@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function filterPluginLinks( array $links ) |
29 | 29 | { |
30 | - $settings_url = admin_url( sprintf( 'options-general.php?page=%s', $this->app->id )); |
|
31 | - $links[] = $this->app->config->disable_config |
|
32 | - ? sprintf( '<span class="network_only">%s</span>', __( 'Settings Disabled', 'pollux' )) |
|
33 | - : sprintf( '<a href="%s">%s</a>', $settings_url, __( 'Settings', 'pollux' )); |
|
30 | + $settings_url = admin_url( sprintf( 'options-general.php?page=%s', $this->app->id ) ); |
|
31 | + $links[ ] = $this->app->config->disable_config |
|
32 | + ? sprintf( '<span class="network_only">%s</span>', __( 'Settings Disabled', 'pollux' ) ) |
|
33 | + : sprintf( '<a href="%s">%s</a>', $settings_url, __( 'Settings', 'pollux' ) ); |
|
34 | 34 | return $links; |
35 | 35 | } |
36 | 36 | |
@@ -59,17 +59,17 @@ discard block |
||
59 | 59 | |
60 | 60 | wp_enqueue_style( 'pollux/main.css', |
61 | 61 | $this->app->url( 'assets/main.css' ), |
62 | - apply_filters( 'pollux/enqueue/css/deps', [] ), |
|
62 | + apply_filters( 'pollux/enqueue/css/deps', [ ] ), |
|
63 | 63 | $this->app->version |
64 | 64 | ); |
65 | 65 | wp_enqueue_script( 'pollux/main.js', |
66 | 66 | $this->app->url( 'assets/main.js' ), |
67 | - apply_filters( 'pollux/enqueue/js/deps', [] ), |
|
67 | + apply_filters( 'pollux/enqueue/js/deps', [ ] ), |
|
68 | 68 | $this->app->version |
69 | 69 | ); |
70 | 70 | wp_localize_script( 'pollux/main.js', |
71 | 71 | apply_filters( 'pollux/enqueue/js/localize/name', $this->app->id ), |
72 | - ['vars' => apply_filters( 'pollux/enqueue/js/localize/variables', [] )] |
|
72 | + [ 'vars' => apply_filters( 'pollux/enqueue/js/localize/variables', [ ] ) ] |
|
73 | 73 | ); |
74 | 74 | } |
75 | 75 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $widgets = apply_filters( 'pollux/dashoard/widgets', [ |
84 | 84 | 'dashboard_primary', |
85 | 85 | 'dashboard_quick_press', |
86 | - ]); |
|
86 | + ] ); |
|
87 | 87 | foreach( $widgets as $widget ) { |
88 | 88 | remove_meta_box( $widget, 'dashboard', 'normal' ); |
89 | 89 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | protected function registerArchiveAssets( WP_Screen $screen ) |
107 | 107 | { |
108 | - if(( new Helper )->endsWith( '_archive', $screen->id ) && $screen->pagenow == 'edit.php' ) { |
|
108 | + if( ( new Helper )->endsWith( '_archive', $screen->id ) && $screen->pagenow == 'edit.php' ) { |
|
109 | 109 | wp_enqueue_script( 'common' ); |
110 | 110 | wp_enqueue_script( 'editor-expand' ); |
111 | 111 | wp_enqueue_script( 'post' ); |
@@ -125,12 +125,12 @@ discard block |
||
125 | 125 | if( $screen->id != 'settings_page_pollux' || $screen->pagenow != 'options-general.php' )return; |
126 | 126 | wp_enqueue_style( 'pollux/codemirror.css', |
127 | 127 | $this->app->url( 'assets/codemirror.css' ), |
128 | - [], |
|
128 | + [ ], |
|
129 | 129 | $this->app->version |
130 | 130 | ); |
131 | 131 | wp_enqueue_script( 'pollux/codemirror.js', |
132 | 132 | $this->app->url( 'assets/codemirror.js' ), |
133 | - ['pollux/main.js'], |
|
133 | + [ 'pollux/main.js' ], |
|
134 | 134 | $this->app->version |
135 | 135 | ); |
136 | 136 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | protected function registerSettingsAssets( WP_Screen $screen ) |
154 | 154 | { |
155 | - if( $screen->id == sprintf( 'toplevel_page_%s', Settings::id() )) { |
|
155 | + if( $screen->id == sprintf( 'toplevel_page_%s', Settings::id() ) ) { |
|
156 | 156 | wp_enqueue_script( 'common' ); |
157 | 157 | wp_enqueue_script( 'postbox' ); |
158 | 158 | wp_enqueue_script( 'wp-lists' ); |
@@ -40,7 +40,9 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function filterWordPressFooter( $text ) |
42 | 42 | { |
43 | - if( $this->app->config->remove_wordpress_footer )return; |
|
43 | + if( $this->app->config->remove_wordpress_footer ) { |
|
44 | + return; |
|
45 | + } |
|
44 | 46 | return $text; |
45 | 47 | } |
46 | 48 | |
@@ -79,7 +81,9 @@ discard block |
||
79 | 81 | */ |
80 | 82 | public function removeDashboardWidgets() |
81 | 83 | { |
82 | - if( !$this->app->config->remove_dashboard_widgets )return; |
|
84 | + if( !$this->app->config->remove_dashboard_widgets ) { |
|
85 | + return; |
|
86 | + } |
|
83 | 87 | $widgets = apply_filters( 'pollux/dashoard/widgets', [ |
84 | 88 | 'dashboard_primary', |
85 | 89 | 'dashboard_quick_press', |
@@ -95,7 +99,9 @@ discard block |
||
95 | 99 | */ |
96 | 100 | public function removeWordPressMenu() |
97 | 101 | { |
98 | - if( !$this->app->config->remove_wordpress_menu )return; |
|
102 | + if( !$this->app->config->remove_wordpress_menu ) { |
|
103 | + return; |
|
104 | + } |
|
99 | 105 | global $wp_admin_bar; |
100 | 106 | $wp_admin_bar->remove_menu( 'wp-logo' ); |
101 | 107 | } |
@@ -122,7 +128,9 @@ discard block |
||
122 | 128 | */ |
123 | 129 | protected function registerCodemirrorAssets( WP_Screen $screen ) |
124 | 130 | { |
125 | - if( $screen->id != 'settings_page_pollux' || $screen->pagenow != 'options-general.php' )return; |
|
131 | + if( $screen->id != 'settings_page_pollux' || $screen->pagenow != 'options-general.php' ) { |
|
132 | + return; |
|
133 | + } |
|
126 | 134 | wp_enqueue_style( 'pollux/codemirror.css', |
127 | 135 | $this->app->url( 'assets/codemirror.css' ), |
128 | 136 | [], |
@@ -18,19 +18,19 @@ |
||
18 | 18 | |
19 | 19 | defined( 'WPINC' ) || die; |
20 | 20 | |
21 | -if( !class_exists( 'GL_Plugin_Check_v1' )) { |
|
22 | - require_once __DIR__.'/activate.php'; |
|
21 | +if( !class_exists( 'GL_Plugin_Check_v1' ) ) { |
|
22 | + require_once __DIR__ . '/activate.php'; |
|
23 | 23 | } |
24 | -if( GL_Plugin_Check_v1::shouldDeactivate( __FILE__))return; |
|
24 | +if( GL_Plugin_Check_v1::shouldDeactivate( __FILE__ ) )return; |
|
25 | 25 | |
26 | -require_once __DIR__.'/autoload.php'; |
|
27 | -require_once __DIR__.'/helpers.php'; |
|
28 | -require_once __DIR__.'/thirdparty.php'; |
|
26 | +require_once __DIR__ . '/autoload.php'; |
|
27 | +require_once __DIR__ . '/helpers.php'; |
|
28 | +require_once __DIR__ . '/thirdparty.php'; |
|
29 | 29 | |
30 | 30 | $app = GeminiLabs\Pollux\Application::getInstance(); |
31 | 31 | |
32 | -register_activation_hook( __FILE__, array( $app, 'onActivation' )); |
|
33 | -register_deactivation_hook( __FILE__, array( $app, 'onDeactivation' )); |
|
32 | +register_activation_hook( __FILE__, array( $app, 'onActivation' ) ); |
|
33 | +register_deactivation_hook( __FILE__, array( $app, 'onDeactivation' ) ); |
|
34 | 34 | |
35 | 35 | $app->register( new GeminiLabs\Pollux\Provider ); |
36 | 36 | $app->init(); |
@@ -21,7 +21,9 @@ |
||
21 | 21 | if( !class_exists( 'GL_Plugin_Check_v1' )) { |
22 | 22 | require_once __DIR__.'/activate.php'; |
23 | 23 | } |
24 | -if( GL_Plugin_Check_v1::shouldDeactivate( __FILE__))return; |
|
24 | +if( GL_Plugin_Check_v1::shouldDeactivate( __FILE__)) { |
|
25 | + return; |
|
26 | +} |
|
25 | 27 | |
26 | 28 | require_once __DIR__.'/autoload.php'; |
27 | 29 | require_once __DIR__.'/helpers.php'; |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public static function isPhpValid( $version = '' ) |
34 | 34 | { |
35 | - if( !empty( $version )) { |
|
36 | - static::normalize( array( 'php' => $version )); |
|
35 | + if( !empty( $version ) ) { |
|
36 | + static::normalize( array( 'php' => $version ) ); |
|
37 | 37 | } |
38 | 38 | return !version_compare( PHP_VERSION, static::$versions->php, '<' ); |
39 | 39 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public static function isValid( array $args = array() ) |
45 | 45 | { |
46 | - if( !empty( $args )) { |
|
46 | + if( !empty( $args ) ) { |
|
47 | 47 | static::normalize( $args ); |
48 | 48 | } |
49 | 49 | return static::isPhpValid() && static::isWpValid(); |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | public static function isWpValid( $version = '' ) |
57 | 57 | { |
58 | 58 | global $wp_version; |
59 | - if( !empty( $version )) { |
|
60 | - static::normalize( array( 'wordpress' => $version )); |
|
59 | + if( !empty( $version ) ) { |
|
60 | + static::normalize( array( 'wordpress' => $version ) ); |
|
61 | 61 | } |
62 | 62 | return !version_compare( $wp_version, static::$versions->wordpress, '<' ); |
63 | 63 | } |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public static function shouldDeactivate( $file, array $args = array() ) |
70 | 70 | { |
71 | - if( empty( static::$instance )) { |
|
71 | + if( empty( static::$instance ) ) { |
|
72 | 72 | static::$file = realpath( $file ); |
73 | 73 | static::$instance = new static; |
74 | 74 | static::$versions = static::normalize( $args ); |
75 | 75 | } |
76 | 76 | if( !static::isValid() ) { |
77 | - add_action( 'activated_plugin', array( static::$instance, 'deactivate' )); |
|
78 | - add_action( 'admin_notices', array( static::$instance, 'deactivate' )); |
|
77 | + add_action( 'activated_plugin', array( static::$instance, 'deactivate' ) ); |
|
78 | + add_action( 'admin_notices', array( static::$instance, 'deactivate' ) ); |
|
79 | 79 | return true; |
80 | 80 | } |
81 | 81 | return false; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } |
95 | 95 | $pluginData = get_file_data( static::$file, array( 'name' => 'Plugin Name' ), 'plugin' ); |
96 | 96 | deactivate_plugins( $pluginSlug ); |
97 | - $this->printNotice( $pluginData['name'] ); |
|
97 | + $this->printNotice( $pluginData[ 'name' ] ); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | */ |
103 | 103 | protected static function normalize( array $args = array() ) |
104 | 104 | { |
105 | - return (object)wp_parse_args( $args, array( |
|
105 | + return (object) wp_parse_args( $args, array( |
|
106 | 106 | 'php' => static::MIN_PHP_VERSION, |
107 | 107 | 'wordpress' => static::MIN_WORDPRESS_VERSION, |
108 | - )); |
|
108 | + ) ); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | filter_input( INPUT_GET, 'plugin_status' ), |
118 | 118 | filter_input( INPUT_GET, 'paged' ), |
119 | 119 | filter_input( INPUT_GET, 's' ) |
120 | - ))); |
|
120 | + ) ) ); |
|
121 | 121 | exit; |
122 | 122 | } |
123 | 123 | |
@@ -138,16 +138,16 @@ discard block |
||
138 | 138 | ); |
139 | 139 | if( !static::isPhpValid() ) { |
140 | 140 | printf( $noticeTemplate, |
141 | - sprintf( $messages[0], $pluginName ), |
|
142 | - sprintf( $messages[1], $messages[3].' '.static::$versions->php ), |
|
143 | - sprintf( $messages[2], PHP_VERSION ) |
|
141 | + sprintf( $messages[ 0 ], $pluginName ), |
|
142 | + sprintf( $messages[ 1 ], $messages[ 3 ] . ' ' . static::$versions->php ), |
|
143 | + sprintf( $messages[ 2 ], PHP_VERSION ) |
|
144 | 144 | ); |
145 | 145 | } |
146 | 146 | else if( !static::isWpValid() ) { |
147 | 147 | printf( $noticeTemplate, |
148 | - sprintf( $messages[0], $pluginName ), |
|
149 | - sprintf( $messages[1], $messages[4].' '.static::$versions->wordpress ), |
|
150 | - sprintf( '<a href="%s">%s</a>', admin_url( 'update-core.php' ), $messages[5] ) |
|
148 | + sprintf( $messages[ 0 ], $pluginName ), |
|
149 | + sprintf( $messages[ 1 ], $messages[ 4 ] . ' ' . static::$versions->wordpress ), |
|
150 | + sprintf( '<a href="%s">%s</a>', admin_url( 'update-core.php' ), $messages[ 5 ] ) |
|
151 | 151 | ); |
152 | 152 | } |
153 | 153 | } |
@@ -87,7 +87,9 @@ |
||
87 | 87 | */ |
88 | 88 | public function deactivate( $plugin ) |
89 | 89 | { |
90 | - if( static::isValid() )return; |
|
90 | + if( static::isValid() ) { |
|
91 | + return; |
|
92 | + } |
|
91 | 93 | $pluginSlug = plugin_basename( static::$file ); |
92 | 94 | if( $plugin == $pluginSlug ) { |
93 | 95 | $this->redirect(); //exit |