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
function num2MultipleRus($int){ | |
$str=strval($int); | |
$fin=$str[strlen($str)-1]; | |
if ($fin==1) return 1; | |
elseif ($fin>1 && $fin<5) return 2; | |
elseif ($fin>4) return 3; | |
} |
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
function Translit_iso($str) { | |
$str=strtr($str,"абвгдезиклмнопрстуфцъыь","abvgdeziklmnoprstufс\"y’"); | |
$str=strtr($str,"АБВГДЕЗИКЛМНОПРСТУФЦЪЫЬ", "ABVGDEZIKLMNOPRSTUFС\"Y’"); | |
$str=strtr($str, array( "э"=>"eh", "х"=>"kh", "й"=>"jj", "ё"=>"jo", "ж"=>"zh", "ч"=>"ch", "ш"=>"sh", "щ"=>"shh", "ю"=>"yu", "я"=>"ya", "э"=>"eh", "х"=>"kh", "й"=>"jj", "ё"=>"jo", "ж"=>"zh", "ч"=>"ch", "ш"=>"sh", "щ"=>"shh", "ю"=>"yu", "я"=>"ya", "ї"=>"i", "ї"=>"yi", "є"=>"ie", "є"=>"ye" )); | |
return $str; | |
} | |
function toTranslit($text, $type = 'translit') { | |
$data = explode(" ", $text); | |
if (count($data) == '') { |
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
function win1251_utf8($s){ | |
$t=''; | |
for($i=0, $m=strlen($s); $i<$m; $i++) | |
{ | |
$c=ord($s[$i]); | |
if ($c<=127) {$t.=chr($c); continue; } | |
if ($c>=192 && $c<=207) {$t.=chr(208).chr($c-48); continue; } | |
if ($c>=208 && $c<=239) {$t.=chr(208).chr($c-48); continue; } | |
if ($c>=240 && $c<=255) {$t.=chr(209).chr($c-112); continue; } |
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
class StemmerEnglish{ | |
function pluralize($word) { | |
$pos = strlen($word)-1; | |
// Check last letter | |
switch ($word{$pos}) { | |
case 's': // Maby already plural | |
if ($word{$pos-1} == 's') | |
return $word.'es'; |
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
/** | |
* @return bool|string | |
*/ | |
function detectMobileDevice() { | |
$mobile_browser = false; | |
$user_agent = $_SERVER['HTTP_USER_AGENT']; | |
$accept = $_SERVER['HTTP_ACCEPT']; | |
switch(true) { |
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
function crc16($string, $crc = 0) { | |
for($x = 0; $x < strlen($string); $x++) { | |
$crc = $crc ^ ord($string[$x]); | |
echo $crc . '<br />'; | |
for($y = 0; $y < 8; $y++) { | |
if(($crc & 0x0001) == 0x0001) { | |
$crc = (($crc >> 1) ^ 0x10589); |
NewerOlder