| 1 |
2
|
Manuela
|
//:Randomly display one WYSIWYG section from a given list
|
| 2 |
|
|
//:Use [[ShowRandomWysiwyg?section=10,12,15,20]]
|
| 3 |
|
|
//:possible Delimiters: [ ,;:|-+#/ ]
|
| 4 |
|
|
global $database;
|
| 5 |
|
|
$content = ' ';
|
| 6 |
|
|
if (isset($section)) {
|
| 7 |
|
|
if( preg_match('/^[0-9]+(?:\s*[\,\|\-\;\:\+\#\/]\s*[0-9]+\s*)*$/', $section)) {
|
| 8 |
|
|
if (is_readable(WB_PATH.'/modules/wysiwyg/view.php')) {
|
| 9 |
|
|
// if valid arguments given and module wysiwyg is installed
|
| 10 |
|
|
// split and sanitize arguments
|
| 11 |
|
|
$aSections = preg_split('/[\s\,\|\-\;\:\+\#\/]+/', $section);
|
| 12 |
|
|
$section_id = $aSections[array_rand($aSections)]; // get random element
|
| 13 |
|
|
ob_start(); // generate output by wysiwyg module
|
| 14 |
|
|
require(WB_PATH.'/modules/wysiwyg/view.php');
|
| 15 |
|
|
$content = ob_get_clean();
|
| 16 |
|
|
}
|
| 17 |
|
|
}
|
| 18 |
|
|
}
|
| 19 |
|
|
return $content;
|