@@ -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' ); |
@@ -53,7 +53,9 @@ |
||
| 53 | 53 | protected function normalize( array $settings ) |
| 54 | 54 | { |
| 55 | 55 | array_walk( $settings, function( &$setting ) { |
| 56 | - if( isset( $setting['default'] ))return; |
|
| 56 | + if( isset( $setting['default'] )) { |
|
| 57 | + return; |
|
| 58 | + } |
|
| 57 | 59 | $setting['default'] = ''; |
| 58 | 60 | }); |
| 59 | 61 | return $settings; |
@@ -13,11 +13,11 @@ discard block |
||
| 13 | 13 | public function defaults() |
| 14 | 14 | { |
| 15 | 15 | $settings = $this->settings(); |
| 16 | - $defaults = array_combine( array_keys( $settings ), array_column( $settings, 'default' )); |
|
| 16 | + $defaults = array_combine( array_keys( $settings ), array_column( $settings, 'default' ) ); |
|
| 17 | 17 | return wp_parse_args( $defaults, [ |
| 18 | 18 | 'version' => '', |
| 19 | 19 | 'version_upgraded_from' => '', |
| 20 | - ]); |
|
| 20 | + ] ); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | protected function normalize( array $settings ) |
| 58 | 58 | { |
| 59 | 59 | array_walk( $settings, function( &$setting ) { |
| 60 | - if( isset( $setting['default'] ))return; |
|
| 60 | + if( isset($setting['default']) )return; |
|
| 61 | 61 | $setting['default'] = ''; |
| 62 | 62 | }); |
| 63 | 63 | return $settings; |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | 'is_multi' => false, |
| 24 | 24 | 'is_valid' => true, |
| 25 | 25 | 'path' => '', |
| 26 | - ]); |
|
| 26 | + ] ); |
|
| 27 | 27 | $this->normalize(); |
| 28 | 28 | } |
| 29 | 29 | |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | return glsr( Template::class )->build( 'partials/settings/form-table-row', [ |
| 41 | 41 | 'context' => [ |
| 42 | 42 | 'class' => $this->getFieldClass(), |
| 43 | - 'field' => glsr( Builder::class )->{$this->field['type']}( $this->field ), |
|
| 43 | + 'field' => glsr( Builder::class )->{$this->field['type']}($this->field), |
|
| 44 | 44 | 'label' => glsr( Builder::class )->label( $this->field['legend'], ['for' => $this->field['id']] ), |
| 45 | 45 | ], |
| 46 | - ]); |
|
| 46 | + ] ); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | 'context' => [ |
| 64 | 64 | 'class' => $this->getFieldClass(), |
| 65 | 65 | 'depends_on' => $this->getFieldDependsOn(), |
| 66 | - 'field' => glsr( Builder::class )->{$this->field['type']}( $this->field ), |
|
| 66 | + 'field' => glsr( Builder::class )->{$this->field['type']}($this->field), |
|
| 67 | 67 | 'label' => glsr( Builder::class )->label( $this->field['legend'], ['for' => $this->field['id']] ), |
| 68 | 68 | 'legend' => $this->field['legend'], |
| 69 | 69 | ], |
| 70 | - ]); |
|
| 70 | + ] ); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | protected function getFieldDefault() |
| 87 | 87 | { |
| 88 | - return isset( $this->field['default'] ) |
|
| 88 | + return isset($this->field['default']) |
|
| 89 | 89 | ? $this->field['default'] |
| 90 | 90 | : ''; |
| 91 | 91 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | protected function getFieldDependsOn() |
| 97 | 97 | { |
| 98 | - return !empty( $this->field['depends_on'] ) |
|
| 98 | + return !empty($this->field['depends_on']) |
|
| 99 | 99 | ? $this->field['depends_on'] |
| 100 | 100 | : ''; |
| 101 | 101 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $path, |
| 112 | 112 | glsr( Helper::class )->getPathValue( $path, glsr()->defaults ) |
| 113 | 113 | ); |
| 114 | - if( is_array( $expectedValue )) { |
|
| 114 | + if( is_array( $expectedValue ) ) { |
|
| 115 | 115 | return !in_array( $optionValue, $expectedValue ); |
| 116 | 116 | } |
| 117 | 117 | return $optionValue != $expectedValue; |
@@ -128,13 +128,13 @@ discard block |
||
| 128 | 128 | 'label', 'name', 'type', |
| 129 | 129 | ]; |
| 130 | 130 | foreach( $requiredValues as $value ) { |
| 131 | - if( isset( $this->field[$value] ))continue; |
|
| 131 | + if( isset($this->field[$value]) )continue; |
|
| 132 | 132 | $missingValues[] = $value; |
| 133 | 133 | $isValid = $this->field['is_valid'] = false; |
| 134 | 134 | } |
| 135 | - if( !empty( $missingValues )) { |
|
| 135 | + if( !empty($missingValues) ) { |
|
| 136 | 136 | glsr_log() |
| 137 | - ->warning( 'Field is missing: '.implode( ', ', $missingValues )) |
|
| 137 | + ->warning( 'Field is missing: '.implode( ', ', $missingValues ) ) |
|
| 138 | 138 | ->info( $this->field ); |
| 139 | 139 | } |
| 140 | 140 | return $isValid; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $field = $this->field; |
| 150 | 150 | foreach( $field as $key => $value ) { |
| 151 | 151 | $methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' ); |
| 152 | - if( !method_exists( $this, $methodName ))continue; |
|
| 152 | + if( !method_exists( $this, $methodName ) )continue; |
|
| 153 | 153 | $this->$methodName(); |
| 154 | 154 | } |
| 155 | 155 | $this->normalizeFieldId(); |
@@ -162,13 +162,13 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | protected function normalizeDependsOn() |
| 164 | 164 | { |
| 165 | - if( empty( $this->field['depends_on'] ) || !is_array( $this->field['depends_on'] ))return; |
|
| 165 | + if( empty($this->field['depends_on']) || !is_array( $this->field['depends_on'] ) )return; |
|
| 166 | 166 | $path = key( $this->field['depends_on'] ); |
| 167 | 167 | $value = $this->field['depends_on'][$path]; |
| 168 | - $this->field['depends_on'] = json_encode([ |
|
| 168 | + $this->field['depends_on'] = json_encode( [ |
|
| 169 | 169 | 'name' => glsr( Helper::class )->convertPathToName( $path, OptionManager::databaseKey() ), |
| 170 | 170 | 'value' => $value, |
| 171 | - ], JSON_HEX_APOS|JSON_HEX_QUOT ); |
|
| 171 | + ], JSON_HEX_APOS | JSON_HEX_QUOT ); |
|
| 172 | 172 | $this->field['is_hidden'] = $this->isFieldHidden( $path, $value ); |
| 173 | 173 | } |
| 174 | 174 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | protected function normalizeFieldId() |
| 179 | 179 | { |
| 180 | - if( isset( $this->field['id'] ))return; |
|
| 180 | + if( isset($this->field['id']) )return; |
|
| 181 | 181 | $this->field['id'] = glsr( Helper::class )->convertNameToId( $this->field['name'] ); |
| 182 | 182 | } |
| 183 | 183 | |
@@ -187,10 +187,10 @@ discard block |
||
| 187 | 187 | protected function normalizeFieldType() |
| 188 | 188 | { |
| 189 | 189 | $className = glsr( Helper::class )->buildClassName( $this->field['type'], 'Modules\Html\Fields' ); |
| 190 | - if( class_exists( $className )) { |
|
| 190 | + if( class_exists( $className ) ) { |
|
| 191 | 191 | $this->field = array_merge( $this->field, glsr( $className )->defaults() ); |
| 192 | 192 | } |
| 193 | - if( in_array( $this->field['type'], static::MULTI_FIELD_TYPES )) { |
|
| 193 | + if( in_array( $this->field['type'], static::MULTI_FIELD_TYPES ) ) { |
|
| 194 | 194 | $this->field['is_multi'] = true; |
| 195 | 195 | } |
| 196 | 196 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | protected function normalizeFieldValue() |
| 202 | 202 | { |
| 203 | - if( isset( $this->field['value'] ))return; |
|
| 203 | + if( isset($this->field['value']) )return; |
|
| 204 | 204 | $this->field['value'] = glsr( OptionManager::class )->get( |
| 205 | 205 | $this->field['path'], |
| 206 | 206 | $this->getFieldDefault() |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | protected function normalizeLabel() |
| 214 | 214 | { |
| 215 | 215 | $this->field['legend'] = $this->field['label']; |
| 216 | - unset( $this->field['label'] ); |
|
| 216 | + unset($this->field['label']); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | /** |
@@ -32,7 +32,9 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function build() |
| 34 | 34 | { |
| 35 | - if( !$this->field['is_valid'] )return; |
|
| 35 | + if( !$this->field['is_valid'] ) { |
|
| 36 | + return; |
|
| 37 | + } |
|
| 36 | 38 | if( $this->field['is_multi'] ) { |
| 37 | 39 | return $this->buildMultiField(); |
| 38 | 40 | } |
@@ -128,7 +130,9 @@ discard block |
||
| 128 | 130 | 'label', 'name', 'type', |
| 129 | 131 | ]; |
| 130 | 132 | foreach( $requiredValues as $value ) { |
| 131 | - if( isset( $this->field[$value] ))continue; |
|
| 133 | + if( isset( $this->field[$value] )) { |
|
| 134 | + continue; |
|
| 135 | + } |
|
| 132 | 136 | $missingValues[] = $value; |
| 133 | 137 | $isValid = $this->field['is_valid'] = false; |
| 134 | 138 | } |
@@ -145,11 +149,15 @@ discard block |
||
| 145 | 149 | */ |
| 146 | 150 | protected function normalize() |
| 147 | 151 | { |
| 148 | - if( !$this->isFieldValid() )return; |
|
| 152 | + if( !$this->isFieldValid() ) { |
|
| 153 | + return; |
|
| 154 | + } |
|
| 149 | 155 | $field = $this->field; |
| 150 | 156 | foreach( $field as $key => $value ) { |
| 151 | 157 | $methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' ); |
| 152 | - if( !method_exists( $this, $methodName ))continue; |
|
| 158 | + if( !method_exists( $this, $methodName )) { |
|
| 159 | + continue; |
|
| 160 | + } |
|
| 153 | 161 | $this->$methodName(); |
| 154 | 162 | } |
| 155 | 163 | $this->normalizeFieldId(); |
@@ -162,7 +170,9 @@ discard block |
||
| 162 | 170 | */ |
| 163 | 171 | protected function normalizeDependsOn() |
| 164 | 172 | { |
| 165 | - if( empty( $this->field['depends_on'] ) || !is_array( $this->field['depends_on'] ))return; |
|
| 173 | + if( empty( $this->field['depends_on'] ) || !is_array( $this->field['depends_on'] )) { |
|
| 174 | + return; |
|
| 175 | + } |
|
| 166 | 176 | $path = key( $this->field['depends_on'] ); |
| 167 | 177 | $value = $this->field['depends_on'][$path]; |
| 168 | 178 | $this->field['depends_on'] = json_encode([ |
@@ -177,7 +187,9 @@ discard block |
||
| 177 | 187 | */ |
| 178 | 188 | protected function normalizeFieldId() |
| 179 | 189 | { |
| 180 | - if( isset( $this->field['id'] ))return; |
|
| 190 | + if( isset( $this->field['id'] )) { |
|
| 191 | + return; |
|
| 192 | + } |
|
| 181 | 193 | $this->field['id'] = glsr( Helper::class )->convertNameToId( $this->field['name'] ); |
| 182 | 194 | } |
| 183 | 195 | |
@@ -200,7 +212,9 @@ discard block |
||
| 200 | 212 | */ |
| 201 | 213 | protected function normalizeFieldValue() |
| 202 | 214 | { |
| 203 | - if( isset( $this->field['value'] ))return; |
|
| 215 | + if( isset( $this->field['value'] )) { |
|
| 216 | + return; |
|
| 217 | + } |
|
| 204 | 218 | $this->field['value'] = glsr( OptionManager::class )->get( |
| 205 | 219 | $this->field['path'], |
| 206 | 220 | $this->getFieldDefault() |