Skip to content

Commit

Permalink
Fixed code bugs to issue #12 and new release
Browse files Browse the repository at this point in the history
  • Loading branch information
bueltge committed Oct 23, 2014
1 parent 264d0f6 commit b8b36c9
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 14 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "bueltge/WordPress-Multisite-Enhancements",
"description": "Enhance Multisite for Network Admins with different topics.",
"license": "GPL 2+",
"version": "1.0.6",
"version": "1.0.7",
"type": "wordpress-plugin",
"authors": [
{
Expand Down
32 changes: 21 additions & 11 deletions inc/autoload/class-add-admin-favicon.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ public function set_favicon() {
$output .= '<style>';
$output .= '#wpadminbar #wp-admin-bar-site-name>.ab-item:before { content: none !important;}';
$output .= 'li#wp-admin-bar-site-name a { background: url( "'
. $stylesheet_dir_uri . $this->get_favicon_path(
) . '" ) left center/20px no-repeat !important; padding-left: 21px !important; background-size: 20px !important; } li#wp-admin-bar-site-name { margin-left: 5px !important; } li#wp-admin-bar-site-name {} #wp-admin-bar-site-name div a { background: none !important; }' . "\n";
. $stylesheet_dir_uri . $this->get_favicon_path()
. '" ) left center/20px no-repeat !important; padding-left: 21px !important; background-size: 20px !important; } li#wp-admin-bar-site-name { margin-left: 5px !important; } li#wp-admin-bar-site-name {} #wp-admin-bar-site-name div a { background: none !important; }' . "\n";
$output .= '</style>';
}

Expand Down Expand Up @@ -139,13 +139,15 @@ public function set_admin_bar_blog_icon() {
$stylesheet_dir = "$theme_root/$stylesheet";

// create favicon directory and directory url locations
$favicon_dir_uri = $this->get_favicon_path($blog[ 'blog_id' ], $stylesheet_dir_uri, 'url' );
$favicon_dir = $this->get_favicon_path($blog[ 'blog_id' ], $stylesheet_dir, 'dir' );
$favicon_dir_uri = $this->get_favicon_path( $blog[ 'blog_id' ], $stylesheet_dir_uri, 'url' );
$favicon_dir = $this->get_favicon_path( $blog[ 'blog_id' ], $stylesheet_dir, 'dir' );

if ( file_exists( $favicon_dir ) ) {
$output .= '#wpadminbar .quicklinks li#wp-admin-bar-blog-' . $blog[ 'blog_id' ] . ' .blavatar { font-size: 0 !important; }';
$output .= '#wp-admin-bar-blog-' . $blog[ 'blog_id' ] . ' div.blavatar { background: url( "'
. $favicon_dir_uri . '" ) left bottom/16px no-repeat !important; background-size: 16px !important; margin: 0 2px 0 -2px; }' . "\n";
$output .= '#wpadminbar .quicklinks li#wp-admin-bar-blog-' . $blog[ 'blog_id' ]
. ' .blavatar { font-size: 0 !important; }';
$output .= '#wp-admin-bar-blog-' . $blog[ 'blog_id' ]
. ' div.blavatar { background: url( "' . $favicon_dir_uri
. '" ) left bottom/16px no-repeat !important; background-size: 16px !important; margin: 0 2px 0 -2px; }' . "\n";
}
}

Expand Down Expand Up @@ -187,9 +189,17 @@ public function change_admin_bar_menu( $admin_bar ) {
*
* @since 1.0.5
*
* @param integer ID of blog in network
* @param string Path to Favicon
* @param string Path type 'url' or 'dir'
*
* @return string File path to favicon file.
*/
protected function get_favicon_path($blog_id, $path, $path_type) {
protected function get_favicon_path( $blog_id = '', $path = '', $path_type = 'url' ) {

if ( empty( $blog_id ) ) {
$blog_id = get_current_blog_id();
}

/**
* Filter the file path to the favicon file.
Expand All @@ -209,8 +219,8 @@ protected function get_favicon_path($blog_id, $path, $path_type) {
* $path_type = 'dir' -> use URL for the location in the server, used to check if the file exists
*
*/
return apply_filters( 'multisite_enhancements_favicon_path', $path.'/favicon.ico', $blog_id, $path_type );

return apply_filters( 'multisite_enhancements_favicon_path', $path . '/favicon.ico', $blog_id, $path_type );
}

} // end class
2 changes: 1 addition & 1 deletion multisite-enhancements.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Multisite Enhancements
* Description: Enhance Multisite for Network Admins with different topics
* Plugin URI: https://github.com/bueltge/WordPress-Multisite-Enhancements
* Version: 1.0.6
* Version: 1.0.7
* Author: Frank Bültge
* Author URI: http://bueltge.de
* License: GPLv2+
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Contributors: Bueltge, inpsyde
Tags: multisite, administration, admin bar, network,
Requires at least: 3.0.0
Tested up to: 4.0
Tested up to: 4.1-alpha
Stable tag: trunk
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -83,6 +83,10 @@ I'm German and my English might be gruesome here and there.
So please be patient with me and let me know of typos or grammatical parts. Thanks

== Changelog ==
= 1.0.7 (09/23/2014) =
* Coe maintenance
* Add parameters for custom favicon, see [documentation](https://github.com/bueltge/WordPress-Multisite-Enhancements/wiki/Filter-Hook-for-Favicon-File-Path)

= 1.0.6 (09/13/2014) =
* Add check for child theme, that you fast see, if is a child and what is the parent inside the network view of themes

Expand Down

0 comments on commit b8b36c9

Please sign in to comment.