@@ -17,13 +17,13 @@ discard block |
||
| 17 | 17 | $review = glsr( ReviewManager::class )->create( $command ); |
| 18 | 18 | if( !$review ) { |
| 19 | 19 | glsr( Session::class )->set( $command->form_id.'errors', [] ); |
| 20 | - glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' )); |
|
| 20 | + glsr( Session::class )->set( $command->form_id.'message', __( 'Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews' ) ); |
|
| 21 | 21 | return; |
| 22 | 22 | } |
| 23 | - glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' )); |
|
| 23 | + glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' ) ); |
|
| 24 | 24 | glsr( Notification::class )->send( $review ); |
| 25 | 25 | if( $command->ajax_request )return; |
| 26 | - wp_safe_redirect( $this->getReferer( $command )); |
|
| 26 | + wp_safe_redirect( $this->getReferer( $command ) ); |
|
| 27 | 27 | exit; |
| 28 | 28 | } |
| 29 | 29 | |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | protected function getReferer( Command $command ) |
| 34 | 34 | { |
| 35 | - $referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ))); |
|
| 36 | - if( empty( $referer )) { |
|
| 35 | + $referer = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) ); |
|
| 36 | + if( empty($referer) ) { |
|
| 37 | 37 | $referer = $command->referer; |
| 38 | 38 | } |
| 39 | - if( empty( $referer )) { |
|
| 39 | + if( empty($referer) ) { |
|
| 40 | 40 | glsr_log()->warning( 'The form referer ($_SERVER[REQUEST_URI]) was empty.' )->info( $command ); |
| 41 | 41 | $referer = home_url(); |
| 42 | 42 | } |
@@ -22,7 +22,9 @@ |
||
| 22 | 22 | } |
| 23 | 23 | glsr( Session::class )->set( $command->form_id.'message', __( 'Your review has been submitted!', 'site-reviews' )); |
| 24 | 24 | glsr( Notification::class )->send( $review ); |
| 25 | - if( $command->ajax_request )return; |
|
| 25 | + if( $command->ajax_request ) { |
|
| 26 | + return; |
|
| 27 | + } |
|
| 26 | 28 | wp_safe_redirect( $this->getReferer( $command )); |
| 27 | 29 | exit; |
| 28 | 30 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | { |
| 29 | 29 | $fields = []; |
| 30 | 30 | foreach( glsr()->config( 'forms/'.$id ) as $name => $field ) { |
| 31 | - $fields[] = new Field( wp_parse_args( $field, ['name' => $name] )); |
|
| 31 | + $fields[] = new Field( wp_parse_args( $field, ['name' => $name] ) ); |
|
| 32 | 32 | } |
| 33 | 33 | return $fields; |
| 34 | 34 | } |
@@ -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 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | function glsr( $alias = null ) { |
| 8 | 8 | $app = \GeminiLabs\SiteReviews\Application::load(); |
| 9 | - return !empty( $alias ) |
|
| 9 | + return !empty($alias) |
|
| 10 | 10 | ? $app->make( $alias ) |
| 11 | 11 | : $app; |
| 12 | 12 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * @return false|\GeminiLabs\SiteReviews\Review |
| 16 | 16 | */ |
| 17 | 17 | function glsr_create_review( array $reviewValues = [] ) { |
| 18 | - if( empty( $reviewValues )) { |
|
| 18 | + if( empty($reviewValues) ) { |
|
| 19 | 19 | return false; |
| 20 | 20 | } |
| 21 | 21 | $review = new \GeminiLabs\SiteReviews\Commands\CreateReview( $reviewValues ); |
@@ -26,10 +26,10 @@ discard block |
||
| 26 | 26 | * @return \WP_Screen|object |
| 27 | 27 | */ |
| 28 | 28 | function glsr_current_screen() { |
| 29 | - if( function_exists( 'get_current_screen' )) { |
|
| 29 | + if( function_exists( 'get_current_screen' ) ) { |
|
| 30 | 30 | $screen = get_current_screen(); |
| 31 | 31 | } |
| 32 | - return empty( $screen ) |
|
| 32 | + return empty($screen) |
|
| 33 | 33 | ? (object)array_fill_keys( ['base', 'id', 'post_type'], null ) |
| 34 | 34 | : $screen; |
| 35 | 35 | } |
@@ -92,11 +92,11 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | function glsr_log() { |
| 94 | 94 | $args = func_get_args(); |
| 95 | - $context = isset( $args[1] ) |
|
| 95 | + $context = isset($args[1]) |
|
| 96 | 96 | ? $args[1] |
| 97 | 97 | : []; |
| 98 | 98 | $console = glsr( 'Modules\Console' ); |
| 99 | - return !empty( $args ) |
|
| 99 | + return !empty($args) |
|
| 100 | 100 | ? $console->log( 'debug', $args[0], $context ) |
| 101 | 101 | : $console; |
| 102 | 102 | } |
@@ -4,7 +4,8 @@ discard block |
||
| 4 | 4 | /** |
| 5 | 5 | * @return mixed |
| 6 | 6 | */ |
| 7 | -function glsr( $alias = null ) { |
|
| 7 | +function glsr( $alias = null ) |
|
| 8 | +{ |
|
| 8 | 9 | $app = \GeminiLabs\SiteReviews\Application::load(); |
| 9 | 10 | return !empty( $alias ) |
| 10 | 11 | ? $app->make( $alias ) |
@@ -14,7 +15,8 @@ discard block |
||
| 14 | 15 | /** |
| 15 | 16 | * @return false|\GeminiLabs\SiteReviews\Review |
| 16 | 17 | */ |
| 17 | -function glsr_create_review( array $reviewValues = [] ) { |
|
| 18 | +function glsr_create_review( array $reviewValues = [] ) |
|
| 19 | +{ |
|
| 18 | 20 | if( empty( $reviewValues )) { |
| 19 | 21 | return false; |
| 20 | 22 | } |
@@ -25,7 +27,8 @@ discard block |
||
| 25 | 27 | /** |
| 26 | 28 | * @return \WP_Screen|object |
| 27 | 29 | */ |
| 28 | -function glsr_current_screen() { |
|
| 30 | +function glsr_current_screen() |
|
| 31 | +{ |
|
| 29 | 32 | if( function_exists( 'get_current_screen' )) { |
| 30 | 33 | $screen = get_current_screen(); |
| 31 | 34 | } |
@@ -38,7 +41,8 @@ discard block |
||
| 38 | 41 | * @param mixed ...$vars |
| 39 | 42 | * @return void |
| 40 | 43 | */ |
| 41 | -function glsr_debug( ...$vars ) { |
|
| 44 | +function glsr_debug( ...$vars ) |
|
| 45 | +{ |
|
| 42 | 46 | if( count( $vars ) == 1 ) { |
| 43 | 47 | $value = htmlspecialchars( print_r( $vars[0], true ), ENT_QUOTES, 'UTF-8' ); |
| 44 | 48 | printf( '<div class="glsr-debug"><pre>%s</pre></div>', $value ); |
@@ -57,14 +61,16 @@ discard block |
||
| 57 | 61 | * @param mixed $fallback |
| 58 | 62 | * @return string|array |
| 59 | 63 | */ |
| 60 | -function glsr_get_option( $path = '', $fallback = '' ) { |
|
| 64 | +function glsr_get_option( $path = '', $fallback = '' ) |
|
| 65 | +{ |
|
| 61 | 66 | return glsr( 'Database\OptionManager' )->get( 'settings.'.$path, $fallback ); |
| 62 | 67 | } |
| 63 | 68 | |
| 64 | 69 | /** |
| 65 | 70 | * @return array |
| 66 | 71 | */ |
| 67 | -function glsr_get_options() { |
|
| 72 | +function glsr_get_options() |
|
| 73 | +{ |
|
| 68 | 74 | return glsr( 'Database\OptionManager' )->get( 'settings' ); |
| 69 | 75 | } |
| 70 | 76 | |
@@ -72,7 +78,8 @@ discard block |
||
| 72 | 78 | * @param int $post_id |
| 73 | 79 | * @return void|\GeminiLabs\SiteReviews\Review |
| 74 | 80 | */ |
| 75 | -function glsr_get_review( $post_id ) { |
|
| 81 | +function glsr_get_review( $post_id ) |
|
| 82 | +{ |
|
| 76 | 83 | $post = get_post( $post_id ); |
| 77 | 84 | if( $post instanceof WP_Post ) { |
| 78 | 85 | return glsr( 'Database\ReviewManager' )->single( $post ); |
@@ -83,14 +90,16 @@ discard block |
||
| 83 | 90 | * @return array |
| 84 | 91 | * @todo document change of $reviews->reviews to $reviews->results |
| 85 | 92 | */ |
| 86 | -function glsr_get_reviews( array $args = array() ) { |
|
| 93 | +function glsr_get_reviews( array $args = array() ) |
|
| 94 | +{ |
|
| 87 | 95 | return glsr( 'Database\ReviewManager' )->get( $args ); |
| 88 | 96 | } |
| 89 | 97 | |
| 90 | 98 | /** |
| 91 | 99 | * @return \GeminiLabs\SiteReviews\Modules\Console |
| 92 | 100 | */ |
| 93 | -function glsr_log() { |
|
| 101 | +function glsr_log() |
|
| 102 | +{ |
|
| 94 | 103 | $args = func_get_args(); |
| 95 | 104 | $context = isset( $args[1] ) |
| 96 | 105 | ? $args[1] |
@@ -13,15 +13,15 @@ discard block |
||
| 13 | 13 | public function fields() |
| 14 | 14 | { |
| 15 | 15 | return [[ |
| 16 | - 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' )), |
|
| 16 | + 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' ) ), |
|
| 17 | 17 | 'minWidth' => 320, |
| 18 | 18 | 'type' => 'container', |
| 19 | - ],[ |
|
| 19 | + ], [ |
|
| 20 | 20 | 'label' => esc_html__( 'Title', 'site-reviews' ), |
| 21 | 21 | 'name' => 'title', |
| 22 | 22 | 'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ), |
| 23 | 23 | 'type' => 'textbox', |
| 24 | - ],[ |
|
| 24 | + ], [ |
|
| 25 | 25 | 'label' => esc_html__( 'Count', 'site-reviews' ), |
| 26 | 26 | 'maxLength' => 5, |
| 27 | 27 | 'name' => 'count', |
@@ -29,20 +29,20 @@ discard block |
||
| 29 | 29 | 'text' => '10', |
| 30 | 30 | 'tooltip' => __( 'How many reviews would you like to display (default: 10)?', 'site-reviews' ), |
| 31 | 31 | 'type' => 'textbox', |
| 32 | - ],[ |
|
| 32 | + ], [ |
|
| 33 | 33 | 'label' => esc_html__( 'Rating', 'site-reviews' ), |
| 34 | 34 | 'name' => 'rating', |
| 35 | 35 | 'options' => [ |
| 36 | - '5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 )), |
|
| 37 | - '4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 )), |
|
| 38 | - '3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 )), |
|
| 39 | - '2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 )), |
|
| 40 | - '1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 )), |
|
| 41 | - '0' => esc_html( __( 'Unrated', 'site-reviews' )), |
|
| 36 | + '5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 ) ), |
|
| 37 | + '4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 ) ), |
|
| 38 | + '3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 ) ), |
|
| 39 | + '2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ) ), |
|
| 40 | + '1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ) ), |
|
| 41 | + '0' => esc_html( __( 'Unrated', 'site-reviews' ) ), |
|
| 42 | 42 | ], |
| 43 | 43 | 'tooltip' => __( 'What is the minimum rating to display (default: 1 star)?', 'site-reviews' ), |
| 44 | 44 | 'type' => 'listbox', |
| 45 | - ],[ |
|
| 45 | + ], [ |
|
| 46 | 46 | 'label' => esc_html__( 'Pagination', 'site-reviews' ), |
| 47 | 47 | 'name' => 'pagination', |
| 48 | 48 | 'options' => [ |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | 'name' => 'assigned_to', |
| 61 | 61 | 'tooltip' => __( 'Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page.', 'site-reviews' ), |
| 62 | 62 | 'type' => 'textbox', |
| 63 | - ],[ |
|
| 63 | + ], [ |
|
| 64 | 64 | 'label' => esc_html__( 'Schema', 'site-reviews' ), |
| 65 | 65 | 'name' => 'schema', |
| 66 | 66 | 'options' => [ |
@@ -69,49 +69,49 @@ discard block |
||
| 69 | 69 | ], |
| 70 | 70 | 'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ), |
| 71 | 71 | 'type' => 'listbox', |
| 72 | - ],[ |
|
| 72 | + ], [ |
|
| 73 | 73 | 'label' => esc_html__( 'Classes', 'site-reviews' ), |
| 74 | 74 | 'name' => 'class', |
| 75 | 75 | 'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ), |
| 76 | 76 | 'type' => 'textbox', |
| 77 | - ],[ |
|
| 77 | + ], [ |
|
| 78 | 78 | 'columns' => 2, |
| 79 | 79 | 'items' => [[ |
| 80 | 80 | 'name' => 'hide_assigned_to', |
| 81 | 81 | 'text' => esc_html__( 'Assigned To', 'site-reviews' ), |
| 82 | 82 | 'tooltip' => __( 'Hide the assigned to link?', 'site-reviews' ), |
| 83 | 83 | 'type' => 'checkbox', |
| 84 | - ],[ |
|
| 84 | + ], [ |
|
| 85 | 85 | 'name' => 'hide_author', |
| 86 | 86 | 'text' => esc_html__( 'Author', 'site-reviews' ), |
| 87 | 87 | 'tooltip' => __( 'Hide the review author?', 'site-reviews' ), |
| 88 | 88 | 'type' => 'checkbox', |
| 89 | - ],[ |
|
| 89 | + ], [ |
|
| 90 | 90 | 'name' => 'hide_avatar', |
| 91 | 91 | 'text' => esc_html__( 'Avatar', 'site-reviews' ), |
| 92 | 92 | 'tooltip' => __( 'Hide the reviewer avatar if shown?', 'site-reviews' ), |
| 93 | 93 | 'type' => 'checkbox', |
| 94 | - ],[ |
|
| 94 | + ], [ |
|
| 95 | 95 | 'name' => 'hide_content', |
| 96 | 96 | 'text' => esc_html__( 'Content', 'site-reviews' ), |
| 97 | 97 | 'tooltip' => __( 'Hide the review content?', 'site-reviews' ), |
| 98 | 98 | 'type' => 'checkbox', |
| 99 | - ],[ |
|
| 99 | + ], [ |
|
| 100 | 100 | 'name' => 'hide_date', |
| 101 | 101 | 'text' => esc_html__( 'Date', 'site-reviews' ), |
| 102 | 102 | 'tooltip' => __( 'Hide the review date?', 'site-reviews' ), |
| 103 | 103 | 'type' => 'checkbox', |
| 104 | - ],[ |
|
| 104 | + ], [ |
|
| 105 | 105 | 'name' => 'hide_rating', |
| 106 | 106 | 'text' => esc_html__( 'Rating', 'site-reviews' ), |
| 107 | 107 | 'tooltip' => __( 'Hide the review rating?', 'site-reviews' ), |
| 108 | 108 | 'type' => 'checkbox', |
| 109 | - ],[ |
|
| 109 | + ], [ |
|
| 110 | 110 | 'name' => 'hide_response', |
| 111 | 111 | 'text' => esc_html__( 'Response', 'site-reviews' ), |
| 112 | 112 | 'tooltip' => __( 'Hide the review response?', 'site-reviews' ), |
| 113 | 113 | 'type' => 'checkbox', |
| 114 | - ],[ |
|
| 114 | + ], [ |
|
| 115 | 115 | 'name' => 'hide_title', |
| 116 | 116 | 'text' => esc_html__( 'Title', 'site-reviews' ), |
| 117 | 117 | 'tooltip' => __( 'Hide the review title?', 'site-reviews' ), |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | 'label' => esc_html__( 'Hide', 'site-reviews' ), |
| 122 | 122 | 'spacing' => 5, |
| 123 | 123 | 'type' => 'container', |
| 124 | - ],[ |
|
| 124 | + ], [ |
|
| 125 | 125 | 'hidden' => true, |
| 126 | 126 | 'name' => 'id', |
| 127 | 127 | 'type' => 'textbox', |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | public function getTerms() |
| 135 | 135 | { |
| 136 | 136 | $terms = glsr( Database::class )->getTerms(); |
| 137 | - if( empty( $terms )) { |
|
| 137 | + if( empty($terms) ) { |
|
| 138 | 138 | return []; |
| 139 | 139 | } |
| 140 | 140 | return [ |
@@ -15,12 +15,12 @@ discard block |
||
| 15 | 15 | return [[ |
| 16 | 16 | 'type' => 'container', |
| 17 | 17 | 'html' => '<p class="strong">'.esc_html__( 'All settings are optional.', 'site-reviews' ).'</p>', |
| 18 | - ],[ |
|
| 18 | + ], [ |
|
| 19 | 19 | 'label' => esc_html__( 'Title', 'site-reviews' ), |
| 20 | 20 | 'name' => 'title', |
| 21 | 21 | 'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ), |
| 22 | 22 | 'type' => 'textbox', |
| 23 | - ],[ |
|
| 23 | + ], [ |
|
| 24 | 24 | 'label' => esc_html__( 'Description', 'site-reviews' ), |
| 25 | 25 | 'minHeight' => 60, |
| 26 | 26 | 'minWidth' => 240, |
@@ -35,39 +35,39 @@ discard block |
||
| 35 | 35 | 'name' => 'assign_to', |
| 36 | 36 | 'tooltip' => __( 'Assign submitted reviews to a custom page/post ID. You can also enter "post_id" to assign reviews to the ID of the current page.', 'site-reviews' ), |
| 37 | 37 | 'type' => 'textbox', |
| 38 | - ],[ |
|
| 38 | + ], [ |
|
| 39 | 39 | 'label' => esc_html__( 'Classes', 'site-reviews' ), |
| 40 | 40 | 'name' => 'class', |
| 41 | 41 | 'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ), |
| 42 | 42 | 'type' => 'textbox', |
| 43 | - ],[ |
|
| 43 | + ], [ |
|
| 44 | 44 | 'columns' => 2, |
| 45 | 45 | 'items' => [[ |
| 46 | 46 | 'name' => 'hide_content', |
| 47 | 47 | 'text' => esc_html__( 'Content', 'site-reviews' ), |
| 48 | 48 | 'tooltip' => __( 'Hide the content field?', 'site-reviews' ), |
| 49 | 49 | 'type' => 'checkbox', |
| 50 | - ],[ |
|
| 50 | + ], [ |
|
| 51 | 51 | 'name' => 'hide_email', |
| 52 | 52 | 'text' => esc_html__( 'Email', 'site-reviews' ), |
| 53 | 53 | 'tooltip' => __( 'Hide the email field?', 'site-reviews' ), |
| 54 | 54 | 'type' => 'checkbox', |
| 55 | - ],[ |
|
| 55 | + ], [ |
|
| 56 | 56 | 'name' => 'hide_name', |
| 57 | 57 | 'text' => esc_html__( 'Name', 'site-reviews' ), |
| 58 | 58 | 'tooltip' => __( 'Hide the name field?', 'site-reviews' ), |
| 59 | 59 | 'type' => 'checkbox', |
| 60 | - ],[ |
|
| 60 | + ], [ |
|
| 61 | 61 | 'name' => 'hide_rating', |
| 62 | 62 | 'text' => esc_html__( 'Rating', 'site-reviews' ), |
| 63 | 63 | 'tooltip' => __( 'Hide the rating field?', 'site-reviews' ), |
| 64 | 64 | 'type' => 'checkbox', |
| 65 | - ],[ |
|
| 65 | + ], [ |
|
| 66 | 66 | 'name' => 'hide_terms', |
| 67 | 67 | 'text' => esc_html__( 'Terms', 'site-reviews' ), |
| 68 | 68 | 'tooltip' => __( 'Hide the terms field?', 'site-reviews' ), |
| 69 | 69 | 'type' => 'checkbox', |
| 70 | - ],[ |
|
| 70 | + ], [ |
|
| 71 | 71 | 'name' => 'hide_title', |
| 72 | 72 | 'text' => esc_html__( 'Title', 'site-reviews' ), |
| 73 | 73 | 'tooltip' => __( 'Hide the title field?', 'site-reviews' ), |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | 'layout' => 'grid', |
| 78 | 78 | 'spacing' => 5, |
| 79 | 79 | 'type' => 'container', |
| 80 | - ],[ |
|
| 80 | + ], [ |
|
| 81 | 81 | 'hidden' => true, |
| 82 | 82 | 'name' => 'id', |
| 83 | 83 | 'type' => 'textbox', |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | public function getTerms() |
| 91 | 91 | { |
| 92 | 92 | $terms = glsr( Database::class )->getTerms(); |
| 93 | - if( empty( $terms )) { |
|
| 93 | + if( empty($terms) ) { |
|
| 94 | 94 | return []; |
| 95 | 95 | } |
| 96 | 96 | return [ |