@@ -26,7 +26,7 @@ class PageEventsCalendar extends PageEventsSearch {
2626 /**
2727 * Description text
2828 */
29- public function description () : ?string {
29+ public function description (): ?string {
3030 return get_field ( 'description ' );
3131 }
3232
@@ -35,7 +35,7 @@ public function description() : ?string {
3535 *
3636 * @return string
3737 */
38- public function no_results () : string {
38+ public function no_results (): string {
3939 return __ ( 'No results ' , 'tms-theme-base ' );
4040 }
4141
@@ -44,7 +44,7 @@ public function no_results() : string {
4444 *
4545 * @return bool
4646 */
47- public function is_grid () : bool {
47+ public function is_grid (): bool {
4848 $ is_grid = get_field ( 'layout ' ) ?? 'grid ' ;
4949
5050 return $ is_grid === 'grid ' ;
@@ -55,7 +55,7 @@ public function is_grid() : bool {
5555 *
5656 * @return string
5757 */
58- public function item_partial () : string {
58+ public function item_partial (): string {
5959 $ part = $ this ->is_grid () ? 'grid ' : 'list ' ;
6060
6161 return 'views/page-events-calendar/page-events-calendar-item- ' . $ part ;
@@ -64,7 +64,7 @@ public function item_partial() : string {
6464 /**
6565 * Get events
6666 */
67- public function events () : ?array {
67+ public function events (): ?array {
6868 try {
6969 $ response = $ this ->get_events ();
7070
@@ -82,28 +82,28 @@ public function events() : ?array {
8282 *
8383 * @return array
8484 */
85- protected function get_events () : array {
85+ protected function get_events (): array {
8686
87- $ paged = get_query_var ( 'paged ' , 1 );
87+ $ paged = \ get_query_var ( 'paged ' , 1 );
8888 $ skip = 0 ;
8989
9090 if ( $ paged > 1 ) {
91- $ skip = ( $ paged - 1 ) * get_option ( 'posts_per_page ' );
91+ $ skip = ( $ paged - 1 ) * \ get_option ( 'posts_per_page ' );
9292 }
9393
9494 $ params = [
95- 'q ' => get_field ( 'text ' ),
96- 'start ' => get_field ( 'start ' ),
97- 'end ' => get_field ( 'end ' ),
98- 'category_id ' => get_field ( 'category ' ),
99- 'areas ' => get_field ( 'area ' ),
100- 'targets ' => get_field ( 'target ' ),
101- 'tags ' => get_field ( 'tag ' ),
95+ 'q ' => \ get_field ( 'text ' ),
96+ 'start ' => \ get_field ( 'start ' ),
97+ 'end ' => \ get_field ( 'end ' ),
98+ 'category_id ' => \ get_field ( 'category ' ),
99+ 'areas ' => \ get_field ( 'area ' ),
100+ 'targets ' => \ get_field ( 'target ' ),
101+ 'tags ' => \ get_field ( 'tag ' ),
102102 'sort ' => 'startDate ' ,
103- 'show_images ' => get_field ( 'show_images ' ),
103+ 'show_images ' => \ get_field ( 'show_images ' ),
104104 ];
105105
106- if ( ! empty ( get_field ( 'starts_today ' ) ) && true === get_field ( 'starts_today ' ) ) {
106+ if ( ! empty ( \ get_field ( 'starts_today ' ) ) && true === \ get_field ( 'starts_today ' ) ) {
107107 $ params ['start ' ] = date ( 'Y-m-d ' );
108108 }
109109
@@ -116,15 +116,15 @@ protected function get_events() : array {
116116 $ params = $ formatter ->format_query_params ( $ params );
117117
118118 $ cache_group = 'page-events-calendar ' ;
119- $ cache_key = md5 ( wp_json_encode ( $ params ) );
120- $ response = wp_cache_get ( $ cache_key , $ cache_group );
119+ $ cache_key = md5 ( \ wp_json_encode ( $ params ) );
120+ $ response = \ wp_cache_get ( $ cache_key , $ cache_group );
121121
122122 if ( empty ( $ response ) ) {
123123
124124 $ response = $ this ->do_get_events ( $ params );
125125
126126 if ( ! empty ( $ response ) ) {
127- wp_cache_set (
127+ \ wp_cache_set (
128128 $ cache_key ,
129129 $ response ,
130130 $ cache_group ,
@@ -136,7 +136,7 @@ protected function get_events() : array {
136136 if ( ! empty ( $ response ['events ' ] ) ) {
137137
138138 // Sort events.
139- usort ( $ response ['events ' ], function ( $ a , $ b ) {
139+ usort ( $ response ['events ' ], function ( $ a , $ b ) {
140140 return $ a ['start_date_raw ' ] <=> $ b ['start_date_raw ' ];
141141 } );
142142
@@ -153,7 +153,7 @@ protected function get_events() : array {
153153 *
154154 * @return array|null
155155 */
156- public function calendar_pages () : ?array {
156+ public function calendar_pages (): ?array {
157157 if ( ! Settings::get_setting ( 'show_related_events_calendars ' ) ) {
158158 return null ;
159159 }
@@ -171,15 +171,15 @@ public function calendar_pages() : ?array {
171171 return null ;
172172 }
173173
174- $ current_page = get_queried_object_id ();
174+ $ current_page = \ get_queried_object_id ();
175175
176176 $ pages = array_filter ( $ the_query ->posts , function ( $ item ) use ( $ current_page ) {
177177 return $ item ->ID !== $ current_page ;
178178 } );
179179
180180 return array_map ( function ( $ item ) {
181181 return [
182- 'url ' => get_the_permalink ( $ item ->ID ),
182+ 'url ' => \ get_the_permalink ( $ item ->ID ),
183183 'title ' => $ item ->post_title ,
184184 ];
185185 }, $ pages );
0 commit comments