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
Hello, World! (^_^) |
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 | |
/** | |
* Повешать плагин на событие OnBeforeDocFormSave | |
* Название любое | |
* meta description в поле description | |
* meta keywords в поле introtext | |
*/ | |
$eventName = $modx->event->name; | |
switch($eventName) { | |
case 'OnBeforeDocFormSave': |
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 | |
/* | |
Plugin Name: Яндекс.ПДС Пингер | |
Plugin URI: http://site.yandex.ru/cms-plugins/ | |
Description: Плагин оповещает сервис Яндекс.Поиск для сайта о новых и измененных документах. | |
Version: 1.5 | |
Author: ООО "ЯНДЕКС" | |
Author URI: http://www.yandex.ru/ | |
License: GPL2 | |
*/ |
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 | |
$eventName = $modx->event->name; | |
switch($eventName) { | |
case 'OnDocFormSave': | |
$templNum = 3;//номер шаблона ресурса для обработки (остальные ресурсы при сохранении обработаны не будут) | |
$tvNum = 'tv2';//номер TV поля с номерами блоков для вывода @var type string | |
$tvNumInt = 2;//номер TV поля с номерами блоков для вывода @var type integer | |
if (($mode == 'new') && (($resource->get('template')) == $templNum) && (!$resource->get($tvNum)) && ($string = $resource->content)) { | |
$search = $modx->getOption('my_search_words');//получаем содержимое системной настройки my_search_words | |
$lang = 'ru_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 | |
/** | |
* Плагин для вывода части микроразметки типа OpenGraph | |
* Выводит в HTML код мета поле с корректным URL картнки. | |
* Принцип работы: если в content текущего ресурса находит хоть одну картинку, | |
* то автоматически выводит её в meta property="og:image" | |
* Если картинки не найдены в тексте, то прицепляет к ресурсу любую жёстко | |
* заданную картинку. Нужен для корректного вывода поста в соц.сетях - с нужной картинкой. | |
*/ | |
$eventName = $modx->event->name; |
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 | |
/** | |
* Парсер для писем или текстовых файлов. | |
* Для записи в базу юзается библиотека http://dklab.ru/lib/DbSimple/manual.html | |
*/ | |
//ini_set('display_errors', 1); | |
//ini_set('error_reporting', -1); | |
require_once "db/lib/config.php"; | |
require_once "db/lib/DbSimple/Generic.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
<script> | |
function resizeImg(){ | |
$( ".slides li img" ).each(function( index, element ){ | |
$( element ).removeAttr("width") | |
.removeAttr("height") | |
.removeAttr("margin-top") | |
.removeAttr("margin-left") | |
.css({ width: "", height: "", "margin-top": "", "margin-left": "" }); |
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 | |
// Add RTE for introtext if richtext option is enabled for the resource | |
// check "OnDocFormRender" event | |
$modx->regClientStartupHTMLBlock('<script>Ext.onReady(function() { | |
if(MODx.loadRTE) MODx.loadRTE("modx-resource-introtext"); | |
});</script>'); |
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 | |
$id = $modx->resource->id; | |
if (!isset($limit)) {$limit = 4;} | |
// Добавляем просмотренный товар MS2 в сессию | |
if ($modx->resource->get('class_key') == 'msProduct') { | |
if (!isset($_SESSION['viewedrecent'])) { | |
$_SESSION['viewedrecent'] = array($id); | |
} | |
else { |
OlderNewer