@@ -25,228 +25,228 @@ |
||
25 | 25 | { |
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * @return EED_Event_Single_Caff |
|
30 | - */ |
|
31 | - public static function instance() |
|
32 | - { |
|
33 | - return parent::get_instance(__CLASS__); |
|
34 | - } |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
39 | - * |
|
40 | - * @access public |
|
41 | - * @return void |
|
42 | - */ |
|
43 | - public static function set_hooks() |
|
44 | - { |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
49 | - * |
|
50 | - * @access public |
|
51 | - * @return void |
|
52 | - */ |
|
53 | - public static function set_hooks_admin() |
|
54 | - { |
|
55 | - self::setDefinitions(); |
|
56 | - add_action( |
|
57 | - 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__template_settings', |
|
58 | - array('EED_Event_Single_Caff', 'load_scripts_styles'), |
|
59 | - 10 |
|
60 | - ); |
|
61 | - add_action( |
|
62 | - 'AHEE__template_settings__template__before_settings_form', |
|
63 | - array('EED_Event_Single_Caff', 'template_settings_form'), |
|
64 | - 10 |
|
65 | - ); |
|
66 | - add_filter( |
|
67 | - 'FHEE__General_Settings_Admin_Page__update_template_settings__data', |
|
68 | - array('EED_Event_Single_Caff', 'update_template_settings'), |
|
69 | - 10, |
|
70 | - 2 |
|
71 | - ); |
|
72 | - // AJAX |
|
73 | - add_action( |
|
74 | - 'wp_ajax_espresso_update_event_single_order', |
|
75 | - array('EED_Event_Single_Caff', 'update_event_single_order') |
|
76 | - ); |
|
77 | - add_action( |
|
78 | - 'wp_ajax_nopriv_espresso_update_event_single_order', |
|
79 | - array('EED_Event_Single_Caff', 'update_event_single_order') |
|
80 | - ); |
|
81 | - } |
|
82 | - |
|
83 | - |
|
84 | - public static function load_scripts_styles() |
|
85 | - { |
|
86 | - add_action('admin_enqueue_scripts', array('EED_Event_Single_Caff', 'enqueue_scripts_styles'), 10); |
|
87 | - } |
|
88 | - |
|
89 | - |
|
90 | - public static function enqueue_scripts_styles() |
|
91 | - { |
|
92 | - wp_register_style( |
|
93 | - 'eed-event-single-sortable', |
|
94 | - EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.css', |
|
95 | - array(), |
|
96 | - EVENT_ESPRESSO_VERSION |
|
97 | - ); |
|
98 | - wp_enqueue_style('eed-event-single-sortable'); |
|
99 | - wp_register_script( |
|
100 | - 'eed-event-single-sortable', |
|
101 | - EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.js', |
|
102 | - array('jquery-ui-sortable'), |
|
103 | - EVENT_ESPRESSO_VERSION, |
|
104 | - true |
|
105 | - ); |
|
106 | - wp_enqueue_script('eed-event-single-sortable'); |
|
107 | - } |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * Set constants only if they haven't been set yet. |
|
112 | - */ |
|
113 | - public static function setDefinitions() |
|
114 | - { |
|
115 | - if (! defined('EVENT_SINGLE_CAFF_TEMPLATES_PATH')) { |
|
116 | - define('EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path(__FILE__) . 'templates' . DS); |
|
117 | - define('EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
118 | - } |
|
119 | - } |
|
120 | - |
|
121 | - |
|
122 | - /** |
|
123 | - * template_settings_form |
|
124 | - * |
|
125 | - * @access public |
|
126 | - * @static |
|
127 | - * @return void |
|
128 | - */ |
|
129 | - public static function template_settings_form() |
|
130 | - { |
|
131 | - $config = EE_Registry::instance()->CFG->template_settings; |
|
132 | - $config = isset($config->EED_Event_Single) && $config->EED_Event_Single instanceof EE_Event_Single_Config |
|
133 | - ? $config->EED_Event_Single : new EE_Event_Single_Config(); |
|
134 | - $config->use_sortable_display_order = isset($config->use_sortable_display_order) |
|
135 | - ? $config->use_sortable_display_order : false; |
|
136 | - $config = apply_filters('FHEE__EED_Event_Single__template_settings_form__event_list_config', $config); |
|
137 | - |
|
138 | - $event_single_order_array = array(); |
|
139 | - $event_single_order_array[ $config->display_order_tickets ] = 'tickets'; |
|
140 | - $event_single_order_array[ $config->display_order_datetimes ] = 'datetimes'; |
|
141 | - $event_single_order_array[ $config->display_order_event ] = 'event'; |
|
142 | - $event_single_order_array[ $config->display_order_venue ] = 'venue'; |
|
143 | - // get template parts |
|
144 | - $template_parts = EED_Event_Single::instance()->initialize_template_parts($config); |
|
145 | - // convert to array so that we can add more properties |
|
146 | - $config = get_object_vars($config); |
|
147 | - $config['event_single_display_order'] = $template_parts->generate_sortable_list_of_template_parts( |
|
148 | - 'event-single-sortable-js', |
|
149 | - '', |
|
150 | - 'single-sortable-li single-sortable-js' |
|
151 | - ); |
|
152 | - EEH_Template::display_template( |
|
153 | - EVENT_SINGLE_CAFF_TEMPLATES_PATH . 'admin-event-single-settings.template.php', |
|
154 | - $config |
|
155 | - ); |
|
156 | - } |
|
157 | - |
|
158 | - |
|
159 | - /** |
|
160 | - * update_template_settings |
|
161 | - * |
|
162 | - * @param EE_Template_Config $CFG |
|
163 | - * @param array $REQ |
|
164 | - * @return EE_Template_Config |
|
165 | - */ |
|
166 | - public static function update_template_settings(EE_Template_Config $CFG, $REQ) |
|
167 | - { |
|
168 | - if (! $CFG->EED_Event_Single instanceof EE_Event_Single_Config) { |
|
169 | - $CFG->EED_Event_Single = new EE_Event_Single_Config(); |
|
170 | - } |
|
171 | - $display_order_event = $CFG->EED_Event_Single->display_order_event !== null |
|
172 | - ? $CFG->EED_Event_Single->display_order_event |
|
173 | - : EED_Event_Single::EVENT_DETAILS_PRIORITY; |
|
174 | - $display_order_datetimes = $CFG->EED_Event_Single->display_order_datetimes !== null |
|
175 | - ? $CFG->EED_Event_Single->display_order_datetimes |
|
176 | - : EED_Event_Single::EVENT_DATETIMES_PRIORITY; |
|
177 | - $display_order_tickets = $CFG->EED_Event_Single->display_order_tickets !== null |
|
178 | - ? $CFG->EED_Event_Single->display_order_tickets |
|
179 | - : EED_Event_Single::EVENT_TICKETS_PRIORITY; |
|
180 | - $display_order_venue = $CFG->EED_Event_Single->display_order_venue !== null |
|
181 | - ? $CFG->EED_Event_Single->display_order_venue |
|
182 | - : EED_Event_Single::EVENT_VENUES_PRIORITY; |
|
183 | - $CFG->EED_Event_Single = new EE_Event_Single_Config(); |
|
184 | - $CFG->EED_Event_Single->display_status_banner_single = ! empty($REQ['display_status_banner_single']) |
|
185 | - && $REQ['display_status_banner_single']; |
|
186 | - $CFG->EED_Event_Single->display_venue = ! empty($REQ['display_venue']) && $REQ['display_venue']; |
|
187 | - $CFG->EED_Event_Single->use_sortable_display_order = ! empty($REQ['EED_Events_Single_use_sortable_display_order']) |
|
188 | - ? absint($REQ['EED_Events_Single_use_sortable_display_order']) |
|
189 | - : 0; |
|
190 | - $CFG->EED_Event_Single->display_order_event = $CFG->EED_Event_Single->use_sortable_display_order |
|
191 | - ? $display_order_event |
|
192 | - : EED_Event_Single::EVENT_DETAILS_PRIORITY; |
|
193 | - $CFG->EED_Event_Single->display_order_datetimes = $CFG->EED_Event_Single->use_sortable_display_order |
|
194 | - ? $display_order_datetimes |
|
195 | - : EED_Event_Single::EVENT_DATETIMES_PRIORITY; |
|
196 | - $CFG->EED_Event_Single->display_order_tickets = $CFG->EED_Event_Single->use_sortable_display_order |
|
197 | - ? $display_order_tickets |
|
198 | - : EED_Event_Single::EVENT_TICKETS_PRIORITY; |
|
199 | - $CFG->EED_Event_Single->display_order_venue = $CFG->EED_Event_Single->use_sortable_display_order |
|
200 | - ? $display_order_venue |
|
201 | - : EED_Event_Single::EVENT_VENUES_PRIORITY; |
|
202 | - do_action('AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ); |
|
203 | - return $CFG; |
|
204 | - } |
|
205 | - |
|
206 | - |
|
207 | - /** |
|
208 | - * update_event_single_order |
|
209 | - * |
|
210 | - * @access public |
|
211 | - * @return void |
|
212 | - */ |
|
213 | - public static function update_event_single_order() |
|
214 | - { |
|
215 | - $config_saved = false; |
|
216 | - $template_parts = sanitize_text_field($_POST['elements']); |
|
217 | - if (! empty($template_parts)) { |
|
218 | - $template_parts = explode(',', trim($template_parts, ',')); |
|
219 | - foreach ($template_parts as $key => $template_part) { |
|
220 | - $template_part = "display_order_$template_part"; |
|
221 | - $priority = ($key * 10) + EED_Event_Single::EVENT_DETAILS_PRIORITY; |
|
222 | - EE_Registry::instance()->CFG->template_settings->EED_Event_Single->{$template_part} = $priority; |
|
223 | - do_action("AHEE__EED_Event_Single__update_event_single_order__$template_part", $priority); |
|
224 | - } |
|
225 | - $config_saved = EE_Registry::instance()->CFG->update_espresso_config(false, false); |
|
226 | - } |
|
227 | - if ($config_saved) { |
|
228 | - EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso')); |
|
229 | - } else { |
|
230 | - EE_Error::add_error( |
|
231 | - __('Display Order was not updated.', 'event_espresso'), |
|
232 | - __FILE__, |
|
233 | - __FUNCTION__, |
|
234 | - __LINE__ |
|
235 | - ); |
|
236 | - } |
|
237 | - echo wp_json_encode(EE_Error::get_notices(false)); |
|
238 | - exit(); |
|
239 | - } |
|
240 | - |
|
241 | - |
|
242 | - /** |
|
243 | - * run - initial module setup |
|
244 | - * |
|
245 | - * @access public |
|
246 | - * @param WP $WP |
|
247 | - * @return void |
|
248 | - */ |
|
249 | - public function run($WP) |
|
250 | - { |
|
251 | - } |
|
28 | + /** |
|
29 | + * @return EED_Event_Single_Caff |
|
30 | + */ |
|
31 | + public static function instance() |
|
32 | + { |
|
33 | + return parent::get_instance(__CLASS__); |
|
34 | + } |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
39 | + * |
|
40 | + * @access public |
|
41 | + * @return void |
|
42 | + */ |
|
43 | + public static function set_hooks() |
|
44 | + { |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
49 | + * |
|
50 | + * @access public |
|
51 | + * @return void |
|
52 | + */ |
|
53 | + public static function set_hooks_admin() |
|
54 | + { |
|
55 | + self::setDefinitions(); |
|
56 | + add_action( |
|
57 | + 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__template_settings', |
|
58 | + array('EED_Event_Single_Caff', 'load_scripts_styles'), |
|
59 | + 10 |
|
60 | + ); |
|
61 | + add_action( |
|
62 | + 'AHEE__template_settings__template__before_settings_form', |
|
63 | + array('EED_Event_Single_Caff', 'template_settings_form'), |
|
64 | + 10 |
|
65 | + ); |
|
66 | + add_filter( |
|
67 | + 'FHEE__General_Settings_Admin_Page__update_template_settings__data', |
|
68 | + array('EED_Event_Single_Caff', 'update_template_settings'), |
|
69 | + 10, |
|
70 | + 2 |
|
71 | + ); |
|
72 | + // AJAX |
|
73 | + add_action( |
|
74 | + 'wp_ajax_espresso_update_event_single_order', |
|
75 | + array('EED_Event_Single_Caff', 'update_event_single_order') |
|
76 | + ); |
|
77 | + add_action( |
|
78 | + 'wp_ajax_nopriv_espresso_update_event_single_order', |
|
79 | + array('EED_Event_Single_Caff', 'update_event_single_order') |
|
80 | + ); |
|
81 | + } |
|
82 | + |
|
83 | + |
|
84 | + public static function load_scripts_styles() |
|
85 | + { |
|
86 | + add_action('admin_enqueue_scripts', array('EED_Event_Single_Caff', 'enqueue_scripts_styles'), 10); |
|
87 | + } |
|
88 | + |
|
89 | + |
|
90 | + public static function enqueue_scripts_styles() |
|
91 | + { |
|
92 | + wp_register_style( |
|
93 | + 'eed-event-single-sortable', |
|
94 | + EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.css', |
|
95 | + array(), |
|
96 | + EVENT_ESPRESSO_VERSION |
|
97 | + ); |
|
98 | + wp_enqueue_style('eed-event-single-sortable'); |
|
99 | + wp_register_script( |
|
100 | + 'eed-event-single-sortable', |
|
101 | + EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.js', |
|
102 | + array('jquery-ui-sortable'), |
|
103 | + EVENT_ESPRESSO_VERSION, |
|
104 | + true |
|
105 | + ); |
|
106 | + wp_enqueue_script('eed-event-single-sortable'); |
|
107 | + } |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * Set constants only if they haven't been set yet. |
|
112 | + */ |
|
113 | + public static function setDefinitions() |
|
114 | + { |
|
115 | + if (! defined('EVENT_SINGLE_CAFF_TEMPLATES_PATH')) { |
|
116 | + define('EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path(__FILE__) . 'templates' . DS); |
|
117 | + define('EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
118 | + } |
|
119 | + } |
|
120 | + |
|
121 | + |
|
122 | + /** |
|
123 | + * template_settings_form |
|
124 | + * |
|
125 | + * @access public |
|
126 | + * @static |
|
127 | + * @return void |
|
128 | + */ |
|
129 | + public static function template_settings_form() |
|
130 | + { |
|
131 | + $config = EE_Registry::instance()->CFG->template_settings; |
|
132 | + $config = isset($config->EED_Event_Single) && $config->EED_Event_Single instanceof EE_Event_Single_Config |
|
133 | + ? $config->EED_Event_Single : new EE_Event_Single_Config(); |
|
134 | + $config->use_sortable_display_order = isset($config->use_sortable_display_order) |
|
135 | + ? $config->use_sortable_display_order : false; |
|
136 | + $config = apply_filters('FHEE__EED_Event_Single__template_settings_form__event_list_config', $config); |
|
137 | + |
|
138 | + $event_single_order_array = array(); |
|
139 | + $event_single_order_array[ $config->display_order_tickets ] = 'tickets'; |
|
140 | + $event_single_order_array[ $config->display_order_datetimes ] = 'datetimes'; |
|
141 | + $event_single_order_array[ $config->display_order_event ] = 'event'; |
|
142 | + $event_single_order_array[ $config->display_order_venue ] = 'venue'; |
|
143 | + // get template parts |
|
144 | + $template_parts = EED_Event_Single::instance()->initialize_template_parts($config); |
|
145 | + // convert to array so that we can add more properties |
|
146 | + $config = get_object_vars($config); |
|
147 | + $config['event_single_display_order'] = $template_parts->generate_sortable_list_of_template_parts( |
|
148 | + 'event-single-sortable-js', |
|
149 | + '', |
|
150 | + 'single-sortable-li single-sortable-js' |
|
151 | + ); |
|
152 | + EEH_Template::display_template( |
|
153 | + EVENT_SINGLE_CAFF_TEMPLATES_PATH . 'admin-event-single-settings.template.php', |
|
154 | + $config |
|
155 | + ); |
|
156 | + } |
|
157 | + |
|
158 | + |
|
159 | + /** |
|
160 | + * update_template_settings |
|
161 | + * |
|
162 | + * @param EE_Template_Config $CFG |
|
163 | + * @param array $REQ |
|
164 | + * @return EE_Template_Config |
|
165 | + */ |
|
166 | + public static function update_template_settings(EE_Template_Config $CFG, $REQ) |
|
167 | + { |
|
168 | + if (! $CFG->EED_Event_Single instanceof EE_Event_Single_Config) { |
|
169 | + $CFG->EED_Event_Single = new EE_Event_Single_Config(); |
|
170 | + } |
|
171 | + $display_order_event = $CFG->EED_Event_Single->display_order_event !== null |
|
172 | + ? $CFG->EED_Event_Single->display_order_event |
|
173 | + : EED_Event_Single::EVENT_DETAILS_PRIORITY; |
|
174 | + $display_order_datetimes = $CFG->EED_Event_Single->display_order_datetimes !== null |
|
175 | + ? $CFG->EED_Event_Single->display_order_datetimes |
|
176 | + : EED_Event_Single::EVENT_DATETIMES_PRIORITY; |
|
177 | + $display_order_tickets = $CFG->EED_Event_Single->display_order_tickets !== null |
|
178 | + ? $CFG->EED_Event_Single->display_order_tickets |
|
179 | + : EED_Event_Single::EVENT_TICKETS_PRIORITY; |
|
180 | + $display_order_venue = $CFG->EED_Event_Single->display_order_venue !== null |
|
181 | + ? $CFG->EED_Event_Single->display_order_venue |
|
182 | + : EED_Event_Single::EVENT_VENUES_PRIORITY; |
|
183 | + $CFG->EED_Event_Single = new EE_Event_Single_Config(); |
|
184 | + $CFG->EED_Event_Single->display_status_banner_single = ! empty($REQ['display_status_banner_single']) |
|
185 | + && $REQ['display_status_banner_single']; |
|
186 | + $CFG->EED_Event_Single->display_venue = ! empty($REQ['display_venue']) && $REQ['display_venue']; |
|
187 | + $CFG->EED_Event_Single->use_sortable_display_order = ! empty($REQ['EED_Events_Single_use_sortable_display_order']) |
|
188 | + ? absint($REQ['EED_Events_Single_use_sortable_display_order']) |
|
189 | + : 0; |
|
190 | + $CFG->EED_Event_Single->display_order_event = $CFG->EED_Event_Single->use_sortable_display_order |
|
191 | + ? $display_order_event |
|
192 | + : EED_Event_Single::EVENT_DETAILS_PRIORITY; |
|
193 | + $CFG->EED_Event_Single->display_order_datetimes = $CFG->EED_Event_Single->use_sortable_display_order |
|
194 | + ? $display_order_datetimes |
|
195 | + : EED_Event_Single::EVENT_DATETIMES_PRIORITY; |
|
196 | + $CFG->EED_Event_Single->display_order_tickets = $CFG->EED_Event_Single->use_sortable_display_order |
|
197 | + ? $display_order_tickets |
|
198 | + : EED_Event_Single::EVENT_TICKETS_PRIORITY; |
|
199 | + $CFG->EED_Event_Single->display_order_venue = $CFG->EED_Event_Single->use_sortable_display_order |
|
200 | + ? $display_order_venue |
|
201 | + : EED_Event_Single::EVENT_VENUES_PRIORITY; |
|
202 | + do_action('AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ); |
|
203 | + return $CFG; |
|
204 | + } |
|
205 | + |
|
206 | + |
|
207 | + /** |
|
208 | + * update_event_single_order |
|
209 | + * |
|
210 | + * @access public |
|
211 | + * @return void |
|
212 | + */ |
|
213 | + public static function update_event_single_order() |
|
214 | + { |
|
215 | + $config_saved = false; |
|
216 | + $template_parts = sanitize_text_field($_POST['elements']); |
|
217 | + if (! empty($template_parts)) { |
|
218 | + $template_parts = explode(',', trim($template_parts, ',')); |
|
219 | + foreach ($template_parts as $key => $template_part) { |
|
220 | + $template_part = "display_order_$template_part"; |
|
221 | + $priority = ($key * 10) + EED_Event_Single::EVENT_DETAILS_PRIORITY; |
|
222 | + EE_Registry::instance()->CFG->template_settings->EED_Event_Single->{$template_part} = $priority; |
|
223 | + do_action("AHEE__EED_Event_Single__update_event_single_order__$template_part", $priority); |
|
224 | + } |
|
225 | + $config_saved = EE_Registry::instance()->CFG->update_espresso_config(false, false); |
|
226 | + } |
|
227 | + if ($config_saved) { |
|
228 | + EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso')); |
|
229 | + } else { |
|
230 | + EE_Error::add_error( |
|
231 | + __('Display Order was not updated.', 'event_espresso'), |
|
232 | + __FILE__, |
|
233 | + __FUNCTION__, |
|
234 | + __LINE__ |
|
235 | + ); |
|
236 | + } |
|
237 | + echo wp_json_encode(EE_Error::get_notices(false)); |
|
238 | + exit(); |
|
239 | + } |
|
240 | + |
|
241 | + |
|
242 | + /** |
|
243 | + * run - initial module setup |
|
244 | + * |
|
245 | + * @access public |
|
246 | + * @param WP $WP |
|
247 | + * @return void |
|
248 | + */ |
|
249 | + public function run($WP) |
|
250 | + { |
|
251 | + } |
|
252 | 252 | } |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | { |
92 | 92 | wp_register_style( |
93 | 93 | 'eed-event-single-sortable', |
94 | - EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.css', |
|
94 | + EVENT_SINGLE_CAFF_ASSETS_URL.'eed_event_single_sortable.css', |
|
95 | 95 | array(), |
96 | 96 | EVENT_ESPRESSO_VERSION |
97 | 97 | ); |
98 | 98 | wp_enqueue_style('eed-event-single-sortable'); |
99 | 99 | wp_register_script( |
100 | 100 | 'eed-event-single-sortable', |
101 | - EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.js', |
|
101 | + EVENT_SINGLE_CAFF_ASSETS_URL.'eed_event_single_sortable.js', |
|
102 | 102 | array('jquery-ui-sortable'), |
103 | 103 | EVENT_ESPRESSO_VERSION, |
104 | 104 | true |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public static function setDefinitions() |
114 | 114 | { |
115 | - if (! defined('EVENT_SINGLE_CAFF_TEMPLATES_PATH')) { |
|
116 | - define('EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path(__FILE__) . 'templates' . DS); |
|
117 | - define('EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
115 | + if ( ! defined('EVENT_SINGLE_CAFF_TEMPLATES_PATH')) { |
|
116 | + define('EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS); |
|
117 | + define('EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | $config = apply_filters('FHEE__EED_Event_Single__template_settings_form__event_list_config', $config); |
137 | 137 | |
138 | 138 | $event_single_order_array = array(); |
139 | - $event_single_order_array[ $config->display_order_tickets ] = 'tickets'; |
|
140 | - $event_single_order_array[ $config->display_order_datetimes ] = 'datetimes'; |
|
141 | - $event_single_order_array[ $config->display_order_event ] = 'event'; |
|
142 | - $event_single_order_array[ $config->display_order_venue ] = 'venue'; |
|
139 | + $event_single_order_array[$config->display_order_tickets] = 'tickets'; |
|
140 | + $event_single_order_array[$config->display_order_datetimes] = 'datetimes'; |
|
141 | + $event_single_order_array[$config->display_order_event] = 'event'; |
|
142 | + $event_single_order_array[$config->display_order_venue] = 'venue'; |
|
143 | 143 | // get template parts |
144 | 144 | $template_parts = EED_Event_Single::instance()->initialize_template_parts($config); |
145 | 145 | // convert to array so that we can add more properties |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | 'single-sortable-li single-sortable-js' |
151 | 151 | ); |
152 | 152 | EEH_Template::display_template( |
153 | - EVENT_SINGLE_CAFF_TEMPLATES_PATH . 'admin-event-single-settings.template.php', |
|
153 | + EVENT_SINGLE_CAFF_TEMPLATES_PATH.'admin-event-single-settings.template.php', |
|
154 | 154 | $config |
155 | 155 | ); |
156 | 156 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public static function update_template_settings(EE_Template_Config $CFG, $REQ) |
167 | 167 | { |
168 | - if (! $CFG->EED_Event_Single instanceof EE_Event_Single_Config) { |
|
168 | + if ( ! $CFG->EED_Event_Single instanceof EE_Event_Single_Config) { |
|
169 | 169 | $CFG->EED_Event_Single = new EE_Event_Single_Config(); |
170 | 170 | } |
171 | 171 | $display_order_event = $CFG->EED_Event_Single->display_order_event !== null |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | { |
215 | 215 | $config_saved = false; |
216 | 216 | $template_parts = sanitize_text_field($_POST['elements']); |
217 | - if (! empty($template_parts)) { |
|
217 | + if ( ! empty($template_parts)) { |
|
218 | 218 | $template_parts = explode(',', trim($template_parts, ',')); |
219 | 219 | foreach ($template_parts as $key => $template_part) { |
220 | 220 | $template_part = "display_order_$template_part"; |
@@ -13,260 +13,260 @@ |
||
13 | 13 | class EED_Events_Archive_Caff extends EED_Events_Archive |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @return EED_Events_Archive_Caff|EED_Module |
|
18 | - */ |
|
19 | - public static function instance() |
|
20 | - { |
|
21 | - return parent::get_instance(__CLASS__); |
|
22 | - } |
|
16 | + /** |
|
17 | + * @return EED_Events_Archive_Caff|EED_Module |
|
18 | + */ |
|
19 | + public static function instance() |
|
20 | + { |
|
21 | + return parent::get_instance(__CLASS__); |
|
22 | + } |
|
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
27 | - * |
|
28 | - * @return void |
|
29 | - */ |
|
30 | - public static function set_hooks() |
|
31 | - { |
|
32 | - } |
|
25 | + /** |
|
26 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
27 | + * |
|
28 | + * @return void |
|
29 | + */ |
|
30 | + public static function set_hooks() |
|
31 | + { |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
36 | - * |
|
37 | - * @access public |
|
38 | - * @return void |
|
39 | - */ |
|
40 | - public static function set_hooks_admin() |
|
41 | - { |
|
42 | - self::setDefinitions(); |
|
43 | - add_action( |
|
44 | - 'AHEE__template_settings__template__before_settings_form', |
|
45 | - array('EED_Events_Archive_Caff', 'template_settings_form'), |
|
46 | - 10 |
|
47 | - ); |
|
48 | - add_filter( |
|
49 | - 'FHEE__General_Settings_Admin_Page__update_template_settings__data', |
|
50 | - array('EED_Events_Archive_Caff', 'update_template_settings'), |
|
51 | - 10, |
|
52 | - 2 |
|
53 | - ); |
|
54 | - // AJAX |
|
55 | - add_action( |
|
56 | - 'wp_ajax_espresso_update_event_archive_order', |
|
57 | - array('EED_Events_Archive_Caff', 'update_event_archive_order') |
|
58 | - ); |
|
59 | - add_action( |
|
60 | - 'wp_ajax_nopriv_espresso_update_event_archive_order', |
|
61 | - array('EED_Events_Archive_Caff', 'update_event_archive_order') |
|
62 | - ); |
|
63 | - } |
|
34 | + /** |
|
35 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
36 | + * |
|
37 | + * @access public |
|
38 | + * @return void |
|
39 | + */ |
|
40 | + public static function set_hooks_admin() |
|
41 | + { |
|
42 | + self::setDefinitions(); |
|
43 | + add_action( |
|
44 | + 'AHEE__template_settings__template__before_settings_form', |
|
45 | + array('EED_Events_Archive_Caff', 'template_settings_form'), |
|
46 | + 10 |
|
47 | + ); |
|
48 | + add_filter( |
|
49 | + 'FHEE__General_Settings_Admin_Page__update_template_settings__data', |
|
50 | + array('EED_Events_Archive_Caff', 'update_template_settings'), |
|
51 | + 10, |
|
52 | + 2 |
|
53 | + ); |
|
54 | + // AJAX |
|
55 | + add_action( |
|
56 | + 'wp_ajax_espresso_update_event_archive_order', |
|
57 | + array('EED_Events_Archive_Caff', 'update_event_archive_order') |
|
58 | + ); |
|
59 | + add_action( |
|
60 | + 'wp_ajax_nopriv_espresso_update_event_archive_order', |
|
61 | + array('EED_Events_Archive_Caff', 'update_event_archive_order') |
|
62 | + ); |
|
63 | + } |
|
64 | 64 | |
65 | 65 | |
66 | - /** |
|
67 | - * run - initial module setup |
|
68 | - * |
|
69 | - * @param WP $WP |
|
70 | - * @return void |
|
71 | - */ |
|
72 | - public function run($WP) |
|
73 | - { |
|
74 | - } |
|
66 | + /** |
|
67 | + * run - initial module setup |
|
68 | + * |
|
69 | + * @param WP $WP |
|
70 | + * @return void |
|
71 | + */ |
|
72 | + public function run($WP) |
|
73 | + { |
|
74 | + } |
|
75 | 75 | |
76 | 76 | |
77 | - /** |
|
78 | - * Conditionally set constants if they haven't been defined yet. |
|
79 | - */ |
|
80 | - public static function setDefinitions() |
|
81 | - { |
|
82 | - if (! defined('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH')) { |
|
83 | - define( |
|
84 | - 'EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', |
|
85 | - str_replace('\\', DS, plugin_dir_path(__FILE__)) . 'templates' . DS |
|
86 | - ); |
|
87 | - define('EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
88 | - } |
|
89 | - } |
|
77 | + /** |
|
78 | + * Conditionally set constants if they haven't been defined yet. |
|
79 | + */ |
|
80 | + public static function setDefinitions() |
|
81 | + { |
|
82 | + if (! defined('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH')) { |
|
83 | + define( |
|
84 | + 'EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', |
|
85 | + str_replace('\\', DS, plugin_dir_path(__FILE__)) . 'templates' . DS |
|
86 | + ); |
|
87 | + define('EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
88 | + } |
|
89 | + } |
|
90 | 90 | |
91 | 91 | |
92 | - /** |
|
93 | - * @return void |
|
94 | - * @throws DomainException |
|
95 | - * @throws InvalidArgumentException |
|
96 | - * @throws InvalidDataTypeException |
|
97 | - * @throws InvalidInterfaceException |
|
98 | - */ |
|
99 | - public static function template_settings_form() |
|
100 | - { |
|
101 | - // grab general settings admin page and remove the existing hook callback |
|
102 | - $gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object('general_settings'); |
|
103 | - if ($gen_set_admin instanceof General_Settings_Admin_Page) { |
|
104 | - remove_action( |
|
105 | - 'AHEE__template_settings__template__before_settings_form', |
|
106 | - array($gen_set_admin, 'template_settings_caff_features'), |
|
107 | - 100 |
|
108 | - ); |
|
109 | - } |
|
110 | - // first just grab the template settings |
|
111 | - $config = EE_Registry::instance()->CFG->template_settings; |
|
112 | - // then if the Event Archive config is valid, use that, else create a new one |
|
113 | - $config = $config instanceof EE_Template_Config |
|
114 | - && $config->EED_Events_Archive instanceof EE_Events_Archive_Config |
|
115 | - ? $config->EED_Events_Archive |
|
116 | - : new EE_Events_Archive_Config(); |
|
117 | - $config = apply_filters( |
|
118 | - 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', |
|
119 | - $config |
|
120 | - ); |
|
121 | - $config->display_status_banner = isset($config->display_status_banner) |
|
122 | - ? $config->display_status_banner |
|
123 | - : 0; |
|
124 | - $config->display_description = isset($config->display_description) |
|
125 | - ? $config->display_description |
|
126 | - : 1; |
|
127 | - $config->display_ticket_selector = isset($config->display_ticket_selector) |
|
128 | - ? $config->display_ticket_selector |
|
129 | - : 0; |
|
130 | - $config->display_datetimes = isset($config->display_datetimes) |
|
131 | - ? $config->display_datetimes |
|
132 | - : 1; |
|
133 | - $config->display_venue = isset($config->display_venue) |
|
134 | - ? $config->display_venue |
|
135 | - : 0; |
|
136 | - $config->display_expired_events = isset($config->display_expired_events) |
|
137 | - ? $config->display_expired_events |
|
138 | - : 0; |
|
139 | - // display order options |
|
140 | - $config->use_sortable_display_order = isset($config->use_sortable_display_order) |
|
141 | - ? $config->use_sortable_display_order |
|
142 | - : false; |
|
143 | - $config->display_order_tickets = isset($config->display_order_tickets) |
|
144 | - ? $config->display_order_tickets |
|
145 | - : 120; |
|
146 | - $config->display_order_datetimes = isset($config->display_order_datetimes) |
|
147 | - ? $config->display_order_datetimes |
|
148 | - : 110; |
|
149 | - $config->display_order_event = isset($config->display_order_event) |
|
150 | - ? $config->display_order_event |
|
151 | - : 100; |
|
152 | - $config->display_order_venue = isset($config->display_order_venue) |
|
153 | - ? $config->display_order_venue |
|
154 | - : 130; |
|
155 | - // get template parts |
|
156 | - $template_parts = EED_Events_Archive::instance()->initialize_template_parts($config); |
|
157 | - // convert to array so that we can add more properties |
|
158 | - $config = get_object_vars($config); |
|
159 | - $config['event_archive_display_order'] = $template_parts->generate_sortable_list_of_template_parts( |
|
160 | - 'event-archive-sortable-js', |
|
161 | - '', |
|
162 | - 'archive-sortable-li archive-sortable-js' |
|
163 | - ); |
|
164 | - EEH_Template::display_template( |
|
165 | - EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php', |
|
166 | - $config |
|
167 | - ); |
|
168 | - } |
|
92 | + /** |
|
93 | + * @return void |
|
94 | + * @throws DomainException |
|
95 | + * @throws InvalidArgumentException |
|
96 | + * @throws InvalidDataTypeException |
|
97 | + * @throws InvalidInterfaceException |
|
98 | + */ |
|
99 | + public static function template_settings_form() |
|
100 | + { |
|
101 | + // grab general settings admin page and remove the existing hook callback |
|
102 | + $gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object('general_settings'); |
|
103 | + if ($gen_set_admin instanceof General_Settings_Admin_Page) { |
|
104 | + remove_action( |
|
105 | + 'AHEE__template_settings__template__before_settings_form', |
|
106 | + array($gen_set_admin, 'template_settings_caff_features'), |
|
107 | + 100 |
|
108 | + ); |
|
109 | + } |
|
110 | + // first just grab the template settings |
|
111 | + $config = EE_Registry::instance()->CFG->template_settings; |
|
112 | + // then if the Event Archive config is valid, use that, else create a new one |
|
113 | + $config = $config instanceof EE_Template_Config |
|
114 | + && $config->EED_Events_Archive instanceof EE_Events_Archive_Config |
|
115 | + ? $config->EED_Events_Archive |
|
116 | + : new EE_Events_Archive_Config(); |
|
117 | + $config = apply_filters( |
|
118 | + 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', |
|
119 | + $config |
|
120 | + ); |
|
121 | + $config->display_status_banner = isset($config->display_status_banner) |
|
122 | + ? $config->display_status_banner |
|
123 | + : 0; |
|
124 | + $config->display_description = isset($config->display_description) |
|
125 | + ? $config->display_description |
|
126 | + : 1; |
|
127 | + $config->display_ticket_selector = isset($config->display_ticket_selector) |
|
128 | + ? $config->display_ticket_selector |
|
129 | + : 0; |
|
130 | + $config->display_datetimes = isset($config->display_datetimes) |
|
131 | + ? $config->display_datetimes |
|
132 | + : 1; |
|
133 | + $config->display_venue = isset($config->display_venue) |
|
134 | + ? $config->display_venue |
|
135 | + : 0; |
|
136 | + $config->display_expired_events = isset($config->display_expired_events) |
|
137 | + ? $config->display_expired_events |
|
138 | + : 0; |
|
139 | + // display order options |
|
140 | + $config->use_sortable_display_order = isset($config->use_sortable_display_order) |
|
141 | + ? $config->use_sortable_display_order |
|
142 | + : false; |
|
143 | + $config->display_order_tickets = isset($config->display_order_tickets) |
|
144 | + ? $config->display_order_tickets |
|
145 | + : 120; |
|
146 | + $config->display_order_datetimes = isset($config->display_order_datetimes) |
|
147 | + ? $config->display_order_datetimes |
|
148 | + : 110; |
|
149 | + $config->display_order_event = isset($config->display_order_event) |
|
150 | + ? $config->display_order_event |
|
151 | + : 100; |
|
152 | + $config->display_order_venue = isset($config->display_order_venue) |
|
153 | + ? $config->display_order_venue |
|
154 | + : 130; |
|
155 | + // get template parts |
|
156 | + $template_parts = EED_Events_Archive::instance()->initialize_template_parts($config); |
|
157 | + // convert to array so that we can add more properties |
|
158 | + $config = get_object_vars($config); |
|
159 | + $config['event_archive_display_order'] = $template_parts->generate_sortable_list_of_template_parts( |
|
160 | + 'event-archive-sortable-js', |
|
161 | + '', |
|
162 | + 'archive-sortable-li archive-sortable-js' |
|
163 | + ); |
|
164 | + EEH_Template::display_template( |
|
165 | + EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php', |
|
166 | + $config |
|
167 | + ); |
|
168 | + } |
|
169 | 169 | |
170 | 170 | |
171 | - /** |
|
172 | - * @param EE_Template_Config $CFG |
|
173 | - * @param array $REQ |
|
174 | - * @return EE_Template_Config |
|
175 | - */ |
|
176 | - public static function update_template_settings($CFG, $REQ) |
|
177 | - { |
|
178 | - /** @var EE_Events_Archive_Config $config */ |
|
179 | - $config = $CFG->EED_Events_Archive instanceof EE_Events_Archive_Config |
|
180 | - ? $CFG->EED_Events_Archive |
|
181 | - : new EE_Events_Archive_Config(); |
|
182 | - // unless we are resetting the config... |
|
183 | - if (! isset($REQ['EED_Events_Archive_reset_event_list_settings']) |
|
184 | - || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1 |
|
185 | - ) { |
|
186 | - $config->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) |
|
187 | - ? absint($REQ['EED_Events_Archive_display_status_banner']) |
|
188 | - : 0; |
|
189 | - $config->display_description = isset($REQ['EED_Events_Archive_display_description']) |
|
190 | - ? absint($REQ['EED_Events_Archive_display_description']) |
|
191 | - : 1; |
|
192 | - $config->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) |
|
193 | - ? absint($REQ['EED_Events_Archive_display_ticket_selector']) |
|
194 | - : 0; |
|
195 | - $config->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) |
|
196 | - ? absint($REQ['EED_Events_Archive_display_datetimes']) |
|
197 | - : 1; |
|
198 | - $config->display_venue = isset($REQ['EED_Events_Archive_display_venue']) |
|
199 | - ? absint($REQ['EED_Events_Archive_display_venue']) |
|
200 | - : 0; |
|
201 | - $config->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) |
|
202 | - ? absint($REQ['EED_Events_Archive_display_expired_events']) |
|
203 | - : 0; |
|
204 | - $config->use_sortable_display_order = isset($REQ['EED_Events_Archive_use_sortable_display_order']) |
|
205 | - ? absint($REQ['EED_Events_Archive_use_sortable_display_order']) |
|
206 | - : 0; |
|
207 | - $config->display_order_event = $config->display_order_event !== null |
|
208 | - && $config->use_sortable_display_order |
|
209 | - ? $config->display_order_event |
|
210 | - : EED_Events_Archive::EVENT_DETAILS_PRIORITY; |
|
211 | - $config->display_order_datetimes = $config->display_order_datetimes !== null |
|
212 | - && $config->use_sortable_display_order |
|
213 | - ? $config->display_order_datetimes |
|
214 | - : EED_Events_Archive::EVENT_DATETIMES_PRIORITY; |
|
215 | - $config->display_order_tickets = $config->display_order_tickets !== null |
|
216 | - && $config->use_sortable_display_order |
|
217 | - ? $config->display_order_tickets |
|
218 | - : EED_Events_Archive::EVENT_TICKETS_PRIORITY; |
|
219 | - $config->display_order_venue = $config->display_order_venue !== null |
|
220 | - && $config->use_sortable_display_order |
|
221 | - ? $config->display_order_venue |
|
222 | - : EED_Events_Archive::EVENT_VENUES_PRIORITY; |
|
223 | - } |
|
224 | - $CFG->EED_Events_Archive = $config; |
|
225 | - do_action('AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ); |
|
226 | - return $CFG; |
|
227 | - } |
|
171 | + /** |
|
172 | + * @param EE_Template_Config $CFG |
|
173 | + * @param array $REQ |
|
174 | + * @return EE_Template_Config |
|
175 | + */ |
|
176 | + public static function update_template_settings($CFG, $REQ) |
|
177 | + { |
|
178 | + /** @var EE_Events_Archive_Config $config */ |
|
179 | + $config = $CFG->EED_Events_Archive instanceof EE_Events_Archive_Config |
|
180 | + ? $CFG->EED_Events_Archive |
|
181 | + : new EE_Events_Archive_Config(); |
|
182 | + // unless we are resetting the config... |
|
183 | + if (! isset($REQ['EED_Events_Archive_reset_event_list_settings']) |
|
184 | + || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1 |
|
185 | + ) { |
|
186 | + $config->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) |
|
187 | + ? absint($REQ['EED_Events_Archive_display_status_banner']) |
|
188 | + : 0; |
|
189 | + $config->display_description = isset($REQ['EED_Events_Archive_display_description']) |
|
190 | + ? absint($REQ['EED_Events_Archive_display_description']) |
|
191 | + : 1; |
|
192 | + $config->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) |
|
193 | + ? absint($REQ['EED_Events_Archive_display_ticket_selector']) |
|
194 | + : 0; |
|
195 | + $config->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) |
|
196 | + ? absint($REQ['EED_Events_Archive_display_datetimes']) |
|
197 | + : 1; |
|
198 | + $config->display_venue = isset($REQ['EED_Events_Archive_display_venue']) |
|
199 | + ? absint($REQ['EED_Events_Archive_display_venue']) |
|
200 | + : 0; |
|
201 | + $config->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) |
|
202 | + ? absint($REQ['EED_Events_Archive_display_expired_events']) |
|
203 | + : 0; |
|
204 | + $config->use_sortable_display_order = isset($REQ['EED_Events_Archive_use_sortable_display_order']) |
|
205 | + ? absint($REQ['EED_Events_Archive_use_sortable_display_order']) |
|
206 | + : 0; |
|
207 | + $config->display_order_event = $config->display_order_event !== null |
|
208 | + && $config->use_sortable_display_order |
|
209 | + ? $config->display_order_event |
|
210 | + : EED_Events_Archive::EVENT_DETAILS_PRIORITY; |
|
211 | + $config->display_order_datetimes = $config->display_order_datetimes !== null |
|
212 | + && $config->use_sortable_display_order |
|
213 | + ? $config->display_order_datetimes |
|
214 | + : EED_Events_Archive::EVENT_DATETIMES_PRIORITY; |
|
215 | + $config->display_order_tickets = $config->display_order_tickets !== null |
|
216 | + && $config->use_sortable_display_order |
|
217 | + ? $config->display_order_tickets |
|
218 | + : EED_Events_Archive::EVENT_TICKETS_PRIORITY; |
|
219 | + $config->display_order_venue = $config->display_order_venue !== null |
|
220 | + && $config->use_sortable_display_order |
|
221 | + ? $config->display_order_venue |
|
222 | + : EED_Events_Archive::EVENT_VENUES_PRIORITY; |
|
223 | + } |
|
224 | + $CFG->EED_Events_Archive = $config; |
|
225 | + do_action('AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ); |
|
226 | + return $CFG; |
|
227 | + } |
|
228 | 228 | |
229 | 229 | |
230 | - /** |
|
231 | - * @return void |
|
232 | - * @throws InvalidArgumentException |
|
233 | - * @throws InvalidDataTypeException |
|
234 | - * @throws InvalidInterfaceException |
|
235 | - */ |
|
236 | - public static function update_event_archive_order() |
|
237 | - { |
|
238 | - /** @var EE_Config $config */ |
|
239 | - $config = EE_Registry::instance()->CFG; |
|
240 | - $config_saved = false; |
|
241 | - $template_parts = sanitize_text_field($_POST['elements']); |
|
242 | - if (! empty($template_parts)) { |
|
243 | - $template_parts = explode(',', trim($template_parts, ',')); |
|
244 | - foreach ($template_parts as $key => $template_part) { |
|
245 | - $template_part = "display_order_$template_part"; |
|
246 | - $priority = ($key * 10) + EED_Events_Archive::EVENT_DETAILS_PRIORITY; |
|
247 | - if ($config->template_settings->EED_Events_Archive instanceof EE_Events_Archive_Config |
|
248 | - && property_exists( |
|
249 | - $config->template_settings->EED_Events_Archive, |
|
250 | - $template_part |
|
251 | - ) |
|
252 | - ) { |
|
253 | - $config->template_settings->EED_Events_Archive->{$template_part} = $priority; |
|
254 | - } |
|
255 | - do_action("AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority); |
|
256 | - } |
|
257 | - $config_saved = $config->update_espresso_config(false, false); |
|
258 | - } |
|
259 | - if ($config_saved) { |
|
260 | - EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso')); |
|
261 | - } else { |
|
262 | - EE_Error::add_error( |
|
263 | - __('Display Order was not updated.', 'event_espresso'), |
|
264 | - __FILE__, |
|
265 | - __FUNCTION__, |
|
266 | - __LINE__ |
|
267 | - ); |
|
268 | - } |
|
269 | - echo wp_json_encode(EE_Error::get_notices(false)); |
|
270 | - exit(); |
|
271 | - } |
|
230 | + /** |
|
231 | + * @return void |
|
232 | + * @throws InvalidArgumentException |
|
233 | + * @throws InvalidDataTypeException |
|
234 | + * @throws InvalidInterfaceException |
|
235 | + */ |
|
236 | + public static function update_event_archive_order() |
|
237 | + { |
|
238 | + /** @var EE_Config $config */ |
|
239 | + $config = EE_Registry::instance()->CFG; |
|
240 | + $config_saved = false; |
|
241 | + $template_parts = sanitize_text_field($_POST['elements']); |
|
242 | + if (! empty($template_parts)) { |
|
243 | + $template_parts = explode(',', trim($template_parts, ',')); |
|
244 | + foreach ($template_parts as $key => $template_part) { |
|
245 | + $template_part = "display_order_$template_part"; |
|
246 | + $priority = ($key * 10) + EED_Events_Archive::EVENT_DETAILS_PRIORITY; |
|
247 | + if ($config->template_settings->EED_Events_Archive instanceof EE_Events_Archive_Config |
|
248 | + && property_exists( |
|
249 | + $config->template_settings->EED_Events_Archive, |
|
250 | + $template_part |
|
251 | + ) |
|
252 | + ) { |
|
253 | + $config->template_settings->EED_Events_Archive->{$template_part} = $priority; |
|
254 | + } |
|
255 | + do_action("AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority); |
|
256 | + } |
|
257 | + $config_saved = $config->update_espresso_config(false, false); |
|
258 | + } |
|
259 | + if ($config_saved) { |
|
260 | + EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso')); |
|
261 | + } else { |
|
262 | + EE_Error::add_error( |
|
263 | + __('Display Order was not updated.', 'event_espresso'), |
|
264 | + __FILE__, |
|
265 | + __FUNCTION__, |
|
266 | + __LINE__ |
|
267 | + ); |
|
268 | + } |
|
269 | + echo wp_json_encode(EE_Error::get_notices(false)); |
|
270 | + exit(); |
|
271 | + } |
|
272 | 272 | } |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public static function setDefinitions() |
81 | 81 | { |
82 | - if (! defined('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH')) { |
|
82 | + if ( ! defined('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH')) { |
|
83 | 83 | define( |
84 | 84 | 'EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', |
85 | - str_replace('\\', DS, plugin_dir_path(__FILE__)) . 'templates' . DS |
|
85 | + str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS |
|
86 | 86 | ); |
87 | - define('EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
87 | + define('EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | 'archive-sortable-li archive-sortable-js' |
163 | 163 | ); |
164 | 164 | EEH_Template::display_template( |
165 | - EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php', |
|
165 | + EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH.'admin-event-list-settings.template.php', |
|
166 | 166 | $config |
167 | 167 | ); |
168 | 168 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | ? $CFG->EED_Events_Archive |
181 | 181 | : new EE_Events_Archive_Config(); |
182 | 182 | // unless we are resetting the config... |
183 | - if (! isset($REQ['EED_Events_Archive_reset_event_list_settings']) |
|
183 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) |
|
184 | 184 | || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1 |
185 | 185 | ) { |
186 | 186 | $config->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | $config = EE_Registry::instance()->CFG; |
240 | 240 | $config_saved = false; |
241 | 241 | $template_parts = sanitize_text_field($_POST['elements']); |
242 | - if (! empty($template_parts)) { |
|
242 | + if ( ! empty($template_parts)) { |
|
243 | 243 | $template_parts = explode(',', trim($template_parts, ',')); |
244 | 244 | foreach ($template_parts as $key => $template_part) { |
245 | 245 | $template_part = "display_order_$template_part"; |