This file contains hidden or 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 rdate($format, $timestamp = null, $case = 0) | |
{ | |
if ($timestamp === null) | |
$timestamp = time(); | |
static $loc = | |
'Январ,ь,я,е,ю,ём,е | |
Феврал,ь,я,е,ю,ём,е |
This file contains hidden or 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 IBlock | |
{ | |
static function GetSQLTypeByPropType($propType) | |
{ | |
static $sqlTypeByPropType = array( | |
'G' => 'INT', | |
'S' => 'CHAR(255)', | |
'N' => 'INT', |
This file contains hidden or 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 | |
// | |
// | |
// Porter's Stemming inside edition v. 1.0 | |
// thx: Vovan-VE | |
// | |
define('RVRE', '/^((?:пере|обез|обес|недо|пред|противо)*.*?[аеиоуыэюя])(.*)$/u'); | |
define('PERFECTIVEGROUND', '/(ив|ивши|ившись|ыв|ывши|ывшись|вшись|авший|авшое|авшись|явшись|авши|явши)$/u'); | |
define('REFLEXIVE', '/(ь?с[яь])$/u'); |
This file contains hidden or 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 | |
/** | |
* Возвращает строку с случайными буквами английского алфавита и цифрами установленной длины | |
* @param int $lenght Необходимая длина | |
*/ | |
function rand_string($lenght = 32) | |
{ | |
$N = 1 + (int)($lenght / 30); | |
for ($i = 0; $i < $N; $i++) |
This file contains hidden or 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 | |
/** | |
* Меняет местами значения и ключи для не-ассоциативных ключей | |
* @param array $ar Входной массив | |
* @param bool $keepValue Оставить ли в качестве значений перевернутой части числовые ключи? | |
* @param string $replacementValue Если $keepValue = false, то данный параметр задаёт новые значения для перевернутой части массива | |
* return array Выходной массив | |
*/ | |
function array_num_flip($ar, $keepValue = false, $replacementValue = '') |
This file contains hidden or 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 | |
/** | |
* @param array $ar Фильтруемый массив | |
* @param string $callback Имя функции-фильтра | |
* return array Результирующий массив | |
*/ | |
function array_filter_key($ar, $callback = 'empty') | |
{ | |
$ar = (array)$ar; |
This file contains hidden or 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 | |
define('TABLE_SORT_ASC', 0); | |
define('TABLE_SORT_DESC', 1); | |
/** | |
* Сортирует массив по ключу который может лежать глубоко внутри | |
* @param array $data Массив который нужно отсортировать | |
* @param string $sortpath Путь к значению по которому должна вестись сортировка | |
*/ |
This file contains hidden or 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 | |
echo untemplate('Привет, #WHO#!', array('WHO' => 'Мир')); // Привет, Мир! |
This file contains hidden or 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 | |
/** | |
* Получает имя файла относительно корня сайта | |
* @param string $syspath Полное имя файла | |
*/ | |
function syspath($webpath) | |
{ | |
return preg_match('~^('.$_SERVER['DOCUMENT_ROOT'].')~', $webpath) ? $webpath : $_SERVER['DOCUMENT_ROOT'].$webpath; | |
} |
This file contains hidden or 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 pt($data, $openTree = true, $maxLevel = 0, $path = array()) | |
{ | |
$level = count($path); | |
static $id = 0; | |
if ( $level == 0 ) | |
$id++; | |
?> |
OlderNewer