aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/language_switch/language_switch.inc.php
diff options
context:
space:
mode:
authorvdigital <vdigital@piwigo.org>2009-05-29 21:46:58 +0000
committervdigital <vdigital@piwigo.org>2009-05-29 21:46:58 +0000
commitd5cd582ca257cf5eb9dc38d5f9f25ab7afaade4b (patch)
treed18cfe930022d9d222cb03e2e4b41927c02e710a /plugins/language_switch/language_switch.inc.php
parent24ce31b9b3c4fa98fd5df10eb1b3c132e833d64e (diff)
Merge: 3368
+ Language Switch enhanced design and concepts. git-svn-id: http://piwigo.org/svn/trunk@3369 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'plugins/language_switch/language_switch.inc.php')
-rw-r--r--plugins/language_switch/language_switch.inc.php49
1 files changed, 48 insertions, 1 deletions
diff --git a/plugins/language_switch/language_switch.inc.php b/plugins/language_switch/language_switch.inc.php
index 21a112567..07ba1e1ab 100644
--- a/plugins/language_switch/language_switch.inc.php
+++ b/plugins/language_switch/language_switch.inc.php
@@ -20,6 +20,8 @@
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
+if (!defined('LANGUAGE_SWITCH_PATH'))
+define('LANGUAGE_SWITCH_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/');
function language_switch()
{
global $user, $template, $conf, $lang;
@@ -66,11 +68,56 @@ function language_switch()
}
}
//if ( isset( $_GET['lang']) ) { redirect( make_index_url() ); }
-
function Lang_flags()
{
global $user, $template;
$available_lang = get_languages();
+ $lsw = array();
+ foreach ( $available_lang as $code => $displayname )
+ {
+ $qlc_url = add_url_params( make_index_url(), array( 'lang' => $code ) );
+ $qlc_alt = ucwords( $displayname );
+ $qlc_img = 'plugins/language_switch/icons/'
+ . $code . '.jpg';
+ if ( $code !== $user['language'] and file_exists(PHPWG_ROOT_PATH.$qlc_img) )
+ {
+ $lsw['flags'][$code] = Array(
+ 'url' => $qlc_url,
+ 'alt' => $qlc_alt,
+ 'img' => $qlc_img,
+ ) ;
+ } else {
+ $lsw['Active'] = Array(
+ 'url' => $qlc_url,
+ 'alt' => $qlc_alt,
+ 'img' => $qlc_img,
+ );
+ }
+ }
+ $template->set_filename('language_flags', dirname(__FILE__) . '/flags.tpl');
+ $lsw['side'] = ceil(sqrt(count($available_lang)));
+ $template->assign(array(
+ 'lang_switch'=> $lsw,
+ 'LANGUAGE_SWITCH_PATH' => LANGUAGE_SWITCH_PATH,
+ ));
+ $flags = $template->parse('language_flags',true);
+ $template->clear_assign('lang_switch');
+ $template->concat( 'PLUGIN_INDEX_ACTIONS', $flags);
+ // In state of making a $flags each time TODO Caching $flags[$user['language']]
+}
+
+if (!function_exists('Componant_exists')) {
+ function Componant_exists($path, $file)
+ {
+ return file_exists( $path . $file);
+ }
+}
+
+// Should be deleted later
+function Lang_flags_previous_function()
+{
+ global $user, $template;
+ $available_lang = get_languages();
foreach ( $available_lang as $code => $displayname )
{
$qlc_url = add_url_params( make_index_url(), array( 'lang' => $code ) );