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
    
  
  
    
  | //проверка наличия ключа в массиве | |
| var arr = [1,2,3,4,5,6,7,8,9]; | |
| if(3 in arr) alert("Элемент с ключём 3 присутствует в массиве"); | |
| if(!(15 in arr)) alert("Элемента с ключём 15 нет в массиве"); | |
| //проверка наличия значения в массиве | 
  
    
      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 if ($_SERVER['REQUEST_URI'] == "/") { ?> | |
| html код будет показан только на главной странице | |
| <?php } else {?> | |
| html код будет показан только на всех страницах, кроме главной | |
| <?php } ?> | |
| <?php /* для профиля пользователя */ | |
| if(preg_match('/^\/users\/([a-zA-z0-9\.]+)$/i', $_SERVER['REQUEST_URI'])){ ?> | |
| <?php } ?> | 
  
    
      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
    
  
  
    
  | UPDATE cms_geo_regions SET name='Крым и Севастополь', country_id = '3159' WHERE id = 10227; | |
| UPDATE cms_geo_cities SET country_id = '3159' WHERE region_id = 10227; | |
| UPDATE cms_geo_cities SET name = 'Гусь-Хрустальный' WHERE id = 3451; | |
| INSERT INTO `cms_geo_cities` (`country_id`, `region_id`, `name`) VALUES ('3159', '3784', 'Весьегонск'); | |
| INSERT INTO `cms_geo_cities` (`country_id`, `region_id`, `name`) VALUES ('3159', '5191', 'Лермонтов'); | |
| INSERT INTO `cms_geo_cities` (`country_id`, `region_id`, `name`) VALUES ('3159', '4861', 'Новомичуринск'); | |
| INSERT INTO `cms_geo_cities` (`country_id`, `region_id`, `name`) VALUES ('3159', '3827', 'Городовиковск'); | |
| INSERT INTO `cms_geo_cities` (`country_id`, `region_id`, `name`) VALUES ('3159', '3827', 'Лагань'); | |
| INSERT INTO `cms_geo_cities` (`country_id`, `region_id`, `name`) VALUES ('3159', '3296', 'Межгорье'); | 
  
    
      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 | |
| //пример модуля, который не будет скрываться на страницах с роутами: | |
| // /maps/events/edit([0-9]+).html - эти маршруты можно взять из файла router.php нужного компонента | |
| // /maps/events/([0-9]+)/add.html | |
| function mod_maps_events_slider($module_id) { | |
| //выходим если это страница добавления и редактирования события объекта | |
| if(preg_match('/^\/maps\/events\/edit([0-9]+).html$/i', $_SERVER['REQUEST_URI'])){ return false; } | |
| if(preg_match('/^\/maps\/events\/([0-9]+)\/add.html$/i', $_SERVER['REQUEST_URI'])){ return false; } | 
  
    
      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
    
  
  
    
  | //for test | |
| ini_set("display_errors","1"); | |
| ini_set("display_startup_errors","1"); | |
| ini_set('error_reporting', E_ALL); | 
  
    
      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
    
  
  
    
  | function video_2html($elem) { | |
| $str = '<div class="bb_tag_video">'; | |
| foreach ($elem['val'] as $item) { | |
| if ($item['type']=='item') { continue; } | |
| $item['str'] = preg_replace('/<iframe.*>.+<\/iframe>/iu', '', $item['str']); | |
| $str .= strip_tags($item['str'], '<iframe><object><param><embed>'); | |
| } | |
| $str .= '</div>'; | |
| return cmsCore::htmlCleanUp($str); | |
| } | 
NewerOlder