@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | defined( 'WPINC' ) || die; |
| 4 | 4 | |
| 5 | -require_once( ABSPATH.WPINC.'/class-phpass.php' ); |
|
| 5 | +require_once(ABSPATH.WPINC.'/class-phpass.php'); |
|
| 6 | 6 | |
| 7 | 7 | spl_autoload_register( function( $className ) { |
| 8 | 8 | $namespaces = [ |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | foreach( $namespaces as $prefix => $baseDir ) { |
| 17 | 17 | $len = strlen( $prefix ); |
| 18 | 18 | if( strncmp( $prefix, $className, $len ) !== 0 )continue; |
| 19 | - $file = $baseDir.str_replace( '\\', '/', substr( $className, $len )).'.php'; |
|
| 20 | - if( !file_exists( $file ))continue; |
|
| 19 | + $file = $baseDir.str_replace( '\\', '/', substr( $className, $len ) ).'.php'; |
|
| 20 | + if( !file_exists( $file ) )continue; |
|
| 21 | 21 | require $file; |
| 22 | 22 | break; |
| 23 | 23 | } |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function __construct() |
| 36 | 36 | { |
| 37 | - if( $cookieId = filter_input( INPUT_COOKIE, static::SESSION_COOKIE )) { |
|
| 38 | - $cookie = explode( '||', stripslashes( $cookieId )); |
|
| 37 | + if( $cookieId = filter_input( INPUT_COOKIE, static::SESSION_COOKIE ) ) { |
|
| 38 | + $cookie = explode( '||', stripslashes( $cookieId ) ); |
|
| 39 | 39 | $this->sessionId = preg_replace( '/[^A-Za-z0-9_]/', '', $cookie[0] ); |
| 40 | 40 | $this->expiryTimestamp = absint( $cookie[1] ); |
| 41 | 41 | $this->expiryTimestampReset = absint( $cookie[2] ); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function deleteExpiredSessions( $limit = 1000 ) |
| 77 | 77 | { |
| 78 | - if( $expiredSessions = implode( "','", $this->getExpiredSessions( $limit ))) { |
|
| 78 | + if( $expiredSessions = implode( "','", $this->getExpiredSessions( $limit ) ) ) { |
|
| 79 | 79 | glsr( SqlQueries::class )->deleteExpiredSessions( $expiredSessions ); |
| 80 | 80 | } |
| 81 | 81 | } |
@@ -89,11 +89,11 @@ discard block |
||
| 89 | 89 | public function get( $key, $fallback = '', $unset = false ) |
| 90 | 90 | { |
| 91 | 91 | $key = sanitize_key( $key ); |
| 92 | - $value = isset( $this->sessionData[$key] ) |
|
| 92 | + $value = isset($this->sessionData[$key]) |
|
| 93 | 93 | ? maybe_unserialize( $this->sessionData[$key] ) |
| 94 | 94 | : $fallback; |
| 95 | - if( isset( $this->sessionData[$key] ) && $unset ) { |
|
| 96 | - unset( $this->sessionData[$key] ); |
|
| 95 | + if( isset($this->sessionData[$key]) && $unset ) { |
|
| 96 | + unset($this->sessionData[$key]); |
|
| 97 | 97 | $this->updateSession(); |
| 98 | 98 | } |
| 99 | 99 | return $value; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | protected function deleteSession() |
| 128 | 128 | { |
| 129 | 129 | delete_option( $this->getSessionId() ); |
| 130 | - delete_option( $this->getSessionId( 'expires' )); |
|
| 130 | + delete_option( $this->getSessionId( 'expires' ) ); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | protected function generateSessionId() |
| 137 | 137 | { |
| 138 | - return md5(( new PasswordHash( 8, false ))->get_random_bytes( 32 )); |
|
| 138 | + return md5( (new PasswordHash( 8, false ))->get_random_bytes( 32 ) ); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
@@ -145,8 +145,8 @@ discard block |
||
| 145 | 145 | protected function getExpiredSessions( $limit ) |
| 146 | 146 | { |
| 147 | 147 | $expiredSessions = []; |
| 148 | - $sessions = glsr( SqlQueries::class )->getExpiredSessions( static::SESSION_COOKIE, absint( $limit )); |
|
| 149 | - if( !empty( $sessions )) { |
|
| 148 | + $sessions = glsr( SqlQueries::class )->getExpiredSessions( static::SESSION_COOKIE, absint( $limit ) ); |
|
| 149 | + if( !empty($sessions) ) { |
|
| 150 | 150 | $now = time(); |
| 151 | 151 | foreach( $sessions as $session ) { |
| 152 | 152 | if( $now <= $session->expiration )continue; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | protected function getSessionId( $separator = '' ) |
| 165 | 165 | { |
| 166 | - return implode( '_', array_filter( [static::SESSION_COOKIE, $separator, $this->sessionId] )); |
|
| 166 | + return implode( '_', array_filter( [static::SESSION_COOKIE, $separator, $this->sessionId] ) ); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /** |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | { |
| 195 | 195 | if( headers_sent() )return; |
| 196 | 196 | $cookie = $this->sessionId.'||'.$this->expiryTimestamp.'||'.$this->expiryTimestampReset; |
| 197 | - $cookiePath = preg_replace( '|https?://[^/]+|i', '', trailingslashit( (string)get_option( 'home' ))); |
|
| 197 | + $cookiePath = preg_replace( '|https?://[^/]+|i', '', trailingslashit( (string)get_option( 'home' ) ) ); |
|
| 198 | 198 | setcookie( static::SESSION_COOKIE, $cookie, $this->expiryTimestamp, $cookiePath ); |
| 199 | 199 | } |
| 200 | 200 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | protected function updateSession() |
| 214 | 214 | { |
| 215 | - if( false === get_option( $this->getSessionId() )) { |
|
| 215 | + if( false === get_option( $this->getSessionId() ) ) { |
|
| 216 | 216 | return $this->createSession(); |
| 217 | 217 | } |
| 218 | 218 | update_option( $this->getSessionId(), $this->sessionData, false ); |
@@ -16,11 +16,11 @@ discard block |
||
| 16 | 16 | <div id="<?= $tax_name; ?>-all" class="tabs-panel"> |
| 17 | 17 | <input type="hidden" name="tax_input[<?= $tax_name; ?>][]" value='0' /> |
| 18 | 18 | <ul id="<?= $tax_name; ?>checklist" data-wp-lists="list:<?= $tax_name; ?>" class="categorychecklist form-no-clear"> |
| 19 | - <?php wp_terms_checklist( $post->ID, array( 'taxonomy' => $tax_name, 'popular_cats' => $popular_ids )); ?> |
|
| 19 | + <?php wp_terms_checklist( $post->ID, array( 'taxonomy' => $tax_name, 'popular_cats' => $popular_ids ) ); ?> |
|
| 20 | 20 | </ul> |
| 21 | 21 | </div> |
| 22 | 22 | |
| 23 | - <?php if( current_user_can( $taxonomy->cap->edit_terms )) : ?> |
|
| 23 | + <?php if( current_user_can( $taxonomy->cap->edit_terms ) ) : ?> |
|
| 24 | 24 | <div id="<?= $tax_name; ?>-adder" class="wp-hidden-children"> |
| 25 | 25 | <a id="<?= $tax_name; ?>-add-toggle" href="#<?= $tax_name; ?>-add" class="hide-if-no-js taxonomy-add-new"> |
| 26 | 26 | <?= sprintf( '+ %s', $taxonomy->labels->add_new_item ); ?> |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | <label class="screen-reader-text" for="new<?= $tax_name; ?>"><?= $taxonomy->labels->add_new_item; ?></label> |
| 30 | 30 | <input type="text" name="new<?= $tax_name; ?>" id="new<?= $tax_name; ?>" class="form-required form-input-tip" value="<?= esc_attr( $taxonomy->labels->new_item_name ); ?>" aria-required="true"/> |
| 31 | 31 | <input type="button" id="<?= $tax_name; ?>-add-submit" data-wp-lists="add:<?= $tax_name; ?>checklist:<?= $tax_name; ?>-add" class="button category-add-submit" value="<?= esc_attr( $taxonomy->labels->add_new_item ); ?>" /> |
| 32 | - <?php wp_nonce_field( 'add-' . $tax_name, '_ajax_nonce-add-' . $tax_name, false ); ?> |
|
| 32 | + <?php wp_nonce_field( 'add-'.$tax_name, '_ajax_nonce-add-'.$tax_name, false ); ?> |
|
| 33 | 33 | <span id="<?= $tax_name; ?>-ajax-response"></span> |
| 34 | 34 | </div> |
| 35 | 35 | </div> |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | */ |
| 58 | 58 | protected function isReviewEditable() |
| 59 | 59 | { |
| 60 | - $postId = intval( filter_input( INPUT_GET, 'post' )); |
|
| 60 | + $postId = intval( filter_input( INPUT_GET, 'post' ) ); |
|
| 61 | 61 | return $postId > 0 |
| 62 | 62 | && get_post_meta( $postId, 'review_type', true ) == 'local' |
| 63 | 63 | && $this->isReviewEditor(); |
@@ -30,13 +30,13 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | foreach( $args as $key => $value ) { |
| 32 | 32 | $property = glsr( Helper::class )->buildPropertyName( $key ); |
| 33 | - if( !property_exists( $this, $property ))continue; |
|
| 33 | + if( !property_exists( $this, $property ) )continue; |
|
| 34 | 34 | $this->$property = $value; |
| 35 | - unset( $args[$key] ); |
|
| 35 | + unset($args[$key]); |
|
| 36 | 36 | } |
| 37 | 37 | $this->args = wp_parse_args( $args, [ |
| 38 | 38 | 'menu_name' => $this->plural, |
| 39 | - ]); |
|
| 39 | + ] ); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | 'singular_name' => $this->single, |
| 60 | 60 | 'uploaded_to_this_item' => sprintf( _x( 'Uploaded to this %s', 'Uploaded to this Post', 'site-reviews' ), $this->single ), |
| 61 | 61 | 'view_item' => sprintf( _x( 'View %s', 'View Post', 'site-reviews' ), $this->single ), |
| 62 | - ]); |
|
| 63 | - unset( $this->args['menu_name'] ); |
|
| 62 | + ] ); |
|
| 63 | + unset($this->args['menu_name']); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -69,12 +69,12 @@ discard block |
||
| 69 | 69 | protected function normalizeColumns() |
| 70 | 70 | { |
| 71 | 71 | $this->columns = ['cb' => ''] + $this->columns; |
| 72 | - if( array_key_exists( 'category', $this->columns )) { |
|
| 72 | + if( array_key_exists( 'category', $this->columns ) ) { |
|
| 73 | 73 | $keys = array_keys( $this->columns ); |
| 74 | 74 | $keys[array_search( 'category', $keys )] = 'taxonomy-'.Application::TAXONOMY; |
| 75 | 75 | $this->columns = array_combine( $keys, $this->columns ); |
| 76 | 76 | } |
| 77 | - if( array_key_exists( 'pinned', $this->columns )) { |
|
| 77 | + if( array_key_exists( 'pinned', $this->columns ) ) { |
|
| 78 | 78 | $this->columns['pinned'] = glsr( Builder::class )->span( '<span>'.$this->columns['pinned'].'</span>', |
| 79 | 79 | ['class' => 'pinned-icon'] |
| 80 | 80 | ); |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function buildPlainTextMessage( PHPMailer $phpmailer ) |
| 92 | 92 | { |
| 93 | - if( empty( $this->email ))return; |
|
| 94 | - if( $phpmailer->ContentType === 'text/plain' || !empty( $phpmailer->AltBody ))return; |
|
| 93 | + if( empty($this->email) )return; |
|
| 94 | + if( $phpmailer->ContentType === 'text/plain' || !empty($phpmailer->AltBody) )return; |
|
| 95 | 95 | $message = $this->stripHtmlTags( $phpmailer->Body ); |
| 96 | 96 | $phpmailer->AltBody = apply_filters( 'site-reviews/email/message', $message, 'text', $this ); |
| 97 | 97 | } |
@@ -104,10 +104,10 @@ discard block |
||
| 104 | 104 | $allowed = [ |
| 105 | 105 | 'bcc', 'cc', 'from', 'reply-to', |
| 106 | 106 | ]; |
| 107 | - $headers = array_intersect_key( $this->email, array_flip( $allowed )); |
|
| 107 | + $headers = array_intersect_key( $this->email, array_flip( $allowed ) ); |
|
| 108 | 108 | $headers = array_filter( $headers ); |
| 109 | 109 | foreach( $headers as $key => $value ) { |
| 110 | - unset( $headers[$key] ); |
|
| 110 | + unset($headers[$key]); |
|
| 111 | 111 | $headers[] = $key.': '.$value; |
| 112 | 112 | } |
| 113 | 113 | $headers[] = 'Content-Type: text/html'; |
@@ -119,16 +119,16 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | protected function buildHtmlMessage() |
| 121 | 121 | { |
| 122 | - $template = trim( glsr( OptionManager::class )->get( 'settings.general.notification_message' )); |
|
| 123 | - if( !empty( $template )) { |
|
| 122 | + $template = trim( glsr( OptionManager::class )->get( 'settings.general.notification_message' ) ); |
|
| 123 | + if( !empty($template) ) { |
|
| 124 | 124 | $message = glsr( Template::class )->interpolate( $template, $this->email['template-tags'] ); |
| 125 | 125 | } |
| 126 | 126 | else if( $this->email['template'] ) { |
| 127 | 127 | $message = glsr( Template::class )->build( 'templates/'.$this->email['template'], [ |
| 128 | 128 | 'context' => $this->email['template-tags'], |
| 129 | - ]); |
|
| 129 | + ] ); |
|
| 130 | 130 | } |
| 131 | - if( !isset( $message )) { |
|
| 131 | + if( !isset($message) ) { |
|
| 132 | 132 | $message = $this->email['message']; |
| 133 | 133 | } |
| 134 | 134 | $message = $this->email['before'].$message.$this->email['after']; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $message = str_replace( ']]>', ']]>', $message ); |
| 140 | 140 | $message = glsr( Template::class )->build( 'partials/email/index', [ |
| 141 | 141 | 'context' => ['message' => $message], |
| 142 | - ]); |
|
| 142 | + ] ); |
|
| 143 | 143 | return apply_filters( 'site-reviews/email/message', stripslashes( $message ), 'html', $this ); |
| 144 | 144 | } |
| 145 | 145 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | protected function normalize( array $email = [] ) |
| 150 | 150 | { |
| 151 | 151 | $email = shortcode_atts( glsr( EmailDefaults::class )->defaults(), $email ); |
| 152 | - if( empty( $email['reply-to'] )) { |
|
| 152 | + if( empty($email['reply-to']) ) { |
|
| 153 | 153 | $email['reply-to'] = $email['from']; |
| 154 | 154 | } |
| 155 | 155 | $this->email = apply_filters( 'site-reviews/email/compose', $email, $this ); |
@@ -10,13 +10,13 @@ |
||
| 10 | 10 | <p>{{ description }}</p> |
| 11 | 11 | </div> |
| 12 | 12 | <div class="glsr-addon-footer"> |
| 13 | - <?php if( !is_wp_error( validate_plugin( $plugin ))) : ?> |
|
| 14 | - <?php if( is_plugin_active( $plugin )) : ?> |
|
| 13 | + <?php if( !is_wp_error( validate_plugin( $plugin ) ) ) : ?> |
|
| 14 | + <?php if( is_plugin_active( $plugin ) ) : ?> |
|
| 15 | 15 | <span class="glsr-addon-link button button-secondary" disabled> |
| 16 | 16 | <?= __( 'Installed', 'site-reviews' ); ?> |
| 17 | 17 | </span> |
| 18 | 18 | <?php else: ?> |
| 19 | - <a href="<?= wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin='.$plugin ), 'activate-plugin_'.$plugin );?>" class="glsr-addon-link button button-secondary"> |
|
| 19 | + <a href="<?= wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin='.$plugin ), 'activate-plugin_'.$plugin ); ?>" class="glsr-addon-link button button-secondary"> |
|
| 20 | 20 | <?= __( 'Activate', 'site-reviews' ); ?> |
| 21 | 21 | </a> |
| 22 | 22 | <?php endif; ?> |
@@ -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 | } |
@@ -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; |