Changeset 1763060
- Timestamp:
- 11/10/2017 02:57:25 PM (7 years ago)
- Location:
- admin-bar-languages/trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
admin-bar-languages/trunk/README.md
r1010539 r1763060 8 8 9 9 1. Unzip plugin and upload `admin-bar-blog-languages` folder to the `/wp-content/plugins/` directory 10 2. 'Network Activate' the plugin through the 'Network admin' ->'Plugins' menu in WordPress10 2. 'Network Activate' the plugin through the 'Network admin' 'Plugins' menu in WordPress 11 11 12 12 ### Frequently Asked Questions … … 22 22 ### Changelog 23 23 24 25 26 27 24 28 #### 1.1 25 29 2014-10-20 -
admin-bar-languages/trunk/admin-bar-languages.php
r1010539 r1763060 3 3 Plugin Name: Admin bar languages 4 4 Plugin URI: http://wordpress.org/extend/plugins/admin-bar-languages/ 5 Description: Show flags at "My sites" list in WordPress admin bar.6 Version: 1. 15 Description: Show flags at "My sites" list in WordPress admin bar. 6 Version: 1. 7 7 Author: Mikael Korpela 8 8 Author URI: http://www.mikaelkorpela.fi … … 26 26 */ 27 27 28 defined('ABSPATH') or die( "No script kiddies please!");28 defined('ABSPATH') or die(); 29 29 30 30 … … 32 32 public function __construct() 33 33 { 34 add_action( 'init', array( $this, 'init_admin_bar_languages') );34 add_action( 'init', array() ); 35 35 } 36 36 … … 38 38 * Run this plugin only when we have admin bar up there... 39 39 */ 40 public function init_admin_bar_languages() {40 public function init_admin_bar_languages(){ 41 41 if( is_user_logged_in() && is_admin_bar_showing() ) { 42 add_action( 'wp_before_admin_bar_render', array( $this, 'flagatar_admin_bar') );43 add_action( 'admin_enqueue_scripts', array( $this, 'flagatar_style') );42 add_action( 'wp_before_admin_bar_render', array() ); 43 add_action( 'admin_enqueue_scripts', array() ); 44 44 } 45 45 46 if ( is_admin()){47 add_filter( 'plugin_row_meta', array( $this, 'flagatar_plugin_links'), 10, 2 );46 if ({ 47 add_filter( 'plugin_row_meta', array(), 10, 2 ); 48 48 } 49 49 } … … 65 65 66 66 // This is functionality for WP 4.0+ only 67 if ( version_compare( get_bloginfo( 'version' ), '4.0', '>=' ) ) {67 if( version_compare( get_bloginfo( 'version' ), '4.0', '>=' ) ) { 68 68 69 69 // Get native language names … … 71 71 $translations = ( function_exists( 'wp_get_available_translations' ) ) ? wp_get_available_translations() : array(); 72 72 73 } 74 else { 75 73 } else { 76 74 $translations = array(); 77 78 75 } 79 76 80 77 // Loop user's blogs trough 81 foreach ( (array) $wp_admin_bar->user->blogs as $blog ) {78 foreach( (array) $wp_admin_bar->user->blogs as $blog ) { 82 79 83 80 $node_id = 'blog-' . $blog->userblog_id; … … 85 82 $node = $wp_admin_bar->get_node( $node_id ); 86 83 87 if ( $node ) {84 if( $node ) { 88 85 89 86 // We'll put it back... … … 94 91 95 92 // Oh, just sometimes language returns empty on WP 4.0, try different key 96 if( empty($lang) && is_multisite() ) $lang = get_blog_option( $blog->userblog_id, 'language', 'en_US' );93 if() && is_multisite() ) $lang = get_blog_option( $blog->userblog_id, 'language', 'en_US' ); 97 94 98 95 // Still no language? Default to US. 99 if( empty( $lang) ) $lang = 'en_US';96 if( empty() ) $lang = 'en_US'; 100 97 101 98 // Blog name - and is this blog currently active? … … 106 103 107 104 // If we have name for this language, show it as title. Fall back to locale. 108 $node->meta['title'] = (isset($translations[$lang])) ? esc_attr( $translations[$lang]['english_name'] . ' (' . $translations[$lang]['native_name'] . ')' ) : esc_attr( $lang );105 $node->meta['title'] = ]['native_name'] . ')' ) : esc_attr( $lang ); 109 106 110 107 $wp_admin_bar->add_node( $node ); … … 116 113 * Add donation link on the plugin listing 117 114 */ 118 public function flagatar_plugin_links( $links, $file) {119 if ( $file == plugin_basename( dirname(__FILE__).'/admin-bar-languages.php') ) {120 $links[] = '<a href="http://www.mikaelkorpela.fi/volunteering/">' . __( 'Donate') . '</a>';115 public function flagatar_plugin_links() { 116 if ( $file == plugin_basename() ) { 117 $links[] = '<a href="http://www.mikaelkorpela.fi/volunteering/">' . __() . '</a>'; 121 118 } 122 119 return $links; -
admin-bar-languages/trunk/readme.txt
r1010539 r1763060 4 4 Tags: admin, i18n, l10n, localization, admin bar, adminbar, toolbar, menu, my sites, network, multi-site, multisite, MU, flags, flag, icon, icons 5 5 Requires at least: 3.6 6 Tested up to: 4. 07 Stable tag: 1. 16 Tested up to: 4. 7 Stable tag: 1. 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 43 43 == Changelog == 44 44 45 46 47 48 45 49 = 1.1 = 46 50 2014-10-20
Note: See TracChangeset
for help on using the changeset viewer.