[phpwebapp-commits] CVS: web_app class.WebApp.php,1.17,1.18
Brought to you by:
dashohoxha
From: Dashamir H. <das...@us...> - 2004-07-14 14:45:52
|
Update of /cvsroot/phpwebapp/web_app In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13284 Modified Files: class.WebApp.php Log Message: Index: class.WebApp.php =================================================================== RCS file: /cvsroot/phpwebapp/web_app/class.WebApp.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** class.WebApp.php 13 Jul 2004 13:18:08 -0000 1.17 --- class.WebApp.php 14 Jul 2004 14:45:41 -0000 1.18 *************** *** 92,97 **** //add also the stylesheet of the framework ! $webapp_styles = ' <link rel="stylesheet" type="text/css" ' ! . 'href="'.WEBAPP_URL.'styles.css">'."\n"; $webPage->append_to_head($webapp_styles); --- 92,97 ---- //add also the stylesheet of the framework ! $webapp_styles = ' <link type="text/css" rel="stylesheet" ' ! . 'href="'.WEBAPP_URL.'styles.css" />'."\n"; $webPage->append_to_head($webapp_styles); *************** *** 249,253 **** //if it is the state var of a webobject //set it in the webobject's scope as well ! if (ereg("(.*)->(.*)", $var_name, $regs)) { $obj_id = $regs[1]; --- 249,253 ---- //if it is the state var of a webobject //set it in the webobject's scope as well ! if (ereg('(.*)->(.*)', $var_name, $regs)) { $obj_id = $regs[1]; *************** *** 285,295 **** /*------ end variable functions ----------------*/ - /*------ begin evaluate ------------------------*/ - /** Returns the value of the given expression. */ function evaluate($expr) { //declare as global any variables that are used in $expr ! $var_names = implode(",", WebApp::get_var_names($expr)); if ($var_names <> '') { --- 285,294 ---- /*------ end variable functions ----------------*/ /** Returns the value of the given expression. */ function evaluate($expr) { //declare as global any variables that are used in $expr ! preg_match_all('/\$[[:alnum:]_]+/', $expr, $matches); ! $var_names = implode(',', $matches[0]); if ($var_names <> '') { *************** *** 307,327 **** return $webApp_value; } - /** - * Returns an array with all the variable names that are used - * in the given $expr. Called by evaluate() (which will be declared - * these variables as global). - * @see evaluate() - */ - function get_var_names($expr) - { - $var_names = array(); - while ( ereg('\$[[:alnum:]_]+', $expr, $regs) ) - { - $var_names[] = $regs[0]; - $expr = str_replace($regs[0], '', $expr); - } - return $var_names; - } - /*------ end evaluate --------------------------*/ /** --- 306,309 ---- *************** *** 378,381 **** --- 360,373 ---- * the variable is inside a string, and if it contains quotes inside * the value, then it may break the string. + * + * A variable can be commented by adding a diesis before or after its + * name. In this case, the variable will not be expanded. + * + * Variables can be nested with each-other, like this: + * {{item_{{id}}_checked}}. The most inner variables are expanded first + * (in this case {{id}}). + * + * Variables are expanded recursively, so, if the value of a variable + * contains another variable, it will be expanded as well. */ function replaceVars($str) *************** *** 438,442 **** break; default: ! print "warning: escape_quotes: the quote '$quote' is unknown.<br>\n"; break; } --- 430,434 ---- break; default: ! print "warning: escape_quotes: the quote '$quote' is unknown.<br />\n"; break; } *************** *** 530,534 **** function to_url($path) { ! $DocumentRoot = ereg_replace(APP_URL."\$", '', APP_PATH); $url = str_replace($DocumentRoot, '', $path); return $url; --- 522,526 ---- function to_url($path) { ! $DocumentRoot = ereg_replace(APP_URL.'$', '', APP_PATH); $url = str_replace($DocumentRoot, '', $path); return $url; *************** *** 601,605 **** <div class='xml_error'> <strong>XML Error:</strong> $error_string. At <strong>$fname</strong>, ! line <strong>$line_nr</strong>, column <strong>$col_nr</strong>: <br> <span class='xml_err_str'>...$xml_string</span>. </div> --- 593,597 ---- <div class='xml_error'> <strong>XML Error:</strong> $error_string. At <strong>$fname</strong>, ! line <strong>$line_nr</strong>, column <strong>$col_nr</strong>: <br /> <span class='xml_err_str'>...$xml_string</span>. </div> |