@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function __call( $name, array $args = [] ) |
27 | 27 | { |
28 | - if( !method_exists( $this, $name ) || !in_array( $name, $this->callable ))return; |
|
28 | + if( !method_exists( $this, $name ) || !in_array( $name, $this->callable ) )return; |
|
29 | 29 | $defaults = call_user_func_array( [$this, $name], $args ); |
30 | 30 | $hookName = (new ReflectionClass( $this ))->getShortName(); |
31 | 31 | $hookName = str_replace( 'Defaults', '', $hookName ); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | protected function filter( array $values = [] ) |
45 | 45 | { |
46 | - return $this->normalize( $this->merge( array_filter( $values )), $values ); |
|
46 | + return $this->normalize( $this->merge( array_filter( $values ) ), $values ); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | protected function filteredJson( array $values = [] ) |
53 | 53 | { |
54 | 54 | $defaults = $this->flattenArray( |
55 | - array_diff_key( $this->defaults(), array_flip( $this->guarded )) |
|
55 | + array_diff_key( $this->defaults(), array_flip( $this->guarded ) ) |
|
56 | 56 | ); |
57 | 57 | $values = $this->flattenArray( |
58 | 58 | shortcode_atts( $defaults, $values ) |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $filtered = array_filter( array_diff_assoc( $values, $defaults ), function( $value ) { |
61 | 61 | return !$this->isEmpty( $value ); |
62 | 62 | }); |
63 | - return json_encode( $filtered, JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_TAG|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE ); |
|
63 | + return json_encode( $filtered, JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | protected function flattenArray( array $values ) |
70 | 70 | { |
71 | 71 | array_walk( $values, function( &$value ) { |
72 | - if( !is_array( $value ))return; |
|
72 | + if( !is_array( $value ) )return; |
|
73 | 73 | $value = implode( ',', $value ); |
74 | 74 | }); |
75 | 75 | return $values; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | protected function isEmpty( $var ) |
83 | 83 | { |
84 | - return !is_numeric( $var ) && !is_bool( $var ) && empty( $var ); |
|
84 | + return !is_numeric( $var ) && !is_bool( $var ) && empty($var); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -25,7 +25,9 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function __call( $name, array $args = [] ) |
27 | 27 | { |
28 | - if( !method_exists( $this, $name ) || !in_array( $name, $this->callable ))return; |
|
28 | + if( !method_exists( $this, $name ) || !in_array( $name, $this->callable )) { |
|
29 | + return; |
|
30 | + } |
|
29 | 31 | $defaults = call_user_func_array( [$this, $name], $args ); |
30 | 32 | $hookName = (new ReflectionClass( $this ))->getShortName(); |
31 | 33 | $hookName = str_replace( 'Defaults', '', $hookName ); |
@@ -69,7 +71,9 @@ discard block |
||
69 | 71 | protected function flattenArray( array $values ) |
70 | 72 | { |
71 | 73 | array_walk( $values, function( &$value ) { |
72 | - if( !is_array( $value ))return; |
|
74 | + if( !is_array( $value )) { |
|
75 | + return; |
|
76 | + } |
|
73 | 77 | $value = implode( ',', $value ); |
74 | 78 | }); |
75 | 79 | return $values; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | 'glsr_star_rating' => 2, |
21 | 21 | ); |
22 | 22 | foreach( $hooks as $function => $acceptedArgs ) { |
23 | - add_filter( $function, function() use( $function ) { |
|
23 | + add_filter( $function, function() use($function) { |
|
24 | 24 | $args = func_get_args(); |
25 | 25 | array_shift( $args ); // remove the fallback value |
26 | 26 | return call_user_func_array( $function, $args ); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | function glsr( $alias = null ) { |
35 | 35 | $app = \GeminiLabs\SiteReviews\Application::load(); |
36 | - return !empty( $alias ) |
|
36 | + return !empty($alias) |
|
37 | 37 | ? $app->make( $alias ) |
38 | 38 | : $app; |
39 | 39 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $result = array(); |
48 | 48 | foreach( $array as $subarray ) { |
49 | 49 | $subarray = (array)$subarray; |
50 | - if( !isset( $subarray[$column] ))continue; |
|
50 | + if( !isset($subarray[$column]) )continue; |
|
51 | 51 | $result[] = $subarray[$column]; |
52 | 52 | } |
53 | 53 | return $result; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | function glsr_calculate_ratings() { |
60 | 60 | glsr( 'Controllers\AdminController' )->routerCountReviews( false ); |
61 | - glsr_log()->notice( __( 'Recalculated rating counts.', 'site-reviews' )); |
|
61 | + glsr_log()->notice( __( 'Recalculated rating counts.', 'site-reviews' ) ); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -75,10 +75,10 @@ discard block |
||
75 | 75 | * @return \WP_Screen|object |
76 | 76 | */ |
77 | 77 | function glsr_current_screen() { |
78 | - if( function_exists( 'get_current_screen' )) { |
|
78 | + if( function_exists( 'get_current_screen' ) ) { |
|
79 | 79 | $screen = get_current_screen(); |
80 | 80 | } |
81 | - return empty( $screen ) |
|
81 | + return empty($screen) |
|
82 | 82 | ? (object)array_fill_keys( ['base', 'id', 'post_type'], null ) |
83 | 83 | : $screen; |
84 | 84 | } |
@@ -135,10 +135,10 @@ discard block |
||
135 | 135 | */ |
136 | 136 | function glsr_get_review( $post_id ) { |
137 | 137 | $post = null; |
138 | - if( is_numeric( $post_id )) { |
|
138 | + if( is_numeric( $post_id ) ) { |
|
139 | 139 | $post = get_post( $post_id ); |
140 | 140 | } |
141 | - if( !( $post instanceof WP_Post )) { |
|
141 | + if( !($post instanceof WP_Post) ) { |
|
142 | 142 | $post = new WP_Post( (object)[] ); |
143 | 143 | } |
144 | 144 | return glsr( 'Database\ReviewManager' )->single( $post ); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @return array |
149 | 149 | */ |
150 | 150 | function glsr_get_reviews( $args = array() ) { |
151 | - return glsr( 'Database\ReviewManager' )->get( glsr( 'Helper' )->consolidateArray( $args )); |
|
151 | + return glsr( 'Database\ReviewManager' )->get( glsr( 'Helper' )->consolidateArray( $args ) ); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | function glsr_log() { |
158 | 158 | $args = func_get_args(); |
159 | 159 | $console = glsr( 'Modules\Console' ); |
160 | - if( $value = glsr_get( $args, '0' )) { |
|
161 | - return $console->log( 'debug', $value, glsr_get( $args, '1', [] )); |
|
160 | + if( $value = glsr_get( $args, '0' ) ) { |
|
161 | + return $console->log( 'debug', $value, glsr_get( $args, '1', [] ) ); |
|
162 | 162 | } |
163 | 163 | return $console; |
164 | 164 | } |
@@ -31,7 +31,8 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * @return mixed |
33 | 33 | */ |
34 | -function glsr( $alias = null ) { |
|
34 | +function glsr( $alias = null ) |
|
35 | +{ |
|
35 | 36 | $app = \GeminiLabs\SiteReviews\Application::load(); |
36 | 37 | return !empty( $alias ) |
37 | 38 | ? $app->make( $alias ) |
@@ -43,11 +44,14 @@ discard block |
||
43 | 44 | * @param $column string |
44 | 45 | * @return array |
45 | 46 | */ |
46 | -function glsr_array_column( array $array, $column ) { |
|
47 | +function glsr_array_column( array $array, $column ) |
|
48 | +{ |
|
47 | 49 | $result = array(); |
48 | 50 | foreach( $array as $subarray ) { |
49 | 51 | $subarray = (array)$subarray; |
50 | - if( !isset( $subarray[$column] ))continue; |
|
52 | + if( !isset( $subarray[$column] )) { |
|
53 | + continue; |
|
54 | + } |
|
51 | 55 | $result[] = $subarray[$column]; |
52 | 56 | } |
53 | 57 | return $result; |
@@ -56,7 +60,8 @@ discard block |
||
56 | 60 | /** |
57 | 61 | * @return void |
58 | 62 | */ |
59 | -function glsr_calculate_ratings() { |
|
63 | +function glsr_calculate_ratings() |
|
64 | +{ |
|
60 | 65 | glsr( 'Controllers\AdminController' )->routerCountReviews( false ); |
61 | 66 | glsr_log()->notice( __( 'Recalculated rating counts.', 'site-reviews' )); |
62 | 67 | } |
@@ -64,7 +69,8 @@ discard block |
||
64 | 69 | /** |
65 | 70 | * @return \GeminiLabs\SiteReviews\Review|false |
66 | 71 | */ |
67 | -function glsr_create_review( $reviewValues = array() ) { |
|
72 | +function glsr_create_review( $reviewValues = array() ) |
|
73 | +{ |
|
68 | 74 | $review = new \GeminiLabs\SiteReviews\Commands\CreateReview( |
69 | 75 | glsr( 'Helper' )->consolidateArray( $reviewValues ) |
70 | 76 | ); |
@@ -74,7 +80,8 @@ discard block |
||
74 | 80 | /** |
75 | 81 | * @return \WP_Screen|object |
76 | 82 | */ |
77 | -function glsr_current_screen() { |
|
83 | +function glsr_current_screen() |
|
84 | +{ |
|
78 | 85 | if( function_exists( 'get_current_screen' )) { |
79 | 86 | $screen = get_current_screen(); |
80 | 87 | } |
@@ -87,7 +94,8 @@ discard block |
||
87 | 94 | * @param mixed ...$vars |
88 | 95 | * @return void |
89 | 96 | */ |
90 | -function glsr_debug( ...$vars ) { |
|
97 | +function glsr_debug( ...$vars ) |
|
98 | +{ |
|
91 | 99 | if( count( $vars ) == 1 ) { |
92 | 100 | $value = htmlspecialchars( print_r( $vars[0], true ), ENT_QUOTES, 'UTF-8' ); |
93 | 101 | printf( '<div class="glsr-debug"><pre>%s</pre></div>', $value ); |
@@ -107,7 +115,8 @@ discard block |
||
107 | 115 | * @param mixed $fallback |
108 | 116 | * @return mixed |
109 | 117 | */ |
110 | -function glsr_get( $array, $path = '', $fallback = '' ) { |
|
118 | +function glsr_get( $array, $path = '', $fallback = '' ) |
|
119 | +{ |
|
111 | 120 | return glsr( 'Helper' )->dataGet( $array, $path, $fallback ); |
112 | 121 | } |
113 | 122 | |
@@ -116,7 +125,8 @@ discard block |
||
116 | 125 | * @param mixed $fallback |
117 | 126 | * @return string|array |
118 | 127 | */ |
119 | -function glsr_get_option( $path = '', $fallback = '' ) { |
|
128 | +function glsr_get_option( $path = '', $fallback = '' ) |
|
129 | +{ |
|
120 | 130 | return is_string( $path ) |
121 | 131 | ? glsr( 'Database\OptionManager' )->get( 'settings.'.$path, $fallback ) |
122 | 132 | : $fallback; |
@@ -125,7 +135,8 @@ discard block |
||
125 | 135 | /** |
126 | 136 | * @return array |
127 | 137 | */ |
128 | -function glsr_get_options() { |
|
138 | +function glsr_get_options() |
|
139 | +{ |
|
129 | 140 | return glsr( 'Database\OptionManager' )->get( 'settings' ); |
130 | 141 | } |
131 | 142 | |
@@ -133,7 +144,8 @@ discard block |
||
133 | 144 | * @param int $post_id |
134 | 145 | * @return \GeminiLabs\SiteReviews\Review |
135 | 146 | */ |
136 | -function glsr_get_review( $post_id ) { |
|
147 | +function glsr_get_review( $post_id ) |
|
148 | +{ |
|
137 | 149 | $post = null; |
138 | 150 | if( is_numeric( $post_id )) { |
139 | 151 | $post = get_post( $post_id ); |
@@ -147,14 +159,16 @@ discard block |
||
147 | 159 | /** |
148 | 160 | * @return array |
149 | 161 | */ |
150 | -function glsr_get_reviews( $args = array() ) { |
|
162 | +function glsr_get_reviews( $args = array() ) |
|
163 | +{ |
|
151 | 164 | return glsr( 'Database\ReviewManager' )->get( glsr( 'Helper' )->consolidateArray( $args )); |
152 | 165 | } |
153 | 166 | |
154 | 167 | /** |
155 | 168 | * @return \GeminiLabs\SiteReviews\Modules\Console |
156 | 169 | */ |
157 | -function glsr_log() { |
|
170 | +function glsr_log() |
|
171 | +{ |
|
158 | 172 | $args = func_get_args(); |
159 | 173 | $console = glsr( 'Modules\Console' ); |
160 | 174 | if( $value = glsr_get( $args, '0' )) { |
@@ -166,6 +180,7 @@ discard block |
||
166 | 180 | /** |
167 | 181 | * @return string |
168 | 182 | */ |
169 | -function glsr_star_rating( $rating ) { |
|
183 | +function glsr_star_rating( $rating ) |
|
184 | +{ |
|
170 | 185 | return glsr( 'Modules\Html\Partial' )->build( 'star-rating', ['rating' => $rating] ); |
171 | 186 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function routerChangeStatus( array $request ) |
25 | 25 | { |
26 | - wp_send_json_success( $this->execute( new ChangeStatus( $request ))); |
|
26 | + wp_send_json_success( $this->execute( new ChangeStatus( $request ) ) ); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | public function routerClearConsole() |
33 | 33 | { |
34 | 34 | glsr( AdminController::class )->routerClearConsole(); |
35 | - wp_send_json_success([ |
|
35 | + wp_send_json_success( [ |
|
36 | 36 | 'console' => glsr( Console::class )->get(), |
37 | 37 | 'notices' => glsr( Notice::class )->get(), |
38 | - ]); |
|
38 | + ] ); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | public function routerCountReviews() |
45 | 45 | { |
46 | 46 | glsr( AdminController::class )->routerCountReviews(); |
47 | - wp_send_json_success([ |
|
47 | + wp_send_json_success( [ |
|
48 | 48 | 'notices' => glsr( Notice::class )->get(), |
49 | - ]); |
|
49 | + ] ); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | { |
57 | 57 | $shortcode = $request['shortcode']; |
58 | 58 | $response = false; |
59 | - if( array_key_exists( $shortcode, glsr()->mceShortcodes )) { |
|
59 | + if( array_key_exists( $shortcode, glsr()->mceShortcodes ) ) { |
|
60 | 60 | $data = glsr()->mceShortcodes[$shortcode]; |
61 | - if( !empty( $data['errors'] )) { |
|
61 | + if( !empty($data['errors']) ) { |
|
62 | 62 | $data['btn_okay'] = [esc_html__( 'Okay', 'site-reviews' )]; |
63 | 63 | } |
64 | 64 | $response = [ |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | public function routerFetchConsole() |
79 | 79 | { |
80 | 80 | glsr( AdminController::class )->routerFetchConsole(); |
81 | - wp_send_json_success([ |
|
81 | + wp_send_json_success( [ |
|
82 | 82 | 'console' => glsr( Console::class )->get(), |
83 | 83 | 'notices' => glsr( Notice::class )->get(), |
84 | - ]); |
|
84 | + ] ); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | public function routerSearchPosts( array $request ) |
91 | 91 | { |
92 | 92 | $results = glsr( Database::class )->searchPosts( $request['search'] ); |
93 | - wp_send_json_success([ |
|
93 | + wp_send_json_success( [ |
|
94 | 94 | 'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>', |
95 | 95 | 'items' => $results, |
96 | - ]); |
|
96 | + ] ); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function routerSearchTranslations( array $request ) |
103 | 103 | { |
104 | - if( empty( $request['exclude'] )) { |
|
104 | + if( empty($request['exclude']) ) { |
|
105 | 105 | $request['exclude'] = []; |
106 | 106 | } |
107 | 107 | $results = glsr( Translation::class ) |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | ->exclude() |
110 | 110 | ->exclude( $request['exclude'] ) |
111 | 111 | ->renderResults(); |
112 | - wp_send_json_success([ |
|
112 | + wp_send_json_success( [ |
|
113 | 113 | 'empty' => '<div>'.__( 'Nothing found.', 'site-reviews' ).'</div>', |
114 | 114 | 'items' => $results, |
115 | - ]); |
|
115 | + ] ); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | public function routerSubmitReview( array $request ) |
122 | 122 | { |
123 | 123 | $command = glsr( PublicController::class )->routerSubmitReview( $request ); |
124 | - $redirect = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ))); |
|
124 | + $redirect = trim( strval( get_post_meta( $command->post_id, 'redirect_to', true ) ) ); |
|
125 | 125 | $redirect = apply_filters( 'site-reviews/review/redirect', $redirect, $command ); |
126 | 126 | $data = [ |
127 | 127 | 'errors' => glsr( Session::class )->get( $command->form_id.'errors', false, true ), |
@@ -145,16 +145,16 @@ discard block |
||
145 | 145 | parse_str( parse_url( glsr_get( $request, 'url' ), PHP_URL_QUERY ), $urlQuery ); |
146 | 146 | $args = [ |
147 | 147 | 'paged' => glsr_get( $urlQuery, glsr()->constant( 'PAGED_QUERY_VAR' ), 1 ), |
148 | - 'pagedUrl' => home_url( parse_url( glsr_get( $request, 'url' ), PHP_URL_PATH )), |
|
148 | + 'pagedUrl' => home_url( parse_url( glsr_get( $request, 'url' ), PHP_URL_PATH ) ), |
|
149 | 149 | 'pagination' => 'ajax', |
150 | 150 | 'schema' => false, |
151 | 151 | ]; |
152 | - $atts = (array) json_decode( glsr_get( $request, 'atts' )); |
|
153 | - $html = glsr( SiteReviews::class )->build( wp_parse_args( $args, $atts )); |
|
154 | - return wp_send_json_success([ |
|
152 | + $atts = (array)json_decode( glsr_get( $request, 'atts' ) ); |
|
153 | + $html = glsr( SiteReviews::class )->build( wp_parse_args( $args, $atts ) ); |
|
154 | + return wp_send_json_success( [ |
|
155 | 155 | 'pagination' => $html->getPagination(), |
156 | 156 | 'reviews' => $html->getReviews(), |
157 | - ]); |
|
157 | + ] ); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function routerTogglePinned( array $request ) |
164 | 164 | { |
165 | - $isPinned = $this->execute( new TogglePinned( $request )); |
|
166 | - wp_send_json_success([ |
|
165 | + $isPinned = $this->execute( new TogglePinned( $request ) ); |
|
166 | + wp_send_json_success( [ |
|
167 | 167 | 'notices' => glsr( Notice::class )->get(), |
168 | 168 | 'pinned' => $isPinned, |
169 | - ]); |
|
169 | + ] ); |
|
170 | 170 | } |
171 | 171 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $this->args = $args; |
30 | 30 | $this->max_num_pages = $maxPageCount; |
31 | 31 | $this->reviews = $reviews; |
32 | - parent::__construct( $reviews, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS ); |
|
32 | + parent::__construct( $reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS ); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @return mixed |
55 | 55 | */ |
56 | 56 | public function offsetGet( $key ) { |
57 | - if( property_exists( $this, $key )) { |
|
57 | + if( property_exists( $this, $key ) ) { |
|
58 | 58 | return $this->key; |
59 | 59 | } |
60 | 60 | return array_key_exists( $key, $this->reviews ) |
@@ -53,7 +53,8 @@ |
||
53 | 53 | * @param mixed $key |
54 | 54 | * @return mixed |
55 | 55 | */ |
56 | - public function offsetGet( $key ) { |
|
56 | + public function offsetGet( $key ) |
|
57 | + { |
|
57 | 58 | if( property_exists( $this, $key )) { |
58 | 59 | return $this->key; |
59 | 60 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $this->max_num_pages = $maxPageCount; |
37 | 37 | $this->reviews = $reviews; |
38 | 38 | $this->pagination = $this->buildPagination(); |
39 | - parent::__construct( $reviews, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS ); |
|
39 | + parent::__construct( $reviews, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS ); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | 'pagination' => $this->getPagination(), |
55 | 55 | 'reviews' => $this->getReviews(), |
56 | 56 | ], |
57 | - ]); |
|
57 | + ] ); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function getReviews() |
74 | 74 | { |
75 | - $html = empty( $this->reviews ) |
|
75 | + $html = empty($this->reviews) |
|
76 | 76 | ? $this->getReviewsFallback() |
77 | 77 | : implode( PHP_EOL, $this->reviews ); |
78 | 78 | $wrapper = '<div class="glsr-reviews">%s</div>'; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | glsr()->deprecated[] = 'The $reviewsHtml->navigation property has been been deprecated. Please use the $reviewsHtml->pagination property instead.'; |
90 | 90 | return $this->pagination; |
91 | 91 | } |
92 | - if( property_exists( $this, $key )) { |
|
92 | + if( property_exists( $this, $key ) ) { |
|
93 | 93 | return $this->$key; |
94 | 94 | } |
95 | 95 | return array_key_exists( $key, $this->reviews ) |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | 'baseUrl' => glsr_get( $this->args, 'pagedUrl' ), |
107 | 107 | 'current' => glsr_get( $this->args, 'paged' ), |
108 | 108 | 'total' => $this->max_num_pages, |
109 | - ]); |
|
110 | - $html.= sprintf( '<glsr-pagination hidden data-atts=\'%s\'></glsr-pagination>', $this->args['json'] ); |
|
109 | + ] ); |
|
110 | + $html .= sprintf( '<glsr-pagination hidden data-atts=\'%s\'></glsr-pagination>', $this->args['json'] ); |
|
111 | 111 | $wrapper = '<div class="glsr-pagination">%s</div>'; |
112 | 112 | $wrapper = apply_filters( 'site-reviews/reviews/pagination-wrapper', $wrapper ); |
113 | 113 | return sprintf( $wrapper, $html ); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $defaults[] = 'glsr-ajax-pagination'; |
126 | 126 | } |
127 | 127 | $classes = explode( ' ', $this->args['class'] ); |
128 | - $classes = array_unique( array_merge( $defaults, array_filter( $classes ))); |
|
128 | + $classes = array_unique( array_merge( $defaults, array_filter( $classes ) ) ); |
|
129 | 129 | return implode( ' ', $classes ); |
130 | 130 | } |
131 | 131 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | protected function getReviewsFallback() |
136 | 136 | { |
137 | - if( empty( $this->args['fallback'] ) && glsr( OptionManager::class )->getBool( 'settings.reviews.fallback' )) { |
|
137 | + if( empty($this->args['fallback']) && glsr( OptionManager::class )->getBool( 'settings.reviews.fallback' ) ) { |
|
138 | 138 | $this->args['fallback'] = __( 'There are no reviews yet. Be the first one to write one.', 'site-reviews' ); |
139 | 139 | } |
140 | 140 | $fallback = '<p class="glsr-no-margins">'.$this->args['fallback'].'</p>'; |
@@ -84,7 +84,8 @@ |
||
84 | 84 | * @param mixed $key |
85 | 85 | * @return mixed |
86 | 86 | */ |
87 | - public function offsetGet( $key ) { |
|
87 | + public function offsetGet( $key ) |
|
88 | + { |
|
88 | 89 | if( $key == 'navigation' ) { |
89 | 90 | glsr()->deprecated[] = 'The $reviewsHtml->navigation property has been been deprecated. Please use the $reviewsHtml->pagination property instead.'; |
90 | 91 | return $this->pagination; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | { |
23 | 23 | $this->review = $review; |
24 | 24 | $this->values = $values; |
25 | - parent::__construct( $values, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS ); |
|
25 | + parent::__construct( $values, ArrayObject::STD_PROP_LIST | ArrayObject::ARRAY_AS_PROPS ); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function __toString() |
32 | 32 | { |
33 | - if( empty( $this->values ))return; |
|
33 | + if( empty($this->values) )return; |
|
34 | 34 | return glsr( Template::class )->build( 'templates/review', [ |
35 | 35 | 'context' => $this->values, |
36 | 36 | 'review' => $this->review, |
37 | - ]); |
|
37 | + ] ); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @return mixed |
43 | 43 | */ |
44 | 44 | public function offsetGet( $key ) { |
45 | - if( property_exists( $this, $key )) { |
|
45 | + if( property_exists( $this, $key ) ) { |
|
46 | 46 | return $this->$key; |
47 | 47 | } |
48 | 48 | return array_key_exists( $key, $this->values ) |
@@ -30,7 +30,9 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function __toString() |
32 | 32 | { |
33 | - if( empty( $this->values ))return; |
|
33 | + if( empty( $this->values )) { |
|
34 | + return; |
|
35 | + } |
|
34 | 36 | return glsr( Template::class )->build( 'templates/review', [ |
35 | 37 | 'context' => $this->values, |
36 | 38 | 'review' => $this->review, |
@@ -41,7 +43,8 @@ discard block |
||
41 | 43 | * @param mixed $key |
42 | 44 | * @return mixed |
43 | 45 | */ |
44 | - public function offsetGet( $key ) { |
|
46 | + public function offsetGet( $key ) |
|
47 | + { |
|
45 | 48 | if( property_exists( $this, $key )) { |
46 | 49 | return $this->$key; |
47 | 50 | } |