Project

General

Profile

« Previous | Next » 

Revision 1138

Added by Ruud over 14 years ago

Fixed bug in droplets. Multiple droplets with the same parameter did not extract the new parameter. (problem introduced by code optimisations for WB2.8)
Fixed usage of the depriciated (PHP 5.3.0) split() function in class.wb. (ticket #772)
Fixed notice ob_end_clean..failed to delete buffer. (ticket #779)

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