This file contains 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 | |
//$iOS_chunk = $modx->getOption('ios',$scriptProperties); | |
//$Android_chunk = $modx->getOption('droid',$scriptProperties); | |
$iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod"); | |
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone"); | |
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad"); | |
$Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android"); | |
//check if user is using ipod, iphone or ipad... |
This file contains 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 | |
$test_c = abs($input) % 10; | |
$ext = ((abs($input) %100 < 21 && abs($input) %100 > 4) ? 'th' | |
: (($test_c < 4) ? ($test_c < 3) ? ($test_c < 2) ? ($test_c < 1) | |
? 'th' : 'st' : 'nd' : 'rd' : 'th')); | |
return $input.$ext; | |
?> |
This file contains 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 | |
// [[!showMe? &start=`` &stop=`` &display=`featuresChunk` &default=`emptyChunk`]] | |
$start = strtotime($modx->getOption('start',$scriptProperties,time())); | |
$stop = strtotime($modx->getOption('stop',$scriptProperties,time())); | |
$display = $modx->getOption('display',$scriptProperties,''); | |
$default = $modx->getOption('default',$scriptProperties,''); | |
$rightNow = time(); | |
if($rightNow > $start && $rightNow < $stop){ | |
$output = $modx->getChunk($display); |
This file contains 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 | |
// [[getChildCount? &parent=`[[+id]]`]] | |
$count = 0; | |
$parent = isset($parent) ? (integer) $parent : 0; | |
if ($parent > 0) { | |
$criteria = array( | |
'parent' => $parent, | |
'deleted' => false, | |
'published' => true, | |
); |
This file contains 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 | |
$optionsXpld = @explode('&', $options); | |
$optionsArray = array(); | |
foreach ($optionsXpld as $xpld) { | |
$params = @explode('=', $xpld); | |
array_walk($params, create_function('&$v', '$v = trim($v);')); | |
if (isset($params[1])) { | |
$optionsArray[$params[0]] = $params[1]; | |
} else { | |
$optionsArray[$params[0]] = ''; |
This file contains 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 | |
$number = floatval($input); | |
$optionsXpld = @explode('&', $options); | |
$optionsArray = array(); | |
foreach ($optionsXpld as $xpld) { | |
$params = @explode('=', $xpld); | |
array_walk($params, create_function('&$v', '$v = trim($v);')); | |
if (isset($params[1])) { | |
$optionsArray[$params[0]] = $params[1]; | |
} else { |
This file contains 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 | |
$eventName = $modx->event->name; | |
switch($eventName) { | |
case 'OnDocFormRender': | |
if ($mode == modSystemEvent::MODE_NEW) { | |
$resource->setProperty('_isContentBlocks', false, 'contentblocks'); | |
} | |
break; | |
} |
This file contains 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 | |
$linkArray = explode(',', $input); | |
foreach ($linkArray as $key => $resource ) { | |
$page = $modx->getObject('modResource', $resource); | |
$published = $page->get('published'); | |
if ($published){ | |
$publishedArray[] = $resource; | |
} | |
} | |
$publishedList = implode(",", $publishedArray); |
This file contains 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 | |
//[[!FormItYearOptions? &name=`rentexpireYear` &futureYears=`3` &pastYears=`1` &selectedOffset=`1`]] | |
$name = $modx->getOption('name',$scriptProperties,'year'); | |
$futureYears = $modx->getOption('futureYears',$scriptProperties,'5'); | |
$pastYears = $modx->getOption('pastYears',$scriptProperties,'1'); | |
$selectedOffset = $modx->getOption('selectedOffset',$scriptProperties,'1'); | |
$reverse = $modx->getOption('reverse',$scriptProperties,''); | |
$thisYear = date('Y'); |
This file contains 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 | |
$timestamp = date('m/d/Y h:i:s'); | |
$ip = $_SERVER['HTTP_CLIENT_IP']?:($_SERVER['HTTP_X_FORWARDED_FOR']?:$_SERVER['REMOTE_ADDR']); | |
| |
// post to webhook url | |
$url = $scriptProperties['webhook']; | |
if (isset($url)) { | |
$postvars = 'timestamp=' . $timestamp . '&ip=' . $ip . '&search=' . $search; | |
$ch = curl_init($url); | |
curl_setopt( $ch, CURLOPT_POST, 1); |
OlderNewer