Changeset 2058613
- Timestamp:
- 03/28/2019 12:56:57 AM (7 years ago)
- Location:
- multisite-admin-bar-switcher/trunk
- Files:
-
- 2 added
- 2 edited
-
.gitignore (added)
-
composer.json (added)
-
multisite-admin-bar-switcher.php (modified) (7 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
multisite-admin-bar-switcher/trunk/multisite-admin-bar-switcher.php
r1667437 r2058613 4 4 Plugin URI: http://www.flynsarmy.com 5 5 Description: Replaces the built in 'My Sites' drop down with a better layed out one 6 Version: 1. 2.66 Version: 1.3.0 7 7 Author: Flyn San 8 8 Author URI: http://www.flynsarmy.com/ … … 37 37 }); 38 38 39 add_action( 'add_admin_bar_menus', 'mabs_remove_admin_bar_menus'); 40 function mabs_remove_admin_bar_menus() 41 { 39 add_action( 'add_admin_bar_menus', function() { 42 40 if ( is_multisite() ) 43 41 { … … 45 43 remove_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20 ); 46 44 } 47 } 45 }); 48 46 49 47 function mabs_require_with($partial, $data) … … 171 169 delete_site_transient('mabs_bloglist_'.$user_id); 172 170 delete_site_transient('mabs_is_below_min_'.$user_id); 171 delete_site_transient('mabs_admin_urls'); 173 172 delete_site_transient('mabs_bloglist_network'); 174 173 } … … 259 258 } 260 259 260 function mabs_get_admin_url( $userblog_id ) 261 { 262 $cache = get_site_transient('mabs_admin_urls'); 263 264 if ( !is_array($cache) ) 265 $cache = []; 266 267 if ( !isset($cache[$userblog_id]) ) 268 { 269 $cache[$userblog_id] = get_admin_url($userblog_id); 270 set_site_transient('mabs_admin_urls', $cache, apply_filters('mabs_cache_duration', 60*60*30)); 271 } 272 273 return $cache[$userblog_id]; 274 } 275 261 276 /** 262 277 * Add the blog list under their respective letters … … 293 308 $letter = mb_strtoupper(mb_substr($key, 0, 1)); 294 309 $site_parent = "mabs_".$letter."_letter"; 295 $admin_url = !empty($blog->external_site) ? $blog->adminurl : get_admin_url( $blog->userblog_id );310 $admin_url = !empty($blog->external_site) ? $blog->adminurl : mabs_get_admin_url( $blog->userblog_id ); 296 311 297 312 //Add the site … … 415 430 } 416 431 432 /** 433 * @return array of stdClass 434 * ( 435 * [userblog_id] => 1 436 * [blogname] => My Blog 437 * [domain] => myblog.localhost.com 438 * [path] => / 439 * [site_id] => 1 440 * [siteurl] => http://myblog.localhost.com 441 * [archived] => 0 442 * [spam] => 0 443 * [deleted] => 0 444 * ) 445 */ 417 446 function mabs_get_blogs_of_network() 418 447 { -
multisite-admin-bar-switcher/trunk/readme.txt
r1667437 r2058613 3 3 Tags: multisite, toolbar, switcher, switch, network, admin, wpmu 4 4 Requires at least: 3.2.1 5 Tested up to: 4.66 Stable tag: 1. 2.65 Tested up to: 5.1.1 6 Stable tag: 1.3.0 7 7 8 8 == Description == … … 78 78 79 79 == Changelog == 80 81 = 1.3.0 = 82 * Cache admin URLs to avoid hitting the DB 80 83 81 84 = 1.2.6 =
Note: See TracChangeset
for help on using the changeset viewer.