@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function build( array $args = [] ) |
70 | 70 | { |
71 | - if( empty( $this->ID )) { |
|
71 | + if( empty($this->ID) ) { |
|
72 | 72 | return new ReviewHtml; |
73 | 73 | } |
74 | 74 | $partial = glsr( SiteReviewsPartial::class ); |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function offsetGet( $key ) |
94 | 94 | { |
95 | - if( property_exists( $this, $key )) { |
|
95 | + if( property_exists( $this, $key ) ) { |
|
96 | 96 | return $this->$key; |
97 | 97 | } |
98 | - if( array_key_exists( $key, (array)$this->custom )) { |
|
98 | + if( array_key_exists( $key, (array)$this->custom ) ) { |
|
99 | 99 | return $this->custom[$key]; |
100 | 100 | } |
101 | 101 | return null; |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function offsetSet( $key, $value ) |
110 | 110 | { |
111 | - if( property_exists( $this, $key )) { |
|
111 | + if( property_exists( $this, $key ) ) { |
|
112 | 112 | $this->$key = $value; |
113 | 113 | return; |
114 | 114 | } |
115 | - if( !is_array( $this->custom )) { |
|
115 | + if( !is_array( $this->custom ) ) { |
|
116 | 116 | $this->custom = array_filter( (array)$this->custom ); |
117 | 117 | } |
118 | 118 | $this->custom[$key] = $value; |
@@ -157,13 +157,13 @@ discard block |
||
157 | 157 | 'review_type' => 'local', |
158 | 158 | ]; |
159 | 159 | $meta = array_filter( |
160 | - array_map( 'array_shift', array_filter((array)get_post_meta( $post->ID ))), |
|
160 | + array_map( 'array_shift', array_filter( (array)get_post_meta( $post->ID ) ) ), |
|
161 | 161 | 'strlen' |
162 | 162 | ); |
163 | - $properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta )); |
|
163 | + $properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ) ); |
|
164 | 164 | $this->modified = $this->isModified( $properties ); |
165 | 165 | array_walk( $properties, function( $value, $key ) { |
166 | - if( !property_exists( $this, $key ) || isset( $this->$key ))return; |
|
166 | + if( !property_exists( $this, $key ) || isset($this->$key) )return; |
|
167 | 167 | $this->$key = maybe_unserialize( $value ); |
168 | 168 | }); |
169 | 169 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | protected function setTermIds( WP_Post $post ) |
175 | 175 | { |
176 | 176 | $this->term_ids = []; |
177 | - if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return; |
|
177 | + if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ) ) )return; |
|
178 | 178 | foreach( $terms as $term ) { |
179 | 179 | $this->term_ids[] = $term->term_id; |
180 | 180 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function routerChangeStatus( array $request ) |
24 | 24 | { |
25 | - wp_send_json_success( $this->execute( new ChangeStatus( $request ))); |
|
25 | + wp_send_json_success( $this->execute( new ChangeStatus( $request ) ) ); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | public function routerClearConsole() |
32 | 32 | { |
33 | 33 | glsr( AdminController::class )->routerClearConsole(); |
34 | - wp_send_json_success([ |
|
34 | + wp_send_json_success( [ |
|
35 | 35 | 'console' => glsr( Console::class )->get(), |
36 | 36 | 'notices' => glsr( Notice::class )->get(), |
37 | - ]); |
|
37 | + ] ); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | public function routerCountReviews() |
44 | 44 | { |
45 | 45 | glsr( AdminController::class )->routerCountReviews(); |
46 | - wp_send_json_success([ |
|
46 | + wp_send_json_success( [ |
|
47 | 47 | 'notices' => glsr( Notice::class )->get(), |
48 | - ]); |
|
48 | + ] ); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | { |
56 | 56 | $shortcode = $request['shortcode']; |
57 | 57 | $response = false; |
58 | - if( array_key_exists( $shortcode, glsr()->mceShortcodes )) { |
|
58 | + if( array_key_exists( $shortcode, glsr()->mceShortcodes ) ) { |
|
59 | 59 | $data = glsr()->mceShortcodes[$shortcode]; |
60 | - if( !empty( $data['errors'] )) { |
|
60 | + if( !empty($data['errors']) ) { |
|
61 | 61 | $data['btn_okay'] = [esc_html__( 'Okay', 'site-reviews' )]; |
62 | 62 | } |
63 | 63 | $response = [ |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | public function routerFetchConsole() |
78 | 78 | { |
79 | 79 | glsr( AdminController::class )->routerFetchConsole(); |
80 | - wp_send_json_success([ |
|
80 | + wp_send_json_success( [ |
|
81 | 81 | 'console' => glsr( Console::class )->get(), |
82 | 82 | 'notices' => glsr( Notice::class )->get(), |
83 | - ]); |
|
83 | + ] ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | public function routerSearchPosts( array $request ) |
90 | 90 | { |
91 | 91 | $results = glsr( Database::class )->searchPosts( $request['search'] ); |
92 | - wp_send_json_success([ |
|
92 | + wp_send_json_success( [ |
|
93 | 93 | 'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>', |
94 | 94 | 'items' => $results, |
95 | - ]); |
|
95 | + ] ); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function routerSearchTranslations( array $request ) |
102 | 102 | { |
103 | - if( empty( $request['exclude'] )) { |
|
103 | + if( empty($request['exclude']) ) { |
|
104 | 104 | $request['exclude'] = []; |
105 | 105 | } |
106 | 106 | $results = glsr( Translation::class ) |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | ->exclude() |
109 | 109 | ->exclude( $request['exclude'] ) |
110 | 110 | ->renderResults(); |
111 | - wp_send_json_success([ |
|
111 | + wp_send_json_success( [ |
|
112 | 112 | 'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>', |
113 | 113 | 'items' => $results, |
114 | - ]); |
|
114 | + ] ); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | public function routerSubmitReview( array $request ) |
121 | 121 | { |
122 | 122 | $command = glsr( PublicController::class )->routerSubmitReview( $request ); |
123 | - $redirect = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ))); |
|
123 | + $redirect = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) ); |
|
124 | 124 | $redirect = apply_filters( 'site-reviews/review/redirect', $redirect, $command ); |
125 | 125 | $data = [ |
126 | 126 | 'errors' => glsr( Session::class )->get( $command->form_id.'errors', false, true ), |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function routerTogglePinned( array $request ) |
142 | 142 | { |
143 | - $isPinned = $this->execute( new TogglePinned( $request )); |
|
144 | - wp_send_json_success([ |
|
143 | + $isPinned = $this->execute( new TogglePinned( $request ) ); |
|
144 | + wp_send_json_success( [ |
|
145 | 145 | 'notices' => glsr( Notice::class )->get(), |
146 | 146 | 'pinned' => $isPinned, |
147 | - ]); |
|
147 | + ] ); |
|
148 | 148 | } |
149 | 149 | } |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | public function filterEnqueuedScripts( $tag, $handle ) |
34 | 34 | { |
35 | 35 | $scripts = [Application::ID.'/google-recaptcha']; |
36 | - if( in_array( $handle, apply_filters( 'site-reviews/async-scripts', $scripts ))) { |
|
36 | + if( in_array( $handle, apply_filters( 'site-reviews/async-scripts', $scripts ) ) ) { |
|
37 | 37 | $tag = str_replace( ' src=', ' async src=', $tag ); |
38 | 38 | } |
39 | - if( in_array( $handle, apply_filters( 'site-reviews/defer-scripts', $scripts ))) { |
|
39 | + if( in_array( $handle, apply_filters( 'site-reviews/defer-scripts', $scripts ) ) ) { |
|
40 | 40 | $tag = str_replace( ' src=', ' defer src=', $tag ); |
41 | 41 | } |
42 | 42 | return $tag; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function filterFieldOrder( array $config ) |
51 | 51 | { |
52 | - $order = (array)apply_filters( 'site-reviews/submission-form/order', array_keys( $config )); |
|
52 | + $order = (array)apply_filters( 'site-reviews/submission-form/order', array_keys( $config ) ); |
|
53 | 53 | return array_intersect_key( array_merge( array_flip( $order ), $config ), $config ); |
54 | 54 | } |
55 | 55 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | { |
101 | 101 | $validated = glsr( ValidateReview::class )->validate( $request ); |
102 | 102 | $command = new CreateReview( $validated->request ); |
103 | - if( empty( $validated->error ) && !$validated->recaptchaIsUnset ) { |
|
103 | + if( empty($validated->error) && !$validated->recaptchaIsUnset ) { |
|
104 | 104 | $this->execute( $command ); |
105 | 105 | } |
106 | 106 | return $command; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | if( $assignedPost instanceof WP_Post && $assignedPost->post_status == 'publish' ) { |
22 | 22 | $column = glsr( Builder::class )->a( get_the_title( $assignedPost->ID ), [ |
23 | 23 | 'href' => (string)get_the_permalink( $assignedPost->ID ), |
24 | - ]); |
|
24 | + ] ); |
|
25 | 25 | } |
26 | 26 | return $column; |
27 | 27 | } |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | $pinned = get_post_meta( $postId, 'pinned', true ) |
36 | 36 | ? 'pinned ' |
37 | 37 | : ''; |
38 | - return glsr( Builder::class )->i([ |
|
38 | + return glsr( Builder::class )->i( [ |
|
39 | 39 | 'class' => $pinned.'dashicons dashicons-sticky', |
40 | 40 | 'data-id' => $postId, |
41 | - ]); |
|
41 | + ] ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function buildColumnReviewer( $postId ) |
49 | 49 | { |
50 | - return strval( get_post_meta( $postId, 'author', true )); |
|
50 | + return strval( get_post_meta( $postId, 'author', true ) ); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function buildColumnRating( $postId ) |
59 | 59 | { |
60 | - return glsr_star_rating( intval( get_post_meta( $postId, 'rating', true ))); |
|
60 | + return glsr_star_rating( intval( get_post_meta( $postId, 'rating', true ) ) ); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public function renderFilters( $postType ) |
80 | 80 | { |
81 | 81 | if( $postType !== Application::POST_TYPE )return; |
82 | - if( !( $status = filter_input( INPUT_GET, 'post_status' ))) { |
|
82 | + if( !($status = filter_input( INPUT_GET, 'post_status' )) ) { |
|
83 | 83 | $status = 'publish'; |
84 | 84 | } |
85 | 85 | $ratings = glsr( Database::class )->getReviewsMeta( 'rating', $status ); |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | */ |
109 | 109 | protected function renderFilterRatings( $ratings ) |
110 | 110 | { |
111 | - if( empty( $ratings ))return; |
|
112 | - $ratings = array_flip( array_reverse( $ratings )); |
|
111 | + if( empty($ratings) )return; |
|
112 | + $ratings = array_flip( array_reverse( $ratings ) ); |
|
113 | 113 | array_walk( $ratings, function( &$value, $key ) { |
114 | 114 | $label = _n( '%s star', '%s stars', $key, 'site-reviews' ); |
115 | 115 | $value = sprintf( $label, $key ); |
@@ -117,12 +117,12 @@ discard block |
||
117 | 117 | echo glsr( Builder::class )->label( __( 'Filter by rating', 'site-reviews' ), [ |
118 | 118 | 'class' => 'screen-reader-text', |
119 | 119 | 'for' => 'rating', |
120 | - ]); |
|
121 | - echo glsr( Builder::class )->select([ |
|
120 | + ] ); |
|
121 | + echo glsr( Builder::class )->select( [ |
|
122 | 122 | 'name' => 'rating', |
123 | 123 | 'options' => ['' => __( 'All ratings', 'site-reviews' )] + $ratings, |
124 | 124 | 'value' => filter_input( INPUT_GET, 'rating' ), |
125 | - ]); |
|
125 | + ] ); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | echo glsr( Builder::class )->label( __( 'Filter by type', 'site-reviews' ), [ |
136 | 136 | 'class' => 'screen-reader-text', |
137 | 137 | 'for' => 'review_type', |
138 | - ]); |
|
139 | - echo glsr( Builder::class )->select([ |
|
138 | + ] ); |
|
139 | + echo glsr( Builder::class )->select( [ |
|
140 | 140 | 'name' => 'review_type', |
141 | 141 | 'options' => ['' => __( 'All types', 'site-reviews' )] + glsr()->reviewTypes, |
142 | 142 | 'value' => filter_input( INPUT_GET, 'review_type' ), |
143 | - ]); |
|
143 | + ] ); |
|
144 | 144 | } |
145 | 145 | } |
@@ -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' => __( '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' => __( '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' => __( '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' => [ |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | 'tooltip' => __( 'When using pagination this shortcode can only be used once on a page. (default: disable)', 'site-reviews' ), |
54 | 54 | 'type' => 'listbox', |
55 | 55 | ], |
56 | - $this->getTypes( __( 'Which type of review would you like to display?', 'site-reviews' )), |
|
57 | - $this->getCategories( __( 'Limit reviews to this category.', 'site-reviews' )), |
|
56 | + $this->getTypes( __( 'Which type of review would you like to display?', 'site-reviews' ) ), |
|
57 | + $this->getCategories( __( 'Limit reviews to this category.', 'site-reviews' ) ), |
|
58 | 58 | [ |
59 | 59 | 'label' => esc_html__( 'Assigned To', 'site-reviews' ), |
60 | 60 | 'name' => 'assigned_to', |
61 | 61 | 'tooltip' => __( '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, or "parent_id" to use the ID of the parent 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,19 +69,19 @@ discard block |
||
69 | 69 | ], |
70 | 70 | 'tooltip' => __( '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' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ), |
76 | 76 | 'type' => 'textbox', |
77 | - ],[ |
|
77 | + ], [ |
|
78 | 78 | 'columns' => 2, |
79 | 79 | 'items' => $this->getHideOptions(), |
80 | 80 | 'label' => esc_html__( 'Hide', 'site-reviews' ), |
81 | 81 | 'layout' => 'grid', |
82 | 82 | 'spacing' => 5, |
83 | 83 | 'type' => 'container', |
84 | - ],[ |
|
84 | + ], [ |
|
85 | 85 | 'hidden' => true, |
86 | 86 | 'name' => 'id', |
87 | 87 | 'type' => 'textbox', |
@@ -12,23 +12,23 @@ discard block |
||
12 | 12 | public function fields() |
13 | 13 | { |
14 | 14 | return [[ |
15 | - 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' )), |
|
15 | + 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'All settings are optional.', 'site-reviews' ) ), |
|
16 | 16 | 'minWidth' => 320, |
17 | 17 | 'type' => 'container', |
18 | - ],[ |
|
18 | + ], [ |
|
19 | 19 | 'label' => esc_html__( 'Title', 'site-reviews' ), |
20 | 20 | 'name' => 'title', |
21 | 21 | 'tooltip' => __( 'Enter a custom shortcode heading.', 'site-reviews' ), |
22 | 22 | 'type' => 'textbox', |
23 | 23 | ], |
24 | - $this->getTypes( __( 'Which type of review would you like to use?', 'site-reviews' )), |
|
25 | - $this->getCategories( __( 'Limit reviews to this category.', 'site-reviews' )), |
|
24 | + $this->getTypes( __( 'Which type of review would you like to use?', 'site-reviews' ) ), |
|
25 | + $this->getCategories( __( 'Limit reviews to this category.', 'site-reviews' ) ), |
|
26 | 26 | [ |
27 | 27 | 'label' => esc_html__( 'Assigned To', 'site-reviews' ), |
28 | 28 | 'name' => 'assigned_to', |
29 | 29 | 'tooltip' => __( '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, or "parent_id" to use the ID of the parent page.', 'site-reviews' ), |
30 | 30 | 'type' => 'textbox', |
31 | - ],[ |
|
31 | + ], [ |
|
32 | 32 | 'label' => esc_html__( 'Schema', 'site-reviews' ), |
33 | 33 | 'name' => 'schema', |
34 | 34 | 'options' => [ |
@@ -37,12 +37,12 @@ discard block |
||
37 | 37 | ], |
38 | 38 | 'tooltip' => __( 'Rich snippets are disabled by default.', 'site-reviews' ), |
39 | 39 | 'type' => 'listbox', |
40 | - ],[ |
|
40 | + ], [ |
|
41 | 41 | 'label' => esc_html__( 'Classes', 'site-reviews' ), |
42 | 42 | 'name' => 'class', |
43 | 43 | 'tooltip' => __( 'Add custom CSS classes to the shortcode.', 'site-reviews' ), |
44 | 44 | 'type' => 'textbox', |
45 | - ],[ |
|
45 | + ], [ |
|
46 | 46 | 'columns' => 2, |
47 | 47 | 'items' => $this->getHideOptions(), |
48 | 48 | 'label' => esc_html__( 'Hide', 'site-reviews' ), |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | 'after_widget' => '</div>', |
24 | 24 | 'before_title' => '<h3 class="glsr-'.$type.'-title">', |
25 | 25 | 'after_title' => '</h3>', |
26 | - ]); |
|
26 | + ] ); |
|
27 | 27 | $args = apply_filters( 'site-reviews/shortcode/args', $args, $type, $shortcodePartial ); |
28 | 28 | $instance = $this->normalize( $instance ); |
29 | 29 | $partial = glsr( Partial::class )->build( $shortcodePartial, $instance ); |
30 | - if( !empty( $instance['title'] )) { |
|
30 | + if( !empty($instance['title']) ) { |
|
31 | 31 | $instance['title'] = $args['before_title'].$instance['title'].$args['after_title']; |
32 | 32 | } |
33 | 33 | return $args['before_widget'].$instance['title'].$partial.$args['after_widget']; |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function normalize( $args ) |
92 | 92 | { |
93 | - $args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args )); |
|
93 | + $args = shortcode_atts( $this->getDefaults(), wp_parse_args( $args ) ); |
|
94 | 94 | array_walk( $args, function( &$value, $key ) { |
95 | 95 | $methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' ); |
96 | - if( !method_exists( $this, $methodName ))return; |
|
96 | + if( !method_exists( $this, $methodName ) )return; |
|
97 | 97 | $value = $this->$methodName( $value ); |
98 | 98 | }); |
99 | 99 | return $this->sanitize( $args ); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | protected function normalizeAssignedTo( $postId ) |
112 | 112 | { |
113 | 113 | if( $postId == 'parent_id' ) { |
114 | - $postId = intval( wp_get_post_parent_id( intval( get_the_ID() ))); |
|
114 | + $postId = intval( wp_get_post_parent_id( intval( get_the_ID() ) ) ); |
|
115 | 115 | } |
116 | 116 | else if( $postId == 'post_id' ) { |
117 | 117 | $postId = intval( get_the_ID() ); |
@@ -134,11 +134,11 @@ discard block |
||
134 | 134 | */ |
135 | 135 | protected function normalizeHide( $hide ) |
136 | 136 | { |
137 | - if( is_string( $hide )) { |
|
137 | + if( is_string( $hide ) ) { |
|
138 | 138 | $hide = explode( ',', $hide ); |
139 | 139 | } |
140 | 140 | $hideKeys = array_keys( $this->getHideOptions() ); |
141 | - return array_filter( array_map( 'trim', $hide ), function( $value ) use( $hideKeys ) { |
|
141 | + return array_filter( array_map( 'trim', $hide ), function( $value ) use($hideKeys) { |
|
142 | 142 | return in_array( $value, $hideKeys ); |
143 | 143 | }); |
144 | 144 | } |
@@ -166,9 +166,9 @@ discard block |
||
166 | 166 | __( 'Terrible', 'site-reviews' ), |
167 | 167 | ]; |
168 | 168 | $defaults = array_pad( $defaults, Rating::MAX_RATING, '' ); |
169 | - $labels = array_map( 'trim', explode( ',', $labels )); |
|
169 | + $labels = array_map( 'trim', explode( ',', $labels ) ); |
|
170 | 170 | foreach( $defaults as $i => $label ) { |
171 | - if( empty( $labels[$i] ))continue; |
|
171 | + if( empty($labels[$i]) )continue; |
|
172 | 172 | $defaults[$i] = $labels[$i]; |
173 | 173 | } |
174 | 174 | return array_combine( range( Rating::MAX_RATING, 1 ), $defaults ); |
@@ -73,7 +73,7 @@ |
||
73 | 73 | $this->filterShortcodeClass(); |
74 | 74 | $this->filterShowMoreLinks( 'content' ); |
75 | 75 | $this->filterShowMoreLinks( 'response' ); |
76 | - if( !$this->hasVisibleFields( $shortcode, $attributes )) { |
|
76 | + if( !$this->hasVisibleFields( $shortcode, $attributes ) ) { |
|
77 | 77 | $this->filterInterpolation(); |
78 | 78 | } |
79 | 79 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $this->filterRatingField(); |
49 | 49 | $this->filterShortcodeClass(); |
50 | 50 | $this->filterSubmitButton(); |
51 | - if( !$this->hasVisibleFields( $shortcode, $attributes )) { |
|
51 | + if( !$this->hasVisibleFields( $shortcode, $attributes ) ) { |
|
52 | 52 | $this->filterInterpolation(); |
53 | 53 | } |
54 | 54 | } |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | add_filter( 'site-reviews/rendered/field', function( $html, $type, $args ) { |
92 | 92 | if( $args['path'] == 'rating' ) { |
93 | 93 | $stars = '<span class="glsr-stars">'; |
94 | - $stars.= str_repeat( '<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', 5 ); |
|
95 | - $stars.= '</span>'; |
|
94 | + $stars .= str_repeat( '<span class="glsr-star glsr-star-empty" aria-hidden="true"></span>', 5 ); |
|
95 | + $stars .= '</span>'; |
|
96 | 96 | $html = preg_replace( '/(.*)(<select.*)(<\/select>)(.*)/', '$1'.$stars.'$4', $html ); |
97 | 97 | } |
98 | 98 | return $html; |