|
Ok!
|
|
|
Ok!
|
---|---|---|---|---|
1 | function rus2translit($string) { $converter = array( 'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'e', 'ж' => 'zh', 'з' => 'z', 'и' => 'i', 'й' => 'y', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'sch', 'ь' => 'j', 'ы' => 'y', 'ъ' => 'j', 'э' => 'e', 'ю' => 'yu', 'я' => 'ya', 'А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G', 'Д' => 'D', 'Е' => 'E', 'Ё' => 'E', 'Ж' => 'Zh', 'З' => 'Z', 'И' => 'I', 'Й' => 'Y', 'К' => 'K', 'Л' => 'L', 'М' => 'M', 'Н' => 'N', 'О' => 'O', 'П' => 'P', 'Р' => 'R', 'С' => 'S', 'Т' => 'T', 'У' => 'U', 'Ф' => 'F', 'Х' => 'H', 'Ц' => 'C', 'Ч' => 'Ch', 'Ш' => 'Sh', 'Щ' => 'Sch', 'Ь' => 'j', 'Ы' => 'Y', 'Ъ' => 'j', 'Э' => 'E', 'Ю' => 'Yu', 'Я' => 'Ya', ' ' => '_', '№' => 'No' ); return strtr($string, $converter); } function str2url($str) { $str = rus2translit($str); $str = strtolower($str); $str = preg_replace('~[^-a-z0-9_]+~u', '-', $str); $str = trim($str, "-"); return $str; } | translit, транслит, php | 0 | Транслит |
23 | $mySignatureValue = md5("$nOutSum:$nInvId:$mrh_pass1:shpdate=$shpdate:shpphone=$shpphone:shppin=$shppin:shptime=$shptime"); | signature value, robokassa | 0 | Строка signature value для платежей через Робокассу |
24 | $rs_Section = CIBlockSection::GetList( array('DEPTH_LEVEL' => 'desc'), $ar_Filter, false, array('ID', 'NAME', 'IBLOCK_SECTION_ID', 'DEPTH_LEVEL', 'SORT') ); $ar_SectionList = array(); $ar_DepthLavel = array(); while($ar_Section = $rs_Section->GetNext(true, false)) { $ar_SectionList[$ar_Section['ID']] = $ar_Section; $ar_DepthLavel[] = $ar_Section['DEPTH_LEVEL']; } $ar_DepthLavelResult = array_unique($ar_DepthLavel); rsort($ar_DepthLavelResult); $i_MaxDepthLevel = $ar_DepthLavelResult[0]; for( $i = $i_MaxDepthLevel; $i > 1; $i-- ) { foreach ( $ar_SectionList as $i_SectionID => $ar_Value ) { if( $ar_Value['DEPTH_LEVEL'] == $i ) { $ar_SectionList[$ar_Value['IBLOCK_SECTION_ID']]['SUB_SECTION'][] = $ar_Value; unset( $ar_SectionList[$i_SectionID] ); } } } function __sectionSort($a, $b) { if ($a['SORT'] == $b['SORT']) { return 0; } return ($a['SORT'] < $b['SORT']) ? -1 : 1; } usort($ar_SectionList, "__sectionSort"); | битрикс, массив, перебор | 0 | Перебор массива Битрикс в виде дерева |
29 | @media all and (min-width: 1001px) { #sidebar ul li a:after { content: " (" attr(data-email) ")"; font-size: 11px; font-style: italic; color: #666; } } | media, content | 0 | Текст тега из атрибуте data-* |
32 | function find_closed() { var tr = $('tr'); if($('#searchfield').val() != "") { for (var i = 0; i < tr.length; i++) { if (tr.eq(i).text().toLowerCase().indexOf($('#searchfield').val().toLowerCase()) > -1) { tr.eq(i).addClass('opened'); /*tr.eq(i).css({'background': '#A8E9FF'});*/ var found = 1; }else{ tr.eq(i).removeClass('opened'); } } if (found < 1) { $('.not-found').text('Не найдено') } } } | javascript, поиск в таблице | 0 | JS функция ищет соответствие в словах скрытых строк таблицы. Если найдет — открывает строку, нет — закрывает |
47 | ' for ' " for " | замена кавычек, кавычки, quotes | 0 | Замена для кавычек в php |
49 | $fp = fopen('tovary.xml',"r"); $arr = file_get_contents('tovary.xml'); $gruops = []; fclose($fp); #[2] => Окрашивание волос #[33] => Перманентная краска $details['category'] = "Перманентная краска"; $s = new SimpleXMLElement($arr); $groups = []; foreach($s->Классификатор->Группы->Группа as $g) { $naim = $g->Наименование; $tid = $g->Ид; $groups[] = [ $tid[0] . "", $naim[0] . "" ]; foreach ( $g->Группы->Группа as $gr_parent ) { $naim = $gr_parent->Наименование; $tid = $gr_parent->Ид; $groups[] = [ $tid[0] . "", $naim[0] . "" ]; } } foreach($groups as $gr){ if($gr[1] == $details['category']){ echo $gr[0]; } } | битрикс, парсинг, xml, товары, каталог | 0 | Парсить группы (категории) товаров в xml экспорте товаров Битрикс |
86 | RewriteCond %{HTTPS} off RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{HTTP_HOST} !^www. [NC] RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | https, www | 0 | Любой редирект на https + www |
103 | $data = preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $data); var_dump(unserialize($data)); | replace, serialized | 0 | recalculating the length of the elements in serialized array |
104 | width: expression(((document.documentElement.clientWidth || document.body.clientWidth) < 1050)? "1050px" : "100%"); | expression, css | 0 | Применение expression в css |