feature 1522: Move local css local files and local language files to local directory.
Add $conf['template_force_compile'] to help developpers. git-svn-id: http://piwigo.org/svn/trunk@5208 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
af78fa6193
commit
6e51794b3f
12 changed files with 169 additions and 8 deletions
|
|
@ -39,7 +39,7 @@ $page['body_id'] = 'theAboutPage';
|
||||||
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
include(PHPWG_ROOT_PATH.'include/page_header.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set in ./language/en_UK.iso-8859-1/local.lang.php (maybe to create)
|
* set in ./local/language/en_UK.lang.php (maybe to create)
|
||||||
* for example for clear theme:
|
* for example for clear theme:
|
||||||
$lang['Theme: clear'] = 'This is the clear theme based on yoga template. '.
|
$lang['Theme: clear'] = 'This is the clear theme based on yoga template. '.
|
||||||
' A standard template/theme of PhpWebgallery.';
|
' A standard template/theme of PhpWebgallery.';
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ if ( is_admin() || (defined('IN_ADMIN') and IN_ADMIN) )
|
||||||
load_language('admin.lang');
|
load_language('admin.lang');
|
||||||
}
|
}
|
||||||
trigger_action('loading_lang');
|
trigger_action('loading_lang');
|
||||||
load_language('local.lang', '', array('no_fallback'=>true) );
|
load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) );
|
||||||
|
|
||||||
// only now we can set the localized username of the guest user (and not in
|
// only now we can set the localized username of the guest user (and not in
|
||||||
// include/user.inc.php)
|
// include/user.inc.php)
|
||||||
|
|
|
||||||
|
|
@ -475,6 +475,11 @@ $conf['compiled_template_cache_language'] = false;
|
||||||
// better performance.
|
// better performance.
|
||||||
$conf['template_compile_check'] = true;
|
$conf['template_compile_check'] = true;
|
||||||
|
|
||||||
|
// This forces Smarty to (re)compile templates on every invocation. This is
|
||||||
|
// handy for development and debugging. It should never be used in a
|
||||||
|
// production environment.
|
||||||
|
$conf['template_force_compile'] = false;
|
||||||
|
|
||||||
// this permit to show the php errors reporting (see INI 'error_reporting'
|
// this permit to show the php errors reporting (see INI 'error_reporting'
|
||||||
// for possible values)
|
// for possible values)
|
||||||
// gives an empty value '' to deactivate
|
// gives an empty value '' to deactivate
|
||||||
|
|
|
||||||
|
|
@ -583,7 +583,7 @@ function redirect_html( $url , $msg = '', $refresh_time = 0)
|
||||||
$user = build_user( $conf['guest_id'], true);
|
$user = build_user( $conf['guest_id'], true);
|
||||||
load_language('common.lang');
|
load_language('common.lang');
|
||||||
trigger_action('loading_lang');
|
trigger_action('loading_lang');
|
||||||
load_language('local.lang', '', array('no_fallback'=>true) );
|
load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) );
|
||||||
$template = new Template(PHPWG_ROOT_PATH.'themes', get_default_theme());
|
$template = new Template(PHPWG_ROOT_PATH.'themes', get_default_theme());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1168,6 +1168,7 @@ function get_pwg_charset()
|
||||||
* return - if true the file content is returned otherwise the file is evaluated as php
|
* return - if true the file content is returned otherwise the file is evaluated as php
|
||||||
* target_charset -
|
* target_charset -
|
||||||
* no_fallback - the language must be respected
|
* no_fallback - the language must be respected
|
||||||
|
* local - if true, get local language file
|
||||||
* @return boolean success status or a string if options['return'] is true
|
* @return boolean success status or a string if options['return'] is true
|
||||||
*/
|
*/
|
||||||
function load_language($filename, $dirname = '',
|
function load_language($filename, $dirname = '',
|
||||||
|
|
@ -1217,7 +1218,10 @@ function load_language($filename, $dirname = '',
|
||||||
$source_file = '';
|
$source_file = '';
|
||||||
foreach ($languages as $language)
|
foreach ($languages as $language)
|
||||||
{
|
{
|
||||||
$f = $dirname.$language.'/'.$filename;
|
$f = @$options['local'] ?
|
||||||
|
$dirname.$language.'.'.$filename:
|
||||||
|
$dirname.$language.'/'.$filename;
|
||||||
|
|
||||||
if (file_exists($f))
|
if (file_exists($f))
|
||||||
{
|
{
|
||||||
$source_file = $f;
|
$source_file = $f;
|
||||||
|
|
|
||||||
|
|
@ -255,7 +255,9 @@ function switch_lang_to($language)
|
||||||
// Translations are in admin file too
|
// Translations are in admin file too
|
||||||
load_language('admin.lang', '', array('language'=>$language) );
|
load_language('admin.lang', '', array('language'=>$language) );
|
||||||
trigger_action('loading_lang');
|
trigger_action('loading_lang');
|
||||||
load_language('local.lang', '', array('language'=>$language, 'no_fallback'=>true));
|
load_language('lang', PHPWG_ROOT_PATH.'local/',
|
||||||
|
array('language'=>$language, 'no_fallback'=>true, 'local'=>true)
|
||||||
|
);
|
||||||
|
|
||||||
$switch_lang['language'][$language]['lang_info'] = $lang_info;
|
$switch_lang['language'][$language]['lang_info'] = $lang_info;
|
||||||
$switch_lang['language'][$language]['lang'] = $lang;
|
$switch_lang['language'][$language]['lang'] = $lang;
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,8 @@ class Template {
|
||||||
|
|
||||||
$this->smarty = new Smarty;
|
$this->smarty = new Smarty;
|
||||||
$this->smarty->debugging = $conf['debug_template'];
|
$this->smarty->debugging = $conf['debug_template'];
|
||||||
$this->smarty->compile_check=$conf['template_compile_check'];
|
$this->smarty->compile_check = $conf['template_compile_check'];
|
||||||
|
$this->smarty->force_compile = $conf['template_force_compile'];
|
||||||
|
|
||||||
$compile_dir = $conf['local_data_dir'].'/templates_c';
|
$compile_dir = $conf['local_data_dir'].'/templates_c';
|
||||||
mkgetdir( $compile_dir );
|
mkgetdir( $compile_dir );
|
||||||
|
|
@ -70,7 +71,10 @@ class Template {
|
||||||
|
|
||||||
$this->smarty->template_dir = array();
|
$this->smarty->template_dir = array();
|
||||||
if ( !empty($theme) )
|
if ( !empty($theme) )
|
||||||
|
{
|
||||||
$this->set_theme($root, $theme, $path);
|
$this->set_theme($root, $theme, $path);
|
||||||
|
$this->set_prefilter( 'header', array('Template', 'prefilter_local_css') );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
$this->set_template_dir($root);
|
$this->set_template_dir($root);
|
||||||
|
|
||||||
|
|
@ -545,6 +549,30 @@ class Template {
|
||||||
|
|
||||||
return $source;
|
return $source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function prefilter_local_css($source, &$smarty)
|
||||||
|
{
|
||||||
|
$css = array();
|
||||||
|
|
||||||
|
foreach ($smarty->get_template_vars('themes') as $theme)
|
||||||
|
{
|
||||||
|
if (file_exists(PHPWG_ROOT_PATH.'local/css/'.$theme['id'].'-rules.css'))
|
||||||
|
{
|
||||||
|
array_push($css, '<link rel="stylesheet" type="text/css" href="{$ROOT_URL}local/css/'.$theme['id'].'-rules.css">');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (file_exists(PHPWG_ROOT_PATH.'local/css/rules.css'))
|
||||||
|
{
|
||||||
|
array_push($css, '<link rel="stylesheet" type="text/css" href="{$ROOT_URL}local/css/rules.css">');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($css))
|
||||||
|
{
|
||||||
|
$source = str_replace("\n</head>", "\n".implode( "\n", $css )."\n</head>", $source);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $source;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
30
local/config/index.php
Normal file
30
local/config/index.php
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
// | Piwigo - a PHP based picture gallery |
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
// | Copyright(C) 2008-2009 Piwigo Team http://piwigo.org |
|
||||||
|
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||||
|
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
// | This program is free software; you can redistribute it and/or modify |
|
||||||
|
// | it under the terms of the GNU General Public License as published by |
|
||||||
|
// | the Free Software Foundation |
|
||||||
|
// | |
|
||||||
|
// | This program is distributed in the hope that it will be useful, but |
|
||||||
|
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
|
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
|
// | General Public License for more details. |
|
||||||
|
// | |
|
||||||
|
// | You should have received a copy of the GNU General Public License |
|
||||||
|
// | along with this program; if not, write to the Free Software |
|
||||||
|
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||||
|
// | USA. |
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
|
||||||
|
// Recursive call
|
||||||
|
$url = '../';
|
||||||
|
header( 'Request-URI: '.$url );
|
||||||
|
header( 'Content-Location: '.$url );
|
||||||
|
header( 'Location: '.$url );
|
||||||
|
exit();
|
||||||
|
?>
|
||||||
30
local/css/index.php
Normal file
30
local/css/index.php
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
// | Piwigo - a PHP based picture gallery |
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
// | Copyright(C) 2008-2009 Piwigo Team http://piwigo.org |
|
||||||
|
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||||
|
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
// | This program is free software; you can redistribute it and/or modify |
|
||||||
|
// | it under the terms of the GNU General Public License as published by |
|
||||||
|
// | the Free Software Foundation |
|
||||||
|
// | |
|
||||||
|
// | This program is distributed in the hope that it will be useful, but |
|
||||||
|
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
|
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
|
// | General Public License for more details. |
|
||||||
|
// | |
|
||||||
|
// | You should have received a copy of the GNU General Public License |
|
||||||
|
// | along with this program; if not, write to the Free Software |
|
||||||
|
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||||
|
// | USA. |
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
|
||||||
|
// Recursive call
|
||||||
|
$url = '../';
|
||||||
|
header( 'Request-URI: '.$url );
|
||||||
|
header( 'Content-Location: '.$url );
|
||||||
|
header( 'Location: '.$url );
|
||||||
|
exit();
|
||||||
|
?>
|
||||||
30
local/index.php
Normal file
30
local/index.php
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
// | Piwigo - a PHP based picture gallery |
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
// | Copyright(C) 2008-2009 Piwigo Team http://piwigo.org |
|
||||||
|
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||||
|
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
// | This program is free software; you can redistribute it and/or modify |
|
||||||
|
// | it under the terms of the GNU General Public License as published by |
|
||||||
|
// | the Free Software Foundation |
|
||||||
|
// | |
|
||||||
|
// | This program is distributed in the hope that it will be useful, but |
|
||||||
|
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
|
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
|
// | General Public License for more details. |
|
||||||
|
// | |
|
||||||
|
// | You should have received a copy of the GNU General Public License |
|
||||||
|
// | along with this program; if not, write to the Free Software |
|
||||||
|
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||||
|
// | USA. |
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
|
||||||
|
// Recursive call
|
||||||
|
$url = '../';
|
||||||
|
header( 'Request-URI: '.$url );
|
||||||
|
header( 'Content-Location: '.$url );
|
||||||
|
header( 'Location: '.$url );
|
||||||
|
exit();
|
||||||
|
?>
|
||||||
30
local/language/index.php
Normal file
30
local/language/index.php
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
// | Piwigo - a PHP based picture gallery |
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
// | Copyright(C) 2008-2009 Piwigo Team http://piwigo.org |
|
||||||
|
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||||
|
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
// | This program is free software; you can redistribute it and/or modify |
|
||||||
|
// | it under the terms of the GNU General Public License as published by |
|
||||||
|
// | the Free Software Foundation |
|
||||||
|
// | |
|
||||||
|
// | This program is distributed in the hope that it will be useful, but |
|
||||||
|
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
|
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||||
|
// | General Public License for more details. |
|
||||||
|
// | |
|
||||||
|
// | You should have received a copy of the GNU General Public License |
|
||||||
|
// | along with this program; if not, write to the Free Software |
|
||||||
|
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||||
|
// | USA. |
|
||||||
|
// +-----------------------------------------------------------------------+
|
||||||
|
|
||||||
|
// Recursive call
|
||||||
|
$url = '../';
|
||||||
|
header( 'Request-URI: '.$url );
|
||||||
|
header( 'Content-Location: '.$url );
|
||||||
|
header( 'Location: '.$url );
|
||||||
|
exit();
|
||||||
|
?>
|
||||||
2
nbm.php
2
nbm.php
|
|
@ -34,7 +34,7 @@ include_once(PHPWG_ROOT_PATH.'admin/include/functions_notification_by_mail.inc.p
|
||||||
load_language('admin.lang');
|
load_language('admin.lang');
|
||||||
// Need to update a second time
|
// Need to update a second time
|
||||||
trigger_action('loading_lang');
|
trigger_action('loading_lang');
|
||||||
load_language('local.lang', '', array('no_fallback'=>true) );
|
load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,9 @@ class language_controler {
|
||||||
// Reload language only if it isn't the same one
|
// Reload language only if it isn't the same one
|
||||||
if ( $same !== $user['language']) {
|
if ( $same !== $user['language']) {
|
||||||
load_language('common.lang', '', array('language'=>$user['language']) );
|
load_language('common.lang', '', array('language'=>$user['language']) );
|
||||||
load_language('local.lang', '', array('language'=>$user['language'], 'no_fallback'=>true) );
|
load_language('lang', PHPWG_ROOT_PATH.'local/',
|
||||||
|
array('language'=>$user['language'], 'no_fallback'=>true, 'local'=>true)
|
||||||
|
);
|
||||||
if (defined('IN_ADMIN') and IN_ADMIN) { // Never currently
|
if (defined('IN_ADMIN') and IN_ADMIN) { // Never currently
|
||||||
load_language('admin.lang', '', array('language'=>$user['language']) );
|
load_language('admin.lang', '', array('language'=>$user['language']) );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue