From e4d2565e05a517641de921c4c19a2c9d1beea2e7 Mon Sep 17 00:00:00 2001 From: nicosomb Date: Thu, 18 Apr 2013 15:39:34 +0200 Subject: =?UTF-8?q?#4=20-=20ajout=20syst=C3=A8me=20de=20connexion=20(login?= =?UTF-8?q?=20poche=20mot=20de=20passe=20poche=20pour=20l'instant)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/rain.tpl.class.php | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'inc/rain.tpl.class.php') diff --git a/inc/rain.tpl.class.php b/inc/rain.tpl.class.php index ea83b2c1..6522c798 100644 --- a/inc/rain.tpl.class.php +++ b/inc/rain.tpl.class.php @@ -81,18 +81,18 @@ class RainTPL{ * */ static $check_template_update = true; - + /** - * PHP tags + * PHP tags * True: php tags are enabled into the template * False: php tags are disabled into the template and rendered as html * * @var bool */ - static $php_enabled = false; + static $php_enabled = true; + - /** * Debug mode flag. * True: debug mode is used, syntax errors are displayed directly in template. Execution of script is not terminated. @@ -285,7 +285,7 @@ class RainTPL{ */ protected function xml_reSubstitution($capture) { return "'; ?>"; - } + } /** * Compile and write the compiled template file @@ -304,11 +304,11 @@ class RainTPL{ $template_code = str_replace( array(""), array("<?","?>"), $template_code ); //xml re-substitution - $template_code = preg_replace_callback ( "/##XML(.*?)XML##/s", array($this, 'xml_reSubstitution'), $template_code ); + $template_code = preg_replace_callback ( "/##XML(.*?)XML##/s", array($this, 'xml_reSubstitution'), $template_code ); //compile template $template_compiled = "" . $this->compileTemplate( $template_code, $tpl_basedir ); - + // fix the php-eating-newline-after-closing-tag-problem $template_compiled = str_replace( "?>\n", "?>\n\n", $template_compiled ); @@ -413,7 +413,7 @@ class RainTPL{ // if the cache is active if( isset($code[ 2 ]) ){ - + //dynamic include $compiled_code .= 'cache( $template = basename("'.$include_var.'") ) )' . @@ -426,7 +426,7 @@ class RainTPL{ '} ?>'; } else{ - + //dynamic include $compiled_code .= 'assign( "key", $key'.$loop_level.' ); $tpl->assign( "value", $value'.$loop_level.' );' ). '$tpl->draw( dirname("'.$include_var.'") . ( substr("'.$include_var.'",-1,1) != "/" ? "/" : "" ) . basename("'.$include_var.'") );'. '?>'; - - + + } } @@ -548,7 +548,7 @@ class RainTPL{ else // parse the function $parsed_function = $function . $this->var_replace( $code[ 2 ], $tag_left_delimiter = null, $tag_right_delimiter = null, $php_left_delimiter = null, $php_right_delimiter = null, $loop_level ); - + //if code $compiled_code .= ""; } @@ -582,8 +582,8 @@ class RainTPL{ } return $compiled_code; } - - + + /** * Reduce a path, eg. www/library/../filepath//file => www/filepath/file * @param type $path @@ -612,7 +612,7 @@ class RainTPL{ if( self::$path_replace ){ $tpl_dir = self::$base_url . self::$tpl_dir . $tpl_basedir; - + // reduce the path $path = $this->reduce_path($tpl_dir); @@ -683,7 +683,7 @@ class RainTPL{ $this->function_check( $tag ); $extra_var = $this->var_replace( $extra_var, null, null, null, null, $loop_level ); - + // check if there's an operator = in the variable tags, if there's this is an initialization so it will not output any value $is_init_variable = preg_match( "/^(\s*?)\=[^=](.*?)$/", $extra_var ); @@ -712,7 +712,7 @@ class RainTPL{ //if there's a function if( $function_var ){ - + // check if there's a function or a static method and separate, function by parameters $function_var = str_replace("::", "@double_dot@", $function_var ); @@ -786,7 +786,7 @@ class RainTPL{ // check if there's an operator = in the variable tags, if there's this is an initialization so it will not output any value $is_init_variable = preg_match( "/^[a-z_A-Z\.\[\](\-\>)]*=[^=]*$/", $extra_var ); - + //function associate to variable $function_var = ( $extra_var and $extra_var[0] == '|') ? substr( $extra_var, 1 ) : null; @@ -805,16 +805,16 @@ class RainTPL{ //transform .$variable in ["$variable"] and .variable in ["variable"] $variable_path = preg_replace('/\.(\${0,1}\w+)/', '["\\1"]', $variable_path ); - + // if is an assignment also assign the variable to $this->var['value'] if( $is_init_variable ) $extra_var = "=\$this->var['{$var_name}']{$variable_path}" . $extra_var; - + //if there's a function if( $function_var ){ - + // check if there's a function or a static method and separate, function by parameters $function_var = str_replace("::", "@double_dot@", $function_var ); @@ -855,13 +855,13 @@ class RainTPL{ $php_var = '$' . $var_name . $variable_path; }else $php_var = '$' . $var_name . $variable_path; - + // compile the variable for php if( isset( $function ) ) $php_var = $php_left_delimiter . ( !$is_init_variable && $echo ? 'echo ' : null ) . ( $params ? "( $function( $php_var, $params ) )" : "$function( $php_var )" ) . $php_right_delimiter; else $php_var = $php_left_delimiter . ( !$is_init_variable && $echo ? 'echo ' : null ) . $php_var . $extra_var . $php_right_delimiter; - + $html = str_replace( $tag, $php_var, $html ); -- cgit v1.2.3