@@ -13,15 +13,15 @@ discard block |
||
13 | 13 | public function fields() |
14 | 14 | { |
15 | 15 | return [[ |
16 | - 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' )), |
|
16 | + 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' ) ), |
|
17 | 17 | 'minWidth' => 320, |
18 | 18 | 'type' => 'container', |
19 | - ],[ |
|
19 | + ], [ |
|
20 | 20 | 'label' => esc_html__( 'Title', 'site-reviews' ), |
21 | 21 | 'name' => 'title', |
22 | 22 | 'tooltip' => esc_attr__( 'Enter a custom shortcode heading.', 'site-reviews' ), |
23 | 23 | 'type' => 'textbox', |
24 | - ],[ |
|
24 | + ], [ |
|
25 | 25 | 'label' => esc_html__( 'Count', 'site-reviews' ), |
26 | 26 | 'maxLength' => 5, |
27 | 27 | 'name' => 'count', |
@@ -29,20 +29,20 @@ discard block |
||
29 | 29 | 'text' => '10', |
30 | 30 | 'tooltip' => esc_attr__( 'How many reviews would you like to display (default: 10)?', 'site-reviews' ), |
31 | 31 | 'type' => 'textbox', |
32 | - ],[ |
|
32 | + ], [ |
|
33 | 33 | 'label' => esc_html__( 'Rating', 'site-reviews' ), |
34 | 34 | 'name' => 'rating', |
35 | 35 | 'options' => [ |
36 | - '5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 )), |
|
37 | - '4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 )), |
|
38 | - '3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 )), |
|
39 | - '2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 )), |
|
40 | - '1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 )), |
|
41 | - '0' => esc_html( __( 'Unrated', 'site-reviews' )), |
|
36 | + '5' => esc_html( sprintf( _n( '%s star', '%s stars', 5, 'site-reviews' ), 5 ) ), |
|
37 | + '4' => esc_html( sprintf( _n( '%s star', '%s stars', 4, 'site-reviews' ), 4 ) ), |
|
38 | + '3' => esc_html( sprintf( _n( '%s star', '%s stars', 3, 'site-reviews' ), 3 ) ), |
|
39 | + '2' => esc_html( sprintf( _n( '%s star', '%s stars', 2, 'site-reviews' ), 2 ) ), |
|
40 | + '1' => esc_html( sprintf( _n( '%s star', '%s stars', 1, 'site-reviews' ), 1 ) ), |
|
41 | + '0' => esc_html( __( 'Unrated', 'site-reviews' ) ), |
|
42 | 42 | ], |
43 | 43 | 'tooltip' => esc_attr__( 'What is the minimum rating to display (default: 1 star)?', 'site-reviews' ), |
44 | 44 | 'type' => 'listbox', |
45 | - ],[ |
|
45 | + ], [ |
|
46 | 46 | 'label' => esc_html__( 'Pagination', 'site-reviews' ), |
47 | 47 | 'name' => 'pagination', |
48 | 48 | 'options' => [ |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | 'name' => 'assigned_to', |
61 | 61 | 'tooltip' => esc_attr__( 'Limit reviews to those assigned to this post ID (separate multiple IDs with a comma). You can also enter "post_id" to use the ID of the current page.', 'site-reviews' ), |
62 | 62 | 'type' => 'textbox', |
63 | - ],[ |
|
63 | + ], [ |
|
64 | 64 | 'label' => esc_html__( 'Schema', 'site-reviews' ), |
65 | 65 | 'name' => 'schema', |
66 | 66 | 'options' => [ |
@@ -69,49 +69,49 @@ discard block |
||
69 | 69 | ], |
70 | 70 | 'tooltip' => esc_attr__( 'Rich snippets are disabled by default.', 'site-reviews' ), |
71 | 71 | 'type' => 'listbox', |
72 | - ],[ |
|
72 | + ], [ |
|
73 | 73 | 'label' => esc_html__( 'Classes', 'site-reviews' ), |
74 | 74 | 'name' => 'class', |
75 | 75 | 'tooltip' => esc_attr__( 'Add custom CSS classes to the shortcode.', 'site-reviews' ), |
76 | 76 | 'type' => 'textbox', |
77 | - ],[ |
|
77 | + ], [ |
|
78 | 78 | 'columns' => 2, |
79 | 79 | 'items' => [[ |
80 | 80 | 'name' => 'hide_assigned_to', |
81 | 81 | 'text' => esc_html__( 'Assigned To', 'site-reviews' ), |
82 | 82 | 'tooltip' => esc_attr__( 'Hide the assigned to link?', 'site-reviews' ), |
83 | 83 | 'type' => 'checkbox', |
84 | - ],[ |
|
84 | + ], [ |
|
85 | 85 | 'name' => 'hide_author', |
86 | 86 | 'text' => esc_html__( 'Author', 'site-reviews' ), |
87 | 87 | 'tooltip' => esc_attr__( 'Hide the review author?', 'site-reviews' ), |
88 | 88 | 'type' => 'checkbox', |
89 | - ],[ |
|
89 | + ], [ |
|
90 | 90 | 'name' => 'hide_avatar', |
91 | 91 | 'text' => esc_html__( 'Avatar', 'site-reviews' ), |
92 | 92 | 'tooltip' => esc_attr__( 'Hide the reviewer avatar if shown?', 'site-reviews' ), |
93 | 93 | 'type' => 'checkbox', |
94 | - ],[ |
|
94 | + ], [ |
|
95 | 95 | 'name' => 'hide_content', |
96 | 96 | 'text' => esc_html__( 'Content', 'site-reviews' ), |
97 | 97 | 'tooltip' => esc_attr__( 'Hide the review content?', 'site-reviews' ), |
98 | 98 | 'type' => 'checkbox', |
99 | - ],[ |
|
99 | + ], [ |
|
100 | 100 | 'name' => 'hide_date', |
101 | 101 | 'text' => esc_html__( 'Date', 'site-reviews' ), |
102 | 102 | 'tooltip' => esc_attr__( 'Hide the review date?', 'site-reviews' ), |
103 | 103 | 'type' => 'checkbox', |
104 | - ],[ |
|
104 | + ], [ |
|
105 | 105 | 'name' => 'hide_rating', |
106 | 106 | 'text' => esc_html__( 'Rating', 'site-reviews' ), |
107 | 107 | 'tooltip' => esc_attr__( 'Hide the review rating?', 'site-reviews' ), |
108 | 108 | 'type' => 'checkbox', |
109 | - ],[ |
|
109 | + ], [ |
|
110 | 110 | 'name' => 'hide_response', |
111 | 111 | 'text' => esc_html__( 'Response', 'site-reviews' ), |
112 | 112 | 'tooltip' => esc_attr__( 'Hide the review response?', 'site-reviews' ), |
113 | 113 | 'type' => 'checkbox', |
114 | - ],[ |
|
114 | + ], [ |
|
115 | 115 | 'name' => 'hide_title', |
116 | 116 | 'text' => esc_html__( 'Title', 'site-reviews' ), |
117 | 117 | 'tooltip' => esc_attr__( 'Hide the review title?', 'site-reviews' ), |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | 'label' => esc_html__( 'Hide', 'site-reviews' ), |
122 | 122 | 'spacing' => 5, |
123 | 123 | 'type' => 'container', |
124 | - ],[ |
|
124 | + ], [ |
|
125 | 125 | 'hidden' => true, |
126 | 126 | 'name' => 'id', |
127 | 127 | 'type' => 'textbox', |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | public function getTerms() |
135 | 135 | { |
136 | 136 | $terms = glsr( Database::class )->getTerms(); |
137 | - if( empty( $terms )) { |
|
137 | + if( empty($terms) ) { |
|
138 | 138 | return []; |
139 | 139 | } |
140 | 140 | return [ |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public function __construct() |
34 | 34 | { |
35 | 35 | $types = glsr( OptionManager::class )->get( 'settings.general.notifications', [] ); |
36 | - $this->email = count( array_intersect( ['admin', 'custom'], $types )) > 0; |
|
36 | + $this->email = count( array_intersect( ['admin', 'custom'], $types ) ) > 0; |
|
37 | 37 | $this->slack = in_array( 'slack', $types ); |
38 | 38 | $this->types = $types; |
39 | 39 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function send( Review $review ) |
45 | 45 | { |
46 | - if( empty( $this->types ))return; |
|
46 | + if( empty($this->types) )return; |
|
47 | 47 | $this->review = $review; |
48 | 48 | $args = [ |
49 | 49 | 'link' => $this->getLink(), |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | protected function buildEmail( array $args ) |
60 | 60 | { |
61 | - return glsr( Email::class )->compose([ |
|
61 | + return glsr( Email::class )->compose( [ |
|
62 | 62 | 'to' => $this->getEmailAddresses(), |
63 | 63 | 'subject' => $args['title'], |
64 | 64 | 'template' => 'email-notification', |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | 'review_rating' => $this->review->rating, |
72 | 72 | 'review_title' => $this->review->title, |
73 | 73 | ], |
74 | - ]); |
|
74 | + ] ); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | 'button_url' => $args['link'], |
84 | 84 | 'fallback' => $this->buildEmail( $args )->read( 'plaintext' ), |
85 | 85 | 'pretext' => $args['title'], |
86 | - ]); |
|
86 | + ] ); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -92,23 +92,23 @@ discard block |
||
92 | 92 | protected function getEmailAddresses() |
93 | 93 | { |
94 | 94 | $emails = []; |
95 | - if( in_array( 'admin', $this->types )) { |
|
95 | + if( in_array( 'admin', $this->types ) ) { |
|
96 | 96 | $emails[] = get_option( 'admin_email' ); |
97 | 97 | } |
98 | - if( in_array( 'author', $this->types )) { |
|
99 | - $assignedPost = get_post( intval( $this->review->assigned_to )); |
|
98 | + if( in_array( 'author', $this->types ) ) { |
|
99 | + $assignedPost = get_post( intval( $this->review->assigned_to ) ); |
|
100 | 100 | if( $assignedPost instanceof WP_Post ) { |
101 | 101 | $this->email = true; |
102 | - $emails[] = get_the_author_meta( 'user_email', intval( $assignedPost->post_author )); |
|
102 | + $emails[] = get_the_author_meta( 'user_email', intval( $assignedPost->post_author ) ); |
|
103 | 103 | } |
104 | 104 | } |
105 | - if( in_array( 'custom', $this->types )) { |
|
105 | + if( in_array( 'custom', $this->types ) ) { |
|
106 | 106 | $customEmails = glsr( OptionManager::class )->get( 'settings.general.notification_email' ); |
107 | 107 | $customEmails = str_replace( [' ', ',', ';'], ',', $customEmails ); |
108 | 108 | $customEmails = explode( ',', $customEmails ); |
109 | 109 | $emails = array_merge( $emails, $customEmails ); |
110 | 110 | } |
111 | - $emails = array_filter( array_keys( array_flip( $emails ))); |
|
111 | + $emails = array_filter( array_keys( array_flip( $emails ) ) ); |
|
112 | 112 | return apply_filters( 'site-reviews/notification/emails', $emails, $this->review ); |
113 | 113 | } |
114 | 114 | |
@@ -125,16 +125,16 @@ discard block |
||
125 | 125 | */ |
126 | 126 | protected function getTitle() |
127 | 127 | { |
128 | - $assignedTitle = get_the_title( intval( $this->review->assigned_to )); |
|
128 | + $assignedTitle = get_the_title( intval( $this->review->assigned_to ) ); |
|
129 | 129 | $title = _nx( |
130 | 130 | 'New %s-star review', |
131 | 131 | 'New %s-star review of: %s', |
132 | - intval( empty( $assignedTitle )), |
|
132 | + intval( empty($assignedTitle) ), |
|
133 | 133 | 'This string differs depending on whether or not the review has been assigned to a post.', |
134 | 134 | 'site-reviews' |
135 | 135 | ); |
136 | 136 | $title = sprintf( '[%s] %s', |
137 | - wp_specialchars_decode( strval( get_option( 'blogname' )), ENT_QUOTES ), |
|
137 | + wp_specialchars_decode( strval( get_option( 'blogname' ) ), ENT_QUOTES ), |
|
138 | 138 | sprintf( $title, $this->review->rating, $assignedTitle ) |
139 | 139 | ); |
140 | 140 | return apply_filters( 'site-reviews/notification/title', $title, $this->review ); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | { |
148 | 148 | $email = $this->buildEmail( $args ); |
149 | 149 | if( !$this->email )return; |
150 | - if( empty( $email->to )) { |
|
150 | + if( empty($email->to) ) { |
|
151 | 151 | glsr_log()->error( 'Email notification was not sent: missing email address' ); |
152 | 152 | return; |
153 | 153 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | if( !$this->slack )return; |
165 | 165 | $notification = $this->buildSlackNotification( $args ); |
166 | 166 | $result = $notification->send(); |
167 | - if( is_wp_error( $result )) { |
|
167 | + if( is_wp_error( $result ) ) { |
|
168 | 168 | $notification->review = null; |
169 | 169 | glsr_log()->error( $result->get_error_message() )->debug( $notification ); |
170 | 170 | } |
@@ -43,7 +43,9 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function send( Review $review ) |
45 | 45 | { |
46 | - if( empty( $this->types ))return; |
|
46 | + if( empty( $this->types )) { |
|
47 | + return; |
|
48 | + } |
|
47 | 49 | $this->review = $review; |
48 | 50 | $args = [ |
49 | 51 | 'link' => $this->getLink(), |
@@ -146,7 +148,9 @@ discard block |
||
146 | 148 | protected function sendToEmail( array $args ) |
147 | 149 | { |
148 | 150 | $email = $this->buildEmail( $args ); |
149 | - if( !$this->email )return; |
|
151 | + if( !$this->email ) { |
|
152 | + return; |
|
153 | + } |
|
150 | 154 | if( empty( $email->to )) { |
151 | 155 | glsr_log()->error( 'Email notification was not sent: missing email address' ); |
152 | 156 | return; |
@@ -161,7 +165,9 @@ discard block |
||
161 | 165 | */ |
162 | 166 | protected function sendToSlack( array $args ) |
163 | 167 | { |
164 | - if( !$this->slack )return; |
|
168 | + if( !$this->slack ) { |
|
169 | + return; |
|
170 | + } |
|
165 | 171 | $notification = $this->buildSlackNotification( $args ); |
166 | 172 | $result = $notification->send(); |
167 | 173 | if( is_wp_error( $result )) { |
@@ -11,13 +11,13 @@ 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 | - ])); |
|
20 | + ] ) ); |
|
21 | 21 | return (bool)apply_filters( 'site-reviews/blacklist/is-blacklisted', |
22 | 22 | $this->check( $target ), |
23 | 23 | $review |
@@ -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 | 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 | } |
@@ -37,7 +37,9 @@ |
||
37 | 37 | $lines = explode( "\n", $blacklist ); |
38 | 38 | foreach( (array)$lines as $line ) { |
39 | 39 | $line = trim( $line ); |
40 | - if( empty( $line ) || 256 < strlen( $line ))continue; |
|
40 | + if( empty( $line ) || 256 < strlen( $line )) { |
|
41 | + continue; |
|
42 | + } |
|
41 | 43 | $pattern = sprintf( '#%s#i', preg_quote( $line, '#' )); |
42 | 44 | if( preg_match( $pattern, $target )) { |
43 | 45 | return true; |
@@ -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 ''; |
@@ -69,7 +69,9 @@ discard block |
||
69 | 69 | $properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta )); |
70 | 70 | $this->modified = $this->isModified( $properties ); |
71 | 71 | array_walk( $properties, function( $value, $key ) { |
72 | - if( !property_exists( $this, $key ) || isset( $this->$key ))return; |
|
72 | + if( !property_exists( $this, $key ) || isset( $this->$key )) { |
|
73 | + return; |
|
74 | + } |
|
73 | 75 | $this->$key = maybe_unserialize( $value ); |
74 | 76 | }); |
75 | 77 | } |
@@ -80,7 +82,9 @@ discard block |
||
80 | 82 | protected function setTermIds( WP_Post $post ) |
81 | 83 | { |
82 | 84 | $this->term_ids = []; |
83 | - if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return; |
|
85 | + if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ))) { |
|
86 | + return; |
|
87 | + } |
|
84 | 88 | foreach( $terms as $term ) { |
85 | 89 | $this->term_ids[] = $term->term_id; |
86 | 90 | } |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function __get( $key ) |
48 | 48 | { |
49 | - if( property_exists( $this, $key )) { |
|
49 | + if( property_exists( $this, $key ) ) { |
|
50 | 50 | return $this->$key; |
51 | 51 | } |
52 | - if( is_array( $this->custom ) && array_key_exists( $key, $this->custom )) { |
|
52 | + if( is_array( $this->custom ) && array_key_exists( $key, $this->custom ) ) { |
|
53 | 53 | return $this->custom[$key]; |
54 | 54 | } |
55 | 55 | return ''; |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | 'review_type' => '', |
78 | 78 | ]; |
79 | 79 | $meta = array_filter( |
80 | - array_map( 'array_shift', (array)get_post_meta( $post->ID )), |
|
80 | + array_map( 'array_shift', (array)get_post_meta( $post->ID ) ), |
|
81 | 81 | 'strlen' |
82 | 82 | ); |
83 | - $properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta )); |
|
83 | + $properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ) ); |
|
84 | 84 | $this->modified = $this->isModified( $properties ); |
85 | 85 | array_walk( $properties, function( $value, $key ) { |
86 | - if( !property_exists( $this, $key ) || isset( $this->$key ))return; |
|
86 | + if( !property_exists( $this, $key ) || isset($this->$key) )return; |
|
87 | 87 | $this->$key = maybe_unserialize( $value ); |
88 | 88 | }); |
89 | 89 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | protected function setTermIds( WP_Post $post ) |
95 | 95 | { |
96 | 96 | $this->term_ids = []; |
97 | - if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return; |
|
97 | + if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ) ) )return; |
|
98 | 98 | foreach( $terms as $term ) { |
99 | 99 | $this->term_ids[] = $term->term_id; |
100 | 100 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function __call( $name, array $args = [] ) |
15 | 15 | { |
16 | - if( !method_exists( $this, $name ))return; |
|
16 | + if( !method_exists( $this, $name ) )return; |
|
17 | 17 | $defaults = call_user_func_array( [$this, $name], $args ); |
18 | 18 | $hookName = (new ReflectionClass( $this ))->getShortName(); |
19 | 19 | $hookName = str_replace( 'Defaults', '', $hookName ); |
@@ -13,7 +13,9 @@ |
||
13 | 13 | */ |
14 | 14 | public function __call( $name, array $args = [] ) |
15 | 15 | { |
16 | - if( !method_exists( $this, $name ))return; |
|
16 | + if( !method_exists( $this, $name )) { |
|
17 | + return; |
|
18 | + } |
|
17 | 19 | $defaults = call_user_func_array( [$this, $name], $args ); |
18 | 20 | $hookName = (new ReflectionClass( $this ))->getShortName(); |
19 | 21 | $hookName = str_replace( 'Defaults', '', $hookName ); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function get() |
110 | 110 | { |
111 | - return empty( $this->log ) |
|
111 | + return empty($this->log) |
|
112 | 112 | ? __( 'Console is empty', 'site-reviews' ) |
113 | 113 | : $this->log; |
114 | 114 | } |
@@ -120,11 +120,11 @@ discard block |
||
120 | 120 | public function humanSize( $valueIfEmpty = null ) |
121 | 121 | { |
122 | 122 | $bytes = $this->size(); |
123 | - if( empty( $bytes ) && is_string( $valueIfEmpty )) { |
|
123 | + if( empty($bytes) && is_string( $valueIfEmpty ) ) { |
|
124 | 124 | return $valueIfEmpty; |
125 | 125 | } |
126 | - $exponent = floor( log( max( $bytes, 1 ), 1024 )); |
|
127 | - return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes','KB','MB','GB'][$exponent]; |
|
126 | + $exponent = floor( log( max( $bytes, 1 ), 1024 ) ); |
|
127 | + return round( $bytes / pow( 1024, $exponent ), 2 ).' '.['bytes', 'KB', 'MB', 'GB'][$exponent]; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | public function log( $level, $message, array $context = [] ) |
148 | 148 | { |
149 | 149 | $constants = (new ReflectionClass( __CLASS__ ))->getConstants(); |
150 | - if( in_array( $level, $constants, true )) { |
|
150 | + if( in_array( $level, $constants, true ) ) { |
|
151 | 151 | $entry = $this->buildLogEntry( $level, $message, $context ); |
152 | - file_put_contents( $this->file, $entry, FILE_APPEND|LOCK_EX ); |
|
152 | + file_put_contents( $this->file, $entry, FILE_APPEND | LOCK_EX ); |
|
153 | 153 | $this->reset(); |
154 | 154 | } |
155 | 155 | return $this; |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | */ |
223 | 223 | protected function interpolate( $message, $context = [] ) |
224 | 224 | { |
225 | - if( $this->isObjectOrArray( $message ) || !is_array( $context )) { |
|
225 | + if( $this->isObjectOrArray( $message ) || !is_array( $context ) ) { |
|
226 | 226 | return print_r( $message, true ); |
227 | 227 | } |
228 | 228 | $replace = []; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | if( $value instanceof DateTime ) { |
251 | 251 | $value = $value->format( 'Y-m-d H:i:s' ); |
252 | 252 | } |
253 | - else if( $this->isObjectOrArray( $value )) { |
|
253 | + else if( $this->isObjectOrArray( $value ) ) { |
|
254 | 254 | $value = json_encode( $value ); |
255 | 255 | } |
256 | 256 | return (string)$value; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $this->clear(); |
266 | 266 | file_put_contents( |
267 | 267 | $this->file, |
268 | - $this->buildLogEntry( 'info', __( 'Console was automatically cleared (128 KB maximum size)', 'site-reviews' )) |
|
268 | + $this->buildLogEntry( 'info', __( 'Console was automatically cleared (128 KB maximum size)', 'site-reviews' ) ) |
|
269 | 269 | ); |
270 | 270 | } |
271 | 271 | } |
@@ -119,13 +119,13 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function renderAssignedToMetabox( WP_Post $post ) |
121 | 121 | { |
122 | - if( !$this->isReviewPostType( $post ))return; |
|
122 | + if( !$this->isReviewPostType( $post ) )return; |
|
123 | 123 | $assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true ); |
124 | 124 | wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false ); |
125 | 125 | glsr()->render( 'partials/editor/metabox-assigned-to', [ |
126 | 126 | 'id' => $assignedTo, |
127 | 127 | 'template' => $this->buildAssignedToTemplate( $assignedTo, $post ), |
128 | - ]); |
|
128 | + ] ); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -134,12 +134,12 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function renderDetailsMetaBox( WP_Post $post ) |
136 | 136 | { |
137 | - if( !$this->isReviewPostType( $post ))return; |
|
137 | + if( !$this->isReviewPostType( $post ) )return; |
|
138 | 138 | $review = glsr( ReviewManager::class )->single( $post ); |
139 | 139 | glsr()->render( 'partials/editor/metabox-details', [ |
140 | 140 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
141 | 141 | 'metabox' => $this->normalizeDetailsMetaBox( $review ), |
142 | - ]); |
|
142 | + ] ); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -148,14 +148,14 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function renderPinnedInPublishMetaBox() |
150 | 150 | { |
151 | - if( !$this->isReviewPostType( get_post() ))return; |
|
151 | + if( !$this->isReviewPostType( get_post() ) )return; |
|
152 | 152 | glsr( Template::class )->render( 'partials/editor/pinned', [ |
153 | 153 | 'context' => [ |
154 | 154 | 'no' => __( 'No', 'site-reviews' ), |
155 | 155 | 'yes' => __( 'Yes', 'site-reviews' ), |
156 | 156 | ], |
157 | - 'pinned' => wp_validate_boolean( get_post_meta( intval( get_the_ID() ), 'pinned', true )), |
|
158 | - ]); |
|
157 | + 'pinned' => wp_validate_boolean( get_post_meta( intval( get_the_ID() ), 'pinned', true ) ), |
|
158 | + ] ); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public function renderResponseMetaBox( WP_Post $post ) |
166 | 166 | { |
167 | - if( !$this->isReviewPostType( $post ))return; |
|
167 | + if( !$this->isReviewPostType( $post ) )return; |
|
168 | 168 | wp_nonce_field( 'response', '_nonce-response', false ); |
169 | 169 | glsr()->render( 'partials/editor/metabox-response', [ |
170 | 170 | 'response' => get_post_meta( $post->ID, 'response', true ), |
171 | - ]); |
|
171 | + ] ); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -178,12 +178,12 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function renderTaxonomyMetabox( WP_Post $post ) |
180 | 180 | { |
181 | - if( !$this->isReviewPostType( $post ))return; |
|
181 | + if( !$this->isReviewPostType( $post ) )return; |
|
182 | 182 | glsr()->render( 'partials/editor/metabox-categories', [ |
183 | 183 | 'post' => $post, |
184 | 184 | 'tax_name' => Application::TAXONOMY, |
185 | 185 | 'taxonomy' => get_taxonomy( Application::TAXONOMY ), |
186 | - ]); |
|
186 | + ] ); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function revertReview() |
195 | 195 | { |
196 | - check_admin_referer( 'revert-review_'.( $postId = $this->getPostId() )); |
|
196 | + check_admin_referer( 'revert-review_'.($postId = $this->getPostId()) ); |
|
197 | 197 | glsr( ReviewManager::class )->revert( $postId ); |
198 | 198 | $this->redirect( $postId, 52 ); |
199 | 199 | } |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | protected function buildAssignedToTemplate( $assignedTo, WP_Post $post ) |
217 | 217 | { |
218 | 218 | $assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo ); |
219 | - if( !( $assignedPost instanceof WP_Post ))return; |
|
219 | + if( !($assignedPost instanceof WP_Post) )return; |
|
220 | 220 | return glsr( Template::class )->build( 'partials/editor/assigned-post', [ |
221 | 221 | 'context' => [ |
222 | 222 | 'data.url' => (string)get_permalink( $assignedPost ), |
223 | 223 | 'data.title' => get_the_title( $assignedPost ), |
224 | 224 | ], |
225 | - ]); |
|
225 | + ] ); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -242,13 +242,13 @@ discard block |
||
242 | 242 | 'class' => 'button button-large', |
243 | 243 | 'href' => $revertUrl, |
244 | 244 | 'id' => 'revert', |
245 | - ]); |
|
245 | + ] ); |
|
246 | 246 | } |
247 | 247 | return glsr( Builder::class )->button( __( 'Nothing to Revert', 'site-reviews' ), [ |
248 | 248 | 'class' => 'button button-large', |
249 | 249 | 'disabled' => true, |
250 | 250 | 'id' => 'revert', |
251 | - ]); |
|
251 | + ] ); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
@@ -261,11 +261,11 @@ discard block |
||
261 | 261 | $reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes ) |
262 | 262 | ? glsr()->reviewTypes[$review->review_type] |
263 | 263 | : __( 'Unknown', 'site-reviews' ); |
264 | - if( !empty( $review->url )) { |
|
264 | + if( !empty($review->url) ) { |
|
265 | 265 | $reviewType = glsr( Builder::class )->a( $reviewType, [ |
266 | 266 | 'href' => $review->url, |
267 | 267 | 'target' => '_blank', |
268 | - ]); |
|
268 | + ] ); |
|
269 | 269 | } |
270 | 270 | return $reviewType; |
271 | 271 | } |
@@ -284,16 +284,16 @@ discard block |
||
284 | 284 | */ |
285 | 285 | protected function normalizeDetailsMetaBox( Review $review ) |
286 | 286 | { |
287 | - $user = empty( $review->user_id ) |
|
287 | + $user = empty($review->user_id) |
|
288 | 288 | ? __( 'Unregistered user', 'site-reviews' ) |
289 | 289 | : glsr( Builder::class )->a( get_the_author_meta( 'display_name', $review->user_id ), [ |
290 | 290 | 'href' => get_author_posts_url( $review->user_id ), |
291 | - ]); |
|
292 | - $email = empty( $review->email ) |
|
291 | + ] ); |
|
292 | + $email = empty($review->email) |
|
293 | 293 | ? '—' |
294 | 294 | : glsr( Builder::class )->a( $review->email, [ |
295 | 295 | 'href' => 'mailto:'.$review->email.'?subject='.esc_attr( __( 'RE:', 'site-reviews' ).' '.$review->title ), |
296 | - ]); |
|
296 | + ] ); |
|
297 | 297 | $metabox = [ |
298 | 298 | __( 'Rating', 'site-reviews' ) => glsr( Partial::class )->build( 'star-rating', ['rating' => $review->rating] ), |
299 | 299 | __( 'Type', 'site-reviews' ) => $this->getReviewType( $review ), |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | __( 'IP Address', 'site-reviews' ) => $review->ip_address, |
305 | 305 | __( 'Avatar', 'site-reviews' ) => sprintf( '<img src="%s" width="96">', $review->avatar ), |
306 | 306 | ]; |
307 | - return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review )); |
|
307 | + return array_filter( apply_filters( 'site-reviews/metabox/details', $metabox, $review ) ); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | $redirectUri = $hasReferer |
322 | 322 | ? remove_query_arg( ['deleted', 'ids', 'trashed', 'untrashed'], $referer ) |
323 | 323 | : get_edit_post_link( $postId ); |
324 | - wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri )); |
|
324 | + wp_safe_redirect( add_query_arg( ['message' => $messageIndex], $redirectUri ) ); |
|
325 | 325 | exit; |
326 | 326 | } |
327 | 327 | } |
@@ -89,7 +89,9 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function registerMetaBoxes( $postType ) |
91 | 91 | { |
92 | - if( $postType != Application::POST_TYPE )return; |
|
92 | + if( $postType != Application::POST_TYPE ) { |
|
93 | + return; |
|
94 | + } |
|
93 | 95 | add_meta_box( Application::ID.'_assigned_to', __( 'Assigned To', 'site-reviews' ), [$this, 'renderAssignedToMetabox'], null, 'side' ); |
94 | 96 | add_meta_box( Application::ID.'_review', __( 'Details', 'site-reviews' ), [$this, 'renderDetailsMetaBox'], null, 'side' ); |
95 | 97 | add_meta_box( Application::ID.'_response', __( 'Respond Publicly', 'site-reviews' ), [$this, 'renderResponseMetaBox'], null, 'normal' ); |
@@ -119,7 +121,9 @@ discard block |
||
119 | 121 | */ |
120 | 122 | public function renderAssignedToMetabox( WP_Post $post ) |
121 | 123 | { |
122 | - if( !$this->isReviewPostType( $post ))return; |
|
124 | + if( !$this->isReviewPostType( $post )) { |
|
125 | + return; |
|
126 | + } |
|
123 | 127 | $assignedTo = (string)get_post_meta( $post->ID, 'assigned_to', true ); |
124 | 128 | wp_nonce_field( 'assigned_to', '_nonce-assigned-to', false ); |
125 | 129 | glsr()->render( 'partials/editor/metabox-assigned-to', [ |
@@ -134,7 +138,9 @@ discard block |
||
134 | 138 | */ |
135 | 139 | public function renderDetailsMetaBox( WP_Post $post ) |
136 | 140 | { |
137 | - if( !$this->isReviewPostType( $post ))return; |
|
141 | + if( !$this->isReviewPostType( $post )) { |
|
142 | + return; |
|
143 | + } |
|
138 | 144 | $review = glsr( ReviewManager::class )->single( $post ); |
139 | 145 | glsr()->render( 'partials/editor/metabox-details', [ |
140 | 146 | 'button' => $this->buildDetailsMetaBoxRevertButton( $review, $post ), |
@@ -148,7 +154,9 @@ discard block |
||
148 | 154 | */ |
149 | 155 | public function renderPinnedInPublishMetaBox() |
150 | 156 | { |
151 | - if( !$this->isReviewPostType( get_post() ))return; |
|
157 | + if( !$this->isReviewPostType( get_post() )) { |
|
158 | + return; |
|
159 | + } |
|
152 | 160 | glsr( Template::class )->render( 'partials/editor/pinned', [ |
153 | 161 | 'context' => [ |
154 | 162 | 'no' => __( 'No', 'site-reviews' ), |
@@ -164,7 +172,9 @@ discard block |
||
164 | 172 | */ |
165 | 173 | public function renderResponseMetaBox( WP_Post $post ) |
166 | 174 | { |
167 | - if( !$this->isReviewPostType( $post ))return; |
|
175 | + if( !$this->isReviewPostType( $post )) { |
|
176 | + return; |
|
177 | + } |
|
168 | 178 | wp_nonce_field( 'response', '_nonce-response', false ); |
169 | 179 | glsr()->render( 'partials/editor/metabox-response', [ |
170 | 180 | 'response' => get_post_meta( $post->ID, 'response', true ), |
@@ -178,7 +188,9 @@ discard block |
||
178 | 188 | */ |
179 | 189 | public function renderTaxonomyMetabox( WP_Post $post ) |
180 | 190 | { |
181 | - if( !$this->isReviewPostType( $post ))return; |
|
191 | + if( !$this->isReviewPostType( $post )) { |
|
192 | + return; |
|
193 | + } |
|
182 | 194 | glsr()->render( 'partials/editor/metabox-categories', [ |
183 | 195 | 'post' => $post, |
184 | 196 | 'tax_name' => Application::TAXONOMY, |
@@ -216,7 +228,9 @@ discard block |
||
216 | 228 | protected function buildAssignedToTemplate( $assignedTo, WP_Post $post ) |
217 | 229 | { |
218 | 230 | $assignedPost = glsr( Database::class )->getAssignedToPost( $post->ID, $assignedTo ); |
219 | - if( !( $assignedPost instanceof WP_Post ))return; |
|
231 | + if( !( $assignedPost instanceof WP_Post )) { |
|
232 | + return; |
|
233 | + } |
|
220 | 234 | return glsr( Template::class )->build( 'partials/editor/assigned-post', [ |
221 | 235 | 'context' => [ |
222 | 236 | 'data.url' => (string)get_permalink( $assignedPost ), |
@@ -257,7 +271,9 @@ discard block |
||
257 | 271 | */ |
258 | 272 | protected function getReviewType( $review ) |
259 | 273 | { |
260 | - if( count( glsr()->reviewTypes ) < 2 )return; |
|
274 | + if( count( glsr()->reviewTypes ) < 2 ) { |
|
275 | + return; |
|
276 | + } |
|
261 | 277 | $reviewType = array_key_exists( $review->review_type, glsr()->reviewTypes ) |
262 | 278 | ? glsr()->reviewTypes[$review->review_type] |
263 | 279 | : __( 'Unknown', 'site-reviews' ); |
@@ -109,7 +109,9 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function renderReviewEditor( WP_Post $post ) |
111 | 111 | { |
112 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
112 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) { |
|
113 | + return; |
|
114 | + } |
|
113 | 115 | glsr()->render( 'partials/editor/review', [ |
114 | 116 | 'post' => $post, |
115 | 117 | ]); |
@@ -121,7 +123,9 @@ discard block |
||
121 | 123 | */ |
122 | 124 | public function renderReviewNotice( WP_Post $post ) |
123 | 125 | { |
124 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
126 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post )) { |
|
127 | + return; |
|
128 | + } |
|
125 | 129 | glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' )); |
126 | 130 | glsr( Template::class )->render( 'partials/editor/notice', [ |
127 | 131 | 'context' => [ |
@@ -136,12 +140,16 @@ discard block |
||
136 | 140 | */ |
137 | 141 | public function renderTinymceButton() |
138 | 142 | { |
139 | - if( glsr_current_screen()->base != 'post' )return; |
|
143 | + if( glsr_current_screen()->base != 'post' ) { |
|
144 | + return; |
|
145 | + } |
|
140 | 146 | $shortcodes = []; |
141 | 147 | foreach( glsr()->mceShortcodes as $shortcode => $values ) { |
142 | 148 | $shortcodes[$shortcode] = $values; |
143 | 149 | } |
144 | - if( empty( $shortcodes ))return; |
|
150 | + if( empty( $shortcodes )) { |
|
151 | + return; |
|
152 | + } |
|
145 | 153 | glsr()->render( 'partials/editor/tinymce', [ |
146 | 154 | 'shortcodes' => $shortcodes, |
147 | 155 | ]); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function enqueueAssets() |
27 | 27 | { |
28 | - $command = new EnqueueAdminAssets([ |
|
28 | + $command = new EnqueueAdminAssets( [ |
|
29 | 29 | 'pointers' => [[ |
30 | 30 | 'content' => __( 'You can pin exceptional reviews so that they are always shown first.', 'site-reviews' ), |
31 | 31 | 'id' => 'glsr-pointer-pinned', |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'target' => '#misc-pub-pinned', |
38 | 38 | 'title' => __( 'Pin Your Reviews', 'site-reviews' ), |
39 | 39 | ]], |
40 | - ]); |
|
40 | + ] ); |
|
41 | 41 | $this->execute( $command ); |
42 | 42 | } |
43 | 43 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | { |
50 | 50 | $links['settings'] = glsr( Builder::class )->a( __( 'Settings', 'site-reviews' ), [ |
51 | 51 | 'href' => admin_url( 'edit.php?post_type='.Application::POST_TYPE.'&page=settings' ), |
52 | - ]); |
|
52 | + ] ); |
|
53 | 53 | return $links; |
54 | 54 | } |
55 | 55 | |
@@ -60,19 +60,19 @@ discard block |
||
60 | 60 | public function filterDashboardGlanceItems( array $items ) |
61 | 61 | { |
62 | 62 | $postCount = wp_count_posts( Application::POST_TYPE ); |
63 | - if( empty( $postCount->publish )) { |
|
63 | + if( empty($postCount->publish) ) { |
|
64 | 64 | return $items; |
65 | 65 | } |
66 | 66 | $text = _n( '%s Review', '%s Reviews', $postCount->publish, 'site-reviews' ); |
67 | - $text = sprintf( $text, number_format_i18n( $postCount->publish )); |
|
67 | + $text = sprintf( $text, number_format_i18n( $postCount->publish ) ); |
|
68 | 68 | $items[] = current_user_can( get_post_type_object( Application::POST_TYPE )->cap->edit_posts ) |
69 | 69 | ? glsr( Builder::class )->a( $text, [ |
70 | 70 | 'class' => 'glsr-review-count', |
71 | 71 | 'href' => 'edit.php?post_type='.Application::POST_TYPE, |
72 | - ]) |
|
72 | + ] ) |
|
73 | 73 | : glsr( Builder::class )->span( $text, [ |
74 | 74 | 'class' => 'glsr-review-count', |
75 | - ]); |
|
75 | + ] ); |
|
76 | 76 | return $items; |
77 | 77 | } |
78 | 78 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function filterTinymcePlugins( array $plugins ) |
84 | 84 | { |
85 | 85 | if( user_can_richedit() |
86 | - && ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ))) { |
|
86 | + && (current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' )) ) { |
|
87 | 87 | $plugins['glsr_shortcode'] = glsr()->url( 'assets/scripts/mce-plugin.js' ); |
88 | 88 | } |
89 | 89 | return $plugins; |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function registerShortcodeButtons() |
97 | 97 | { |
98 | - $command = new RegisterShortcodeButtons([ |
|
98 | + $command = new RegisterShortcodeButtons( [ |
|
99 | 99 | 'site_reviews' => esc_html__( 'Recent Reviews', 'site-reviews' ), |
100 | 100 | 'site_reviews_form' => esc_html__( 'Submit a Review', 'site-reviews' ), |
101 | 101 | 'site_reviews_summary' => esc_html__( 'Summary of Reviews', 'site-reviews' ), |
102 | - ]); |
|
102 | + ] ); |
|
103 | 103 | $this->execute( $command ); |
104 | 104 | } |
105 | 105 | |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function renderReviewEditor( WP_Post $post ) |
111 | 111 | { |
112 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
112 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return; |
|
113 | 113 | glsr()->render( 'partials/editor/review', [ |
114 | 114 | 'post' => $post, |
115 | - ]); |
|
115 | + ] ); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -121,13 +121,13 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function renderReviewNotice( WP_Post $post ) |
123 | 123 | { |
124 | - if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ))return; |
|
125 | - glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' )); |
|
124 | + if( !$this->isReviewPostType( $post ) || $this->isReviewEditable( $post ) )return; |
|
125 | + glsr( Notice::class )->addWarning( __( 'This review is read-only.', 'site-reviews' ) ); |
|
126 | 126 | glsr( Template::class )->render( 'partials/editor/notice', [ |
127 | 127 | 'context' => [ |
128 | 128 | 'notices' => glsr( Notice::class )->get(), |
129 | 129 | ], |
130 | - ]); |
|
130 | + ] ); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | foreach( glsr()->mceShortcodes as $shortcode => $values ) { |
142 | 142 | $shortcodes[$shortcode] = $values; |
143 | 143 | } |
144 | - if( empty( $shortcodes ))return; |
|
144 | + if( empty($shortcodes) )return; |
|
145 | 145 | glsr()->render( 'partials/editor/tinymce', [ |
146 | 146 | 'shortcodes' => $shortcodes, |
147 | - ]); |
|
147 | + ] ); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | public function routerClearConsole() |
154 | 154 | { |
155 | 155 | glsr( Console::class )->clear(); |
156 | - glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' )); |
|
156 | + glsr( Notice::class )->addSuccess( __( 'Console cleared.', 'site-reviews' ) ); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function routerFetchConsole() |
163 | 163 | { |
164 | - glsr( Notice::class )->addSuccess( __( 'Console reloaded.', 'site-reviews' )); |
|
164 | + glsr( Notice::class )->addSuccess( __( 'Console reloaded.', 'site-reviews' ) ); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -171,20 +171,20 @@ discard block |
||
171 | 171 | public function routerCountReviews( $showNotice = true ) |
172 | 172 | { |
173 | 173 | $countManager = glsr( CountsManager::class ); |
174 | - $terms = get_terms([ |
|
174 | + $terms = get_terms( [ |
|
175 | 175 | 'hide_empty' => true, |
176 | 176 | 'taxonomy' => Application::TAXONOMY, |
177 | - ]); |
|
177 | + ] ); |
|
178 | 178 | foreach( $terms as $term ) { |
179 | - $countManager->setTermCounts( $term->term_id, $countManager->buildTermCounts( $term->term_id )); |
|
179 | + $countManager->setTermCounts( $term->term_id, $countManager->buildTermCounts( $term->term_id ) ); |
|
180 | 180 | } |
181 | 181 | $postIds = glsr( SqlQueries::class )->getReviewsMeta( 'assigned_to' ); |
182 | 182 | foreach( $postIds as $postId ) { |
183 | - $countManager->setPostCounts( $postId, $countManager->buildPostCounts( $postId )); |
|
183 | + $countManager->setPostCounts( $postId, $countManager->buildPostCounts( $postId ) ); |
|
184 | 184 | } |
185 | 185 | $countManager->setCounts( $countManager->buildCounts() ); |
186 | 186 | if( $showNotice ) { |
187 | - glsr( Notice::class )->clear()->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' )); |
|
187 | + glsr( Notice::class )->clear()->addSuccess( __( 'Recalculated rating counts.', 'site-reviews' ) ); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
@@ -219,17 +219,17 @@ discard block |
||
219 | 219 | { |
220 | 220 | $file = $_FILES['import-file']; |
221 | 221 | if( $file['error'] !== UPLOAD_ERR_OK ) { |
222 | - return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] )); |
|
222 | + return glsr( Notice::class )->addError( $this->getUploadError( $file['error'] ) ); |
|
223 | 223 | } |
224 | - if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] )) { |
|
225 | - return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' )); |
|
224 | + if( $file['type'] !== 'application/json' || !glsr( Helper::class )->endsWith( '.json', $file['name'] ) ) { |
|
225 | + return glsr( Notice::class )->addError( __( 'Please use a valid Site Reviews settings file.', 'site-reviews' ) ); |
|
226 | 226 | } |
227 | 227 | $settings = json_decode( file_get_contents( $file['tmp_name'] ), true ); |
228 | - if( empty( $settings )) { |
|
229 | - return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' )); |
|
228 | + if( empty($settings) ) { |
|
229 | + return glsr( Notice::class )->addWarning( __( 'There were no settings found to import.', 'site-reviews' ) ); |
|
230 | 230 | } |
231 | - glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings )); |
|
232 | - glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' )); |
|
231 | + glsr( OptionManager::class )->set( glsr( OptionManager::class )->normalize( $settings ) ); |
|
232 | + glsr( Notice::class )->addSuccess( __( 'Settings imported.', 'site-reviews' ) ); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | /** |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | UPLOAD_ERR_CANT_WRITE => __( 'Failed to write file to disk.', 'site-reviews' ), |
248 | 248 | UPLOAD_ERR_EXTENSION => __( 'A PHP extension stopped the file upload.', 'site-reviews' ), |
249 | 249 | ]; |
250 | - return !isset( $errors[$errorCode] ) |
|
250 | + return !isset($errors[$errorCode]) |
|
251 | 251 | ? __( 'Unknown upload error.', 'site-reviews' ) |
252 | 252 | : $errors[$errorCode]; |
253 | 253 | } |