@@ -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( |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function __call( $method, array $arguments ) |
41 | 41 | { |
42 | - $value = isset( $arguments[0] ) |
|
42 | + $value = isset($arguments[0]) |
|
43 | 43 | ? $arguments[0] |
44 | 44 | : ''; |
45 | 45 | return $this->setProperty( $method, $value ); |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | * @param mixed $default |
97 | 97 | * @return mixed |
98 | 98 | */ |
99 | - public function getProperty( $property, $default = null) |
|
99 | + public function getProperty( $property, $default = null ) |
|
100 | 100 | { |
101 | - return isset( $this->properties[$property] ) |
|
101 | + return isset($this->properties[$property]) |
|
102 | 102 | ? $this->properties[$property] |
103 | 103 | : $default; |
104 | 104 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function offsetUnset( $offset ) |
168 | 168 | { |
169 | - unset( $this->properties[$offset] ); |
|
169 | + unset($this->properties[$offset]); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -212,16 +212,16 @@ discard block |
||
212 | 212 | */ |
213 | 213 | protected function getParents( $parents = null ) |
214 | 214 | { |
215 | - if( !isset( $parents )) { |
|
215 | + if( !isset($parents) ) { |
|
216 | 216 | $parents = $this->parents; |
217 | 217 | } |
218 | 218 | $newParents = $parents; |
219 | 219 | foreach( $parents as $parent ) { |
220 | 220 | $parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ ); |
221 | - if( !class_exists( $parentClass ))continue; |
|
222 | - $newParents = array_merge( $newParents, $this->getParents( (new $parentClass)->parents )); |
|
221 | + if( !class_exists( $parentClass ) )continue; |
|
222 | + $newParents = array_merge( $newParents, $this->getParents( (new $parentClass)->parents ) ); |
|
223 | 223 | } |
224 | - return array_values( array_unique( $newParents )); |
|
224 | + return array_values( array_unique( $newParents ) ); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | $parents = $this->getParents(); |
233 | 233 | foreach( $parents as $parent ) { |
234 | 234 | $parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ ); |
235 | - if( !class_exists( $parentClass ))continue; |
|
236 | - $this->allowed = array_values( array_unique( array_merge( (new $parentClass)->allowed, $this->allowed ))); |
|
235 | + if( !class_exists( $parentClass ) )continue; |
|
236 | + $this->allowed = array_values( array_unique( array_merge( (new $parentClass)->allowed, $this->allowed ) ) ); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | |
@@ -243,17 +243,17 @@ discard block |
||
243 | 243 | */ |
244 | 244 | protected function serializeProperty( $property ) |
245 | 245 | { |
246 | - if( is_array( $property )) { |
|
246 | + if( is_array( $property ) ) { |
|
247 | 247 | return array_map( [$this, 'serializeProperty'], $property ); |
248 | 248 | } |
249 | 249 | if( $property instanceof Type ) { |
250 | 250 | $property = $property->toArray(); |
251 | - unset( $property['@context'] ); |
|
251 | + unset($property['@context']); |
|
252 | 252 | } |
253 | 253 | if( $property instanceof DateTimeInterface ) { |
254 | 254 | $property = $property->format( DateTime::ATOM ); |
255 | 255 | } |
256 | - if( is_object( $property )) { |
|
256 | + if( is_object( $property ) ) { |
|
257 | 257 | throw new InvalidProperty(); |
258 | 258 | } |
259 | 259 | return $property; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function all() |
30 | 30 | { |
31 | - if( empty( $this->options )) { |
|
31 | + if( empty($this->options) ) { |
|
32 | 32 | $this->reset(); |
33 | 33 | } |
34 | 34 | return $this->options; |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | $options = $this->all(); |
46 | 46 | $pointer = &$options; |
47 | 47 | foreach( $keys as $key ) { |
48 | - if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue; |
|
48 | + if( !isset($pointer[$key]) || !is_array( $pointer[$key] ) )continue; |
|
49 | 49 | $pointer = &$pointer[$key]; |
50 | 50 | } |
51 | - unset( $pointer[$last] ); |
|
51 | + unset($pointer[$last]); |
|
52 | 52 | return $this->set( $options ); |
53 | 53 | } |
54 | 54 | |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | glsr( DefaultsManager::class )->defaults() |
81 | 81 | ); |
82 | 82 | array_walk( $options, function( &$value ) { |
83 | - if( !is_string( $value ))return; |
|
84 | - $value = wp_kses( $value, wp_kses_allowed_html( 'post' )); |
|
83 | + if( !is_string( $value ) )return; |
|
84 | + $value = wp_kses( $value, wp_kses_allowed_html( 'post' ) ); |
|
85 | 85 | }); |
86 | 86 | return glsr( Helper::class )->convertDotNotationArray( $options ); |
87 | 87 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | public function isRecaptchaEnabled() |
93 | 93 | { |
94 | 94 | $integration = $this->get( 'settings.submissions.recaptcha.integration' ); |
95 | - return $integration == 'all' || ( $integration == 'guest' && !is_user_logged_in() ); |
|
95 | + return $integration == 'all' || ($integration == 'guest' && !is_user_logged_in()); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | public function reset() |
102 | 102 | { |
103 | 103 | $options = get_option( static::databaseKey(), [] ); |
104 | - if( !is_array( $options ) || empty( $options )) { |
|
104 | + if( !is_array( $options ) || empty($options) ) { |
|
105 | 105 | delete_option( static::databaseKey() ); |
106 | 106 | $options = wp_parse_args( glsr()->defaults, ['settings' => []] ); |
107 | 107 | } |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function set( $pathOrOptions, $value = '' ) |
117 | 117 | { |
118 | - if( is_string( $pathOrOptions )) { |
|
118 | + if( is_string( $pathOrOptions ) ) { |
|
119 | 119 | $pathOrOptions = glsr( Helper::class )->setPathValue( $pathOrOptions, $value, $this->all() ); |
120 | 120 | } |
121 | - if( $result = update_option( static::databaseKey(), (array)$pathOrOptions )) { |
|
121 | + if( $result = update_option( static::databaseKey(), (array)$pathOrOptions ) ) { |
|
122 | 122 | $this->reset(); |
123 | 123 | } |
124 | 124 | return $result; |
@@ -21,7 +21,9 @@ |
||
21 | 21 | if( !class_exists( 'GL_Plugin_Check_v3' )) { |
22 | 22 | require_once __DIR__.'/activate.php'; |
23 | 23 | } |
24 | -if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() )return; |
|
24 | +if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() ) { |
|
25 | + return; |
|
26 | +} |
|
25 | 27 | require_once __DIR__.'/autoload.php'; |
26 | 28 | require_once __DIR__.'/compatibility.php'; |
27 | 29 | require_once __DIR__.'/deprecated.php'; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | defined( 'WPINC' ) || die; |
20 | 20 | |
21 | -if( !class_exists( 'GL_Plugin_Check_v3' )) { |
|
21 | +if( !class_exists( 'GL_Plugin_Check_v3' ) ) { |
|
22 | 22 | require_once __DIR__.'/activate.php'; |
23 | 23 | } |
24 | 24 | if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() )return; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | $app = new GeminiLabs\SiteReviews\Application; |
31 | 31 | $app->make( 'Provider' )->register( $app ); |
32 | -register_activation_hook( __FILE__, array( $app, 'activate' )); |
|
33 | -register_deactivation_hook( __FILE__, array( $app, 'deactivate' )); |
|
34 | -register_shutdown_function( array( $app, 'catchFatalError' )); |
|
32 | +register_activation_hook( __FILE__, array( $app, 'activate' ) ); |
|
33 | +register_deactivation_hook( __FILE__, array( $app, 'deactivate' ) ); |
|
34 | +register_shutdown_function( array( $app, 'catchFatalError' ) ); |
|
35 | 35 | $app->init(); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | protected function getFieldDefault( array $field ) |
37 | 37 | { |
38 | - return isset( $field['default'] ) |
|
38 | + return isset($field['default']) |
|
39 | 39 | ? $field['default'] |
40 | 40 | : ''; |
41 | 41 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | protected function getSettingFields( $path ) |
47 | 47 | { |
48 | - return array_filter( $this->settings, function( $key ) use( $path ) { |
|
48 | + return array_filter( $this->settings, function( $key ) use($path) { |
|
49 | 49 | return glsr( Helper::class )->startsWith( $path, $key ); |
50 | 50 | }, ARRAY_FILTER_USE_KEY ); |
51 | 51 | } |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | $field = wp_parse_args( $field, [ |
61 | 61 | 'is_setting' => true, |
62 | 62 | 'name' => $name, |
63 | - ]); |
|
64 | - $rows.= new Field( $this->normalize( $field )); |
|
63 | + ] ); |
|
64 | + $rows .= new Field( $this->normalize( $field ) ); |
|
65 | 65 | } |
66 | 66 | return $rows; |
67 | 67 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | protected function getTemplateData( $id ) |
74 | 74 | { |
75 | - $fields = $this->getSettingFields( $this->normalizeSettingPath( $id )); |
|
75 | + $fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) ); |
|
76 | 76 | return [ |
77 | 77 | 'context' => [ |
78 | 78 | 'rows' => $this->getSettingRows( $fields ), |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | */ |
87 | 87 | protected function getTemplateDataForAddons( $id ) |
88 | 88 | { |
89 | - $fields = $this->getSettingFields( $this->normalizeSettingPath( $id )); |
|
89 | + $fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) ); |
|
90 | 90 | $settings = glsr( Helper::class )->convertDotNotationArray( $fields ); |
91 | 91 | $settingKeys = array_keys( $settings['settings']['addons'] ); |
92 | 92 | $results = []; |
93 | 93 | foreach( $settingKeys as $key ) { |
94 | - $addonFields = array_filter( $fields, function( $path ) use( $key ) { |
|
94 | + $addonFields = array_filter( $fields, function( $path ) use($key) { |
|
95 | 95 | return glsr( Helper::class )->startsWith( 'settings.addons.'.$key, $path ); |
96 | 96 | }, ARRAY_FILTER_USE_KEY ); |
97 | 97 | $results[$key] = $this->getSettingRows( $addonFields ); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | protected function getTemplateDataForLicenses( $id ) |
110 | 110 | { |
111 | - $fields = $this->getSettingFields( $this->normalizeSettingPath( $id )); |
|
111 | + $fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) ); |
|
112 | 112 | ksort( $fields ); |
113 | 113 | return [ |
114 | 114 | 'context' => [ |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | protected function getTemplateDataForTranslations() |
124 | 124 | { |
125 | 125 | $translations = glsr( Translation::class )->renderAll(); |
126 | - $class = empty( $translations ) |
|
126 | + $class = empty($translations) |
|
127 | 127 | ? 'glsr-hidden' |
128 | 128 | : ''; |
129 | 129 | return [ |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | $path, |
147 | 147 | glsr( Helper::class )->getPathValue( $path, glsr()->defaults ) |
148 | 148 | ); |
149 | - if( is_array( $expectedValue )) { |
|
149 | + if( is_array( $expectedValue ) ) { |
|
150 | 150 | return is_array( $optionValue ) |
151 | - ? count( array_intersect( $optionValue, $expectedValue )) === 0 |
|
151 | + ? count( array_intersect( $optionValue, $expectedValue ) ) === 0 |
|
152 | 152 | : !in_array( $optionValue, $expectedValue ); |
153 | 153 | } |
154 | 154 | return $optionValue != $expectedValue; |
@@ -159,10 +159,10 @@ discard block |
||
159 | 159 | */ |
160 | 160 | protected function isMultiDependency( $path ) |
161 | 161 | { |
162 | - if( isset( $this->settings[$path] )) { |
|
162 | + if( isset($this->settings[$path]) ) { |
|
163 | 163 | $field = $this->settings[$path]; |
164 | - return ( $field['type'] == 'checkbox' && !empty( $field['options'] )) |
|
165 | - || !empty( $field['multiple'] ); |
|
164 | + return ($field['type'] == 'checkbox' && !empty($field['options'])) |
|
165 | + || !empty($field['multiple']); |
|
166 | 166 | } |
167 | 167 | return false; |
168 | 168 | } |
@@ -183,17 +183,17 @@ discard block |
||
183 | 183 | */ |
184 | 184 | protected function normalizeDependsOn( array $field ) |
185 | 185 | { |
186 | - if( !empty( $field['depends_on'] ) && is_array( $field['depends_on'] )) { |
|
186 | + if( !empty($field['depends_on']) && is_array( $field['depends_on'] ) ) { |
|
187 | 187 | $path = key( $field['depends_on'] ); |
188 | 188 | $expectedValue = $field['depends_on'][$path]; |
189 | 189 | $fieldName = glsr( Helper::class )->convertPathToName( $path, OptionManager::databaseKey() ); |
190 | - if( $this->isMultiDependency( $path )) { |
|
191 | - $fieldName.= '[]'; |
|
190 | + if( $this->isMultiDependency( $path ) ) { |
|
191 | + $fieldName .= '[]'; |
|
192 | 192 | } |
193 | - $field['data-depends'] = json_encode([ |
|
193 | + $field['data-depends'] = json_encode( [ |
|
194 | 194 | 'name' => $fieldName, |
195 | 195 | 'value' => $expectedValue, |
196 | - ], JSON_HEX_APOS|JSON_HEX_QUOT ); |
|
196 | + ], JSON_HEX_APOS | JSON_HEX_QUOT ); |
|
197 | 197 | $field['is_hidden'] = $this->isFieldHidden( $path, $expectedValue ); |
198 | 198 | } |
199 | 199 | return $field; |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | */ |
205 | 205 | protected function normalizeLabelAndLegend( array $field ) |
206 | 206 | { |
207 | - if( !empty( $field['label'] )) { |
|
207 | + if( !empty($field['label']) ) { |
|
208 | 208 | $field['legend'] = $field['label']; |
209 | - unset( $field['label'] ); |
|
209 | + unset($field['label']); |
|
210 | 210 | } |
211 | 211 | else { |
212 | 212 | $field['is_valid'] = false; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | protected function normalizeValue( array $field ) |
222 | 222 | { |
223 | - if( !isset( $field['value'] )) { |
|
223 | + if( !isset($field['value']) ) { |
|
224 | 224 | $field['value'] = glsr( OptionManager::class )->get( |
225 | 225 | $field['name'], |
226 | 226 | $this->getFieldDefault( $field ) |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function renderTaxonomyFilter() |
37 | 37 | { |
38 | - if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY ))return; |
|
38 | + if( !is_object_in_taxonomy( glsr_current_screen()->post_type, Application::TAXONOMY ) )return; |
|
39 | 39 | echo glsr( Builder::class )->label( __( 'Filter by category', 'site-reviews' ), [ |
40 | 40 | 'class' => 'screen-reader-text', |
41 | 41 | 'for' => Application::TAXONOMY, |
42 | - ]); |
|
43 | - wp_dropdown_categories([ |
|
42 | + ] ); |
|
43 | + wp_dropdown_categories( [ |
|
44 | 44 | 'depth' => 3, |
45 | 45 | 'hide_empty' => true, |
46 | 46 | 'hide_if_empty' => true, |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | 'show_option_all' => $this->getShowOptionAll(), |
53 | 53 | 'taxonomy' => Application::TAXONOMY, |
54 | 54 | 'value_field' => 'slug', |
55 | - ]); |
|
55 | + ] ); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | protected function getSelected() |
62 | 62 | { |
63 | 63 | global $wp_query; |
64 | - return isset( $wp_query->query[Application::TAXONOMY] ) |
|
64 | + return isset($wp_query->query[Application::TAXONOMY]) |
|
65 | 65 | ? $wp_query->query[Application::TAXONOMY] |
66 | 66 | : ''; |
67 | 67 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | $taxonomy = get_taxonomy( Application::TAXONOMY ); |
75 | 75 | return $taxonomy |
76 | - ? ucfirst( strtolower( $taxonomy->labels->all_items )) |
|
76 | + ? ucfirst( strtolower( $taxonomy->labels->all_items ) ) |
|
77 | 77 | : ''; |
78 | 78 | } |
79 | 79 | } |
@@ -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' => __( 'Add-ons', '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, glsr()->constant( '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 | /** |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | 'hooks' => __( 'Hooks', 'site-reviews' ), |
85 | 85 | 'functions' => __( 'Functions', 'site-reviews' ), |
86 | 86 | 'addons' => __( 'Addons', 'site-reviews' ), |
87 | - ]); |
|
87 | + ] ); |
|
88 | 88 | $addons = apply_filters( 'site-reviews/addon/documentation', [] ); |
89 | 89 | ksort( $addons ); |
90 | - if( empty( $addons )) { |
|
91 | - unset( $tabs['addons'] ); |
|
90 | + if( empty($addons) ) { |
|
91 | + unset($tabs['addons']); |
|
92 | 92 | } |
93 | 93 | $this->renderPage( 'documentation', [ |
94 | 94 | 'addons' => $addons, |
95 | 95 | 'tabs' => $tabs, |
96 | - ]); |
|
96 | + ] ); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -111,18 +111,18 @@ discard block |
||
111 | 111 | 'translations' => __( 'Translations', 'site-reviews' ), |
112 | 112 | 'addons' => __( 'Addons', 'site-reviews' ), |
113 | 113 | 'licenses' => __( 'Licenses', 'site-reviews' ), |
114 | - ]); |
|
115 | - if( empty( glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults ))) { |
|
116 | - unset( $tabs['addons'] ); |
|
114 | + ] ); |
|
115 | + if( empty(glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults )) ) { |
|
116 | + unset($tabs['addons']); |
|
117 | 117 | } |
118 | - if( empty( glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults ))) { |
|
119 | - unset( $tabs['licenses'] ); |
|
118 | + if( empty(glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults )) ) { |
|
119 | + unset($tabs['licenses']); |
|
120 | 120 | } |
121 | 121 | $this->renderPage( 'settings', [ |
122 | 122 | 'notices' => $this->getNotices(), |
123 | 123 | 'settings' => glsr( Settings::class ), |
124 | 124 | 'tabs' => $tabs, |
125 | - ]); |
|
125 | + ] ); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -137,24 +137,24 @@ discard block |
||
137 | 137 | 'sync' => __( 'Sync Reviews', 'site-reviews' ), |
138 | 138 | 'console' => __( 'Console', 'site-reviews' ), |
139 | 139 | 'system-info' => __( 'System Info', 'site-reviews' ), |
140 | - ]); |
|
141 | - if( !apply_filters( 'site-reviews/addon/sync/enable', false )) { |
|
142 | - unset( $tabs['sync'] ); |
|
140 | + ] ); |
|
141 | + if( !apply_filters( 'site-reviews/addon/sync/enable', false ) ) { |
|
142 | + unset($tabs['sync']); |
|
143 | 143 | } |
144 | 144 | $this->renderPage( 'tools', [ |
145 | 145 | 'data' => [ |
146 | 146 | 'context' => [ |
147 | 147 | 'base_url' => admin_url( 'edit.php?post_type='.Application::POST_TYPE ), |
148 | - 'console' => strval( glsr( Console::class )), |
|
148 | + 'console' => strval( glsr( Console::class ) ), |
|
149 | 149 | 'id' => Application::ID, |
150 | - 'system' => strval( glsr( System::class )), |
|
150 | + 'system' => strval( glsr( System::class ) ), |
|
151 | 151 | ], |
152 | 152 | 'services' => apply_filters( 'site-reviews/addon/sync/services', [] ), |
153 | 153 | ], |
154 | 154 | 'notices' => $this->getNotices(), |
155 | 155 | 'tabs' => $tabs, |
156 | 156 | 'template' => glsr( Template::class ), |
157 | - ]); |
|
157 | + ] ); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | { |
176 | 176 | return glsr( Builder::class )->div( glsr( Notice::class )->get(), [ |
177 | 177 | 'id' => 'glsr-notices', |
178 | - ]); |
|
178 | + ] ); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function getAssignedToPost( $postId, $assignedTo = '' ) |
22 | 22 | { |
23 | - if( empty( $assignedTo )) { |
|
23 | + if( empty($assignedTo) ) { |
|
24 | 24 | $assignedTo = get_post_meta( $postId, 'assigned_to', true ); |
25 | 25 | } |
26 | - if( empty( $assignedTo ))return; |
|
26 | + if( empty($assignedTo) )return; |
|
27 | 27 | $assignedPost = get_post( $assignedTo ); |
28 | 28 | if( $assignedPost instanceof WP_Post && $assignedPost->ID != $postId ) { |
29 | 29 | return $assignedPost; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | if( !$metaValue ) { |
45 | 45 | return $counts; |
46 | 46 | } |
47 | - return isset( $counts[$metaValue] ) |
|
47 | + return isset($counts[$metaValue]) |
|
48 | 48 | ? $counts[$metaValue] |
49 | 49 | : 0; |
50 | 50 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function getReviewsMeta( $key, $status = 'publish' ) |
67 | 67 | { |
68 | - if( $status == 'all' || empty( $status )) { |
|
68 | + if( $status == 'all' || empty($status) ) { |
|
69 | 69 | $status = get_post_stati( ['exclude_from_search' => false] ); |
70 | 70 | } |
71 | 71 | return glsr( SqlQueries::class )->getReviewsMeta( $key, $status ); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $termIds = []; |
81 | 81 | foreach( $values as $value ) { |
82 | 82 | $term = get_term_by( $field, $value, Application::TAXONOMY ); |
83 | - if( !isset( $term->term_id ))continue; |
|
83 | + if( !isset($term->term_id) )continue; |
|
84 | 84 | $termIds[] = $term->term_id; |
85 | 85 | } |
86 | 86 | return $termIds; |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | 'fields' => 'id=>name', |
97 | 97 | 'hide_empty' => false, |
98 | 98 | 'taxonomy' => Application::TAXONOMY, |
99 | - ]); |
|
99 | + ] ); |
|
100 | 100 | $terms = get_terms( $args ); |
101 | - if( is_wp_error( $terms )) { |
|
101 | + if( is_wp_error( $terms ) ) { |
|
102 | 102 | glsr_log()->error( $terms->get_error_message() ); |
103 | 103 | return []; |
104 | 104 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | 'post_status' => 'publish', |
116 | 116 | 'post_type' => 'any', |
117 | 117 | ]; |
118 | - if( is_numeric( $searchTerm )) { |
|
118 | + if( is_numeric( $searchTerm ) ) { |
|
119 | 119 | $args['post__in'] = [$searchTerm]; |
120 | 120 | } |
121 | 121 | else { |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | ob_start(); |
135 | 135 | glsr()->render( 'partials/editor/search-result', [ |
136 | 136 | 'ID' => get_the_ID(), |
137 | - 'permalink' => esc_url( (string) get_permalink() ), |
|
137 | + 'permalink' => esc_url( (string)get_permalink() ), |
|
138 | 138 | 'title' => esc_attr( get_the_title() ), |
139 | - ]); |
|
139 | + ] ); |
|
140 | 140 | $results .= ob_get_clean(); |
141 | 141 | } |
142 | 142 | wp_reset_postdata(); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | 'is_valid' => true, |
28 | 28 | 'is_widget' => false, |
29 | 29 | 'path' => '', |
30 | - ]); |
|
30 | + ] ); |
|
31 | 31 | $this->normalize(); |
32 | 32 | } |
33 | 33 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | if( !$this->field['is_valid'] )return; |
48 | 48 | if( $this->field['is_raw'] ) { |
49 | - return glsr( Builder::class )->{$this->field['type']}( $this->field ); |
|
49 | + return glsr( Builder::class )->{$this->field['type']}($this->field); |
|
50 | 50 | } |
51 | 51 | if( !$this->field['is_setting'] ) { |
52 | 52 | return $this->buildField(); |
@@ -75,15 +75,15 @@ discard block |
||
75 | 75 | 'class' => $this->getFieldClass(), |
76 | 76 | 'errors' => $this->getFieldErrors(), |
77 | 77 | 'field' => glsr( Builder::class )->raw( $this->field ), |
78 | - 'label' => glsr( Builder::class )->label([ |
|
78 | + 'label' => glsr( Builder::class )->label( [ |
|
79 | 79 | 'class' => 'glsr-'.$this->field['type'].'-label', |
80 | 80 | 'for' => $this->field['id'], |
81 | 81 | 'is_public' => $this->field['is_public'], |
82 | 82 | 'text' => $this->field['label'].'<span></span>', |
83 | 83 | 'type' => $this->field['type'], |
84 | - ]), |
|
84 | + ] ), |
|
85 | 85 | ], |
86 | - ]); |
|
86 | + ] ); |
|
87 | 87 | return apply_filters( 'site-reviews/rendered/field', $field, $this->field['type'], $this->field ); |
88 | 88 | } |
89 | 89 | |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | return glsr( Template::class )->build( 'partials/form/table-row', [ |
96 | 96 | 'context' => [ |
97 | 97 | 'class' => $this->getFieldClass(), |
98 | - 'field' => glsr( Builder::class )->{$this->field['type']}( $this->field ), |
|
98 | + 'field' => glsr( Builder::class )->{$this->field['type']}($this->field), |
|
99 | 99 | 'label' => glsr( Builder::class )->label( $this->field['legend'], ['for' => $this->field['id']] ), |
100 | 100 | ], |
101 | - ]); |
|
101 | + ] ); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -107,16 +107,16 @@ discard block |
||
107 | 107 | protected function buildSettingMultiField() |
108 | 108 | { |
109 | 109 | $dependsOn = $this->getFieldDependsOn(); |
110 | - unset( $this->field['data-depends'] ); |
|
110 | + unset($this->field['data-depends']); |
|
111 | 111 | return glsr( Template::class )->build( 'partials/form/table-row-multiple', [ |
112 | 112 | 'context' => [ |
113 | 113 | 'class' => $this->getFieldClass(), |
114 | 114 | 'depends_on' => $dependsOn, |
115 | - 'field' => glsr( Builder::class )->{$this->field['type']}( $this->field ), |
|
115 | + 'field' => glsr( Builder::class )->{$this->field['type']}($this->field), |
|
116 | 116 | 'label' => glsr( Builder::class )->label( $this->field['legend'], ['for' => $this->field['id']] ), |
117 | 117 | 'legend' => $this->field['legend'], |
118 | 118 | ], |
119 | - ]); |
|
119 | + ] ); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -125,13 +125,13 @@ discard block |
||
125 | 125 | protected function getFieldClass() |
126 | 126 | { |
127 | 127 | $classes = []; |
128 | - if( !empty( $this->field['errors'] )) { |
|
128 | + if( !empty($this->field['errors']) ) { |
|
129 | 129 | $classes[] = 'glsr-has-error'; |
130 | 130 | } |
131 | 131 | if( $this->field['is_hidden'] ) { |
132 | 132 | $classes[] = 'hidden'; |
133 | 133 | } |
134 | - if( !empty( $this->field['required'] )) { |
|
134 | + if( !empty($this->field['required']) ) { |
|
135 | 135 | $classes[] = 'glsr-required'; |
136 | 136 | } |
137 | 137 | $classes = apply_filters( 'site-reviews/rendered/field/classes', $classes, $this->field ); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | protected function getFieldDependsOn() |
145 | 145 | { |
146 | - return !empty( $this->field['data-depends'] ) |
|
146 | + return !empty($this->field['data-depends']) |
|
147 | 147 | ? $this->field['data-depends'] |
148 | 148 | : ''; |
149 | 149 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | */ |
154 | 154 | protected function getFieldErrors() |
155 | 155 | { |
156 | - if( empty( $this->field['errors'] ) || !is_array( $this->field['errors'] ))return; |
|
156 | + if( empty($this->field['errors']) || !is_array( $this->field['errors'] ) )return; |
|
157 | 157 | $errors = array_reduce( $this->field['errors'], function( $carry, $error ) { |
158 | 158 | return $carry.glsr( Builder::class )->span( $error, ['class' => 'glsr-field-error'] ); |
159 | 159 | }); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | 'context' => [ |
162 | 162 | 'errors' => $errors, |
163 | 163 | ], |
164 | - ]); |
|
164 | + ] ); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -184,13 +184,13 @@ discard block |
||
184 | 184 | 'name', 'type', |
185 | 185 | ]; |
186 | 186 | foreach( $requiredValues as $value ) { |
187 | - if( isset( $this->field[$value] ))continue; |
|
187 | + if( isset($this->field[$value]) )continue; |
|
188 | 188 | $missingValues[] = $value; |
189 | 189 | $this->field['is_valid'] = false; |
190 | 190 | } |
191 | - if( !empty( $missingValues )) { |
|
191 | + if( !empty($missingValues) ) { |
|
192 | 192 | glsr_log() |
193 | - ->warning( 'Field is missing: '.implode( ', ', $missingValues )) |
|
193 | + ->warning( 'Field is missing: '.implode( ', ', $missingValues ) ) |
|
194 | 194 | ->info( $this->field ); |
195 | 195 | } |
196 | 196 | return $this->field['is_valid']; |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | if( !$this->isFieldValid() )return; |
205 | 205 | $this->field['path'] = $this->field['name']; |
206 | 206 | $className = glsr( Helper::class )->buildClassName( $this->field['type'], __NAMESPACE__.'\Fields' ); |
207 | - if( class_exists( $className )) { |
|
207 | + if( class_exists( $className ) ) { |
|
208 | 208 | $this->field = array_merge( |
209 | 209 | wp_parse_args( $this->field, $className::defaults() ), |
210 | 210 | $className::required() |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | */ |
220 | 220 | protected function normalizeFieldId() |
221 | 221 | { |
222 | - if( isset( $this->field['id'] ) || $this->field['is_raw'] )return; |
|
222 | + if( isset($this->field['id']) || $this->field['is_raw'] )return; |
|
223 | 223 | $this->field['id'] = glsr( Helper::class )->convertPathToId( |
224 | 224 | $this->field['path'], |
225 | 225 | $this->getFieldPrefix() |