@@ -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 | } |
@@ -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 | } |
@@ -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; |
@@ -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 | } |