@@ -31,7 +31,8 @@ |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | private function __clone() |
34 | - {} |
|
34 | + { |
|
35 | +} |
|
35 | 36 | |
36 | 37 | /** |
37 | 38 | * Get or create the singleton alias loader instance. |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public static function getInstance( array $aliases = [] ) |
42 | 42 | { |
43 | - if( is_null( static::$instance )) { |
|
44 | - return static::$instance = new static( $aliases ); |
|
43 | + if( is_null( static::$instance ) ) { |
|
44 | + return static::$instance = new static($aliases); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $aliases = array_merge( static::$instance->aliases, $aliases ); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function load( $alias ) |
62 | 62 | { |
63 | - if( isset( $this->aliases[$alias] )) { |
|
63 | + if( isset($this->aliases[$alias]) ) { |
|
64 | 64 | return class_alias( $this->aliases[$alias], $alias ); |
65 | 65 | } |
66 | 66 | } |
@@ -16,18 +16,18 @@ discard block |
||
16 | 16 | */ |
17 | 17 | protected static $instance; |
18 | 18 | |
19 | - /** |
|
20 | - * The container's bound services. |
|
21 | - * |
|
22 | - * @var array |
|
23 | - */ |
|
19 | + /** |
|
20 | + * The container's bound services. |
|
21 | + * |
|
22 | + * @var array |
|
23 | + */ |
|
24 | 24 | protected $services = []; |
25 | 25 | |
26 | - /** |
|
27 | - * The container's bucket items |
|
28 | - * |
|
29 | - * @var array |
|
30 | - */ |
|
26 | + /** |
|
27 | + * The container's bucket items |
|
28 | + * |
|
29 | + * @var array |
|
30 | + */ |
|
31 | 31 | protected $bucket = []; |
32 | 32 | |
33 | 33 | /** |
@@ -123,10 +123,10 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
126 | - * Register a Provider. |
|
127 | - * |
|
128 | - * @return void |
|
129 | - */ |
|
126 | + * Register a Provider. |
|
127 | + * |
|
128 | + * @return void |
|
129 | + */ |
|
130 | 130 | public function register( $provider ) |
131 | 131 | { |
132 | 132 | $provider->register( $this ); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public static function getInstance() |
39 | 39 | { |
40 | - if( is_null( static::$instance )) { |
|
40 | + if( is_null( static::$instance ) ) { |
|
41 | 41 | static::$instance = new static; |
42 | 42 | } |
43 | 43 | |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function make( $abstract ) |
70 | 70 | { |
71 | - $service = isset( $this->services[$abstract] ) |
|
71 | + $service = isset($this->services[$abstract]) |
|
72 | 72 | ? $this->services[$abstract] |
73 | 73 | : $this->addNamespace( $abstract ); |
74 | 74 | |
75 | - if( is_callable( $service )) { |
|
75 | + if( is_callable( $service ) ) { |
|
76 | 76 | return call_user_func_array( $service, [$this] ); |
77 | 77 | } |
78 | - if( is_object( $service )) { |
|
78 | + if( is_object( $service ) ) { |
|
79 | 79 | return $service; |
80 | 80 | } |
81 | 81 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function singleton( $abstract, $concrete ) |
94 | 94 | { |
95 | - $this->bind( $abstract, $this->make( $concrete )); |
|
95 | + $this->bind( $abstract, $this->make( $concrete ) ); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function __get( $item ) |
106 | 106 | { |
107 | - return isset( $this->bucket[$item] ) |
|
107 | + return isset($this->bucket[$item]) |
|
108 | 108 | ? $this->bucket[$item] |
109 | 109 | : null; |
110 | 110 | } |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | */ |
142 | 142 | protected function addNamespace( $abstract ) |
143 | 143 | { |
144 | - if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract )) { |
|
145 | - $abstract = __NAMESPACE__ . "\\$abstract"; |
|
144 | + if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract ) ) { |
|
145 | + $abstract = __NAMESPACE__."\\$abstract"; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | return $abstract; |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | return $this->notInstantiable( $concrete ); |
184 | 184 | } |
185 | 185 | |
186 | - if( is_null(( $constructor = $reflector->getConstructor() ))) { |
|
186 | + if( is_null( ($constructor = $reflector->getConstructor()) ) ) { |
|
187 | 187 | return new $concrete; |
188 | 188 | } |
189 | 189 |
@@ -12,7 +12,9 @@ |
||
12 | 12 | */ |
13 | 13 | public function get( $metaKey, array $args = [] ) |
14 | 14 | { |
15 | - if( empty( $metaKey ))return; |
|
15 | + if( empty( $metaKey )) { |
|
16 | + return; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | $args = $this->normalize( $args ); |
18 | 20 | $metaKey = $this->buildMetaKey( $metaKey, $args['prefix'] ); |
@@ -18,16 +18,16 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function get( $metaKey, array $args = [] ) |
20 | 20 | { |
21 | - if( empty( $metaKey ))return; |
|
21 | + if( empty($metaKey) )return; |
|
22 | 22 | |
23 | 23 | $args = $this->normalize( $args ); |
24 | 24 | $metaKey = $this->buildMetaKey( $metaKey, $args['prefix'] ); |
25 | 25 | $metaValue = get_post_meta( $args['id'], $metaKey, $args['single'] ); |
26 | 26 | |
27 | - if( is_string( $metaValue )) { |
|
27 | + if( is_string( $metaValue ) ) { |
|
28 | 28 | $metaValue = trim( $metaValue ); |
29 | 29 | } |
30 | - return empty( $metaValue ) |
|
30 | + return empty($metaValue) |
|
31 | 31 | ? $args['fallback'] |
32 | 32 | : $metaValue; |
33 | 33 | } |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | */ |
40 | 40 | protected function buildMetaKey( $metaKey, $prefix ) |
41 | 41 | { |
42 | - return ( substr( $metaKey, 0, 1 ) == '_' && !empty( $prefix )) |
|
42 | + return (substr( $metaKey, 0, 1 ) == '_' && !empty($prefix)) |
|
43 | 43 | ? sprintf( '_%s%s', rtrim( $prefix, '_' ), $metaKey ) |
44 | - : $prefix . $metaKey; |
|
44 | + : $prefix.$metaKey; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -55,6 +55,6 @@ discard block |
||
55 | 55 | 'single' => true, |
56 | 56 | 'prefix' => Application::prefix(), |
57 | 57 | ]; |
58 | - return shortcode_atts( $defaults, array_change_key_case( $args )); |
|
58 | + return shortcode_atts( $defaults, array_change_key_case( $args ) ); |
|
59 | 59 | } |
60 | 60 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if( !function_exists( 'pollux_app' )) { |
|
3 | +if( !function_exists( 'pollux_app' ) ) { |
|
4 | 4 | function pollux_app() { |
5 | 5 | return GeminiLabs\Pollux\Application::getInstance(); |
6 | 6 | } |
@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if( !function_exists( 'pollux_app' )) { |
4 | - function pollux_app() { |
|
4 | + function pollux_app() |
|
5 | + { |
|
5 | 6 | return GeminiLabs\Pollux\Application::getInstance(); |
6 | 7 | } |
7 | 8 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | |
10 | 10 | class Archive extends Settings |
11 | 11 | { |
12 | - CONST ID = 'archives'; |
|
12 | + const ID = 'archives'; |
|
13 | 13 | |
14 | 14 | const CAPABILITY = 'edit_others_posts'; |
15 | 15 | const DEPENDENCY = ''; |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | parent::init(); |
27 | 27 | |
28 | 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' ); |
|
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() |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | return sprintf( '<pre class="my-sites nav-tab-active misc-pub-section">%s</pre>', |
49 | 49 | array_reduce( ['title', 'content', 'featured'], function( $instructions, $id ) { |
50 | - return $instructions . $this->filterInstruction( null, ['slug' => $id], ['slug' => $this->getPostType()] ) . PHP_EOL; |
|
50 | + return $instructions.$this->filterInstruction( null, ['slug' => $id], ['slug' => $this->getPostType()] ).PHP_EOL; |
|
51 | 51 | }) |
52 | 52 | ); |
53 | 53 | } |
@@ -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 | /** |
@@ -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 | |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function register() |
118 | 118 | { |
119 | - $screenId = ( new Helper )->getCurrentScreen()->id; |
|
120 | - if( in_array( $screenId, $this->hooks )) { |
|
119 | + $screenId = (new Helper)->getCurrentScreen()->id; |
|
120 | + if( in_array( $screenId, $this->hooks ) ) { |
|
121 | 121 | $this->hook = $screenId; |
122 | 122 | } |
123 | 123 | parent::register(); |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function registerFeaturedImageMetaBox() |
131 | 131 | { |
132 | - if( !current_user_can( 'upload_files' ))return; |
|
132 | + if( !current_user_can( 'upload_files' ) )return; |
|
133 | 133 | add_meta_box( 'postimagediv', __( 'Featured Image', 'pollux' ), [$this, 'renderFeaturedImageMetaBox'], null, 'side', 'low' ); |
134 | 134 | } |
135 | 135 | |
@@ -140,7 +140,7 @@ 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 )); |
|
143 | + $labels = get_post_type_labels( get_post_type_object( $type ) ); |
|
144 | 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 ), |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | static::CAPABILITY, |
149 | 149 | sprintf( '%s_archive', $type ), |
150 | 150 | [$this, 'renderPage'], |
151 | - ])); |
|
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,10 +178,10 @@ 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 | 186 | : [266, 266]; |
187 | 187 | $thumbnail = get_post( $imageId ) |
@@ -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 | /** |
@@ -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,7 +244,7 @@ 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] )); |
|
247 | + }, get_post_types( ['has_archive' => 1] ) ); |
|
248 | 248 | return array_merge( $types, ['post' => 'edit.php'] ); |
249 | 249 | } |
250 | 250 | |
@@ -253,6 +253,6 @@ discard block |
||
253 | 253 | */ |
254 | 254 | protected function getSettings() |
255 | 255 | { |
256 | - return (array) ArchiveMeta::all(); |
|
256 | + return (array)ArchiveMeta::all(); |
|
257 | 257 | } |
258 | 258 | } |
@@ -129,7 +129,9 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function registerFeaturedImageMetaBox() |
131 | 131 | { |
132 | - if( !current_user_can( 'upload_files' ))return; |
|
132 | + if( !current_user_can( 'upload_files' )) { |
|
133 | + return; |
|
134 | + } |
|
133 | 135 | add_meta_box( 'postimagediv', __( 'Featured Image', 'pollux' ), [$this, 'renderFeaturedImageMetaBox'], null, 'side', 'low' ); |
134 | 136 | } |
135 | 137 | |
@@ -205,7 +207,9 @@ discard block |
||
205 | 207 | public function renderPage() |
206 | 208 | { |
207 | 209 | $type = $this->getPostType(); |
208 | - if( empty( $type ))return; |
|
210 | + if( empty( $type )) { |
|
211 | + return; |
|
212 | + } |
|
209 | 213 | $labels = get_post_type_labels( get_post_type_object( $type )); |
210 | 214 | $this->app->render( 'archive/index', [ |
211 | 215 | 'columns' => get_current_screen()->get_columns(), |
@@ -37,7 +37,9 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function init() |
39 | 39 | { |
40 | - if( $this->app->config->disable_config )return; |
|
40 | + if( $this->app->config->disable_config ) { |
|
41 | + return; |
|
42 | + } |
|
41 | 43 | |
42 | 44 | add_action( 'admin_menu', [$this, 'registerPage'] ); |
43 | 45 | add_action( 'admin_menu', [$this, 'registerSetting'] ); |
@@ -107,7 +109,9 @@ discard block |
||
107 | 109 | { |
108 | 110 | if( filter_input( INPUT_GET, 'page' ) !== $this->app->id |
109 | 111 | || filter_input( INPUT_GET, 'action' ) !== 'reset' |
110 | - )return; |
|
112 | + ) { |
|
113 | + return; |
|
114 | + } |
|
111 | 115 | if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), static::id() )) { |
112 | 116 | delete_option( static::id() ); |
113 | 117 | $this->app->make( ConfigManager::class )->compile( true ); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public static function id() |
26 | 26 | { |
27 | - return Application::PREFIX . static::ID; |
|
27 | + return Application::PREFIX.static::ID; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | public function __construct( Application $app ) |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | { |
40 | 40 | if( $this->app->config->disable_config )return; |
41 | 41 | |
42 | - add_action( 'admin_menu', [$this, 'registerPage'] ); |
|
43 | - add_action( 'admin_menu', [$this, 'registerSetting'] ); |
|
42 | + add_action( 'admin_menu', [$this, 'registerPage'] ); |
|
43 | + add_action( 'admin_menu', [$this, 'registerSetting'] ); |
|
44 | 44 | add_action( 'current_screen', [$this, 'resetPage'] ); |
45 | 45 | } |
46 | 46 | |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | 'config' => $this->app->make( ConfigManager::class ), |
95 | 95 | 'heading' => __( 'Pollux Settings', 'pollux' ), |
96 | 96 | 'id' => static::id(), |
97 | - 'reset_url' => esc_url( add_query_arg( $query, admin_url( 'options-general.php' ))), |
|
97 | + 'reset_url' => esc_url( add_query_arg( $query, admin_url( 'options-general.php' ) ) ), |
|
98 | 98 | 'has_meta_box' => $this->app->gatekeeper->hasDependency( 'meta-box/meta-box.php' ), |
99 | - ]); |
|
99 | + ] ); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -108,16 +108,16 @@ discard block |
||
108 | 108 | if( filter_input( INPUT_GET, 'page' ) !== $this->app->id |
109 | 109 | || filter_input( INPUT_GET, 'action' ) !== 'reset' |
110 | 110 | )return; |
111 | - if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), static::id() )) { |
|
111 | + if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), static::id() ) ) { |
|
112 | 112 | delete_option( static::id() ); |
113 | 113 | $this->app->make( ConfigManager::class )->compile( true ); |
114 | 114 | add_settings_error( static::id(), 'reset', __( 'Reset successful.', 'pollux' ), 'updated' ); |
115 | 115 | } |
116 | 116 | else { |
117 | - add_settings_error( static::id(), 'failed', __( 'Failed to reset. Please try again.', 'pollux' )); |
|
117 | + add_settings_error( static::id(), 'failed', __( 'Failed to reset. Please try again.', 'pollux' ) ); |
|
118 | 118 | } |
119 | 119 | set_transient( 'settings_errors', get_settings_errors(), 30 ); |
120 | - wp_safe_redirect( add_query_arg( 'settings-updated', 'true', wp_get_referer() )); |
|
120 | + wp_safe_redirect( add_query_arg( 'settings-updated', 'true', wp_get_referer() ) ); |
|
121 | 121 | exit; |
122 | 122 | } |
123 | 123 | } |
@@ -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 ); |
@@ -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 | [], |
@@ -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 )); |
|
30 | + $settings_url = admin_url( sprintf( 'options-general.php?page=%s', $this->app->id ) ); |
|
31 | 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' )); |
|
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 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function registerAssets() |
52 | 52 | { |
53 | - $screen = ( new Helper )->getCurrentScreen(); |
|
53 | + $screen = (new Helper)->getCurrentScreen(); |
|
54 | 54 | |
55 | 55 | $this->registerArchiveAssets( $screen ); |
56 | 56 | $this->registerCodemirrorAssets( $screen ); |
@@ -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' ); |
@@ -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' ); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $this->versions = wp_parse_args( $versions, array( |
31 | 31 | 'php' => static::MIN_PHP_VERSION, |
32 | 32 | 'wordpress' => static::MIN_WORDPRESS_VERSION, |
33 | - )); |
|
33 | + ) ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | if( $this->isValid() ) { |
42 | 42 | return true; |
43 | 43 | } |
44 | - add_action( 'activated_plugin', array( $this, 'deactivate' )); |
|
45 | - add_action( 'admin_notices', array( $this, 'deactivate' )); |
|
44 | + add_action( 'activated_plugin', array( $this, 'deactivate' ) ); |
|
45 | + add_action( 'admin_notices', array( $this, 'deactivate' ) ); |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | filter_input( INPUT_GET, 'plugin_status' ), |
138 | 138 | filter_input( INPUT_GET, 'paged' ), |
139 | 139 | filter_input( INPUT_GET, 's' ) |
140 | - ))); |
|
140 | + ) ) ); |
|
141 | 141 | exit; |
142 | 142 | } |
143 | 143 | } |
@@ -77,7 +77,9 @@ |
||
77 | 77 | */ |
78 | 78 | public function deactivate( $plugin ) |
79 | 79 | { |
80 | - if( $this->isValid() )return; |
|
80 | + if( $this->isValid() ) { |
|
81 | + return; |
|
82 | + } |
|
81 | 83 | $pluginSlug = plugin_basename( $this->file ); |
82 | 84 | if( $plugin == $pluginSlug ) { |
83 | 85 | $this->redirect(); //exit |