Skip to content

Instantly share code, notes, and snippets.

View pavel-one's full-sized avatar

Pavel Zarubin pavel-one

View GitHub Profile
<?php
$installPackages = array(
'sdStore'
, 'translit'
, 'SanitizeUpload'
, 'TinyMCE'
, 'FormIt'
, 'Analytics'
, 'Big Brother'
@pavel-one
pavel-one / getCartAjax.php
Created April 18, 2018 11:12
Переделанная корзина minishop2 для запроса по ajax {'!getCartAjax' | snippet | json_encode}
<?php
/** @var modX $modx */
/** @var array $scriptProperties */
/** @var miniShop2 $miniShop2 */
$miniShop2 = $modx->getService('miniShop2');
$miniShop2->initialize($modx->context->key);
/** @var pdoFetch $pdoFetch */
if (!$modx->loadClass('pdofetch', MODX_CORE_PATH . 'components/pdotools/model/pdotools/', false, true)) {
return false;
}
@pavel-one
pavel-one / getCartAjax.php
Created April 18, 2018 11:13
Переделанная миникорзина для запроса по ajax
<?php
/** @var modX $modx */
/** @var array $scriptProperties */
/** @var miniShop2 $miniShop2 */
$miniShop2 = $modx->getService('miniShop2');
$miniShop2->initialize($modx->context->key);
/** @var pdoFetch $pdoFetch */
if (!$modx->loadClass('pdofetch', MODX_CORE_PATH . 'components/pdotools/model/pdotools/', false, true)) {
return false;
}
@pavel-one
pavel-one / calendar.tpl
Created April 20, 2018 01:56
Вывод выше текущей даты
{'!pdoResources' | snippet: [
'parents' => 53,
'limit' => 10,
'includeTVs' => 'eventDate, eventImage, eventPrice',
'depth' => 5,
'sortby' => 'eventDate',
'sortdir' => 'ASC',
'tvPrefix' => '',
'tpl' => '@FILE tpl/latestEvent.tpl',
'showLog' => 0,
@pavel-one
pavel-one / preloader.js
Created April 23, 2018 23:54
preloader
function preloader(show) {
var template = '<div class="preloader" style="position: fixed;width: 100%;height: 100%;background: rgba(255,255,255,0.45);top: 0;left: 0;z-index: 99999;display: flex;justify-content: center;align-items: center;"><img src="preloader.svg"><div>';
if (show) {
$(template).appendTo('body');
return;
}
$(document).find('.preloader').remove();
}
@pavel-one
pavel-one / resVideoGal
Created April 26, 2018 23:43
pdoResources
{'!pdoResources' | snippet: [
'class' => 'RvgVideos',
'sortby' => 'rank',
'limit' => 0,
'tpl' => '@FILE pdo/videoItem.tpl'
]}
<?php
$arr = explode(' ', $input);
$month = $arr[1];
$trans = array("January" => "января",
"February" => "февраля",
"March" => "марта",
"April" => "апреля",
"May" => "мая",
"June" => "июня",
<?php
$trans = array("Monday" => "Понедельник",
"Tuesday" => "Вторник",
"Wednesday" => "Среда",
"Thursday" => "Четверг",
"Friday" => "Пятница",
"Saturday" => "Суббота",
"Sunday" => "Воскресенье"
);
@pavel-one
pavel-one / api.php
Created April 28, 2018 12:55 — forked from but1head/api.php
мини рест для modx на slim
<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
require '........../autoload.php'; // путь к композеру
define('MODX_API_MODE', true);
require $_SERVER["DOCUMENT_ROOT"].'/index.php';
@pavel-one
pavel-one / plugin.php
Created April 30, 2018 16:01
MODX Extjs Интересные методы
<?php
$eventName = $modx->event->name;
switch($eventName) {
case 'OnDocFormPrerender':
// Для ресурсов с индетификатором шаблона 2
// а также для всех новых ресурсов ( $resource == null )
if( $resource && $resource->get('template') == 2 || !$resource){
$modx->regClientStartupHTMLBlock('<script>
Ext.onReady(function() {