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