@@ -15,13 +15,13 @@ discard block |
||
| 15 | 15 | public function __construct( $idBase, $name, $values ) |
| 16 | 16 | { |
| 17 | 17 | $controlOptions = $widgetOptions = []; |
| 18 | - if( isset( $values['class'] )) { |
|
| 18 | + if( isset($values['class']) ) { |
|
| 19 | 19 | $widgetOptions['classname'] = $values['class']; |
| 20 | 20 | } |
| 21 | - if( isset( $values['description'] )) { |
|
| 21 | + if( isset($values['description']) ) { |
|
| 22 | 22 | $widgetOptions['description'] = $values['description']; |
| 23 | 23 | } |
| 24 | - if( isset( $values['width'] )) { |
|
| 24 | + if( isset($values['width']) ) { |
|
| 25 | 25 | $controlOptions['width'] = $values['width']; |
| 26 | 26 | } |
| 27 | 27 | parent::__construct( $idBase, $name, $widgetOptions, $controlOptions ); |
@@ -34,10 +34,10 @@ discard block |
||
| 34 | 34 | protected function renderField( $tag, array $args = [] ) |
| 35 | 35 | { |
| 36 | 36 | $args = $this->normalizeFieldAttributes( $tag, $args ); |
| 37 | - $field = glsr( Html::class )->build( ['is_widget' => true] )->{$tag}( $args['name'], $args ); |
|
| 37 | + $field = glsr( Html::class )->build( ['is_widget' => true] )->{$tag}($args['name'], $args); |
|
| 38 | 38 | echo glsr( Html::class )->build( ['is_widget' => true] )->div( $field, [ |
| 39 | 39 | 'class' => 'glsr-field', |
| 40 | - ]); |
|
| 40 | + ] ); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | protected function normalizeFieldAttributes( $tag, array $args ) |
| 48 | 48 | { |
| 49 | - if( empty( $args['value'] )) { |
|
| 49 | + if( empty($args['value']) ) { |
|
| 50 | 50 | $args['value'] = $this->widgetArgs[$args['name']]; |
| 51 | 51 | } |
| 52 | - if( empty( $this->widgetArgs['options'] ) && in_array( $tag, ['checkbox', 'radio'] )) { |
|
| 52 | + if( empty($this->widgetArgs['options']) && in_array( $tag, ['checkbox', 'radio'] ) ) { |
|
| 53 | 53 | $args['checked'] = in_array( $args['value'], (array)$this->widgetArgs[$args['name']] ); |
| 54 | 54 | } |
| 55 | 55 | $args['id'] = $this->get_field_id( $args['name'] ); |
@@ -87,7 +87,9 @@ discard block |
||
| 87 | 87 | ]; |
| 88 | 88 | if( !isset( $properties[$property] ) |
| 89 | 89 | || empty( array_filter( [$value], $properties[$property] )) |
| 90 | - )return; |
|
| 90 | + ) { |
|
| 91 | + return; |
|
| 92 | + } |
|
| 91 | 93 | $this->$property = $value; |
| 92 | 94 | } |
| 93 | 95 | |
@@ -137,7 +139,9 @@ discard block |
||
| 137 | 139 | */ |
| 138 | 140 | protected function buildFieldDescription() |
| 139 | 141 | { |
| 140 | - if( empty( $this->args['description'] ))return; |
|
| 142 | + if( empty( $this->args['description'] )) { |
|
| 143 | + return; |
|
| 144 | + } |
|
| 141 | 145 | if( !empty( $this->globals['is_widget'] )) { |
| 142 | 146 | return $this->small( $this->args['description'] ); |
| 143 | 147 | } |
@@ -186,7 +190,9 @@ discard block |
||
| 186 | 190 | */ |
| 187 | 191 | protected function buildFormLabel() |
| 188 | 192 | { |
| 189 | - if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return; |
|
| 193 | + if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' ) { |
|
| 194 | + return; |
|
| 195 | + } |
|
| 190 | 196 | return $this->label([ |
| 191 | 197 | 'for' => $this->args['id'], |
| 192 | 198 | 'text' => $this->args['label'], |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public function __call( $method, $args ) |
| 61 | 61 | { |
| 62 | - $instance = new static( $this->globals ); |
|
| 62 | + $instance = new static($this->globals); |
|
| 63 | 63 | $instance->setTagFromMethod( $method ); |
| 64 | - call_user_func_array( [$instance, 'normalize'], $args += ['',''] ); |
|
| 64 | + call_user_func_array( [$instance, 'normalize'], $args += ['', ''] ); |
|
| 65 | 65 | $tags = array_merge( static::TAGS_FORM, static::TAGS_STRUCTURE, static::TAGS_TEXT ); |
| 66 | 66 | $generatedTag = in_array( $instance->tag, $tags ) |
| 67 | 67 | ? $instance->buildTag() |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | 'render' => 'is_bool', |
| 86 | 86 | 'tag' => 'is_string', |
| 87 | 87 | ]; |
| 88 | - if( !isset( $properties[$property] ) |
|
| 89 | - || empty( array_filter( [$value], $properties[$property] )) |
|
| 88 | + if( !isset($properties[$property]) |
|
| 89 | + || empty(array_filter( [$value], $properties[$property] )) |
|
| 90 | 90 | )return; |
| 91 | 91 | $this->$property = $value; |
| 92 | 92 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function getOpeningTag() |
| 106 | 106 | { |
| 107 | - $attributes = glsr( Attributes::class )->{$this->tag}( $this->args )->toString(); |
|
| 107 | + $attributes = glsr( Attributes::class )->{$this->tag}($this->args)->toString(); |
|
| 108 | 108 | return '<'.trim( $this->tag.' '.$attributes ).'>'; |
| 109 | 109 | } |
| 110 | 110 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | protected function buildCustomField() |
| 115 | 115 | { |
| 116 | 116 | $className = glsr( Helper::class )->buildClassName( $this->tag, __NAMESPACE__.'\Fields' ); |
| 117 | - if( !class_exists( $className )) { |
|
| 117 | + if( !class_exists( $className ) ) { |
|
| 118 | 118 | glsr_log()->error( 'Field missing: '.$className ); |
| 119 | 119 | return; |
| 120 | 120 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | protected function buildDefaultTag( $text = '' ) |
| 128 | 128 | { |
| 129 | - if( empty( $text )) { |
|
| 129 | + if( empty($text) ) { |
|
| 130 | 130 | $text = $this->args['text']; |
| 131 | 131 | } |
| 132 | 132 | return $this->getOpeningTag().$text.$this->getClosingTag(); |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | protected function buildFieldDescription() |
| 139 | 139 | { |
| 140 | - if( empty( $this->args['description'] ))return; |
|
| 141 | - if( !empty( $this->globals['is_widget'] )) { |
|
| 140 | + if( empty($this->args['description']) )return; |
|
| 141 | + if( !empty($this->globals['is_widget']) ) { |
|
| 142 | 142 | return $this->small( $this->args['description'] ); |
| 143 | 143 | } |
| 144 | 144 | return $this->p( $this->args['description'], ['class' => 'description'] ); |
@@ -149,10 +149,10 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | protected function buildFormInput() |
| 151 | 151 | { |
| 152 | - if( !in_array( $this->args['type'], ['checkbox', 'radio'] )) { |
|
| 152 | + if( !in_array( $this->args['type'], ['checkbox', 'radio'] ) ) { |
|
| 153 | 153 | return $this->buildFormLabel().$this->getOpeningTag(); |
| 154 | 154 | } |
| 155 | - return empty( $this->args['options'] ) |
|
| 155 | + return empty($this->args['options']) |
|
| 156 | 156 | ? $this->buildFormInputChoice() |
| 157 | 157 | : $this->buildFormInputMultiChoice(); |
| 158 | 158 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | protected function buildFormInputMultiChoice() |
| 172 | 172 | { |
| 173 | 173 | if( $this->args['type'] == 'checkbox' ) { |
| 174 | - $this->args['name'].= '[]'; |
|
| 174 | + $this->args['name'] .= '[]'; |
|
| 175 | 175 | } |
| 176 | 176 | $options = array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) { |
| 177 | 177 | return $carry.$this->li( $this->{$this->args['type']}([ |
@@ -179,12 +179,12 @@ discard block |
||
| 179 | 179 | 'name' => $this->args['name'], |
| 180 | 180 | 'text' => $this->args['options'][$key], |
| 181 | 181 | 'value' => $key, |
| 182 | - ])); |
|
| 182 | + ]) ); |
|
| 183 | 183 | }); |
| 184 | 184 | return $this->ul( $options, [ |
| 185 | 185 | 'class' => $this->args['class'], |
| 186 | 186 | 'id' => $this->args['id'], |
| 187 | - ]); |
|
| 187 | + ] ); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** |
@@ -192,11 +192,11 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | protected function buildFormLabel() |
| 194 | 194 | { |
| 195 | - if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return; |
|
| 196 | - return $this->label([ |
|
| 195 | + if( empty($this->args['label']) || $this->args['type'] == 'hidden' )return; |
|
| 196 | + return $this->label( [ |
|
| 197 | 197 | 'for' => $this->args['id'], |
| 198 | 198 | 'text' => $this->args['label'], |
| 199 | - ]); |
|
| 199 | + ] ); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
@@ -213,11 +213,11 @@ discard block |
||
| 213 | 213 | protected function buildFormSelectOptions() |
| 214 | 214 | { |
| 215 | 215 | return array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) { |
| 216 | - return $carry.$this->option([ |
|
| 216 | + return $carry.$this->option( [ |
|
| 217 | 217 | 'selected' => $this->args['value'] == $key, |
| 218 | 218 | 'text' => $this->args['options'][$key], |
| 219 | 219 | 'value' => $key, |
| 220 | - ]); |
|
| 220 | + ] ); |
|
| 221 | 221 | }); |
| 222 | 222 | } |
| 223 | 223 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | */ |
| 235 | 235 | protected function buildTag() |
| 236 | 236 | { |
| 237 | - if( !in_array( $this->tag, static::TAGS_FORM )) { |
|
| 237 | + if( !in_array( $this->tag, static::TAGS_FORM ) ) { |
|
| 238 | 238 | return $this->buildDefaultTag(); |
| 239 | 239 | } |
| 240 | 240 | return call_user_func( [$this, 'buildForm'.ucfirst( $this->tag )] ).$this->buildFieldDescription(); |
@@ -246,13 +246,13 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | protected function normalize( ...$params ) |
| 248 | 248 | { |
| 249 | - if( is_string( $params[0] ) || is_numeric( $params[0] )) { |
|
| 249 | + if( is_string( $params[0] ) || is_numeric( $params[0] ) ) { |
|
| 250 | 250 | $this->setNameOrTextAttributeForTag( $params[0] ); |
| 251 | 251 | } |
| 252 | - if( is_array( $params[0] )) { |
|
| 252 | + if( is_array( $params[0] ) ) { |
|
| 253 | 253 | $this->args += $params[0]; |
| 254 | 254 | } |
| 255 | - else if( is_array( $params[1] )) { |
|
| 255 | + else if( is_array( $params[1] ) ) { |
|
| 256 | 256 | $this->args += $params[1]; |
| 257 | 257 | } |
| 258 | 258 | $this->args = glsr( BuilderDefaults::class )->merge( $this->args ); |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | protected function setTagFromMethod( $method ) |
| 278 | 278 | { |
| 279 | 279 | $this->tag = strtolower( $method ); |
| 280 | - if( in_array( $this->tag, static::INPUT_TYPES )) { |
|
| 280 | + if( in_array( $this->tag, static::INPUT_TYPES ) ) { |
|
| 281 | 281 | $this->args['type'] = $this->tag; |
| 282 | 282 | $this->tag = 'input'; |
| 283 | 283 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | { |
| 14 | 14 | $defaults = wp_parse_args( $this->defaults(), [ |
| 15 | 15 | 'name' => $this->builder->args['text'], |
| 16 | - ]); |
|
| 16 | + ] ); |
|
| 17 | 17 | $this->builder->args = wp_parse_args( $this->builder->args, $defaults ); |
| 18 | 18 | $this->builder->tag = 'input'; |
| 19 | 19 | return $this->builder->getOpeningTag(); |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | 'name' => 'tripadvisor', |
| 13 | 13 | 'title' => 'Tripadvisor Reviews', |
| 14 | 14 | ], |
| 15 | - ]); |
|
| 15 | + ] ); |
|
| 16 | 16 | $template->render( 'partials/addons/addon', [ |
| 17 | 17 | 'context' => [ |
| 18 | 18 | 'description' => __( 'Sync your Yelp reviews and display them on your site.', 'site-reviews' ), |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | 'name' => 'yelp', |
| 21 | 21 | 'title' => 'Yelp Reviews', |
| 22 | 22 | ], |
| 23 | - ]); |
|
| 23 | + ] ); |
|
| 24 | 24 | ?> |
| 25 | 25 | </div> |
| 26 | 26 | </div> |
@@ -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> |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | </ul> |
| 21 | 21 | </div> |
| 22 | 22 | |
| 23 | - <?php if( current_user_can( $taxonomy->cap->edit_terms )) : ?> |
|
| 23 | + <?php if( current_user_can( $taxonomy->cap->edit_terms ) ) : ?> |
|
| 24 | 24 | <div id="<?= $tax_name; ?>-adder" class="wp-hidden-children"> |
| 25 | 25 | <a id="<?= $tax_name; ?>-add-toggle" href="#<?= $tax_name; ?>-add" class="hide-if-no-js taxonomy-add-new"> |
| 26 | 26 | <?= sprintf( '+ %s', $taxonomy->labels->add_new_item ); ?> |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | <label class="screen-reader-text" for="new<?= $tax_name; ?>"><?= $taxonomy->labels->add_new_item; ?></label> |
| 30 | 30 | <input type="text" name="new<?= $tax_name; ?>" id="new<?= $tax_name; ?>" class="form-required form-input-tip" value="<?= esc_attr( $taxonomy->labels->new_item_name ); ?>" aria-required="true"/> |
| 31 | 31 | <input type="button" id="<?= $tax_name; ?>-add-submit" data-wp-lists="add:<?= $tax_name; ?>checklist:<?= $tax_name; ?>-add" class="button category-add-submit" value="<?= esc_attr( $taxonomy->labels->add_new_item ); ?>" /> |
| 32 | - <?php wp_nonce_field( 'add-' . $tax_name, '_ajax_nonce-add-' . $tax_name, false ); ?> |
|
| 32 | + <?php wp_nonce_field( 'add-'.$tax_name, '_ajax_nonce-add-'.$tax_name, false ); ?> |
|
| 33 | 33 | <span id="<?= $tax_name; ?>-ajax-response"></span> |
| 34 | 34 | </div> |
| 35 | 35 | </div> |
@@ -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' ); |
@@ -3,7 +3,9 @@ |
||
| 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' ))) { |
|
| 7 | + return; |
|
| 8 | +} |
|
| 7 | 9 | |
| 8 | 10 | delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey() ); |
| 9 | 11 | delete_option( 'widget_'.glsr()->id.'_site-reviews' ); |