@@ -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 | } |
@@ -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( $this ); |
73 | 73 | } |
74 | 74 | $partial = glsr( SiteReviewsPartial::class ); |
@@ -92,7 +92,7 @@ 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 | 98 | return array_key_exists( $key, (array)$this->custom ) |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function offsetSet( $key, $value ) |
109 | 109 | { |
110 | - if( property_exists( $this, $key )) { |
|
110 | + if( property_exists( $this, $key ) ) { |
|
111 | 111 | $this->{$key} = $value; |
112 | 112 | return; |
113 | 113 | } |
114 | - if( !is_array( $this->custom )) { |
|
114 | + if( !is_array( $this->custom ) ) { |
|
115 | 115 | $this->custom = array_filter( (array)$this->custom ); |
116 | 116 | } |
117 | 117 | $this->custom[$key] = $value; |
@@ -156,13 +156,13 @@ discard block |
||
156 | 156 | 'review_type' => 'local', |
157 | 157 | ]; |
158 | 158 | $meta = array_filter( |
159 | - array_map( 'array_shift', array_filter((array)get_post_meta( $post->ID ))), |
|
159 | + array_map( 'array_shift', array_filter( (array)get_post_meta( $post->ID ) ) ), |
|
160 | 160 | 'strlen' |
161 | 161 | ); |
162 | - $properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta )); |
|
162 | + $properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta ) ); |
|
163 | 163 | $this->modified = $this->isModified( $properties ); |
164 | 164 | array_walk( $properties, function( $value, $key ) { |
165 | - if( !property_exists( $this, $key ) || isset( $this->$key ))return; |
|
165 | + if( !property_exists( $this, $key ) || isset($this->$key) )return; |
|
166 | 166 | $this->$key = maybe_unserialize( $value ); |
167 | 167 | }); |
168 | 168 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | protected function setTermIds( WP_Post $post ) |
174 | 174 | { |
175 | 175 | $this->term_ids = []; |
176 | - if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY )))return; |
|
176 | + if( !is_array( $terms = get_the_terms( $post, Application::TAXONOMY ) ) )return; |
|
177 | 177 | foreach( $terms as $term ) { |
178 | 178 | $this->term_ids[] = $term->term_id; |
179 | 179 | } |
@@ -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>'; |
@@ -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 | } |