Changeset 11994
- Timestamp:
- 05/19/08 22:13:23 (6 months ago)
- Location:
- websites/events.php.gr.jp/trunk/lib/Smarty
- Files:
-
- 15 modified
-
Config_File.class.php (modified) (2 diffs)
-
Smarty.class.php (modified) (9 diffs)
-
Smarty_Compiler.class.php (modified) (14 diffs)
-
internals/core.write_compiled_include.php (modified) (1 diff)
-
internals/core.write_file.php (modified) (2 diffs)
-
plugins/compiler.assign.php (modified) (1 diff)
-
plugins/function.html_select_date.php (modified) (8 diffs)
-
plugins/function.html_table.php (modified) (10 diffs)
-
plugins/function.mailto.php (modified) (2 diffs)
-
plugins/modifier.capitalize.php (modified) (2 diffs)
-
plugins/modifier.date_format.php (modified) (2 diffs)
-
plugins/modifier.debug_print_var.php (modified) (1 diff)
-
plugins/modifier.regex_replace.php (modified) (1 diff)
-
plugins/modifier.truncate.php (modified) (1 diff)
-
plugins/outputfilter.trimwhitespace.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
websites/events.php.gr.jp/trunk/lib/Smarty/Config_File.class.php
r9806 r11994 19 19 * 20 20 * @link http://smarty.php.net/ 21 * @version 2.6.1 421 * @version 2.6.19 22 22 * @copyright Copyright: 2001-2005 New Digital Group, Inc. 23 23 * @author Andrei Zmievski <andrei@php.net> … … 26 26 */ 27 27 28 /* $Id: Config_File.class.php 129 2006-08-10 08:16:02Z halt $ */28 /* $Id: Config_File.class.php 2702 2007-03-08 19:11:22Z mohrt $ */ 29 29 30 30 /** -
websites/events.php.gr.jp/trunk/lib/Smarty/Smarty.class.php
r9806 r11994 28 28 * @author Andrei Zmievski <andrei@php.net> 29 29 * @package Smarty 30 * @version 2.6.1 430 * @version 2.6.19 31 31 */ 32 32 33 /* $Id: Smarty.class.php 129 2006-08-10 08:16:02Z halt$ */33 /* $Id: Smarty.class.php 2722 2007-06-18 14:29:00Z danilo $ */ 34 34 35 35 /** … … 465 465 * @var string 466 466 */ 467 var $_version = '2.6.1 4';467 var $_version = '2.6.19'; 468 468 469 469 /** … … 839 839 * to a template before compiling 840 840 * 841 * @param string $function name of PHP function to register841 * @param callback $function 842 842 */ 843 843 function register_prefilter($function) 844 844 { 845 $_name = (is_array($function)) ? $function[1] : $function; 846 $this->_plugins['prefilter'][$_name] 845 $this->_plugins['prefilter'][$this->_get_filter_name($function)] 847 846 = array($function, null, null, false); 848 847 } … … 851 850 * Unregisters a prefilter function 852 851 * 853 * @param string $function name of PHPfunction852 * @param callback $function 854 853 */ 855 854 function unregister_prefilter($function) 856 855 { 857 unset($this->_plugins['prefilter'][$ function]);856 unset($this->_plugins['prefilter'][$this->_get_filter_name($function)]); 858 857 } 859 858 … … 862 861 * to a compiled template after compilation 863 862 * 864 * @param string $function name of PHP function to register863 * @param callback $function 865 864 */ 866 865 function register_postfilter($function) 867 866 { 868 $_name = (is_array($function)) ? $function[1] : $function; 869 $this->_plugins['postfilter'][$_name] 867 $this->_plugins['postfilter'][$this->_get_filter_name($function)] 870 868 = array($function, null, null, false); 871 869 } … … 874 872 * Unregisters a postfilter function 875 873 * 876 * @param string $function name of PHPfunction874 * @param callback $function 877 875 */ 878 876 function unregister_postfilter($function) 879 877 { 880 unset($this->_plugins['postfilter'][$ function]);878 unset($this->_plugins['postfilter'][$this->_get_filter_name($function)]); 881 879 } 882 880 … … 885 883 * to a template output 886 884 * 887 * @param string $function name of PHPfunction885 * @param callback $function 888 886 */ 889 887 function register_outputfilter($function) 890 888 { 891 $_name = (is_array($function)) ? $function[1] : $function; 892 $this->_plugins['outputfilter'][$_name] 889 $this->_plugins['outputfilter'][$this->_get_filter_name($function)] 893 890 = array($function, null, null, false); 894 891 } … … 897 894 * Unregisters an outputfilter function 898 895 * 899 * @param string $function name of PHPfunction896 * @param callback $function 900 897 */ 901 898 function unregister_outputfilter($function) 902 899 { 903 unset($this->_plugins['outputfilter'][$ function]);900 unset($this->_plugins['outputfilter'][$this->_get_filter_name($function)]); 904 901 } 905 902 … … 1936 1933 return eval($code); 1937 1934 } 1935 1936 /** 1937 * Extracts the filter name from the given callback 1938 * 1939 * @param callback $function 1940 * @return string 1941 */ 1942 function _get_filter_name($function) 1943 { 1944 if (is_array($function)) { 1945 $_class_name = (is_object($function[0]) ? 1946 get_class($function[0]) : $function[0]); 1947 return $_class_name . '_' . $function[1]; 1948 } 1949 else { 1950 return $function; 1951 } 1952 } 1953 1938 1954 /**#@-*/ 1939 1955 -
websites/events.php.gr.jp/trunk/lib/Smarty/Smarty_Compiler.class.php
r9806 r11994 22 22 * @author Monte Ohrt <monte at ohrt dot com> 23 23 * @author Andrei Zmievski <andrei@php.net> 24 * @version 2.6.1 424 * @version 2.6.19 25 25 * @copyright 2001-2005 New Digital Group, Inc. 26 26 * @package Smarty 27 27 */ 28 28 29 /* $Id: Smarty_Compiler.class.php 129 2006-08-10 08:16:02Z halt $ */29 /* $Id: Smarty_Compiler.class.php 2736 2007-09-16 14:47:53Z mohrt $ */ 30 30 31 31 /** … … 241 241 $rdq = preg_quote($this->right_delimiter, '~'); 242 242 243 /* un-hide hidden xml open tags */244 $source_content = preg_replace("~<({$ldq}(.*?){$rdq})[?]~s", '< \\1', $source_content);245 246 243 // run template source through prefilter functions 247 244 if (count($this->_plugins['prefilter']) > 0) { … … 282 279 for ($curr_tb = 0, $for_max = count($text_blocks); $curr_tb < $for_max; $curr_tb++) { 283 280 /* match anything resembling php tags */ 284 if (preg_match_all('~(<\?(?:\w+|=)?|\?>|language\s*=\s*[\"\']? php[\"\']?)~is', $text_blocks[$curr_tb], $sp_match)) {281 if (preg_match_all('~(<\?(?:\w+|=)?|\?>|language\s*=\s*[\"\']?\s*php\s*[\"\']?)~is', $text_blocks[$curr_tb], $sp_match)) { 285 282 /* replace tags with placeholders to prevent recursive replacements */ 286 283 $sp_match[1] = array_unique($sp_match[1]); … … 308 305 } 309 306 } 310 307 311 308 /* Compile the template tags into PHP code. */ 312 309 $compiled_tags = array(); … … 353 350 } 354 351 $compiled_content = ''; 355 352 353 $tag_guard = '%%%SMARTYOTG' . md5(uniqid(rand(), true)) . '%%%'; 354 356 355 /* Interleave the compiled contents and text blocks to get the final result. */ 357 356 for ($i = 0, $for_max = count($compiled_tags); $i < $for_max; $i++) { … … 360 359 $text_blocks[$i+1] = preg_replace('~^(\r\n|\r|\n)~', '', $text_blocks[$i+1]); 361 360 } 362 $compiled_content .= $text_blocks[$i].$compiled_tags[$i]; 363 } 364 $compiled_content .= $text_blocks[$i]; 365 361 // replace legit PHP tags with placeholder 362 $text_blocks[$i] = str_replace('<?', $tag_guard, $text_blocks[$i]); 363 $compiled_tags[$i] = str_replace('<?', $tag_guard, $compiled_tags[$i]); 364 365 $compiled_content .= $text_blocks[$i] . $compiled_tags[$i]; 366 } 367 $compiled_content .= str_replace('<?', $tag_guard, $text_blocks[$i]); 368 369 // escape php tags created by interleaving 370 $compiled_content = str_replace('<?', "<?php echo '<?' ?>\n", $compiled_content); 371 $compiled_content = preg_replace("~(?<!')language\s*=\s*[\"\']?\s*php\s*[\"\']?~", "<?php echo 'language=php' ?>\n", $compiled_content); 372 373 // recover legit tags 374 $compiled_content = str_replace($tag_guard, '<?', $compiled_content); 375 366 376 // remove \n from the end of the file, if any 367 377 if (strlen($compiled_content) && (substr($compiled_content, -1) == "\n") ) { … … 372 382 $compiled_content = "<?php \$this->_cache_serials['".$this->_cache_include."'] = '".$this->_cache_serial."'; ?>" . $compiled_content; 373 383 } 374 375 // remove unnecessary close/open tags376 $compiled_content = preg_replace('~\?>\n?<\?php~', '', $compiled_content);377 384 378 385 // run compiled template through postfilter functions … … 863 870 $args = implode(',', array_values($attrs)); 864 871 if (empty($args)) { 865 $args = ' null';872 $args = ''; 866 873 } 867 874 } … … 928 935 929 936 if (empty($name)) { 930 $this->_syntax_error("missing insert name", E_USER_ERROR, __FILE__, __LINE__); 937 return $this->_syntax_error("missing insert name", E_USER_ERROR, __FILE__, __LINE__); 938 } 939 940 if (!preg_match('~^\w+$~', $name)) { 941 return $this->_syntax_error("'insert: 'name' must be an insert function name", E_USER_ERROR, __FILE__, __LINE__); 931 942 } 932 943 … … 1161 1172 $item = $this->_dequote($attrs['item']); 1162 1173 if (!preg_match('~^\w+$~', $item)) { 1163 return $this->_syntax_error(" 'foreach:item' must be a variable name (literal string)", E_USER_ERROR, __FILE__, __LINE__);1174 return $this->_syntax_error("foreach: 'item' must be a variable name (literal string)", E_USER_ERROR, __FILE__, __LINE__); 1164 1175 } 1165 1176 … … 1212 1223 1213 1224 if ($start) { 1214 if (isset($attrs['name'])) 1215 $buffer = $attrs['name']; 1216 else 1217 $buffer = "'default'"; 1218 1219 if (isset($attrs['assign'])) 1220 $assign = $attrs['assign']; 1221 else 1222 $assign = null; 1225 $buffer = isset($attrs['name']) ? $attrs['name'] : "'default'"; 1226 $assign = isset($attrs['assign']) ? $attrs['assign'] : null; 1227 $append = isset($attrs['append']) ? $attrs['append'] : null; 1228 1223 1229 $output = "<?php ob_start(); ?>"; 1224 $this->_capture_stack[] = array($buffer, $assign );1230 $this->_capture_stack[] = array($buffer, $assign, $append); 1225 1231 } else { 1226 list($buffer, $assign ) = array_pop($this->_capture_stack);1232 list($buffer, $assign, $append) = array_pop($this->_capture_stack); 1227 1233 $output = "<?php \$this->_smarty_vars['capture'][$buffer] = ob_get_contents(); "; 1228 1234 if (isset($assign)) { 1229 1235 $output .= " \$this->assign($assign, ob_get_contents());"; 1236 } 1237 if (isset($append)) { 1238 $output .= " \$this->append($append, ob_get_contents());"; 1230 1239 } 1231 1240 $output .= "ob_end_clean(); ?>"; … … 1672 1681 if(preg_match_all('~(?:\`(?<!\\\\)\$' . $this->_dvar_guts_regexp . '(?:' . $this->_obj_ext_regexp . ')*\`)|(?:(?<!\\\\)\$\w+(\[[a-zA-Z0-9]+\])*)~', $var_expr, $_match)) { 1673 1682 $_match = $_match[0]; 1674 rsort($_match); 1675 reset($_match); 1683 $_replace = array(); 1676 1684 foreach($_match as $_var) { 1677 $var_expr = str_replace ($_var, '".(' . $this->_parse_var(str_replace('`','',$_var)) . ')."', $var_expr); 1678 } 1685 $_replace[$_var] = '".(' . $this->_parse_var(str_replace('`','',$_var)) . ')."'; 1686 } 1687 $var_expr = strtr($var_expr, $_replace); 1679 1688 $_return = preg_replace('~\.""|(?<!\\\\)""\.~', '', $var_expr); 1680 1689 } else { … … 2220 2229 || 0<$this->_cacheable_state++) return ''; 2221 2230 if (!isset($this->_cache_serial)) $this->_cache_serial = md5(uniqid('Smarty')); 2222 $_ret = 'if ($this->caching && !$this->_cache_including) {echo \'{nocache:'2231 $_ret = 'if ($this->caching && !$this->_cache_including): echo \'{nocache:' 2223 2232 . $this->_cache_serial . '#' . $this->_nocache_count 2224 . '}\'; };';2233 . '}\'; endif;'; 2225 2234 return $_ret; 2226 2235 } … … 2237 2246 if ($_cacheable 2238 2247 || --$this->_cacheable_state>0) return ''; 2239 return 'if ($this->caching && !$this->_cache_including) {echo \'{/nocache:'2248 return 'if ($this->caching && !$this->_cache_including): echo \'{/nocache:' 2240 2249 . $this->_cache_serial . '#' . ($this->_nocache_count++) 2241 . '}\'; };';2250 . '}\'; endif;'; 2242 2251 } 2243 2252 -
websites/events.php.gr.jp/trunk/lib/Smarty/internals/core.write_compiled_include.php
r9806 r11994 16 16 function smarty_core_write_compiled_include($params, &$smarty) 17 17 { 18 $_tag_start = 'if \(\$this->caching && \!\$this->_cache_including\) \{ echo \'\{nocache\:('.$params['cache_serial'].')#(\d+)\}\'; \};';19 $_tag_end = 'if \(\$this->caching && \!\$this->_cache_including\) \{ echo \'\{/nocache\:(\\2)#(\\3)\}\'; \};';18 $_tag_start = 'if \(\$this->caching && \!\$this->_cache_including\)\: echo \'\{nocache\:('.$params['cache_serial'].')#(\d+)\}\'; endif;'; 19 $_tag_end = 'if \(\$this->caching && \!\$this->_cache_including\)\: echo \'\{/nocache\:(\\2)#(\\3)\}\'; endif;'; 20 20 21 21 preg_match_all('!('.$_tag_start.'(.*)'.$_tag_end.')!Us', 22 22 $params['compiled_content'], $_match_source, PREG_SET_ORDER); 23 23 24 24 // no nocache-parts found: done 25 25 if (count($_match_source)==0) return; -
websites/events.php.gr.jp/trunk/lib/Smarty/internals/core.write_file.php
r9806 r11994 24 24 } 25 25 26 // write to tmp file, then rename it to avoid 27 // file locking race condition 26 // write to tmp file, then rename it to avoid file locking race condition 28 27 $_tmp_file = tempnam($_dirname, 'wrt'); 29 28 … … 39 38 fclose($fd); 40 39 41 // Delete the file if it allready exists (this is needed on Win, 42 // because it cannot overwrite files with rename() 43 if (file_exists($params['filename'])) { 40 if (DIRECTORY_SEPARATOR == '\\' || !@rename($_tmp_file, $params['filename'])) { 41 // On platforms and filesystems that cannot overwrite with rename() 42 // delete the file before renaming it -- because windows always suffers 43 // this, it is short-circuited to avoid the initial rename() attempt 44 44 @unlink($params['filename']); 45 @rename($_tmp_file, $params['filename']); 45 46 } 46 @rename($_tmp_file, $params['filename']);47 47 @chmod($params['filename'], $smarty->_file_perms); 48 48 -
websites/events.php.gr.jp/trunk/lib/Smarty/plugins/compiler.assign.php
r9806 r11994 15 15 * (Smarty online manual) 16 16 * @author Monte Ohrt <monte at ohrt dot com> (initial author) 17 * @auth er messju mohr <messju at lammfellpuschen dot de> (conversion to compiler function)17 * @author messju mohr <messju at lammfellpuschen dot de> (conversion to compiler function) 18 18 * @param string containing var-attribute and value-attribute 19 19 * @param Smarty_Compiler -
websites/events.php.gr.jp/trunk/lib/Smarty/plugins/function.html_select_date.php
r9806 r11994 25 25 * - 1.3.2 support negative timestamps, force year 26 26 * dropdown to include given date unless explicitly set (Monte) 27 * - 1.3.4 fix behaviour of 0000-00-00 00:00:00 dates to match that 28 * of 0000-00-00 dates (cybot, boots) 27 29 * @link http://smarty.php.net/manual/en/language.function.html.select.date.php {html_select_date} 28 30 * (Smarty online manual) 29 * @version 1.3. 231 * @version 1.3.4 30 32 * @author Andrei Zmievski 31 33 * @author Monte Ohrt <monte at ohrt dot com> … … 132 134 } 133 135 134 if (preg_match('!^-\d+$!',$time)) {136 if (preg_match('!^-\d+$!', $time)) { 135 137 // negative timestamp, use date() 136 $time = date('Y-m-d', $time);138 $time = date('Y-m-d', $time); 137 139 } 138 140 // If $time is not in format yyyy-mm-dd 139 if (!preg_match('/^\d{0,4}-\d{0,2}-\d{0,2}$/', $time)) { 141 if (preg_match('/^(\d{0,4}-\d{0,2}-\d{0,2})/', $time, $found)) { 142 $time = $found[1]; 143 } else { 140 144 // use smarty_make_timestamp to get an unix timestamp and 141 145 // strftime to make yyyy-mm-dd … … 144 148 // Now split this in pieces, which later can be used to set the select 145 149 $time = explode("-", $time); 146 150 147 151 // make syntax "+N" or "-N" work with start_year and end_year 148 152 if (preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match)) { … … 160 164 } 161 165 } 162 if (strlen($time[0]) > 0) { 166 if (strlen($time[0]) > 0) { 163 167 if ($start_year > $time[0] && !isset($params['start_year'])) { 164 168 // force start year to include given date if not explicitly set … … 175 179 $html_result = $month_result = $day_result = $year_result = ""; 176 180 181 $field_separator_count = -1; 177 182 if ($display_months) { 183 $field_separator_count++; 178 184 $month_names = array(); 179 185 $month_values = array(); … … 213 219 214 220 if ($display_days) { 221 $field_separator_count++; 215 222 $days = array(); 216 223 if (isset($day_empty)) { … … 248 255 249 256 if ($display_years) { 257 $field_separator_count++; 250 258 if (null !== $field_array){ 251 259 $year_name = $field_array . '[' . $prefix . 'Year]'; … … 311 319 } 312 320 // Add the field seperator 313 if($i != 2) {321 if($i < $field_separator_count) { 314 322 $html_result .= $field_separator; 315 323 } -
websites/events.php.gr.jp/trunk/lib/Smarty/plugins/function.html_table.php
r9806 r11994 16 16 * Input:<br> 17 17 * - loop = array to loop through 18 * - cols = number of columns 18 * - cols = number of columns, comma separated list of column names 19 * or array of column names 19 20 * - rows = number of rows 20 21 * - table_attr = table attributes 22 * - th_attr = table heading attributes (arrays are cycled) 21 23 * - tr_attr = table row attributes (arrays are cycled) 22 24 * - td_attr = table cell attributes (arrays are cycled) 23 25 * - trailpad = value to pad trailing cells with 26 * - caption = text for caption element 24 27 * - vdir = vertical direction (default: "down", means top-to-bottom) 25 28 * - hdir = horizontal direction (default: "right", means left-to-right) … … 32 35 * {table loop=$data} 33 36 * {table loop=$data cols=4 tr_attr='"bgcolor=red"'} 34 * {table loop=$data cols= 4tr_attr=$colors}37 * {table loop=$data cols="first,second,third" tr_attr=$colors} 35 38 * </pre> 36 39 * @author Monte Ohrt <monte at ohrt dot com> 37 * @version 1.0 40 * @author credit to Messju Mohr <messju at lammfellpuschen dot de> 41 * @author credit to boots <boots dot smarty at yahoo dot com> 42 * @version 1.1 38 43 * @link http://smarty.php.net/manual/en/language.function.html.table.php {html_table} 39 44 * (Smarty online manual) … … 46 51 $table_attr = 'border="1"'; 47 52 $tr_attr = ''; 53 $th_attr = ''; 48 54 $td_attr = ''; 49 $cols = 3;55 $cols = $cols_count = 3; 50 56 $rows = 3; 51 57 $trailpad = ' '; … … 53 59 $hdir = 'right'; 54 60 $inner = 'cols'; 61 $caption = ''; 55 62 56 63 if (!isset($params['loop'])) { … … 66 73 67 74 case 'cols': 75 if (is_array($_value) && !empty($_value)) { 76 $cols = $_value; 77 $cols_count = count($_value); 78 } elseif (!is_numeric($_value) && is_string($_value) && !empty($_value)) { 79 $cols = explode(',', $_value); 80 $cols_count = count($cols); 81 } elseif (!empty($_value)) { 82 $cols_count = (int)$_value; 83 } else { 84 $cols_count = $cols; 85 } 86 break; 87 68 88 case 'rows': 69 89 $$_key = (int)$_value; … … 75 95 case 'vdir': 76 96 case 'inner': 97 case 'caption': 77 98 $$_key = (string)$_value; 78 99 break; … … 80 101 case 'tr_attr': 81 102 case 'td_attr': 103 case 'th_attr': 82 104 $$_key = $_value; 83 105 break; … … 88 110 if (empty($params['rows'])) { 89 111 /* no rows specified */
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)