Merge: 3368
+ Language Switch enhanced design and concepts. git-svn-id: http://piwigo.org/svn/trunk@3369 68402e56-0260-453c-a942-63ccdbb3a9ee
48
plugins/language_switch/flags.tpl
Normal file
|
@ -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}
|
Before Width: | Height: | Size: 153 B |
BIN
plugins/language_switch/icons/bg_BG.jpg
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 903 B |
BIN
plugins/language_switch/icons/cz_CZ.jpg
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
plugins/language_switch/icons/da_DK.jpg
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 899 B |
BIN
plugins/language_switch/icons/de_DE.jpg
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
BIN
plugins/language_switch/icons/en_UK.jpg
Normal file
After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.1 KiB |
BIN
plugins/language_switch/icons/es_AR.jpg
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1 KiB |
BIN
plugins/language_switch/icons/es_ES.jpg
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 236 B |
BIN
plugins/language_switch/icons/fr_FR.jpg
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 545 B |
BIN
plugins/language_switch/icons/hr_HR.jpg
Normal file
After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1 KiB |
BIN
plugins/language_switch/icons/hu_HU.jpg
Normal file
After Width: | Height: | Size: 1.1 KiB |
|
@ -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();
|
||||
?>
|
Before Width: | Height: | Size: 959 B |
BIN
plugins/language_switch/icons/it_IT.jpg
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
plugins/language_switch/icons/ja_JP.jpg
Normal file
After Width: | Height: | Size: 800 B |
Before Width: | Height: | Size: 215 B |
BIN
plugins/language_switch/icons/mg_MG.jpg
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 103 B |
BIN
plugins/language_switch/icons/nl_NL.jpg
Normal file
After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 156 B |
BIN
plugins/language_switch/icons/pl_PL.jpg
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 902 B |
BIN
plugins/language_switch/icons/pt_PT.jpg
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 89 B |
BIN
plugins/language_switch/icons/ru_RU.jpg
Normal file
After Width: | Height: | Size: 489 B |
Before Width: | Height: | Size: 203 B |
BIN
plugins/language_switch/icons/zh_CN.jpg
Normal file
After Width: | Height: | Size: 1.1 KiB |
15
plugins/language_switch/language_switch-default.css
Normal file
|
@ -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;}
|
6
plugins/language_switch/language_switch-ie6.css
Normal file
|
@ -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;}
|
16
plugins/language_switch/language_switch.css
Normal file
|
@ -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;}
|
|
@ -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,8 +68,53 @@ 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();
|
||||
|
|
|
@ -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
|
||||
|
|