/Functions.php
PHP | 353 lines | 237 code | 15 blank | 101 comment | 3 complexity | 8ce277b3210b07be6d41025b41507993 MD5 | raw file
- <?php
-
- /*function utf8_chr($dec)
- {
- if ($dec < 128)
- return chr($dec);
-
- if ($dec < 2048)
- return chr(($dec >> 6) + 192) . chr(($dec & 63) + 128);
-
- if ($dec < 65536)
- return chr(($dec >> 12) + 224) . chr((($dec >> 6) & 63) + 128) . chr(($dec & 63) + 128);
-
- if ($dec < 2097152)
- return chr(($dec >> 18) + 240) . chr((($dec >> 12) & 63) + 128) . chr((($dec >> 6) & 63) + 128) . chr(($dec & 63) + 128);
-
- return '';
- }
-
- function utf8_ord($str)
- {
- if (ord($str{0}) >= 0 && ord($str{0}) <= 127)
- return ord($str{0});
-
- if (ord($str{0}) >= 192 && ord($str{0}) <= 223)
- return (ord($str{0})-192)*64 + (ord($str{1})-128);
-
- if (ord($str{0}) >= 224 && ord($str{0}) <= 239)
- return (ord($str{0})-224)*4096 + (ord($str{1})-128)*64 + (ord($str{2})-128);
-
- if (ord($str{0}) >= 240 && ord($str{0}) <= 247)
- return (ord($str{0})-240)*262144 + (ord($str{1})-128)*4096 + (ord($str{2})-128)*64 + (ord($str{3})-128);
-
- if (ord($str{0}) >= 248 && ord($str{0}) <= 251)
- return (ord($str{0})-248)*16777216 + (ord($str{1})-128)*262144 + (ord($str{2})-128)*4096 + (ord($str{3})-128)*64 + (ord($str{4})-128);
-
- if (ord($str{0}) >= 252 && ord($str{0}) <= 253)
- return (ord($str{0})-252)*1073741824 + (ord($str{1})-128)*16777216 + (ord($str{2})-128)*262144 + (ord($str{3})-128)*4096 + (ord($str{4})-128)*64 + (ord($str{5})-128);
-
- if (ord($str{0}) >= 254 && ord($str{0}) <= 255) //error
- return false;
-
- return 0;
- }
-
- function utf8_decode_entities($str)
- {
- $str = preg_replace_callback('~&#x([0-9a-f]+);~i', 'utf8_hexchr_callback', $str);
- $str = preg_replace_callback('~&#([0-9]+);~', 'utf8_chr_callback', $str);
-
- return $str;
- }
-
- function utf8_chr_callback($matches)
- {
- return utf8_chr($matches[1]);
- }
-
- function utf8_hexchr_callback($matches)
- {
- return utf8_chr(hexdec($matches[1]));
- }
-
- function utf8_convert_encoding ($str, $to, $from = NULL)
- {
- mb_substitute_character('none');
- return mb_convert_encoding($str, $to, $from);
- }*/
-
- /**
- * @param string $value
- * @param int $rounds
- *
- * @return string
- */
- function hashMake($value, $rounds = 10)
- {
- $work_rounds = str_pad($rounds, 2, '0', STR_PAD_LEFT);
-
- $salt = substr(str_shuffle(str_repeat('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 5)), 0, 40);
- $salt = substr(strtr(base64_encode($salt), '+', '.'), 0 , 22);
-
- return crypt($value, '$2a$' . $work_rounds . '$' . $salt);
- }
-
- /**
- * @param string $value
- * @param string $hash
- *
- * @return boolean
- */
- function hashCheck($value, $hash)
- {
- return crypt($value, $hash) === $hash;
- }
-
- /**
- * @param string $path
- *
- * @return string
- */
- function pathToURL ($path)
- {
- return str_replace(array(FILE_PATH, DS, '\\'), array(FILE_PATH_URL, '/', '/'), $path);
- }
-
- /**
- * @param string $path
- *
- * @return string
- */
- function URLToPath ($path)
- {
- return str_replace(array(FILE_PATH_URL, '/'), array(FILE_PATH, DS), $path);
- }
-
- /**
- * @param string $str
- *
- * @return string
- */
- function romanize ($str)
- {
- $romanize = array
- (
- // Lower accents
- 'à'=>'a','ô'=>'o','?'=>'d','?'=>'f','ë'=>'e','š'=>'s','?'=>'o','ß'=>'ss','?'=>'a','?'=>'r',
- '?'=>'t','?'=>'n','?'=>'a','?'=>'k','?'=>'s','?'=>'y','?'=>'n','?'=>'l','?'=>'h','?'=>'p',
- 'ó'=>'o','ú'=>'u','?'=>'e','é'=>'e','ç'=>'c','?'=>'w','?'=>'c','õ'=>'o','?'=>'s','ø'=>'o',
- '?'=>'g','?'=>'t','?'=>'s','?'=>'e','?'=>'c','?'=>'s','î'=>'i','?'=>'u','?'=>'c','?'=>'e',
- '?'=>'w','?'=>'t','?'=>'u','?'=>'c','ö'=>'oe','è'=>'e','?'=>'y','?'=>'a','?'=>'l','?'=>'u',
- '?'=>'u','?'=>'s','?'=>'g','?'=>'l','ƒ'=>'f','ž'=>'z','?'=>'w','?'=>'b','å'=>'a','ì'=>'i',
- 'ï'=>'i','?'=>'d','?'=>'t','?'=>'r','ä'=>'ae','í'=>'i','?'=>'r','ê'=>'e','ü'=>'ue','ò'=>'o',
- '?'=>'e','ñ'=>'n','?'=>'n','?'=>'h','?'=>'g','?'=>'d','?'=>'j','ÿ'=>'y','?'=>'u','?'=>'u',
- '?'=>'u','?'=>'t','ý'=>'y','?'=>'o','â'=>'a','?'=>'l','?'=>'w','?'=>'z','?'=>'i','ã'=>'a',
- '?'=>'g','?'=>'m','?'=>'o','?'=>'i','ù'=>'u','?'=>'i','?'=>'z','á'=>'a','û'=>'u','þ'=>'th',
- 'ð'=>'dh','æ'=>'ae','µ'=>'u','?'=>'e',
-
- // Upper accents
- 'À'=>'A','Ô'=>'O','?'=>'D','?'=>'F','Ë'=>'E','Š'=>'S','?'=>'O','?'=>'A','?'=>'R','?'=>'T',
- '?'=>'N','?'=>'A','?'=>'K','?'=>'S','?'=>'Y','?'=>'N','?'=>'L','?'=>'H','?'=>'P','Ó'=>'O',
- 'Ú'=>'U','?'=>'E','É'=>'E','Ç'=>'C','?'=>'W','?'=>'C','Õ'=>'O','?'=>'S','Ø'=>'O','?'=>'G',
- '?'=>'T','?'=>'S','?'=>'E','?'=>'C','?'=>'S','Î'=>'I','?'=>'U','?'=>'C','?'=>'E','?'=>'W',
- '?'=>'T','?'=>'U','?'=>'C','Ö'=>'Oe','È'=>'E','?'=>'Y','?'=>'A','?'=>'L','?'=>'U','?'=>'U',
- '?'=>'S','?'=>'G','?'=>'L','?'=>'F','Ž'=>'Z','?'=>'W','?'=>'B','Å'=>'A','Ì'=>'I','Ï'=>'I',
- '?'=>'D','?'=>'T','?'=>'R','Ä'=>'Ae','Í'=>'I','?'=>'R','Ê'=>'E','Ü'=>'Ue','Ò'=>'O','?'=>'E',
- 'Ñ'=>'N','?'=>'N','?'=>'H','?'=>'G','?'=>'D','?'=>'J','Ÿ'=>'Y','?'=>'U','?'=>'U','?'=>'U',
- '?'=>'T','Ý'=>'Y','?'=>'O','Â'=>'A','?'=>'L','?'=>'W','?'=>'Z','?'=>'I','Ã'=>'A','?'=>'G',
- '?'=>'M','?'=>'O','?'=>'I','Ù'=>'U','?'=>'I','?'=>'Z','Á'=>'A','Û'=>'U','Þ'=>'Th','Ð'=>'Dh',
- 'Æ'=>'Ae','?'=>'E',
-
- // Russian cyrillic
- '?'=>'a','?'=>'A','?'=>'b','?'=>'B','?'=>'v','?'=>'V','?'=>'g','?'=>'G','?'=>'d','?'=>'D',
- '?'=>'e','?'=>'E','?'=>'jo','?'=>'Jo','?'=>'zh','?'=>'Zh','?'=>'z','?'=>'Z','?'=>'i','?'=>'I',
- '?'=>'j','?'=>'J','?'=>'k','?'=>'K','?'=>'l','?'=>'L','?'=>'m','?'=>'M','?'=>'n','?'=>'N',
- '?'=>'o','?'=>'O','?'=>'p','?'=>'P','?'=>'r','?'=>'R','?'=>'s','?'=>'S','?'=>'t','?'=>'T',
- '?'=>'u','?'=>'U','?'=>'f','?'=>'F','?'=>'x','?'=>'X','?'=>'c','?'=>'C','?'=>'ch','?'=>'Ch',
- '?'=>'sh','?'=>'Sh','?'=>'sch','?'=>'Sch','?'=>'','?'=>'','?'=>'y','?'=>'Y','?'=>'','?'=>'',
- '?'=>'eh','?'=>'Eh','?'=>'ju','?'=>'Ju','?'=>'ja','?'=>'Ja',
-
- // Ukrainian cyrillic
- '?'=>'Gh','?'=>'gh','?'=>'Je','?'=>'je','?'=>'I','?'=>'i','?'=>'Ji','?'=>'ji',
-
- // Georgian
- '?'=>'a','?'=>'b','?'=>'g','?'=>'d','?'=>'e','?'=>'v','?'=>'z','?'=>'th','?'=>'i','?'=>'p',
- '?'=>'l','?'=>'m','?'=>'n','?'=>'o','?'=>'p','?'=>'zh','?'=>'r','?'=>'s','?'=>'t','?'=>'u',
- '?'=>'ph','?'=>'kh','?'=>'gh','?'=>'q','?'=>'sh','?'=>'ch','?'=>'c','?'=>'dh','?'=>'w','?'=>'j',
- '?'=>'x','?'=>'jh','?'=>'xh',
-
- // Sanskrit
- '?'=>'a','?'=>'ah','?'=>'i','?'=>'ih','?'=>'u','?'=>'uh','?'=>'ry','?'=>'ryh','?'=>'ly','?'=>'lyh',
- '?'=>'e','?'=>'ay','?'=>'o','?'=>'aw','??'=>'amh','??'=>'aq','?'=>'k','?'=>'kh','?'=>'g','?'=>'gh',
- '?'=>'nh','?'=>'c','?'=>'ch','?'=>'j','?'=>'jh','?'=>'ny','?'=>'tq','?'=>'tqh','?'=>'dq','?'=>'dqh',
- '?'=>'nq','?'=>'t','?'=>'th','?'=>'d','?'=>'dh','?'=>'n','?'=>'p','?'=>'ph','?'=>'b','?'=>'bh',
- '?'=>'m','?'=>'z','?'=>'r','?'=>'l','?'=>'v','?'=>'sh','?'=>'sqh','?'=>'s','?'=>'x',
-
- // Hebrew
- '?'=>'a', '?'=>'b','?'=>'g','?'=>'d','?'=>'h','?'=>'v','?'=>'z','?'=>'kh','?'=>'th','?'=>'y',
- '?'=>'h','?'=>'k','?'=>'l','?'=>'m','?'=>'m','?'=>'n','?'=>'n','?'=>'s','?'=>'ah','?'=>'f',
- '?'=>'p','?'=>'c','?'=>'c','?'=>'q','?'=>'r','?'=>'sh','?'=>'t',
-
- // Arabic
- '?'=>'a','?'=>'b','?'=>'t','?'=>'th','?'=>'g','?'=>'xh','?'=>'x','?'=>'d','?'=>'dh','?'=>'r',
- '?'=>'z','?'=>'s','?'=>'sh','?'=>'s\'','?'=>'d\'','?'=>'t\'','?'=>'z\'','?'=>'y','?'=>'gh',
- '?'=>'f','?'=>'q','?'=>'k','?'=>'l','?'=>'m','?'=>'n','?'=>'x\'','?'=>'u','?'=>'i',
-
- // Japanese hiragana
- '?'=>'a','?'=>'e','?'=>'i','?'=>'o','?'=>'u','?'=>'ba','?'=>'be','?'=>'bi','?'=>'bo','?'=>'bu',
- '?'=>'ci','?'=>'da','?'=>'de','?'=>'di','?'=>'do','?'=>'du','??'=>'fa','??'=>'fe','??'=>'fi','??'=>'fo',
- '?'=>'fu','?'=>'ga','?'=>'ge','?'=>'gi','?'=>'go','?'=>'gu','?'=>'ha','?'=>'he','?'=>'hi','?'=>'ho',
- '?'=>'hu','??'=>'ja','??'=>'je','?'=>'ji','??'=>'jo','??'=>'ju','?'=>'ka','?'=>'ke','?'=>'ki','?'=>'ko',
- '?'=>'ku','?'=>'la','?'=>'le','?'=>'li','?'=>'lo','?'=>'lu','?'=>'ma','?'=>'me','?'=>'mi','?'=>'mo',
- '?'=>'mu','?'=>'na','?'=>'ne','?'=>'ni','?'=>'no','?'=>'nu','?'=>'pa','?'=>'pe','?'=>'pi','?'=>'po',
- '?'=>'pu','?'=>'ra','?'=>'re','?'=>'ri','?'=>'ro','?'=>'ru','?'=>'sa','?'=>'se','?'=>'si','?'=>'so',
- '?'=>'su','?'=>'ta','?'=>'te','?'=>'ti','?'=>'to','?'=>'tu','??'=>'va','??'=>'ve','??'=>'vi','??'=>'vo',
- '?'=>'vu','?'=>'wa','??'=>'we','??'=>'wi','?'=>'wo','?'=>'ya','??'=>'ye','?'=>'yi','?'=>'yo','?'=>'yu',
- '?'=>'za','?'=>'ze','?'=>'zi','?'=>'zo','?'=>'zu','??'=>'bya','??'=>'bye','??'=>'byi','??'=>'byo','??'=>'byu',
- '??'=>'cha','??'=>'che','?'=>'chi','??'=>'cho','??'=>'chu','??'=>'cya','??'=>'cye','??'=>'cyi','??'=>'cyo',
- '??'=>'cyu','??'=>'dha','??'=>'dhe','??'=>'dhi','??'=>'dho','??'=>'dhu','??'=>'dwa','??'=>'dwe','??'=>'dwi',
- '??'=>'dwo','??'=>'dwu','??'=>'dya','??'=>'dye','??'=>'dyi','??'=>'dyo','??'=>'dyu','?'=>'dzi','??'=>'fwa',
- '??'=>'fwe','??'=>'fwi','??'=>'fwo','??'=>'fwu','??'=>'fya','??'=>'fye','??'=>'fyi','??'=>'fyo','??'=>'fyu',
- '??'=>'gya','??'=>'gye','??'=>'gyi','??'=>'gyo','??'=>'gyu','??'=>'hya','??'=>'hye','??'=>'hyi','??'=>'hyo',
- '??'=>'hyu','??'=>'jya','??'=>'jye','??'=>'jyi','??'=>'jyo','??'=>'jyu','??'=>'kya','??'=>'kye','??'=>'kyi',
- '??'=>'kyo','??'=>'kyu','??'=>'lya','??'=>'lye','??'=>'lyi','??'=>'lyo','??'=>'lyu','??'=>'mya','??'=>'mye',
- '??'=>'myi','??'=>'myo','??'=>'myu','?'=>'n','??'=>'nya','??'=>'nye','??'=>'nyi','??'=>'nyo','??'=>'nyu',
- '??'=>'pya','??'=>'pye','??'=>'pyi','??'=>'pyo','??'=>'pyu','??'=>'rya','??'=>'rye','??'=>'ryi','??'=>'ryo',
- '??'=>'ryu','??'=>'sha','??'=>'she','?'=>'shi','??'=>'sho','??'=>'shu','??'=>'swa','??'=>'swe','??'=>'swi',
- '??'=>'swo','??'=>'swu','??'=>'sya','??'=>'sye','??'=>'syi','??'=>'syo','??'=>'syu','??'=>'tha','??'=>'the',
- '??'=>'thi','??'=>'tho','??'=>'thu','??'=>'tsa','??'=>'tse','??'=>'tsi','??'=>'tso','?'=>'tsu','??'=>'twa',
- '??'=>'twe','??'=>'twi','??'=>'two','??'=>'twu','??'=>'tya','??'=>'tye','??'=>'tyi','??'=>'tyo','??'=>'tyu',
- '??'=>'vya','??'=>'vye','??'=>'vyi','??'=>'vyo','??'=>'vyu','??'=>'wha','??'=>'whe','??'=>'whi','??'=>'who',
- '??'=>'whu','?'=>'wye','?'=>'wyi','??'=>'zha','??'=>'zhe','??'=>'zhi','??'=>'zho','??'=>'zhu','??'=>'zya',
- '??'=>'zye','??'=>'zyi','??'=>'zyo','??'=>'zyu',
-
- // Japanese katakana
- '?'=>'a','?'=>'e','?'=>'i','?'=>'o','?'=>'u','?'=>'ba','?'=>'be','?'=>'bi','?'=>'bo','?'=>'bu',
- '?'=>'ci','?'=>'da','?'=>'de','?'=>'di','?'=>'do','?'=>'du','??'=>'fa','??'=>'fe','??'=>'fi','??'=>'fo',
- '?'=>'fu','?'=>'ga','?'=>'ge','?'=>'gi','?'=>'go','?'=>'gu','?'=>'ha','?'=>'he','?'=>'hi','?'=>'ho',
- '?'=>'hu','??'=>'ja','??'=>'je','?'=>'ji','??'=>'jo','??'=>'ju','?'=>'ka','?'=>'ke','?'=>'ki','?'=>'ko',
- '?'=>'ku','?'=>'la','?'=>'le','?'=>'li','?'=>'lo','?'=>'lu','?'=>'ma','?'=>'me','?'=>'mi','?'=>'mo',
- '?'=>'mu','?'=>'na','?'=>'ne','?'=>'ni','?'=>'no','?'=>'nu','?'=>'pa','?'=>'pe','?'=>'pi','?'=>'po',
- '?'=>'pu','?'=>'ra','?'=>'re','?'=>'ri','?'=>'ro','?'=>'ru','?'=>'sa','?'=>'se','?'=>'si','?'=>'so',
- '?'=>'su','?'=>'ta','?'=>'te','?'=>'ti','?'=>'to','?'=>'tu','??'=>'va','??'=>'ve','??'=>'vi','??'=>'vo',
- '?'=>'vu','?'=>'wa','??'=>'we','??'=>'wi','?'=>'wo','?'=>'ya','??'=>'ye','?'=>'yi','?'=>'yo','?'=>'yu',
- '?'=>'za','?'=>'ze','?'=>'zi','?'=>'zo','?'=>'zu','??'=>'bya','??'=>'bye','??'=>'byi','??'=>'byo',
- '??'=>'byu','??'=>'cha','??'=>'che','?'=>'chi','??'=>'cho','??'=>'chu','??'=>'cya','??'=>'cye','??'=>'cyi',
- '??'=>'cyo','??'=>'cyu','??'=>'dha','??'=>'dhe','??'=>'dhi','??'=>'dho','??'=>'dhu','??'=>'dwa','??'=>'dwe',
- '??'=>'dwi','??'=>'dwo','??'=>'dwu','??'=>'dya','??'=>'dye','??'=>'dyi','??'=>'dyo','??'=>'dyu','?'=>'dzi',
- '??'=>'fwa','??'=>'fwe','??'=>'fwi','??'=>'fwo','??'=>'fwu','??'=>'fya','??'=>'fye','??'=>'fyi','??'=>'fyo',
- '??'=>'fyu','??'=>'gya','??'=>'gye','??'=>'gyi','??'=>'gyo','??'=>'gyu','??'=>'hya','??'=>'hye','??'=>'hyi',
- '??'=>'hyo','??'=>'hyu','??'=>'jya','??'=>'jye','??'=>'jyi','??'=>'jyo','??'=>'jyu','??'=>'kya','??'=>'kye',
- '??'=>'kyi','??'=>'kyo','??'=>'kyu','??'=>'lya','??'=>'lye','??'=>'lyi','??'=>'lyo','??'=>'lyu','??'=>'mya',
- '??'=>'mye','??'=>'myi','??'=>'myo','??'=>'myu','?'=>'n','??'=>'nya','??'=>'nye','??'=>'nyi','??'=>'nyo',
- '??'=>'nyu','??'=>'pya','??'=>'pye','??'=>'pyi','??'=>'pyo','??'=>'pyu','??'=>'rya','??'=>'rye','??'=>'ryi',
- '??'=>'ryo','??'=>'ryu','??'=>'sha','??'=>'she','?'=>'shi','??'=>'sho','??'=>'shu','??'=>'swa','??'=>'swe',
- '??'=>'swi','??'=>'swo','??'=>'swu','??'=>'sya','??'=>'sye','??'=>'syi','??'=>'syo','??'=>'syu','??'=>'tha',
- '??'=>'the','??'=>'thi','??'=>'tho','??'=>'thu','??'=>'tsa','??'=>'tse','??'=>'tsi','??'=>'tso','?'=>'tsu',
- '??'=>'twa','??'=>'twe','??'=>'twi','??'=>'two','??'=>'twu','??'=>'tya','??'=>'tye','??'=>'tyi','??'=>'tyo',
- '??'=>'tyu','??'=>'vya','??'=>'vye','??'=>'vyi','??'=>'vyo','??'=>'vyu','??'=>'wha','??'=>'whe','??'=>'whi',
- '??'=>'who','??'=>'whu','?'=>'wye','?'=>'wyi','??'=>'zha','??'=>'zhe','??'=>'zhi','??'=>'zho','??'=>'zhu',
- '??'=>'zya','??'=>'zye','??'=>'zyi','??'=>'zyo','??'=>'zyu',
-
- // Greek
- '?'=>'G','?'=>'E','?'=>'Th','?'=>'L','?'=>'X','?'=>'P','?'=>'S','?'=>'F','?'=>'Ps','?'=>'g',
- '?'=>'e','?'=>'th','?'=>'l','?'=>'x','?'=>'p','?'=>'s','?'=>'f','?'=>'ps',
-
- // Thai
- '?'=>'k','?'=>'kh','?'=>'kh','?'=>'kh','?'=>'kh','?'=>'kh','?'=>'ng','?'=>'ch','?'=>'ch','?'=>'ch',
- '?'=>'s','?'=>'ch','?'=>'y','?'=>'d','?'=>'t','?'=>'th','?'=>'d','?'=>'th','?'=>'n','?'=>'d',
- '?'=>'t','?'=>'th','?'=>'th','?'=>'th','?'=>'n','?'=>'b','?'=>'p','?'=>'ph','?'=>'f','?'=>'ph',
- '?'=>'f','?'=>'ph','?'=>'m','?'=>'y','?'=>'r','?'=>'rue','??'=>'rue','?'=>'l','?'=>'lue','??'=>'lue',
- '?'=>'w','?'=>'s','?'=>'s','?'=>'s','?'=>'h','?'=>'l','?'=>'h','?'=>'a','–?'=>'a','??'=>'a','?'=>'a',
- '??'=>'an','?'=>'am','–?'=>'i','–?'=>'i','–?'=>'ue','–?'=>'ue','–?'=>'u','–?'=>'u','??'=>'e',
- '?–?'=>'e','?'=>'e','??'=>'ae','?'=>'ae','??'=>'o','?'=>'o','???'=>'o','?'=>'o','???'=>'oe','?–?'=>'oe',
- '??'=>'oe','?–???'=>'ia','?–??'=>'ia','?–???'=>'uea','?–??'=>'uea','–???'=>'ua','–??'=>'ua',
- '?'=>'ua','?'=>'ai','?'=>'ai','–??'=>'ai','??'=>'ai','??'=>'ai','??'=>'ao','??'=>'ao','–??'=>'ui',
- '??'=>'oi','??'=>'oi','??'=>'oei','?–???'=>'ueai','??'=>'uai','–??'=>'io','?–??'=>'eo','??'=>'eo',
- '?–??'=>'aeo','??'=>'aeo','?–???'=>'iao',
-
- // Korean
- '?'=>'k','?'=>'kh','?'=>'kk','?'=>'t','?'=>'th','?'=>'tt','?'=>'p','?'=>'ph','?'=>'pp','?'=>'c','?'=>'ch',
- '?'=>'cc','?'=>'s','?'=>'ss','?'=>'h','?'=>'ng','?'=>'n','?'=>'l','?'=>'m', '?'=>'a','?'=>'e','?'=>'o',
- '?'=>'wu','?'=>'u','?'=>'i','?'=>'ay','?'=>'ey','?'=>'oy','?'=>'wa','?'=>'we','?'=>'wi','?'=>'way',
- '?'=>'wey','?'=>'uy','?'=>'ya','?'=>'ye','?'=>'oy','?'=>'yu','?'=>'yay','?'=>'yey'
- );
- return strtr($str, $romanize);
- }
-
- /*function utf8_ucfirst($str)
- {
- $str = mb_strtoupper(mb_substr($str, 0, 1)) . mb_substr($str, 1);
- return $str;
- }*/
-
- // ?????????? ?????? ? ???????? + _
- /**
- * @param string $str
- *
- * @return string
- */
- function standardize ($str)
- {
- return standardize_unicode(romanize($str));
- }
-
- // ?????????? ?????? ? ?????? + ?????? + _
- /**
- * @param string $str
- *
- * @return string
- */
- function standardize_unicode ($str)
- {
- $pattern = array('#[- \\/+\.,:;=]#iu', '#[^\p{L}\p{Nd}_]+#iu');
- $replace = array('_', '');
-
- $str = preg_replace($pattern, $replace, $str);
-
- return mb_strtolower(trim($str));
- }
-
- /**
- * @param string $first
- * @param string $second
- *
- * @return integer
- */
- function PicturesSort ($first, $second)
- {
- $first_date = \DateTime::createFromFormat('d.m.Y:H.i.s', $first['create_date'] . ':00.00.00');
- $second_date = \DateTime::createFromFormat('d.m.Y:H.i.s', $second['create_date'] . ':00.00.00');
-
- if ($first_date == $second_date)
- {
- return 0;
- }
- return ($first_date > $second_date) ? -1 : 1;
- }
-
- /**
- * @param string $string
- * @param string $delimiter
- *
- * @return array
- */
- function stringToArray ($string, $delimiter = ',')
- {
- $array = explode($delimiter, $string);
-
- foreach ($array as &$item) { $item = trim($item); }
- unset($item);
-
- return $array;
- }
-
- /**
- * @param $array
- * @param string $delimiter
- *
- * @return string
- */
- function arrayToString (array $array, $delimiter = ', ')
- {
- $string = '';
-
- if ($array)
- {
- $last_item = array_pop($array);
- foreach ($array as $item) { $string .= $item . $delimiter; }
- $string .= $last_item;
- }
- return $string;
- }