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)); |
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 | |
// The Resource ID to test | |
$id = (int) $modx->getOption('id', $scriptProperties, $modx->resource->get('id'), true); | |
// Option to return early if Current Resource matches $id | |
$matchCurrent = $modx->getOption('matchCurrent', $scriptProperties, true); | |
// IDs of Resources deemed as "sections", against which to test | |
$sectionIds = array_filter(array_map('trim', explode(',', $modx->getOption('sectionIds', $scriptProperties, '')))); | |
// IDs of parent Resources, the direct children of which will be added to $sectionIds | |
$sectionParentIds = array_filter(array_map('trim', explode(',', $modx->getOption('sectionParentIds', $scriptProperties, '')))); | |
// If the test passes, meaning the Resource has a $sectionId as an ancestor, output this |
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 | |
// In case the wrong event is enabled | |
if ($modx->context->key !== 'mgr' || $modx->event->name !== 'OnDocFormSave') return; | |
// We really need a resource object and the pthumb snippet | |
if (!is_object($resource) || $modx->getCount('modSnippet', array('name' => 'phpthumbof')) !== 1) { | |
$modx->log(modX::LOG_LEVEL_ERROR, 'ResourceImageThumbnails plugin requires phpthumbof and a valid resource object.'); | |
return; | |
} |
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 | |
/* | |
* DateToTimestamp Plugin for MODX Revolution | |
* @code @theboxer | |
* @comments @sepiariver | |
* | |
* DateToTimestamp 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 | |
* Foundation; either version 2 of the License, or (at your option) any later | |
* version. |
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
# Add content types for fonts | |
AddType application/x-font-ttf .ttf | |
AddType application/x-font-opentype .otf | |
AddType application/x-font-woff .woff | |
ExpiresActive On | |
ExpiresByType image/gif A2592000 | |
ExpiresByType image/jpeg A2592000 | |
ExpiresByType image/png A2592000 | |
ExpiresByType image/x-icon A2592000 |