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 | |
$DOC = 270400; | |
switch($modx->event->name){ | |
case 'OnPageNotFound':{ | |
$brand = ''; | |
$q = explode('/', ltrim($_SERVER['REQUEST_URI'], '/')); | |
if(!isset($modx->motoDocID) && count($q)==2 && isset($q[0],$q[1])){ | |
$motoID = (int)rtrim($q[1],$modx->config['friendly_url_suffix']); | |
if($motoID.$modx->config['friendly_url_suffix'] == $q[1]){ | |
include_once(MODX_BASE_PATH.'assets/lib/modResource.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
<?php | |
function close_tag_html($text) { | |
preg_match_all("/<[^>]*>/", $text, $bal); | |
$liste = array(); | |
foreach($bal[0] as $balise) { | |
if ($balise{1} != "/") { // opening tag | |
preg_match("/<([a-z]+)/i", $balise, $type); | |
// add the tag | |
$liste[] = $type[1]; | |
} else { // closing tag |
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 | |
/** | |
* TagList | |
* | |
* [[TagList? &data=`[*tag*]` &sep=`,` &tpl=`PostTagList` &outSep=`, `]] | |
* | |
* PostTagList: | |
* <a href="/[~11~]?tag=[+encode+]" title="Все статьи с тегом [+tag+]">[+tag+]</a> | |
* | |
* @category snippet |
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 | |
/** | |
* TagPopular | |
* | |
* [[TagPopular? &tpl=`TagCloudItem` &tv=`7` &count=`15`]] | |
* | |
* TagCloudItem: | |
* <a href="/[~11~]?tag=[[urlencode? &input=`[+name+]`]]" title="Статьи с тегом [+name+]" class="label">[+name+] ([+count+])</a> | |
* | |
* @category snippet |
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 | |
/** | |
* PHP: Detect location by IP | |
* http://www.catswhocode.com/blog/10-super-useful-php-snippets-you-probably-havent-seen | |
*/ | |
function detect_city($ip) { | |
$default = 'UNKNOWN'; | |
if (!is_string($ip) || strlen($ip) < 1 || $ip == '127.0.0.1' || $ip == 'localhost') |
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 | |
/** | |
* Protect TV-saver | |
* | |
* @category plugin | |
* @version 0.1 | |
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html | |
* @internal @events OnBeforeDocFormSave | |
* @internal @modx_category Manager and Admin | |
* @author Agel_Nash <Agel_Nash@xaker.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
<?php | |
/** | |
* Include once file | |
* | |
* @category validate | |
* @version 0.1 | |
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html | |
* @param string $file Файл который необходимо подключить в текущей папке | |
* @param boolean $ret Возвращать статус подключения файла или его ответ | |
* @return boolean Результат подключения файла |
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 | |
/** | |
* SEOphpthumb | |
* | |
* @category snippet | |
* @version 1.3 | |
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html | |
* @author Agel_Nash <Agel_Nash@xaker.ru> | |
*/ | |