Вход Регистрация
Файл: adultscript-2.0.3-pro/files/libraries/framework/functions.php
Строк: 60
<?php
defined
('_VALID') or die('Restricted Access!');
function 
prepare_string($string, $url=FALSE, $limit=FALSE)
{
    if (
$limit !== FALSE) {
        
$string = VText::truncate_chars($string, $limit, '', TRUE);
    }

    
$ascii    = (utf8_is_ascii($string)) ? TRUE : FALSE;
    
$regex    = ($ascii === TRUE) ? '/[^A-Za-z0-9 ]+/' : '/[^pLpNpZs]+/u';

    
$string    = preg_replace($regex, ' ', $string);
    
$string    = preg_replace('/ss+/', ' ', $string);
    
$string = preg_replace('/--+/', '-', $string);
    
$string    = ($ascii === TRUE) ? trim($string) : utf8_trim($string);
        
    if (
$url === TRUE) {
        if (
$ascii === TRUE) {
            
$string    = strtolower($string);
        } else {
            
$string    = utf8_strtolower($string);
            
$string    = utf8_replace_accents($string);
        }
        
        
$string    = str_replace(' ', '-', $string);
    }
    
    return 
$string;
}

function 
prepare_tags($string) {
    
$ascii    = (utf8_is_ascii($string)) ? TRUE : FALSE;
    
$regex    = ($ascii === TRUE) ? '/[^A-Za-z0-9, ]+/' : '/[^pLpNpZ,s]+/u';

    
$string    = preg_replace($regex, ' ', trim($string));
    
$string = preg_replace('/--+/', '-', $string);
    
$string    = preg_replace('/ss+/', ' ', $string);
    
    return (
$ascii === TRUE) ? strtolower(trim($string)) : utf8_strtolower(utf8_trim($string));
}

function 
path($video_id)
{
    return 
implode('/', str_split(sprintf('%09d', $video_id), 3));
}

if (
version_compare(PHP_VERSION, '5.2.3', '>=')) {
    function 
e($string) {
        return 
htmlspecialchars((string) $string, ENT_QUOTES, 'UTF-8', FALSE);
    }
} else {
    function 
e($string) {
        return 
htmlspecialchars(htmlspecialchars_decode((string) $string, ENT_QUOTES), ENT_QUOTES, 'UTF-8');
    }
}
Онлайн: 2
Реклама