@@ -35,7 +35,9 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public function renderTaxonomyFilter() |
| 37 | 37 | { |
| 38 | - if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY ))return; |
|
| 38 | + if( !is_object_in_taxonomy( get_current_screen()->post_type, Application::TAXONOMY )) { |
|
| 39 | + return; |
|
| 40 | + } |
|
| 39 | 41 | glsr( Html::class )->render()->label( __( 'Filter by category', 'site-reviews' ), [ |
| 40 | 42 | 'class' => 'screen-reader-text', |
| 41 | 43 | 'for' => Application::TAXONOMY, |
@@ -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', |
@@ -48,7 +48,9 @@ |
||
| 48 | 48 | public function filterUpdateMessages( array $messages ) |
| 49 | 49 | { |
| 50 | 50 | $post = get_post(); |
| 51 | - if( !( $post instanceof WP_Post ))return; |
|
| 51 | + if( !( $post instanceof WP_Post )) { |
|
| 52 | + return; |
|
| 53 | + } |
|
| 52 | 54 | $strings = $this->getReviewLabels(); |
| 53 | 55 | $restored = filter_input( INPUT_GET, 'revision' ); |
| 54 | 56 | if( $revisionTitle = wp_post_revision_title( intval( $restored ), false )) { |
@@ -107,7 +107,9 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function renderReviewEditor( WP_Post $post ) |
| 109 | 109 | { |
| 110 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
| 110 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) { |
|
| 111 | + return; |
|
| 112 | + } |
|
| 111 | 113 | glsr()->render( 'partials/editor/review', [ |
| 112 | 114 | 'post' => $post, |
| 113 | 115 | ]); |
@@ -119,7 +121,9 @@ discard block |
||
| 119 | 121 | */ |
| 120 | 122 | public function renderReviewNotice( WP_Post $post ) |
| 121 | 123 | { |
| 122 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
| 124 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) { |
|
| 125 | + return; |
|
| 126 | + } |
|
| 123 | 127 | glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' )); |
| 124 | 128 | glsr( Html::class )->renderTemplate( 'partials/editor/notice', [ |
| 125 | 129 | 'context' => [ |
@@ -134,13 +138,19 @@ discard block |
||
| 134 | 138 | */ |
| 135 | 139 | public function renderTinymceButton() |
| 136 | 140 | { |
| 137 | - if( glsr_current_screen()->base != 'post' )return; |
|
| 141 | + if( glsr_current_screen()->base != 'post' ) { |
|
| 142 | + return; |
|
| 143 | + } |
|
| 138 | 144 | $shortcodes = []; |
| 139 | 145 | foreach( glsr()->mceShortcodes as $shortcode => $values ) { |
| 140 | - if( !apply_filters( sanitize_title( $shortcode ).'_condition', true ))continue; |
|
| 146 | + if( !apply_filters( sanitize_title( $shortcode ).'_condition', true )) { |
|
| 147 | + continue; |
|
| 148 | + } |
|
| 141 | 149 | $shortcodes[$shortcode] = $values; |
| 142 | 150 | } |
| 143 | - if( empty( $shortcodes ))return; |
|
| 151 | + if( empty( $shortcodes )) { |
|
| 152 | + return; |
|
| 153 | + } |
|
| 144 | 154 | glsr()->render( 'partials/editor/tinymce', [ |
| 145 | 155 | 'shortcodes' => $shortcodes, |
| 146 | 156 | ]); |
@@ -72,7 +72,9 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function send() |
| 74 | 74 | { |
| 75 | - if( !$this->message || !$this->subject || !$this->to )return; |
|
| 75 | + if( !$this->message || !$this->subject || !$this->to ) { |
|
| 76 | + return; |
|
| 77 | + } |
|
| 76 | 78 | $sent = wp_mail( |
| 77 | 79 | $this->to, |
| 78 | 80 | $this->subject, |
@@ -90,8 +92,12 @@ discard block |
||
| 90 | 92 | */ |
| 91 | 93 | public function buildPlainTextMessage( PHPMailer $phpmailer ) |
| 92 | 94 | { |
| 93 | - if( empty( $this->email ))return; |
|
| 94 | - if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ))return; |
|
| 95 | + if( empty( $this->email )) { |
|
| 96 | + return; |
|
| 97 | + } |
|
| 98 | + if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody )) { |
|
| 99 | + return; |
|
| 100 | + } |
|
| 95 | 101 | $message = $this->stripHtmlTags( $phpmailer->Body ); |
| 96 | 102 | $phpmailer->AltBody = apply_filters( 'site-reviews/email/message', $message, 'text', $this ); |
| 97 | 103 | } |
@@ -29,7 +29,8 @@ |
||
| 29 | 29 | protected $settings; |
| 30 | 30 | protected $taxonomy; |
| 31 | 31 | |
| 32 | - public function __construct( Application $app ) { |
|
| 32 | + public function __construct( Application $app ) |
|
| 33 | + { |
|
| 33 | 34 | $this->app = $app; |
| 34 | 35 | $this->admin = $app->make( AdminController::class ); |
| 35 | 36 | $this->editor = $app->make( EditorController::class ); |
@@ -16,9 +16,13 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $queries = []; |
| 18 | 18 | foreach( $keys as $key ) { |
| 19 | - if( !array_key_exists( $key, $values ))continue; |
|
| 19 | + if( !array_key_exists( $key, $values )) { |
|
| 20 | + continue; |
|
| 21 | + } |
|
| 20 | 22 | $methodName = glsr( Helper::class )->buildMethodName( $key, __FUNCTION__ ); |
| 21 | - if( !method_exists( $this, $methodName ))continue; |
|
| 23 | + if( !method_exists( $this, $methodName )) { |
|
| 24 | + continue; |
|
| 25 | + } |
|
| 22 | 26 | $query = call_user_func( [$this, $methodName], $values[$key] ); |
| 23 | 27 | if( is_array( $query )) { |
| 24 | 28 | $queries[] = $query; |
@@ -92,7 +96,9 @@ discard block |
||
| 92 | 96 | */ |
| 93 | 97 | protected function buildQueryAssignedTo( $value ) |
| 94 | 98 | { |
| 95 | - if( empty( $value ))return; |
|
| 99 | + if( empty( $value )) { |
|
| 100 | + return; |
|
| 101 | + } |
|
| 96 | 102 | return [ |
| 97 | 103 | 'compare' => 'IN', |
| 98 | 104 | 'key' => 'assigned_to', |
@@ -106,7 +112,9 @@ discard block |
||
| 106 | 112 | */ |
| 107 | 113 | protected function buildQueryCategory( $value ) |
| 108 | 114 | { |
| 109 | - if( empty( $value ))return; |
|
| 115 | + if( empty( $value )) { |
|
| 116 | + return; |
|
| 117 | + } |
|
| 110 | 118 | return [ |
| 111 | 119 | 'field' => 'term_id', |
| 112 | 120 | 'taxonomy' => Application::TAXONOMY, |
@@ -120,7 +128,9 @@ discard block |
||
| 120 | 128 | */ |
| 121 | 129 | protected function buildQueryRating( $value ) |
| 122 | 130 | { |
| 123 | - if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 )))return; |
|
| 131 | + if( !is_numeric( $value ) || !in_array( intval( $value ), range( 1, 5 ))) { |
|
| 132 | + return; |
|
| 133 | + } |
|
| 124 | 134 | return [ |
| 125 | 135 | 'compare' => '>=', |
| 126 | 136 | 'key' => 'rating', |
@@ -134,7 +144,9 @@ discard block |
||
| 134 | 144 | */ |
| 135 | 145 | protected function buildQueryType( $value ) |
| 136 | 146 | { |
| 137 | - if( in_array( $value, ['','all'] ))return; |
|
| 147 | + if( in_array( $value, ['','all'] )) { |
|
| 148 | + return; |
|
| 149 | + } |
|
| 138 | 150 | return [ |
| 139 | 151 | 'key' => 'review_type', |
| 140 | 152 | 'value' => $value, |
@@ -212,7 +212,9 @@ discard block |
||
| 212 | 212 | $newParents = $parents; |
| 213 | 213 | foreach( $parents as $parent ) { |
| 214 | 214 | $parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ ); |
| 215 | - if( !class_exists( $parentClass ))continue; |
|
| 215 | + if( !class_exists( $parentClass )) { |
|
| 216 | + continue; |
|
| 217 | + } |
|
| 216 | 218 | $newParents = array_merge( $newParents, $this->getParents( (new $parentClass)->parents )); |
| 217 | 219 | } |
| 218 | 220 | return array_values( array_unique( $newParents )); |
@@ -226,7 +228,9 @@ discard block |
||
| 226 | 228 | $parents = $this->getParents(); |
| 227 | 229 | foreach( $parents as $parent ) { |
| 228 | 230 | $parentClass = glsr( Helper::class )->buildClassName( $parent, __NAMESPACE__ ); |
| 229 | - if( !class_exists( $parentClass ))continue; |
|
| 231 | + if( !class_exists( $parentClass )) { |
|
| 232 | + continue; |
|
| 233 | + } |
|
| 230 | 234 | $this->allowed = array_values( array_unique( array_merge( (new $parentClass)->allowed, $this->allowed ))); |
| 231 | 235 | } |
| 232 | 236 | } |
@@ -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 | |
@@ -157,7 +161,9 @@ discard block |
||
| 157 | 161 | ksort( $settings ); |
| 158 | 162 | $details = []; |
| 159 | 163 | foreach( $settings as $key => $value ) { |
| 160 | - if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key ))continue; |
|
| 164 | + if( $helper->startsWith( 'strings', $key ) && $helper->endsWith( 'id', $key )) { |
|
| 165 | + continue; |
|
| 166 | + } |
|
| 161 | 167 | $value = htmlspecialchars( trim( preg_replace('/\s\s+/', '\\n', $value )), ENT_QUOTES, 'UTF-8' ); |
| 162 | 168 | $details[$key] = $value; |
| 163 | 169 | } |
@@ -230,7 +236,9 @@ discard block |
||
| 230 | 236 | 'WPE_APIKEY' => 'WP Engine', |
| 231 | 237 | ]; |
| 232 | 238 | foreach( $checks as $key => $value ) { |
| 233 | - if( !$this->isWebhostCheckValid( $key ))continue; |
|
| 239 | + if( !$this->isWebhostCheckValid( $key )) { |
|
| 240 | + continue; |
|
| 241 | + } |
|
| 234 | 242 | return $value; |
| 235 | 243 | } |
| 236 | 244 | return implode( ',', array_filter( [DB_HOST, filter_input( INPUT_SERVER, 'SERVER_NAME' )] )); |
@@ -311,7 +319,9 @@ discard block |
||
| 311 | 319 | ]; |
| 312 | 320 | array_walk( $settings, function( &$value, $setting ) use( $keys ) { |
| 313 | 321 | foreach( $keys as $key ) { |
| 314 | - if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty( $value ))continue; |
|
| 322 | + if( !glsr( Helper::class )->startsWith( $key, $setting ) || empty( $value )) { |
|
| 323 | + continue; |
|
| 324 | + } |
|
| 315 | 325 | $value = str_repeat( '•', 13 ); |
| 316 | 326 | return; |
| 317 | 327 | } |