@@ -3,7 +3,7 @@ |
||
3 | 3 | <p>{{ data.s1 }}</p> |
4 | 4 | <p>{{ data.p1 }}</p> |
5 | 5 | <p class="row-actions"> |
6 | - <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
6 | + <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
7 | 7 | </p> |
8 | 8 | <button type="button" class="toggle-row"> |
9 | 9 | <span class="screen-reader-text"><?= __( 'Show custom translation', 'site-reviews' ); ?></span> |
@@ -2,7 +2,7 @@ |
||
2 | 2 | <td class="glsr-string-td1 column-primary"> |
3 | 3 | <p>{{ data.s1 }}</p> |
4 | 4 | <p class="row-actions"> |
5 | - <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
5 | + <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
6 | 6 | </p> |
7 | 7 | <button type="button" class="toggle-row"> |
8 | 8 | <span class="screen-reader-text"><?= __( 'Show custom translation', 'site-reviews' ); ?></span> |
@@ -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'; |
@@ -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 | } |
@@ -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 ); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | */ |
12 | 12 | public function build( array $args = [] ) |
13 | 13 | { |
14 | - require_once( ABSPATH.'wp-admin/includes/template.php' ); |
|
14 | + require_once(ABSPATH.'wp-admin/includes/template.php'); |
|
15 | 15 | ob_start(); |
16 | 16 | wp_star_rating( $args ); |
17 | 17 | return ob_get_clean(); |
@@ -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( Html::class )->buildPartial( $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 ); |