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
$string = "ЧелоБрейк"; | |
function string_split_unicode($string, $length = 1) { | |
$tmp = preg_split('~~u', $string, -1, PREG_SPLIT_NO_EMPTY); | |
if ($length > 1) { | |
$chunks = array_chunk($tmp, $length); | |
foreach ($chunks as $i => $chunk) { | |
$chunks[$i] = join('', (array) $chunk); | |
} | |
$tmp = $chunks; | |
} |
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
/** | |
* Замена любых символов в строке на любые другие | |
* | |
* @param [string] $string - входная строка | |
* @param [string] $a - что поменять | |
* @param [string] $b - на что поменять | |
* @return string - строка с замененными символами | |
*/ | |
function simbols_to_simbols($string, $a, $b) { | |
$array = explode($a, $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
/** | |
* Преобразует запись цвета из RGB в HEX. | |
* | |
* @param [string] $dec_color - цвет в десятичном формате 50, 100, 150; | |
* | |
* @return [string] - строка в шестнадцатиричном формате #326496; | |
*/ | |
function decToHex($dec_color) | |
{ | |
$arr_color = explode(', ', $dec_color); |
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
/** | |
* Получение имен файлов и каталогов в заданной дирректории. | |
* | |
* @param [string] $dir - дирректория | |
* @return array | |
*/ | |
function getNamesOfDir($dir) { | |
return array_slice(scandir($dir), 2); | |
} |
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
Tabs: | |
[ | |
{"caption":"Tab Title", "fields": [ | |
{"field":"title","caption":"Name"}, | |
{"field":"description","caption":"Description","inputTVtype":"textarea"}, | |
{"field":"imageTV","caption":"Photo","inputTV":"imageTV"} | |
]} | |
] | |
Table: |
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 | |
/** | |
* Использование буферизации вывода для включения файла PHP в строку. | |
* http://php.net/manual/ru/function.ob-start.php | |
* http://php.net/manual/ru/function.ob-get-clean.php | |
*/ | |
$string = get_include_contents('somefile.php'); | |
function get_include_contents($filename) { | |
if (is_file($filename)) { |
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
https://docs.modx.com/extras/revo/formit | |
https://modx.com/extras/package/formit | |
https://modx.com/extras/package/recaptchav2 | |
// Обработчик формочки перед <form... | |
[[!FormIt? | |
&hooks=`recaptchav2,spam,email,redirect,FormItAutoResponder` | |
&emailTpl=`email-send-tpl` | |
&emailTo=`[[++email]]` |
OlderNewer