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
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); | |
} |
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
//for test | |
ini_set("display_errors","1"); | |
ini_set("display_startup_errors","1"); | |
ini_set('error_reporting', E_ALL); |
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 | |
//пример модуля, который не будет скрываться на страницах с роутами: | |
// /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 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 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 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 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_blog_posts p, cms_hits h | |
SET h.owner_id = p.blog_id | |
WHERE h.target_id = p.id AND h.target = 'blogpost' | |
--расстояние до геоточек | |
--еще нужна функция MYSQL - позже добавлю | |
SET @src := Point('56.85479147340446','60.59969435180665'); | |
SELECT i.*, DATE_FORMAT(i.pubdate, '%H:%i') as ftime, c.title as category, c.marker as marker, c.zoom as zoom , geodist(X(@src), Y(@src), i.lat, i.lng) AS distantion FROM cms_map_cats c, cms_map_items i WHERE i.published = 1 AND ((i.category_id = c.id) AND (c.NSLeft>=3 AND c.NSRight<=4)) AND (i.city_id = '5106') | |
GROUP BY i.id |
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 | |
$cats_full = $model->getCategories(); | |
if(!$cats_full) { return false; } | |
foreach ($cats_full as $cat) { | |
$cats[] = $cat; | |
$nsl[] = $cat['NSLeft']; | |
$ord[] = $cat['ordering']; | |
} |
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 | |
header("Content-type: text/csv"); | |
header("Content-Disposition: attachment; filename=file.csv"); | |
header("Pragma: no-cache"); | |
header("Expires: 0"); | |
$array = array( // данные которые мы будем выводить в csv файл | |
0 => array('Nikolay','nikolay@email.ru'), | |
1 => array('Maria', 'maria@email.ru') | |
); |
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
$cena=str_replace(",",'.',$cena); | |
$cena=preg_replace("/[^x\d|*\.]/","",$cena); |
OlderNewer