aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/language_switch/language_switch.inc.php
diff options
context:
space:
mode:
authorvdigital <vdigital@piwigo.org>2009-05-29 21:26:27 +0000
committervdigital <vdigital@piwigo.org>2009-05-29 21:26:27 +0000
commitb31faf23b521417ca2bc5dbcea24f5f13608214b (patch)
tree1b805fc3703f6a1997f9cae2312693b247b96598 /plugins/language_switch/language_switch.inc.php
parentb6ed391396c02b2ccaf67a65649cbe363b644442 (diff)
+ Language Switch enhanced design and concepts.
git-svn-id: http://piwigo.org/svn/branches/2.0@3368 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 ) );