@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function get() |
110 | 110 | { |
111 | - return empty( $this->log ) |
|
111 | + return empty($this->log) |
|
112 | 112 | ? __( 'Log is empty', 'site-reviews' ) |
113 | 113 | : $this->log; |
114 | 114 | } |
@@ -120,11 +120,11 @@ discard block |
||
120 | 120 | public function humanSize( $valueIfEmpty = null ) |
121 | 121 | { |
122 | 122 | $bytes = $this->size(); |
123 | - if( empty( $bytes ) && is_string( $valueIfEmpty )) { |
|
123 | + if( empty($bytes) && is_string( $valueIfEmpty ) ) { |
|
124 | 124 | return $valueIfEmpty; |
125 | 125 | } |
126 | - $exponent = floor( log( max( $bytes, 1 ), 1024 )); |
|
127 | - return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes','KB','MB','GB'][$exponent]; |
|
126 | + $exponent = floor( log( max( $bytes, 1 ), 1024 ) ); |
|
127 | + return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes', 'KB', 'MB', 'GB'][$exponent]; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | { |
149 | 149 | $constants = (new ReflectionClass( __CLASS__ ))->getConstants(); |
150 | 150 | $constants = (array)apply_filters( 'site-reviews/log-levels', $constants ); |
151 | - if( in_array( $level, $constants, true )) { |
|
151 | + if( in_array( $level, $constants, true ) ) { |
|
152 | 152 | $entry = $this->buildLogEntry( $level, $message, $context ); |
153 | - file_put_contents( $this->file, $entry, FILE_APPEND|LOCK_EX ); |
|
153 | + file_put_contents( $this->file, $entry, FILE_APPEND | LOCK_EX ); |
|
154 | 154 | $this->reset(); |
155 | 155 | } |
156 | 156 | return $this; |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | protected function interpolate( $message, $context = [] ) |
225 | 225 | { |
226 | - if( $this->isObjectOrArray( $message ) || !is_array( $context )) { |
|
226 | + if( $this->isObjectOrArray( $message ) || !is_array( $context ) ) { |
|
227 | 227 | return print_r( $message, true ); |
228 | 228 | } |
229 | 229 | $replace = []; |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | if( $value instanceof DateTime ) { |
252 | 252 | $value = $value->format( 'Y-m-d H:i:s' ); |
253 | 253 | } |
254 | - else if( $this->isObjectOrArray( $value )) { |
|
254 | + else if( $this->isObjectOrArray( $value ) ) { |
|
255 | 255 | $value = json_encode( $value ); |
256 | 256 | } |
257 | 257 | return (string)$value; |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $this->clear(); |
267 | 267 | file_put_contents( |
268 | 268 | $this->file, |
269 | - $this->buildLogEntry( 'info', __( 'Console was automatically reset (128 KB max size)', 'site-reviews' )) |
|
269 | + $this->buildLogEntry( 'info', __( 'Console was automatically reset (128 KB max size)', 'site-reviews' ) ) |
|
270 | 270 | ); |
271 | 271 | } |
272 | 272 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function all() |
30 | 30 | { |
31 | - if( empty( $this->options )) { |
|
31 | + if( empty($this->options) ) { |
|
32 | 32 | $this->reset(); |
33 | 33 | } |
34 | 34 | return $this->options; |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | $options = $this->all(); |
46 | 46 | $pointer = &$options; |
47 | 47 | foreach( $keys as $key ) { |
48 | - if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue; |
|
48 | + if( !isset($pointer[$key]) || !is_array( $pointer[$key] ) )continue; |
|
49 | 49 | $pointer = &$pointer[$key]; |
50 | 50 | } |
51 | - unset( $pointer[$last] ); |
|
51 | + unset($pointer[$last]); |
|
52 | 52 | return $this->set( $options ); |
53 | 53 | } |
54 | 54 | |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | glsr( DefaultsManager::class )->defaults() |
81 | 81 | ); |
82 | 82 | array_walk( $options, function( &$value ) { |
83 | - if( !is_string( $value ))return; |
|
84 | - $value = wp_kses( $value, wp_kses_allowed_html( 'post' )); |
|
83 | + if( !is_string( $value ) )return; |
|
84 | + $value = wp_kses( $value, wp_kses_allowed_html( 'post' ) ); |
|
85 | 85 | }); |
86 | 86 | return glsr( Helper::class )->convertDotNotationArray( $options ); |
87 | 87 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | public function reset() |
93 | 93 | { |
94 | 94 | $options = get_option( static::databaseKey(), [] ); |
95 | - if( !is_array( $options ) || empty( $options )) { |
|
95 | + if( !is_array( $options ) || empty($options) ) { |
|
96 | 96 | delete_option( static::databaseKey() ); |
97 | 97 | $options = wp_parse_args( glsr()->defaults, ['settings' => []] ); |
98 | 98 | } |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function set( $pathOrOptions, $value = '' ) |
108 | 108 | { |
109 | - if( is_string( $pathOrOptions )) { |
|
109 | + if( is_string( $pathOrOptions ) ) { |
|
110 | 110 | $pathOrOptions = glsr( Helper::class )->setPathValue( $pathOrOptions, $value, $this->all() ); |
111 | 111 | } |
112 | - if( $result = update_option( static::databaseKey(), (array)$pathOrOptions )) { |
|
112 | + if( $result = update_option( static::databaseKey(), (array)$pathOrOptions ) ) { |
|
113 | 113 | $this->reset(); |
114 | 114 | } |
115 | 115 | return $result; |
@@ -21,17 +21,17 @@ discard block |
||
21 | 21 | { |
22 | 22 | global $menu, $typenow; |
23 | 23 | foreach( $menu as $key => $value ) { |
24 | - if( !isset( $value[2] ) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
24 | + if( !isset($value[2]) || $value[2] != 'edit.php?post_type='.Application::POST_TYPE )continue; |
|
25 | 25 | $postCount = wp_count_posts( Application::POST_TYPE ); |
26 | 26 | $pendingCount = glsr( Builder::class )->span( number_format_i18n( $postCount->pending ), [ |
27 | 27 | 'class' => 'pending-count', |
28 | - ]); |
|
28 | + ] ); |
|
29 | 29 | $awaitingModeration = glsr( Builder::class )->span( $pendingCount, [ |
30 | 30 | 'class' => 'awaiting-mod count-'.$postCount->pending, |
31 | - ]); |
|
31 | + ] ); |
|
32 | 32 | $menu[$key][0] .= ' '.$awaitingModeration; |
33 | 33 | if( $typenow === Application::POST_TYPE ) { |
34 | - $menu[$key][4].= ' current'; |
|
34 | + $menu[$key][4] .= ' current'; |
|
35 | 35 | } |
36 | 36 | break; |
37 | 37 | } |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | 'tools' => __( 'Tools', 'site-reviews' ), |
49 | 49 | 'addons' => __( 'Addons', 'site-reviews' ), |
50 | 50 | 'documentation' => __( 'Documentation', 'site-reviews' ), |
51 | - ]); |
|
51 | + ] ); |
|
52 | 52 | foreach( $pages as $slug => $title ) { |
53 | 53 | $method = glsr( Helper::class )->buildMethodName( 'render-'.$slug.'-menu' ); |
54 | 54 | $callback = apply_filters( 'site-reviews/addon/submenu/callback', [$this, $method], $slug ); |
55 | - if( !is_callable( $callback ))continue; |
|
55 | + if( !is_callable( $callback ) )continue; |
|
56 | 56 | add_submenu_page( 'edit.php?post_type='.Application::POST_TYPE, $title, $title, Application::CAPABILITY, $slug, $callback ); |
57 | 57 | } |
58 | 58 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | { |
67 | 67 | $this->renderPage( 'addons', [ |
68 | 68 | 'template' => glsr( Template::class ), |
69 | - ]); |
|
69 | + ] ); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | 'shortcodes' => __( 'Shortcodes', 'site-reviews' ), |
83 | 83 | 'hooks' => __( 'Hooks', 'site-reviews' ), |
84 | 84 | 'functions' => __( 'Functions', 'site-reviews' ), |
85 | - ]); |
|
85 | + ] ); |
|
86 | 86 | $this->renderPage( 'documentation', [ |
87 | 87 | 'tabs' => $tabs, |
88 | - ]); |
|
88 | + ] ); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -103,17 +103,17 @@ discard block |
||
103 | 103 | 'translations' => __( 'Translations', 'site-reviews' ), |
104 | 104 | 'addons' => __( 'Addons', 'site-reviews' ), |
105 | 105 | 'licenses' => __( 'Licenses', 'site-reviews' ), |
106 | - ]); |
|
107 | - if( empty( glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults ))) { |
|
108 | - unset( $tabs['addons'] ); |
|
106 | + ] ); |
|
107 | + if( empty(glsr( Helper::class )->getPathValue( 'settings.addons', glsr()->defaults )) ) { |
|
108 | + unset($tabs['addons']); |
|
109 | 109 | } |
110 | - if( empty( glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults ))) { |
|
111 | - unset( $tabs['licenses'] ); |
|
110 | + if( empty(glsr( Helper::class )->getPathValue( 'settings.licenses', glsr()->defaults )) ) { |
|
111 | + unset($tabs['licenses']); |
|
112 | 112 | } |
113 | 113 | $this->renderPage( 'settings', [ |
114 | 114 | 'html' => glsr( Html::class ), |
115 | 115 | 'tabs' => $tabs, |
116 | - ]); |
|
116 | + ] ); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | 'import-export' => __( 'Import/Export', 'site-reviews' ), |
129 | 129 | 'console' => __( 'Console', 'site-reviews' ), |
130 | 130 | 'system-info' => __( 'System Info', 'site-reviews' ), |
131 | - ]); |
|
132 | - if( !apply_filters( 'site-reviews/addon/sync/enable', false )) { |
|
133 | - unset( $tabs['sync'] ); |
|
131 | + ] ); |
|
132 | + if( !apply_filters( 'site-reviews/addon/sync/enable', false ) ) { |
|
133 | + unset($tabs['sync']); |
|
134 | 134 | } |
135 | 135 | $this->renderPage( 'tools', [ |
136 | 136 | 'data' => [ |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | ], |
144 | 144 | 'html' => glsr( Html::class ), |
145 | 145 | 'tabs' => $tabs, |
146 | - ]); |
|
146 | + ] ); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function getDefaults() |
68 | 68 | { |
69 | - if( empty( $this->defaults )) { |
|
69 | + if( empty($this->defaults) ) { |
|
70 | 70 | $this->defaults = $this->make( DefaultsManager::class )->get(); |
71 | 71 | $this->upgrade(); |
72 | 72 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public function hasPermission() |
80 | 80 | { |
81 | 81 | $isAdmin = $this->isAdmin(); |
82 | - return !$isAdmin || ( $isAdmin && current_user_can( static::CAPABILITY )); |
|
82 | + return !$isAdmin || ($isAdmin && current_user_can( static::CAPABILITY )); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $types = apply_filters( 'site-reviews/addon/types', [] ); |
135 | 135 | $this->reviewTypes = wp_parse_args( $types, [ |
136 | 136 | 'local' => __( 'Local', 'site-reviews' ), |
137 | - ]); |
|
137 | + ] ); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -144,15 +144,15 @@ discard block |
||
144 | 144 | public function render( $view, array $data = [] ) |
145 | 145 | { |
146 | 146 | $file = ''; |
147 | - if( glsr( Helper::class )->startsWith( $view, 'templates/' )) { |
|
147 | + if( glsr( Helper::class )->startsWith( $view, 'templates/' ) ) { |
|
148 | 148 | $file = str_replace( 'templates/', 'site-reviews/', $view ).'.php'; |
149 | 149 | $file = get_stylesheet_directory().'/'.$file; |
150 | 150 | } |
151 | - if( !file_exists( $file )) { |
|
151 | + if( !file_exists( $file ) ) { |
|
152 | 152 | $file = $this->path( 'views/'.$view.'.php' ); |
153 | 153 | } |
154 | 154 | $file = apply_filters( 'site-reviews/views/file', $file, $view, $data ); |
155 | - if( !file_exists( $file )) { |
|
155 | + if( !file_exists( $file ) ) { |
|
156 | 156 | glsr_log()->error( 'File not found: '.$file ); |
157 | 157 | return; |
158 | 158 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function scheduleCronJob() |
168 | 168 | { |
169 | - if( wp_next_scheduled( static::CRON_EVENT ))return; |
|
169 | + if( wp_next_scheduled( static::CRON_EVENT ) )return; |
|
170 | 170 | wp_schedule_event( time(), 'twicedaily', static::CRON_EVENT ); |
171 | 171 | } |
172 | 172 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function unscheduleCronJob() |
177 | 177 | { |
178 | - wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT )), static::CRON_EVENT ); |
|
178 | + wp_unschedule_event( intval( wp_next_scheduled( static::CRON_EVENT ) ), static::CRON_EVENT ); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -207,6 +207,6 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public function url( $path = '' ) |
209 | 209 | { |
210 | - return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' )); |
|
210 | + return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) ); |
|
211 | 211 | } |
212 | 212 | } |
@@ -10,13 +10,13 @@ |
||
10 | 10 | <p>{{ description }}</p> |
11 | 11 | </div> |
12 | 12 | <div class="glsr-addon-footer"> |
13 | - <?php if( !is_wp_error( validate_plugin( $plugin ))) : ?> |
|
14 | - <?php if( is_plugin_active( $plugin )) : ?> |
|
13 | + <?php if( !is_wp_error( validate_plugin( $plugin ) ) ) : ?> |
|
14 | + <?php if( is_plugin_active( $plugin ) ) : ?> |
|
15 | 15 | <span class="glsr-addon-link button button-secondary" disabled> |
16 | 16 | <?= __( 'Installed', 'site-reviews' ); ?> |
17 | 17 | </span> |
18 | 18 | <?php else: ?> |
19 | - <a href="<?= wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin='.$plugin ), 'activate-plugin_'.$plugin );?>" class="glsr-addon-link button button-secondary"> |
|
19 | + <a href="<?= wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin='.$plugin ), 'activate-plugin_'.$plugin ); ?>" class="glsr-addon-link button button-secondary"> |
|
20 | 20 | <?= __( 'Activate', 'site-reviews' ); ?> |
21 | 21 | </a> |
22 | 22 | <?php endif; ?> |
@@ -38,7 +38,7 @@ |
||
38 | 38 | <form method="post"> |
39 | 39 | <div class="tablenav bottom"> |
40 | 40 | <div class="actions"> |
41 | - <?php if( count( $sites ) > 1) : ?> |
|
41 | + <?php if( count( $sites ) > 1 ) : ?> |
|
42 | 42 | <label for="bulk-action-selector-bottom" class="screen-reader-text">Select a site to sync</label> |
43 | 43 | <select name="{{ id }}[site]"> |
44 | 44 | <option>- <?= __( 'Select a Site', 'site-reviews' ); ?> -</option> |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | 'title' => 'Tripadvisor Reviews', |
14 | 14 | ], |
15 | 15 | 'plugin' => 'site-reviews-tripadvisor/site-reviews-tripadvisor.php', |
16 | - ]); |
|
16 | + ] ); |
|
17 | 17 | $template->render( 'partials/addons/addon', [ |
18 | 18 | 'context' => [ |
19 | 19 | 'description' => __( 'Sync your Yelp reviews and display them on your site.', 'site-reviews' ), |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | 'title' => 'Yelp Reviews', |
23 | 23 | ], |
24 | 24 | 'plugin' => 'site-reviews-yelp/site-reviews-yelp.php', |
25 | - ]); |
|
25 | + ] ); |
|
26 | 26 | ?> |
27 | 27 | </div> |
28 | 28 | </div> |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | 'results' => $this->buildResults(), |
61 | 61 | 'submit_button' => $this->buildSubmitButton().$this->buildRecaptcha(), |
62 | 62 | ], |
63 | - ]); |
|
63 | + ] ); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | $integration = glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.integration' ); |
72 | 72 | $recaptchaMethod = glsr( Helper::class )->buildMethodName( $integration, 'getRecaptcha' ); |
73 | - if( method_exists( $this, $recaptchaMethod )) { |
|
73 | + if( method_exists( $this, $recaptchaMethod ) ) { |
|
74 | 74 | return $this->$recaptchaMethod(); |
75 | 75 | } |
76 | 76 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | return glsr( Partial::class )->build( 'form-results', [ |
84 | 84 | 'errors' => $this->errors, |
85 | 85 | 'message' => $this->message, |
86 | - ]); |
|
86 | + ] ); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | 'context' => [ |
96 | 96 | 'text' => __( 'Submit your review', 'site-reviews' ), |
97 | 97 | ], |
98 | - ]); |
|
98 | + ] ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $fields = array_merge( |
116 | 116 | $this->getHiddenFields(), |
117 | 117 | [$this->getHoneypotField()], |
118 | - $this->normalizeFields( glsr( Form::class )->getFields( 'submission-form' )) |
|
118 | + $this->normalizeFields( glsr( Form::class )->getFields( 'submission-form' ) ) |
|
119 | 119 | ); |
120 | 120 | return $fields; |
121 | 121 | } |
@@ -128,27 +128,27 @@ discard block |
||
128 | 128 | $fields = [[ |
129 | 129 | 'name' => 'action', |
130 | 130 | 'value' => 'submit-review', |
131 | - ],[ |
|
131 | + ], [ |
|
132 | 132 | 'name' => 'assign_to', |
133 | 133 | 'value' => $this->args['assign_to'], |
134 | - ],[ |
|
134 | + ], [ |
|
135 | 135 | 'name' => 'category', |
136 | 136 | 'value' => $this->args['category'], |
137 | - ],[ |
|
137 | + ], [ |
|
138 | 138 | 'name' => 'excluded', |
139 | 139 | 'value' => $this->args['excluded'], // @todo should default to "[]" |
140 | - ],[ |
|
140 | + ], [ |
|
141 | 141 | 'name' => 'form_id', |
142 | 142 | 'value' => $this->args['id'], |
143 | - ],[ |
|
143 | + ], [ |
|
144 | 144 | 'name' => 'nonce', |
145 | 145 | 'value' => wp_create_nonce( 'submit-review' ), |
146 | - ],[ |
|
146 | + ], [ |
|
147 | 147 | 'name' => 'referer', |
148 | - 'value' => wp_unslash( filter_input( INPUT_SERVER, 'REQUEST_URI' )), |
|
148 | + 'value' => wp_unslash( filter_input( INPUT_SERVER, 'REQUEST_URI' ) ), |
|
149 | 149 | ]]; |
150 | 150 | return array_map( function( $field ) { |
151 | - return new Field( wp_parse_args( $field, ['type' => 'hidden'] )); |
|
151 | + return new Field( wp_parse_args( $field, ['type' => 'hidden'] ) ); |
|
152 | 152 | }, $fields ); |
153 | 153 | } |
154 | 154 | |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | */ |
158 | 158 | protected function getHoneypotField() |
159 | 159 | { |
160 | - return new Field([ |
|
160 | + return new Field( [ |
|
161 | 161 | 'name' => 'gotcha', |
162 | 162 | 'type' => 'honeypot', |
163 | - ]); |
|
163 | + ] ); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -168,12 +168,12 @@ discard block |
||
168 | 168 | */ |
169 | 169 | protected function getRecaptchaCustom() |
170 | 170 | { |
171 | - return glsr( Builder::class )->div([ |
|
171 | + return glsr( Builder::class )->div( [ |
|
172 | 172 | 'class' => 'glsr-recaptcha-holder', |
173 | - 'data-badge' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.position' )), |
|
174 | - 'data-sitekey' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.key' )), |
|
173 | + 'data-badge' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.position' ) ), |
|
174 | + 'data-sitekey' => sanitize_text_field( glsr( OptionManager::class )->get( 'settings.submissions.recaptcha.key' ) ), |
|
175 | 175 | 'data-size' => 'invisible', |
176 | - ]); |
|
176 | + ] ); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $html = ob_get_clean(); |
187 | 187 | return glsr( Builder::class )->div( $html, [ |
188 | 188 | 'class' => 'glsr-recaptcha-holder', |
189 | - ]); |
|
189 | + ] ); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | protected function normalizeFieldErrors( Field &$field ) |
196 | 196 | { |
197 | - if( !array_key_exists( $field->field['path'], $this->errors ))return; |
|
197 | + if( !array_key_exists( $field->field['path'], $this->errors ) )return; |
|
198 | 198 | $field->field['errors'] = $this->errors[$field->field['path']]; |
199 | 199 | } |
200 | 200 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | protected function normalizeFieldRequired( Field &$field ) |
205 | 205 | { |
206 | - if( !in_array( $field->field['path'], $this->required ))return; |
|
206 | + if( !in_array( $field->field['path'], $this->required ) )return; |
|
207 | 207 | $field->field['required'] = true; |
208 | 208 | } |
209 | 209 | |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | */ |
226 | 226 | protected function normalizeFieldValue( Field &$field ) |
227 | 227 | { |
228 | - if( !array_key_exists( $field->field['path'], $this->values ))return; |
|
229 | - if( in_array( $field->field['type'], ['radio', 'checkbox'] )) { |
|
228 | + if( !array_key_exists( $field->field['path'], $this->values ) )return; |
|
229 | + if( in_array( $field->field['type'], ['radio', 'checkbox'] ) ) { |
|
230 | 230 | $field->field['checked'] = $field->field['value'] == $this->values[$field->field['path']]; |
231 | 231 | } |
232 | 232 | else { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | 'navigation' => $navigation, |
57 | 57 | ], |
58 | 58 | 'reviews' => $this->buildReviews(), |
59 | - ]); |
|
59 | + ] ); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $reviewValues = []; |
83 | 83 | foreach( $review as $key => $value ) { |
84 | 84 | $method = glsr( Helper::class )->buildMethodName( $key, 'buildOption' ); |
85 | - if( !method_exists( $this, $method ))continue; |
|
85 | + if( !method_exists( $this, $method ) )continue; |
|
86 | 86 | $reviewValues[$key] = $this->$method( $key, $value ); |
87 | 87 | } |
88 | 88 | $reviewValues = apply_filters( 'site-reviews/review/build/after', $reviewValues ); |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | */ |
97 | 97 | protected function buildOptionAssignedTo( $key, $value ) |
98 | 98 | { |
99 | - if( $this->isHiddenOrEmpty( $key, 'settings.reviews.assigned_links.enabled' ))return; |
|
100 | - $post = get_post( intval( $value )); |
|
101 | - if( !( $post instanceof WP_Post ))return; |
|
99 | + if( $this->isHiddenOrEmpty( $key, 'settings.reviews.assigned_links.enabled' ) )return; |
|
100 | + $post = get_post( intval( $value ) ); |
|
101 | + if( !($post instanceof WP_Post) )return; |
|
102 | 102 | $permalink = glsr( Builder::class )->a( get_the_title( $post->ID ), [ |
103 | 103 | 'href' => get_the_permalink( $post->ID ), |
104 | - ]); |
|
104 | + ] ); |
|
105 | 105 | $assignedTo = sprintf( __( 'Review of %s', 'site-reviews' ), $permalink ); |
106 | 106 | return $this->wrap( $key, '<span>'.$assignedTo.'</span>' ); |
107 | 107 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | protected function buildOptionAuthor( $key, $value ) |
115 | 115 | { |
116 | - if( $this->isHidden( $key ))return; |
|
116 | + if( $this->isHidden( $key ) )return; |
|
117 | 117 | $prefix = !$this->isOptionEnabled( 'settings.reviews.avatars.enabled' ) |
118 | 118 | ? apply_filters( 'site-reviews/review/author/prefix', '—' ) |
119 | 119 | : ''; |
@@ -127,13 +127,13 @@ discard block |
||
127 | 127 | */ |
128 | 128 | protected function buildOptionAvatar( $key, $value ) |
129 | 129 | { |
130 | - if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' ))return; |
|
130 | + if( $this->isHidden( $key, 'settings.reviews.avatars.enabled' ) )return; |
|
131 | 131 | $size = $this->getOption( 'settings.reviews.avatars.size', 40 ); |
132 | - return $this->wrap( $key, glsr( Builder::class )->img([ |
|
132 | + return $this->wrap( $key, glsr( Builder::class )->img( [ |
|
133 | 133 | 'src' => $this->generateAvatar( $value ), |
134 | 134 | 'height' => $size, |
135 | 135 | 'width' => $size, |
136 | - ])); |
|
136 | + ] ) ); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | protected function buildOptionContent( $key, $value ) |
145 | 145 | { |
146 | 146 | $text = $this->normalizeText( $value ); |
147 | - if( $this->isHiddenOrEmpty( $key, $text ))return; |
|
147 | + if( $this->isHiddenOrEmpty( $key, $text ) )return; |
|
148 | 148 | return $this->wrap( $key, '<p>'.$text.'</p>' ); |
149 | 149 | } |
150 | 150 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | protected function buildOptionDate( $key, $value ) |
157 | 157 | { |
158 | - if( $this->isHidden( $key ))return; |
|
158 | + if( $this->isHidden( $key ) )return; |
|
159 | 159 | $dateFormat = $this->getOption( 'settings.reviews.date.format', 'default' ); |
160 | 160 | if( $dateFormat == 'relative' ) { |
161 | 161 | $date = glsr( Date::class )->relative( $value ); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $format = $dateFormat == 'custom' |
165 | 165 | ? $this->getOption( 'settings.reviews.date.custom', 'M j, Y' ) |
166 | 166 | : (string)get_option( 'date_format' ); |
167 | - $date = date_i18n( $format, strtotime( $value )); |
|
167 | + $date = date_i18n( $format, strtotime( $value ) ); |
|
168 | 168 | } |
169 | 169 | return $this->wrap( $key, '<span>'.$date.'</span>' ); |
170 | 170 | } |
@@ -176,10 +176,10 @@ discard block |
||
176 | 176 | */ |
177 | 177 | protected function buildOptionRating( $key, $value ) |
178 | 178 | { |
179 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
179 | + if( $this->isHiddenOrEmpty( $key, $value ) )return; |
|
180 | 180 | $rating = glsr( Html::class )->buildPartial( 'star-rating', [ |
181 | 181 | 'rating' => $value, |
182 | - ]); |
|
182 | + ] ); |
|
183 | 183 | return $this->wrap( $key, $rating ); |
184 | 184 | } |
185 | 185 | |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | */ |
191 | 191 | protected function buildOptionResponse( $key, $value ) |
192 | 192 | { |
193 | - if( $this->isHiddenOrEmpty( $key, $value ))return; |
|
194 | - $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' )); |
|
193 | + if( $this->isHiddenOrEmpty( $key, $value ) )return; |
|
194 | + $title = sprintf( __( 'Response from %s', 'site-reviews' ), get_bloginfo( 'name' ) ); |
|
195 | 195 | $text = $this->normalizeText( $value ); |
196 | 196 | $text = '<p><strong>'.$title.'</strong></p><p>'.$text.'</p>'; |
197 | 197 | return $this->wrap( $key, |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | */ |
208 | 208 | protected function buildOptionTitle( $key, $value ) |
209 | 209 | { |
210 | - if( $this->isHidden( $key ))return; |
|
211 | - if( empty( $value )) { |
|
210 | + if( $this->isHidden( $key ) )return; |
|
211 | + if( empty($value) ) { |
|
212 | 212 | $value = __( 'No Title', 'site-reviews' ); |
213 | 213 | } |
214 | 214 | return $this->wrap( $key, '<h3>'.$value.'</h3>' ); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | return $avatarUrl; |
227 | 227 | } |
228 | 228 | $authorIdOrEmail = get_the_author_meta( 'ID', $review->user_id ); |
229 | - if( empty( $authorIdOrEmail )) { |
|
229 | + if( empty($authorIdOrEmail) ) { |
|
230 | 230 | $authorIdOrEmail = $review->email; |
231 | 231 | } |
232 | 232 | return (string)get_avatar_url( $authorIdOrEmail ); |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | protected function generateSchema() |
239 | 239 | { |
240 | - if( !wp_validate_boolean( $this->args['schema'] ))return; |
|
240 | + if( !wp_validate_boolean( $this->args['schema'] ) )return; |
|
241 | 241 | glsr( Schema::class )->store( |
242 | 242 | glsr( Schema::class )->build( $this->args ) |
243 | 243 | ); |
@@ -263,14 +263,14 @@ discard block |
||
263 | 263 | { |
264 | 264 | $limit = $this->getOption( 'settings.reviews.excerpt.length', 55 ); |
265 | 265 | if( str_word_count( $text, 0 ) > $limit ) { |
266 | - $words = array_keys( str_word_count( $text, 2 )); |
|
267 | - $excerpt = ltrim( substr( $text, 0, $words[$limit] )); |
|
268 | - $hiddenText = substr( $text, strlen( $excerpt )); |
|
266 | + $words = array_keys( str_word_count( $text, 2 ) ); |
|
267 | + $excerpt = ltrim( substr( $text, 0, $words[$limit] ) ); |
|
268 | + $hiddenText = substr( $text, strlen( $excerpt ) ); |
|
269 | 269 | $showMore = glsr( Builder::class )->span( $hiddenText, [ |
270 | 270 | 'class' => 'glsr-hidden glsr-hidden-text', |
271 | 271 | 'data-show-less' => __( 'Show less', 'site-reviews' ), |
272 | 272 | 'data-show-more' => __( 'Show more', 'site-reviews' ), |
273 | - ]); |
|
273 | + ] ); |
|
274 | 274 | $text = $excerpt.$showMore; |
275 | 275 | } |
276 | 276 | return nl2br( $text ); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | */ |
284 | 284 | protected function getOption( $path, $fallback = '' ) |
285 | 285 | { |
286 | - if( array_key_exists( $path, $this->options )) { |
|
286 | + if( array_key_exists( $path, $this->options ) ) { |
|
287 | 287 | return $this->options[$path]; |
288 | 288 | } |
289 | 289 | return $fallback; |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | */ |
297 | 297 | protected function isHidden( $key, $path = '' ) |
298 | 298 | { |
299 | - $isOptionEnabled = !empty( $path ) |
|
299 | + $isOptionEnabled = !empty($path) |
|
300 | 300 | ? $this->isOptionEnabled( $path ) |
301 | 301 | : true; |
302 | 302 | return in_array( $key, $this->args['hide'] ) || !$isOptionEnabled; |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | */ |
310 | 310 | protected function isHiddenOrEmpty( $key, $value ) |
311 | 311 | { |
312 | - return $this->isHidden( $key ) || empty( $value ); |
|
312 | + return $this->isHidden( $key ) || empty($value); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | /** |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | protected function normalizeText( $text ) |
329 | 329 | { |
330 | 330 | $text = wp_kses( $text, wp_kses_allowed_html() ); |
331 | - $text = convert_smilies( wptexturize( strip_shortcodes( $text ))); |
|
331 | + $text = convert_smilies( wptexturize( strip_shortcodes( $text ) ) ); |
|
332 | 332 | $text = str_replace( ']]>', ']]>', $text ); |
333 | 333 | $text = preg_replace( '/(\R){2,}/', '$1', $text ); |
334 | 334 | return $this->isOptionEnabled( 'settings.reviews.excerpt.enabled' ) |
@@ -345,6 +345,6 @@ discard block |
||
345 | 345 | { |
346 | 346 | return glsr( Builder::class )->div( $value, [ |
347 | 347 | 'class' => 'glsr-review-'.$key, |
348 | - ]); |
|
348 | + ] ); |
|
349 | 349 | } |
350 | 350 | } |