From 42c7de5a8965d071d5f0197f49b827683957f6a9 Mon Sep 17 00:00:00 2001 From: Gary Jones Date: Tue, 16 Jan 2018 13:31:46 +0000 Subject: [PATCH 1/3] Docs: Update Scrutinizer reference --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5c1b91b..32cb7d3 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A class to copy into your WordPress plugin, to make adding custom post type counts to the _At a Glance_ dashboard widget considerably easier. -[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/GaryJones/Gamajo-Dashboard-Glancer/badges/quality-score.png?s=543e04781b27f58b1e37ba742f760c0c5ba82297)](https://scrutinizer-ci.com/g/GaryJones/Gamajo-Dashboard-Glancer/) +[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/gamajo/dashboard-glancer/badges/quality-score.png?s=543e04781b27f58b1e37ba742f760c0c5ba82297)](https://scrutinizer-ci.com/g/gamajo/dashboard-glancer/) ## Description From 33a0720a606d7e79253f68bbc2898b00843cc271 Mon Sep 17 00:00:00 2001 From: Gary Jones Date: Sun, 20 May 2018 08:09:33 +0100 Subject: [PATCH 2/3] Minor code improvements --- class-gamajo-dashboard-glancer.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/class-gamajo-dashboard-glancer.php b/class-gamajo-dashboard-glancer.php index 04f2366..65a43f4 100644 --- a/class-gamajo-dashboard-glancer.php +++ b/class-gamajo-dashboard-glancer.php @@ -52,7 +52,11 @@ public function __construct() { * @return null Return early if action hook has already passed, or no valid * post types were given. */ - public function add( $post_types, $statuses = 'publish' ) { + public function add( $post_types, $statuses = null ) { + if ( null === $statuses ) { + $statuses = 'publish'; + } + // If relevant output action hook has already passed, then no point in proceeding. if ( did_action( 'dashboard_glance_items' ) ) { _doing_it_wrong( __CLASS__, 'Trying to add At a Glance items to dashboard widget afterhook already fired', '1.0.0' ); @@ -102,7 +106,7 @@ public function show() { protected function unset_invalid_post_types( array $post_types ) { foreach ( $post_types as $index => $post_type ) { $post_type_object = get_post_type_object( $post_type ); - if ( is_null( $post_type_object ) ) { + if ( null === $post_type_object ) { unset( $post_types[ $index ] ); } } @@ -198,17 +202,16 @@ protected function maybe_link( $text, $href ) { * @return string Markup for list item. */ protected function get_markup( $text, $post_type ) { - $class = ''; - $classes[] = $post_type . '-count'; + $classes[] = $post_type . '-count'; $post_type_object = get_post_type_object( $post_type ); - $menu_icon = isset( $post_type_object->menu_icon ) ? $post_type_object->menu_icon : null; + $menu_icon = isset( $post_type_object->menu_icon ) ? $post_type_object->menu_icon : null; if ( 0 === strpos( $menu_icon, 'dashicons-' ) ) { $classes[] = 'dashicons-before'; $classes[] = $menu_icon; } - $class = join( ' ', sanitize_html_class( $classes ) ); + $class = implode( ' ', sanitize_html_class( $classes ) ); return '
  • ' . wp_kses_post( $text ) . '
  • ' . "\n"; } @@ -233,7 +236,7 @@ public function dashboard_css() { $screen = get_current_screen(); - if ( ! in_array( $screen->base, array( 'dashboard' ), true ) ) { + if ( 'dashboard' !== $screen->base ) { return; } From 3b0479e01824a4ced11772d7ffb1ad7282b25822 Mon Sep 17 00:00:00 2001 From: Gary Jones Date: Sun, 20 May 2018 08:10:08 +0100 Subject: [PATCH 3/3] 1.0.5 --- class-gamajo-dashboard-glancer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class-gamajo-dashboard-glancer.php b/class-gamajo-dashboard-glancer.php index 65a43f4..5fedbb3 100644 --- a/class-gamajo-dashboard-glancer.php +++ b/class-gamajo-dashboard-glancer.php @@ -7,7 +7,7 @@ * @link https://github.com/gamajo/dashboard-glancer * @copyright 2013 Gary Jones, Gamajo * @license GPL-2.0-or-later - * @version 1.0.4 + * @version 1.0.5 */ /**