|
Ok!
|
|
|
Ok!
|
---|---|---|---|---|
117 | SELECT * FROM news UNION SELECT * FROM news1 WHERE date = \'03.12.2015\' GROUP BY region ORDER BY id DESC | union, mysql | 980 | Объединить в один запрос выборку из двух баз с одинаковой структурой |
253 | $iterator = CIBlockElement::GetList( array("ID"=>"DESC"), array('IBLOCK_ID' => 26, '=ACTIVE' => 'Y', 'IBLOCK_SECTION_ID', ['LOGIC' => 'OR', 'PREVIEW_TEXT' => false, 'DETAIL_TEXT' => false]), false, false, array('ID', 'NAME', 'CODE', 'IBLOCK_SECTION_ID') ); while($item = $iterator->Fetch()) { $was_id = 0; $nav = CIBlockSection::GetNavChain(false, $item['IBLOCK_SECTION_ID'], array(), false); $url = ""; while($nav->Fetch()){ if($was_id != $item['ID']){ $url_length = count($nav->arResult); $url .= $nav->arResult[$url_length - 1]['CODE'] . "/"; echo $item['ID'] . ';"' . $item['NAME'] . '";"https://lamaree.ru/catalog/' . $url . $item['CODE'] . '/"' . " "; $was_id = $item['ID']; } } } | url, bitrix, catalog | 980 | Выбрать из каталога Битрикс товары без описаний с URL |
263 | https://api.wordpress.org/secret-key/1.1/salt/ | ключи, WP | 985 | Сгенерировать ключи Вордпресс |
35 | $page = file_get_contents('http://touch.facebook.com'); $doc = new DOMDocument(); $doc->loadHTML($page); $divs = $doc->getElementsByTagName('div'); foreach($divs as $div) { if ($div->getAttribute('id') === 'content') { echo $div->nodeValue; } } | parse, php, parser | 1000 | Парсер страницы или блока страницы |
216 | /** * @param $limit * @return string|string[] * обрезает контент до числа слов */ function content($limit, $pid = null) { $content = explode(' ', get_the_content($pid), $limit); if (count($content)>=$limit) { array_pop($content); $content = implode(" ",$content).'...'; } else { $content = implode(" ",$content); } $content = preg_replace('/[.+]/','', $content); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); return $content; } | контент, образает, WP | 1001 | обрезает контент до числа слов |
36 | div.wpcf7 .screen-reader-response { color: black!important; background: white; padding: 3em; border: 1px solid rgba(1,1,1,.1); margin: 2em; box-sizing: border-box; width: 500px; position: absolute; } | pre, php | 1004 | PRE php |
61 | <img src="image.svg" onerror="this.onerror=null; this.src='image.png'"> | ошибка картинки, ошибка изображений | 1004 | Обработка ошибки при загрузке изображений |
27 | <?php function Escape_win ($path) { $path = strtoupper ($path); return strtr($path, array("U0430"=>"а", "U0431"=>"б", "U0432"=>"в", "U0433"=>"г", "U0434"=>"д", "U0435"=>"е", "U0451"=>"ё", "U0436"=>"ж", "U0437"=>"з", "U0438"=>"и", "U0439"=>"й", "U043A"=>"к", "U043B"=>"л", "U043C"=>"м", "U043D"=>"н", "U043E"=>"о", "U043F"=>"п", "U0440"=>"р", "U0441"=>"с", "U0442"=>"т", "U0443"=>"у", "U0444"=>"ф", "U0445"=>"х", "U0446"=>"ц", "U0447"=>"ч", "U0448"=>"ш", "U0449"=>"щ", "U044A"=>"ъ", "U044B"=>"ы", "U044C"=>"ь", "U044D"=>"э", "U044E"=>"ю", "U044F"=>"я", "U0410"=>"А", "U0411"=>"Б", "U0412"=>"В", "U0413"=>"Г", "U0414"=>"Д", "U0415"=>"Е", "U0401"=>"Ё", "U0416"=>"Ж", "U0417"=>"З", "U0418"=>"И", "U0419"=>"Й", "U041A"=>"К", "U041B"=>"Л", "U041C"=>"М", "U041D"=>"Н", "U041E"=>"О", "U041F"=>"П", "U0420"=>"Р", "U0421"=>"С", "U0422"=>"Т", "U0423"=>"У", "U0424"=>"Ф", "U0425"=>"Х", "U0426"=>"Ц", "U0427"=>"Ч", "U0428"=>"Ш", "U0429"=>"Щ", "U042A"=>"Ъ", "U042B"=>"Ы", "U042C"=>"Ь", "U042D"=>"Э", "U042E"=>"Ю", "U042F"=>"Я")); } $str = "u0430u043fu044bu0443u043au0435u043f "; print Escape_win ($str); ?> | json, decode | 1030 | Преобразовать в русскоязычные символы |
10 | require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php"); | битрикс пролог, prolog_before | 1040 | Подключение пролога вместо вывода шапки Битрикс |
14 | (in_array($r[1] % 10, array(2, 3, 4)) && $r[1] < 10 ) ? "отзыва" : ($r[1] == 1 ? "отзыв" : "отзывов") | человека, человек | 1050 | PHP выражение для вывода "человека или человек" в зависимости от цифры |
16 | function getCoordinates($address){ $address = urlencode($address); $url = "http://maps.google.com/maps/api/geocode/json?sensor=false&address=" . $address; $response = file_get_contents($url); $json = json_decode($response,true); $lat = $json['results'][0]['geometry']['location']['lat']; $lng = $json['results'][0]['geometry']['location']['lng']; return array($lat, $lng); } | координаты, гугл, php | 1050 | Функция получения координат через Гугл на php |
77 | <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-115977538-1"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-115977538-1'); </script> | gtag, google tagmanager | 1090 | Google Tag Manager |
88 | document.addEventListener("DOMContentLoaded", function(event) { var cl = document.getElementById('#all_otz'); cl.onclick = function(ev) { var post = {}; post['num_otz'] = 20; post['ajax'] = 'y'; node = BX('video_feed_block'); if (!!node) { BX.ajax.post( 'https://www.brtclinic.ru/index.php', post, function (data) { var el = data.getElementById('video_feed_block'); node.innerHTML = el.innerHTML(); } ); } } }); | битрикс, битрикс аякс | 1090 | Битрикс функция вместо jQuery ajax |
115 | RewriteCond %{REQUEST_URI} !^/(catalog/special/action) RewriteCond %{REQUEST_URI} !^/(catalog/special/hit) RewriteCond %{REQUEST_URI} !^/(catalog/special/new) RewriteCond %{REQUEST_URI} ^/catalog/special/(.*)/ RewriteRule ^.*$ /404.php [L] | 404, редирект | 1090 | Редирект на 404 всех из списка кроме указанных |
132 | <body class="<?=array_splice(explode('/', htmlspecialchars($_SERVER['PHP_SELF'])),-2,1)[0]?>"> | класс, класс для body | 1090 | Присвоить тегу body class с названием текущей папки в адресе страницы |
89 | $post = get_post(); $t = strtotime($post->post_modified_gmt); $str = 'Last-Modified: '.gmdate('D, d M Y H:i:s', $t).' GMT'; header('Last-Modified: '.gmdate('D, d M Y H:i:s', $t).' GMT'); | daremodified, wp, php | 1200 | WP date modified php file |
218 | function loadScript(url, callback) { const element = document.createElement("script"); element.type = "text/javascript"; element.src = url; element.onload = callback; document.body.appendChild(element); } loadScript("js/common.js", () => { loadScript("<https://cdn.jsdelivr.net/npm/[email protected]/build/global/luxon.min.js>", () => { console.log("timer.js ") }) }) | loadscript, js | 1200 | Скрипт чтоб загрузить другой скрипт |
18 | Use the "update-ping" mechanism to permanently remove content from the Google AMP Cache after the content has been removed from its origin. For example, to purge content formerly served at https://cdn.ampproject.org/i/s/example.com/favicon.ico, send an update ping request to: https://cdn.ampproject.org/update-ping/i/s/example.com/favicon.ico. Cached content that no longer exists will eventually get removed from the cache; it's just faster to use "update-ping". Google's Remove AMP content "documentation" | amp, удалить, гугл сео | 1234 | Убрать AMP описание удаленной страницы из Гугла |
38 | var thisPageName = $('html').find('title').text(); var addrString = document.URL.split('/').splice(-2,1).toString() var reach = "yaCounter48115721.reachGoal('" + addrString + "'); return true;"; $('form.wpcf7-form').append('<input type="hidden" name="pageUrlFrom" value="' + document.URL + '"/>'); $('form.wpcf7-form').append('<input type="hidden" name="pageNameFrom" value="' + thisPageName + '"/>'); $('form.wpcf7-form').find('input[type="submit"]').attr('onclick', reach); | цель, метрика, добавить цели | 1234 | Яваскрипт, jQuery код добавки события reachGoal в форму сайта с учетом адреса страницы |
65 | br{content:' ';} br:after{content:' ';} | br, пробел, абзац, новая строка | 1270 | CSS заменить тег <br> пробелами. Собрать строку из абзацев. |