Created
January 26, 2012 02:13
-
-
Save enminc/1680499 to your computer and use it in GitHub Desktop.
MODX Snippet/OutputFilter that outputs the results of php rand() function
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
$min = 0; | |
$max = 10000000; | |
$input = $modx->getOption('input',$scriptProperties,null); | |
if(($input) && ($input != '')){ // used when used as output filter | |
$nums = explode(',',$input); | |
if($nums[0] != '' && is_numeric($nums[0])){ | |
$min = intval($nums[0]); | |
} | |
if($nums[1] != '' && is_numeric($nums[1])){ | |
$mac = intval($nums[1]); | |
} | |
} | |
else{ // when past in as a snippet property | |
$min = $modx->getOption('min',$scriptProperties,$min); | |
$max = $modx->getOption('max',$scriptProperties,$max); | |
} | |
return rand($min,$max); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment