Changeset 5208


Ignore:
Timestamp:
Mar 21, 2010, 12:14:30 AM (14 years ago)
Author:
patdenice
Message:

feature 1522: Move local css local files and local language files to local directory.
Add $conftemplate_force_compile to help developpers.

Location:
trunk
Files:
8 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/about.php

    r5196 r5208  
    4040
    4141/**
    42  * set in ./language/en_UK.iso-8859-1/local.lang.php (maybe to create)
     42 * set in ./local/language/en_UK.lang.php (maybe to create)
    4343 * for example for clear theme:
    4444  $lang['Theme: clear'] = 'This is the clear theme based on yoga template. '.
  • trunk/include/common.inc.php

    r5196 r5208  
    137137}
    138138trigger_action('loading_lang');
    139 load_language('local.lang', '', array('no_fallback'=>true) );
     139load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) );
    140140
    141141// only now we can set the localized username of the guest user (and not in
  • trunk/include/config_default.inc.php

    r5196 r5208  
    475475// better performance.
    476476$conf['template_compile_check'] = true;
     477
     478// This forces Smarty to (re)compile templates on every invocation. This is
     479// handy for development and debugging. It should never be used in a
     480// production environment.
     481$conf['template_force_compile'] = false;
    477482
    478483// this permit to show the php errors reporting (see INI 'error_reporting'
  • trunk/include/functions.inc.php

    r5200 r5208  
    584584    load_language('common.lang');
    585585    trigger_action('loading_lang');
    586     load_language('local.lang', '', array('no_fallback'=>true) );
     586    load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) );
    587587    $template = new Template(PHPWG_ROOT_PATH.'themes', get_default_theme());
    588588  }
     
    11691169 *     target_charset -
    11701170 *     no_fallback - the language must be respected
     1171 *     local - if true, get local language file
    11711172 * @return boolean success status or a string if options['return'] is true
    11721173 */
     
    12181219  foreach ($languages as $language)
    12191220  {
    1220     $f = $dirname.$language.'/'.$filename;
     1221    $f = @$options['local'] ?
     1222      $dirname.$language.'.'.$filename:
     1223      $dirname.$language.'/'.$filename;
     1224
    12211225    if (file_exists($f))
    12221226    {
  • trunk/include/functions_mail.inc.php

    r5196 r5208  
    256256    load_language('admin.lang', '', array('language'=>$language) );
    257257    trigger_action('loading_lang');
    258     load_language('local.lang', '', array('language'=>$language, 'no_fallback'=>true));
     258    load_language('lang', PHPWG_ROOT_PATH.'local/',
     259      array('language'=>$language, 'no_fallback'=>true, 'local'=>true)
     260    );
    259261
    260262    $switch_lang['language'][$language]['lang_info'] = $lang_info;
  • trunk/include/template.class.php

    r5196 r5208  
    5050    $this->smarty = new Smarty;
    5151    $this->smarty->debugging = $conf['debug_template'];
    52     $this->smarty->compile_check=$conf['template_compile_check'];
     52    $this->smarty->compile_check = $conf['template_compile_check'];
     53    $this->smarty->force_compile = $conf['template_force_compile'];
    5354
    5455    $compile_dir = $conf['local_data_dir'].'/templates_c';
     
    7172    $this->smarty->template_dir = array();
    7273    if ( !empty($theme) )
     74    {
    7375      $this->set_theme($root, $theme, $path);
     76      $this->set_prefilter( 'header', array('Template', 'prefilter_local_css') );
     77    }
    7478    else
    7579      $this->set_template_dir($root);
     
    546550    return $source;
    547551  }
     552
     553  static function prefilter_local_css($source, &$smarty)
     554  {
     555    $css = array();
     556
     557    foreach ($smarty->get_template_vars('themes') as $theme)
     558    {
     559      if (file_exists(PHPWG_ROOT_PATH.'local/css/'.$theme['id'].'-rules.css'))
     560      {
     561        array_push($css, '<link rel="stylesheet" type="text/css" href="{$ROOT_URL}local/css/'.$theme['id'].'-rules.css">');
     562      }
     563    }
     564    if (file_exists(PHPWG_ROOT_PATH.'local/css/rules.css'))
     565    {
     566      array_push($css, '<link rel="stylesheet" type="text/css" href="{$ROOT_URL}local/css/rules.css">');
     567    }
     568
     569    if (!empty($css))
     570    {
     571      $source = str_replace("\n</head>", "\n".implode( "\n", $css )."\n</head>", $source);
     572    }
     573
     574    return $source;
     575  }
    548576}
    549577
  • trunk/nbm.php

    r5196 r5208  
    3535// Need to update a second time
    3636trigger_action('loading_lang');
    37 load_language('local.lang', '', array('no_fallback'=>true) );
     37load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) );
    3838
    3939
  • trunk/plugins/language_switch/language_switch.inc.php

    r5196 r5208  
    5050    if ( $same !== $user['language']) {
    5151      load_language('common.lang', '', array('language'=>$user['language']) );
    52       load_language('local.lang', '', array('language'=>$user['language'], 'no_fallback'=>true) );
     52      load_language('lang', PHPWG_ROOT_PATH.'local/',
     53        array('language'=>$user['language'], 'no_fallback'=>true, 'local'=>true)
     54      );
    5355      if (defined('IN_ADMIN') and IN_ADMIN) { // Never currently
    5456        load_language('admin.lang', '', array('language'=>$user['language']) );
Note: See TracChangeset for help on using the changeset viewer.