Changeset 2290
- Timestamp:
- Mar 23, 2008, 1:04:46 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/tabsheet.class.php
r2226 r2290 135 135 136 136 $selected_tab = $this->get_selected(); 137 137 138 138 if (isset($selected_tab)) 139 139 { 140 $template->assign _vars(140 $template->assign( 141 141 array($this->titlename => '['.$selected_tab['caption'].']')); 142 142 } -
trunk/include/common.inc.php
r2240 r2290 139 139 include(PHPWG_ROOT_PATH . 'include/constants.php'); 140 140 include(PHPWG_ROOT_PATH . 'include/functions.inc.php'); 141 include(PHPWG_ROOT_PATH . 'include/template. php');141 include(PHPWG_ROOT_PATH . 'include/template.class.php'); 142 142 143 143 // Database connection -
trunk/include/functions_category.inc.php
r2265 r2290 279 279 global $template; 280 280 281 // TODO - remove from here after old template removed281 $tpl_cats = array(); 282 282 foreach ($categories as $category) 283 283 { 284 $selected = '';285 if (in_array($category['id'], $selecteds))286 {287 $selected = ' selected="selected"';288 }289 290 284 if ($fullname) 291 285 { … … 300 294 $option.= '- '.$category['name']; 301 295 } 302 303 $template->_old->assign_block_vars(304 $blockname,305 array('SELECTED'=>$selected,306 'VALUE'=>$category['id'],307 'OPTION'=>$option308 ));309 }310 // TODO - remove until here after old template removed311 $tpl_cats = array();312 foreach ($categories as $category)313 {314 if ($fullname)315 {316 $option = get_cat_display_name_cache($category['uppercats'],317 null,318 false);319 }320 else321 {322 $option = str_repeat(' ',323 (3 * substr_count($category['global_rank'], '.')));324 $option.= '- '.$category['name'];325 }326 296 $tpl_cats[ $category['id'] ] = $option; 327 297 } 328 298 329 $template-> smarty->assign( $blockname, $tpl_cats);330 $template-> smarty->assign( $blockname.'_selected', $selecteds);299 $template->assign( $blockname, $tpl_cats); 300 $template->assign( $blockname.'_selected', $selecteds); 331 301 } 332 302 -
trunk/include/functions_html.inc.php
r2265 r2290 33 33 return ''; 34 34 } 35 35 36 36 if (isset($page['get_icon_cache'][$date])) 37 37 { … … 714 714 } 715 715 716 /**717 * set a class to display a counter718 * .zero .one .plural719 */720 function set_span_class($count)721 {722 if ($count > 1)723 {724 return 'plural';725 }726 return ( $count == 0 ) ? 'zero':'one';727 }728 729 716 /** returns the category comment for rendering in html. 730 717 * this is an event handler. don't call directly -
trunk/include/template.class.php
r2286 r2290 26 26 27 27 28 require 'smarty/libs/Smarty.class.php';28 require_once 'smarty/libs/Smarty.class.php'; 29 29 30 30 // migrate lang:XXX … … 42 42 var $smarty; 43 43 44 var $_old;45 46 44 var $output = ''; 47 45 … … 89 87 } 90 88 91 $this->_old = & new TemplateOld($root, $theme);92 93 89 $this->set_template_dir($root); 94 90 } … … 99 95 function set_template_dir($dir) 100 96 { 101 $this->_old->set_rootdir($dir);102 97 $this->smarty->template_dir = $dir; 103 98 … … 163 158 } 164 159 165 /**166 * DEPRECATED - backward compatibility only; use assign167 */168 function assign_vars($vararray)169 {170 is_array( $vararray ) || die('assign_vars parameter not array');171 $this->assign( $vararray );172 }173 174 /**175 * DEPRECATED - backward compatibility only; use assign176 */177 function assign_var($varname, $varval)178 {179 !is_array( $varname ) || die('assign_var parameter name is array');180 $this->assign( $varname, $varval );181 }182 183 /**184 * DEPRECATED - backward compatibility only185 */186 function assign_block_vars($blockname, $vararray)187 {188 if (strstr($blockname, '.')!==false)189 {190 $blocks = explode('.', $blockname);191 $blockcount = sizeof($blocks) - 1;192 $root_var = & $this->smarty->get_template_vars();193 194 $str = '$root_var';195 for ($i = 0; $i < $blockcount; $i++)196 {197 $str .= '[\'' . $blocks[$i] . '\']';198 eval('$lastiteration = isset('.$str.') ? sizeof('.$str.')-1:0;');199 $str .= '[' . $lastiteration . ']';200 }201 $str .= '[\'' . $blocks[$blockcount] . '\'][] = $vararray;';202 eval($str);203 }204 else205 $this->smarty->append( $blockname, $vararray );206 207 $this->_old->assign_block_vars($blockname, $vararray);208 }209 210 /**211 * DEPRECATED - backward compatibility only212 */213 function merge_block_vars($blockname, $vararray)214 {215 if (strstr($blockname, '.')!==false)216 {217 $blocks = explode('.', $blockname);218 $blockcount = count($blocks);219 $root_var = & $this->smarty->get_template_vars();220 221 $str = '$root_var';222 for ($i = 0; $i < $blockcount; $i++)223 {224 $str .= '[\'' . $blocks[$i] . '\']';225 eval('$lastiteration = isset('.$str.') ? sizeof('.$str.')-1:-1;');226 if ($lastiteration==-1)227 {228 return false;229 }230 $str .= '[' . $lastiteration . ']';231 }232 $str = $str.'=array_merge('.$str.', $vararray);';233 eval($str);234 }235 else236 $this->smarty->append( $blockname, $vararray, true );237 238 $this->_old->merge_block_vars($blockname, $vararray);239 return true;240 }241 242 160 /** see smarty assign http://www.smarty.net/manual/en/api.assign.php */ 243 161 function assign($tpl_var, $value = null) 244 162 { 245 163 $this->smarty->assign( $tpl_var, $value ); 246 247 if ( is_array($tpl_var) ) 248 $this->_old->assign_vars( $tpl_var ); 249 else 250 $this->_old->assign_var( $tpl_var, $value ); 251 } 252 164 } 165 253 166 /** 254 167 * Inserts the uncompiled code for $handle as the value of $varname in the … … 279 192 { 280 193 $old_val .= $value; 281 $this->_old->concat_var( $tpl_var, $value );282 194 } 283 195 else … … 312 224 } 313 225 314 $is_new = true; 315 $params = array('resource_name' => $this->files[$handle], 'quiet'=>true, 'get_source'=>true); 316 if ( $this->smarty->_fetch_resource_info($params) ) 317 { 318 if (!preg_match('~{(/(if|section|foreach))|ldelim|\$[a-zA-Z_]+}~', @$params['source_content']) ) 319 $is_new = false; 320 } 321 322 if ($is_new) 323 { 324 $this->smarty->assign( 'ROOT_URL', get_root_url() ); 325 $this->smarty->assign( 'TAG_INPUT_ENABLED', 326 ((is_adviser()) ? 'disabled="disabled" onclick="return false;"' : '')); 327 $v = $this->smarty->fetch($this->files[$handle], null, null, false); 328 } 329 else 330 { 331 $this->_old->assign_vars(array('TAG_INPUT_ENABLED' => 332 ((is_adviser()) ? 'disabled onclick="return false;"' : ''))); 333 $this->_old->set_filename( $handle, $this->files[$handle] ); 334 $v = $this->_old->parse($handle, true); 335 } 226 $this->smarty->assign( 'ROOT_URL', get_root_url() ); 227 $this->smarty->assign( 'TAG_INPUT_ENABLED', 228 ((is_adviser()) ? 'disabled="disabled" onclick="return false;"' : '')); 229 $v = $this->smarty->fetch($this->files[$handle], null, null, false); 336 230 if ($return) 337 231 { … … 387 281 /** 388 282 * explode variable modifier - similar to php explode 389 * 'Yes;No'|@explode:';' -> array('Yes', 'No') 283 * 'Yes;No'|@explode:';' -> array('Yes', 'No') 390 284 */ 391 285 /*static*/ function mod_explode($text, $delimiter=',') -
trunk/install.php
r2248 r2290 190 190 include(PHPWG_ROOT_PATH . 'admin/include/functions.php'); 191 191 include(PHPWG_ROOT_PATH . 'admin/include/functions_upgrade.php'); 192 include(PHPWG_ROOT_PATH . 'include/template. php');192 include(PHPWG_ROOT_PATH . 'include/template.class.php'); 193 193 194 194 if (isset($_GET['language'])) -
trunk/plugins/hello_world/main.inc.php
r2243 r2290 27 27 { 28 28 global $template, $page; 29 $template->assign _var( 'PAGE_BANNER',29 $template->assign( 'PAGE_BANNER', 30 30 '<h1>"'.$page['page_banner'].'" from PhpWebGallery plugin!</h1>'); 31 31 } -
trunk/upgrade.php
r2254 r2290 30 30 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 31 31 include_once(PHPWG_ROOT_PATH.'admin/include/functions_upgrade.php'); 32 include(PHPWG_ROOT_PATH.'include/template. php');32 include(PHPWG_ROOT_PATH.'include/template.class.php'); 33 33 34 34 include(PHPWG_ROOT_PATH.'include/mysql.inc.php'); … … 72 72 { 73 73 $tables = array(); 74 74 75 75 $query = ' 76 76 SHOW TABLES … … 121 121 { 122 122 global $last_time; 123 123 124 124 $new_time = get_moment(); 125 125 echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; … … 195 195 die('No upgrade required, the database structure is up to date'); 196 196 } 197 197 198 198 $template->assign( 199 199 'introduction', … … 290 290 if you encounter any problem.' 291 291 ); 292 292 293 293 $template->assign('infos', $page['infos']); 294 294 295 295 $query = ' 296 296 UPDATE '.USER_CACHE_TABLE.'
Note: See TracChangeset
for help on using the changeset viewer.