Skip to content

Instantly share code, notes, and snippets.

View Fi1osof's full-sized avatar

Nikolay Lanets Fi1osof

View GitHub Profile
@Fi1osof
Fi1osof / modcli.php
Created December 29, 2012 21:52 — forked from Mark-H/a readme.md
<?php
/**
* modCLI is a command line interface for MODX Revolution Processors.
*
* It enables you to run any core or third party processor from the command line, passing it options as you go along.
*
* @author Mark Hamstra <hello@markhamstra.com>
* @version 0.1.0-pl, 2012-12-16
* @license GPL v2
*/
@Fi1osof
Fi1osof / gist:4448579
Last active December 10, 2015 14:38
Original modCacheManager::generateContext()
<?php
public function generateContext($key, array $options = array()) {
$results = array();
if (!$this->getOption('transient_context', $options, false)) {
/** @var modContext $obj */
$obj= $this->modx->getObject('modContext', $key, true);
if (is_object($obj) && $obj instanceof modContext && $obj->get('key')) {
$cacheKey = $obj->getCacheKey();
$contextKey = is_object($this->modx->context) ? $this->modx->context->get('key') : $key;
@Fi1osof
Fi1osof / gist:4448846
Created January 4, 2013 00:31
Modified modCacheManager::generateContext()
<?php
public function generateContext($key, array $options = array()) {
$results = array();
$contextConfig= array_merge($this->modx->_systemConfig, $options);
/** @var modContext $obj */
$obj= $this->modx->getObject('modContext', $key, true);
if (is_object($obj) && $obj instanceof modContext && $obj->get('key')) {
@Fi1osof
Fi1osof / gist:4449531
Created January 4, 2013 02:57
DIFF in modCacheManager::generateContext()
<?php
public function generateContext($key, array $options = array()) {
$results = array();
$contextConfig= array_merge($this->modx->_systemConfig, $options);
/** @var modContext $obj */
$obj= $this->modx->getObject('modContext', $key, true);
if (is_object($obj) && $obj instanceof modContext && $obj->get('key')) {
$cacheKey = $obj->getCacheKey();
@Fi1osof
Fi1osof / gist:4449671
Created January 4, 2013 03:27
Manifest
<?php
/**
* Discuss
*
* Copyright 2010-11 by Shaun McCormick <shaun@modx.com>
*
* This file is part of Discuss, a native forum for MODx Revolution.
*
* Discuss is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
@Fi1osof
Fi1osof / gist:4461649
Last active December 10, 2015 16:29
modX::addExtensionPackage(
<?php
public function addExtensionPackage($name,$path,array $options = array()) {
// What is it for?
// $extPackages
// It`s not using
$extPackages = $this->getOption('extension_packages');
$extPackages = !empty($extPackages) ? $extPackages : array();
$extPackages = is_array($extPackages) ? $extPackages : $this->fromJSON($extPackages);
$extPackages[$name] = $options;
$extPackages['path'] = $path;
@Fi1osof
Fi1osof / gist:4479563
Created January 7, 2013 23:24
CustomUser
<?php
class SocietyUser extends modUser {
static function load(xPDO &$xpdo, $className, $criteria, $cacheFlag = true) {
$instance= null;
$fromCache= false;
if ($className= $xpdo->loadClass($className)) {
if (!is_object($criteria)) {
$criteria= $xpdo->getCriteria($className, $criteria, $cacheFlag);
}
<?php
$path = $this->getOption('modsociety.core_path', null);
if(!$path){
$path = MODX_CORE_PATH .'components/modsociety/';
}
$path .= 'model/modSociety/';
if(!$this->loadClass('modSociety', $path, false, true)){
@Fi1osof
Fi1osof / gist:4493453
Last active December 10, 2015 21:09
$modx->runProcessor()
<?php
MODx{
function runProcessor($action = '',$scriptProperties = array(),$options = array()){
if($class = $this->loadProcessorClass($action, $options){
$processor = new $class($scriptProperties,$options);
return $processor->process();
}
return ;
@Fi1osof
Fi1osof / gist:4495700
Created January 9, 2013 18:45
load modBlog
<?php
$path = $this->getOption('modsociety.core_path', null);
if(!$path){
$path = MODX_CORE_PATH .'components/modsociety/';
}
$path .= 'model/modSociety/';
if(!$this->loadClass('modSociety', $path, false, true)){