aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/language_switch
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/language_switch')
-rw-r--r--plugins/language_switch/flags.tpl48
-rw-r--r--plugins/language_switch/icons/bg_BG.gifbin153 -> 0 bytes
-rw-r--r--plugins/language_switch/icons/bg_BG.jpgbin0 -> 1118 bytes
-rw-r--r--plugins/language_switch/icons/cz_CZ.gifbin903 -> 0 bytes
-rw-r--r--plugins/language_switch/icons/cz_CZ.jpgbin0 -> 1197 bytes
-rw-r--r--plugins/language_switch/icons/da_DK.jpgbin0 -> 1112 bytes
-rw-r--r--plugins/language_switch/icons/de_DE.gifbin899 -> 0 bytes
-rw-r--r--plugins/language_switch/icons/de_DE.jpgbin0 -> 1177 bytes
-rw-r--r--plugins/language_switch/icons/en_UK.gifbin1161 -> 0 bytes
-rw-r--r--plugins/language_switch/icons/en_UK.jpgbin0 -> 1278 bytes
-rw-r--r--plugins/language_switch/icons/es_AR.gifbin1166 -> 0 bytes
-rw-r--r--plugins/language_switch/icons/es_AR.jpgbin0 -> 1135 bytes
-rw-r--r--plugins/language_switch/icons/es_ES.gifbin1025 -> 0 bytes
-rw-r--r--plugins/language_switch/icons/es_ES.jpgbin0 -> 1173 bytes
-rw-r--r--plugins/language_switch/icons/fr_FR.gifbin236 -> 0 bytes
-rw-r--r--plugins/language_switch/icons/fr_FR.jpgbin0 -> 1083 bytes
-rw-r--r--plugins/language_switch/icons/hr_HR.gifbin545 -> 0 bytes
-rw-r--r--plugins/language_switch/icons/hr_HR.jpgbin0 -> 1253 bytes
-rw-r--r--plugins/language_switch/icons/hu_HU.gifbin1033 -> 0 bytes
-rw-r--r--plugins/language_switch/icons/hu_HU.jpgbin0 -> 1149 bytes
-rw-r--r--plugins/language_switch/icons/index.php30
-rw-r--r--plugins/language_switch/icons/it_IT.gifbin959 -> 0 bytes
-rw-r--r--plugins/language_switch/icons/it_IT.jpgbin0 -> 1059 bytes
-rw-r--r--plugins/language_switch/icons/ja_JP.jpgbin0 -> 800 bytes
-rw-r--r--plugins/language_switch/icons/mg_MG.gifbin215 -> 0 bytes
-rw-r--r--plugins/language_switch/icons/mg_MG.jpgbin0 -> 1136 bytes
-rw-r--r--plugins/language_switch/icons/nl_NL.gifbin103 -> 0 bytes
-rw-r--r--plugins/language_switch/icons/nl_NL.jpgbin0 -> 1181 bytes
-rw-r--r--plugins/language_switch/icons/pl_PL.gifbin156 -> 0 bytes
-rw-r--r--plugins/language_switch/icons/pl_PL.jpgbin0 -> 1132 bytes
-rw-r--r--plugins/language_switch/icons/pt_PT.gifbin902 -> 0 bytes
-rw-r--r--plugins/language_switch/icons/pt_PT.jpgbin0 -> 1139 bytes
-rw-r--r--plugins/language_switch/icons/ru_RU.gifbin89 -> 0 bytes
-rw-r--r--plugins/language_switch/icons/ru_RU.jpgbin0 -> 489 bytes
-rw-r--r--plugins/language_switch/icons/zh_CN.gifbin203 -> 0 bytes
-rw-r--r--plugins/language_switch/icons/zh_CN.jpgbin0 -> 1080 bytes
-rw-r--r--plugins/language_switch/language_switch-default.css15
-rw-r--r--plugins/language_switch/language_switch-ie6.css6
-rw-r--r--plugins/language_switch/language_switch.css16
-rw-r--r--plugins/language_switch/language_switch.inc.php49
-rw-r--r--plugins/language_switch/main.inc.php2
41 files changed, 134 insertions, 32 deletions
diff --git a/plugins/language_switch/flags.tpl b/plugins/language_switch/flags.tpl
new file mode 100644
index 000000000..7a30553ee
--- /dev/null
+++ b/plugins/language_switch/flags.tpl
@@ -0,0 +1,48 @@
+</ul>
+<ul class="categoryActions">
+<li class="menuf">
+ <div>
+ <ul>
+ <li>
+ <a rel="nofollow" href="#">
+ <img class="flags" src="{$lang_switch.Active.img}" alt="{$lang_switch.Active.alt}" title="{$lang_switch.Active.alt}"/>
+ </a>
+ <!--[if lte IE 6]>
+ <a rel="nofollow" href="#">
+ <img class="flags" src="{$lang_switch.Active.img}" alt="{$lang_switch.Active.alt}" title="{$lang_switch.Active.alt}"/>
+ <table>
+ <tr>
+ <td>
+ <![endif]-->
+ <ul class="flag-pan">
+ {foreach from=$lang_switch.flags key=code item=flag name=f}
+ <li>
+ <a rel="nofollow" href="{$flag.url}">
+ <img class="flags" src="{$flag.img}" alt="{$flag.alt}" title="{$flag.alt}"/>
+ </a>
+ </li>
+ {/foreach}
+ </ul>
+ <!--[if lte IE 6]>
+ </td>
+ </tr>
+ </table>
+ </a>
+ <![endif]-->
+ </li>
+ </ul>
+ </div>
+</li>
+{html_head}
+{if $themeconf.template=='yoga' and $themeconf.theme=='Sylvia'}
+<link rel="stylesheet" type="text/css" href="{$LANGUAGE_SWITCH_PATH|@cat:'language_switch.css'}">
+{else}
+<link rel="stylesheet" type="text/css" href="{$LANGUAGE_SWITCH_PATH|@cat:'language_switch-default.css'}">
+{/if}
+{if Componant_exists($LANGUAGE_SWITCH_PATH, 'language_switch-local.css')}
+<link rel="stylesheet" type="text/css" href="{$LANGUAGE_SWITCH_PATH|@cat:'language_switch-local.css'}">
+{/if}
+<!--[if lte IE 6]>
+<link rel="stylesheet" type="text/css" href="{$LANGUAGE_SWITCH_PATH|@cat:'language_switch-ie6.css'}">
+<![endif]-->
+{/html_head} \ No newline at end of file
diff --git a/plugins/language_switch/icons/bg_BG.gif b/plugins/language_switch/icons/bg_BG.gif
deleted file mode 100644
index 87b63669e..000000000
--- a/plugins/language_switch/icons/bg_BG.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/language_switch/icons/bg_BG.jpg b/plugins/language_switch/icons/bg_BG.jpg
new file mode 100644
index 000000000..1cad87973
--- /dev/null
+++ b/plugins/language_switch/icons/bg_BG.jpg
Binary files differ
diff --git a/plugins/language_switch/icons/cz_CZ.gif b/plugins/language_switch/icons/cz_CZ.gif
deleted file mode 100644
index 89686c417..000000000
--- a/plugins/language_switch/icons/cz_CZ.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/language_switch/icons/cz_CZ.jpg b/plugins/language_switch/icons/cz_CZ.jpg
new file mode 100644
index 000000000..3222866cd
--- /dev/null
+++ b/plugins/language_switch/icons/cz_CZ.jpg
Binary files differ
diff --git a/plugins/language_switch/icons/da_DK.jpg b/plugins/language_switch/icons/da_DK.jpg
new file mode 100644
index 000000000..8c98a892b
--- /dev/null
+++ b/plugins/language_switch/icons/da_DK.jpg
Binary files differ
diff --git a/plugins/language_switch/icons/de_DE.gif b/plugins/language_switch/icons/de_DE.gif
deleted file mode 100644
index 9b3009565..000000000
--- a/plugins/language_switch/icons/de_DE.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/language_switch/icons/de_DE.jpg b/plugins/language_switch/icons/de_DE.jpg
new file mode 100644
index 000000000..da843ade8
--- /dev/null
+++ b/plugins/language_switch/icons/de_DE.jpg
Binary files differ
diff --git a/plugins/language_switch/icons/en_UK.gif b/plugins/language_switch/icons/en_UK.gif
deleted file mode 100644
index 51b20e3c1..000000000
--- a/plugins/language_switch/icons/en_UK.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/language_switch/icons/en_UK.jpg b/plugins/language_switch/icons/en_UK.jpg
new file mode 100644
index 000000000..ad551d898
--- /dev/null
+++ b/plugins/language_switch/icons/en_UK.jpg
Binary files differ
diff --git a/plugins/language_switch/icons/es_AR.gif b/plugins/language_switch/icons/es_AR.gif
deleted file mode 100644
index 677979bc5..000000000
--- a/plugins/language_switch/icons/es_AR.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/language_switch/icons/es_AR.jpg b/plugins/language_switch/icons/es_AR.jpg
new file mode 100644
index 000000000..c4cb89682
--- /dev/null
+++ b/plugins/language_switch/icons/es_AR.jpg
Binary files differ
diff --git a/plugins/language_switch/icons/es_ES.gif b/plugins/language_switch/icons/es_ES.gif
deleted file mode 100644
index d0d5adbbb..000000000
--- a/plugins/language_switch/icons/es_ES.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/language_switch/icons/es_ES.jpg b/plugins/language_switch/icons/es_ES.jpg
new file mode 100644
index 000000000..2f3b9ceb4
--- /dev/null
+++ b/plugins/language_switch/icons/es_ES.jpg
Binary files differ
diff --git a/plugins/language_switch/icons/fr_FR.gif b/plugins/language_switch/icons/fr_FR.gif
deleted file mode 100644
index 9080a66bf..000000000
--- a/plugins/language_switch/icons/fr_FR.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/language_switch/icons/fr_FR.jpg b/plugins/language_switch/icons/fr_FR.jpg
new file mode 100644
index 000000000..c93b5e61e
--- /dev/null
+++ b/plugins/language_switch/icons/fr_FR.jpg
Binary files differ
diff --git a/plugins/language_switch/icons/hr_HR.gif b/plugins/language_switch/icons/hr_HR.gif
deleted file mode 100644
index 08b574745..000000000
--- a/plugins/language_switch/icons/hr_HR.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/language_switch/icons/hr_HR.jpg b/plugins/language_switch/icons/hr_HR.jpg
new file mode 100644
index 000000000..9089cd608
--- /dev/null
+++ b/plugins/language_switch/icons/hr_HR.jpg
Binary files differ
diff --git a/plugins/language_switch/icons/hu_HU.gif b/plugins/language_switch/icons/hu_HU.gif
deleted file mode 100644
index 4eb513589..000000000
--- a/plugins/language_switch/icons/hu_HU.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/language_switch/icons/hu_HU.jpg b/plugins/language_switch/icons/hu_HU.jpg
new file mode 100644
index 000000000..e9bbc459e
--- /dev/null
+++ b/plugins/language_switch/icons/hu_HU.jpg
Binary files differ
diff --git a/plugins/language_switch/icons/index.php b/plugins/language_switch/icons/index.php
deleted file mode 100644
index 871b52b6a..000000000
--- a/plugins/language_switch/icons/index.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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();
-?>
diff --git a/plugins/language_switch/icons/it_IT.gif b/plugins/language_switch/icons/it_IT.gif
deleted file mode 100644
index 0ee512d4c..000000000
--- a/plugins/language_switch/icons/it_IT.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/language_switch/icons/it_IT.jpg b/plugins/language_switch/icons/it_IT.jpg
new file mode 100644
index 000000000..dd9bbb95c
--- /dev/null
+++ b/plugins/language_switch/icons/it_IT.jpg
Binary files differ
diff --git a/plugins/language_switch/icons/ja_JP.jpg b/plugins/language_switch/icons/ja_JP.jpg
new file mode 100644
index 000000000..02336b394
--- /dev/null
+++ b/plugins/language_switch/icons/ja_JP.jpg
Binary files differ
diff --git a/plugins/language_switch/icons/mg_MG.gif b/plugins/language_switch/icons/mg_MG.gif
deleted file mode 100644
index 1c840948d..000000000
--- a/plugins/language_switch/icons/mg_MG.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/language_switch/icons/mg_MG.jpg b/plugins/language_switch/icons/mg_MG.jpg
new file mode 100644
index 000000000..c2c96df83
--- /dev/null
+++ b/plugins/language_switch/icons/mg_MG.jpg
Binary files differ
diff --git a/plugins/language_switch/icons/nl_NL.gif b/plugins/language_switch/icons/nl_NL.gif
deleted file mode 100644
index 520e994b7..000000000
--- a/plugins/language_switch/icons/nl_NL.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/language_switch/icons/nl_NL.jpg b/plugins/language_switch/icons/nl_NL.jpg
new file mode 100644
index 000000000..0c90262fe
--- /dev/null
+++ b/plugins/language_switch/icons/nl_NL.jpg
Binary files differ
diff --git a/plugins/language_switch/icons/pl_PL.gif b/plugins/language_switch/icons/pl_PL.gif
deleted file mode 100644
index 66f140606..000000000
--- a/plugins/language_switch/icons/pl_PL.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/language_switch/icons/pl_PL.jpg b/plugins/language_switch/icons/pl_PL.jpg
new file mode 100644
index 000000000..34a1ff3c5
--- /dev/null
+++ b/plugins/language_switch/icons/pl_PL.jpg
Binary files differ
diff --git a/plugins/language_switch/icons/pt_PT.gif b/plugins/language_switch/icons/pt_PT.gif
deleted file mode 100644
index c3127b148..000000000
--- a/plugins/language_switch/icons/pt_PT.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/language_switch/icons/pt_PT.jpg b/plugins/language_switch/icons/pt_PT.jpg
new file mode 100644
index 000000000..b9dd503d4
--- /dev/null
+++ b/plugins/language_switch/icons/pt_PT.jpg
Binary files differ
diff --git a/plugins/language_switch/icons/ru_RU.gif b/plugins/language_switch/icons/ru_RU.gif
deleted file mode 100644
index 39e20a8ba..000000000
--- a/plugins/language_switch/icons/ru_RU.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/language_switch/icons/ru_RU.jpg b/plugins/language_switch/icons/ru_RU.jpg
new file mode 100644
index 000000000..f2286f8e3
--- /dev/null
+++ b/plugins/language_switch/icons/ru_RU.jpg
Binary files differ
diff --git a/plugins/language_switch/icons/zh_CN.gif b/plugins/language_switch/icons/zh_CN.gif
deleted file mode 100644
index bfcae5cce..000000000
--- a/plugins/language_switch/icons/zh_CN.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/language_switch/icons/zh_CN.jpg b/plugins/language_switch/icons/zh_CN.jpg
new file mode 100644
index 000000000..fbcb52df5
--- /dev/null
+++ b/plugins/language_switch/icons/zh_CN.jpg
Binary files differ
diff --git a/plugins/language_switch/language_switch-default.css b/plugins/language_switch/language_switch-default.css
new file mode 100644
index 000000000..4f7872db3
--- /dev/null
+++ b/plugins/language_switch/language_switch-default.css
@@ -0,0 +1,15 @@
+.flag-pan { width:132px; z-index:100; border-width:1px; border-style: solid; background-color: #999; padding: 2px 5px 10px 5px; }
+.content ul.categoryActions .flag-pan a img.flags { margin: 5px 2px 10px; }
+.content ul.categoryActions .flag-pan a { margin: 0; }
+.menuf { width:30px; height:24px; display: inline; }
+.menuf ul li a, .menuf ul li a:visited {display:block; text-decoration:none; width:44px; height:27px; text-align:center; line-height:27px; overflow:hidden;}
+.menuf ul {padding:0; margin:0; list-style: none;}
+.menuf ul li {float:left; position:relative; right: 0; top: 0;}
+.menuf ul li ul {display: none;}/* specific to non IE browsers */
+.menuf li a:hover { border:0 !important;}
+.menuf .flags {border-width:1px !important; ; border-style: solid !important; }
+.menuf ul li:hover ul {display:block; position:absolute; top:0px; left:-96px; }
+.menuf ul li:hover ul li ul {display: none;}
+.menuf ul li:hover ul li {display: block;}
+.menuf ul li:hover ul li a {display:block;}
+.menuf ul li:hover ul li:hover ul {display:block; position:absolute; left:0px; top:0;} \ No newline at end of file
diff --git a/plugins/language_switch/language_switch-ie6.css b/plugins/language_switch/language_switch-ie6.css
new file mode 100644
index 000000000..73b92a6a2
--- /dev/null
+++ b/plugins/language_switch/language_switch-ie6.css
@@ -0,0 +1,6 @@
+.menuf ul li a.hide, .menuf ul li a:visited.hide {display:none;}
+.menuf ul li a:hover ul li a.hide {display:none;}
+.menuf ul li a:hover ul { display:block; position:absolute; top:-15%; left:-85%; }
+.menuf ul li a:hover ul li a {display:block; }
+.menuf ul li a:hover ul li a ul {visibility:hidden;}
+.menuf ul li a:hover ul li a:hover ul {visibility:visible; position:absolute; left:105px; top:0;} \ No newline at end of file
diff --git a/plugins/language_switch/language_switch.css b/plugins/language_switch/language_switch.css
new file mode 100644
index 000000000..434368366
--- /dev/null
+++ b/plugins/language_switch/language_switch.css
@@ -0,0 +1,16 @@
+.flag-pan { width:132px; z-index:100; border:2px solid; background-color: #111; padding: 2px 5px 10px 5px;
+-moz-border-radius-bottomleft:8px; -moz-border-radius-bottomright:8px; -moz-border-radius-topleft:8px; -moz-border-radius-topright:8px;}
+.content ul.categoryActions .flag-pan a img.flags { margin: 5px 2px 10px; }
+.content ul.categoryActions .flag-pan a { margin: 0; }
+.menuf { width:30px; height:24px; display: inline; }
+.menuf ul li a, .menuf ul li a:visited {display:block; text-decoration:none; width:44px; height:27px; text-align:center; line-height:27px; overflow:hidden;}
+.menuf ul {padding:0; margin:0; list-style: none;}
+.menuf ul li {float:left; position:relative; right: 0; top: 0;}
+.menuf ul li ul {display: none;}/* specific to non IE browsers */
+.menuf li a:hover { border:0 !important;}
+.menuf .flags {border:1px solid #000 !important; }
+.menuf ul li:hover ul {display:block; position:absolute; top:0px; left:-96px; }
+.menuf ul li:hover ul li ul {display: none;}
+.menuf ul li:hover ul li {display: block;}
+.menuf ul li:hover ul li a {display:block;}
+.menuf ul li:hover ul li:hover ul {display:block; position:absolute; left:0px; top:0;} \ No newline at end of file
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 ) );
diff --git a/plugins/language_switch/main.inc.php b/plugins/language_switch/main.inc.php
index aaf3f20c1..c5887c364 100644
--- a/plugins/language_switch/main.inc.php
+++ b/plugins/language_switch/main.inc.php
@@ -23,7 +23,7 @@
/*
Plugin Name: Language Switch
-Version: 2.0.2
+Version: 2.0.2a
Description: Switch to another language from flags on your gallery home page.
Plugin URI: http://piwigo.org/ext/extension_view.php?eid=123
Author: Piwigo team