This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function ad($array, $index) | |
{ | |
return array_key_exists($index, $array) ? $array[$index] : null; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class url_var | |
{ | |
/** | |
* encode variable for url | |
* @param $var | |
* @return string | |
*/ | |
static function enc($var) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function str_implode_wrapped($before, $after, $array, $glue = '') | |
{ | |
return $before.implode($after.$glue.$before, $array).$after; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function translit($cyr_str) | |
{ | |
return strtr($cyr_str, array( | |
'Ґ'=> 'G', 'Ё'=> 'Yo', 'Є'=> 'E', 'Ї'=> 'Yi', 'І'=> 'I', 'і'=> 'i', 'ґ'=> 'g', 'ё'=> 'yo', '№'=> '#', 'є'=> 'e', | |
'ї'=> 'yi', 'А'=> 'A', 'Б'=> 'B', 'В'=> 'V', 'Г'=> 'G', 'Д'=> 'D', 'Е'=> 'E', 'Ж'=> 'Zh', 'З'=> 'Z', 'И'=> 'I', | |
'Й'=> 'Y', 'К'=> 'K', 'Л'=> 'L', 'М'=> 'M', 'Н'=> 'N', 'О'=> 'O', 'П'=> 'P', 'Р'=> 'R', 'С'=> 'S', 'Т'=> 'T', | |
'У'=> 'U', 'Ф'=> 'F', 'Х'=> 'H', 'Ц'=> 'Ts', 'Ч'=> 'Ch', 'Ш'=> 'Sh', 'Щ'=> 'Sch', 'Ъ'=> '`', 'Ы'=> 'Yi', 'Ь'=> '', | |
'Э'=> 'E', 'Ю'=> 'Yu', 'Я'=> 'Ya', 'а'=> 'a', 'б'=> 'b', 'в'=> 'v', 'г'=> 'g', 'д'=> 'd', 'е'=> 'e', 'ж'=> 'zh', | |
'з'=> 'z', 'и'=> 'i', 'й'=> 'y', 'к'=> 'k', 'л'=> 'l', 'м'=> 'm', 'н'=> 'n', 'о'=> 'o', 'п'=> 'p', 'р'=> 'r', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function str_is_email($email) | |
{ | |
return (bool)filter_var($email, FILTER_VALIDATE_EMAIL); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function str_is_match($pattern, $string) | |
{ | |
$array = null; | |
$res = preg_match_all('('.$pattern.')', $string, $array); | |
return !(($res === false) or ($res == 0) or ($res > 1) or ($array[0][0] != $string)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ru2en = | |
{ | |
ru_str : "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя", | |
en_str : ['A','B','V','G','D','E','JO','ZH','Z','I','J','K','L','M','N','O','P','R','S','T', | |
'U','F','H','C','Ch','Sh','Shh',String.fromCharCode(35),'I',String.fromCharCode(39),'Je','Ju', | |
'Ja','a','b','v','g','d','e','jo','zh','z','i','j','k','l','m','n','o','p','r','s','t','u','f', | |
'h','c','ch','sh','shh',String.fromCharCode(35),'i',String.fromCharCode(39),'je','ju','ja'], | |
translit : function(org_str) | |
{ | |
var tmp_str = ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class mime_type | |
{ | |
static function url_mime_type($url) | |
{ | |
$finfo = new \finfo(FILEINFO_MIME_TYPE); | |
return $finfo->buffer(file_get_contents($url)); | |
}; | |
static function file_mime_type($file_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function download_file($url, $newfname) | |
{ | |
if (($file = fopen($url, 'rb'))) | |
if (($newf = fopen($newfname, 'wb'))) | |
while (!feof($file)) | |
fwrite($newf, fread($file, 8192), 8192); | |
if ($file) | |
fclose($file); | |
if (isset($newf)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function mail($to, $person, $subject, $message, $from_name, $from_mail) | |
{ | |
$headers = 'MIME-Version: 1.0'."\r\n"; | |
$headers .= 'Content-type: text/html; charset=utf-8'."\r\n"; | |
$headers .= 'To: '.$person.' <'.$to.'>'."\r\n"; | |
$headers .= 'From: '.$from_name.' <'.$from_mail.'>'."\r\n"; | |
return mail($to, $subject, $message, $headers); | |
} |
OlderNewer