Skip to content

Instantly share code, notes, and snippets.

Avatar

Nikolay Lanets Fi1osof

View GitHub Profile
@Fi1osof
Fi1osof / react
Last active Apr 17, 2018 — forked from koras/react
react
View react
// https://maxfarseer.gitbooks.io/react-course-ru/content/zhiznennii_tsikl_komponenta.html
// https://maxfarseer.gitbooks.io/react-course-ru/content/prodvinutoe_ispolzovanie.html
// https://reactjs.org/docs/faq-ajax.html
import React, { Component } from 'react';
import { Link } from "react-router-dom";
import { promisifyAll } from 'bluebird'
//import ReactDOM from 'react-dom';
import { getWeb3Async } from '../util/web3'
View wp_import.php
<?php
/*
* WP Import, Ver 2015.01.04
* (C) 2015 by ZoRg Soft
* MODx Notes - WP Import модуь для импорта записей из Wordpress
* http://agarkov.org/modx-x/evo-wpimport
*/
$theme = $modx->config['manager_theme'];
$basePath = $modx->config['base_path'];
View breadcrumbs.class.php
<?php
class modSiteWebBreadcrumbsProcessor extends modProcessor{
public function initialize(){
$this->setDefaultProperties(array(
'startId' => 0,
'excludeDocs' => array(),
'showHidden' => true,
'showUnpub' => false,
View gist:8827909
<?php
$q = $modx->newQuery('modResource');
$q->innerJoin('ShopmodxProduct', 'Product');
$q->leftJoin('modTemplateVarResource', 'tv', 'tv.contentid=modResource.id and tv.tmplvarid=29');
$q->where(array(
"tv.id" => null,
));
print $modx->getCount('modResource', $q);
@Fi1osof
Fi1osof / gist:6907324
Created Oct 9, 2013
Создаем таблицы и основные записи для пакета Billing
View gist:6907324
<?php
$manager = $modx->getManager();
// Создаем таблицы
$objects = array(
'Order',
'OrderProduct',
'OrderStatus',
@Fi1osof
Fi1osof / gist:6023918
Last active Dec 19, 2015
Дефолтовый контроллер
View gist:6023918
<?php
$properties = $modx->resource->getOne('Template')->getProperties();
if(!empty($properties['tpl'])){
$tpl = $properties['tpl'];
}
else{
$tpl = 'index.tpl';
}
View gist:5109345
<?php
/**
* Smarty plugin
*
* @package Smarty
* @subpackage PluginsFunction
*/
function smarty_function_processor($params, & $smarty)
@Fi1osof
Fi1osof / gist:5070120
Created Mar 2, 2013
ShopmodxObjectGetListProcessor
View gist:5070120
<?php
abstract class ShopmodxObjectGetListProcessor extends modObjectGetListProcessor{
function prepareQueryBeforeCount(xPDOQuery $c) {
$this->addDerivativeCriteria($c);
return parent::prepareQueryBeforeCount($c);
}
protected function addDerivativeCriteria(xPDOQuery $c){
$this->modx->addDerivativeCriteria($this->classKey, $c);
@Fi1osof
Fi1osof / gist:5062419
Created Mar 1, 2013
OnWebPageComplete stats plugin
View gist:5062419
<?php
$memory = round(memory_get_usage()/1024/1024, 4).' Mb';
print "<div>Memory: {$memory}</div>";
$totalTime= ($modx->getMicroTime() - $modx->startTime);
$queryTime= $modx->queryTime;
$queryTime= sprintf("%2.4f s", $queryTime);
$queries= isset ($modx->executedQueries) ? $modx->executedQueries : 0;
$totalTime= sprintf("%2.4f s", $totalTime);
@Fi1osof
Fi1osof / gist:4986826
Last active Dec 13, 2015
MODX Revolution. Плагин, позволяющий определять, какие дочерние документы показывать или нет. Просто создайте плагин на событие OnManagerPageInit и пропишите в нем свои правила resourcesRules
View gist:4986826
<?php
switch($modx->event->name){
case 'OnManagerPageInit':
$JS = <<<JS
<script type="text/javascript">
Ext.onReady(function(){
// Получаем дерево
var tree = Ext.getCmp('modx-resource-tree');
You can’t perform that action at this time.