@@ -7,7 +7,7 @@ |
||
| 7 | 7 | <p>{{ data.s1 }}</p> |
| 8 | 8 | </div> |
| 9 | 9 | <p class="row-actions"> |
| 10 | - <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
| 10 | + <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
| 11 | 11 | </p> |
| 12 | 12 | </td> |
| 13 | 13 | <td class="glsr-string-td2"> |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | <p>{{ data.p1 }}</p> |
| 9 | 9 | </div> |
| 10 | 10 | <p class="row-actions"> |
| 11 | - <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' );?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
| 11 | + <span class="delete"><a href="#{{ data.index }}" class="delete" aria-label="<?= __( 'Delete translation string', 'site-reviews' ); ?>"><?= __( 'Delete', 'site-reviews' ); ?></a></span> |
|
| 12 | 12 | </p> |
| 13 | 13 | </td> |
| 14 | 14 | <td class="glsr-string-td2"> |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | protected function filterAttributes( array $allowedAttributeKeys ) |
| 124 | 124 | { |
| 125 | - return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys )); |
|
| 125 | + return array_intersect_key( $this->attributes, array_flip( $allowedAttributeKeys ) ); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $globalAttributes = $this->filterAttributes( static::GLOBAL_ATTRIBUTES ); |
| 134 | 134 | $wildcards = []; |
| 135 | 135 | foreach( static::GLOBAL_WILDCARD_ATTRIBUTES as $wildcard ) { |
| 136 | - $newWildcards = array_filter( $this->attributes, function( $key ) use( $wildcard ) { |
|
| 136 | + $newWildcards = array_filter( $this->attributes, function( $key ) use($wildcard) { |
|
| 137 | 137 | return glsr( Helper::class )->startsWith( $wildcard, $key ); |
| 138 | 138 | }, ARRAY_FILTER_USE_KEY ); |
| 139 | 139 | $wildcards = array_merge( $wildcards, $newWildcards ); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | protected function getPermanentAttributes() |
| 148 | 148 | { |
| 149 | 149 | $permanentAttributes = []; |
| 150 | - if( array_key_exists( 'value', $this->attributes )) { |
|
| 150 | + if( array_key_exists( 'value', $this->attributes ) ) { |
|
| 151 | 151 | $permanentAttributes['value'] = $this->attributes['value']; |
| 152 | 152 | } |
| 153 | 153 | return $permanentAttributes; |
@@ -199,11 +199,11 @@ discard block |
||
| 199 | 199 | protected function normalizeBooleanAttributes() |
| 200 | 200 | { |
| 201 | 201 | foreach( $this->attributes as $key => $value ) { |
| 202 | - if( $this->isAttributeKeyNumeric( $key, $value )) { |
|
| 202 | + if( $this->isAttributeKeyNumeric( $key, $value ) ) { |
|
| 203 | 203 | $key = $value; |
| 204 | 204 | $value = true; |
| 205 | 205 | } |
| 206 | - if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ))continue; |
|
| 206 | + if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ) )continue; |
|
| 207 | 207 | $this->attributes[$key] = wp_validate_boolean( $value ); |
| 208 | 208 | } |
| 209 | 209 | } |
@@ -214,13 +214,13 @@ discard block |
||
| 214 | 214 | protected function normalizeDataAttributes() |
| 215 | 215 | { |
| 216 | 216 | foreach( $this->attributes as $key => $value ) { |
| 217 | - if( $this->isAttributeKeyNumeric( $key, $value )) { |
|
| 217 | + if( $this->isAttributeKeyNumeric( $key, $value ) ) { |
|
| 218 | 218 | $key = $value; |
| 219 | 219 | $value = ''; |
| 220 | 220 | } |
| 221 | - if( !glsr( Helper::class )->startsWith( 'data-', $key ))continue; |
|
| 222 | - if( is_array( $value )) { |
|
| 223 | - $value = json_encode( $value, JSON_HEX_APOS|JSON_NUMERIC_CHECK|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE ); |
|
| 221 | + if( !glsr( Helper::class )->startsWith( 'data-', $key ) )continue; |
|
| 222 | + if( is_array( $value ) ) { |
|
| 223 | + $value = json_encode( $value, JSON_HEX_APOS | JSON_NUMERIC_CHECK | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); |
|
| 224 | 224 | } |
| 225 | 225 | $this->attributes[$key] = $value; |
| 226 | 226 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | protected function normalizeStringAttributes() |
| 233 | 233 | { |
| 234 | 234 | foreach( $this->attributes as $key => $value ) { |
| 235 | - if( !is_string( $value ))continue; |
|
| 235 | + if( !is_string( $value ) )continue; |
|
| 236 | 236 | $this->attributes[$key] = trim( $value ); |
| 237 | 237 | } |
| 238 | 238 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | { |
| 246 | 246 | if( $method != 'input' )return; |
| 247 | 247 | $attributes = wp_parse_args( $this->attributes, ['type' => ''] ); |
| 248 | - if( !in_array( $attributes['type'], static::INPUT_TYPES )) { |
|
| 248 | + if( !in_array( $attributes['type'], static::INPUT_TYPES ) ) { |
|
| 249 | 249 | $this->attributes['type'] = 'text'; |
| 250 | 250 | } |
| 251 | 251 | } |
@@ -259,11 +259,11 @@ discard block |
||
| 259 | 259 | $permanentAttributes = $this->getPermanentAttributes(); |
| 260 | 260 | foreach( $this->attributes as $key => $value ) { |
| 261 | 261 | if( in_array( $key, static::BOOLEAN_ATTRIBUTES ) && !$value ) { |
| 262 | - unset( $attributes[$key] ); |
|
| 262 | + unset($attributes[$key]); |
|
| 263 | 263 | } |
| 264 | - if( glsr( Helper::class )->startsWith( 'data-', $key )) { |
|
| 264 | + if( glsr( Helper::class )->startsWith( 'data-', $key ) ) { |
|
| 265 | 265 | $permanentAttributes[$key] = $value; |
| 266 | - unset( $attributes[$key] ); |
|
| 266 | + unset($attributes[$key]); |
|
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | 269 | $this->attributes = array_merge( array_filter( $attributes ), $permanentAttributes ); |
@@ -203,7 +203,9 @@ discard block |
||
| 203 | 203 | $key = $value; |
| 204 | 204 | $value = true; |
| 205 | 205 | } |
| 206 | - if( !in_array( $key, static::BOOLEAN_ATTRIBUTES ))continue; |
|
| 206 | + if( !in_array( $key, static::BOOLEAN_ATTRIBUTES )) { |
|
| 207 | + continue; |
|
| 208 | + } |
|
| 207 | 209 | $this->attributes[$key] = wp_validate_boolean( $value ); |
| 208 | 210 | } |
| 209 | 211 | } |
@@ -218,7 +220,9 @@ discard block |
||
| 218 | 220 | $key = $value; |
| 219 | 221 | $value = ''; |
| 220 | 222 | } |
| 221 | - if( !glsr( Helper::class )->startsWith( 'data-', $key ))continue; |
|
| 223 | + if( !glsr( Helper::class )->startsWith( 'data-', $key )) { |
|
| 224 | + continue; |
|
| 225 | + } |
|
| 222 | 226 | if( is_array( $value )) { |
| 223 | 227 | $value = json_encode( $value, JSON_HEX_APOS|JSON_NUMERIC_CHECK|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE ); |
| 224 | 228 | } |
@@ -232,7 +236,9 @@ discard block |
||
| 232 | 236 | protected function normalizeStringAttributes() |
| 233 | 237 | { |
| 234 | 238 | foreach( $this->attributes as $key => $value ) { |
| 235 | - if( !is_string( $value ))continue; |
|
| 239 | + if( !is_string( $value )) { |
|
| 240 | + continue; |
|
| 241 | + } |
|
| 236 | 242 | $this->attributes[$key] = trim( $value ); |
| 237 | 243 | } |
| 238 | 244 | } |
@@ -243,7 +249,9 @@ discard block |
||
| 243 | 249 | */ |
| 244 | 250 | protected function normalizeInputType( $method ) |
| 245 | 251 | { |
| 246 | - if( $method != 'input' )return; |
|
| 252 | + if( $method != 'input' ) { |
|
| 253 | + return; |
|
| 254 | + } |
|
| 247 | 255 | $attributes = wp_parse_args( $this->attributes, ['type' => ''] ); |
| 248 | 256 | if( !in_array( $attributes['type'], static::INPUT_TYPES )) { |
| 249 | 257 | $this->attributes['type'] = 'text'; |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | $this->newSettings = $this->getNewSettings(); |
| 76 | 76 | $this->oldSettings = $this->getOldSettings(); |
| 77 | - if( empty( $this->oldSettings ))return; |
|
| 77 | + if( empty($this->oldSettings) )return; |
|
| 78 | 78 | foreach( static::MAPPED_SETTINGS as $old => $new ) { |
| 79 | - if( empty( $this->oldSettings[$old] ))continue; |
|
| 79 | + if( empty($this->oldSettings[$old]) )continue; |
|
| 80 | 80 | $this->newSettings[$new] = $this->oldSettings[$old]; |
| 81 | 81 | } |
| 82 | 82 | $this->migrateNotificationSettings(); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $this->migrateRequiredSettings(); |
| 85 | 85 | $oldSettings = glsr( Helper::class )->convertDotNotationArray( $this->oldSettings ); |
| 86 | 86 | $newSettings = glsr( Helper::class )->convertDotNotationArray( $this->newSettings ); |
| 87 | - if( isset( $oldSettings['settings']['strings'] ) && is_array( $oldSettings['settings']['strings'] )) { |
|
| 87 | + if( isset($oldSettings['settings']['strings']) && is_array( $oldSettings['settings']['strings'] ) ) { |
|
| 88 | 88 | $newSettings['settings']['strings'] = $oldSettings['settings']['strings']; |
| 89 | 89 | } |
| 90 | 90 | glsr( OptionManager::class )->set( $newSettings ); |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | protected function getOldSettings() |
| 118 | 118 | { |
| 119 | 119 | $defaults = array_fill_keys( array_keys( static::MAPPED_SETTINGS ), '' ); |
| 120 | - $settings = glsr( Helper::class )->flattenArray( get_option( 'geminilabs_site_reviews-v2', [] )); |
|
| 121 | - if( !empty( $settings )) { |
|
| 120 | + $settings = glsr( Helper::class )->flattenArray( get_option( 'geminilabs_site_reviews-v2', [] ) ); |
|
| 121 | + if( !empty($settings) ) { |
|
| 122 | 122 | $settings = wp_parse_args( $settings, $defaults ); |
| 123 | 123 | } |
| 124 | 124 | return $settings; |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | 'SecretKey' => $this->oldSettings['settings.reviews-form.recaptcha.secret'], |
| 152 | 152 | 'SiteKey' => $this->oldSettings['settings.reviews-form.recaptcha.key'], |
| 153 | 153 | ]; |
| 154 | - if( in_array( $this->oldSettings['settings.reviews-form.recaptcha.integration'], ['custom', 'invisible-recaptcha'] )) { |
|
| 154 | + if( in_array( $this->oldSettings['settings.reviews-form.recaptcha.integration'], ['custom', 'invisible-recaptcha'] ) ) { |
|
| 155 | 155 | $this->newSettings['settings.submissions.recaptcha.integration'] = 'all'; |
| 156 | 156 | } |
| 157 | 157 | if( $this->oldSettings['settings.reviews-form.recaptcha.integration'] == 'invisible-recaptcha' ) { |
@@ -74,9 +74,13 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | $this->newSettings = $this->getNewSettings(); |
| 76 | 76 | $this->oldSettings = $this->getOldSettings(); |
| 77 | - if( empty( $this->oldSettings ))return; |
|
| 77 | + if( empty( $this->oldSettings )) { |
|
| 78 | + return; |
|
| 79 | + } |
|
| 78 | 80 | foreach( static::MAPPED_SETTINGS as $old => $new ) { |
| 79 | - if( empty( $this->oldSettings[$old] ))continue; |
|
| 81 | + if( empty( $this->oldSettings[$old] )) { |
|
| 82 | + continue; |
|
| 83 | + } |
|
| 80 | 84 | $this->newSettings[$new] = $this->oldSettings[$old]; |
| 81 | 85 | } |
| 82 | 86 | $this->migrateNotificationSettings(); |
@@ -136,7 +140,9 @@ discard block |
||
| 136 | 140 | ]; |
| 137 | 141 | $this->newSettings['settings.general.notifications'] = []; |
| 138 | 142 | foreach( $notifications as $old => $new ) { |
| 139 | - if( $this->oldSettings['settings.general.notification'] != $old )continue; |
|
| 143 | + if( $this->oldSettings['settings.general.notification'] != $old ) { |
|
| 144 | + continue; |
|
| 145 | + } |
|
| 140 | 146 | $this->newSettings['settings.general.notifications'][] = $new; |
| 141 | 147 | } |
| 142 | 148 | } |
@@ -14,14 +14,14 @@ |
||
| 14 | 14 | { |
| 15 | 15 | foreach( $command->popups as $slug => $label ) { |
| 16 | 16 | $buttonClass = glsr( Helper::class )->buildClassName( $slug.'-popup', 'Shortcodes' ); |
| 17 | - if( !class_exists( $buttonClass )) { |
|
| 18 | - glsr_log()->error( sprintf( 'Class missing (%s)', $buttonClass )); |
|
| 17 | + if( !class_exists( $buttonClass ) ) { |
|
| 18 | + glsr_log()->error( sprintf( 'Class missing (%s)', $buttonClass ) ); |
|
| 19 | 19 | continue; |
| 20 | 20 | } |
| 21 | 21 | $shortcode = glsr( $buttonClass )->register( $slug, [ |
| 22 | 22 | 'label' => $label, |
| 23 | 23 | 'title' => $label, |
| 24 | - ]); |
|
| 24 | + ] ); |
|
| 25 | 25 | glsr()->mceShortcodes[$slug] = $shortcode->properties; |
| 26 | 26 | } |
| 27 | 27 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function build( array $args = [] ) |
| 14 | 14 | { |
| 15 | - require_once( ABSPATH.'wp-admin/includes/template.php' ); |
|
| 15 | + require_once(ABSPATH.'wp-admin/includes/template.php'); |
|
| 16 | 16 | ob_start(); |
| 17 | 17 | wp_star_rating( $args ); |
| 18 | 18 | $stars = ob_get_clean(); |
@@ -1,14 +1,14 @@ discard block |
||
| 1 | 1 | <?php defined( 'WPINC' ) || die; ?> |
| 2 | 2 | |
| 3 | 3 | <div id="titlediv"> |
| 4 | - <input type="text" id="title" value="<?= $post->post_title ? esc_attr( $post->post_title ) : sprintf( '(%s)', __( 'no title', 'site-reviews' )); ?>" readonly> |
|
| 4 | + <input type="text" id="title" value="<?= $post->post_title ? esc_attr( $post->post_title ) : sprintf( '(%s)', __( 'no title', 'site-reviews' ) ); ?>" readonly> |
|
| 5 | 5 | </div> |
| 6 | 6 | |
| 7 | 7 | <div id="contentdiv"> |
| 8 | 8 | <textarea readonly><?= esc_attr( $post->post_content ); ?></textarea> |
| 9 | 9 | </div> |
| 10 | 10 | |
| 11 | -<?php if( empty( $response ))return; ?> |
|
| 11 | +<?php if( empty($response) )return; ?> |
|
| 12 | 12 | |
| 13 | 13 | <div class="postbox glsr-response-postbox"> |
| 14 | 14 | <button type="button" class="handlediv" aria-expanded="true"> |
@@ -19,6 +19,6 @@ discard block |
||
| 19 | 19 | <span><?= __( 'Public Response', 'site-reviews' ); ?></span> |
| 20 | 20 | </h2> |
| 21 | 21 | <div class="inside"> |
| 22 | - <?= wpautop( esc_attr( $response )); ?> |
|
| 22 | + <?= wpautop( esc_attr( $response ) ); ?> |
|
| 23 | 23 | </div> |
| 24 | 24 | </div> |
@@ -8,7 +8,10 @@ |
||
| 8 | 8 | <textarea readonly><?= esc_attr( $post->post_content ); ?></textarea> |
| 9 | 9 | </div> |
| 10 | 10 | |
| 11 | -<?php if( empty( $response ))return; ?> |
|
| 11 | +<?php if( empty( $response )) { |
|
| 12 | + return; |
|
| 13 | +} |
|
| 14 | +?> |
|
| 12 | 15 | |
| 13 | 16 | <div class="postbox glsr-response-postbox"> |
| 14 | 17 | <button type="button" class="handlediv" aria-expanded="true"> |
@@ -13,14 +13,14 @@ discard block |
||
| 13 | 13 | public function getPost( $postId ) |
| 14 | 14 | { |
| 15 | 15 | $postId = trim( $postId ); |
| 16 | - if( empty( $postId ) || !is_numeric( $postId ))return; |
|
| 16 | + if( empty($postId) || !is_numeric( $postId ) )return; |
|
| 17 | 17 | if( $this->isEnabled() ) { |
| 18 | - $polylangPostId = pll_get_post( $postId, pll_get_post_language( get_the_ID() )); |
|
| 18 | + $polylangPostId = pll_get_post( $postId, pll_get_post_language( get_the_ID() ) ); |
|
| 19 | 19 | } |
| 20 | - if( !empty( $polylangPostId )) { |
|
| 20 | + if( !empty($polylangPostId) ) { |
|
| 21 | 21 | $postId = $polylangPostId; |
| 22 | 22 | } |
| 23 | - return get_post( intval( $postId )); |
|
| 23 | + return get_post( intval( $postId ) ); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | foreach( $this->cleanIds( $postIds ) as $postId ) { |
| 36 | 36 | $newPostIds = array_merge( |
| 37 | 37 | $newPostIds, |
| 38 | - array_values( pll_get_post_translations( $postId )) |
|
| 38 | + array_values( pll_get_post_translations( $postId ) ) |
|
| 39 | 39 | ); |
| 40 | 40 | } |
| 41 | 41 | return $this->cleanIds( $newPostIds ); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | protected function cleanIds( array $postIds ) |
| 77 | 77 | { |
| 78 | - return array_filter( array_unique( $postIds )); |
|
| 78 | + return array_filter( array_unique( $postIds ) ); |
|
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
@@ -13,7 +13,9 @@ |
||
| 13 | 13 | public function getPost( $postId ) |
| 14 | 14 | { |
| 15 | 15 | $postId = trim( $postId ); |
| 16 | - if( empty( $postId ) || !is_numeric( $postId ))return; |
|
| 16 | + if( empty( $postId ) || !is_numeric( $postId )) { |
|
| 17 | + return; |
|
| 18 | + } |
|
| 17 | 19 | if( $this->isEnabled() ) { |
| 18 | 20 | $polylangPostId = pll_get_post( $postId, pll_get_post_language( get_the_ID() )); |
| 19 | 21 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public function download( $filename, $content ) |
| 17 | 17 | { |
| 18 | - if( !current_user_can( glsr()->constant( 'CAPABILITY' )))return; |
|
| 18 | + if( !current_user_can( glsr()->constant( '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,7 +49,7 @@ 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 | |
| 55 | 55 | /** |
@@ -15,7 +15,9 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function download( $filename, $content ) |
| 17 | 17 | { |
| 18 | - if( !current_user_can( glsr()->constant( 'CAPABILITY' )))return; |
|
| 18 | + if( !current_user_can( glsr()->constant( 'CAPABILITY' ))) { |
|
| 19 | + return; |
|
| 20 | + } |
|
| 19 | 21 | nocache_headers(); |
| 20 | 22 | header( 'Content-Type: text/plain' ); |
| 21 | 23 | header( 'Content-Disposition: attachment; filename="'.$filename.'"' ); |