Project

General

Profile

« Previous | Next » 

Revision 1289

Added by kweitzel over 14 years ago

Branch 2.8.1 merged back into Trunk

View differences:

droplets.php
3 3
// $Id$
4 4

  
5 5
/*
6
*	@version	1.0
6
*	@version	1.0.2
7 7
*	@author		Ruud Eisinga (Ruud) John (PCWacht)
8 8
*	@date		June 2009
9 9
*
10 10
*	droplets are small codeblocks that are called from anywhere in the template. 
11
* 	To call a droplet just use [[dropletname]]. optional parameters for a droplet can be used like [[dropletname?parameter=value&parameter2=value]]
11
* 	To call a droplet just use [[dropletname]]. optional parameters for a droplet can be used like [[dropletname?parameter=value&parameter2=value]]\
12
*
13
*   1.0.2, bugfix. Reused the evalDroplet function so the extracted parameters will be only available within the scope of the eval and cleared when ready.
12 14
*/
13 15

  
14 16
function evalDroplets ($wb_page_data) {
......
37 39
		if ($query_content && $query_content->numRows() > 0){
38 40
			$fetch_content = $query_content->fetchRow();
39 41
			$codedata = ($fetch_content['code']);
40
			if(is_array($parameter)) extract($parameter, EXTR_SKIP);
41
			$newvalue = eval($codedata);
42
			$newvalue = evalDroplet($codedata, $parameter, $wb_page_data);
42 43
			if ($newvalue == "" && !$newvalue === true) 
43 44
				$newvalue = "<font color=\"red\">Error in: $match, no correct returnvalue.</font>";
44 45
			if ($newvalue === true) 
......
48 49
	}
49 50
	return $wb_page_data;
50 51
}
52

  
53
function evalDroplet($droplet, $params, &$wb_page_data) {
54
    if(is_array($params)) extract($params, EXTR_SKIP);
55
	return eval($droplet);
56
}
51 57
?>

Also available in: Unified diff