Changeset 2290


Ignore:
Timestamp:
Mar 23, 2008, 1:04:46 AM (16 years ago)
Author:
rvelices
Message:
  • remove compatibility with old template ...
Location:
trunk
Files:
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/tabsheet.class.php

    r2226 r2290  
    135135
    136136    $selected_tab = $this->get_selected();
    137    
     137
    138138    if (isset($selected_tab))
    139139    {
    140       $template->assign_vars(
     140      $template->assign(
    141141        array($this->titlename => '['.$selected_tab['caption'].']'));
    142142    }
  • trunk/include/common.inc.php

    r2240 r2290  
    139139include(PHPWG_ROOT_PATH . 'include/constants.php');
    140140include(PHPWG_ROOT_PATH . 'include/functions.inc.php');
    141 include(PHPWG_ROOT_PATH . 'include/template.php');
     141include(PHPWG_ROOT_PATH . 'include/template.class.php');
    142142
    143143// Database connection
  • trunk/include/functions_category.inc.php

    r2265 r2290  
    279279  global $template;
    280280
    281   // TODO - remove from here after old template removed
     281  $tpl_cats = array();
    282282  foreach ($categories as $category)
    283283  {
    284     $selected = '';
    285     if (in_array($category['id'], $selecteds))
    286     {
    287       $selected = ' selected="selected"';
    288     }
    289 
    290284    if ($fullname)
    291285    {
     
    300294      $option.= '- '.$category['name'];
    301295    }
    302 
    303     $template->_old->assign_block_vars(
    304       $blockname,
    305       array('SELECTED'=>$selected,
    306             'VALUE'=>$category['id'],
    307             'OPTION'=>$option
    308         ));
    309   }
    310   // TODO - remove until here after old template removed
    311   $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     else
    321     {
    322       $option = str_repeat(' ',
    323                            (3 * substr_count($category['global_rank'], '.')));
    324       $option.= '- '.$category['name'];
    325     }
    326296    $tpl_cats[ $category['id'] ] = $option;
    327297  }
    328298
    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);
    331301}
    332302
  • trunk/include/functions_html.inc.php

    r2265 r2290  
    3333    return '';
    3434  }
    35  
     35
    3636  if (isset($page['get_icon_cache'][$date]))
    3737  {
     
    714714}
    715715
    716 /**
    717  * set a class to display a counter
    718  * .zero .one .plural
    719  */
    720 function set_span_class($count)
    721 {
    722   if ($count > 1)
    723   {
    724     return 'plural';
    725   }
    726   return ( $count == 0 ) ? 'zero':'one';
    727 }
    728 
    729716/** returns the category comment for rendering in html.
    730717 * this is an event handler. don't call directly
  • trunk/include/template.class.php

    r2286 r2290  
    2626
    2727
    28 require 'smarty/libs/Smarty.class.php';
     28require_once 'smarty/libs/Smarty.class.php';
    2929
    3030// migrate lang:XXX
     
    4242  var $smarty;
    4343
    44   var $_old;
    45 
    4644  var $output = '';
    4745
     
    8987    }
    9088
    91     $this->_old = & new TemplateOld($root, $theme);
    92 
    9389    $this->set_template_dir($root);
    9490  }
     
    9995  function set_template_dir($dir)
    10096  {
    101     $this->_old->set_rootdir($dir);
    10297    $this->smarty->template_dir = $dir;
    10398
     
    163158  }
    164159
    165   /**
    166    * DEPRECATED - backward compatibility only; use assign
    167    */
    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 assign
    176    */
    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 only
    185    */
    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     else
    205       $this->smarty->append( $blockname, $vararray );
    206 
    207     $this->_old->assign_block_vars($blockname, $vararray);
    208   }
    209 
    210   /**
    211    * DEPRECATED - backward compatibility only
    212    */
    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     else
    236       $this->smarty->append( $blockname, $vararray, true );
    237 
    238     $this->_old->merge_block_vars($blockname, $vararray);
    239     return true;
    240   }
    241 
    242160  /** see smarty assign http://www.smarty.net/manual/en/api.assign.php */
    243161  function assign($tpl_var, $value = null)
    244162  {
    245163    $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
    253166  /**
    254167   * Inserts the uncompiled code for $handle as the value of $varname in the
     
    279192    {
    280193      $old_val .= $value;
    281       $this->_old->concat_var( $tpl_var, $value );
    282194    }
    283195    else
     
    312224    }
    313225
    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);
    336230    if ($return)
    337231    {
     
    387281  /**
    388282   * explode variable modifier - similar to php explode
    389    * 'Yes;No'|@explode:';' -> array('Yes', 'No')   
     283   * 'Yes;No'|@explode:';' -> array('Yes', 'No')
    390284   */
    391285  /*static*/ function mod_explode($text, $delimiter=',')
  • trunk/install.php

    r2248 r2290  
    190190include(PHPWG_ROOT_PATH . 'admin/include/functions.php');
    191191include(PHPWG_ROOT_PATH . 'admin/include/functions_upgrade.php');
    192 include(PHPWG_ROOT_PATH . 'include/template.php');
     192include(PHPWG_ROOT_PATH . 'include/template.class.php');
    193193
    194194if (isset($_GET['language']))
  • trunk/plugins/hello_world/main.inc.php

    r2243 r2290  
    2727{
    2828  global $template, $page;
    29   $template->assign_var( 'PAGE_BANNER',
     29  $template->assign( 'PAGE_BANNER',
    3030    '<h1>"'.$page['page_banner'].'" from PhpWebGallery plugin!</h1>');
    3131}
  • trunk/upgrade.php

    r2254 r2290  
    3030include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
    3131include_once(PHPWG_ROOT_PATH.'admin/include/functions_upgrade.php');
    32 include(PHPWG_ROOT_PATH.'include/template.php');
     32include(PHPWG_ROOT_PATH.'include/template.class.php');
    3333
    3434include(PHPWG_ROOT_PATH.'include/mysql.inc.php');
     
    7272{
    7373  $tables = array();
    74  
     74
    7575  $query = '
    7676SHOW TABLES
     
    121121{
    122122  global $last_time;
    123  
     123
    124124  $new_time = get_moment();
    125125  echo '<pre>['.get_elapsed_time($last_time, $new_time).']';
     
    195195    die('No upgrade required, the database structure is up to date');
    196196  }
    197  
     197
    198198  $template->assign(
    199199    'introduction',
     
    290290if you encounter any problem.'
    291291      );
    292    
     292
    293293    $template->assign('infos', $page['infos']);
    294    
     294
    295295    $query = '
    296296UPDATE '.USER_CACHE_TABLE.'
Note: See TracChangeset for help on using the changeset viewer.