@@ -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> |
@@ -46,9 +46,12 @@ |
||
46 | 46 | <option value="<?= $slug; ?>" class="hide-if-no-js"><?= $details['name']; ?></option> |
47 | 47 | <?php endforeach; ?> |
48 | 48 | </select> |
49 | - <?php else: ?> |
|
49 | + <?php else { |
|
50 | + : ?> |
|
50 | 51 | <?php foreach( $sites as $slug => $details ) : ?> |
51 | - <input type="hidden" name="{{ id }}[site]" value="<?= $slug; ?>"> |
|
52 | + <input type="hidden" name="{{ id }}[site]" value="<?= $slug; |
|
53 | +} |
|
54 | +?>"> |
|
52 | 55 | <?php endforeach; ?> |
53 | 56 | <?php endif; ?> |
54 | 57 | <input type="hidden" name="{{ id }}[action]" value="sync-reviews"> |
@@ -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 ''; |
@@ -60,7 +60,9 @@ |
||
60 | 60 | */ |
61 | 61 | public function deactivate( $plugin ) |
62 | 62 | { |
63 | - if( $this->isValid() )return; |
|
63 | + if( $this->isValid() ) { |
|
64 | + return; |
|
65 | + } |
|
64 | 66 | $pluginSlug = plugin_basename( $this->file ); |
65 | 67 | if( $plugin == $pluginSlug ) { |
66 | 68 | $this->redirect(); //exit |
@@ -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 | } |
@@ -3,7 +3,9 @@ |
||
3 | 3 | defined( 'WP_UNINSTALL_PLUGIN' ) || die; |
4 | 4 | |
5 | 5 | require_once __DIR__.'/site-reviews.php'; |
6 | -if( !(new GL_Plugin_Check_v3( __FILE__ ))->isValid() )return; |
|
6 | +if( !(new GL_Plugin_Check_v3( __FILE__ ))->isValid() ) { |
|
7 | + return; |
|
8 | +} |
|
7 | 9 | |
8 | 10 | delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey() ); |
9 | 11 | delete_option( 'widget_'.glsr()->id.'_site-reviews' ); |
@@ -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(); |
@@ -21,7 +21,9 @@ |
||
21 | 21 | if( !class_exists( 'GL_Plugin_Check_v3' )) { |
22 | 22 | require_once __DIR__.'/activate.php'; |
23 | 23 | } |
24 | -if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() )return; |
|
24 | +if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() ) { |
|
25 | + return; |
|
26 | +} |
|
25 | 27 | require_once __DIR__.'/autoload.php'; |
26 | 28 | require_once __DIR__.'/compatibility.php'; |
27 | 29 | require_once __DIR__.'/helpers.php'; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $this->errors = $args['errors']; |
22 | 22 | return glsr( Builder::class )->div( wpautop( $args['message'] ), [ |
23 | 23 | 'class' => $this->getClass(), |
24 | - ]); |
|
24 | + ] ); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | protected function getClass() |
31 | 31 | { |
32 | - $errorClass = !empty( $this->errors ) |
|
32 | + $errorClass = !empty($this->errors) |
|
33 | 33 | ? 'glsr-has-errors' |
34 | 34 | : ''; |
35 | 35 | return trim( 'glsr-form-messages '.$errorClass ); |
@@ -16,7 +16,9 @@ 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 )) { |
|
20 | + return; |
|
21 | + } |
|
20 | 22 | check_admin_referer( $request['action'] ); |
21 | 23 | $this->routeRequest( 'admin', $request['action'], $request ); |
22 | 24 | } |
@@ -38,10 +40,16 @@ discard block |
||
38 | 40 | */ |
39 | 41 | public function routePublicPostRequest() |
40 | 42 | { |
41 | - if( is_admin() )return; |
|
43 | + if( is_admin() ) { |
|
44 | + return; |
|
45 | + } |
|
42 | 46 | $request = $this->getRequest(); |
43 | - if( !$this->isValidPostRequest( $request ))return; |
|
44 | - if( !$this->isValidPublicNonce( $request ))return; |
|
47 | + if( !$this->isValidPostRequest( $request )) { |
|
48 | + return; |
|
49 | + } |
|
50 | + if( !$this->isValidPublicNonce( $request )) { |
|
51 | + return; |
|
52 | + } |
|
45 | 53 | $this->routeRequest( 'public', $request['action'], $request ); |
46 | 54 | } |
47 | 55 | |
@@ -50,7 +58,9 @@ discard block |
||
50 | 58 | */ |
51 | 59 | protected function checkAjaxNonce( array $request ) |
52 | 60 | { |
53 | - if( !is_user_logged_in() )return; |
|
61 | + if( !is_user_logged_in() ) { |
|
62 | + return; |
|
63 | + } |
|
54 | 64 | if( !isset( $request['nonce'] )) { |
55 | 65 | $this->sendAjaxError( 'The request is missing a nonce', $request ); |
56 | 66 | } |
@@ -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 ); |
@@ -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 | }); |