Вход Регистрация
Файл: top_reit/rustats.su/system/classes/Protect.class.php
Строк: 35
<?php


class Protect{
    
/**
    * Обработка чисел
    */
    
public static function num($num){
        return (int)
abs($num);
    }
    
    
    
/**
    * Фильтр для заголовков
    */
    
public static function title($check){
        
$check = htmlentities($check, ENT_QUOTES, 'UTF-8');
        
$check = str_replace(array('̏','͓'), null, $check);
        return 
$check;
    }

public static function 
time($time){
        
$timep = date("d/m  H:i:s", $time);
        return 
$timep;
    }
    
/** 
    * Фильтр для текста
    */
    
public static function text($str){
        global 
$Tag;
        
$str = htmlentities($str, ENT_QUOTES, 'UTF-8');
        
$str = nl2br($str);
        
$str = str_replace(array('̏','͓'), null, $str);
        return 
stripslashes($str);
    }
    
    
/**
    * Обрезанный текст
    */
    
public static function rez_text($text, $maxwords = 15){
        if(
mb_strlen($text) > $maxwords){
            
$text = mb_substr($text, 0, $maxwords, 'utf-8');
            
$text = $text.'...';
        }
    return 
$text;
    }
    
    
/**
    * Генерация случайной строки
    */
    
public static function generate($count){
        
$kod = NULL;
        
$arr_1 = range(0, 9);
        
$arr_2 = range('a', 'z');
        
$arr_3 = range('A', 'Z'); 

        
$array = array_merge( $arr_1, $arr_2, $arr_3 );

        for(
$i = 0; $i < $count; $i++) {
            
shuffle($array);
            
$kod .= $array[$i];
        }
        return 
$kod;
    }
}
?>
Онлайн: 4
Реклама