@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php defined( 'WPINC' ) || die; |
2 | 2 | |
3 | -include trailingslashit(__DIR__).'header.php'; |
|
4 | -include trailingslashit(__DIR__).'body.php'; |
|
5 | -include trailingslashit(__DIR__).'footer.php'; |
|
3 | +include trailingslashit( __DIR__ ).'header.php'; |
|
4 | +include trailingslashit( __DIR__ ).'body.php'; |
|
5 | +include trailingslashit( __DIR__ ).'footer.php'; |
@@ -3,7 +3,7 @@ |
||
3 | 3 | defined( 'WP_UNINSTALL_PLUGIN' ) || die; |
4 | 4 | |
5 | 5 | require_once __DIR__.'/site-reviews.php'; |
6 | -if( !GL_Plugin_Check_v1::isValid( array( 'wordpress' => '4.7.0' )))return; |
|
6 | +if( !GL_Plugin_Check_v1::isValid( array( 'wordpress' => '4.7.0' ) ) )return; |
|
7 | 7 | |
8 | 8 | delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey() ); |
9 | 9 | delete_option( 'widget_'.glsr()->id.'_site-reviews' ); |
@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | public function defaults() |
14 | 14 | { |
15 | 15 | $settings = $this->settings(); |
16 | - $defaults = array_combine( array_keys( $settings ), array_column( $settings, 'default' )); |
|
16 | + $defaults = array_combine( array_keys( $settings ), array_column( $settings, 'default' ) ); |
|
17 | 17 | return wp_parse_args( $defaults, [ |
18 | 18 | 'version' => '', |
19 | 19 | 'version_upgraded_from' => '', |
20 | - ]); |
|
20 | + ] ); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | protected function normalize( array $settings ) |
58 | 58 | { |
59 | 59 | array_walk( $settings, function( &$setting ) { |
60 | - if( isset( $setting['default'] ))return; |
|
60 | + if( isset($setting['default']) )return; |
|
61 | 61 | $setting['default'] = ''; |
62 | 62 | }); |
63 | 63 | return $settings; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | public function download( $filename, $content ) |
17 | 17 | { |
18 | - if( !current_user_can( Application::CAPABILITY ))return; |
|
18 | + if( !current_user_can( Application::CAPABILITY ) )return; |
|
19 | 19 | nocache_headers(); |
20 | 20 | header( 'Content-Type: text/plain' ); |
21 | 21 | header( 'Content-Disposition: attachment; filename="'.$filename.'"' ); |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function execute( $command ) |
32 | 32 | { |
33 | - $handlerClass = str_replace( 'Commands', 'Handlers', get_class( $command )); |
|
34 | - if( !class_exists( $handlerClass )) { |
|
33 | + $handlerClass = str_replace( 'Commands', 'Handlers', get_class( $command ) ); |
|
34 | + if( !class_exists( $handlerClass ) ) { |
|
35 | 35 | throw new InvalidArgumentException( 'Handler '.$handlerClass.' not found.' ); |
36 | 36 | } |
37 | 37 | try { |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | } |
40 | 40 | catch( Exception $e ) { |
41 | 41 | status_header( 400 ); |
42 | - glsr( Notice::class )->addError( new WP_Error( 'site_reviews_error', $e->getMessage() )); |
|
42 | + glsr( Notice::class )->addError( new WP_Error( 'site_reviews_error', $e->getMessage() ) ); |
|
43 | 43 | glsr_log()->error( $e->getMessage() ); |
44 | 44 | } |
45 | 45 | } |
@@ -49,6 +49,6 @@ discard block |
||
49 | 49 | */ |
50 | 50 | protected function getPostId() |
51 | 51 | { |
52 | - return intval( filter_input( INPUT_GET, 'post' )); |
|
52 | + return intval( filter_input( INPUT_GET, 'post' ) ); |
|
53 | 53 | } |
54 | 54 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | public function all() |
25 | 25 | { |
26 | 26 | $options = get_option( static::databaseKey(), [] ); |
27 | - if( !is_array( $options )) { |
|
27 | + if( !is_array( $options ) ) { |
|
28 | 28 | delete_option( static::databaseKey() ); |
29 | 29 | $options = ['settings' => []]; |
30 | 30 | } |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | $options = $this->all(); |
43 | 43 | $pointer = &$options; |
44 | 44 | foreach( $keys as $key ) { |
45 | - if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue; |
|
45 | + if( !isset($pointer[$key]) || !is_array( $pointer[$key] ) )continue; |
|
46 | 46 | $pointer = &$pointer[$key]; |
47 | 47 | } |
48 | - unset( $pointer[$last] ); |
|
48 | + unset($pointer[$last]); |
|
49 | 49 | return $this->set( $options ); |
50 | 50 | } |
51 | 51 | |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | glsr( DefaultsManager::class )->defaults() |
78 | 78 | ); |
79 | 79 | array_walk( $options, function( &$value ) { |
80 | - if( !is_string( $value ))return; |
|
81 | - $value = wp_kses( $value, wp_kses_allowed_html( 'post' )); |
|
80 | + if( !is_string( $value ) )return; |
|
81 | + $value = wp_kses( $value, wp_kses_allowed_html( 'post' ) ); |
|
82 | 82 | }); |
83 | 83 | return glsr( Helper::class )->convertDotNotationArray( $options ); |
84 | 84 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function set( $pathOrOptions, $value = '' ) |
92 | 92 | { |
93 | - if( is_string( $pathOrOptions )) { |
|
93 | + if( is_string( $pathOrOptions ) ) { |
|
94 | 94 | $pathOrOptions = glsr( Helper::class )->setPathValue( $pathOrOptions, $value, $this->all() ); |
95 | 95 | } |
96 | 96 | return update_option( static::databaseKey(), (array)$pathOrOptions ); |
@@ -38,27 +38,27 @@ |
||
38 | 38 | */ |
39 | 39 | public function run() |
40 | 40 | { |
41 | - add_filter( 'mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15 ); |
|
42 | - add_filter( 'plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks'] ); |
|
43 | - add_filter( 'dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems'] ); |
|
44 | - add_filter( 'wp_editor_settings', [$this->editor, 'filterEditorSettings'] ); |
|
45 | - add_filter( 'the_editor', [$this->editor, 'filterEditorTextarea'] ); |
|
46 | - add_filter( 'gettext', [$this->editor, 'filterPostStatusLabels'], 10, 3 ); |
|
47 | - add_filter( 'gettext_with_context', [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4 ); |
|
48 | - add_filter( 'post_updated_messages', [$this->editor, 'filterUpdateMessages'] ); |
|
49 | - add_filter( 'bulk_post_updated_messages', [$this->listtable, 'filterBulkUpdateMessages'], 10, 2 ); |
|
50 | - add_filter( 'manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType'] ); |
|
51 | - add_filter( 'post_date_column_status', [$this->listtable, 'filterDateColumnStatus'], 10, 2 ); |
|
52 | - add_filter( 'default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 ); |
|
53 | - add_filter( 'display_post_states', [$this->listtable, 'filterPostStates'], 10, 2 ); |
|
54 | - add_filter( 'post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2 ); |
|
41 | + add_filter( 'mce_external_plugins', [$this->admin, 'filterTinymcePlugins'], 15 ); |
|
42 | + add_filter( 'plugin_action_links_'.$this->basename, [$this->admin, 'filterActionLinks'] ); |
|
43 | + add_filter( 'dashboard_glance_items', [$this->admin, 'filterDashboardGlanceItems'] ); |
|
44 | + add_filter( 'wp_editor_settings', [$this->editor, 'filterEditorSettings'] ); |
|
45 | + add_filter( 'the_editor', [$this->editor, 'filterEditorTextarea'] ); |
|
46 | + add_filter( 'gettext', [$this->editor, 'filterPostStatusLabels'], 10, 3 ); |
|
47 | + add_filter( 'gettext_with_context', [$this->editor, 'filterPostStatusLabelsWithContext'], 10, 4 ); |
|
48 | + add_filter( 'post_updated_messages', [$this->editor, 'filterUpdateMessages'] ); |
|
49 | + add_filter( 'bulk_post_updated_messages', [$this->listtable, 'filterBulkUpdateMessages'], 10, 2 ); |
|
50 | + add_filter( 'manage_'.Application::POST_TYPE.'_posts_columns', [$this->listtable, 'filterColumnsForPostType'] ); |
|
51 | + add_filter( 'post_date_column_status', [$this->listtable, 'filterDateColumnStatus'], 10, 2 ); |
|
52 | + add_filter( 'default_hidden_columns', [$this->listtable, 'filterDefaultHiddenColumns'], 10, 2 ); |
|
53 | + add_filter( 'display_post_states', [$this->listtable, 'filterPostStates'], 10, 2 ); |
|
54 | + add_filter( 'post_row_actions', [$this->listtable, 'filterRowActions'], 10, 2 ); |
|
55 | 55 | add_filter( 'manage_edit-'.Application::POST_TYPE.'_sortable_columns', [$this->listtable, 'filterSortableColumns'] ); |
56 | - add_filter( 'ngettext', [$this->listtable, 'filterStatusText'], 10, 5 ); |
|
57 | - add_filter( 'script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2 ); |
|
58 | - add_filter( 'query_vars', [$this->public, 'filterQueryVars'] ); |
|
59 | - add_filter( 'gettext', [$this->translator, 'filterGettext'], 10, 3 ); |
|
60 | - add_filter( 'gettext_with_context', [$this->translator, 'filterGettextWithContext'], 10, 4 ); |
|
61 | - add_filter( 'ngettext', [$this->translator, 'filterNgettext'], 10, 5 ); |
|
62 | - add_filter( 'ngettext_with_context', [$this->translator, 'filterNgettextWithContext'], 10, 6 ); |
|
56 | + add_filter( 'ngettext', [$this->listtable, 'filterStatusText'], 10, 5 ); |
|
57 | + add_filter( 'script_loader_tag', [$this->public, 'filterEnqueuedScripts'], 10, 2 ); |
|
58 | + add_filter( 'query_vars', [$this->public, 'filterQueryVars'] ); |
|
59 | + add_filter( 'gettext', [$this->translator, 'filterGettext'], 10, 3 ); |
|
60 | + add_filter( 'gettext_with_context', [$this->translator, 'filterGettextWithContext'], 10, 4 ); |
|
61 | + add_filter( 'ngettext', [$this->translator, 'filterNgettext'], 10, 5 ); |
|
62 | + add_filter( 'ngettext_with_context', [$this->translator, 'filterNgettextWithContext'], 10, 6 ); |
|
63 | 63 | } |
64 | 64 | } |
@@ -12,11 +12,11 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public function handle( Command $command ) |
14 | 14 | { |
15 | - $postId = wp_update_post([ |
|
15 | + $postId = wp_update_post( [ |
|
16 | 16 | 'ID' => $command->id, |
17 | 17 | 'post_status' => $command->status, |
18 | - ]); |
|
19 | - if( is_wp_error( $postId )) { |
|
18 | + ] ); |
|
19 | + if( is_wp_error( $postId ) ) { |
|
20 | 20 | glsr_log()->error( $postId->get_error_message() ); |
21 | 21 | return []; |
22 | 22 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'aria-label' => '“'.esc_attr( $title ).'” ('.__( 'Edit', 'site-reviews' ).')', |
38 | 38 | 'class' => 'row-title', |
39 | 39 | 'href' => get_edit_post_link( $postId ), |
40 | - ]); |
|
40 | + ] ); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | protected function getPostState( $postId ) |
48 | 48 | { |
49 | 49 | ob_start(); |
50 | - _post_states( get_post( $postId )); |
|
50 | + _post_states( get_post( $postId ) ); |
|
51 | 51 | return ob_get_clean(); |
52 | 52 | } |
53 | 53 | } |
@@ -51,9 +51,9 @@ |
||
51 | 51 | protected function normalize( array $data ) |
52 | 52 | { |
53 | 53 | $arrayKeys = ['context', 'globals']; |
54 | - $data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] )); |
|
54 | + $data = wp_parse_args( $data, array_fill_keys( $arrayKeys, [] ) ); |
|
55 | 55 | foreach( $arrayKeys as $key ) { |
56 | - if( is_array( $data[$key] ))continue; |
|
56 | + if( is_array( $data[$key] ) )continue; |
|
57 | 57 | $data[$key] = []; |
58 | 58 | } |
59 | 59 | return $data; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | protected function filterAttributes( array $allowedAttributeKeys ) |
119 | 119 | { |
120 | - return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys )); |
|
120 | + return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys ) ); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $globalAttributes = $this->filterAttributes( static::GLOBAL_ATTRIBUTES ); |
129 | 129 | $wildcards = []; |
130 | 130 | foreach( static::GLOBAL_WILDCARD_ATTRIBUTES as $wildcard ) { |
131 | - $newWildcards = array_filter( $this->attributes, function( $key ) use( $wildcard ) { |
|
131 | + $newWildcards = array_filter( $this->attributes, function( $key ) use($wildcard) { |
|
132 | 132 | return glsr( Helper::class )->startsWith( $wildcard, $key ); |
133 | 133 | }, ARRAY_FILTER_USE_KEY ); |
134 | 134 | $wildcards = array_merge( $wildcards, $newWildcards ); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | protected function getPermanentAttributes() |
143 | 143 | { |
144 | 144 | $permanentAttributes = []; |
145 | - if( array_key_exists( 'value', $this->attributes )) { |
|
145 | + if( array_key_exists( 'value', $this->attributes ) ) { |
|
146 | 146 | $permanentAttributes['value'] = $this->attributes['value']; |
147 | 147 | } |
148 | 148 | return $permanentAttributes; |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | protected function normalizeBooleanAttributes() |
195 | 195 | { |
196 | 196 | foreach( $this->attributes as $key => $value ) { |
197 | - if( $this->isAttributeKeyNumeric( $key, $value )) { |
|
197 | + if( $this->isAttributeKeyNumeric( $key, $value ) ) { |
|
198 | 198 | $key = $value; |
199 | 199 | $value = true; |
200 | 200 | } |
201 | - if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ))continue; |
|
201 | + if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ) )continue; |
|
202 | 202 | $this->attributes[$key] = wp_validate_boolean( $value ); |
203 | 203 | } |
204 | 204 | } |
@@ -209,12 +209,12 @@ discard block |
||
209 | 209 | protected function normalizeDataAttributes() |
210 | 210 | { |
211 | 211 | foreach( $this->attributes as $key => $value ) { |
212 | - if( $this->isAttributeKeyNumeric( $key, $value )) { |
|
212 | + if( $this->isAttributeKeyNumeric( $key, $value ) ) { |
|
213 | 213 | $key = $value; |
214 | 214 | $value = ''; |
215 | 215 | } |
216 | - if( !glsr( Helper::class )->startsWith( 'data-', $key ))continue; |
|
217 | - if( is_array( $value )) { |
|
216 | + if( !glsr( Helper::class )->startsWith( 'data-', $key ) )continue; |
|
217 | + if( is_array( $value ) ) { |
|
218 | 218 | $value = json_encode( $value, JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES ); |
219 | 219 | } |
220 | 220 | $this->attributes[$key] = $value; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | protected function normalizeStringAttributes() |
228 | 228 | { |
229 | 229 | foreach( $this->attributes as $key => $value ) { |
230 | - if( !is_string( $value ))continue; |
|
230 | + if( !is_string( $value ) )continue; |
|
231 | 231 | $this->attributes[$key] = trim( $value ); |
232 | 232 | } |
233 | 233 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | { |
241 | 241 | if( $method != 'input' )return; |
242 | 242 | $attributes = wp_parse_args( $this->attributes, ['type' => ''] ); |
243 | - if( !in_array( $attributes['type'], static::INPUT_TYPES )) { |
|
243 | + if( !in_array( $attributes['type'], static::INPUT_TYPES ) ) { |
|
244 | 244 | $this->attributes['type'] = 'text'; |
245 | 245 | } |
246 | 246 | } |
@@ -254,11 +254,11 @@ discard block |
||
254 | 254 | $permanentAttributes = $this->getPermanentAttributes(); |
255 | 255 | foreach( $this->attributes as $key => $value ) { |
256 | 256 | if( in_array( $key, static::BOOLEAN_ATTRIBUTES ) && !$value ) { |
257 | - unset( $attributes[$key] ); |
|
257 | + unset($attributes[$key]); |
|
258 | 258 | } |
259 | - if( glsr( Helper::class )->startsWith( 'data-', $key )) { |
|
259 | + if( glsr( Helper::class )->startsWith( 'data-', $key ) ) { |
|
260 | 260 | $permanentAttributes[$key] = $value; |
261 | - unset( $attributes[$key] ); |
|
261 | + unset($attributes[$key]); |
|
262 | 262 | } |
263 | 263 | } |
264 | 264 | $this->attributes = array_merge( array_filter( $attributes ), $permanentAttributes ); |