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 | |
$parents = explode(',',$modx->getOption('parents',$scriptProperties,'11,10,12,13,14')); | |
$parents = array_unique($parents); | |
$output = array(); | |
foreach ($parents as $parent) { | |
$childrenOutput = array(); | |
$children = $modx->getCollection('modResource', array('parent'=>$parent)); | |
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
/* modx event OnHandleRequest */ | |
<?php | |
if (isset($_GET['a'])) { | |
$action = $modx->getObject('modAction', $_GET['a']); | |
if (is_object($action) && $action->get('controller') == 'resource/create') { | |
$parentID = isset($_REQUEST['parent']) ? (int) $_REQUEST['parent'] : 0; | |
if ($parent = $modx->getObject('modResource', $parentID)) { | |
$parentTpl = $parent->get('template'); | |
if ($parentTplObj = $modx->getObject('modTemplate', $parentTpl)) { |
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 | |
$output = str_replace('./','',$input); | |
if ($mediasource = $modx->getObject('sources.modMediaSource',$options)){ | |
$output = $mediasource->prepareOutputUrl($output); | |
} | |
return '/' . $output; |
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 | |
return $options.$input; |
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 | |
$input = $modx->fromJSON($input); | |
$i=0; | |
$output = array(); | |
if (!$input || empty($tpl)) return 'no stuff'; | |
foreach ($input as $row) { | |
$i++; | |
$row['idx']=$i; | |
$output[] = $modx->getChunk($tpl, $row); | |
} |
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 = $modx->getOption('content',$scriptProperties,''); | |
// For debugging: | |
$modx->log(modX::LOG_LEVEL_DEBUG | |
, '[htmlToBottom] called on page '. $modx->resource->id . ' with the following properties: ' | |
.print_r($scriptProperties, true)); | |
// Verify Inputs | |
if(isset($scriptProperties['content'])){ | |
$modx->regClientHTMLBlock($content); |
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 | |
$link = $modx->getOption('link',$scriptProperties,''); | |
// For debugging: | |
$modx->log(modX::LOG_LEVEL_DEBUG | |
, '[sendJsBottom] called on page '. $modx->resource->id . ' with the following properties: ' | |
.print_r($scriptProperties, true)); | |
// Verify Inputs | |
if(isset($scriptProperties['link'])){ | |
$modx->regClientScript($link); | |
} |
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 | |
function splitString($string, $amount) | |
{ | |
$start = 0; | |
$end = $amount; | |
while ($end < strlen($string)+$amount) //while $end is less than the length of $string + $amount to make sure it gets it all | |
{ | |
$chunk = substr($string, $start, $amount); //assign to variable instead of array | |
$chunk = strrev($chunk); // reverse string 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 | |
$output=''; | |
$chunkArray=explode(',',$chunks); | |
$randomKeys=array_rand($chunkArray);//pick random key | |
$randomChunkName=$chunkArray[$randomKeys]; | |
$output.=$modx->getChunk($randomChunkName); | |
return $output; |
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
//[[haveSiblings? &classtwo=`no_sub_menu` &classone=`with_sub_menu`]] | |
<?php | |
if(!isset($modx)) return ''; | |
/* setup vars */ | |
$exclude = !empty($exclude) ? (is_array($exclude) ? $exclude : explode(',', str_replace(' ', '', $exclude))) : null; | |
$id = $modx->resource->get('id'); | |
if(!is_null($exclude) && in_array($id, $exclude)) return ''; |
NewerOlder