@@ -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'; |
@@ -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 ); |
@@ -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 ); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | { |
14 | 14 | $this->builder->args = wp_parse_args( $this->builder->args, [ |
15 | 15 | 'name' => $this->builder->args['text'], |
16 | - ]); |
|
16 | + ] ); |
|
17 | 17 | $this->builder->tag = 'input'; |
18 | 18 | $this->mergeFieldArgs(); |
19 | 19 | return $this->builder->getOpeningTag(); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | glsr()->version, |
45 | 45 | true |
46 | 46 | ); |
47 | - if( !empty( $this->pointers )) { |
|
47 | + if( !empty($this->pointers) ) { |
|
48 | 48 | wp_enqueue_style( 'wp-pointer' ); |
49 | 49 | wp_enqueue_script( 'wp-pointer' ); |
50 | 50 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $dependencies = apply_filters( 'site-reviews/enqueue/admin/dependencies', [] ); |
85 | 85 | $dependencies = array_merge( $dependencies, [ |
86 | 86 | 'jquery', 'jquery-ui-sortable', 'underscore', 'wp-util', |
87 | - ]); |
|
87 | + ] ); |
|
88 | 88 | return $dependencies; |
89 | 89 | } |
90 | 90 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $generatedPointers = []; |
115 | 115 | foreach( $pointers as $pointer ) { |
116 | 116 | if( $pointer['screen'] != glsr_current_screen()->id )continue; |
117 | - if( in_array( $pointer['id'], $dismissedPointers ))continue; |
|
117 | + if( in_array( $pointer['id'], $dismissedPointers ) )continue; |
|
118 | 118 | $generatedPointers[] = $this->generatePointer( $pointer ); |
119 | 119 | } |
120 | 120 | $this->pointers = $generatedPointers; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | protected function isCurrentScreen() |
127 | 127 | { |
128 | 128 | $screen = glsr_current_screen(); |
129 | - return $screen && ( $screen->post_type == Application::POST_TYPE |
|
129 | + return $screen && ($screen->post_type == Application::POST_TYPE |
|
130 | 130 | || $screen->base == 'post' |
131 | 131 | || $screen->id == 'dashboard' |
132 | 132 | || $screen->id == 'widgets' |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | $variables = []; |
142 | 142 | foreach( glsr()->mceShortcodes as $tag => $args ) { |
143 | - if( empty( $args['required'] ))continue; |
|
143 | + if( empty($args['required']) )continue; |
|
144 | 144 | $variables[$tag] = $args['required']; |
145 | 145 | } |
146 | 146 | return $variables; |