Changeset 5177


Ignore:
Timestamp:
03/18/10 19:40:00 (10 years ago)
Author:
rvelices
Message:
  • allow template class to be instantiated with an empty theme (in plugins for example)
  • local_head must now be defined in the themeconf.inc.php otherwise not taken into account (avoid several calls to file_exists)
  • renamed themeconftheme to themeconfname (this is what it is themeconf[theme] is confusing)
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/themes/clear/themeconf.inc.php

    r5173 r5177  
    11<?php 
    22$themeconf = array( 
    3   'theme'    => 'clear', 
     3  'name'    => 'clear', 
    44  'parent'   => 'default', 
    55  'admin_icon_dir' => 'admin/themes/clear/icon', 
  • trunk/admin/themes/default/themeconf.inc.php

    r5123 r5177  
    11<?php 
    22$themeconf = array( 
    3   'theme'          => 'default', 
     3  'name'          => 'default', 
    44  'icon_dir'       => 'themes/default/icon', 
    55  'admin_icon_dir' => 'admin/themes/default/icon', 
    66  'mime_icon_dir'  => 'themes/default/icon/mimetypes/', 
     7  'local_head'     => 'local_head.tpl', 
    78); 
    89?> 
  • trunk/admin/themes/roma/themeconf.inc.php

    r5173 r5177  
    11<?php 
    22$themeconf = array( 
    3   'theme'  => 'roma', 
     3  'name'  => 'roma', 
    44  'parent' => 'default', 
    55); 
  • trunk/include/template.class.php

    r5154 r5177  
    2525require_once(PHPWG_ROOT_PATH.'include/smarty/libs/Smarty.class.php'); 
    2626 
    27 // migrate lang:XXX 
    28 //    sed "s/{lang:\([^}]\+\)}/{\'\1\'|@translate}/g" my_template.tpl 
    29 // migrate change root level vars {XXX} 
    30 //    sed "s/{pwg_root}/{ROOT_URL}/g" my_template.tpl 
    31 // migrate change root level vars {XXX} 
    32 //    sed "s/{\([a-zA-Z_]\+\)}/{$\1}/g" my_template.tpl 
    33 // migrate all 
    34 //    cat my_template.tpl | sed "s/{lang:\([^}]\+\)}/{\'\1\'|@translate}/g" | sed "s/{pwg_root}/{ROOT_URL}/g" | sed "s/{\([a-zA-Z_]\+\)}/{$\1}/g" 
    35  
    3627 
    3728class Template { 
     
    4940  // Templates prefilter from external sources (plugins) 
    5041  var $external_filters = array(); 
    51    
     42 
    5243  // used by html_head smarty block to add content before </head> 
    5344  var $html_head_elements = array(); 
     
    7970 
    8071    $this->smarty->template_dir = array(); 
    81     $this->set_theme($root, $theme, $path); 
     72    if ( !empty($theme) ) 
     73      $this->set_theme($root, $theme, $path); 
     74    else 
     75      $this->set_template_dir($root); 
    8276 
    8377    $this->smarty->assign('lang_info', $lang_info); 
     
    10498    } 
    10599 
    106     $tpl_var = array('name' => $themeconf['theme']); 
    107     if (file_exists($root.'/'.$theme.'/local_head.tpl')) 
    108     { 
    109       $tpl_var['local_head'] = realpath($root.'/'.$theme.'/local_head.tpl'); 
     100    $tpl_var = array('name' => $themeconf['name']); 
     101    if (!empty($themeconf['local_head']) ) 
     102    { 
     103      $tpl_var['local_head'] = realpath($root.'/'.$theme.'/'.$themeconf['local_head'] ); 
    110104    } 
    111105    $this->smarty->append('themes', $tpl_var); 
     
    469463    ksort($this->external_filters[$handle]); 
    470464  } 
    471    
     465 
    472466 /** 
    473467   * This function actually triggers the filters on the tpl files. 
     
    480474    { 
    481475      $compile_id = ''; 
    482       foreach ($this->external_filters[$handle] as $filters)  
    483       { 
    484         foreach ($filters as $filter)  
     476      foreach ($this->external_filters[$handle] as $filters) 
     477      { 
     478        foreach ($filters as $filter) 
    485479        { 
    486480          list($type, $callback) = $filter; 
     
    497491    if (isset($this->external_filters[$handle])) 
    498492    { 
    499       foreach ($this->external_filters[$handle] as $filters)  
    500       { 
    501         foreach ($filters as $filter)  
     493      foreach ($this->external_filters[$handle] as $filters) 
     494      { 
     495        foreach ($filters as $filter) 
    502496        { 
    503497          list($type, $callback) = $filter; 
  • trunk/themes/Sylvia/themeconf.inc.php

    r5123 r5177  
    11<?php 
    22$themeconf = array( 
    3   'theme'         => 'Sylvia', 
     3  'name'         => 'Sylvia', 
    44  'parent'        => 'default', 
    55  'icon_dir'      => 'themes/Sylvia/icon', 
  • trunk/themes/clear/themeconf.inc.php

    r5123 r5177  
    11<?php 
    22$themeconf = array( 
    3   'theme'  => 'clear', 
     3  'name'  => 'clear', 
    44  'parent' => 'default', 
    55); 
  • trunk/themes/dark/themeconf.inc.php

    r5123 r5177  
    11<?php 
    22$themeconf = array( 
    3   'theme'  => 'dark', 
     3  'name'  => 'dark', 
    44  'parent' => 'default', 
    55); 
  • trunk/themes/default/themeconf.inc.php

    r5123 r5177  
    11<?php 
    22$themeconf = array( 
    3   'theme'         => 'default', 
     3  'name'         => 'default', 
    44  'icon_dir'      => 'themes/default/icon', 
    55  'mime_icon_dir' => 'themes/default/icon/mimetypes/', 
     6  'local_head'    => 'local_head.tpl', 
    67); 
    78?> 
Note: See TracChangeset for help on using the changeset viewer.