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() {
53
53
54
54
55
55
public function multisite_maybe_hide_plugin ( $ plugins ) {
56
- if ( count ( self ::getSingletons () ) > 1 ) {
56
+ if ( count ( self ::getSingletons ( WP_Plugin::class ) ) > 1 ) {
57
57
$ updates = get_transient ( 'update_plugins ' );
58
58
if ( ! isset ( $ updates ->response [ $ this ->getPluginFile () ] ) ) {
59
59
unset( $ plugins [ $ this ->getPluginFile () ] );
@@ -65,7 +65,7 @@ public function multisite_maybe_hide_plugin( $plugins ) {
65
65
66
66
public function maybe_hide_plugin () {
67
67
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 () ] ) ) {
69
69
$ updates = get_transient ( 'update_plugins ' );
70
70
if ( ! isset ( $ updates ->response [ $ this ->getPluginFile () ] ) ) {
71
71
unset( $ wp_list_table ->items [ $ this ->getPluginFile () ] );
@@ -80,7 +80,7 @@ public function maybe_hide_plugin() {
80
80
* @throws \ReflectionException
81
81
*/
82
82
private function searchPlugins ( $ plugins ) {
83
- $ non_core = self ::getSingletonsByClass ( WP_Plugin::class );
83
+ $ non_core = self ::getSingletons ( WP_Plugin::class );
84
84
$ class = new \ReflectionClass ( static ::class );
85
85
$ class ->getName ();
86
86
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 ) {
82
82
}
83
83
84
84
/**
85
- * @param string $class
85
+ * @param bool| string $class
86
86
*
87
87
* @return array
88
88
*/
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 ;
91
92
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 ;
100
96
101
- return $ singletons ;
97
+ return $ singletons ;
98
+ }
102
99
}
103
100
}
You can’t perform that action at this time.
0 commit comments