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 | |
// Only run this via SSH | |
if (PHP_SAPI !== 'cli') return; | |
// Sometimes helpful if processing lots of Resources | |
ini_set('memory_limit', '2048M'); | |
// Init @modx | |
@include(dirname(__FILE__) . '/config.core.php'); | |
if (!defined('MODX_CORE_PATH')) define('MODX_CORE_PATH', dirname(__FILE__) . '/core/'); | |
include_once (MODX_CORE_PATH . "model/modx/modx.class.php"); | |
$modx= new modX(); |
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 | |
// Only ssh users can execute | |
if (PHP_SAPI !== 'cli') return; | |
// Comes in handy sometimes | |
ini_set('memory_limit', '2048M'); | |
// Instantiate MODX | |
@include(dirname(__FILE__) . '/config.core.php'); | |
if (!defined('MODX_CORE_PATH')) define('MODX_CORE_PATH', dirname(__FILE__) . '/core/'); | |
include_once (MODX_CORE_PATH . "model/modx/modx.class.php"); | |
$modx= new modX(); |
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 | |
// Only executable via SSH | |
if (PHP_SAPI !== 'cli') exit(); | |
// Instantiate MODX | |
@include(dirname(__FILE__) . '/config.core.php'); | |
if (!defined('MODX_CORE_PATH')) define('MODX_CORE_PATH', dirname(__FILE__) . '/core/'); | |
include_once (MODX_CORE_PATH . "model/modx/modx.class.php"); | |
$modx= new modX(); | |
$modx->initialize('web'); |
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 | |
// Only run via SSH | |
if (PHP_SAPI !== 'cli') exit(); | |
// Instantiate MODX | |
@include(dirname(__FILE__) . '/config.core.php'); | |
if (!defined('MODX_CORE_PATH')) define('MODX_CORE_PATH', dirname(__FILE__) . '/core/'); | |
include_once (MODX_CORE_PATH . "model/modx/modx.class.php"); | |
$modx= new modX(); | |
$modx->initialize('web'); |
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
[ | |
{ | |
"class": "modSnippet", | |
"where": [ | |
{ | |
"name:=": "SomeCustomSnippet" | |
} | |
], | |
"toWhere": "create" | |
}, |
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 | |
/** | |
* getResourcesColumns | |
* @author @sepiariver | |
* | |
* &parent optional ID of Resource from which to fetch children. Defaults to current resource. | |
* &fields optional Resource field(s) from which to fetch values. Defaults to 'pagetitle,longtitle,introtext,parent,hidemenu'. | |
* &columns optional Number of columns to sort Resources into and wrap with colWrapper_n; | |
* &columnDirection optionalVertical or horizontal column sorting. Defaults to horizontal | |
* &depth optional Depth to seek children via getChildIds(). Defaults to 1 |
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 | |
/** | |
* quickList | |
* | |
* Lists Resourcs super fast. Uses code by Garry Nutting of the MODX Core Team. | |
* | |
* @author YJ Tso <[email protected]>, Garry Nutting <[email protected]> | |
* | |
* | |
* quickList is free software; you can redistribute it and/or modify it |
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 | |
$options = $modx->getOption('options', $scriptProperties, $modx->getOption('friendly_alias_restrict_chars_pattern'), true); | |
return $modx->filterPathSegment($input, array('friendly_alias_restrict_chars_pattern' => $options)); |
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 | |
if ($modx->context->get('key') === 'mgr') return; | |
$key = $modx->getOption('key', $scriptProperties, 'my-secret-key'); | |
$val = $modx->getOption('val', $scriptProperties, 'my-secret-value'); | |
switch ($modx->event->name) { | |
case 'OnHandleRequest': | |
if (!$modx->getOption('site_status')) { | |
if ($_GET[$key] === $val) { | |
$modx->config['site_status'] = 1; |
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 | |
$options = (int) $modx->getOption('options', $scriptProperties, 200, true); // 200 words per minute | |
$wordCount = (int) str_word_count(strip_tags($input)); // To display word count set options to 0 | |
if ($options === 0) return $wordCount; | |
return ceil($wordCount / abs($options)); |