From 45259cd97a749413ac47b2db990f57f78d6303ad Mon Sep 17 00:00:00 2001 From: Norcross Date: Mon, 25 Apr 2016 12:01:11 -0400 Subject: [PATCH] minor tweak to include CSS for new icon font --- CHANGES.md | 3 +++ airplane-mode.php | 37 ++++++++++++++++++++++++++--------- lib/css/airplane-mode.css | 12 ++++++++++++ lib/css/airplane-mode.min.css | 2 +- readme.txt | 5 ++++- 5 files changed, 48 insertions(+), 11 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index d2a6527..86da708 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,6 @@ +#### Version 0.1.6 - 2016/04/25 +* minor tweak to include CSS for new icon font + #### Version 0.1.5 - 2016/04/24 * adding custom icon font for display and removing label. props @barryceelen diff --git a/airplane-mode.php b/airplane-mode.php index 2de39e4..6ef11c9 100644 --- a/airplane-mode.php +++ b/airplane-mode.php @@ -5,7 +5,7 @@ * Description: Control loading of external files when developing locally * Author: Andrew Norcross * Author URI: http://reaktivstudios.com/ - * Version: 0.1.5 + * Version: 0.1.6 * Text Domain: airplane-mode * Requires WP: 4.0 * Domain Path: languages @@ -45,7 +45,7 @@ } if ( ! defined( 'AIRMDE_VER' ) ) { - define( 'AIRMDE_VER', '0.1.5' ); + define( 'AIRMDE_VER', '0.1.6' ); } if ( ! class_exists( 'Airplane_Mode_Core' ) ) { @@ -342,26 +342,45 @@ public function block_oembed_html( $html, $url, $attr, $post_ID ) { } /** - * Add body class to front-end pages and login based on plugin status + * Add body class to front-end pages and login based on plugin status. * - * @return string our new class appended to the existing string + * @param array $classes The existing array of body classes. + * + * @return array $classes The updated array of body classes. */ - public function body_class() { + public function body_class( $classes ) { // Add the class based on the current status. $classes[] = $this->enabled() ? 'airplane-mode-enabled' : 'airplane-mode-disabled'; + // Also add in the margin setup for Query Monitor because I'm a perfectionist. + if ( ! class_exists( 'QueryMonitor' ) || defined( 'QM_DISABLED' ) && QM_DISABLED ) { + $classes[] = 'airplane-mode-no-qm'; + } + // Return our array of classes. return $classes; } /** - * Add body class to admin pages based on plugin status + * Add body class to admin pages based on plugin status. + * + * @param string $classes The existing space-separated list of CSS classes. * - * @return string our new class appended to the existing string + * @return string $classes The updated space-separated list of CSS classes. */ - public function admin_body_class() { - return $this->enabled() ? ' airplane-mode-enabled' : ' airplane-mode-disabled'; + public function admin_body_class( $classes ) { + + // First add the standard set of classes based on status. + $classes .= $this->enabled() ? ' airplane-mode-enabled' : ' airplane-mode-disabled'; + + // Also add in the margin setup for Query Monitor because I'm a perfectionist. + if ( ! class_exists( 'QueryMonitor' ) || defined( 'QM_DISABLED' ) && QM_DISABLED ) { + $classes .= ' airplane-mode-no-qm'; + } + + // Return our string of classes. + return $classes; } /** diff --git a/lib/css/airplane-mode.css b/lib/css/airplane-mode.css index f6c509d..8fb7a9e 100644 --- a/lib/css/airplane-mode.css +++ b/lib/css/airplane-mode.css @@ -22,6 +22,18 @@ content: "\e001"; } +#wpadminbar > #wp-toolbar > #wp-admin-bar-root-default > #wp-admin-bar-airplane-mode-toggle .ab-icon, +#wpadminbar #wp-admin-bar-airplane-mode-toggle .ab-icon, +#wpadminbar #wp-admin-bar-airplane-mode-toggle .ab-item::before { + margin-right: 0; +} + +.airplane-mode-no-qm #wpadminbar > #wp-toolbar > #wp-admin-bar-root-default > #wp-admin-bar-airplane-mode-toggle .ab-icon, +.airplane-mode-no-qm #wpadminbar #wp-admin-bar-airplane-mode-toggle .ab-icon, +.airplane-mode-no-qm #wpadminbar #wp-admin-bar-airplane-mode-toggle .ab-item::before { + margin-right: 6px; +} + /* Set the opacity to mimic comment moderation queue. */ .airplane-mode-disabled #wp-admin-bar-airplane-mode-toggle .ab-label { /* Theoretically for IE 8 & 9 (more valid) */ diff --git a/lib/css/airplane-mode.min.css b/lib/css/airplane-mode.min.css index b9c748e..b396b63 100644 --- a/lib/css/airplane-mode.min.css +++ b/lib/css/airplane-mode.min.css @@ -1 +1 @@ -@font-face{font-family:airplanemodeicons;src:url(../fonts/airplanemodeicons.eot);src:url(../fonts/airplanemodeicons.eot?#iefix) format("embedded-opentype"),url(../fonts/airplanemodeicons.woff) format("woff"),url(../fonts/airplanemodeicons.ttf) format("truetype"),url(../fonts/airplanemodeicons.svg#airplanemodeicons) format("svg");font-weight:400;font-style:normal}#wp-admin-bar-airplane-mode-toggle .ab-icon{top:1px}#wp-admin-bar-airplane-mode-toggle .ab-icon:before{content:"\e000";font:400 18px/1 airplanemodeicons}.airplane-mode-disabled #wp-admin-bar-airplane-mode-toggle .ab-icon:before{content:"\e001"}.airplane-mode-disabled #wp-admin-bar-airplane-mode-toggle .ab-label{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";filter:alpha(opacity=50);opacity:.5}.airplane-mode-enabled .theme-browser.content-filterable.rendered,.airplane-mode-enabled.plugin-install-php .wp-filter,.airplane-mode-enabled.plugin-install-php h1 a.upload,.airplane-mode-enabled.theme-install-php .wp-filter,.airplane-mode-enabled.theme-install-php a.browse-themes{display:none!important} \ No newline at end of file +@font-face{font-family:airplanemodeicons;src:url(../fonts/airplanemodeicons.eot);src:url(../fonts/airplanemodeicons.eot?#iefix) format("embedded-opentype"),url(../fonts/airplanemodeicons.woff) format("woff"),url(../fonts/airplanemodeicons.ttf) format("truetype"),url(../fonts/airplanemodeicons.svg#airplanemodeicons) format("svg");font-weight:400;font-style:normal}#wp-admin-bar-airplane-mode-toggle .ab-icon{top:1px}#wp-admin-bar-airplane-mode-toggle .ab-icon:before{content:"\e000";font:400 18px/1 airplanemodeicons}.airplane-mode-disabled #wp-admin-bar-airplane-mode-toggle .ab-icon:before{content:"\e001"}#wpadminbar #wp-admin-bar-airplane-mode-toggle .ab-icon,#wpadminbar #wp-admin-bar-airplane-mode-toggle .ab-item::before,#wpadminbar>#wp-toolbar>#wp-admin-bar-root-default>#wp-admin-bar-airplane-mode-toggle .ab-icon{margin-right:0}.airplane-mode-no-qm #wpadminbar #wp-admin-bar-airplane-mode-toggle .ab-icon,.airplane-mode-no-qm #wpadminbar #wp-admin-bar-airplane-mode-toggle .ab-item::before,.airplane-mode-no-qm #wpadminbar>#wp-toolbar>#wp-admin-bar-root-default>#wp-admin-bar-airplane-mode-toggle .ab-icon{margin-right:6px}.airplane-mode-disabled #wp-admin-bar-airplane-mode-toggle .ab-label{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";filter:alpha(opacity=50);opacity:.5}.airplane-mode-enabled .theme-browser.content-filterable.rendered,.airplane-mode-enabled.plugin-install-php .wp-filter,.airplane-mode-enabled.plugin-install-php h1 a.upload,.airplane-mode-enabled.theme-install-php .wp-filter,.airplane-mode-enabled.theme-install-php a.browse-themes{display:none!important} \ No newline at end of file diff --git a/readme.txt b/readme.txt index fe9cadf..8ef3470 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Donate link: https://andrewnorcross.com/donate Tags: external calls, HTTP Requires at least: 4.0 Tested up to: 4.5 -Stable tag: 0.1.5 +Stable tag: 0.1.6 License: MIT License URI: http://norcross.mit-license.org/ @@ -43,6 +43,9 @@ Because you are a jet set developer who needs to work without internet. == Changelog == += 0.1.6 - 2016/04/25 +* minor tweak to include CSS for new icon font + = 0.1.5 - 2016/04/24 * adding custom icon font for display and removing label. props @barryceelen