@@ -50,7 +50,7 @@ |
||
| 50 | 50 | public function routerSubmitReview( array $request ) |
| 51 | 51 | { |
| 52 | 52 | $validated = glsr( ValidateReview::class )->validate( $request ); |
| 53 | - if( !empty( $validated->error ) || $validated->recaptchaIsUnset )return; |
|
| 54 | - $this->execute( new CreateReview( $validated->request )); |
|
| 53 | + if( !empty($validated->error) || $validated->recaptchaIsUnset )return; |
|
| 54 | + $this->execute( new CreateReview( $validated->request ) ); |
|
| 55 | 55 | } |
| 56 | 56 | } |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function deleteAllSessions( $sessionCookiePrefix ) |
| 25 | 25 | { |
| 26 | - return $this->db->query(" |
|
| 26 | + return $this->db->query( " |
|
| 27 | 27 | DELETE |
| 28 | 28 | FROM {$this->db->options} |
| 29 | 29 | WHERE option_name LIKE '{$sessionCookiePrefix}_%' |
| 30 | - "); |
|
| 30 | + " ); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -36,11 +36,11 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function deleteExpiredSessions( $expiredSessions ) |
| 38 | 38 | { |
| 39 | - return $this->db->query(" |
|
| 39 | + return $this->db->query( " |
|
| 40 | 40 | DELETE |
| 41 | 41 | FROM {$this->db->options} |
| 42 | 42 | WHERE option_name IN ('{$expiredSessions}') |
| 43 | - "); |
|
| 43 | + " ); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -49,13 +49,13 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function getReviewCounts( $metaKey ) |
| 51 | 51 | { |
| 52 | - return (array) $this->db->get_results(" |
|
| 52 | + return (array)$this->db->get_results( " |
|
| 53 | 53 | SELECT m.meta_value AS name, COUNT(*) num_posts |
| 54 | 54 | FROM {$this->db->posts} AS p |
| 55 | 55 | INNER JOIN {$this->db->postmeta} AS m ON p.ID = m.post_id |
| 56 | 56 | WHERE p.post_type = '{$this->postType}' AND m.meta_key = '{$metaKey}' |
| 57 | 57 | GROUP BY name |
| 58 | - "); |
|
| 58 | + " ); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -65,13 +65,13 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function getExpiredSessions( $sessionCookiePrefix, $limit ) |
| 67 | 67 | { |
| 68 | - return $this->db->get_results(" |
|
| 68 | + return $this->db->get_results( " |
|
| 69 | 69 | SELECT option_name AS name, option_value AS expiration |
| 70 | 70 | FROM {$this->db->options} |
| 71 | 71 | WHERE option_name LIKE '{$sessionCookiePrefix}_expires_%' |
| 72 | 72 | ORDER BY option_value ASC |
| 73 | 73 | LIMIT 0, {$limit} |
| 74 | - "); |
|
| 74 | + " ); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -80,14 +80,14 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function getReviewPostId( $metaReviewId ) |
| 82 | 82 | { |
| 83 | - $postId = $this->db->get_var(" |
|
| 83 | + $postId = $this->db->get_var( " |
|
| 84 | 84 | SELECT p.ID |
| 85 | 85 | FROM {$this->db->posts} AS p |
| 86 | 86 | INNER JOIN {$this->db->postmeta} AS pm ON p.ID = pm.post_id |
| 87 | 87 | WHERE p.post_type = '{$this->postType}' |
| 88 | 88 | AND pm.meta_key = 'review_id' |
| 89 | 89 | AND pm.meta_value = '{$metaReviewId}' |
| 90 | - "); |
|
| 90 | + " ); |
|
| 91 | 91 | return intval( $postId ); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public function getReviewIdsByType( $metaReviewType ) |
| 99 | 99 | { |
| 100 | - $query = $this->db->get_col(" |
|
| 100 | + $query = $this->db->get_col( " |
|
| 101 | 101 | SELECT m1.meta_value AS review_id |
| 102 | 102 | FROM {$this->db->posts} AS p |
| 103 | 103 | INNER JOIN {$this->db->postmeta} AS m1 ON p.ID = m1.post_id |
@@ -106,8 +106,8 @@ discard block |
||
| 106 | 106 | AND m1.meta_key = 'review_id' |
| 107 | 107 | AND m2.meta_key = 'review_type' |
| 108 | 108 | AND m2.meta_value = '{$metaReviewType}' |
| 109 | - "); |
|
| 110 | - return array_keys( array_flip( $query )); |
|
| 109 | + " ); |
|
| 110 | + return array_keys( array_flip( $query ) ); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -120,13 +120,13 @@ discard block |
||
| 120 | 120 | $queryBuilder = glsr( QueryBuilder::class ); |
| 121 | 121 | $keys = $queryBuilder->buildSqlOr( $keys, "pm.meta_key = '%s'" ); |
| 122 | 122 | $status = $queryBuilder->buildSqlOr( $status, "p.post_status = '%s'" ); |
| 123 | - return $this->db->get_col(" |
|
| 123 | + return $this->db->get_col( " |
|
| 124 | 124 | SELECT DISTINCT pm.meta_value FROM {$this->db->postmeta} pm |
| 125 | 125 | LEFT JOIN {$this->db->posts} p ON p.ID = pm.post_id |
| 126 | 126 | WHERE p.post_type = '{$this->postType}' |
| 127 | 127 | AND ({$keys}) |
| 128 | 128 | AND ({$status}) |
| 129 | 129 | ORDER BY pm.meta_value |
| 130 | - "); |
|
| 130 | + " ); |
|
| 131 | 131 | } |
| 132 | 132 | } |
@@ -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 ); |
@@ -11,14 +11,14 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | public function isBlacklisted( array $review ) |
| 13 | 13 | { |
| 14 | - $target = implode( "\n", array_filter([ |
|
| 14 | + $target = implode( "\n", array_filter( [ |
|
| 15 | 15 | $review['name'], |
| 16 | 16 | $review['content'], |
| 17 | 17 | $review['email'], |
| 18 | 18 | $review['ip_address'], |
| 19 | 19 | $review['title'], |
| 20 | - ])); |
|
| 21 | - return (bool) apply_filters( 'site-reviews/blacklist/is-blacklisted', |
|
| 20 | + ] ) ); |
|
| 21 | + return (bool)apply_filters( 'site-reviews/blacklist/is-blacklisted', |
|
| 22 | 22 | $this->check( $target ), |
| 23 | 23 | $review |
| 24 | 24 | ); |
@@ -30,16 +30,16 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | protected function check( $target ) |
| 32 | 32 | { |
| 33 | - $blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' )); |
|
| 34 | - if( empty( $blacklist )) { |
|
| 33 | + $blacklist = trim( glsr( OptionManager::class )->get( 'settings.submissions.blacklist.entries' ) ); |
|
| 34 | + if( empty($blacklist) ) { |
|
| 35 | 35 | return false; |
| 36 | 36 | } |
| 37 | 37 | $lines = explode( "\n", $blacklist ); |
| 38 | - foreach( (array) $lines as $line ) { |
|
| 38 | + foreach( (array)$lines as $line ) { |
|
| 39 | 39 | $line = trim( $line ); |
| 40 | - if( empty( $line ) || 256 < strlen( $line ))continue; |
|
| 41 | - $pattern = sprintf( '#%s#i', preg_quote( $line, '#' )); |
|
| 42 | - if( preg_match( $pattern, $target )) { |
|
| 40 | + if( empty($line) || 256 < strlen( $line ) )continue; |
|
| 41 | + $pattern = sprintf( '#%s#i', preg_quote( $line, '#' ) ); |
|
| 42 | + if( preg_match( $pattern, $target ) ) { |
|
| 43 | 43 | return true; |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -27,21 +27,21 @@ discard block |
||
| 27 | 27 | public function __construct( $input ) |
| 28 | 28 | { |
| 29 | 29 | $this->request = $input; |
| 30 | - $this->ajax_request = isset( $input['ajax_request'] ); |
|
| 30 | + $this->ajax_request = isset($input['ajax_request']); |
|
| 31 | 31 | $this->assigned_to = $this->getNumeric( 'assign_to' ); |
| 32 | - $this->author = sanitize_text_field( $this->get( 'name' )); |
|
| 33 | - $this->avatar = get_avatar_url( $this->get( 'email' )); |
|
| 34 | - $this->blacklisted = isset( $input['blacklisted'] ); |
|
| 35 | - $this->category = sanitize_key( $this->get( 'category' )); |
|
| 36 | - $this->content = sanitize_textarea_field( $this->get( 'content' )); |
|
| 32 | + $this->author = sanitize_text_field( $this->get( 'name' ) ); |
|
| 33 | + $this->avatar = get_avatar_url( $this->get( 'email' ) ); |
|
| 34 | + $this->blacklisted = isset($input['blacklisted']); |
|
| 35 | + $this->category = sanitize_key( $this->get( 'category' ) ); |
|
| 36 | + $this->content = sanitize_textarea_field( $this->get( 'content' ) ); |
|
| 37 | 37 | $this->custom = $this->getCustom(); |
| 38 | - $this->email = sanitize_email( $this->get( 'email' )); |
|
| 39 | - $this->form_id = sanitize_key( $this->get( 'form_id' )); |
|
| 38 | + $this->email = sanitize_email( $this->get( 'email' ) ); |
|
| 39 | + $this->form_id = sanitize_key( $this->get( 'form_id' ) ); |
|
| 40 | 40 | $this->ip_address = $this->get( 'ip_address' ); |
| 41 | - $this->rating = intval( $this->get( 'rating' )); |
|
| 41 | + $this->rating = intval( $this->get( 'rating' ) ); |
|
| 42 | 42 | $this->referrer = $this->get( 'referrer' ); |
| 43 | - $this->terms = isset( $input['terms'] ); |
|
| 44 | - $this->title = sanitize_text_field( $this->get( 'title' )); |
|
| 43 | + $this->terms = isset($input['terms']); |
|
| 44 | + $this->title = sanitize_text_field( $this->get( 'title' ) ); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | protected function get( $key ) |
| 52 | 52 | { |
| 53 | - return isset( $this->request[$key] ) |
|
| 53 | + return isset($this->request[$key]) |
|
| 54 | 54 | ? (string)$this->request[$key] |
| 55 | 55 | : ''; |
| 56 | 56 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | ]; |
| 68 | 68 | $custom = $this->request; |
| 69 | 69 | foreach( $unset as $value ) { |
| 70 | - unset( $custom[$value] ); |
|
| 70 | + unset($custom[$value]); |
|
| 71 | 71 | } |
| 72 | 72 | return $custom; |
| 73 | 73 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | { |
| 56 | 56 | $instance = new static; |
| 57 | 57 | $instance->setTagFromMethod( $method ); |
| 58 | - call_user_func_array( [$instance, 'normalize'], $args += ['',''] ); |
|
| 58 | + call_user_func_array( [$instance, 'normalize'], $args += ['', ''] ); |
|
| 59 | 59 | $tags = array_merge( static::TAGS_FORM, static::TAGS_SINGLE, static::TAGS_STRUCTURE, static::TAGS_TEXT ); |
| 60 | 60 | $generatedTag = in_array( $instance->tag, $tags ) |
| 61 | 61 | ? $instance->buildTag() |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | 'render' => 'is_bool', |
| 79 | 79 | 'tag' => 'is_string', |
| 80 | 80 | ]; |
| 81 | - if( !isset( $properties[$property] ) |
|
| 82 | - || empty( array_filter( [$value], $properties[$property] )) |
|
| 81 | + if( !isset($properties[$property]) |
|
| 82 | + || empty(array_filter( [$value], $properties[$property] )) |
|
| 83 | 83 | )return; |
| 84 | 84 | $this->$property = $value; |
| 85 | 85 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public function getOpeningTag() |
| 99 | 99 | { |
| 100 | - $attributes = glsr( Attributes::class )->{$this->tag}( $this->args )->toString(); |
|
| 100 | + $attributes = glsr( Attributes::class )->{$this->tag}($this->args)->toString(); |
|
| 101 | 101 | return '<'.trim( $this->tag.' '.$attributes ).'>'; |
| 102 | 102 | } |
| 103 | 103 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | protected function buildCustomField() |
| 108 | 108 | { |
| 109 | 109 | $className = $this->getCustomFieldClassName(); |
| 110 | - if( class_exists( $className )) { |
|
| 110 | + if( class_exists( $className ) ) { |
|
| 111 | 111 | return (new $className( $this ))->build(); |
| 112 | 112 | } |
| 113 | 113 | glsr_log()->error( 'Field missing: '.$className ); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | protected function buildDefaultTag( $text = '' ) |
| 120 | 120 | { |
| 121 | - if( empty( $text )) { |
|
| 121 | + if( empty($text) ) { |
|
| 122 | 122 | $text = $this->args['text']; |
| 123 | 123 | } |
| 124 | 124 | return $this->getOpeningTag().$text.$this->getClosingTag(); |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | protected function buildFieldDescription() |
| 131 | 131 | { |
| 132 | - if( empty( $this->args['description'] ))return; |
|
| 132 | + if( empty($this->args['description']) )return; |
|
| 133 | 133 | if( $this->args['is_widget'] ) { |
| 134 | 134 | return $this->small( $this->args['description'] ); |
| 135 | 135 | } |
@@ -141,13 +141,13 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | protected function buildFormInput() |
| 143 | 143 | { |
| 144 | - if( !in_array( $this->args['type'], ['checkbox', 'radio'] )) { |
|
| 145 | - if( isset( $this->args['multiple'] )) { |
|
| 146 | - $this->args['name'].= '[]'; |
|
| 144 | + if( !in_array( $this->args['type'], ['checkbox', 'radio'] ) ) { |
|
| 145 | + if( isset($this->args['multiple']) ) { |
|
| 146 | + $this->args['name'] .= '[]'; |
|
| 147 | 147 | } |
| 148 | 148 | return $this->buildFormLabel().$this->getOpeningTag(); |
| 149 | 149 | } |
| 150 | - return empty( $this->args['options'] ) |
|
| 150 | + return empty($this->args['options']) |
|
| 151 | 151 | ? $this->buildFormInputChoice() |
| 152 | 152 | : $this->buildFormInputMultiChoice(); |
| 153 | 153 | } |
@@ -157,13 +157,13 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | protected function buildFormInputChoice() |
| 159 | 159 | { |
| 160 | - $labelText = !empty( $this->args['text'] ) |
|
| 160 | + $labelText = !empty($this->args['text']) |
|
| 161 | 161 | ? $this->args['text'] |
| 162 | 162 | : $this->args['label']; |
| 163 | 163 | return $this->label( $this->getOpeningTag().' '.$labelText, [ |
| 164 | 164 | 'class' => 'glsr-'.$this->args['type'].'-label', |
| 165 | 165 | 'for' => $this->args['id'], |
| 166 | - ]); |
|
| 166 | + ] ); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /** |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | protected function buildFormInputMultiChoice() |
| 173 | 173 | { |
| 174 | 174 | if( $this->args['type'] == 'checkbox' ) { |
| 175 | - $this->args['name'].= '[]'; |
|
| 175 | + $this->args['name'] .= '[]'; |
|
| 176 | 176 | } |
| 177 | 177 | $options = array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) { |
| 178 | 178 | return $carry.$this->li( $this->{$this->args['type']}([ |
@@ -180,12 +180,12 @@ discard block |
||
| 180 | 180 | 'name' => $this->args['name'], |
| 181 | 181 | 'text' => $this->args['options'][$key], |
| 182 | 182 | 'value' => $key, |
| 183 | - ])); |
|
| 183 | + ]) ); |
|
| 184 | 184 | }); |
| 185 | 185 | return $this->ul( $options, [ |
| 186 | 186 | 'class' => $this->args['class'], |
| 187 | 187 | 'id' => $this->args['id'], |
| 188 | - ]); |
|
| 188 | + ] ); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
@@ -193,11 +193,11 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | protected function buildFormLabel() |
| 195 | 195 | { |
| 196 | - if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return; |
|
| 197 | - return $this->label([ |
|
| 196 | + if( empty($this->args['label']) || $this->args['type'] == 'hidden' )return; |
|
| 197 | + return $this->label( [ |
|
| 198 | 198 | 'for' => $this->args['id'], |
| 199 | 199 | 'text' => $this->args['label'], |
| 200 | - ]); |
|
| 200 | + ] ); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
@@ -214,11 +214,11 @@ discard block |
||
| 214 | 214 | protected function buildFormSelectOptions() |
| 215 | 215 | { |
| 216 | 216 | return array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) { |
| 217 | - return $carry.$this->option([ |
|
| 217 | + return $carry.$this->option( [ |
|
| 218 | 218 | 'selected' => $this->args['value'] == $key, |
| 219 | 219 | 'text' => $this->args['options'][$key], |
| 220 | 220 | 'value' => $key, |
| 221 | - ]); |
|
| 221 | + ] ); |
|
| 222 | 222 | }); |
| 223 | 223 | } |
| 224 | 224 | |
@@ -236,10 +236,10 @@ discard block |
||
| 236 | 236 | protected function buildTag() |
| 237 | 237 | { |
| 238 | 238 | $this->mergeArgsWithRequiredDefaults(); |
| 239 | - if( in_array( $this->tag, static::TAGS_SINGLE )) { |
|
| 239 | + if( in_array( $this->tag, static::TAGS_SINGLE ) ) { |
|
| 240 | 240 | return $this->getOpeningTag(); |
| 241 | 241 | } |
| 242 | - if( !in_array( $this->tag, static::TAGS_FORM )) { |
|
| 242 | + if( !in_array( $this->tag, static::TAGS_FORM ) ) { |
|
| 243 | 243 | return $this->buildDefaultTag(); |
| 244 | 244 | } |
| 245 | 245 | return call_user_func( [$this, 'buildForm'.ucfirst( $this->tag )] ).$this->buildFieldDescription(); |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | protected function mergeArgsWithRequiredDefaults() |
| 260 | 260 | { |
| 261 | 261 | $className = $this->getCustomFieldClassName(); |
| 262 | - if( class_exists( $className )) { |
|
| 262 | + if( class_exists( $className ) ) { |
|
| 263 | 263 | $this->args = array_merge( |
| 264 | 264 | wp_parse_args( $this->args, $className::defaults() ), |
| 265 | 265 | $className::required() |
@@ -274,13 +274,13 @@ discard block |
||
| 274 | 274 | */ |
| 275 | 275 | protected function normalize( ...$params ) |
| 276 | 276 | { |
| 277 | - if( is_string( $params[0] ) || is_numeric( $params[0] )) { |
|
| 277 | + if( is_string( $params[0] ) || is_numeric( $params[0] ) ) { |
|
| 278 | 278 | $this->setNameOrTextAttributeForTag( $params[0] ); |
| 279 | 279 | } |
| 280 | - if( is_array( $params[0] )) { |
|
| 280 | + if( is_array( $params[0] ) ) { |
|
| 281 | 281 | $this->args += $params[0]; |
| 282 | 282 | } |
| 283 | - else if( is_array( $params[1] )) { |
|
| 283 | + else if( is_array( $params[1] ) ) { |
|
| 284 | 284 | $this->args += $params[1]; |
| 285 | 285 | } |
| 286 | 286 | } |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | protected function setTagFromMethod( $method ) |
| 305 | 305 | { |
| 306 | 306 | $this->tag = strtolower( $method ); |
| 307 | - if( in_array( $this->tag, static::INPUT_TYPES )) { |
|
| 307 | + if( in_array( $this->tag, static::INPUT_TYPES ) ) { |
|
| 308 | 308 | $this->args['type'] = $this->tag; |
| 309 | 309 | $this->tag = 'input'; |
| 310 | 310 | } |
@@ -22,11 +22,11 @@ discard block |
||
| 22 | 22 | $this->args = $this->normalize( $args ); |
| 23 | 23 | if( $this->args['total'] < 2 )return; |
| 24 | 24 | $links = $this->buildLinksForDeprecatedThemes(); |
| 25 | - if( empty( $links )) { |
|
| 25 | + if( empty($links) ) { |
|
| 26 | 26 | $links = $this->buildLinks(); |
| 27 | 27 | } |
| 28 | 28 | $links = apply_filters( 'site-reviews/reviews/navigation_links', $links, $this->args ); |
| 29 | - if( empty( $links ))return; |
|
| 29 | + if( empty($links) )return; |
|
| 30 | 30 | return $this->buildTemplate( $links ); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | 'total' => $this->args['total'], |
| 46 | 46 | ]; |
| 47 | 47 | if( is_front_page() ) { |
| 48 | - unset( $paginateArgs['format'] ); |
|
| 48 | + unset($paginateArgs['format']); |
|
| 49 | 49 | } |
| 50 | 50 | return paginate_links( $paginateArgs ); |
| 51 | 51 | } |
@@ -56,17 +56,17 @@ discard block |
||
| 56 | 56 | protected function buildLinksForDeprecatedThemes() |
| 57 | 57 | { |
| 58 | 58 | $theme = wp_get_theme()->get( 'TextDomain' ); |
| 59 | - if( !in_array( $theme, ['twentyten','twentyeleven','twentytwelve','twentythirteen'] ))return; |
|
| 59 | + if( !in_array( $theme, ['twentyten', 'twentyeleven', 'twentytwelve', 'twentythirteen'] ) )return; |
|
| 60 | 60 | $links = ''; |
| 61 | 61 | if( $this->args['paged'] > 1 ) { |
| 62 | - $links.= sprintf( '<div class="nav-previous"><a href="%s"><span class="meta-nav">←</span> %s</a></div>', |
|
| 62 | + $links .= sprintf( '<div class="nav-previous"><a href="%s"><span class="meta-nav">←</span> %s</a></div>', |
|
| 63 | 63 | $this->buildUrlForDeprecatedThemes(-1), |
| 64 | 64 | __( 'Previous', 'site-reviews' ) |
| 65 | 65 | ); |
| 66 | 66 | } |
| 67 | 67 | if( $this->args['paged'] < $this->args['total'] ) { |
| 68 | - $links.= sprintf( '<div class="nav-next"><a href="%s">%s <span class="meta-nav">→</span></a></div>', |
|
| 69 | - $this->buildUrlForDeprecatedThemes(1), |
|
| 68 | + $links .= sprintf( '<div class="nav-next"><a href="%s">%s <span class="meta-nav">→</span></a></div>', |
|
| 69 | + $this->buildUrlForDeprecatedThemes( 1 ), |
|
| 70 | 70 | __( 'Next', 'site-reviews' ) |
| 71 | 71 | ); |
| 72 | 72 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $screenReaderTemplate = '<h2 class="screen-reader-text">%2$s</h2>'; |
| 85 | 85 | $screenReaderText = __( 'Site Reviews navigation', 'site-reviews' ); |
| 86 | 86 | $innerTemplate = $screenReaderTemplate.'<div class="nav-links">%3$s</div>'; |
| 87 | - if( in_array( $theme, ['twentyten', 'twentyeleven', 'twentytwelve'] )) { |
|
| 87 | + if( in_array( $theme, ['twentyten', 'twentyeleven', 'twentytwelve'] ) ) { |
|
| 88 | 88 | $innerTemplate = '%3$s'; |
| 89 | 89 | } |
| 90 | 90 | else if( $theme == 'twentyfourteen' ) { |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $template = sprintf( $template, $class, $screenReaderText, $links ); |
| 97 | 97 | return glsr( Builder::class )->div( $template.'<div class="glsr-loader"></div>', [ |
| 98 | 98 | 'class' => 'glsr-navigation', |
| 99 | - ]); |
|
| 99 | + ] ); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -119,6 +119,6 @@ discard block |
||
| 119 | 119 | return wp_parse_args( $args, [ |
| 120 | 120 | 'paged' => glsr( QueryBuilder::class )->getPaged(), |
| 121 | 121 | 'total' => 1, |
| 122 | - ]); |
|
| 122 | + ] ); |
|
| 123 | 123 | } |
| 124 | 124 | } |
@@ -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> |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php defined( 'WPINC' ) || die; ?> |
| 2 | 2 | |
| 3 | 3 | <div id="titlediv"> |
| 4 | - <input type="text" id="title" value="<?= $post->post_title ? esc_attr( $post->post_title ) : sprintf( '(%s)', __( 'no title', 'site-reviews' )); ?>" readonly> |
|
| 4 | + <input type="text" id="title" value="<?= $post->post_title ? esc_attr( $post->post_title ) : sprintf( '(%s)', __( 'no title', 'site-reviews' ) ); ?>" readonly> |
|
| 5 | 5 | </div> |
| 6 | 6 | |
| 7 | 7 | <div id="contentdiv"> |