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 | |
$modx->addPackage('colorsProducts', MODX_CORE_PATH . 'components/colorsProducts/model/'); | |
$url = 'https://ral.ru/classic_colours'; | |
$options = array( | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_HEADER => false, | |
CURLOPT_FOLLOWLOCATION => false, | |
CURLOPT_ENCODING => "", | |
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17", |
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
DirectoryIndex index.php | |
RewriteEngine On | |
RewriteBase / | |
# Rewrite www.example.com -> example.com | |
RewriteCond %{HTTP_HOST} . | |
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC] | |
RewriteRule ^(.*)$ https://%1/$1 [R=301,L] | |
# Force rewrite to https for every host |
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 to add a "created by" field on a resource form and moves "published on" to document tab | |
* | |
* @var modX $modx | |
* @var array $scriptProperties | |
* | |
* @event OnDocFormPrerender | |
*/ | |
$dateFormat = $modx->getOption('manager_date_format',null,'d.m.Y'); |
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
#!/bin/bash | |
a=`ps ax|grep 3310|grep -v grep|wc -l` | |
echo $a | |
if (( "$a" < 1 )); then | |
/usr/bin/docker start 21ab17aeab7b | |
fi |
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 | |
/* | |
* на основе статьи https://pocketadmin.tech/ru/%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D0%B0-%D1%81-4-%D0%B2%D0%B5%D1%80%D1%81%D0%B8%D0%B5%D0%B9-api-google-%D1%82%D0%B0%D0%B1%D0%BB%D0%B8%D1%86%D1%8B-%D0%BD%D0%B0-php/ | |
* библиотека wget https://github.com/googleapis/google-api-php-client/releases/download/v2.7.2/google-api-php-client-v2.7.2-PHP7.0.zip | |
* номер ячейки, из которой следует брать остатки товара, указывается в TV поле товара | |
* остатки записываются в другое TV поле (при желании можно записать хоть куда) | |
*/ | |
if (!isset($modx)) { | |
define('MODX_API_MODE', true); | |
while (!isset($modx) && ($i = isset($i) ? --$i : 10)) { |
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 | |
//настройки для коннекта к portobello.ru | |
$portobelloUrlTree = 'https://portobello.ru/export/new-products.xml'; //весь каталог товаров | |
$portobelloUrlStock = 'https://portobello.ru/export/new-products-quantity.xml'; //наличие товаров | |
//настройки для парсинга и установки шаблонов для создаваемых продуктов | |
$fileProductGroups = dirname(__FILE__).'/portobello_groups.txt'; | |
$fileCatExist = dirname(__FILE__).'/portobello_category_exist.txt'; | |
//настройки для обработки товаров |
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 | |
/* | |
* API для Я.Маркет плейсмаркета | |
* by i.modx@ya.ru / andronex | |
* интеграция от 12 т.р. | |
*/ | |
//шлём заголовки | |
header('Access-Control-Allow-Origin: *'); | |
header('Content-type: application/json; charset=utf-8'); |
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 '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 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 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 |