Project

General

Profile

« Previous | Next » 

Revision 1686

Added by darkviper about 12 years ago

some modifications concerning the new autoloader
Twig Template engine v.1.7.0
some droplets actualisized
unfinished changes in installer

View differences:

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

Also available in: Unified diff