@@ -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> |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | public function __get( $key ) |
| 21 | 21 | { |
| 22 | - if( array_key_exists( $key, $this->values )) { |
|
| 22 | + if( array_key_exists( $key, $this->values ) ) { |
|
| 23 | 23 | return $this->values[$key]; |
| 24 | 24 | } |
| 25 | 25 | return ''; |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $this->versions = wp_parse_args( $versions, array( |
| 31 | 31 | 'php' => static::MIN_PHP_VERSION, |
| 32 | 32 | 'wordpress' => static::MIN_WORDPRESS_VERSION, |
| 33 | - )); |
|
| 33 | + ) ); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | if( $this->isValid() ) { |
| 42 | 42 | return true; |
| 43 | 43 | } |
| 44 | - add_action( 'activated_plugin', array( $this, 'deactivate' )); |
|
| 45 | - add_action( 'admin_notices', array( $this, 'deactivate' )); |
|
| 44 | + add_action( 'activated_plugin', array( $this, 'deactivate' ) ); |
|
| 45 | + add_action( 'admin_notices', array( $this, 'deactivate' ) ); |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | filter_input( INPUT_GET, 'plugin_status' ), |
| 138 | 138 | filter_input( INPUT_GET, 'paged' ), |
| 139 | 139 | filter_input( INPUT_GET, 's' ) |
| 140 | - ))); |
|
| 140 | + ) ) ); |
|
| 141 | 141 | exit; |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | defined( 'WPINC' ) || die; |
| 20 | 20 | |
| 21 | -if( !class_exists( 'GL_Plugin_Check_v3' )) { |
|
| 21 | +if( !class_exists( 'GL_Plugin_Check_v3' ) ) { |
|
| 22 | 22 | require_once __DIR__.'/activate.php'; |
| 23 | 23 | } |
| 24 | 24 | if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() )return; |
@@ -27,6 +27,6 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | $app = new GeminiLabs\SiteReviews\Application; |
| 29 | 29 | $app->make( 'Provider' )->register( $app ); |
| 30 | -register_activation_hook( __FILE__, array( $app, 'activate' )); |
|
| 31 | -register_deactivation_hook( __FILE__, array( $app, 'deactivate' )); |
|
| 30 | +register_activation_hook( __FILE__, array( $app, 'activate' ) ); |
|
| 31 | +register_deactivation_hook( __FILE__, array( $app, 'deactivate' ) ); |
|
| 32 | 32 | $app->init(); |
@@ -9,5 +9,5 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | add_filter( 'sbp_exclude_defer_scripts', function( $scriptHandles ) { |
| 11 | 11 | $scriptHandles[] = 'site-reviews/google-recaptcha'; |
| 12 | - return array_keys( array_flip( $scriptHandles )); |
|
| 12 | + return array_keys( array_flip( $scriptHandles ) ); |
|
| 13 | 13 | }); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function __call( $method, array $arguments ) |
| 41 | 41 | { |
| 42 | - $value = isset( $arguments[0] ) |
|
| 42 | + $value = isset($arguments[0]) |
|
| 43 | 43 | ? $arguments[0] |
| 44 | 44 | : ''; |
| 45 | 45 | return $this->setProperty( $method, $value ); |
@@ -96,9 +96,9 @@ discard block |
||
| 96 | 96 | * @param mixed $default |
| 97 | 97 | * @return mixed |
| 98 | 98 | */ |
| 99 | - public function getProperty( $property, $default = null) |
|
| 99 | + public function getProperty( $property, $default = null ) |
|
| 100 | 100 | { |
| 101 | - return isset( $this->properties[$property] ) |
|
| 101 | + return isset($this->properties[$property]) |
|
| 102 | 102 | ? $this->properties[$property] |
| 103 | 103 | : $default; |
| 104 | 104 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | public function offsetUnset( $offset ) |
| 168 | 168 | { |
| 169 | - unset( $this->properties[$offset] ); |
|
| 169 | + unset($this->properties[$offset]); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
@@ -212,16 +212,16 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | protected function getParents( $parents = null ) |
| 214 | 214 | { |
| 215 | - if( !isset( $parents )) { |
|
| 215 | + if( !isset($parents) ) { |
|
| 216 | 216 | $parents = $this->parents; |
| 217 | 217 | } |
| 218 | 218 | $newParents = $parents; |
| 219 | 219 | foreach( $parents as $parent ) { |
| 220 | 220 | $parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ ); |
| 221 | - if( !class_exists( $parentClass ))continue; |
|
| 222 | - $newParents = array_merge( $newParents, $this->getParents( (new $parentClass)->parents )); |
|
| 221 | + if( !class_exists( $parentClass ) )continue; |
|
| 222 | + $newParents = array_merge( $newParents, $this->getParents( (new $parentClass)->parents ) ); |
|
| 223 | 223 | } |
| 224 | - return array_values( array_unique( $newParents )); |
|
| 224 | + return array_values( array_unique( $newParents ) ); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
@@ -232,8 +232,8 @@ discard block |
||
| 232 | 232 | $parents = $this->getParents(); |
| 233 | 233 | foreach( $parents as $parent ) { |
| 234 | 234 | $parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ ); |
| 235 | - if( !class_exists( $parentClass ))continue; |
|
| 236 | - $this->allowed = array_values( array_unique( array_merge( (new $parentClass)->allowed, $this->allowed ))); |
|
| 235 | + if( !class_exists( $parentClass ) )continue; |
|
| 236 | + $this->allowed = array_values( array_unique( array_merge( (new $parentClass)->allowed, $this->allowed ) ) ); |
|
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | 239 | |
@@ -243,17 +243,17 @@ discard block |
||
| 243 | 243 | */ |
| 244 | 244 | protected function serializeProperty( $property ) |
| 245 | 245 | { |
| 246 | - if( is_array( $property )) { |
|
| 246 | + if( is_array( $property ) ) { |
|
| 247 | 247 | return array_map( [$this, 'serializeProperty'], $property ); |
| 248 | 248 | } |
| 249 | 249 | if( $property instanceof Type ) { |
| 250 | 250 | $property = $property->toArray(); |
| 251 | - unset( $property['@context'] ); |
|
| 251 | + unset($property['@context']); |
|
| 252 | 252 | } |
| 253 | 253 | if( $property instanceof DateTimeInterface ) { |
| 254 | 254 | $property = $property->format( DateTime::ATOM ); |
| 255 | 255 | } |
| 256 | - if( is_object( $property )) { |
|
| 256 | + if( is_object( $property ) ) { |
|
| 257 | 257 | throw new InvalidProperty(); |
| 258 | 258 | } |
| 259 | 259 | return $property; |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | public function routeAdminPostRequest() |
| 17 | 17 | { |
| 18 | 18 | $request = $this->getRequest(); |
| 19 | - if( !$this->isValidPostRequest( $request ))return; |
|
| 19 | + if( !$this->isValidPostRequest( $request ) )return; |
|
| 20 | 20 | check_admin_referer( $request['action'] ); |
| 21 | 21 | $this->routeRequest( 'admin', $request['action'], $request ); |
| 22 | 22 | } |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | { |
| 41 | 41 | if( is_admin() )return; |
| 42 | 42 | $request = $this->getRequest(); |
| 43 | - if( !$this->isValidPostRequest( $request ))return; |
|
| 44 | - if( !$this->isValidPublicNonce( $request ))return; |
|
| 43 | + if( !$this->isValidPostRequest( $request ) )return; |
|
| 44 | + if( !$this->isValidPublicNonce( $request ) )return; |
|
| 45 | 45 | $this->routeRequest( 'public', $request['action'], $request ); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -51,10 +51,10 @@ discard block |
||
| 51 | 51 | protected function checkAjaxNonce( array $request ) |
| 52 | 52 | { |
| 53 | 53 | if( !is_user_logged_in() )return; |
| 54 | - if( !isset( $request['nonce'] )) { |
|
| 54 | + if( !isset($request['nonce']) ) { |
|
| 55 | 55 | $this->sendAjaxError( 'The request is missing a nonce', $request ); |
| 56 | 56 | } |
| 57 | - if( !wp_verify_nonce( $request['nonce'], $request['action'] )) { |
|
| 57 | + if( !wp_verify_nonce( $request['nonce'], $request['action'] ) ) { |
|
| 58 | 58 | $this->sendAjaxError( 'The request failed the nonce check', $request, 403 ); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | protected function checkAjaxRequest( array $request ) |
| 66 | 66 | { |
| 67 | - if( !isset( $request['action'] )) { |
|
| 67 | + if( !isset($request['action']) ) { |
|
| 68 | 68 | $this->sendAjaxError( 'The request must include an action', $request ); |
| 69 | 69 | } |
| 70 | - if( empty( $request['ajax_request'] )) { |
|
| 70 | + if( empty($request['ajax_request']) ) { |
|
| 71 | 71 | $this->sendAjaxError( 'The request is invalid', $request ); |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | return glsr( Helper::class )->filterInputArray( Application::ID ); |
| 85 | 85 | } |
| 86 | 86 | $request = glsr( Helper::class )->filterInputArray( 'request' ); |
| 87 | - if( empty( $request )) { |
|
| 87 | + if( empty($request) ) { |
|
| 88 | 88 | $request = glsr( Helper::class )->filterInputArray( Application::ID ); |
| 89 | 89 | } |
| 90 | 90 | return $this->normalizeRequest( $request ); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | protected function isValidPostRequest( array $request = [] ) |
| 97 | 97 | { |
| 98 | - return !empty( $request['action'] ) && empty( $request['ajax_request'] ); |
|
| 98 | + return !empty($request['action']) && empty($request['ajax_request']); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | protected function isValidPublicNonce( array $request ) |
| 105 | 105 | { |
| 106 | - if( is_user_logged_in() && !wp_verify_nonce( $request['nonce'], $request['action'] )) { |
|
| 106 | + if( is_user_logged_in() && !wp_verify_nonce( $request['nonce'], $request['action'] ) ) { |
|
| 107 | 107 | glsr_log()->error( 'Nonce check failed for public request' )->info( $request ); |
| 108 | 108 | return false; |
| 109 | 109 | } |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | protected function routeRequest( $type, $action, array $request = [] ) |
| 133 | 133 | { |
| 134 | 134 | $actionHook = 'site-reviews/route/'.$type.'/request'; |
| 135 | - $controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' )); |
|
| 135 | + $controller = glsr( glsr( Helper::class )->buildClassName( $type.'-controller', 'Controllers' ) ); |
|
| 136 | 136 | $method = glsr( Helper::class )->buildMethodName( $action, 'router' ); |
| 137 | 137 | $request = apply_filters( 'site-reviews/route/request', $request, $action, $type ); |
| 138 | 138 | do_action( $actionHook, $action, $request ); |
| 139 | - if( is_callable( [$controller, $method] )) { |
|
| 139 | + if( is_callable( [$controller, $method] ) ) { |
|
| 140 | 140 | call_user_func( [$controller, $method], $request ); |
| 141 | 141 | return; |
| 142 | 142 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | protected function sendAjaxError( $error, array $request, $statusCode = 400 ) |
| 154 | 154 | { |
| 155 | 155 | glsr_log()->error( $error )->info( $request ); |
| 156 | - wp_send_json_error([ |
|
| 156 | + wp_send_json_error( [ |
|
| 157 | 157 | 'message' => __( 'The form could not be submitted. Please notify the site administrator.', 'site-reviews' ), |
| 158 | 158 | 'error' => $error, |
| 159 | 159 | ], $statusCode ); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | 'post_type' => Application::POST_TYPE, |
| 34 | 34 | ]; |
| 35 | 35 | $postId = wp_insert_post( $post, true ); |
| 36 | - if( is_wp_error( $postId )) { |
|
| 36 | + if( is_wp_error( $postId ) ) { |
|
| 37 | 37 | glsr_log()->error( $postId->get_error_message() ); |
| 38 | 38 | return 0; |
| 39 | 39 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function delete( $metaReviewId ) |
| 50 | 50 | { |
| 51 | - if( $postId = $this->getPostId( $metaReviewId )) { |
|
| 51 | + if( $postId = $this->getPostId( $metaReviewId ) ) { |
|
| 52 | 52 | wp_delete_post( $postId, true ); |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $paged = glsr( QueryBuilder::class )->getPaged( |
| 71 | 71 | wp_validate_boolean( $args['pagination'] ) |
| 72 | 72 | ); |
| 73 | - $reviews = new WP_Query([ |
|
| 73 | + $reviews = new WP_Query( [ |
|
| 74 | 74 | 'meta_key' => 'pinned', |
| 75 | 75 | 'meta_query' => $metaQuery, |
| 76 | 76 | 'offset' => $args['offset'], |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | 'post_type' => Application::POST_TYPE, |
| 84 | 84 | 'posts_per_page' => $args['count'], |
| 85 | 85 | 'tax_query' => $taxQuery, |
| 86 | - ]); |
|
| 86 | + ] ); |
|
| 87 | 87 | return (object)[ |
| 88 | 88 | 'results' => array_map( [$this, 'single'], $reviews->posts ), |
| 89 | 89 | 'max_num_pages' => $reviews->max_num_pages, |
@@ -107,13 +107,13 @@ discard block |
||
| 107 | 107 | { |
| 108 | 108 | if( get_post_field( 'post_type', $postId ) != Application::POST_TYPE )return; |
| 109 | 109 | delete_post_meta( $postId, '_edit_last' ); |
| 110 | - $result = wp_update_post([ |
|
| 110 | + $result = wp_update_post( [ |
|
| 111 | 111 | 'ID' => $postId, |
| 112 | 112 | 'post_content' => get_post_meta( $postId, 'content', true ), |
| 113 | 113 | 'post_date' => get_post_meta( $postId, 'date', true ), |
| 114 | 114 | 'post_title' => get_post_meta( $postId, 'title', true ), |
| 115 | - ]); |
|
| 116 | - if( is_wp_error( $result )) { |
|
| 115 | + ] ); |
|
| 116 | + if( is_wp_error( $result ) ) { |
|
| 117 | 117 | glsr_log()->error( $result->get_error_message() ); |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | protected function getNewPostStatus( array $review, $isBlacklisted ) |
| 136 | 136 | { |
| 137 | 137 | $requireApprovalOption = glsr( OptionManager::class )->get( 'settings.general.require.approval' ); |
| 138 | - return $review['review_type'] == 'local' && ( $requireApprovalOption == 'yes' || $isBlacklisted ) |
|
| 138 | + return $review['review_type'] == 'local' && ($requireApprovalOption == 'yes' || $isBlacklisted) |
|
| 139 | 139 | ? 'pending' |
| 140 | 140 | : 'publish'; |
| 141 | 141 | } |
@@ -147,10 +147,10 @@ discard block |
||
| 147 | 147 | protected function normalizeTerms( $commaSeparatedTermIds ) |
| 148 | 148 | { |
| 149 | 149 | $terms = []; |
| 150 | - $termIds = array_map( 'trim', explode( ',', $commaSeparatedTermIds )); |
|
| 150 | + $termIds = array_map( 'trim', explode( ',', $commaSeparatedTermIds ) ); |
|
| 151 | 151 | foreach( $termIds as $termId ) { |
| 152 | 152 | $term = term_exists( $termId, Application::TAXONOMY ); |
| 153 | - if( !isset( $term['term_id'] ))continue; |
|
| 153 | + if( !isset($term['term_id']) )continue; |
|
| 154 | 154 | $terms[] = intval( $term['term_id'] ); |
| 155 | 155 | } |
| 156 | 156 | return $terms; |
@@ -164,9 +164,9 @@ discard block |
||
| 164 | 164 | protected function setTerms( $postId, $termIds ) |
| 165 | 165 | { |
| 166 | 166 | $terms = $this->normalizeTerms( $termIds ); |
| 167 | - if( empty( $terms ))return; |
|
| 167 | + if( empty($terms) )return; |
|
| 168 | 168 | $result = wp_set_object_terms( $postId, $terms, Application::TAXONOMY ); |
| 169 | - if( is_wp_error( $result )) { |
|
| 169 | + if( is_wp_error( $result ) ) { |
|
| 170 | 170 | glsr_log()->error( $result->get_error_message() ); |
| 171 | 171 | } |
| 172 | 172 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | natsort( $routines ); |
| 18 | 18 | array_walk( $routines, function( $routine ) { |
| 19 | 19 | $parts = explode( '__', $routine ); |
| 20 | - if( version_compare( glsr()->version, end( $parts ), '>=' ))return; |
|
| 20 | + if( version_compare( glsr()->version, end( $parts ), '>=' ) )return; |
|
| 21 | 21 | call_user_func( [$this, $routine] ); |
| 22 | 22 | }); |
| 23 | 23 | $this->updateVersion(); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public function updateVersion() |
| 30 | 30 | { |
| 31 | 31 | $currentVersion = glsr( OptionManager::class )->get( 'version' ); |
| 32 | - if( version_compare( $currentVersion, glsr()->version, '<' )) { |
|
| 32 | + if( version_compare( $currentVersion, glsr()->version, '<' ) ) { |
|
| 33 | 33 | glsr( OptionManager::class )->set( 'version', glsr()->version ); |
| 34 | 34 | } |
| 35 | 35 | if( $currentVersion != glsr()->version ) { |