Вход Регистрация
Файл: core/autoload/FileSystem.class.php
Строк: 47
<?

class FileSystem {
    
    static function 
DirClear($dir = false, $timeex = 0, $countinue = false, $ext = '*') {
        
$FileList = false;
        if (
file_exists($dir)) {
            foreach (
glob($dir . $ext) as $file) {
                
$FileInfo = basename($file);
                
$f = false;
                if (
is_array($countinue)) {
                    foreach (
$countinue AS $p){
                        if (
$p == $FileInfo) {
                            
$f = true;
                        }
                    }
                }
                if (
filectime($file) >= time() - $timeex or $f) {
                    continue;
                }
                
$FileList[] = $FileInfo;
                
unlink($file);
            }
        }
        return 
$FileList;
    }
    
//Подсчёт числа символов
    
static function TextStrlen($text = false) {
        return 
mb_strlen($text, 'UTF-8');
    }
    
//Обрезка текста по числу символов
    
static function TextCut($string = null, $num = 30, $type = 1)    {
        if (
$string == null) {
            return 
null;
        }
        if (
$type == 1)    {
            
$string = output($string,'html','BBcodesClear');
        }
        
$string = mb_strlen($string,"UTF-8") > $num ?  mb_substr($string, 0, $num, "UTF-8") ."…" : $string;  
        return 
$string;
    }    
    
//Число слов в тексте
    
static function TextWordCount($text = false, $type = false, $charlist = false) {
        if (!
$charlist) {
            
$charlist = 'АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя';
        }
        echo 
str_word_count($text,$type,$charlist);
    }
}
Онлайн: 0
Реклама