@@ -11,7 +11,9 @@ |
||
11 | 11 | */ |
12 | 12 | public function handle( Command $command ) |
13 | 13 | { |
14 | - if( in_array( $command->postType, get_post_types( ['_builtin' => true] )))return; |
|
14 | + if( in_array( $command->postType, get_post_types( ['_builtin' => true] ))) { |
|
15 | + return; |
|
16 | + } |
|
15 | 17 | register_post_type( $command->postType, $command->args ); |
16 | 18 | glsr()->postTypeColumns = wp_parse_args( glsr()->postTypeColumns, [ |
17 | 19 | $command->postType => $command->columns, |
@@ -11,10 +11,10 @@ |
||
11 | 11 | */ |
12 | 12 | public function handle( Command $command ) |
13 | 13 | { |
14 | - if( in_array( $command->postType, get_post_types( ['_builtin' => true] )))return; |
|
14 | + if( in_array( $command->postType, get_post_types( ['_builtin' => true] ) ) )return; |
|
15 | 15 | register_post_type( $command->postType, $command->args ); |
16 | 16 | glsr()->postTypeColumns = wp_parse_args( glsr()->postTypeColumns, [ |
17 | 17 | $command->postType => $command->columns, |
18 | - ]); |
|
18 | + ] ); |
|
19 | 19 | } |
20 | 20 | } |
@@ -19,7 +19,9 @@ |
||
19 | 19 | */ |
20 | 20 | public function registerPostType() |
21 | 21 | { |
22 | - if( !glsr()->hasPermission() )return; |
|
22 | + if( !glsr()->hasPermission() ) { |
|
23 | + return; |
|
24 | + } |
|
23 | 25 | $command = new RegisterPostType([ |
24 | 26 | 'capabilities'=> ['create_posts' => 'create_'.Application::POST_TYPE], |
25 | 27 | 'columns' => [ |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | public function registerPostType() |
20 | 20 | { |
21 | 21 | if( !glsr()->hasPermission() )return; |
22 | - $command = new RegisterPostType([ |
|
22 | + $command = new RegisterPostType( [ |
|
23 | 23 | 'capabilities'=> ['create_posts' => 'create_'.Application::POST_TYPE], |
24 | 24 | 'columns' => [ |
25 | 25 | 'title' => '', |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'plural' => __( 'Reviews', 'site-reviews' ), |
38 | 38 | 'post_type' => Application::POST_TYPE, |
39 | 39 | 'single' => __( 'Review', 'site-reviews' ), |
40 | - ]); |
|
40 | + ] ); |
|
41 | 41 | $this->execute( $command ); |
42 | 42 | } |
43 | 43 | |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function registerShortcodes() |
49 | 49 | { |
50 | - $command = new RegisterShortcodes([ |
|
50 | + $command = new RegisterShortcodes( [ |
|
51 | 51 | 'site_reviews', |
52 | 52 | 'site_reviews_form', |
53 | 53 | 'site_reviews_summary', |
54 | - ]); |
|
54 | + ] ); |
|
55 | 55 | $this->execute( $command ); |
56 | 56 | } |
57 | 57 | |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function registerTaxonomy() |
63 | 63 | { |
64 | - $command = new RegisterTaxonomy([ |
|
64 | + $command = new RegisterTaxonomy( [ |
|
65 | 65 | 'hierarchical' => true, |
66 | 66 | 'meta_box_cb' => [glsr( EditorController::class ), 'renderTaxonomyMetabox'], |
67 | 67 | 'public' => false, |
68 | 68 | 'show_admin_column' => true, |
69 | 69 | 'show_ui' => true, |
70 | - ]); |
|
70 | + ] ); |
|
71 | 71 | $this->execute( $command ); |
72 | 72 | } |
73 | 73 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function registerWidgets() |
79 | 79 | { |
80 | - $command = new RegisterWidgets([ |
|
80 | + $command = new RegisterWidgets( [ |
|
81 | 81 | 'site-reviews' => [ |
82 | 82 | 'class' => 'glsr-widget glsr-widget-site-reviews', |
83 | 83 | 'description' => __( 'Your site’s most recent reviews.', 'site-reviews' ), |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | 'description' => __( 'A summary of your site’s reviews.', 'site-reviews' ), |
94 | 94 | 'title' => __( 'Summary of Reviews', 'site-reviews' ), |
95 | 95 | ], |
96 | - ]); |
|
96 | + ] ); |
|
97 | 97 | $this->execute( $command ); |
98 | 98 | } |
99 | 99 | } |
@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | { |
21 | 21 | global $menu, $typenow; |
22 | 22 | foreach( $menu as $key => $value ) { |
23 | - if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
23 | + if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE ) { |
|
24 | + continue; |
|
25 | + } |
|
24 | 26 | $postCount = wp_count_posts( Application::POST_TYPE ); |
25 | 27 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ |
26 | 28 | 'class' => 'pending-count', |
@@ -52,7 +54,9 @@ discard block |
||
52 | 54 | foreach( $pages as $slug => $title ) { |
53 | 55 | $method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' ); |
54 | 56 | $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug ); |
55 | - if( !is_callable( $callback ))continue; |
|
57 | + if( !is_callable( $callback )) { |
|
58 | + continue; |
|
59 | + } |
|
56 | 60 | add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, Application::CAPABILITY, $slug, $callback ); |
57 | 61 | } |
58 | 62 | } |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | { |
23 | 23 | global $menu, $typenow; |
24 | 24 | foreach( $menu as $key => $value ) { |
25 | - if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
25 | + if( !isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
26 | 26 | $postCount = wp_count_posts( Application::POST_TYPE ); |
27 | 27 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ |
28 | 28 | 'class' => 'pending-count', |
29 | - ]); |
|
29 | + ] ); |
|
30 | 30 | $awaitingModeration = glsr( Builder::class )->span( $pendingCount, [ |
31 | 31 | 'class' => 'awaiting-mod count-'.$postCount->pending, |
32 | - ]); |
|
32 | + ] ); |
|
33 | 33 | $menu[$key][0] .= ' '.$awaitingModeration; |
34 | 34 | if( $typenow === Application::POST_TYPE ) { |
35 | - $menu[$key][4].= ' current'; |
|
35 | + $menu[$key][4] .= ' current'; |
|
36 | 36 | } |
37 | 37 | break; |
38 | 38 | } |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | 'tools' => __( 'Tools', 'site-reviews' ), |
50 | 50 | 'addons' => __( 'Addons', 'site-reviews' ), |
51 | 51 | 'documentation' => __( 'Documentation', 'site-reviews' ), |
52 | - ]); |
|
52 | + ] ); |
|
53 | 53 | foreach( $pages as $slug => $title ) { |
54 | 54 | $method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' ); |
55 | 55 | $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug ); |
56 | - if( !is_callable( $callback ))continue; |
|
56 | + if( !is_callable( $callback ) )continue; |
|
57 | 57 | add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, Application::CAPABILITY, $slug, $callback ); |
58 | 58 | } |
59 | 59 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | { |
68 | 68 | $this->renderPage( 'addons', [ |
69 | 69 | 'template' => glsr( Template::class ), |
70 | - ]); |
|
70 | + ] ); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | 'shortcodes' => __( 'Shortcodes', 'site-reviews' ), |
84 | 84 | 'hooks' => __( 'Hooks', 'site-reviews' ), |
85 | 85 | 'functions' => __( 'Functions', 'site-reviews' ), |
86 | - ]); |
|
86 | + ] ); |
|
87 | 87 | $this->renderPage( 'documentation', [ |
88 | 88 | 'tabs' => $tabs, |
89 | - ]); |
|
89 | + ] ); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -104,18 +104,18 @@ discard block |
||
104 | 104 | 'translations' => __( 'Translations', 'site-reviews' ), |
105 | 105 | 'addons' => __( 'Addons', 'site-reviews' ), |
106 | 106 | 'licenses' => __( 'Licenses', 'site-reviews' ), |
107 | - ]); |
|
108 | - if( empty( glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults ))) { |
|
109 | - unset( $tabs['addons'] ); |
|
107 | + ] ); |
|
108 | + if( empty(glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults )) ) { |
|
109 | + unset($tabs['addons']); |
|
110 | 110 | } |
111 | - if( empty( glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults ))) { |
|
112 | - unset( $tabs['licenses'] ); |
|
111 | + if( empty(glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults )) ) { |
|
112 | + unset($tabs['licenses']); |
|
113 | 113 | } |
114 | 114 | $this->renderPage( 'settings', [ |
115 | 115 | 'notices' => $this->getNotices(), |
116 | 116 | 'settings' => glsr( Settings::class ), |
117 | 117 | 'tabs' => $tabs, |
118 | - ]); |
|
118 | + ] ); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -130,23 +130,23 @@ discard block |
||
130 | 130 | 'sync' => __( 'Sync Reviews', 'site-reviews' ), |
131 | 131 | 'console' => __( 'Console', 'site-reviews' ), |
132 | 132 | 'system-info' => __( 'System Info', 'site-reviews' ), |
133 | - ]); |
|
134 | - if( !apply_filters( 'site-reviews/addon/sync/enable', false )) { |
|
135 | - unset( $tabs['sync'] ); |
|
133 | + ] ); |
|
134 | + if( !apply_filters( 'site-reviews/addon/sync/enable', false ) ) { |
|
135 | + unset($tabs['sync']); |
|
136 | 136 | } |
137 | 137 | $this->renderPage( 'tools', [ |
138 | 138 | 'data' => [ |
139 | 139 | 'context' => [ |
140 | - 'console' => strval( glsr( Console::class )), |
|
140 | + 'console' => strval( glsr( Console::class ) ), |
|
141 | 141 | 'id' => Application::ID, |
142 | - 'system' => strval( glsr( System::class )), |
|
142 | + 'system' => strval( glsr( System::class ) ), |
|
143 | 143 | ], |
144 | 144 | 'sites' => apply_filters( 'site-reviews/addon/sync/sites', [] ), |
145 | 145 | ], |
146 | 146 | 'notices' => $this->getNotices(), |
147 | 147 | 'tabs' => $tabs, |
148 | 148 | 'template' => glsr( Template::class ), |
149 | - ]); |
|
149 | + ] ); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | { |
168 | 168 | return glsr( Builder::class )->div( glsr( Notice::class )->get(), [ |
169 | 169 | 'id' => 'glsr-notices', |
170 | - ]); |
|
170 | + ] ); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -166,7 +166,9 @@ |
||
166 | 166 | { |
167 | 167 | $result = []; |
168 | 168 | foreach( $array as $key => $value ) { |
169 | - if( !$value )continue; |
|
169 | + if( !$value ) { |
|
170 | + continue; |
|
171 | + } |
|
170 | 172 | $result[$key] = is_array( $value ) |
171 | 173 | ? $this->removeEmptyArrayValues( $value ) |
172 | 174 | : $value; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | { |
17 | 17 | $className = $this->camelCase( $name ); |
18 | 18 | $path = ltrim( str_replace( __NAMESPACE__, '', $path ), '\\' ); |
19 | - return !empty( $path ) |
|
19 | + return !empty($path) |
|
20 | 20 | ? __NAMESPACE__.'\\'.$path.'\\'.$className |
21 | 21 | : $className; |
22 | 22 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function buildMethodName( $name, $prefix = '' ) |
30 | 30 | { |
31 | - return lcfirst( $prefix.$this->buildClassName( $name )); |
|
31 | + return lcfirst( $prefix.$this->buildClassName( $name ) ); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function buildPropertyName( $name ) |
39 | 39 | { |
40 | - return lcfirst( $this->buildClassName( $name )); |
|
40 | + return lcfirst( $this->buildClassName( $name ) ); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function camelCase( $string ) |
48 | 48 | { |
49 | - $string = ucwords( str_replace( ['-', '_'], ' ', trim( $string ))); |
|
49 | + $string = ucwords( str_replace( ['-', '_'], ' ', trim( $string ) ) ); |
|
50 | 50 | return str_replace( ' ', '', $string ); |
51 | 51 | } |
52 | 52 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function convertPathToId( $path, $prefix = '' ) |
80 | 80 | { |
81 | - return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix )); |
|
81 | + return str_replace( ['[', ']'], ['-', ''], $this->convertPathToName( $path, $prefix ) ); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | { |
90 | 90 | $levels = explode( '.', $path ); |
91 | 91 | return array_reduce( $levels, function( $result, $value ) { |
92 | - return $result.= '['.$value.']'; |
|
92 | + return $result .= '['.$value.']'; |
|
93 | 93 | }, $prefix ); |
94 | 94 | } |
95 | 95 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function convertStringToArray( $string, $callback = null ) |
102 | 102 | { |
103 | - $array = array_map( 'trim', explode( ',', $string )); |
|
103 | + $array = array_map( 'trim', explode( ',', $string ) ); |
|
104 | 104 | return $callback |
105 | 105 | ? array_filter( $array, $callback ) |
106 | 106 | : array_filter( $array ); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function dashCase( $string ) |
114 | 114 | { |
115 | - return str_replace( '_', '-', $this->snakeCase( $string )); |
|
115 | + return str_replace( '_', '-', $this->snakeCase( $string ) ); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -134,11 +134,11 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function filterInput( $key, array $request = [] ) |
136 | 136 | { |
137 | - if( isset( $request[$key] )) { |
|
137 | + if( isset($request[$key]) ) { |
|
138 | 138 | return $request[$key]; |
139 | 139 | } |
140 | 140 | $variable = filter_input( INPUT_POST, $key ); |
141 | - if( is_null( $variable ) && isset( $_POST[$key] )) { |
|
141 | + if( is_null( $variable ) && isset($_POST[$key]) ) { |
|
142 | 142 | $variable = $_POST[$key]; |
143 | 143 | } |
144 | 144 | return $variable; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | public function filterInputArray( $key ) |
152 | 152 | { |
153 | 153 | $variable = filter_input( INPUT_POST, $key, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); |
154 | - if( empty( $variable ) && !empty( $_POST[$key] ) && is_array( $_POST[$key] )) { |
|
154 | + if( empty($variable) && !empty($_POST[$key]) && is_array( $_POST[$key] ) ) { |
|
155 | 155 | $variable = $_POST[$key]; |
156 | 156 | } |
157 | 157 | return (array)$variable; |
@@ -167,13 +167,13 @@ discard block |
||
167 | 167 | $result = []; |
168 | 168 | foreach( $array as $key => $value ) { |
169 | 169 | $newKey = ltrim( $prefix.'.'.$key, '.' ); |
170 | - if( $this->isIndexedFlatArray( $value )) { |
|
170 | + if( $this->isIndexedFlatArray( $value ) ) { |
|
171 | 171 | if( $flattenValue ) { |
172 | 172 | $value = '['.implode( ', ', $value ).']'; |
173 | 173 | } |
174 | 174 | } |
175 | - else if( is_array( $value )) { |
|
176 | - $result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey )); |
|
175 | + else if( is_array( $value ) ) { |
|
176 | + $result = array_merge( $result, $this->flattenArray( $value, $flattenValue, $newKey ) ); |
|
177 | 177 | continue; |
178 | 178 | } |
179 | 179 | $result[$newKey] = $value; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | Whip::IPV4 => $cloudflareIps['v4'], |
193 | 193 | Whip::IPV6 => $cloudflareIps['v6'], |
194 | 194 | ], |
195 | - ]))->getValidIpAddress(); |
|
195 | + ] ))->getValidIpAddress(); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | { |
206 | 206 | $keys = explode( '.', $path ); |
207 | 207 | foreach( $keys as $key ) { |
208 | - if( !isset( $values[$key] )) { |
|
208 | + if( !isset($values[$key]) ) { |
|
209 | 209 | return $fallback; |
210 | 210 | } |
211 | 211 | $values = $values[$key]; |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public function isIndexedArray( $array ) |
221 | 221 | { |
222 | - if( !is_array( $array )) { |
|
222 | + if( !is_array( $array ) ) { |
|
223 | 223 | return false; |
224 | 224 | } |
225 | 225 | $current = 0; |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public function isIndexedFlatArray( $array ) |
240 | 240 | { |
241 | - if( !is_array( $array ) || array_filter( $array, 'is_array' )) { |
|
241 | + if( !is_array( $array ) || array_filter( $array, 'is_array' ) ) { |
|
242 | 242 | return false; |
243 | 243 | } |
244 | 244 | return $this->isIndexedArray( $array ); |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | */ |
252 | 252 | public function prefixString( $string, $prefix = '' ) |
253 | 253 | { |
254 | - return $prefix.str_replace( $prefix, '', trim( $string )); |
|
254 | + return $prefix.str_replace( $prefix, '', trim( $string ) ); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | */ |
297 | 297 | public function snakeCase( $string ) |
298 | 298 | { |
299 | - if( !ctype_lower( $string )) { |
|
299 | + if( !ctype_lower( $string ) ) { |
|
300 | 300 | $string = preg_replace( '/\s+/u', '', $string ); |
301 | 301 | $string = preg_replace( '/(.)(?=[A-Z])/u', '$1_', $string ); |
302 | 302 | $string = mb_strtolower( $string, 'UTF-8' ); |
@@ -311,6 +311,6 @@ discard block |
||
311 | 311 | */ |
312 | 312 | public function startsWith( $needle, $haystack ) |
313 | 313 | { |
314 | - return substr( $haystack, 0, strlen( $needle )) === $needle; |
|
314 | + return substr( $haystack, 0, strlen( $needle ) ) === $needle; |
|
315 | 315 | } |
316 | 316 | } |
@@ -113,7 +113,7 @@ |
||
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
116 | - * Bind a singleton instance to the container |
|
116 | + * Bind a singleton instance to the container |
|
117 | 117 | * @param string $alias |
118 | 118 | * @param callable|string|null $binding |
119 | 119 | * @return void |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public static function load() |
39 | 39 | { |
40 | - if( empty( static::$instance )) { |
|
40 | + if( empty(static::$instance) ) { |
|
41 | 41 | static::$instance = new static; |
42 | 42 | } |
43 | 43 | return static::$instance; |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function __get( $property ) |
51 | 51 | { |
52 | - if( property_exists( $this, $property ) && !in_array( $property, static::PROTECTED_PROPERTIES )) { |
|
52 | + if( property_exists( $this, $property ) && !in_array( $property, static::PROTECTED_PROPERTIES ) ) { |
|
53 | 53 | return $this->$property; |
54 | 54 | } |
55 | - $constant = 'static::'.strtoupper( $this->make( Helper::class )->snakeCase( $property )); |
|
56 | - if( defined( $constant )) { |
|
55 | + $constant = 'static::'.strtoupper( $this->make( Helper::class )->snakeCase( $property ) ); |
|
56 | + if( defined( $constant ) ) { |
|
57 | 57 | return constant( $constant ); |
58 | 58 | } |
59 | - return isset( $this->storage[$property] ) |
|
59 | + return isset($this->storage[$property]) |
|
60 | 60 | ? $this->storage[$property] |
61 | 61 | : null; |
62 | 62 | } |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function __set( $property, $value ) |
70 | 70 | { |
71 | - if( !property_exists( $this, $property ) || in_array( $property, static::PROTECTED_PROPERTIES )) { |
|
71 | + if( !property_exists( $this, $property ) || in_array( $property, static::PROTECTED_PROPERTIES ) ) { |
|
72 | 72 | $this->storage[$property] = $value; |
73 | 73 | } |
74 | - else if( !isset( $this->$property )) { |
|
74 | + else if( !isset($this->$property) ) { |
|
75 | 75 | $this->$property = $value; |
76 | 76 | } |
77 | 77 | else { |
78 | - throw new Exception( sprintf( 'The "%s" property cannot be changed once set.', $property )); |
|
78 | + throw new Exception( sprintf( 'The "%s" property cannot be changed once set.', $property ) ); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
@@ -97,16 +97,16 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function make( $abstract ) |
99 | 99 | { |
100 | - if( !isset( $this->services[$abstract] )) { |
|
100 | + if( !isset($this->services[$abstract]) ) { |
|
101 | 101 | $abstract = $this->addNamespace( $abstract ); |
102 | 102 | } |
103 | - if( isset( $this->services[$abstract] )) { |
|
103 | + if( isset($this->services[$abstract]) ) { |
|
104 | 104 | $abstract = $this->services[$abstract]; |
105 | 105 | } |
106 | - if( is_callable( $abstract )) { |
|
106 | + if( is_callable( $abstract ) ) { |
|
107 | 107 | return call_user_func_array( $abstract, [$this] ); |
108 | 108 | } |
109 | - if( is_object( $abstract )) { |
|
109 | + if( is_object( $abstract ) ) { |
|
110 | 110 | return $abstract; |
111 | 111 | } |
112 | 112 | return $this->resolve( $abstract ); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function singleton( $alias, $binding ) |
122 | 122 | { |
123 | - $this->bind( $alias, $this->make( $binding )); |
|
123 | + $this->bind( $alias, $this->make( $binding ) ); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | protected function addNamespace( $abstract ) |
132 | 132 | { |
133 | - if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract )) { |
|
133 | + if( strpos( $abstract, __NAMESPACE__ ) === false && !class_exists( $abstract ) ) { |
|
134 | 134 | $abstract = __NAMESPACE__.'\\'.$abstract; |
135 | 135 | } |
136 | 136 | return $abstract; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | throw new Exception( 'Target ['.$concrete.'] is not instantiable.' ); |
153 | 153 | } |
154 | 154 | $constructor = $reflector->getConstructor(); |
155 | - if( empty( $constructor )) { |
|
155 | + if( empty($constructor) ) { |
|
156 | 156 | return new $concrete; |
157 | 157 | } |
158 | 158 | return $reflector->newInstanceArgs( |
@@ -76,7 +76,9 @@ discard block |
||
76 | 76 | $args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args )); |
77 | 77 | array_walk( $args, function( &$value, $key ) { |
78 | 78 | $methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' ); |
79 | - if( !method_exists( $this, $methodName ))return; |
|
79 | + if( !method_exists( $this, $methodName )) { |
|
80 | + return; |
|
81 | + } |
|
80 | 82 | $value = $this->$methodName( $value ); |
81 | 83 | }); |
82 | 84 | return $this->sanitize( $args ); |
@@ -141,7 +143,9 @@ discard block |
||
141 | 143 | $defaults = array_pad( $defaults, Rating::MAX_RATING, '' ); |
142 | 144 | $labels = array_map( 'trim', explode( ',', $labels )); |
143 | 145 | foreach( $defaults as $i => $label ) { |
144 | - if( empty( $labels[$i] ))continue; |
|
146 | + if( empty( $labels[$i] )) { |
|
147 | + continue; |
|
148 | + } |
|
145 | 149 | $defaults[$i] = $labels[$i]; |
146 | 150 | } |
147 | 151 | return array_combine( range( Rating::MAX_RATING, 1 ), $defaults ); |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | 'after_widget' => '</div>', |
23 | 23 | 'before_title' => '<h3 class="glsr-shortcode-title">', |
24 | 24 | 'after_title' => '</h3>', |
25 | - ]); |
|
25 | + ] ); |
|
26 | 26 | $instance = $this->normalize( $instance ); |
27 | 27 | $partial = glsr( Partial::class )->build( $shortcodePartial, $instance ); |
28 | - if( !empty( $instance['title'] )) { |
|
28 | + if( !empty($instance['title']) ) { |
|
29 | 29 | $instance['title'] = $args['before_title'].$instance['title'].$args['after_title']; |
30 | 30 | } |
31 | 31 | return $args['before_widget'].$instance['title'].$partial.$args['after_widget']; |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function normalize( $args ) |
70 | 70 | { |
71 | - $args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args )); |
|
71 | + $args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args ) ); |
|
72 | 72 | array_walk( $args, function( &$value, $key ) { |
73 | 73 | $methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' ); |
74 | - if( !method_exists( $this, $methodName ))return; |
|
74 | + if( !method_exists( $this, $methodName ) )return; |
|
75 | 75 | $value = $this->$methodName( $value ); |
76 | 76 | }); |
77 | 77 | return $this->sanitize( $args ); |
@@ -103,13 +103,13 @@ discard block |
||
103 | 103 | */ |
104 | 104 | protected function normalizeHide( $hide ) |
105 | 105 | { |
106 | - if( is_string( $hide )) { |
|
106 | + if( is_string( $hide ) ) { |
|
107 | 107 | $hide = explode( ',', $hide ); |
108 | 108 | } |
109 | 109 | $hiddenKeys = defined( 'static::HIDDEN_KEYS' ) |
110 | 110 | ? static::HIDDEN_KEYS |
111 | 111 | : []; |
112 | - return array_filter( array_map( 'trim', $hide ), function( $value ) use( $hiddenKeys ) { |
|
112 | + return array_filter( array_map( 'trim', $hide ), function( $value ) use($hiddenKeys) { |
|
113 | 113 | return in_array( $value, $hiddenKeys ); |
114 | 114 | }); |
115 | 115 | } |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | __( 'Terrible', 'site-reviews' ), |
138 | 138 | ]; |
139 | 139 | $defaults = array_pad( $defaults, Rating::MAX_RATING, '' ); |
140 | - $labels = array_map( 'trim', explode( ',', $labels )); |
|
140 | + $labels = array_map( 'trim', explode( ',', $labels ) ); |
|
141 | 141 | foreach( $defaults as $i => $label ) { |
142 | - if( empty( $labels[$i] ))continue; |
|
142 | + if( empty($labels[$i]) )continue; |
|
143 | 143 | $defaults[$i] = $labels[$i]; |
144 | 144 | } |
145 | 145 | return array_combine( range( Rating::MAX_RATING, 1 ), $defaults ); |
@@ -29,7 +29,9 @@ |
||
29 | 29 | { |
30 | 30 | foreach( $args as $key => $value ) { |
31 | 31 | $property = glsr( Helper::class )->buildPropertyName( $key ); |
32 | - if( !property_exists( $this, $property ))continue; |
|
32 | + if( !property_exists( $this, $property )) { |
|
33 | + continue; |
|
34 | + } |
|
33 | 35 | $this->$property = $value; |
34 | 36 | unset( $args[$key] ); |
35 | 37 | } |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | { |
31 | 31 | foreach( $args as $key => $value ) { |
32 | 32 | $property = glsr( Helper::class )->buildPropertyName( $key ); |
33 | - if( !property_exists( $this, $property ))continue; |
|
33 | + if( !property_exists( $this, $property ) )continue; |
|
34 | 34 | $this->$property = $value; |
35 | - unset( $args[$key] ); |
|
35 | + unset($args[$key]); |
|
36 | 36 | } |
37 | 37 | $this->args = wp_parse_args( $args, [ |
38 | 38 | 'menu_name' => $this->plural, |
39 | - ]); |
|
39 | + ] ); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | 'singular_name' => $this->single, |
60 | 60 | 'uploaded_to_this_item' => sprintf( _x( 'Uploaded to this %s', 'Uploaded to this Post', 'site-reviews' ), $this->single ), |
61 | 61 | 'view_item' => sprintf( _x( 'View %s', 'View Post', 'site-reviews' ), $this->single ), |
62 | - ]); |
|
63 | - unset( $this->args['menu_name'] ); |
|
62 | + ] ); |
|
63 | + unset($this->args['menu_name']); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | protected function normalizeColumns() |
70 | 70 | { |
71 | 71 | $this->columns = ['cb' => ''] + $this->columns; |
72 | - if( array_key_exists( 'category', $this->columns )) { |
|
72 | + if( array_key_exists( 'category', $this->columns ) ) { |
|
73 | 73 | $keys = array_keys( $this->columns ); |
74 | 74 | $keys[array_search( 'category', $keys )] = 'taxonomy-'.Application::TAXONOMY; |
75 | 75 | $this->columns = array_combine( $keys, $this->columns ); |
76 | 76 | } |
77 | - if( array_key_exists( 'pinned', $this->columns )) { |
|
77 | + if( array_key_exists( 'pinned', $this->columns ) ) { |
|
78 | 78 | $this->columns['pinned'] = glsr( Builder::class )->span( '<span>'.$this->columns['pinned'].'</span>', |
79 | 79 | ['class' => 'pinned-icon'] |
80 | 80 | ); |
@@ -15,7 +15,9 @@ discard block |
||
15 | 15 | */ |
16 | 16 | public function add( $type, $message, array $args = [] ) |
17 | 17 | { |
18 | - if( empty( array_filter( [$message, $type] )))return; |
|
18 | + if( empty( array_filter( [$message, $type] ))) { |
|
19 | + return; |
|
20 | + } |
|
19 | 21 | $args['message'] = $message; |
20 | 22 | $args['type'] = $type; |
21 | 23 | add_settings_error( Application::ID, '', json_encode( $this->normalize( $args ))); |
@@ -56,7 +58,9 @@ discard block |
||
56 | 58 | $notices = array_map( 'unserialize', |
57 | 59 | array_unique( array_map( 'serialize', get_settings_errors( Application::ID ))) |
58 | 60 | ); |
59 | - if( empty( $notices ))return; |
|
61 | + if( empty( $notices )) { |
|
62 | + return; |
|
63 | + } |
|
60 | 64 | return array_reduce( $notices, function( $carry, $notice ) { |
61 | 65 | return $carry.$this->buildNotice( json_decode( $notice['message'], true )); |
62 | 66 | }); |
@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | */ |
16 | 16 | public function add( $type, $message, array $args = [] ) |
17 | 17 | { |
18 | - if( empty( array_filter( [$message, $type] )))return; |
|
18 | + if( empty(array_filter( [$message, $type] )) )return; |
|
19 | 19 | $args['message'] = $message; |
20 | 20 | $args['type'] = $type; |
21 | - add_settings_error( Application::ID, '', json_encode( $this->normalize( $args ))); |
|
21 | + add_settings_error( Application::ID, '', json_encode( $this->normalize( $args ) ) ); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | public function get() |
55 | 55 | { |
56 | 56 | $notices = array_map( 'unserialize', |
57 | - array_unique( array_map( 'serialize', get_settings_errors( Application::ID ))) |
|
57 | + array_unique( array_map( 'serialize', get_settings_errors( Application::ID ) ) ) |
|
58 | 58 | ); |
59 | - if( empty( $notices ))return; |
|
59 | + if( empty($notices) )return; |
|
60 | 60 | return array_reduce( $notices, function( $carry, $notice ) { |
61 | - return $carry.$this->buildNotice( json_decode( $notice['message'], true )); |
|
61 | + return $carry.$this->buildNotice( json_decode( $notice['message'], true ) ); |
|
62 | 62 | }); |
63 | 63 | } |
64 | 64 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } |
80 | 80 | return glsr( Builder::class )->div( $messages, [ |
81 | 81 | 'class' => $class, |
82 | - ]); |
|
82 | + ] ); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | 'type' => '', |
95 | 95 | ]; |
96 | 96 | $args = shortcode_atts( $defaults, $args ); |
97 | - if( !in_array( $args['type'], ['error', 'warning', 'success'] )) { |
|
97 | + if( !in_array( $args['type'], ['error', 'warning', 'success'] ) ) { |
|
98 | 98 | $args['type'] = 'success'; |
99 | 99 | } |
100 | 100 | $args['messages'] = is_wp_error( $args['message'] ) |
101 | 101 | ? (array)$args['message']->get_error_message() |
102 | 102 | : (array)$args['message']; |
103 | - unset( $args['message'] ); |
|
103 | + unset($args['message']); |
|
104 | 104 | return $args; |
105 | 105 | } |
106 | 106 | } |
@@ -30,7 +30,9 @@ discard block |
||
30 | 30 | // 'is_test' => 1, |
31 | 31 | ]; |
32 | 32 | foreach( $_SERVER as $key => $value ) { |
33 | - if( is_array( $value ) || in_array( $key, ['HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'] ))continue; |
|
33 | + if( is_array( $value ) || in_array( $key, ['HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'] )) { |
|
34 | + continue; |
|
35 | + } |
|
34 | 36 | $submission[$key] = $value; |
35 | 37 | } |
36 | 38 | return $this->check( apply_filters( 'site-reviews/akismet/submission', $submission, $review )); |
@@ -56,12 +58,16 @@ discard block |
||
56 | 58 | { |
57 | 59 | $query = []; |
58 | 60 | foreach( $data as $key => $value ) { |
59 | - if( is_array( $value ) || is_object( $value ))continue; |
|
61 | + if( is_array( $value ) || is_object( $value )) { |
|
62 | + continue; |
|
63 | + } |
|
60 | 64 | if( $value === false ) { |
61 | 65 | $value = '0'; |
62 | 66 | } |
63 | 67 | $value = trim( $value ); |
64 | - if( !strlen( $value ))continue; |
|
68 | + if( !strlen( $value )) { |
|
69 | + continue; |
|
70 | + } |
|
65 | 71 | $query[] = urlencode( $key ).'='.urlencode( $value ); |
66 | 72 | } |
67 | 73 | return implode( '&', $query ); |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | // 'is_test' => 1, |
32 | 32 | ]; |
33 | 33 | foreach( $_SERVER as $key => $value ) { |
34 | - if( is_array( $value ) || in_array( $key, ['HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'] ))continue; |
|
34 | + if( is_array( $value ) || in_array( $key, ['HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'] ) )continue; |
|
35 | 35 | $submission[$key] = $value; |
36 | 36 | } |
37 | - return $this->check( apply_filters( 'site-reviews/akismet/submission', $submission, $review )); |
|
37 | + return $this->check( apply_filters( 'site-reviews/akismet/submission', $submission, $review ) ); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | { |
58 | 58 | $query = []; |
59 | 59 | foreach( $data as $key => $value ) { |
60 | - if( is_array( $value ) || is_object( $value ))continue; |
|
60 | + if( is_array( $value ) || is_object( $value ) )continue; |
|
61 | 61 | if( $value === false ) { |
62 | 62 | $value = '0'; |
63 | 63 | } |
64 | 64 | $value = trim( $value ); |
65 | - if( !strlen( $value ))continue; |
|
65 | + if( !strlen( $value ) )continue; |
|
66 | 66 | $query[] = urlencode( $key ).'='.urlencode( $value ); |
67 | 67 | } |
68 | 68 | return implode( '&', $query ); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | || !is_callable( ['Akismet', 'get_api_key'] ) |
78 | 78 | || !is_callable( ['Akismet', 'http_post'] ) |
79 | 79 | ? false |
80 | - : (bool) AkismetPlugin::get_api_key(); |
|
80 | + : (bool)AkismetPlugin::get_api_key(); |
|
81 | 81 | return apply_filters( 'site-reviews/akismet/is-active', $check ); |
82 | 82 | } |
83 | 83 | } |