|
Ok!
|
|
|
Ok!
|
---|---|---|---|---|
231 | $scheme = CMain::IsHTTPS() ? "https" : "http"; | https, bitrix | 9090 | Определить https в Битрикс |
230 | grep двух слов в строке grep '77.50.63.90' lamaree.ru.access.log | grep '.default/ajax.php' | grep, 2 words | 10080 | Поиск двух слов в строке через grep linux |
229 | define('BX_COMP_MANAGED_CACHE', true); | кэш, битрикс, сбросить | 1390 | Учет кэширования в Битрикс и моментальные изменения после исправлений. Добавить в dbconn |
228 | new Date().toLocaleString('en-CA').substr(0,10) | дата, JS, date | 100 | Дата в Javascript ГГГГ-ММ-ДД |
227 | const numbers = [1, 2, 3]; const doubled = numbers.map(x => x * 2); // [2, 4, 6] | map, js | 19800 | Метод map в javascript |
226 | var player = {score: 1, name: 'Jeff'}; var newPlayer = Object.assign({}, player, {score: 2}); // or var newPlayer = {...player, score: 2}; | create new object, js | 100300 | Создать новый объект из старого в Javascript |
225 | <a href="https://api.whatsapp.com/send?phone=79269946796" target="_blank" class="header__social-link" data-menu-exit> | wa, whatsapp | 200 | |
224 | ₽ | рубль, html | 100500 | символ рубля в html |
223 | public function convertImage(&$content) { if (defined('ADMIN_SECTION') || defined('WIZARD_SITE_ID')) { return; } preg_match_all('/"(/upload/[^"]*.(jpg|jpeg|png))"/i', $content, $matches1); self::convertImageToWebp($content, $matches1); preg_match_all("/'(/upload/[^']*.(jpg|jpeg|png))'/i", $content, $matches2); self::convertImageToWebp($content, $matches2); } private static function convertImageToWebp(&$content, $matches) { if (!empty($matches[1])) { foreach ($matches[1] as $i => $imageUrl) { $root = $_SERVER['DOCUMENT_ROOT']; $type = $matches[2][$i]; $newName = str_replace($type, 'webp', $imageUrl); if (file_exists($root . $newName)) { $content = str_replace($imageUrl, $newName, $content); continue; } if (!file_exists($root . $imageUrl)) { continue; } $type = strtolower($type); switch ($type) { case 'jpeg': case 'jpg': $img = imagecreatefromjpeg($root . $imageUrl); break; case 'png': $img = imagecreatefrompng($root . $imageUrl); imagepalettetotruecolor($img); imagealphablending($img, true); imagesavealpha($img, true); break; } if (isset($img)) { $result = imagewebp($img, $root . $newName, 75); if (!$result) { continue; } $content = str_replace($imageUrl, $newName, $content); imagedestroy($img); unset($img); } } } } | bitrix, webp, convert | 20030 | convert image to webp bitrix |
222 | echo <<<EOH ---------- ----------- -- ---------- результат значение оп тест ---------- ----------- -- ---------- EOH; | eoh, php print formated | 12090 | Форматированная строка в PHP |