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 | |
/* | |
* API для Я.Маркет плейсмаркета | |
* by [email protected] / andronex | |
* интеграция от 12 т.р. | |
*/ | |
//шлём заголовки | |
header('Access-Control-Allow-Origin: *'); | |
header('Content-type: application/json; charset=utf-8'); |
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 | |
$eventName = $modx->event->name; | |
switch($eventName) { | |
case 'pdoToolsOnFenomInit': | |
$fenom->addModifier('lazy', function ($html) use ($modx) { | |
libxml_use_internal_errors(true); | |
$dom = new DOMDocument(); | |
$dom->loadHTML('<?xml encoding="utf-8" ?>' . (string)$html); | |
$output = $html; | |
//img |
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 mSearch2 = {}, | |
selectorFilter = '.js-filter', | |
selectorInput = selectorFilter+' input', | |
selectorClear = selectorFilter+' .js-filter-clean', | |
selectorExe = selectorFilter+' .js-execute', | |
selectorToggle = selectorFilter+' .js-filter-toggle', | |
selectorFormWrap = selectorFilter+' .js-filter-form-wrap', | |
selectorRows = '.js-rows'; | |
mSearch2.Hash = { | |
get: function() { |
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
#!/bin/bash | |
#запускать скрипт каждую ночь | |
/usr/bin/mysql -pПАРОЛЬ -uЛОГИН ИМЯ_БД <<EOF | |
DELETE FROM modx_session WHERE access <UNIX_TIMESTAMP(DATE_SUB(now(), INTERVAL 4 DAY)); #удалять записи старше 4-х дней | |
OPTIMIZE TABLE modx_session; | |
EOF |
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 | |
/* | |
0346745008178 | |
Should fail - checksum should be 9 | |
5060096384137 | |
Should pass | |
5020650002112 |
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 | |
/* | |
* вызов {$_modx->runSnippet('@FILE snippets/get_all_cities.php', ['split' => 'А-Б,Г-Д,Е-Ж,З-И,Ш-Щ,Ф-Х'])} | |
* split - объединение букв для вывода городов | |
* шаблон вывода вшит в скрипт (при желании можно сделать параметром) | |
* название настройки контекста, содержащее название города, вшито в скрипт (при желании можно сделать параметром) | |
*/ | |
$query = $modx->newQuery('modContext'); | |
$query->leftJoin('modContextSetting', 'ContextSettings'); | |
$query->where(array( |
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 | |
/* | |
* используется компонент TVTable | |
*/ | |
$criteria = array(); | |
$criteria['modTemplateVarResource.tmplvarid'] = 18; | |
$criteria['modTemplateVarResource.value:!='] = ''; | |
$criteria['Resource.template:IN'] = array(9,10); | |
$criteria = $modx->newQuery('modTemplateVarResource', $criteria); | |
$tvrs = $modx->getCollectionGraph('modTemplateVarResource','{"Resource":{}}', $criteria); |
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 | |
$eventName = $modx->event->name; | |
switch($eventName) { | |
case 'OnDocFormPrerender': | |
$script = ' | |
if (MODx.loadRTE && Ext.getCmp(\'modx-resource-introtext\')) { | |
MODx.loadRTE(\'modx-resource-introtext\'); | |
} | |
'; | |
$modx->controller->addHtml('<script> |
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 | |
$is_admin = false; | |
switch ($modx->event->name) { | |
case 'OnWebPageInit': | |
if($modx->user->isAuthenticated('web')){ | |
$is_admin = true; | |
} | |
if ($is_admin) { | |
//Устанавливаем ключ для кэша версии для админа | |
$modx->setOption('cache_resource_key', 'resource/is_admin'); |
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
/* | |
* USE | |
* <script src="https://html2canvas.hertzen.com/dist/html2canvas.min.js"></script> | |
* <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.debug.js" integrity="sha384-NaWTHo/8YCBYJ59830LTz/P4aQZK1sS0SneOgAvhsIl3zBu8r9RevNg5lHCHAuQ/" crossorigin="anonymous"></script> | |
* <script src="https://mozilla.github.io/pdf.js/build/pdf.js"></script> | |
* and Library https://github.com/CodeSeven/toastr for open modal messages | |
*/ | |
/****** this in up to code page ******/ | |
var SERT_PDF = [], |