- Timestamp:
- May 29, 2009, 11:26:27 PM (15 years ago)
- Location:
- branches/2.0/plugins/language_switch
- Files:
-
- 22 added
- 18 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/plugins/language_switch/language_switch.inc.php
r3046 r3368 21 21 // | USA. | 22 22 // +-----------------------------------------------------------------------+ 23 if (!defined('LANGUAGE_SWITCH_PATH')) 24 define('LANGUAGE_SWITCH_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); 23 25 function language_switch() 24 26 { … … 67 69 } 68 70 //if ( isset( $_GET['lang']) ) { redirect( make_index_url() ); } 71 function Lang_flags() 72 { 73 global $user, $template; 74 $available_lang = get_languages(); 75 $lsw = array(); 76 foreach ( $available_lang as $code => $displayname ) 77 { 78 $qlc_url = add_url_params( make_index_url(), array( 'lang' => $code ) ); 79 $qlc_alt = ucwords( $displayname ); 80 $qlc_img = 'plugins/language_switch/icons/' 81 . $code . '.jpg'; 82 if ( $code !== $user['language'] and file_exists(PHPWG_ROOT_PATH.$qlc_img) ) 83 { 84 $lsw['flags'][$code] = Array( 85 'url' => $qlc_url, 86 'alt' => $qlc_alt, 87 'img' => $qlc_img, 88 ) ; 89 } else { 90 $lsw['Active'] = Array( 91 'url' => $qlc_url, 92 'alt' => $qlc_alt, 93 'img' => $qlc_img, 94 ); 95 } 96 } 97 $template->set_filename('language_flags', dirname(__FILE__) . '/flags.tpl'); 98 $lsw['side'] = ceil(sqrt(count($available_lang))); 99 $template->assign(array( 100 'lang_switch'=> $lsw, 101 'LANGUAGE_SWITCH_PATH' => LANGUAGE_SWITCH_PATH, 102 )); 103 $flags = $template->parse('language_flags',true); 104 $template->clear_assign('lang_switch'); 105 $template->concat( 'PLUGIN_INDEX_ACTIONS', $flags); 106 // In state of making a $flags each time TODO Caching $flags[$user['language']] 107 } 69 108 70 function Lang_flags() 109 if (!function_exists('Componant_exists')) { 110 function Componant_exists($path, $file) 111 { 112 return file_exists( $path . $file); 113 } 114 } 115 116 // Should be deleted later 117 function Lang_flags_previous_function() 71 118 { 72 119 global $user, $template; -
branches/2.0/plugins/language_switch/main.inc.php
r3274 r3368 24 24 /* 25 25 Plugin Name: Language Switch 26 Version: 2.0.2 26 Version: 2.0.2a 27 27 Description: Switch to another language from flags on your gallery home page. 28 28 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=123
Note: See TracChangeset
for help on using the changeset viewer.