@@ -4,8 +4,8 @@ |
||
4 | 4 | * Compatibility with Give WP plugin |
5 | 5 | */ |
6 | 6 | add_filter( 'give_load_admin_scripts', function( $is_admin_page, $hook ) { |
7 | - $needle = sprintf( '_page_%s', filter_input( INPUT_GET, 'page' )); |
|
8 | - return substr( $hook, - strlen( $needle )) !== $needle |
|
7 | + $needle = sprintf( '_page_%s', filter_input( INPUT_GET, 'page' ) ); |
|
8 | + return substr( $hook, - strlen( $needle ) ) !== $needle |
|
9 | 9 | ? $is_admin_page |
10 | 10 | : true; |
11 | 11 | }, 10, 2 ); |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | public $gatekeeper; |
19 | 19 | public $id; |
20 | 20 | public $name; |
21 | - public $notices = []; |
|
21 | + public $notices = [ ]; |
|
22 | 22 | public $version; |
23 | 23 | |
24 | 24 | /** |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | |
32 | 32 | public function __construct() |
33 | 33 | { |
34 | - $this->file = realpath( dirname( dirname( __FILE__ )) . '/pollux.php' ); |
|
35 | - $this->gatekeeper = new GateKeeper( plugin_basename( $this->file )); |
|
34 | + $this->file = realpath( dirname( dirname( __FILE__ ) ) . '/pollux.php' ); |
|
35 | + $this->gatekeeper = new GateKeeper( plugin_basename( $this->file ) ); |
|
36 | 36 | |
37 | 37 | $data = get_file_data( $this->file, array( |
38 | 38 | 'id' => 'Text Domain', |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | add_action( 'plugins_loaded', function() { |
59 | 59 | $this->bootstrap(); |
60 | 60 | }); |
61 | - add_action( 'admin_enqueue_scripts', array( $controller, 'registerAssets' )); |
|
62 | - add_action( 'admin_init', array( $controller, 'removeDashboardWidgets' )); |
|
63 | - add_action( 'wp_before_admin_bar_render', array( $controller, 'removeWordPressMenu' )); |
|
64 | - add_filter( "plugin_action_links_{$basename}", array( $controller, 'filterPluginLinks' )); |
|
65 | - add_filter( 'admin_footer_text', array( $controller, 'filterWordPressFooter' )); |
|
61 | + add_action( 'admin_enqueue_scripts', array( $controller, 'registerAssets' ) ); |
|
62 | + add_action( 'admin_init', array( $controller, 'removeDashboardWidgets' ) ); |
|
63 | + add_action( 'wp_before_admin_bar_render', array( $controller, 'removeWordPressMenu' ) ); |
|
64 | + add_filter( "plugin_action_links_{$basename}", array( $controller, 'filterPluginLinks' ) ); |
|
65 | + add_filter( 'admin_footer_text', array( $controller, 'filterWordPressFooter' ) ); |
|
66 | 66 | |
67 | 67 | // Disallow indexing of the site on non-production environments |
68 | 68 | if( !$this->environment( 'production' ) && !is_admin() ) { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | public function environment( $checkFor = '' ) |
78 | 78 | { |
79 | 79 | $environment = defined( 'WP_ENV' ) ? WP_ENV : 'production'; |
80 | - if( !empty( $checkFor )) { |
|
80 | + if( !empty( $checkFor ) ) { |
|
81 | 81 | return $environment == $checkFor; |
82 | 82 | } |
83 | 83 | return $environment; |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | trailingslashit( trailingslashit( $theme->theme_root ) . $theme->template ), |
97 | 97 | trailingslashit( WP_CONTENT_DIR ), |
98 | 98 | trailingslashit( ABSPATH ), |
99 | - trailingslashit( dirname( ABSPATH )), |
|
100 | - trailingslashit( dirname( dirname( ABSPATH ))), |
|
101 | - ]); |
|
99 | + trailingslashit( dirname( ABSPATH ) ), |
|
100 | + trailingslashit( dirname( dirname( ABSPATH ) ) ), |
|
101 | + ] ); |
|
102 | 102 | foreach( (array) $locations as $location ) { |
103 | - if( !file_exists( $location . $filename ))continue; |
|
103 | + if( !file_exists( $location . $filename ) )continue; |
|
104 | 104 | return $location . $filename; |
105 | 105 | } |
106 | 106 | return null; |
@@ -133,14 +133,14 @@ discard block |
||
133 | 133 | * @param string $view |
134 | 134 | * @return void|null |
135 | 135 | */ |
136 | - public function render( $view, array $data = [] ) |
|
136 | + public function render( $view, array $data = [ ] ) |
|
137 | 137 | { |
138 | 138 | $file = apply_filters( 'pollux/views/file', |
139 | - $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ))), |
|
139 | + $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ) ) ), |
|
140 | 140 | $view, |
141 | 141 | $data |
142 | 142 | ); |
143 | - if( !file_exists( $file ))return; |
|
143 | + if( !file_exists( $file ) )return; |
|
144 | 144 | extract( $data ); |
145 | 145 | include $file; |
146 | 146 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function url( $path = '' ) |
153 | 153 | { |
154 | - return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' )); |
|
154 | + return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' ) ); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | protected function loadHooks() |
186 | 186 | { |
187 | - if( $file = $this->getFile( 'pollux-hooks.php' )) { |
|
187 | + if( $file = $this->getFile( 'pollux-hooks.php' ) ) { |
|
188 | 188 | include_once $file; |
189 | 189 | } |
190 | 190 | } |
@@ -206,6 +206,6 @@ discard block |
||
206 | 206 | 'ArchiveMeta' => 'GeminiLabs\Pollux\Facades\ArchiveMeta', |
207 | 207 | 'PostMeta' => 'GeminiLabs\Pollux\Facades\PostMeta', |
208 | 208 | 'SiteMeta' => 'GeminiLabs\Pollux\Facades\SiteMeta', |
209 | - )))->register(); |
|
209 | + ) ) )->register(); |
|
210 | 210 | } |
211 | 211 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | public static $current; |
18 | 18 | |
19 | - public $hooks = []; |
|
19 | + public $hooks = [ ]; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * {@inheritdoc} |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | { |
26 | 26 | parent::init(); |
27 | 27 | |
28 | - add_action( 'wp_ajax_pollux/archives/featured/html', [$this, 'getFeaturedImageHtml'] ); |
|
29 | - add_action( 'pollux/archives/init', [$this, 'registerFeaturedImageMetaBox'] ); |
|
30 | - add_action( 'pollux/archives/editor', [$this, 'renderEditor'], 10, 2 ); |
|
31 | - add_action( 'wp_ajax_pollux/archives/featured', [$this, 'setFeaturedImage'] ); |
|
32 | - add_filter( 'pollux/archives/metabox/submit', [$this, 'filterSubmitMetaBox'] ); |
|
33 | - add_filter( 'pollux/archives/show/instructions', '__return_true' ); |
|
28 | + add_action( 'wp_ajax_pollux/archives/featured/html', [ $this, 'getFeaturedImageHtml' ] ); |
|
29 | + add_action( 'pollux/archives/init', [ $this, 'registerFeaturedImageMetaBox' ] ); |
|
30 | + add_action( 'pollux/archives/editor', [ $this, 'renderEditor' ], 10, 2 ); |
|
31 | + add_action( 'wp_ajax_pollux/archives/featured', [ $this, 'setFeaturedImage' ] ); |
|
32 | + add_filter( 'pollux/archives/metabox/submit', [ $this, 'filterSubmitMetaBox' ] ); |
|
33 | + add_filter( 'pollux/archives/show/instructions', '__return_true' ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | public function canProceed() |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | public function filterBeforeInstructions() |
47 | 47 | { |
48 | 48 | return sprintf( '<pre class="my-sites nav-tab-active misc-pub-section">%s</pre>', |
49 | - array_reduce( ['title', 'content', 'featured'], function( $instructions, $id ) { |
|
50 | - return $instructions . $this->filterInstruction( null, ['slug' => $id], ['slug' => $this->getPostType()] ) . PHP_EOL; |
|
49 | + array_reduce( [ 'title', 'content', 'featured' ], function( $instructions, $id ) { |
|
50 | + return $instructions . $this->filterInstruction( null, [ 'slug' => $id ], [ 'slug' => $this->getPostType() ] ) . PHP_EOL; |
|
51 | 51 | }) |
52 | 52 | ); |
53 | 53 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function filterInstruction( $instruction, array $field, array $metabox ) |
61 | 61 | { |
62 | - return sprintf( "ArchiveMeta::%s('%s');", $metabox['slug'], $field['slug'] ); |
|
62 | + return sprintf( "ArchiveMeta::%s('%s');", $metabox[ 'slug' ], $field[ 'slug' ] ); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | public function filterSavedSettings( $settings ) |
71 | 71 | { |
72 | 72 | return $this->filter( 'save', array_intersect_key( |
73 | - array_merge( $this->getSettings(), ( new Helper )->toArray( $settings )), |
|
73 | + array_merge( $this->getSettings(), ( new Helper )->toArray( $settings ) ), |
|
74 | 74 | $this->getPostTypesWithArchive() |
75 | - )); |
|
75 | + ) ); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function filterSubmitMetaBox( array $args ) |
83 | 83 | { |
84 | - $args[1] = __( 'Save Archive', 'pollux' ); |
|
84 | + $args[ 1 ] = __( 'Save Archive', 'pollux' ); |
|
85 | 85 | return $args; |
86 | 86 | } |
87 | 87 | |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function getFeaturedImageHtml() |
94 | 94 | { |
95 | - check_ajax_referer( sprintf( '%s-options', static::id() )); |
|
95 | + check_ajax_referer( sprintf( '%s-options', static::id() ) ); |
|
96 | 96 | static::$current = filter_input( INPUT_POST, 'post_type' ); |
97 | 97 | ob_start(); |
98 | - $this->renderFeaturedImageMetaBox( intval( filter_input( INPUT_POST, 'thumbnail_id' ))); |
|
98 | + $this->renderFeaturedImageMetaBox( intval( filter_input( INPUT_POST, 'thumbnail_id' ) ) ); |
|
99 | 99 | wp_send_json_success( ob_get_clean() ); |
100 | 100 | } |
101 | 101 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | public function register() |
118 | 118 | { |
119 | 119 | $screenId = ( new Helper )->getCurrentScreen()->id; |
120 | - if( in_array( $screenId, $this->hooks )) { |
|
120 | + if( in_array( $screenId, $this->hooks ) ) { |
|
121 | 121 | $this->hook = $screenId; |
122 | 122 | } |
123 | 123 | parent::register(); |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function registerFeaturedImageMetaBox() |
131 | 131 | { |
132 | - if( !current_user_can( 'upload_files' ))return; |
|
133 | - add_meta_box( 'postimagediv', __( 'Featured Image', 'pollux' ), [$this, 'renderFeaturedImageMetaBox'], null, 'side', 'low' ); |
|
132 | + if( !current_user_can( 'upload_files' ) )return; |
|
133 | + add_meta_box( 'postimagediv', __( 'Featured Image', 'pollux' ), [ $this, 'renderFeaturedImageMetaBox' ], null, 'side', 'low' ); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -140,15 +140,15 @@ discard block |
||
140 | 140 | public function registerPage() |
141 | 141 | { |
142 | 142 | foreach( $this->getPostTypesWithArchive() as $type => $page ) { |
143 | - $labels = get_post_type_labels( get_post_type_object( $type )); |
|
144 | - $this->hooks[$type] = call_user_func_array( 'add_submenu_page', $this->filter( 'page', [ |
|
143 | + $labels = get_post_type_labels( get_post_type_object( $type ) ); |
|
144 | + $this->hooks[ $type ] = call_user_func_array( 'add_submenu_page', $this->filter( 'page', [ |
|
145 | 145 | $page, |
146 | 146 | sprintf( _x( '%s Archive', 'post archive', 'pollux' ), $labels->singular_name ), |
147 | 147 | sprintf( _x( '%s Archive', 'post archive', 'pollux' ), $labels->singular_name ), |
148 | 148 | static::CAPABILITY, |
149 | 149 | sprintf( '%s_archive', $type ), |
150 | - [$this, 'renderPage'], |
|
151 | - ])); |
|
150 | + [ $this, 'renderPage' ], |
|
151 | + ] ) ); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | 'resize' => false, |
170 | 170 | 'wp_autoresize_on' => true, |
171 | 171 | ], |
172 | - ]); |
|
172 | + ] ); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
@@ -178,12 +178,12 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function renderFeaturedImageMetaBox( $imageId = null ) |
180 | 180 | { |
181 | - if( !is_numeric( $imageId )) { |
|
181 | + if( !is_numeric( $imageId ) ) { |
|
182 | 182 | $imageId = ArchiveMeta::get( $this->getPostType(), 'featured', -1 ); |
183 | 183 | } |
184 | - $imageSize = isset( wp_get_additional_image_sizes()['post-thumbnail'] ) |
|
184 | + $imageSize = isset( wp_get_additional_image_sizes()[ 'post-thumbnail' ] ) |
|
185 | 185 | ? 'post-thumbnail' |
186 | - : [266, 266]; |
|
186 | + : [ 266, 266 ]; |
|
187 | 187 | $thumbnail = get_post( $imageId ) |
188 | 188 | ? wp_get_attachment_image( $imageId, $imageSize ) |
189 | 189 | : __( 'Set Featured Image', 'pollux' ); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | 'post_type' => $this->getPostType(), |
196 | 196 | 'remove_image' => __( 'Remove featured image', 'pollux' ), |
197 | 197 | 'thumbnail' => $thumbnail, |
198 | - ]); |
|
198 | + ] ); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | public function renderPage() |
206 | 206 | { |
207 | 207 | $type = $this->getPostType(); |
208 | - if( empty( $type ))return; |
|
209 | - $labels = get_post_type_labels( get_post_type_object( $type )); |
|
208 | + if( empty( $type ) )return; |
|
209 | + $labels = get_post_type_labels( get_post_type_object( $type ) ); |
|
210 | 210 | $this->app->render( 'archive/index', [ |
211 | 211 | 'columns' => get_current_screen()->get_columns(), |
212 | 212 | 'content' => ArchiveMeta::get( $type, 'content', '' ), |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | 'id' => static::id(), |
215 | 215 | 'post_type' => $type, |
216 | 216 | 'title' => ArchiveMeta::get( $type, 'title', '' ), |
217 | - ]); |
|
217 | + ] ); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | */ |
223 | 223 | protected function getDefaults() |
224 | 224 | { |
225 | - return []; |
|
225 | + return [ ]; |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | protected function getPostType() |
232 | 232 | { |
233 | 233 | $type = array_search( $this->hook, $this->hooks ); |
234 | - if( !empty( $type ) && is_string( $type )) { |
|
234 | + if( !empty( $type ) && is_string( $type ) ) { |
|
235 | 235 | static::$current = $type; |
236 | 236 | } |
237 | 237 | return static::$current; |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | { |
245 | 245 | $types = array_map( function( $value ) { |
246 | 246 | return sprintf( 'edit.php?post_type=%s', $value ); |
247 | - }, get_post_types( ['has_archive' => 1] )); |
|
248 | - return array_merge( $types, ['post' => 'edit.php'] ); |
|
247 | + }, get_post_types( [ 'has_archive' => 1 ] ) ); |
|
248 | + return array_merge( $types, [ 'post' => 'edit.php' ] ); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | |
43 | 43 | $this->normalize( $this->app->config->{static::ID} ); |
44 | 44 | |
45 | - add_action( 'pollux/'.static::ID.'/init', [$this, 'addSubmitMetaBox'] ); |
|
46 | - add_action( 'current_screen', [$this, 'register'] ); |
|
47 | - add_action( 'admin_menu', [$this, 'registerPage'] ); |
|
48 | - add_action( 'admin_menu', [$this, 'registerSetting'] ); |
|
49 | - add_action( 'pollux/'.static::ID.'/init', [$this, 'resetPage'] ); |
|
50 | - add_action( 'admin_print_footer_scripts', [$this, 'renderFooterScript'] ); |
|
51 | - add_filter( 'pollux/'.static::ID.'/instruction', [$this, 'filterInstruction'], 10, 3 ); |
|
52 | - add_filter( 'pollux/'.static::ID.'/before/instructions', [$this, 'filterBeforeInstructions'] ); |
|
45 | + add_action( 'pollux/' . static::ID . '/init', [ $this, 'addSubmitMetaBox' ] ); |
|
46 | + add_action( 'current_screen', [ $this, 'register' ] ); |
|
47 | + add_action( 'admin_menu', [ $this, 'registerPage' ] ); |
|
48 | + add_action( 'admin_menu', [ $this, 'registerSetting' ] ); |
|
49 | + add_action( 'pollux/' . static::ID . '/init', [ $this, 'resetPage' ] ); |
|
50 | + add_action( 'admin_print_footer_scripts', [ $this, 'renderFooterScript' ] ); |
|
51 | + add_filter( 'pollux/' . static::ID . '/instruction', [ $this, 'filterInstruction' ], 10, 3 ); |
|
52 | + add_filter( 'pollux/' . static::ID . '/before/instructions', [ $this, 'filterBeforeInstructions' ] ); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | public function canProceed() |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | call_user_func_array( 'add_meta_box', $this->filter( 'metabox/submit', [ |
68 | 68 | 'submitdiv', |
69 | 69 | __( 'Save Settings', 'pollux' ), |
70 | - [$this, 'renderSubmitMetaBox'], |
|
70 | + [ $this, 'renderSubmitMetaBox' ], |
|
71 | 71 | $this->hook, |
72 | 72 | 'side', |
73 | 73 | 'high', |
74 | - ])); |
|
74 | + ] ) ); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function filterInstruction( $instruction, array $field, array $metabox ) |
92 | 92 | { |
93 | - return sprintf( "SiteMeta::%s('%s');", $metabox['slug'], $field['slug'] ); |
|
93 | + return sprintf( "SiteMeta::%s('%s');", $metabox[ 'slug' ], $field[ 'slug' ] ); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | return $this->filter( 'save', array_merge( |
105 | 105 | array_intersect_key( $this->getSettings(), $settings ), |
106 | 106 | $settings |
107 | - )); |
|
107 | + ) ); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function register() |
126 | 126 | { |
127 | - if(( new Helper )->getCurrentScreen()->id != $this->hook )return; |
|
128 | - if( $this->app->gatekeeper->hasDependency( self::DEPENDENCY )) { |
|
127 | + if( ( new Helper )->getCurrentScreen()->id != $this->hook )return; |
|
128 | + if( $this->app->gatekeeper->hasDependency( self::DEPENDENCY ) ) { |
|
129 | 129 | foreach( parent::register() as $metabox ) { |
130 | 130 | new RWMetaBox( $metabox, static::ID, $this ); |
131 | 131 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | add_screen_option( 'layout_columns', [ |
134 | 134 | 'max' => 2, |
135 | 135 | 'default' => 2, |
136 | - ]); |
|
136 | + ] ); |
|
137 | 137 | $this->action( 'init' ); |
138 | 138 | } |
139 | 139 | |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | __( 'Site Settings', 'pollux' ), |
149 | 149 | static::CAPABILITY, |
150 | 150 | static::id(), |
151 | - [$this, 'renderPage'], |
|
151 | + [ $this, 'renderPage' ], |
|
152 | 152 | 'dashicons-screenoptions', |
153 | 153 | 1313 |
154 | - ])); |
|
154 | + ] ) ); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function registerSetting() |
162 | 162 | { |
163 | - register_setting( static::id(), static::id(), [$this, 'filterSavedSettings'] ); |
|
163 | + register_setting( static::id(), static::id(), [ $this, 'filterSavedSettings' ] ); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function renderFooterScript() |
171 | 171 | { |
172 | - if(( new Helper )->getCurrentScreen()->id != $this->hook )return; |
|
172 | + if( ( new Helper )->getCurrentScreen()->id != $this->hook )return; |
|
173 | 173 | $this->app->render( 'settings/script', [ |
174 | 174 | 'confirm' => __( 'Are you sure want to do this?', 'pollux' ), |
175 | 175 | 'hook' => $this->hook, |
176 | 176 | 'id' => static::id(), |
177 | - ]); |
|
177 | + ] ); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | 'columns' => get_current_screen()->get_columns(), |
188 | 188 | 'heading' => __( 'Site Settings', 'pollux' ), |
189 | 189 | 'id' => static::id(), |
190 | - ]); |
|
190 | + ] ); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | ]; |
205 | 205 | $this->app->render( 'settings/submit', [ |
206 | 206 | 'reset' => __( 'Reset all', 'pollux' ), |
207 | - 'reset_url' => esc_url( add_query_arg( $query, admin_url( $pagenow ))), |
|
207 | + 'reset_url' => esc_url( add_query_arg( $query, admin_url( $pagenow ) ) ), |
|
208 | 208 | 'submit' => get_submit_button( __( 'Save', 'pollux' ), 'primary', 'submit', false ), |
209 | - ]); |
|
209 | + ] ); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -218,15 +218,15 @@ discard block |
||
218 | 218 | if( filter_input( INPUT_GET, 'page' ) !== static::id() |
219 | 219 | || filter_input( INPUT_GET, 'action' ) !== 'reset' |
220 | 220 | )return; |
221 | - if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), $this->hook )) { |
|
221 | + if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), $this->hook ) ) { |
|
222 | 222 | update_option( static::id(), $this->getDefaults() ); |
223 | 223 | add_settings_error( static::id(), 'reset', __( 'Reset successful.', 'pollux' ), 'updated' ); |
224 | 224 | } |
225 | 225 | else { |
226 | - add_settings_error( static::id(), 'failed', __( 'Failed to reset. Please try again.', 'pollux' )); |
|
226 | + add_settings_error( static::id(), 'failed', __( 'Failed to reset. Please try again.', 'pollux' ) ); |
|
227 | 227 | } |
228 | 228 | set_transient( 'settings_errors', get_settings_errors(), 30 ); |
229 | - wp_safe_redirect( add_query_arg( 'settings-updated', 'true', wp_get_referer() )); |
|
229 | + wp_safe_redirect( add_query_arg( 'settings-updated', 'true', wp_get_referer() ) ); |
|
230 | 230 | exit; |
231 | 231 | } |
232 | 232 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | protected function filterArrayByKey( array $array, $key ) |
238 | 238 | { |
239 | 239 | return array_filter( $array, function( $value ) use( $key ) { |
240 | - return !empty( $value[$key] ); |
|
240 | + return !empty( $value[ $key ] ); |
|
241 | 241 | }); |
242 | 242 | } |
243 | 243 | |
@@ -250,11 +250,11 @@ discard block |
||
250 | 250 | |
251 | 251 | array_walk( $metaboxes, function( &$metabox ) { |
252 | 252 | $fields = array_map( function( $field ) { |
253 | - $field = wp_parse_args( $field, ['std' => ''] ); |
|
254 | - return [$field['slug'] => $field['std']]; |
|
255 | - }, $this->filterArrayByKey( $metabox['fields'], 'slug' )); |
|
253 | + $field = wp_parse_args( $field, [ 'std' => '' ] ); |
|
254 | + return [ $field[ 'slug' ] => $field[ 'std' ] ]; |
|
255 | + }, $this->filterArrayByKey( $metabox[ 'fields' ], 'slug' ) ); |
|
256 | 256 | $metabox = [ |
257 | - $metabox['slug'] => call_user_func_array( 'array_merge', $fields ), |
|
257 | + $metabox[ 'slug' ] => call_user_func_array( 'array_merge', $fields ), |
|
258 | 258 | ]; |
259 | 259 | }); |
260 | 260 | return call_user_func_array( 'array_merge', $metaboxes ); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | protected function normalizeFieldName( $name, array $data, $parentId ) |
274 | 274 | { |
275 | - return sprintf( '%s[%s][%s]', static::id(), $parentId, $data['slug'] ); |
|
275 | + return sprintf( '%s[%s][%s]', static::id(), $parentId, $data[ 'slug' ] ); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | 'meta-box/meta-box.php' => 'Meta Box|4.11|https://wordpress.org/plugins/meta-box/', |
15 | 15 | ]; |
16 | 16 | |
17 | - public $errors = []; |
|
17 | + public $errors = [ ]; |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * @var Notice |
@@ -29,17 +29,17 @@ discard block |
||
29 | 29 | public function __construct( $plugin ) |
30 | 30 | { |
31 | 31 | $this->plugin = $plugin; |
32 | - add_action( 'admin_init', [$this, 'init'] ); |
|
32 | + add_action( 'admin_init', [ $this, 'init' ] ); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function init() |
36 | 36 | { |
37 | 37 | $this->notice = pollux_app()->make( 'Notice' ); |
38 | 38 | |
39 | - add_action( 'current_screen', [$this, 'activatePlugin'] ); |
|
40 | - add_action( 'wp_ajax_pollux/dependency/activate_url', [$this, 'ajaxActivatePluginLink'] ); |
|
41 | - add_action( 'admin_notices', [$this, 'printNotices'] ); |
|
42 | - add_action( 'current_screen', [$this, 'setDependencyNotice'] ); |
|
39 | + add_action( 'current_screen', [ $this, 'activatePlugin' ] ); |
|
40 | + add_action( 'wp_ajax_pollux/dependency/activate_url', [ $this, 'ajaxActivatePluginLink' ] ); |
|
41 | + add_action( 'admin_notices', [ $this, 'printNotices' ] ); |
|
42 | + add_action( 'current_screen', [ $this, 'setDependencyNotice' ] ); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $plugin = filter_input( INPUT_GET, 'plugin' ); |
54 | 54 | check_admin_referer( 'activate-plugin_' . $plugin ); |
55 | 55 | $result = activate_plugin( $plugin, null, is_network_admin(), true ); |
56 | - if( is_wp_error( $result )) { |
|
56 | + if( is_wp_error( $result ) ) { |
|
57 | 57 | wp_die( $result->get_error_message() ); |
58 | 58 | } |
59 | 59 | wp_safe_redirect( wp_get_referer() ); |
@@ -67,19 +67,19 @@ discard block |
||
67 | 67 | { |
68 | 68 | check_ajax_referer( 'updates' ); |
69 | 69 | $plugin = filter_input( INPUT_POST, 'plugin' ); |
70 | - if( !$this->isPluginDependency( $plugin )) { |
|
70 | + if( !$this->isPluginDependency( $plugin ) ) { |
|
71 | 71 | wp_send_json_error(); |
72 | 72 | } |
73 | - $activateUrl = add_query_arg([ |
|
74 | - '_wpnonce' => wp_create_nonce( sprintf( 'activate-plugin_%s', $plugin )), |
|
73 | + $activateUrl = add_query_arg( [ |
|
74 | + '_wpnonce' => wp_create_nonce( sprintf( 'activate-plugin_%s', $plugin ) ), |
|
75 | 75 | 'action' => 'activate', |
76 | 76 | 'page' => pollux_app()->id, |
77 | 77 | 'plugin' => $plugin, |
78 | - ], self_admin_url( 'options-general.php' )); |
|
79 | - wp_send_json_success([ |
|
78 | + ], self_admin_url( 'options-general.php' ) ); |
|
79 | + wp_send_json_success( [ |
|
80 | 80 | 'activate_url' => $activateUrl, |
81 | 81 | filter_input( INPUT_POST, 'type' ) => $plugin, |
82 | - ]); |
|
82 | + ] ); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function hasDependency( $plugin ) |
89 | 89 | { |
90 | - if( !$this->isPluginDependency( $plugin )) { |
|
90 | + if( !$this->isPluginDependency( $plugin ) ) { |
|
91 | 91 | return true; |
92 | 92 | } |
93 | 93 | return $this->isPluginInstalled( $plugin ) && $this->isPluginValid( $plugin ); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | public function hasPendingDependencies() |
100 | 100 | { |
101 | 101 | foreach( static::DEPENDENCIES as $plugin => $data ) { |
102 | - if( !$this->isPluginDependency( $plugin ))continue; |
|
102 | + if( !$this->isPluginDependency( $plugin ) )continue; |
|
103 | 103 | $this->isPluginActive( $plugin ); |
104 | 104 | $this->isPluginVersionValid( $plugin ); |
105 | 105 | } |
@@ -147,17 +147,17 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function isPluginVersionValid( $plugin ) |
149 | 149 | { |
150 | - if( !$this->isPluginDependency( $plugin )) { |
|
150 | + if( !$this->isPluginDependency( $plugin ) ) { |
|
151 | 151 | return true; |
152 | 152 | } |
153 | - if( !$this->isPluginInstalled( $plugin )) { |
|
153 | + if( !$this->isPluginInstalled( $plugin ) ) { |
|
154 | 154 | return false; |
155 | 155 | } |
156 | 156 | return $this->catchError( $plugin, 'wrong_version', version_compare( |
157 | 157 | $this->getPluginRequirements( $plugin, 'version' ), |
158 | - $this->getAllPlugins()[$plugin]['Version'], |
|
158 | + $this->getAllPlugins()[ $plugin ][ 'Version' ], |
|
159 | 159 | '<=' |
160 | - )); |
|
160 | + ) ); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | __( 'Pollux requires the latest version of the following plugins', 'pollux' ), |
184 | 184 | $this->getDependencyLinks() |
185 | 185 | ); |
186 | - $this->notice->addWarning( [$message, $this->getDependencyActions()] ); |
|
186 | + $this->notice->addWarning( [ $message, $this->getDependencyActions() ] ); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -194,13 +194,13 @@ discard block |
||
194 | 194 | */ |
195 | 195 | protected function catchError( $plugin, $error, $isValid ) |
196 | 196 | { |
197 | - if( !$isValid && $this->isPluginDependency( $plugin )) { |
|
198 | - if( !isset( $this->errors[$plugin] )) { |
|
199 | - $this->errors[$plugin] = []; |
|
197 | + if( !$isValid && $this->isPluginDependency( $plugin ) ) { |
|
198 | + if( !isset( $this->errors[ $plugin ] ) ) { |
|
199 | + $this->errors[ $plugin ] = [ ]; |
|
200 | 200 | } |
201 | - $this->errors[$plugin] = array_keys( array_flip( |
|
202 | - array_merge( $this->errors[$plugin], [$error] ) |
|
203 | - )); |
|
201 | + $this->errors[ $plugin ] = array_keys( array_flip( |
|
202 | + array_merge( $this->errors[ $plugin ], [ $error ] ) |
|
203 | + ) ); |
|
204 | 204 | } |
205 | 205 | return $isValid; |
206 | 206 | } |
@@ -221,14 +221,14 @@ discard block |
||
221 | 221 | { |
222 | 222 | $actions = ''; |
223 | 223 | foreach( $this->errors as $plugin => $errors ) { |
224 | - if( in_array( 'not_found', $errors ) && current_user_can( 'install_plugins' )) { |
|
225 | - $actions .= $this->notice->installButton( $this->getPluginRequirements( $plugin )); |
|
224 | + if( in_array( 'not_found', $errors ) && current_user_can( 'install_plugins' ) ) { |
|
225 | + $actions .= $this->notice->installButton( $this->getPluginRequirements( $plugin ) ); |
|
226 | 226 | } |
227 | - else if( in_array( 'wrong_version', $errors ) && current_user_can( 'update_plugins' )) { |
|
228 | - $actions .= $this->notice->updateButton( $this->getPluginInformation( $plugin )); |
|
227 | + else if( in_array( 'wrong_version', $errors ) && current_user_can( 'update_plugins' ) ) { |
|
228 | + $actions .= $this->notice->updateButton( $this->getPluginInformation( $plugin ) ); |
|
229 | 229 | } |
230 | - else if( in_array( 'inactive', $errors ) && current_user_can( 'activate_plugins' )) { |
|
231 | - $actions .= $this->notice->activateButton( $this->getPluginInformation( $plugin )); |
|
230 | + else if( in_array( 'inactive', $errors ) && current_user_can( 'activate_plugins' ) ) { |
|
231 | + $actions .= $this->notice->activateButton( $this->getPluginInformation( $plugin ) ); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | return $actions; |
@@ -250,10 +250,10 @@ discard block |
||
250 | 250 | protected function getMustUsePlugins() |
251 | 251 | { |
252 | 252 | $plugins = get_mu_plugins(); |
253 | - if( in_array( 'Bedrock Autoloader', array_column( $plugins, 'Name' ))) { |
|
253 | + if( in_array( 'Bedrock Autoloader', array_column( $plugins, 'Name' ) ) ) { |
|
254 | 254 | $autoloadedPlugins = get_site_option( 'bedrock_autoloader' ); |
255 | - if( !empty( $autoloadedPlugins['plugins'] )) { |
|
256 | - return array_merge( $plugins, $autoloadedPlugins['plugins'] ); |
|
255 | + if( !empty( $autoloadedPlugins[ 'plugins' ] ) ) { |
|
256 | + return array_merge( $plugins, $autoloadedPlugins[ 'plugins' ] ); |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | return $plugins; |
@@ -264,8 +264,8 @@ discard block |
||
264 | 264 | */ |
265 | 265 | protected function getPlugin( $plugin ) |
266 | 266 | { |
267 | - if( $this->isPluginInstalled( $plugin )) { |
|
268 | - return $this->getAllPlugins()[$plugin]; |
|
267 | + if( $this->isPluginInstalled( $plugin ) ) { |
|
268 | + return $this->getAllPlugins()[ $plugin ]; |
|
269 | 269 | } |
270 | 270 | return false; |
271 | 271 | } |
@@ -275,18 +275,18 @@ discard block |
||
275 | 275 | */ |
276 | 276 | protected function getPluginData( $plugin, $data, $key = null ) |
277 | 277 | { |
278 | - if( !is_array( $data )) { |
|
279 | - throw new Exception( sprintf( 'Plugin information not found for: %s', $plugin )); |
|
278 | + if( !is_array( $data ) ) { |
|
279 | + throw new Exception( sprintf( 'Plugin information not found for: %s', $plugin ) ); |
|
280 | 280 | } |
281 | - $data['plugin'] = $plugin; |
|
282 | - $data['slug'] = $this->getPluginSlug( $plugin ); |
|
281 | + $data[ 'plugin' ] = $plugin; |
|
282 | + $data[ 'slug' ] = $this->getPluginSlug( $plugin ); |
|
283 | 283 | $data = array_change_key_case( $data ); |
284 | - if( is_null( $key )) { |
|
284 | + if( is_null( $key ) ) { |
|
285 | 285 | return $data; |
286 | 286 | } |
287 | 287 | $key = strtolower( $key ); |
288 | - return isset( $data[$key] ) |
|
289 | - ? $data[$key] |
|
288 | + return isset( $data[ $key ] ) |
|
289 | + ? $data[ $key ] |
|
290 | 290 | : ''; |
291 | 291 | } |
292 | 292 | |
@@ -310,9 +310,9 @@ discard block |
||
310 | 310 | $data = $this->getPluginRequirements( $plugin ); |
311 | 311 | } |
312 | 312 | return sprintf( '<span class="plugin-%s"><a href="%s">%s</a></span>', |
313 | - $data['slug'], |
|
314 | - $data['pluginuri'], |
|
315 | - $data['name'] |
|
313 | + $data[ 'slug' ], |
|
314 | + $data[ 'pluginuri' ], |
|
315 | + $data[ 'name' ] |
|
316 | 316 | ); |
317 | 317 | } |
318 | 318 | |
@@ -321,9 +321,9 @@ discard block |
||
321 | 321 | */ |
322 | 322 | protected function getPluginRequirements( $plugin, $key = null ) |
323 | 323 | { |
324 | - $keys = ['Name', 'Version', 'PluginURI']; |
|
324 | + $keys = [ 'Name', 'Version', 'PluginURI' ]; |
|
325 | 325 | $requirements = $this->isPluginDependency( $plugin ) |
326 | - ? array_pad( explode( '|', static::DEPENDENCIES[$plugin] ), 3, '' ) |
|
326 | + ? array_pad( explode( '|', static::DEPENDENCIES[ $plugin ] ), 3, '' ) |
|
327 | 327 | : array_fill( 0, 3, '' ); |
328 | 328 | return $this->getPluginData( $plugin, array_combine( $keys, $requirements ), $key ); |
329 | 329 | } |
@@ -333,6 +333,6 @@ discard block |
||
333 | 333 | */ |
334 | 334 | protected function getPluginSlug( $plugin ) |
335 | 335 | { |
336 | - return substr( $plugin, 0, strrpos( $plugin, '/' )); |
|
336 | + return substr( $plugin, 0, strrpos( $plugin, '/' ) ); |
|
337 | 337 | } |
338 | 338 | } |
@@ -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' ); |
@@ -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(); |
@@ -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 | } |