@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | add_filter( 'sbp_exclude_defer_scripts', function( $scriptHandles ) { |
| 21 | 21 | $scriptHandles[] = 'site-reviews/google-recaptcha'; |
| 22 | - return array_keys( array_flip( $scriptHandles )); |
|
| 22 | + return array_keys( array_flip( $scriptHandles ) ); |
|
| 23 | 23 | }); |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | * @see https://searchandfilter.com/ |
| 30 | 30 | */ |
| 31 | 31 | add_filter( 'sf_edit_query_args', function( $query ) { |
| 32 | - if( !empty( $query['meta_key'] ) && $query['meta_key'] == '_glsr_ranking' ) { |
|
| 33 | - unset( $query['meta_key'] ); |
|
| 32 | + if( !empty($query['meta_key']) && $query['meta_key'] == '_glsr_ranking' ) { |
|
| 33 | + unset($query['meta_key']); |
|
| 34 | 34 | $query['meta_query'] = [ |
| 35 | 35 | 'relation' => 'OR', |
| 36 | 36 | ['key' => '_glsr_ranking', 'compare' => 'EXISTS'], |
@@ -8,7 +8,9 @@ |
||
| 8 | 8 | * @see https://www.elegantthemes.com/gallery/divi/ |
| 9 | 9 | */ |
| 10 | 10 | add_action( 'site-reviews/customize/divi', function( $instance ) { |
| 11 | - if( $instance->tag != 'label' || $instance->args['type'] != 'checkbox' )return; |
|
| 11 | + if( $instance->tag != 'label' || $instance->args['type'] != 'checkbox' ) { |
|
| 12 | + return; |
|
| 13 | + } |
|
| 12 | 14 | $instance->args['text'] = '<i></i>'.$instance->args['text']; |
| 13 | 15 | }); |
| 14 | 16 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | $className = str_replace( '.php', '', $file ); |
| 25 | 25 | $version = str_replace( ['Upgrade_', '_'], ['', '.'], $className ); |
| 26 | 26 | $versionSuffix = preg_replace( '/[\d.]+(.+)?/', '${1}', glsr()->version ); // allow alpha/beta versions |
| 27 | - if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ))return; |
|
| 27 | + if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ) )return; |
|
| 28 | 28 | glsr( 'Modules\\Upgrader\\'.$className ); |
| 29 | 29 | glsr_log()->info( 'Completed Upgrade for v'.$version.$versionSuffix ); |
| 30 | 30 | }); |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function setReviewCounts() |
| 47 | 47 | { |
| 48 | - if( !empty( glsr( OptionManager::class )->get( 'last_review_count' )))return; |
|
| 48 | + if( !empty(glsr( OptionManager::class )->get( 'last_review_count' )) )return; |
|
| 49 | 49 | add_action( 'admin_init', function() { |
| 50 | 50 | glsr( AdminController::class )->routerCountReviews( false ); |
| 51 | - glsr_log()->info( __( 'Calculated rating counts.', 'site-reviews' )); |
|
| 51 | + glsr_log()->info( __( 'Calculated rating counts.', 'site-reviews' ) ); |
|
| 52 | 52 | }); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -16,7 +16,9 @@ discard block |
||
| 16 | 16 | $filenames = []; |
| 17 | 17 | $iterator = new DirectoryIterator( dirname( __FILE__ ).'/Upgrader' ); |
| 18 | 18 | foreach( $iterator as $fileinfo ) { |
| 19 | - if( !$fileinfo->isFile() )continue; |
|
| 19 | + if( !$fileinfo->isFile() ) { |
|
| 20 | + continue; |
|
| 21 | + } |
|
| 20 | 22 | $filenames[] = $fileinfo->getFilename(); |
| 21 | 23 | } |
| 22 | 24 | natsort( $filenames ); |
@@ -24,7 +26,9 @@ discard block |
||
| 24 | 26 | $className = str_replace( '.php', '', $file ); |
| 25 | 27 | $version = str_replace( ['Upgrade_', '_'], ['', '.'], $className ); |
| 26 | 28 | $versionSuffix = preg_replace( '/[\d.]+(.+)?/', '${1}', glsr()->version ); // allow alpha/beta versions |
| 27 | - if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ))return; |
|
| 29 | + if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' )) { |
|
| 30 | + return; |
|
| 31 | + } |
|
| 28 | 32 | glsr( 'Modules\\Upgrader\\'.$className ); |
| 29 | 33 | glsr_log()->info( 'Completed Upgrade for v'.$version.$versionSuffix ); |
| 30 | 34 | }); |
@@ -45,7 +49,9 @@ discard block |
||
| 45 | 49 | */ |
| 46 | 50 | public function setReviewCounts() |
| 47 | 51 | { |
| 48 | - if( !empty( glsr( OptionManager::class )->get( 'last_review_count' )))return; |
|
| 52 | + if( !empty( glsr( OptionManager::class )->get( 'last_review_count' ))) { |
|
| 53 | + return; |
|
| 54 | + } |
|
| 49 | 55 | add_action( 'admin_init', function() { |
| 50 | 56 | glsr( AdminController::class )->routerCountReviews( false ); |
| 51 | 57 | glsr_log()->info( __( 'Calculated rating counts.', 'site-reviews' )); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | protected function getFieldDefault( array $field ) |
| 37 | 37 | { |
| 38 | - return isset( $field['default'] ) |
|
| 38 | + return isset($field['default']) |
|
| 39 | 39 | ? $field['default'] |
| 40 | 40 | : ''; |
| 41 | 41 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | protected function getSettingFields( $path ) |
| 47 | 47 | { |
| 48 | - return array_filter( $this->settings, function( $key ) use( $path ) { |
|
| 48 | + return array_filter( $this->settings, function( $key ) use($path) { |
|
| 49 | 49 | return glsr( Helper::class )->startsWith( $path, $key ); |
| 50 | 50 | }, ARRAY_FILTER_USE_KEY ); |
| 51 | 51 | } |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | $field = wp_parse_args( $field, [ |
| 61 | 61 | 'is_setting' => true, |
| 62 | 62 | 'name' => $name, |
| 63 | - ]); |
|
| 64 | - $rows.= new Field( $this->normalize( $field )); |
|
| 63 | + ] ); |
|
| 64 | + $rows .= new Field( $this->normalize( $field ) ); |
|
| 65 | 65 | } |
| 66 | 66 | return $rows; |
| 67 | 67 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | protected function getTemplateData( $id ) |
| 74 | 74 | { |
| 75 | - $fields = $this->getSettingFields( $this->normalizeSettingPath( $id )); |
|
| 75 | + $fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) ); |
|
| 76 | 76 | return [ |
| 77 | 77 | 'context' => [ |
| 78 | 78 | 'rows' => $this->getSettingRows( $fields ), |
@@ -86,12 +86,12 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | protected function getTemplateDataForAddons( $id ) |
| 88 | 88 | { |
| 89 | - $fields = $this->getSettingFields( $this->normalizeSettingPath( $id )); |
|
| 89 | + $fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) ); |
|
| 90 | 90 | $settings = glsr( Helper::class )->convertDotNotationArray( $fields ); |
| 91 | 91 | $settingKeys = array_keys( $settings['settings']['addons'] ); |
| 92 | 92 | $results = []; |
| 93 | 93 | foreach( $settingKeys as $key ) { |
| 94 | - $addonFields = array_filter( $fields, function( $path ) use( $key ) { |
|
| 94 | + $addonFields = array_filter( $fields, function( $path ) use($key) { |
|
| 95 | 95 | return glsr( Helper::class )->startsWith( 'settings.addons.'.$key, $path ); |
| 96 | 96 | }, ARRAY_FILTER_USE_KEY ); |
| 97 | 97 | $results[$key] = $this->getSettingRows( $addonFields ); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | protected function getTemplateDataForLicenses( $id ) |
| 110 | 110 | { |
| 111 | - $fields = $this->getSettingFields( $this->normalizeSettingPath( $id )); |
|
| 111 | + $fields = $this->getSettingFields( $this->normalizeSettingPath( $id ) ); |
|
| 112 | 112 | ksort( $fields ); |
| 113 | 113 | return [ |
| 114 | 114 | 'context' => [ |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | protected function getTemplateDataForTranslations() |
| 124 | 124 | { |
| 125 | 125 | $translations = glsr( Translation::class )->renderAll(); |
| 126 | - $class = empty( $translations ) |
|
| 126 | + $class = empty($translations) |
|
| 127 | 127 | ? 'glsr-hidden' |
| 128 | 128 | : ''; |
| 129 | 129 | return [ |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | $path, |
| 147 | 147 | glsr( Helper::class )->getPathValue( $path, glsr()->defaults ) |
| 148 | 148 | ); |
| 149 | - if( is_array( $expectedValue )) { |
|
| 149 | + if( is_array( $expectedValue ) ) { |
|
| 150 | 150 | return is_array( $optionValue ) |
| 151 | - ? count( array_intersect( $optionValue, $expectedValue )) === 0 |
|
| 151 | + ? count( array_intersect( $optionValue, $expectedValue ) ) === 0 |
|
| 152 | 152 | : !in_array( $optionValue, $expectedValue ); |
| 153 | 153 | } |
| 154 | 154 | return $optionValue != $expectedValue; |
@@ -159,10 +159,10 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | protected function isMultiDependency( $path ) |
| 161 | 161 | { |
| 162 | - if( isset( $this->settings[$path] )) { |
|
| 162 | + if( isset($this->settings[$path]) ) { |
|
| 163 | 163 | $field = $this->settings[$path]; |
| 164 | - return ( $field['type'] == 'checkbox' && !empty( $field['options'] )) |
|
| 165 | - || !empty( $field['multiple'] ); |
|
| 164 | + return ($field['type'] == 'checkbox' && !empty($field['options'])) |
|
| 165 | + || !empty($field['multiple']); |
|
| 166 | 166 | } |
| 167 | 167 | return false; |
| 168 | 168 | } |
@@ -183,17 +183,17 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | protected function normalizeDependsOn( array $field ) |
| 185 | 185 | { |
| 186 | - if( !empty( $field['depends_on'] ) && is_array( $field['depends_on'] )) { |
|
| 186 | + if( !empty($field['depends_on']) && is_array( $field['depends_on'] ) ) { |
|
| 187 | 187 | $path = key( $field['depends_on'] ); |
| 188 | 188 | $expectedValue = $field['depends_on'][$path]; |
| 189 | 189 | $fieldName = glsr( Helper::class )->convertPathToName( $path, OptionManager::databaseKey() ); |
| 190 | - if( $this->isMultiDependency( $path )) { |
|
| 191 | - $fieldName.= '[]'; |
|
| 190 | + if( $this->isMultiDependency( $path ) ) { |
|
| 191 | + $fieldName .= '[]'; |
|
| 192 | 192 | } |
| 193 | - $field['data-depends'] = json_encode([ |
|
| 193 | + $field['data-depends'] = json_encode( [ |
|
| 194 | 194 | 'name' => $fieldName, |
| 195 | 195 | 'value' => $expectedValue, |
| 196 | - ], JSON_HEX_APOS|JSON_HEX_QUOT ); |
|
| 196 | + ], JSON_HEX_APOS | JSON_HEX_QUOT ); |
|
| 197 | 197 | $field['is_hidden'] = $this->isFieldHidden( $path, $expectedValue ); |
| 198 | 198 | } |
| 199 | 199 | return $field; |
@@ -204,9 +204,9 @@ discard block |
||
| 204 | 204 | */ |
| 205 | 205 | protected function normalizeLabelAndLegend( array $field ) |
| 206 | 206 | { |
| 207 | - if( !empty( $field['label'] )) { |
|
| 207 | + if( !empty($field['label']) ) { |
|
| 208 | 208 | $field['legend'] = $field['label']; |
| 209 | - unset( $field['label'] ); |
|
| 209 | + unset($field['label']); |
|
| 210 | 210 | } |
| 211 | 211 | else { |
| 212 | 212 | $field['is_valid'] = false; |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | protected function normalizeValue( array $field ) |
| 222 | 222 | { |
| 223 | - if( !isset( $field['value'] )) { |
|
| 223 | + if( !isset($field['value']) ) { |
|
| 224 | 224 | $field['value'] = glsr( OptionManager::class )->get( |
| 225 | 225 | $field['name'], |
| 226 | 226 | $this->getFieldDefault( $field ) |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function routerChangeStatus( array $request ) |
| 24 | 24 | { |
| 25 | - wp_send_json_success( $this->execute( new ChangeStatus( $request ))); |
|
| 25 | + wp_send_json_success( $this->execute( new ChangeStatus( $request ) ) ); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | public function routerClearConsole() |
| 32 | 32 | { |
| 33 | 33 | glsr( AdminController::class )->routerClearConsole(); |
| 34 | - wp_send_json_success([ |
|
| 34 | + wp_send_json_success( [ |
|
| 35 | 35 | 'console' => glsr( Console::class )->get(), |
| 36 | 36 | 'notices' => glsr( Notice::class )->get(), |
| 37 | - ]); |
|
| 37 | + ] ); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | public function routerCountReviews() |
| 44 | 44 | { |
| 45 | 45 | glsr( AdminController::class )->routerCountReviews(); |
| 46 | - wp_send_json_success([ |
|
| 46 | + wp_send_json_success( [ |
|
| 47 | 47 | 'notices' => glsr( Notice::class )->get(), |
| 48 | - ]); |
|
| 48 | + ] ); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | { |
| 56 | 56 | $shortcode = $request['shortcode']; |
| 57 | 57 | $response = false; |
| 58 | - if( array_key_exists( $shortcode, glsr()->mceShortcodes )) { |
|
| 58 | + if( array_key_exists( $shortcode, glsr()->mceShortcodes ) ) { |
|
| 59 | 59 | $data = glsr()->mceShortcodes[$shortcode]; |
| 60 | - if( !empty( $data['errors'] )) { |
|
| 60 | + if( !empty($data['errors']) ) { |
|
| 61 | 61 | $data['btn_okay'] = [esc_html__( 'Okay', 'site-reviews' )]; |
| 62 | 62 | } |
| 63 | 63 | $response = [ |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | public function routerFetchConsole() |
| 78 | 78 | { |
| 79 | 79 | glsr( AdminController::class )->routerFetchConsole(); |
| 80 | - wp_send_json_success([ |
|
| 80 | + wp_send_json_success( [ |
|
| 81 | 81 | 'console' => glsr( Console::class )->get(), |
| 82 | 82 | 'notices' => glsr( Notice::class )->get(), |
| 83 | - ]); |
|
| 83 | + ] ); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | public function routerSearchPosts( array $request ) |
| 90 | 90 | { |
| 91 | 91 | $results = glsr( Database::class )->searchPosts( $request['search'] ); |
| 92 | - wp_send_json_success([ |
|
| 92 | + wp_send_json_success( [ |
|
| 93 | 93 | 'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>', |
| 94 | 94 | 'items' => $results, |
| 95 | - ]); |
|
| 95 | + ] ); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function routerSearchTranslations( array $request ) |
| 102 | 102 | { |
| 103 | - if( empty( $request['exclude'] )) { |
|
| 103 | + if( empty($request['exclude']) ) { |
|
| 104 | 104 | $request['exclude'] = []; |
| 105 | 105 | } |
| 106 | 106 | $results = glsr( Translation::class ) |
@@ -108,10 +108,10 @@ discard block |
||
| 108 | 108 | ->exclude() |
| 109 | 109 | ->exclude( $request['exclude'] ) |
| 110 | 110 | ->renderResults(); |
| 111 | - wp_send_json_success([ |
|
| 111 | + wp_send_json_success( [ |
|
| 112 | 112 | 'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>', |
| 113 | 113 | 'items' => $results, |
| 114 | - ]); |
|
| 114 | + ] ); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | 'errors' => glsr( Session::class )->get( $request['form_id'].'errors', false, true ), |
| 125 | 125 | 'message' => glsr( Session::class )->get( $request['form_id'].'message', '', true ), |
| 126 | 126 | 'recaptcha' => glsr( Session::class )->get( $request['form_id'].'recaptcha', false, true ), |
| 127 | - 'redirect' => trim( strval( get_post_meta( intval( $request['_post_id'] ), 'redirect_to', true ))), |
|
| 127 | + 'redirect' => trim( strval( get_post_meta( intval( $request['_post_id'] ), 'redirect_to', true ) ) ), |
|
| 128 | 128 | ]; |
| 129 | 129 | if( $data['errors'] === false ) { |
| 130 | 130 | glsr( Session::class )->clear(); |
@@ -138,10 +138,10 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public function routerTogglePinned( array $request ) |
| 140 | 140 | { |
| 141 | - $isPinned = $this->execute( new TogglePinned( $request )); |
|
| 142 | - wp_send_json_success([ |
|
| 141 | + $isPinned = $this->execute( new TogglePinned( $request ) ); |
|
| 142 | + wp_send_json_success( [ |
|
| 143 | 143 | 'notices' => glsr( Notice::class )->get(), |
| 144 | 144 | 'pinned' => $isPinned, |
| 145 | - ]); |
|
| 145 | + ] ); |
|
| 146 | 146 | } |
| 147 | 147 | } |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | // Database/ReviewManager.php |
| 6 | 6 | add_action( 'site-reviews/review/created', function( $review ) { |
| 7 | - if( has_action( 'site-reviews/local/review/create' )) { |
|
| 7 | + if( has_action( 'site-reviews/local/review/create' ) ) { |
|
| 8 | 8 | glsr()->deprecated[] = 'The "site-reviews/local/review/create" hook has been deprecated. Please use the "site-reviews/review/created" hook instead.'; |
| 9 | 9 | do_action( 'site-reviews/local/review/create', (array)get_post( $review->ID ), (array)$review, $review->ID ); |
| 10 | 10 | } |
@@ -12,18 +12,18 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | // Handlers/CreateReview.php |
| 14 | 14 | add_action( 'site-reviews/review/submitted', function( $review ) { |
| 15 | - if( has_action( 'site-reviews/local/review/submitted' )) { |
|
| 15 | + if( has_action( 'site-reviews/local/review/submitted' ) ) { |
|
| 16 | 16 | glsr()->deprecated[] = 'The "site-reviews/local/review/submitted" hook has been deprecated. Please use the "site-reviews/review/submitted" hook instead.'; |
| 17 | 17 | do_action( 'site-reviews/local/review/submitted', null, $review ); |
| 18 | 18 | } |
| 19 | - if( has_filter( 'site-reviews/local/review/submitted/message' )) { |
|
| 19 | + if( has_filter( 'site-reviews/local/review/submitted/message' ) ) { |
|
| 20 | 20 | glsr()->deprecated[] = 'The "site-reviews/local/review/submitted/message" hook has been deprecated.'; |
| 21 | 21 | } |
| 22 | 22 | }, 9 ); |
| 23 | 23 | |
| 24 | 24 | // Database/ReviewManager.php |
| 25 | 25 | add_filter( 'site-reviews/create/review-values', function( $values, $command ) { |
| 26 | - if( has_filter( 'site-reviews/local/review' )) { |
|
| 26 | + if( has_filter( 'site-reviews/local/review' ) ) { |
|
| 27 | 27 | glsr()->deprecated[] = 'The "site-reviews/local/review" hook has been deprecated. Please use the "site-reviews/create/review-values" hook instead.'; |
| 28 | 28 | return apply_filters( 'site-reviews/local/review', $values, $command ); |
| 29 | 29 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | // Handlers/EnqueuePublicAssets.php |
| 34 | 34 | add_filter( 'site-reviews/enqueue/public/localize', function( $variables ) { |
| 35 | - if( has_filter( 'site-reviews/enqueue/localize' )) { |
|
| 35 | + if( has_filter( 'site-reviews/enqueue/localize' ) ) { |
|
| 36 | 36 | glsr()->deprecated[] = 'The "site-reviews/enqueue/localize" hook has been deprecated. Please use the "site-reviews/enqueue/public/localize" hook instead.'; |
| 37 | 37 | return apply_filters( 'site-reviews/enqueue/localize', $variables ); |
| 38 | 38 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | // Modules/Rating.php |
| 43 | 43 | add_filter( 'site-reviews/rating/average', function( $average ) { |
| 44 | - if( has_filter( 'site-reviews/average/rating' )) { |
|
| 44 | + if( has_filter( 'site-reviews/average/rating' ) ) { |
|
| 45 | 45 | glsr()->deprecated[] = 'The "site-reviews/average/rating" hook has been deprecated. Please use the "site-reviews/rating/average" hook instead.'; |
| 46 | 46 | } |
| 47 | 47 | return $average; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | // Modules/Rating.php |
| 51 | 51 | add_filter( 'site-reviews/rating/ranking', function( $ranking ) { |
| 52 | - if( has_filter( 'site-reviews/bayesian/ranking' )) { |
|
| 52 | + if( has_filter( 'site-reviews/bayesian/ranking' ) ) { |
|
| 53 | 53 | glsr()->deprecated[] = 'The "site-reviews/bayesian/ranking" hook has been deprecated. Please use the "site-reviews/rating/ranking" hook instead.'; |
| 54 | 54 | } |
| 55 | 55 | return $ranking; |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | // Modules/Html/Partials/SiteReviews.php |
| 59 | 59 | add_filter( 'site-reviews/review/build/after', function( $renderedFields ) { |
| 60 | - if( has_filter( 'site-reviews/reviews/review/text' )) { |
|
| 60 | + if( has_filter( 'site-reviews/reviews/review/text' ) ) { |
|
| 61 | 61 | glsr()->deprecated[] = 'The "site-reviews/reviews/review/text" hook has been deprecated. Please use the "site-reviews/review/build/after" hook instead.'; |
| 62 | 62 | } |
| 63 | - if( has_filter( 'site-reviews/reviews/review/title' )) { |
|
| 63 | + if( has_filter( 'site-reviews/reviews/review/title' ) ) { |
|
| 64 | 64 | glsr()->deprecated[] = 'The "site-reviews/reviews/review/title" hook has been deprecated. Please use the "site-reviews/review/build/after" hook instead.'; |
| 65 | 65 | } |
| 66 | 66 | return $renderedFields; |
@@ -68,26 +68,26 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | // Modules/Html/Partials/SiteReviews.php |
| 70 | 70 | add_filter( 'site-reviews/review/build/before', function( $review ) { |
| 71 | - if( has_filter( 'site-reviews/rendered/review' )) { |
|
| 71 | + if( has_filter( 'site-reviews/rendered/review' ) ) { |
|
| 72 | 72 | glsr()->deprecated[] = 'The "site-reviews/rendered/review" hook has been deprecated. Please either use a custom "review.php" template (refer to the documentation), or use the "site-reviews/review/build/after" hook instead.'; |
| 73 | 73 | } |
| 74 | - if( has_filter( 'site-reviews/rendered/review/meta/order' )) { |
|
| 74 | + if( has_filter( 'site-reviews/rendered/review/meta/order' ) ) { |
|
| 75 | 75 | glsr()->deprecated[] = 'The "site-reviews/rendered/review/meta/order" hook has been deprecated. Please use a custom "review.php" template instead (refer to the documentation).'; |
| 76 | 76 | } |
| 77 | - if( has_filter( 'site-reviews/rendered/review/order' )) { |
|
| 77 | + if( has_filter( 'site-reviews/rendered/review/order' ) ) { |
|
| 78 | 78 | glsr()->deprecated[] = 'The "site-reviews/rendered/review/order" hook has been deprecated. Please use a custom "review.php" template instead (refer to the documentation).'; |
| 79 | 79 | } |
| 80 | - if( has_filter( 'site-reviews/rendered/review-form/login-register' )) { |
|
| 80 | + if( has_filter( 'site-reviews/rendered/review-form/login-register' ) ) { |
|
| 81 | 81 | glsr()->deprecated[] = 'The "site-reviews/rendered/review-form/login-register" hook has been deprecated. Please use a custom "login-register.php" template instead (refer to the documentation).'; |
| 82 | 82 | } |
| 83 | - if( has_filter( 'site-reviews/reviews/navigation_links' )) { |
|
| 83 | + if( has_filter( 'site-reviews/reviews/navigation_links' ) ) { |
|
| 84 | 84 | glsr()->deprecated[] = 'The "site-reviews/reviews/navigation_links" hook has been deprecated. Please use a custom "pagination.php" template instead (refer to the documentation).'; |
| 85 | 85 | } |
| 86 | 86 | return $review; |
| 87 | 87 | }, 9 ); |
| 88 | 88 | |
| 89 | 89 | add_filter( 'site-reviews/validate/custom', function( $result, $request ) { |
| 90 | - if( has_filter( 'site-reviews/validate/review/submission' )) { |
|
| 90 | + if( has_filter( 'site-reviews/validate/review/submission' ) ) { |
|
| 91 | 91 | glsr_log()->notice( 'The "site-reviews/validate/review/submission" hook has been deprecated. Please use the "site-reviews/validate/custom" hook instead.' ); |
| 92 | 92 | return apply_filters( 'site-reviews/validate/review/submission', $result, $request ); |
| 93 | 93 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | }, 9, 2 ); |
| 96 | 96 | |
| 97 | 97 | add_filter( 'site-reviews/views/file', function( $file, $view, $data ) { |
| 98 | - if( has_filter( 'site-reviews/addon/views/file' )) { |
|
| 98 | + if( has_filter( 'site-reviews/addon/views/file' ) ) { |
|
| 99 | 99 | glsr()->deprecated[] = 'The "site-reviews/addon/views/file" hook has been deprecated. Please use the "site-reviews/views/file" hook instead.'; |
| 100 | 100 | $file = apply_filters( 'site-reviews/addon/views/file', $file, $view, $data ); |
| 101 | 101 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | }, 9, 3 ); |
| 104 | 104 | |
| 105 | 105 | add_action( 'wp_footer', function() { |
| 106 | - $notices = array_keys( array_flip( glsr()->deprecated )); |
|
| 106 | + $notices = array_keys( array_flip( glsr()->deprecated ) ); |
|
| 107 | 107 | natsort( $notices ); |
| 108 | 108 | foreach( $notices as $notice ) { |
| 109 | 109 | glsr_log()->notice( $notice ); |
@@ -25,13 +25,13 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | sort( $termIds ); |
| 27 | 27 | sort( $oldTermIds ); |
| 28 | - if( $termIds === $oldTermIds || !$this->isReviewPostId( $postId ))return; |
|
| 29 | - $review = glsr( ReviewManager::class )->single( get_post( $postId )); |
|
| 28 | + if( $termIds === $oldTermIds || !$this->isReviewPostId( $postId ) )return; |
|
| 29 | + $review = glsr( ReviewManager::class )->single( get_post( $postId ) ); |
|
| 30 | 30 | $ignoredTerms = array_intersect( $oldTermIds, $termIds ); |
| 31 | - if( $review->term_ids = array_diff( $oldTermIds, $ignoredTerms )) { |
|
| 31 | + if( $review->term_ids = array_diff( $oldTermIds, $ignoredTerms ) ) { |
|
| 32 | 32 | glsr( CountsManager::class )->decreaseTermCounts( $review ); |
| 33 | 33 | } |
| 34 | - if( $review->term_ids = array_diff( $termIds, $ignoredTerms )) { |
|
| 34 | + if( $review->term_ids = array_diff( $termIds, $ignoredTerms ) ) { |
|
| 35 | 35 | glsr( CountsManager::class )->increaseTermCounts( $review ); |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function onBeforeDelete( $postId ) |
| 54 | 54 | { |
| 55 | - if( !$this->isReviewPostId( $postId ))return; |
|
| 56 | - $review = glsr( ReviewManager::class )->single( get_post( $postId )); |
|
| 55 | + if( !$this->isReviewPostId( $postId ) )return; |
|
| 56 | + $review = glsr( ReviewManager::class )->single( get_post( $postId ) ); |
|
| 57 | 57 | glsr( CountsManager::class )->decrease( $review ); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | if( !$this->isReviewPostId( $postId ) |
| 71 | 71 | || !in_array( $metaKey, ['assigned_to', 'rating', 'review_type'] ) |
| 72 | 72 | )return; |
| 73 | - $review = glsr( ReviewManager::class )->single( get_post( $postId )); |
|
| 73 | + $review = glsr( ReviewManager::class )->single( get_post( $postId ) ); |
|
| 74 | 74 | if( $review->$metaKey == $metaValue )return; |
| 75 | 75 | $method = glsr( Helper::class )->buildMethodName( $metaKey, 'onBeforeChange' ); |
| 76 | 76 | call_user_func( [$this, $method], $review, $metaValue ); |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function onChangeStatus( $newStatus, $oldStatus, WP_Post $post ) |
| 119 | 119 | { |
| 120 | - if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] ))return; |
|
| 121 | - $review = glsr( ReviewManager::class )->single( get_post( $post->ID )); |
|
| 120 | + if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] ) )return; |
|
| 121 | + $review = glsr( ReviewManager::class )->single( get_post( $post->ID ) ); |
|
| 122 | 122 | if( $post->post_status == 'publish' ) { |
| 123 | 123 | glsr( CountsManager::class )->increase( $review ); |
| 124 | 124 | } |
@@ -25,7 +25,9 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | sort( $termIds ); |
| 27 | 27 | sort( $oldTermIds ); |
| 28 | - if( $termIds === $oldTermIds || !$this->isReviewPostId( $postId ))return; |
|
| 28 | + if( $termIds === $oldTermIds || !$this->isReviewPostId( $postId )) { |
|
| 29 | + return; |
|
| 30 | + } |
|
| 29 | 31 | $review = glsr( ReviewManager::class )->single( get_post( $postId )); |
| 30 | 32 | $ignoredTerms = array_intersect( $oldTermIds, $termIds ); |
| 31 | 33 | if( $review->term_ids = array_diff( $oldTermIds, $ignoredTerms )) { |
@@ -52,7 +54,9 @@ discard block |
||
| 52 | 54 | */ |
| 53 | 55 | public function onBeforeDelete( $postId ) |
| 54 | 56 | { |
| 55 | - if( !$this->isReviewPostId( $postId ))return; |
|
| 57 | + if( !$this->isReviewPostId( $postId )) { |
|
| 58 | + return; |
|
| 59 | + } |
|
| 56 | 60 | $review = glsr( ReviewManager::class )->single( get_post( $postId )); |
| 57 | 61 | glsr( CountsManager::class )->decrease( $review ); |
| 58 | 62 | } |
@@ -69,9 +73,13 @@ discard block |
||
| 69 | 73 | { |
| 70 | 74 | if( !$this->isReviewPostId( $postId ) |
| 71 | 75 | || !in_array( $metaKey, ['assigned_to', 'rating', 'review_type'] ) |
| 72 | - )return; |
|
| 76 | + ) { |
|
| 77 | + return; |
|
| 78 | + } |
|
| 73 | 79 | $review = glsr( ReviewManager::class )->single( get_post( $postId )); |
| 74 | - if( $review->$metaKey == $metaValue )return; |
|
| 80 | + if( $review->$metaKey == $metaValue ) { |
|
| 81 | + return; |
|
| 82 | + } |
|
| 75 | 83 | $method = glsr( Helper::class )->buildMethodName( $metaKey, 'onBeforeChange' ); |
| 76 | 84 | call_user_func( [$this, $method], $review, $metaValue ); |
| 77 | 85 | } |
@@ -117,7 +125,9 @@ discard block |
||
| 117 | 125 | */ |
| 118 | 126 | public function onChangeStatus( $newStatus, $oldStatus, WP_Post $post ) |
| 119 | 127 | { |
| 120 | - if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] ))return; |
|
| 128 | + if( $post->post_type != Application::POST_TYPE || in_array( $oldStatus, ['new', $newStatus] )) { |
|
| 129 | + return; |
|
| 130 | + } |
|
| 121 | 131 | $review = glsr( ReviewManager::class )->single( get_post( $post->ID )); |
| 122 | 132 | if( $post->post_status == 'publish' ) { |
| 123 | 133 | glsr( CountsManager::class )->increase( $review ); |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | if( $review->review_type != 'local' )continue; |
| 39 | 39 | $reviews[] = $this->buildReview( $review ); |
| 40 | 40 | } |
| 41 | - if( !empty( $reviews )) { |
|
| 41 | + if( !empty($reviews) ) { |
|
| 42 | 42 | array_walk( $reviews, function( &$review ) { |
| 43 | - unset( $review['@context'] ); |
|
| 44 | - unset( $review['itemReviewed'] ); |
|
| 43 | + unset($review['@context']); |
|
| 44 | + unset($review['itemReviewed']); |
|
| 45 | 45 | }); |
| 46 | 46 | $schema['review'] = $reviews; |
| 47 | 47 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function buildSummary( $args = null ) |
| 56 | 56 | { |
| 57 | - if( is_array( $args )) { |
|
| 57 | + if( is_array( $args ) ) { |
|
| 58 | 58 | $this->args = $args; |
| 59 | 59 | } |
| 60 | 60 | $buildSummary = glsr( Helper::class )->buildMethodName( $this->getSchemaOptionValue( 'type' ), 'buildSummaryFor' ); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $schema = method_exists( $this, $buildSummary ) |
| 63 | 63 | ? $this->$buildSummary() |
| 64 | 64 | : $this->buildSummaryForCustom(); |
| 65 | - if( !empty( $count )) { |
|
| 65 | + if( !empty($count) ) { |
|
| 66 | 66 | $schema->aggregateRating( |
| 67 | 67 | $this->getSchemaType( 'AggregateRating' ) |
| 68 | 68 | ->ratingValue( $this->getRatingValue() ) |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function render() |
| 82 | 82 | { |
| 83 | - if( empty( glsr()->schemas ))return; |
|
| 83 | + if( empty(glsr()->schemas) )return; |
|
| 84 | 84 | printf( '<script type="application/ld+json">%s</script>', json_encode( |
| 85 | 85 | apply_filters( 'site-reviews/schema/all', glsr()->schemas ), |
| 86 | 86 | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES |
| 87 | - )); |
|
| 87 | + ) ); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | { |
| 95 | 95 | $schemas = glsr()->schemas; |
| 96 | 96 | $schemas[] = $schema; |
| 97 | - glsr()->schemas = array_map( 'unserialize', array_unique( array_map( 'serialize', $schemas ))); |
|
| 97 | + glsr()->schemas = array_map( 'unserialize', array_unique( array_map( 'serialize', $schemas ) ) ); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -104,16 +104,16 @@ discard block |
||
| 104 | 104 | protected function buildReview( $review ) |
| 105 | 105 | { |
| 106 | 106 | $schema = $this->getSchemaType( 'Review' ) |
| 107 | - ->doIf( !in_array( 'title', $this->args['hide'] ), function( $schema ) use( $review ) { |
|
| 107 | + ->doIf( !in_array( 'title', $this->args['hide'] ), function( $schema ) use($review) { |
|
| 108 | 108 | $schema->name( $review->title ); |
| 109 | 109 | }) |
| 110 | - ->doIf( !in_array( 'excerpt', $this->args['hide'] ), function( $schema ) use( $review ) { |
|
| 110 | + ->doIf( !in_array( 'excerpt', $this->args['hide'] ), function( $schema ) use($review) { |
|
| 111 | 111 | $schema->reviewBody( $review->content ); |
| 112 | 112 | }) |
| 113 | - ->datePublished(( new DateTime( $review->date ))) |
|
| 114 | - ->author( $this->getSchemaType( 'Person' )->name( $review->author )) |
|
| 115 | - ->itemReviewed( $this->getSchemaType()->name( $this->getSchemaOptionValue( 'name' ))); |
|
| 116 | - if( !empty( $review->rating )) { |
|
| 113 | + ->datePublished( (new DateTime( $review->date )) ) |
|
| 114 | + ->author( $this->getSchemaType( 'Person' )->name( $review->author ) ) |
|
| 115 | + ->itemReviewed( $this->getSchemaType()->name( $this->getSchemaOptionValue( 'name' ) ) ); |
|
| 116 | + if( !empty($review->rating) ) { |
|
| 117 | 117 | $schema->reviewRating( |
| 118 | 118 | $this->getSchemaType( 'Rating' ) |
| 119 | 119 | ->ratingValue( $review->rating ) |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | foreach( $values as $value ) { |
| 134 | 134 | $option = $this->getSchemaOptionValue( $value ); |
| 135 | - if( empty( $option ))continue; |
|
| 135 | + if( empty($option) )continue; |
|
| 136 | 136 | $schema->$value( $option ); |
| 137 | 137 | } |
| 138 | 138 | return $schema; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | { |
| 146 | 146 | return $this->buildSchemaValues( $this->getSchemaType(), [ |
| 147 | 147 | 'description', 'image', 'name', 'url', |
| 148 | - ]); |
|
| 148 | + ] ); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | { |
| 156 | 156 | return $this->buildSchemaValues( $this->buildSummaryForCustom(), [ |
| 157 | 157 | 'address', 'priceRange', 'telephone', |
| 158 | - ]); |
|
| 158 | + ] ); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /** |
@@ -165,10 +165,10 @@ discard block |
||
| 165 | 165 | { |
| 166 | 166 | $offers = $this->buildSchemaValues( $this->getSchemaType( 'AggregateOffer' ), [ |
| 167 | 167 | 'highPrice', 'lowPrice', 'priceCurrency', |
| 168 | - ]); |
|
| 168 | + ] ); |
|
| 169 | 169 | return $this->buildSummaryForCustom() |
| 170 | 170 | ->offers( $offers ) |
| 171 | - ->setProperty( '@id', $this->getSchemaOptionValue( 'url' )); |
|
| 171 | + ->setProperty( '@id', $this->getSchemaOptionValue( 'url' ) ); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
@@ -176,14 +176,14 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | protected function getRatingCounts() |
| 178 | 178 | { |
| 179 | - if( !isset( $this->ratingCounts )) { |
|
| 180 | - $counts = glsr( CountsManager::class )->get([ |
|
| 179 | + if( !isset($this->ratingCounts) ) { |
|
| 180 | + $counts = glsr( CountsManager::class )->get( [ |
|
| 181 | 181 | 'post_ids' => glsr( Helper::class )->convertStringToArray( $this->args['assigned_to'] ), |
| 182 | 182 | 'term_ids' => glsr( ReviewManager::class )->normalizeTerms( $this->args['category'] ), |
| 183 | - ]); |
|
| 183 | + ] ); |
|
| 184 | 184 | $this->ratingCounts = glsr( CountsManager::class )->flatten( $counts, [ |
| 185 | 185 | 'min' => $this->args['rating'], |
| 186 | - ]); |
|
| 186 | + ] ); |
|
| 187 | 187 | } |
| 188 | 188 | return $this->ratingCounts; |
| 189 | 189 | } |
@@ -204,14 +204,14 @@ discard block |
||
| 204 | 204 | protected function getSchemaOption( $option, $fallback ) |
| 205 | 205 | { |
| 206 | 206 | $option = strtolower( $option ); |
| 207 | - if( $schemaOption = trim( (string)get_post_meta( intval( get_the_ID() ), 'schema_'.$option, true ))) { |
|
| 207 | + if( $schemaOption = trim( (string)get_post_meta( intval( get_the_ID() ), 'schema_'.$option, true ) ) ) { |
|
| 208 | 208 | return $schemaOption; |
| 209 | 209 | } |
| 210 | 210 | $setting = glsr( OptionManager::class )->get( 'settings.schema.'.$option ); |
| 211 | - if( is_array( $setting )) { |
|
| 211 | + if( is_array( $setting ) ) { |
|
| 212 | 212 | return $this->getSchemaOptionDefault( $setting, $fallback ); |
| 213 | 213 | } |
| 214 | - return !empty( $setting ) |
|
| 214 | + return !empty($setting) |
|
| 215 | 215 | ? $setting |
| 216 | 216 | : $fallback; |
| 217 | 217 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | $setting = wp_parse_args( $setting, [ |
| 226 | 226 | 'custom' => '', |
| 227 | 227 | 'default' => $fallback, |
| 228 | - ]); |
|
| 228 | + ] ); |
|
| 229 | 229 | return $setting['default'] != 'custom' |
| 230 | 230 | ? $setting['default'] |
| 231 | 231 | : $setting['custom']; |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | if( !is_single() && !is_page() )return; |
| 246 | 246 | $method = glsr( Helper::class )->buildMethodName( $option, 'getThing' ); |
| 247 | - if( method_exists( $this, $method )) { |
|
| 247 | + if( method_exists( $this, $method ) ) { |
|
| 248 | 248 | return $this->$method(); |
| 249 | 249 | } |
| 250 | 250 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | protected function getSchemaType( $type = null ) |
| 257 | 257 | { |
| 258 | - if( !is_string( $type )) { |
|
| 258 | + if( !is_string( $type ) ) { |
|
| 259 | 259 | $type = $this->getSchemaOption( 'type', 'LocalBusiness' ); |
| 260 | 260 | } |
| 261 | 261 | $className = glsr( Helper::class )->buildClassName( $type, 'Modules\Schema' ); |
@@ -270,11 +270,11 @@ discard block |
||
| 270 | 270 | protected function getThingDescription() |
| 271 | 271 | { |
| 272 | 272 | $post = get_post(); |
| 273 | - if( !( $post instanceof WP_Post )) { |
|
| 273 | + if( !($post instanceof WP_Post) ) { |
|
| 274 | 274 | return ''; |
| 275 | 275 | } |
| 276 | - $text = strip_shortcodes( wp_strip_all_tags( $post->post_excerpt )); |
|
| 277 | - return wp_trim_words( $text, apply_filters( 'excerpt_length', 55 )); |
|
| 276 | + $text = strip_shortcodes( wp_strip_all_tags( $post->post_excerpt ) ); |
|
| 277 | + return wp_trim_words( $text, apply_filters( 'excerpt_length', 55 ) ); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | /** |
@@ -35,7 +35,9 @@ discard block |
||
| 35 | 35 | foreach( glsr( ReviewManager::class )->get( $this->args )->results as $review ) { |
| 36 | 36 | // Only include critic reviews that have been directly produced by your site, not reviews from third- party sites or syndicated reviews. |
| 37 | 37 | // @see https://developers.google.com/search/docs/data-types/review |
| 38 | - if( $review->review_type != 'local' )continue; |
|
| 38 | + if( $review->review_type != 'local' ) { |
|
| 39 | + continue; |
|
| 40 | + } |
|
| 39 | 41 | $reviews[] = $this->buildReview( $review ); |
| 40 | 42 | } |
| 41 | 43 | if( !empty( $reviews )) { |
@@ -80,7 +82,9 @@ discard block |
||
| 80 | 82 | */ |
| 81 | 83 | public function render() |
| 82 | 84 | { |
| 83 | - if( empty( glsr()->schemas ))return; |
|
| 85 | + if( empty( glsr()->schemas )) { |
|
| 86 | + return; |
|
| 87 | + } |
|
| 84 | 88 | printf( '<script type="application/ld+json">%s</script>', json_encode( |
| 85 | 89 | apply_filters( 'site-reviews/schema/all', glsr()->schemas ), |
| 86 | 90 | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES |
@@ -132,7 +136,9 @@ discard block |
||
| 132 | 136 | { |
| 133 | 137 | foreach( $values as $value ) { |
| 134 | 138 | $option = $this->getSchemaOptionValue( $value ); |
| 135 | - if( empty( $option ))continue; |
|
| 139 | + if( empty( $option )) { |
|
| 140 | + continue; |
|
| 141 | + } |
|
| 136 | 142 | $schema->$value( $option ); |
| 137 | 143 | } |
| 138 | 144 | return $schema; |
@@ -242,7 +248,9 @@ discard block |
||
| 242 | 248 | if( $value != $fallback ) { |
| 243 | 249 | return $value; |
| 244 | 250 | } |
| 245 | - if( !is_single() && !is_page() )return; |
|
| 251 | + if( !is_single() && !is_page() ) { |
|
| 252 | + return; |
|
| 253 | + } |
|
| 246 | 254 | $method = glsr( Helper::class )->buildMethodName( $option, 'getThing' ); |
| 247 | 255 | if( method_exists( $this, $method )) { |
| 248 | 256 | return $this->$method(); |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | 'avatar' => '', |
| 19 | 19 | 'content' => '', |
| 20 | 20 | 'custom' => '', |
| 21 | - 'date' => get_date_from_gmt( current_time( 'mysql', 1 )), |
|
| 21 | + 'date' => get_date_from_gmt( current_time( 'mysql', 1 ) ), |
|
| 22 | 22 | 'email' => '', |
| 23 | 23 | 'ip_address' => glsr( Helper::class )->getIpAddress(), |
| 24 | 24 | 'pinned' => false, |
@@ -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"> |