@@ -22,7 +22,8 @@ |
||
| 22 | 22 | protected $public; |
| 23 | 23 | protected $translator; |
| 24 | 24 | |
| 25 | - public function __construct( Application $app ) { |
|
| 25 | + public function __construct( Application $app ) |
|
| 26 | + { |
|
| 26 | 27 | $this->app = $app; |
| 27 | 28 | $this->admin = $app->make( AdminController::class ); |
| 28 | 29 | $this->basename = plugin_basename( $app->file ); |
@@ -25,7 +25,8 @@ |
||
| 25 | 25 | protected $router; |
| 26 | 26 | protected $settings; |
| 27 | 27 | |
| 28 | - public function __construct( Application $app ) { |
|
| 28 | + public function __construct( Application $app ) |
|
| 29 | + { |
|
| 29 | 30 | $this->app = $app; |
| 30 | 31 | $this->admin = $app->make( AdminController::class ); |
| 31 | 32 | $this->editor = $app->make( EditorController::class ); |
@@ -171,8 +171,12 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | protected function validateAkismet() |
| 173 | 173 | { |
| 174 | - if( !empty( $this->error ))return; |
|
| 175 | - if( !glsr( Akismet::class )->isSpam( $this->request ))return; |
|
| 174 | + if( !empty( $this->error )) { |
|
| 175 | + return; |
|
| 176 | + } |
|
| 177 | + if( !glsr( Akismet::class )->isSpam( $this->request )) { |
|
| 178 | + return; |
|
| 179 | + } |
|
| 176 | 180 | $this->setSessionValues( 'errors', [], 'Akismet caught a spam submission:' ); |
| 177 | 181 | $this->error = __( 'Your review cannot be submitted at this time. Please try again later.', 'site-reviews' ); |
| 178 | 182 | } |
@@ -182,8 +186,12 @@ discard block |
||
| 182 | 186 | */ |
| 183 | 187 | protected function validateBlacklist() |
| 184 | 188 | { |
| 185 | - if( !empty( $this->error ))return; |
|
| 186 | - if( !glsr( Blacklist::class )->isBlacklisted( $this->request ))return; |
|
| 189 | + if( !empty( $this->error )) { |
|
| 190 | + return; |
|
| 191 | + } |
|
| 192 | + if( !glsr( Blacklist::class )->isBlacklisted( $this->request )) { |
|
| 193 | + return; |
|
| 194 | + } |
|
| 187 | 195 | $blacklistAction = glsr( OptionManager::class )->get( 'settings.submissions.blacklist.action' ); |
| 188 | 196 | if( $blacklistAction == 'unapprove' ) { |
| 189 | 197 | $this->request['blacklisted'] = true; |
@@ -199,9 +207,13 @@ discard block |
||
| 199 | 207 | */ |
| 200 | 208 | protected function validateCustom() |
| 201 | 209 | { |
| 202 | - if( !empty( $this->error ))return; |
|
| 210 | + if( !empty( $this->error )) { |
|
| 211 | + return; |
|
| 212 | + } |
|
| 203 | 213 | $validated = apply_filters( 'site-reviews/validate/review/submission', true, $this->request ); |
| 204 | - if( $validated === true )return; |
|
| 214 | + if( $validated === true ) { |
|
| 215 | + return; |
|
| 216 | + } |
|
| 205 | 217 | $this->setSessionValues( 'errors', [] ); |
| 206 | 218 | $this->setSessionValues( 'values', $this->request ); |
| 207 | 219 | $this->error = is_string( $validated ) |
@@ -214,8 +226,12 @@ discard block |
||
| 214 | 226 | */ |
| 215 | 227 | protected function validateHoneyPot() |
| 216 | 228 | { |
| 217 | - if( !empty( $this->error ))return; |
|
| 218 | - if( empty( $this->request['gotcha'] ))return; |
|
| 229 | + if( !empty( $this->error )) { |
|
| 230 | + return; |
|
| 231 | + } |
|
| 232 | + if( empty( $this->request['gotcha'] )) { |
|
| 233 | + return; |
|
| 234 | + } |
|
| 219 | 235 | $this->setSessionValues( 'errors', [], 'The Honeypot caught a bad submission:' ); |
| 220 | 236 | $this->error = __( 'The review submission failed. Please notify the site administrator.', 'site-reviews' ); |
| 221 | 237 | } |
@@ -225,7 +241,9 @@ discard block |
||
| 225 | 241 | */ |
| 226 | 242 | protected function validateRecaptcha() |
| 227 | 243 | { |
| 228 | - if( !empty( $this->error ))return; |
|
| 244 | + if( !empty( $this->error )) { |
|
| 245 | + return; |
|
| 246 | + } |
|
| 229 | 247 | $isValid = $this->isRecaptchaResponseValid(); |
| 230 | 248 | if( is_null( $isValid )) { |
| 231 | 249 | $this->setSessionValues( 'recaptcha', true ); |
@@ -3,7 +3,9 @@ |
||
| 3 | 3 | defined( 'WP_UNINSTALL_PLUGIN' ) || die; |
| 4 | 4 | |
| 5 | 5 | require_once __DIR__.'/site-reviews.php'; |
| 6 | -if( !GL_Plugin_Check_v1::isValid( array( 'wordpress' => '4.7.0' )))return; |
|
| 6 | +if( !GL_Plugin_Check_v1::isValid( array( 'wordpress' => '4.7.0' ))) { |
|
| 7 | + return; |
|
| 8 | +} |
|
| 7 | 9 | |
| 8 | 10 | delete_option( GeminiLabs\SiteReviews\Database\OptionManager::databaseKey() ); |
| 9 | 11 | delete_option( 'widget_'.glsr()->id.'_site-reviews' ); |
@@ -53,7 +53,9 @@ |
||
| 53 | 53 | protected function normalize( array $settings ) |
| 54 | 54 | { |
| 55 | 55 | array_walk( $settings, function( &$setting ) { |
| 56 | - if( isset( $setting['default'] ))return; |
|
| 56 | + if( isset( $setting['default'] )) { |
|
| 57 | + return; |
|
| 58 | + } |
|
| 57 | 59 | $setting['default'] = ''; |
| 58 | 60 | }); |
| 59 | 61 | return $settings; |
@@ -91,7 +91,9 @@ discard block |
||
| 91 | 91 | get_mu_plugins(), |
| 92 | 92 | get_plugins( '/../'.basename( WPMU_PLUGIN_DIR )) |
| 93 | 93 | ); |
| 94 | - if( empty( $plugins ))return; |
|
| 94 | + if( empty( $plugins )) { |
|
| 95 | + return; |
|
| 96 | + } |
|
| 95 | 97 | return $this->normalizePluginList( $plugins ); |
| 96 | 98 | } |
| 97 | 99 | |
@@ -100,7 +102,9 @@ discard block |
||
| 100 | 102 | */ |
| 101 | 103 | public function getMultisitePluginDetails() |
| 102 | 104 | { |
| 103 | - if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] )))return; |
|
| 105 | + if( !is_multisite() || empty( get_site_option( 'active_sitewide_plugins', [] ))) { |
|
| 106 | + return; |
|
| 107 | + } |
|
| 104 | 108 | return $this->normalizePluginList( wp_get_active_network_plugins() ); |
| 105 | 109 | } |
| 106 | 110 | |
@@ -154,12 +158,16 @@ discard block |
||
| 154 | 158 | $settings = glsr( OptionManager::class )->get( 'settings', [] ); |
| 155 | 159 | $settings = $helper->flattenArray( $settings, true ); |
| 156 | 160 | foreach( ['submissions.recaptcha.key', 'submissions.recaptcha.secret'] as $key ) { |
| 157 | - if( empty( $settings[$key] ))continue; |
|
| 161 | + if( empty( $settings[$key] )) { |
|
| 162 | + continue; |
|
| 163 | + } |
|
| 158 | 164 | $settings[$key] = str_repeat( '*', 10 ); |
| 159 | 165 | } |
| 160 | 166 | $details = []; |
| 161 | 167 | foreach( $settings as $key => $value ) { |
| 162 | - if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ))continue; |
|
| 168 | + if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key )) { |
|
| 169 | + continue; |
|
| 170 | + } |
|
| 163 | 171 | $value = htmlspecialchars( trim( preg_replace('/\s\s+/', '\\n', $value )), ENT_QUOTES, 'UTF-8' ); |
| 164 | 172 | $details[$key] = $value; |
| 165 | 173 | } |
@@ -16,7 +16,9 @@ discard block |
||
| 16 | 16 | public function routeAdminPostRequest() |
| 17 | 17 | { |
| 18 | 18 | $request = filter_input( INPUT_POST, Application::ID, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); |
| 19 | - if( !isset( $request['action'] ))return; |
|
| 19 | + if( !isset( $request['action'] )) { |
|
| 20 | + return; |
|
| 21 | + } |
|
| 20 | 22 | $this->checkNonce( $request['action'] ); |
| 21 | 23 | $this->routeRequest( 'admin', $request['action'], $request ); |
| 22 | 24 | } |
@@ -71,7 +73,9 @@ discard block |
||
| 71 | 73 | public function routeWebhookRequest() |
| 72 | 74 | { |
| 73 | 75 | $request = filter_input( INPUT_GET, sprintf( '%s-hook', Application::ID )); |
| 74 | - if( !$request )return; |
|
| 76 | + if( !$request ) { |
|
| 77 | + return; |
|
| 78 | + } |
|
| 75 | 79 | // @todo manage webhook here |
| 76 | 80 | } |
| 77 | 81 | |
@@ -42,7 +42,9 @@ discard block |
||
| 42 | 42 | $options = $this->all(); |
| 43 | 43 | $pointer = &$options; |
| 44 | 44 | foreach( $keys as $key ) { |
| 45 | - if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] ))continue; |
|
| 45 | + if( !isset( $pointer[$key] ) || !is_array( $pointer[$key] )) { |
|
| 46 | + continue; |
|
| 47 | + } |
|
| 46 | 48 | $pointer = &$pointer[$key]; |
| 47 | 49 | } |
| 48 | 50 | unset( $pointer[$last] ); |
@@ -77,7 +79,9 @@ discard block |
||
| 77 | 79 | glsr( DefaultsManager::class )->defaults() |
| 78 | 80 | ); |
| 79 | 81 | array_walk( $options, function( &$value ) { |
| 80 | - if( !is_string( $value ))return; |
|
| 82 | + if( !is_string( $value )) { |
|
| 83 | + return; |
|
| 84 | + } |
|
| 81 | 85 | $value = wp_kses( $value, wp_kses_allowed_html( 'post' )); |
| 82 | 86 | }); |
| 83 | 87 | return glsr( Helper::class )->convertDotNotationArray( $options ); |
@@ -86,7 +86,9 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function renderFilters( $postType ) |
| 88 | 88 | { |
| 89 | - if( $postType !== Application::POST_TYPE )return; |
|
| 89 | + if( $postType !== Application::POST_TYPE ) { |
|
| 90 | + return; |
|
| 91 | + } |
|
| 90 | 92 | if( !( $status = filter_input( INPUT_GET, 'post_status' ))) { |
| 91 | 93 | $status = 'publish'; |
| 92 | 94 | } |
@@ -103,7 +105,9 @@ discard block |
||
| 103 | 105 | */ |
| 104 | 106 | public function renderValues( $column, $postId ) |
| 105 | 107 | { |
| 106 | - if( glsr_current_screen()->post_type != Application::POST_TYPE )return; |
|
| 108 | + if( glsr_current_screen()->post_type != Application::POST_TYPE ) { |
|
| 109 | + return; |
|
| 110 | + } |
|
| 107 | 111 | $method = glsr( Helper::class )->buildMethodName( $column, 'buildColumn' ); |
| 108 | 112 | echo method_exists( $this, $method ) |
| 109 | 113 | ? call_user_func( [$this, $method], $postId ) |
@@ -116,7 +120,9 @@ discard block |
||
| 116 | 120 | */ |
| 117 | 121 | protected function renderFilterRatings( $ratings ) |
| 118 | 122 | { |
| 119 | - if( empty( $ratings ))return; |
|
| 123 | + if( empty( $ratings )) { |
|
| 124 | + return; |
|
| 125 | + } |
|
| 120 | 126 | $ratings = array_flip( array_reverse( $ratings )); |
| 121 | 127 | array_walk( $ratings, function( &$value, $key ) { |
| 122 | 128 | $label = _n( '%s star', '%s stars', $key, 'site-reviews' ); |
@@ -139,7 +145,9 @@ discard block |
||
| 139 | 145 | */ |
| 140 | 146 | protected function renderFilterTypes( $types ) |
| 141 | 147 | { |
| 142 | - if( count( glsr()->reviewTypes ) < 2 )return; |
|
| 148 | + if( count( glsr()->reviewTypes ) < 2 ) { |
|
| 149 | + return; |
|
| 150 | + } |
|
| 143 | 151 | echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [ |
| 144 | 152 | 'class' => 'screen-reader-text', |
| 145 | 153 | 'for' => 'review_type', |