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 | |
/** | |
* getImgSizeFromUrl snippet for MODX | |
* Retrieves the height and width of an image from a remote url | |
* | |
* example usage: [[!getImgSizeFromUrl? &url='https://path/to/myimg.jpg' &tpl=`myTpl`]] | |
* placeholders to use in the myTpl chunk are [[+height]]] and [[+width]] | |
* | |
* @author Jon Leverrier ([email protected]) | |
* @version 1.0 |
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 | |
/** | |
* getResourceThumbnails snippet | |
* Searches inside the tv_posttype field, and pulls out images | |
* for use in Open Graph tags. | |
* If the resource is a default resource, it displays the default | |
* Open Graph image from ClientConfig | |
* | |
* | |
* @author Jon Leverrier ([email protected]) |
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 | |
/** | |
* isAnon snippet | |
* returns the value 1 if the user is anonymous (not logged into the manager) | |
* | |
* example usage: [[!isAnon:is=`1`:then=``:else=`i'm not logged in`]] | |
* | |
* @author Jon Leverrier ([email protected]) | |
* @version 1.0 | |
* @since 10th December 2017 |
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 | |
/** | |
* isAdmin snippet | |
* returns the value 1 if the user is an administrator | |
* | |
* example usage: [[!isAdmin:is=`1`:then=`i'm an admin`:else=`i'm just a content editor`]] | |
* | |
* @author Jon Leverrier ([email protected]) | |
* @version 1.0 | |
* @since 10th December 2017 |
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 | |
/** | |
* minifyHTML Plugin for MODX | |
* Based on the PHPWee PHP Minifier class | |
* | |
* This plugin uses a forked version of PHPWee PHP Minifier | |
* which has been patched and updated | |
* | |
* For more info see; | |
* https://github.com/ashucg/phpwee-php-minifier |
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
// folder selector for content blocks | |
// put this snippet inside a field setting with the field type of "select" | |
// get current resource id | |
$id = (!empty($id) ? $id : $modx->resource->get('id')); | |
// get current context key | |
// if $resourceid isn't a resource object, it will fallback to web | |
if ($resourceid = $modx->getObject('modResource', $id)) { |
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 | |
/** | |
* Content Blocks cbContentEditor Plugin | |
* | |
* This plugin hides certain CB buttons from certain MODX user groups | |
* and disables the drag and drop functionality, so that you can provide | |
* some clients with a more locked down version of CB. | |
* | |
* I would suggest setting up CB templates and defaults in the CB component manager, | |
* so that predefined layouts are loaded automatically when a new resource is created. |
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 | |
$contexts = $modx->getCollection('modContext', array('key:!=' => 'mgr')); | |
foreach($contexts as $context) | |
{ | |
$context_keys[] = $context->get('key'); | |
} | |
return implode(',', $context_keys); |
NewerOlder