This repository was archived by the owner on Dec 4, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-15
lines changed Expand file tree Collapse file tree 2 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ public function actionsAndFilters() {
5353
5454
5555 public function multisite_maybe_hide_plugin ( $ plugins ) {
56- if ( count ( self ::getSingletons () ) > 1 ) {
56+ if ( count ( self ::getSingletons ( WP_Plugin::class ) ) > 1 ) {
5757 $ updates = get_transient ( 'update_plugins ' );
5858 if ( ! isset ( $ updates ->response [ $ this ->getPluginFile () ] ) ) {
5959 unset( $ plugins [ $ this ->getPluginFile () ] );
@@ -65,7 +65,7 @@ public function multisite_maybe_hide_plugin( $plugins ) {
6565
6666 public function maybe_hide_plugin () {
6767 global $ wp_list_table ;
68- if ( count ( self ::getSingletons () ) > 1 && isset ( $ wp_list_table ->items [ $ this ->getPluginFile () ] ) ) {
68+ if ( count ( self ::getSingletons ( WP_Plugin::class ) ) > 1 && isset ( $ wp_list_table ->items [ $ this ->getPluginFile () ] ) ) {
6969 $ updates = get_transient ( 'update_plugins ' );
7070 if ( ! isset ( $ updates ->response [ $ this ->getPluginFile () ] ) ) {
7171 unset( $ wp_list_table ->items [ $ this ->getPluginFile () ] );
@@ -80,7 +80,7 @@ public function maybe_hide_plugin() {
8080 * @throws \ReflectionException
8181 */
8282 private function searchPlugins ( $ plugins ) {
83- $ non_core = self ::getSingletonsByClass ( WP_Plugin::class );
83+ $ non_core = self ::getSingletons ( WP_Plugin::class );
8484 $ class = new \ReflectionClass ( static ::class );
8585 $ class ->getName ();
8686 unset( $ non_core [ $ class ->getName () ] );
Original file line number Diff line number Diff line change @@ -82,22 +82,19 @@ public static final function InitFromConstructor( $that ) {
8282 }
8383
8484 /**
85- * @param string $class
85+ * @param bool| string $class
8686 *
8787 * @return array
8888 */
89- public static final function getSingletonsByClass ( $ class ) {
90- global $ singletons_hierarchy ;
89+ public static final function getSingletons ( $ class = false ) {
90+ if ( ! empty ( $ class ) ) {
91+ global $ singletons_hierarchy ;
9192
92- return $ singletons_hierarchy [ $ class ];
93- }
94-
95- /**
96- * @return array
97- */
98- public static final function getSingletons () {
99- global $ singletons ;
93+ return $ singletons_hierarchy [ $ class ];
94+ } else {
95+ global $ singletons ;
10096
101- return $ singletons ;
97+ return $ singletons ;
98+ }
10299 }
103100}
You can’t perform that action at this time.
0 commit comments