@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | |
43 | 43 | public function __construct() { |
44 | 44 | // construct request stack and run middleware apps as soon as all WP plugins are loaded |
45 | - add_action( 'plugins_loaded', array( $this, 'run_request_stack' ), 0 ); |
|
45 | + add_action('plugins_loaded', array($this, 'run_request_stack'), 0); |
|
46 | 46 | // set framework for the rest of EE to hook into when loading |
47 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'load_espresso_addons' ), 1 ); |
|
48 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'detect_activations_or_upgrades' ), 3 ); |
|
49 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'load_core_configuration' ), 5 ); |
|
50 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
51 | - add_action( 'plugins_loaded', array( 'EE_Bootstrap', 'brew_espresso' ), 9 ); |
|
47 | + add_action('plugins_loaded', array('EE_Bootstrap', 'load_espresso_addons'), 1); |
|
48 | + add_action('plugins_loaded', array('EE_Bootstrap', 'detect_activations_or_upgrades'), 3); |
|
49 | + add_action('plugins_loaded', array('EE_Bootstrap', 'load_core_configuration'), 5); |
|
50 | + add_action('plugins_loaded', array('EE_Bootstrap', 'register_shortcodes_modules_and_widgets'), 7); |
|
51 | + add_action('plugins_loaded', array('EE_Bootstrap', 'brew_espresso'), 9); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | new EE_Load_Espresso_Core() |
66 | 66 | ); |
67 | 67 | $this->_request_stack->handle_request( |
68 | - new EE_Request( $_GET, $_POST, $_COOKIE ), |
|
68 | + new EE_Request($_GET, $_POST, $_COOKIE), |
|
69 | 69 | new EE_Response() |
70 | 70 | ); |
71 | 71 | $this->_request_stack->handle_response(); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | protected function load_autoloader() { |
80 | 80 | // load interfaces |
81 | - espresso_load_required( 'EEH_Autoloader', EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php' ); |
|
81 | + espresso_load_required('EEH_Autoloader', EE_CORE.'helpers'.DS.'EEH_Autoloader.helper.php'); |
|
82 | 82 | EEH_Autoloader::instance(); |
83 | 83 | } |
84 | 84 | |
@@ -89,15 +89,15 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected function set_autoloaders_for_required_files() { |
91 | 91 | // load interfaces |
92 | - espresso_load_required( 'EEI_Interfaces', EE_CORE . 'interfaces' . DS . 'EEI_Interfaces.php' ); |
|
93 | - espresso_load_required( 'InterminableInterface', EE_CORE . 'interfaces' . DS . 'InterminableInterface.php' ); |
|
94 | - espresso_load_required( 'ResettableInterface', EE_CORE . 'interfaces' . DS . 'ResettableInterface.php' ); |
|
92 | + espresso_load_required('EEI_Interfaces', EE_CORE.'interfaces'.DS.'EEI_Interfaces.php'); |
|
93 | + espresso_load_required('InterminableInterface', EE_CORE.'interfaces'.DS.'InterminableInterface.php'); |
|
94 | + espresso_load_required('ResettableInterface', EE_CORE.'interfaces'.DS.'ResettableInterface.php'); |
|
95 | 95 | // load helpers |
96 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_HELPERS ); |
|
96 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
97 | 97 | // load request stack |
98 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE . 'request_stack' . DS ); |
|
98 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'request_stack'.DS); |
|
99 | 99 | // load middleware |
100 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE . 'middleware' . DS ); |
|
100 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'middleware'.DS); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | ) |
119 | 119 | ); |
120 | 120 | // load middleware onto stack : FILO (First In Last Out) |
121 | - foreach ( (array)$stack_apps as $stack_app ) { |
|
121 | + foreach ((array) $stack_apps as $stack_app) { |
|
122 | 122 | //$request_stack_builder->push( $stack_app ); |
123 | - $request_stack_builder->unshift( $stack_app ); |
|
123 | + $request_stack_builder->unshift($stack_app); |
|
124 | 124 | } |
125 | 125 | return apply_filters( |
126 | 126 | 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * no other logic should be performed at this point |
138 | 138 | */ |
139 | 139 | public static function load_espresso_addons() { |
140 | - do_action( 'AHEE__EE_Bootstrap__load_espresso_addons' ); |
|
140 | + do_action('AHEE__EE_Bootstrap__load_espresso_addons'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * we can determine if anything needs activating or upgrading |
150 | 150 | */ |
151 | 151 | public static function detect_activations_or_upgrades() { |
152 | - do_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades' ); |
|
152 | + do_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * we can load and set all of the system configurations |
162 | 162 | */ |
163 | 163 | public static function load_core_configuration() { |
164 | - do_action( 'AHEE__EE_Bootstrap__load_core_configuration' ); |
|
164 | + do_action('AHEE__EE_Bootstrap__load_core_configuration'); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * so that they are ready to be used throughout the system |
174 | 174 | */ |
175 | 175 | public static function register_shortcodes_modules_and_widgets() { |
176 | - do_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets' ); |
|
176 | + do_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets'); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * so let the fun begin... |
186 | 186 | */ |
187 | 187 | public static function brew_espresso() { |
188 | - do_action( 'AHEE__EE_Bootstrap__brew_espresso' ); |
|
188 | + do_action('AHEE__EE_Bootstrap__brew_espresso'); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 |
@@ -1,4 +1,4 @@ |
||
1 | -<?php use EventEspresso\core\interfaces\InterminableInterface; |
|
1 | +<?php |
|
2 | 2 | |
3 | 3 | defined('EVENT_ESPRESSO_VERSION') || exit('No direct script access allowed'); |
4 | 4 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -42,51 +42,51 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @param \Registrations_Admin_Page $admin_page |
44 | 44 | */ |
45 | - public function __construct( $admin_page ) { |
|
46 | - parent::__construct( $admin_page ); |
|
45 | + public function __construct($admin_page) { |
|
46 | + parent::__construct($admin_page); |
|
47 | 47 | $this->_status = $this->_admin_page->get_registration_status_array(); |
48 | 48 | } |
49 | 49 | |
50 | 50 | |
51 | 51 | |
52 | 52 | protected function _setup_data() { |
53 | - $this->_data = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page ) |
|
54 | - : $this->_admin_page->get_event_attendees( $this->_per_page, false, true ); |
|
53 | + $this->_data = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page) |
|
54 | + : $this->_admin_page->get_event_attendees($this->_per_page, false, true); |
|
55 | 55 | $this->_all_data_count = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees( |
56 | 56 | $this->_per_page, |
57 | 57 | true |
58 | - ) : $this->_admin_page->get_event_attendees( $this->_per_page, true, true ); |
|
58 | + ) : $this->_admin_page->get_event_attendees($this->_per_page, true, true); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | 62 | |
63 | 63 | protected function _set_properties() { |
64 | - $evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null; |
|
64 | + $evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null; |
|
65 | 65 | $this->_wp_list_args = array( |
66 | - 'singular' => __( 'registrant', 'event_espresso' ), |
|
67 | - 'plural' => __( 'registrants', 'event_espresso' ), |
|
66 | + 'singular' => __('registrant', 'event_espresso'), |
|
67 | + 'plural' => __('registrants', 'event_espresso'), |
|
68 | 68 | 'ajax' => true, |
69 | 69 | 'screen' => $this->_admin_page->get_current_screen()->id, |
70 | 70 | ); |
71 | 71 | $columns = array(); |
72 | 72 | //$columns['_Reg_Status'] = ''; |
73 | - if ( ! empty( $evt_id ) ) { |
|
73 | + if ( ! empty($evt_id)) { |
|
74 | 74 | $columns['cb'] = '<input type="checkbox" />'; //Render a checkbox instead of text |
75 | 75 | $this->_has_checkbox_column = true; |
76 | 76 | } |
77 | 77 | $this->_columns = array( |
78 | 78 | '_REG_att_checked_in' => '<span class="dashicons dashicons-yes ee-icon-size-18"></span>', |
79 | - 'ATT_name' => __( 'Registrant', 'event_espresso' ), |
|
80 | - 'ATT_email' => __( 'Email Address', 'event_espresso' ), |
|
81 | - 'Event' => __( 'Event', 'event_espresso' ), |
|
82 | - 'PRC_name' => __( 'TKT Option', 'event_espresso' ), |
|
83 | - '_REG_final_price' => __( 'Price', 'event_espresso' ), |
|
84 | - 'TXN_paid' => __( 'Paid', 'event_espresso' ), |
|
85 | - 'TXN_total' => __( 'Total', 'event_espresso' ), |
|
79 | + 'ATT_name' => __('Registrant', 'event_espresso'), |
|
80 | + 'ATT_email' => __('Email Address', 'event_espresso'), |
|
81 | + 'Event' => __('Event', 'event_espresso'), |
|
82 | + 'PRC_name' => __('TKT Option', 'event_espresso'), |
|
83 | + '_REG_final_price' => __('Price', 'event_espresso'), |
|
84 | + 'TXN_paid' => __('Paid', 'event_espresso'), |
|
85 | + 'TXN_total' => __('Total', 'event_espresso'), |
|
86 | 86 | ); |
87 | - $this->_columns = array_merge( $columns, $this->_columns ); |
|
87 | + $this->_columns = array_merge($columns, $this->_columns); |
|
88 | 88 | $this->_primary_column = '_REG_att_checked_in'; |
89 | - if ( ! empty( $evt_id ) |
|
89 | + if ( ! empty($evt_id) |
|
90 | 90 | && EE_Registry::instance()->CAP->current_user_can( |
91 | 91 | 'ee_read_registrations', |
92 | 92 | 'espresso_registrations_registrations_reports', |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | 'extra_request' => |
100 | 100 | array( |
101 | 101 | 'EVT_ID' => $evt_id, |
102 | - 'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ), |
|
102 | + 'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"), |
|
103 | 103 | ), |
104 | 104 | ), |
105 | 105 | ); |
@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | true, |
141 | 141 | $this |
142 | 142 | ) |
143 | - ? array( 'ATT_lname' => true ) |
|
144 | - : array( 'ATT_fname' => true ), |
|
145 | - 'Event' => array( 'Event.EVT.Name' => false ), |
|
143 | + ? array('ATT_lname' => true) |
|
144 | + : array('ATT_fname' => true), |
|
145 | + 'Event' => array('Event.EVT.Name' => false), |
|
146 | 146 | ); |
147 | 147 | $this->_hidden_columns = array(); |
148 | - $this->_evt = EEM_Event::instance()->get_one_by_ID( $evt_id ); |
|
148 | + $this->_evt = EEM_Event::instance()->get_one_by_ID($evt_id); |
|
149 | 149 | $this->_dtts_for_event = $this->_evt instanceof EE_Event ? $this->_evt->datetimes_ordered() : array(); |
150 | 150 | } |
151 | 151 | |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | * @param \EE_Registration $item |
156 | 156 | * @return string |
157 | 157 | */ |
158 | - protected function _get_row_class( $item ) { |
|
159 | - $class = parent::_get_row_class( $item ); |
|
158 | + protected function _get_row_class($item) { |
|
159 | + $class = parent::_get_row_class($item); |
|
160 | 160 | //add status class |
161 | - $class .= ' ee-status-strip reg-status-' . $item->status_ID(); |
|
162 | - if ( $this->_has_checkbox_column ) { |
|
161 | + $class .= ' ee-status-strip reg-status-'.$item->status_ID(); |
|
162 | + if ($this->_has_checkbox_column) { |
|
163 | 163 | $class .= ' has-checkbox-column'; |
164 | 164 | } |
165 | 165 | return $class; |
@@ -173,61 +173,61 @@ discard block |
||
173 | 173 | */ |
174 | 174 | protected function _get_table_filters() { |
175 | 175 | $filters = $where = array(); |
176 | - $current_EVT_ID = isset( $this->_req_data['event_id'] ) ? (int) $this->_req_data['event_id'] : 0; |
|
177 | - if ( empty( $this->_dtts_for_event ) || count( $this->_dtts_for_event ) === 1 ) { |
|
176 | + $current_EVT_ID = isset($this->_req_data['event_id']) ? (int) $this->_req_data['event_id'] : 0; |
|
177 | + if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) { |
|
178 | 178 | //this means we don't have an event so let's setup a filter dropdown for all the events to select |
179 | 179 | //note possible capability restrictions |
180 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) { |
|
181 | - $where['status**'] = array( '!=', 'private' ); |
|
180 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
181 | + $where['status**'] = array('!=', 'private'); |
|
182 | 182 | } |
183 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
183 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
184 | 184 | $where['EVT_wp_user'] = get_current_user_id(); |
185 | 185 | } |
186 | 186 | $events = EEM_Event::instance()->get_all( |
187 | 187 | array( |
188 | 188 | $where, |
189 | - 'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ), |
|
189 | + 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC'), |
|
190 | 190 | ) |
191 | 191 | ); |
192 | 192 | $evts[] = array( |
193 | 193 | 'id' => 0, |
194 | - 'text' => __( 'To toggle Check-in status, select an event', 'event_espresso' ), |
|
194 | + 'text' => __('To toggle Check-in status, select an event', 'event_espresso'), |
|
195 | 195 | ); |
196 | 196 | $checked = 'checked'; |
197 | 197 | /** @var EE_Event $evt */ |
198 | - foreach ( $events as $evt ) { |
|
198 | + foreach ($events as $evt) { |
|
199 | 199 | //any registrations for this event? |
200 | - if ( ! $evt->get_count_of_all_registrations() ) { |
|
200 | + if ( ! $evt->get_count_of_all_registrations()) { |
|
201 | 201 | continue; |
202 | 202 | } |
203 | 203 | $evts[] = array( |
204 | 204 | 'id' => $evt->ID(), |
205 | - 'text' => apply_filters('FHEE__EE_Event_Registrations___get_table_filters__event_name', $evt->get( 'EVT_name' ), $evt), |
|
205 | + 'text' => apply_filters('FHEE__EE_Event_Registrations___get_table_filters__event_name', $evt->get('EVT_name'), $evt), |
|
206 | 206 | 'class' => $evt->is_expired() ? 'ee-expired-event' : '', |
207 | 207 | ); |
208 | - if ( $evt->ID() === $current_EVT_ID && $evt->is_expired() ) { |
|
208 | + if ($evt->ID() === $current_EVT_ID && $evt->is_expired()) { |
|
209 | 209 | $checked = ''; |
210 | 210 | } |
211 | 211 | } |
212 | 212 | $event_filter = '<div class="ee-event-filter">'; |
213 | - $event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts, $current_EVT_ID ); |
|
213 | + $event_filter .= EEH_Form_Fields::select_input('event_id', $evts, $current_EVT_ID); |
|
214 | 214 | $event_filter .= '<span class="ee-event-filter-toggle">'; |
215 | - $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '> '; |
|
216 | - $event_filter .= __( 'Hide Expired Events', 'event_espresso' ); |
|
215 | + $event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" '.$checked.'> '; |
|
216 | + $event_filter .= __('Hide Expired Events', 'event_espresso'); |
|
217 | 217 | $event_filter .= '</span>'; |
218 | 218 | $event_filter .= '</div>'; |
219 | 219 | $filters[] = $event_filter; |
220 | 220 | } |
221 | - if ( ! empty( $this->_dtts_for_event ) ) { |
|
221 | + if ( ! empty($this->_dtts_for_event)) { |
|
222 | 222 | //DTT datetimes filter |
223 | - $this->_cur_dtt_id = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0; |
|
224 | - if ( count( $this->_dtts_for_event ) > 1 ) { |
|
225 | - $dtts[0] = __( 'To toggle check-in status, select a datetime.', 'event_espresso' ); |
|
226 | - foreach ( $this->_dtts_for_event as $dtt ) { |
|
223 | + $this->_cur_dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0; |
|
224 | + if (count($this->_dtts_for_event) > 1) { |
|
225 | + $dtts[0] = __('To toggle check-in status, select a datetime.', 'event_espresso'); |
|
226 | + foreach ($this->_dtts_for_event as $dtt) { |
|
227 | 227 | $datetime_string = $dtt->name(); |
228 | - $datetime_string = ! empty($datetime_string ) ? ' (' . $datetime_string . ')' : ''; |
|
229 | - $datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time() . $datetime_string; |
|
230 | - $dtts[ $dtt->ID() ] = $datetime_string; |
|
228 | + $datetime_string = ! empty($datetime_string) ? ' ('.$datetime_string.')' : ''; |
|
229 | + $datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time().$datetime_string; |
|
230 | + $dtts[$dtt->ID()] = $datetime_string; |
|
231 | 231 | } |
232 | 232 | $input = new EE_Select_Input( |
233 | 233 | $dtts, |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | ) |
239 | 239 | ); |
240 | 240 | $filters[] = $input->get_html_for_input(); |
241 | - $filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">'; |
|
241 | + $filters[] = '<input type="hidden" name="event_id" value="'.$current_EVT_ID.'">'; |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | return $filters; |
@@ -257,22 +257,22 @@ discard block |
||
257 | 257 | * @throws \EE_Error |
258 | 258 | */ |
259 | 259 | protected function _get_total_event_attendees() { |
260 | - $EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : false; |
|
260 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false; |
|
261 | 261 | $DTT_ID = $this->_cur_dtt_id; |
262 | 262 | $query_params = array(); |
263 | - if ( $EVT_ID ) { |
|
263 | + if ($EVT_ID) { |
|
264 | 264 | $query_params[0]['EVT_ID'] = $EVT_ID; |
265 | 265 | } |
266 | 266 | //if DTT is included we only show for that datetime. Otherwise we're showing for all datetimes (the event). |
267 | - if ( $DTT_ID ) { |
|
267 | + if ($DTT_ID) { |
|
268 | 268 | $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
269 | 269 | } |
270 | 270 | $status_ids_array = apply_filters( |
271 | 271 | 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', |
272 | - array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) |
|
272 | + array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved) |
|
273 | 273 | ); |
274 | - $query_params[0]['STS_ID'] = array( 'IN', $status_ids_array ); |
|
275 | - return EEM_Registration::instance()->count( $query_params ); |
|
274 | + $query_params[0]['STS_ID'] = array('IN', $status_ids_array); |
|
275 | + return EEM_Registration::instance()->count($query_params); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | * @param \EE_Registration $item |
282 | 282 | * @return string |
283 | 283 | */ |
284 | - public function column__Reg_Status( EE_Registration $item ) { |
|
285 | - return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>'; |
|
284 | + public function column__Reg_Status(EE_Registration $item) { |
|
285 | + return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>'; |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | * @return string |
293 | 293 | * @throws \EE_Error |
294 | 294 | */ |
295 | - public function column_cb( $item ) { |
|
296 | - return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() ); |
|
295 | + public function column_cb($item) { |
|
296 | + return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID()); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | |
@@ -305,20 +305,20 @@ discard block |
||
305 | 305 | * @return string |
306 | 306 | * @throws \EE_Error |
307 | 307 | */ |
308 | - public function column__REG_att_checked_in( EE_Registration $item ) { |
|
308 | + public function column__REG_att_checked_in(EE_Registration $item) { |
|
309 | 309 | $attendee = $item->attendee(); |
310 | 310 | $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; |
311 | 311 | |
312 | - if ( $this->_cur_dtt_id === 0 && count( $this->_dtts_for_event ) === 1 ) { |
|
312 | + if ($this->_cur_dtt_id === 0 && count($this->_dtts_for_event) === 1) { |
|
313 | 313 | $latest_related_datetime = $item->get_latest_related_datetime(); |
314 | - if ( $latest_related_datetime instanceof EE_Datetime ) { |
|
314 | + if ($latest_related_datetime instanceof EE_Datetime) { |
|
315 | 315 | $this->_cur_dtt_id = $latest_related_datetime->ID(); |
316 | 316 | } |
317 | 317 | } |
318 | 318 | |
319 | - $checkinstatus = $item->check_in_status_for_datetime( $this->_cur_dtt_id ); |
|
320 | - $nonce = wp_create_nonce( 'checkin_nonce' ); |
|
321 | - $toggle_active = ! empty ( $this->_cur_dtt_id ) |
|
319 | + $checkinstatus = $item->check_in_status_for_datetime($this->_cur_dtt_id); |
|
320 | + $nonce = wp_create_nonce('checkin_nonce'); |
|
321 | + $toggle_active = ! empty ($this->_cur_dtt_id) |
|
322 | 322 | && EE_Registry::instance()->CAP->current_user_can( |
323 | 323 | 'ee_edit_checkin', |
324 | 324 | 'espresso_registrations_toggle_checkin_status', |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | ) |
327 | 327 | ? ' clickable trigger-checkin' |
328 | 328 | : ''; |
329 | - $mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>'; |
|
330 | - return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '"' |
|
331 | - . ' data-_regid="' . $item->ID() . '"' |
|
332 | - . ' data-dttid="' . $this->_cur_dtt_id . '"' |
|
333 | - . ' data-nonce="' . $nonce . '">' |
|
329 | + $mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>'; |
|
330 | + return '<span class="checkin-icons checkedin-status-'.$checkinstatus.$toggle_active.'"' |
|
331 | + . ' data-_regid="'.$item->ID().'"' |
|
332 | + . ' data-dttid="'.$this->_cur_dtt_id.'"' |
|
333 | + . ' data-nonce="'.$nonce.'">' |
|
334 | 334 | . '</span>' |
335 | 335 | . $mobile_view_content; |
336 | 336 | } |
@@ -342,21 +342,21 @@ discard block |
||
342 | 342 | * @return mixed|string|void |
343 | 343 | * @throws \EE_Error |
344 | 344 | */ |
345 | - public function column_ATT_name( EE_Registration $item ) { |
|
345 | + public function column_ATT_name(EE_Registration $item) { |
|
346 | 346 | $attendee = $item->attendee(); |
347 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
348 | - return __( 'No contact record for this registration.', 'event_espresso' ); |
|
347 | + if ( ! $attendee instanceof EE_Attendee) { |
|
348 | + return __('No contact record for this registration.', 'event_espresso'); |
|
349 | 349 | } |
350 | 350 | // edit attendee link |
351 | 351 | $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
352 | - array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), |
|
352 | + array('action' => 'view_registration', '_REG_ID' => $item->ID()), |
|
353 | 353 | REG_ADMIN_URL |
354 | 354 | ); |
355 | 355 | $name_link = EE_Registry::instance()->CAP->current_user_can( |
356 | 356 | 'ee_edit_contacts', |
357 | 357 | 'espresso_registrations_edit_attendee' |
358 | 358 | ) |
359 | - ? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' |
|
359 | + ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">' |
|
360 | 360 | . $item->attendee()->full_name() |
361 | 361 | . '</a>' |
362 | 362 | : $item->attendee()->full_name(); |
@@ -364,10 +364,10 @@ discard block |
||
364 | 364 | ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup> ' |
365 | 365 | : ''; |
366 | 366 | //add group details |
367 | - $name_link .= ' ' . sprintf( __( '(%s of %s)', 'event_espresso' ), $item->count(), $item->group_size() ); |
|
367 | + $name_link .= ' '.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size()); |
|
368 | 368 | //add regcode |
369 | 369 | $link = EE_Admin_Page::add_query_args_and_nonce( |
370 | - array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), |
|
370 | + array('action' => 'view_registration', '_REG_ID' => $item->ID()), |
|
371 | 371 | REG_ADMIN_URL |
372 | 372 | ); |
373 | 373 | $name_link .= '<br>'; |
@@ -376,50 +376,50 @@ discard block |
||
376 | 376 | 'view_registration', |
377 | 377 | $item->ID() |
378 | 378 | ) |
379 | - ? '<a href="' . $link . '" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' |
|
379 | + ? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">' |
|
380 | 380 | . $item->reg_code() |
381 | 381 | . '</a>' |
382 | 382 | : $item->reg_code(); |
383 | 383 | //status |
384 | 384 | $name_link .= '<br><span class="ee-status-text-small">'; |
385 | - $name_link .= EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ); |
|
385 | + $name_link .= EEH_Template::pretty_status($item->status_ID(), false, 'sentence'); |
|
386 | 386 | $name_link .= '</span>'; |
387 | 387 | $actions = array(); |
388 | 388 | $DTT_ID = $this->_cur_dtt_id; |
389 | - $latest_related_datetime = empty( $DTT_ID ) && ! empty( $this->_req_data['event_id'] ) && $item instanceof EE_Registration |
|
389 | + $latest_related_datetime = empty($DTT_ID) && ! empty($this->_req_data['event_id']) && $item instanceof EE_Registration |
|
390 | 390 | ? $item->get_latest_related_datetime() |
391 | 391 | : null; |
392 | 392 | $DTT_ID = $latest_related_datetime instanceof EE_Datetime |
393 | 393 | ? $latest_related_datetime->ID() |
394 | 394 | : $DTT_ID; |
395 | - if ( ! empty( $DTT_ID ) |
|
395 | + if ( ! empty($DTT_ID) |
|
396 | 396 | && EE_Registry::instance()->CAP->current_user_can( |
397 | 397 | 'ee_read_checkins', |
398 | 398 | 'espresso_registrations_registration_checkins' |
399 | 399 | ) |
400 | 400 | ) { |
401 | 401 | $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( |
402 | - array( 'action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID ) |
|
402 | + array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID) |
|
403 | 403 | ); |
404 | 404 | // get the timestamps for this registration's checkins, related to the selected datetime |
405 | - $timestamps = $item->get_many_related( 'Checkin', array( array( 'DTT_ID' => $DTT_ID ) ) ); |
|
406 | - if( ! empty( $timestamps ) ) { |
|
405 | + $timestamps = $item->get_many_related('Checkin', array(array('DTT_ID' => $DTT_ID))); |
|
406 | + if ( ! empty($timestamps)) { |
|
407 | 407 | // get the last timestamp |
408 | - $last_timestamp = end( $timestamps ); |
|
408 | + $last_timestamp = end($timestamps); |
|
409 | 409 | // checked in or checked out? |
410 | - $checkin_status = $last_timestamp->get( 'CHK_in' ) |
|
411 | - ? esc_html__( 'Checked In', 'event_espresso' ) |
|
412 | - : esc_html__( 'Checked Out', 'event_espresso' ); |
|
410 | + $checkin_status = $last_timestamp->get('CHK_in') |
|
411 | + ? esc_html__('Checked In', 'event_espresso') |
|
412 | + : esc_html__('Checked Out', 'event_espresso'); |
|
413 | 413 | // get timestamp string |
414 | - $timestamp_string = $last_timestamp->get_datetime( 'CHK_timestamp' ); |
|
415 | - $actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__( |
|
414 | + $timestamp_string = $last_timestamp->get_datetime('CHK_timestamp'); |
|
415 | + $actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'.esc_attr__( |
|
416 | 416 | 'View this registrant\'s check-ins/checkouts for the datetime', |
417 | 417 | 'event_espresso' |
418 | - ) . '">' . $checkin_status . ': ' . $timestamp_string . '</a>'; |
|
418 | + ).'">'.$checkin_status.': '.$timestamp_string.'</a>'; |
|
419 | 419 | } |
420 | 420 | } |
421 | - return ( ! empty( $DTT_ID ) && ! empty( $timestamps ) ) |
|
422 | - ? sprintf( '%1$s %2$s', $name_link, $this->row_actions( $actions, true ) ) |
|
421 | + return ( ! empty($DTT_ID) && ! empty($timestamps)) |
|
422 | + ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions, true)) |
|
423 | 423 | : $name_link; |
424 | 424 | } |
425 | 425 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @param \EE_Registration $item |
430 | 430 | * @return string |
431 | 431 | */ |
432 | - public function column_ATT_email( EE_Registration $item ) { |
|
432 | + public function column_ATT_email(EE_Registration $item) { |
|
433 | 433 | $attendee = $item->attendee(); |
434 | 434 | return $attendee instanceof EE_Attendee ? $attendee->email() : ''; |
435 | 435 | } |
@@ -441,22 +441,22 @@ discard block |
||
441 | 441 | * @return bool|string |
442 | 442 | * @throws \EE_Error |
443 | 443 | */ |
444 | - public function column_Event( EE_Registration $item ) { |
|
444 | + public function column_Event(EE_Registration $item) { |
|
445 | 445 | try { |
446 | 446 | $event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event(); |
447 | 447 | $chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
448 | - array( 'action' => 'event_registrations', 'event_id' => $event->ID() ), |
|
448 | + array('action' => 'event_registrations', 'event_id' => $event->ID()), |
|
449 | 449 | REG_ADMIN_URL |
450 | 450 | ); |
451 | 451 | $event_label = EE_Registry::instance()->CAP->current_user_can( |
452 | 452 | 'ee_read_checkins', |
453 | 453 | 'espresso_registrations_registration_checkins' |
454 | - ) ? '<a href="' . $chkin_lnk_url . '" title="' . esc_attr__( |
|
454 | + ) ? '<a href="'.$chkin_lnk_url.'" title="'.esc_attr__( |
|
455 | 455 | 'View Checkins for this Event', |
456 | 456 | 'event_espresso' |
457 | - ) . '">' . $event->name() . '</a>' : $event->name(); |
|
458 | - } catch ( \EventEspresso\core\exceptions\EntityNotFoundException $e ) { |
|
459 | - $event_label = esc_html__( 'Unknown', 'event_espresso' ); |
|
457 | + ).'">'.$event->name().'</a>' : $event->name(); |
|
458 | + } catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) { |
|
459 | + $event_label = esc_html__('Unknown', 'event_espresso'); |
|
460 | 460 | } |
461 | 461 | return $event_label; |
462 | 462 | } |
@@ -467,8 +467,8 @@ discard block |
||
467 | 467 | * @param \EE_Registration $item |
468 | 468 | * @return mixed|string|void |
469 | 469 | */ |
470 | - public function column_PRC_name( EE_Registration $item ) { |
|
471 | - return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __( "Unknown", "event_espresso" ); |
|
470 | + public function column_PRC_name(EE_Registration $item) { |
|
471 | + return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso"); |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | |
@@ -479,8 +479,8 @@ discard block |
||
479 | 479 | * @param \EE_Registration $item |
480 | 480 | * @return string |
481 | 481 | */ |
482 | - public function column__REG_final_price( EE_Registration $item ) { |
|
483 | - return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>'; |
|
482 | + public function column__REG_final_price(EE_Registration $item) { |
|
483 | + return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>'; |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | |
@@ -492,13 +492,13 @@ discard block |
||
492 | 492 | * @return string |
493 | 493 | * @throws \EE_Error |
494 | 494 | */ |
495 | - public function column_TXN_paid( EE_Registration $item ) { |
|
496 | - if ( $item->count() === 1 ) { |
|
497 | - if ( $item->transaction()->paid() >= $item->transaction()->total() ) { |
|
495 | + public function column_TXN_paid(EE_Registration $item) { |
|
496 | + if ($item->count() === 1) { |
|
497 | + if ($item->transaction()->paid() >= $item->transaction()->total()) { |
|
498 | 498 | return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>'; |
499 | 499 | } else { |
500 | 500 | $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
501 | - array( 'action' => 'view_transaction', 'TXN_ID' => $item->transaction_ID() ), |
|
501 | + array('action' => 'view_transaction', 'TXN_ID' => $item->transaction_ID()), |
|
502 | 502 | TXN_ADMIN_URL |
503 | 503 | ); |
504 | 504 | return EE_Registry::instance()->CAP->current_user_can( |
@@ -511,13 +511,13 @@ discard block |
||
511 | 511 | . '" href="' |
512 | 512 | . $view_txn_lnk_url |
513 | 513 | . '" title="' |
514 | - . esc_attr__( 'View Transaction', 'event_espresso' ) |
|
514 | + . esc_attr__('View Transaction', 'event_espresso') |
|
515 | 515 | . '"> |
516 | 516 | ' |
517 | 517 | . $item->transaction()->pretty_paid() |
518 | 518 | . ' |
519 | 519 | </a> |
520 | - <span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>'; |
|
520 | + <span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>'; |
|
521 | 521 | } |
522 | 522 | } else { |
523 | 523 | return '<span class="reg-pad-rght"></span>'; |
@@ -533,13 +533,13 @@ discard block |
||
533 | 533 | * @return string |
534 | 534 | * @throws \EE_Error |
535 | 535 | */ |
536 | - public function column_TXN_total( EE_Registration $item ) { |
|
536 | + public function column_TXN_total(EE_Registration $item) { |
|
537 | 537 | $txn = $item->transaction(); |
538 | - $view_txn_url = add_query_arg( array( 'action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL ); |
|
539 | - if ( $item->get( 'REG_count' ) === 1 ) { |
|
538 | + $view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL); |
|
539 | + if ($item->get('REG_count') === 1) { |
|
540 | 540 | $line_total_obj = $txn->total_line_item(); |
541 | 541 | $txn_total = $line_total_obj instanceof EE_Line_Item |
542 | - ? $line_total_obj->get_pretty( 'LIN_total' ) |
|
542 | + ? $line_total_obj->get_pretty('LIN_total') |
|
543 | 543 | : __( |
544 | 544 | 'View Transaction', |
545 | 545 | 'event_espresso' |
@@ -550,10 +550,10 @@ discard block |
||
550 | 550 | ) ? '<a href="' |
551 | 551 | . $view_txn_url |
552 | 552 | . '" title="' |
553 | - . esc_attr__( 'View Transaction', 'event_espresso' ) |
|
553 | + . esc_attr__('View Transaction', 'event_espresso') |
|
554 | 554 | . '"><span class="reg-pad-rght">' |
555 | 555 | . $txn_total |
556 | - . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>'; |
|
556 | + . '</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>'; |
|
557 | 557 | } else { |
558 | 558 | return '<span class="reg-pad-rght"></span>'; |
559 | 559 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | use ReflectionException; |
8 | 8 | |
9 | 9 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
10 | - exit('No direct script access allowed'); |
|
10 | + exit('No direct script access allowed'); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | |
@@ -25,53 +25,53 @@ discard block |
||
25 | 25 | |
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * @param Exception $exception |
|
30 | - * @throws Exception |
|
31 | - */ |
|
32 | - public function __construct(Exception $exception) |
|
33 | - { |
|
34 | - if (WP_DEBUG && ! defined('EE_TESTS_DIR')) { |
|
35 | - $this->displayException($exception); |
|
36 | - } else { |
|
37 | - throw $exception; |
|
38 | - } |
|
39 | - } |
|
28 | + /** |
|
29 | + * @param Exception $exception |
|
30 | + * @throws Exception |
|
31 | + */ |
|
32 | + public function __construct(Exception $exception) |
|
33 | + { |
|
34 | + if (WP_DEBUG && ! defined('EE_TESTS_DIR')) { |
|
35 | + $this->displayException($exception); |
|
36 | + } else { |
|
37 | + throw $exception; |
|
38 | + } |
|
39 | + } |
|
40 | 40 | |
41 | 41 | |
42 | 42 | |
43 | - /** |
|
44 | - * @access protected |
|
45 | - * @param Exception $exception |
|
46 | - * @throws ReflectionException |
|
47 | - */ |
|
48 | - protected function displayException(Exception $exception) |
|
49 | - { |
|
50 | - $error_code = ''; |
|
51 | - $trace_details = ''; |
|
52 | - $time = time(); |
|
53 | - $trace = $exception->getTrace(); |
|
54 | - // get separate user and developer messages if they exist |
|
55 | - $msg = explode('||', $exception->getMessage()); |
|
56 | - $user_msg = $msg[0]; |
|
57 | - $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
58 | - $msg = WP_DEBUG ? $dev_msg : $user_msg; |
|
59 | - // start gathering output |
|
60 | - $output = $this->exceptionStyles(); |
|
61 | - $output .= ' |
|
43 | + /** |
|
44 | + * @access protected |
|
45 | + * @param Exception $exception |
|
46 | + * @throws ReflectionException |
|
47 | + */ |
|
48 | + protected function displayException(Exception $exception) |
|
49 | + { |
|
50 | + $error_code = ''; |
|
51 | + $trace_details = ''; |
|
52 | + $time = time(); |
|
53 | + $trace = $exception->getTrace(); |
|
54 | + // get separate user and developer messages if they exist |
|
55 | + $msg = explode('||', $exception->getMessage()); |
|
56 | + $user_msg = $msg[0]; |
|
57 | + $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
58 | + $msg = WP_DEBUG ? $dev_msg : $user_msg; |
|
59 | + // start gathering output |
|
60 | + $output = $this->exceptionStyles(); |
|
61 | + $output .= ' |
|
62 | 62 | <div id="ee-error-message" class="error">'; |
63 | - if (! WP_DEBUG) { |
|
64 | - $output .= ' |
|
63 | + if (! WP_DEBUG) { |
|
64 | + $output .= ' |
|
65 | 65 | <p>'; |
66 | - } |
|
67 | - // process trace info |
|
68 | - if (empty($trace)) { |
|
69 | - $trace_details .= __( |
|
70 | - 'Sorry, but no trace information was available for this exception.', |
|
71 | - 'event_espresso' |
|
72 | - ); |
|
73 | - } else { |
|
74 | - $trace_details .= ' |
|
66 | + } |
|
67 | + // process trace info |
|
68 | + if (empty($trace)) { |
|
69 | + $trace_details .= __( |
|
70 | + 'Sorry, but no trace information was available for this exception.', |
|
71 | + 'event_espresso' |
|
72 | + ); |
|
73 | + } else { |
|
74 | + $trace_details .= ' |
|
75 | 75 | <div id="ee-trace-details"> |
76 | 76 | <table width="100%" border="0" cellpadding="5" cellspacing="0"> |
77 | 77 | <tr> |
@@ -79,255 +79,255 @@ discard block |
||
79 | 79 | <th scope="col" align="right" style="width:3.5%;">Line</th> |
80 | 80 | <th scope="col" align="left" style="width:40%;">File</th> |
81 | 81 | <th scope="col" align="left">' . __('Class', 'event_espresso') . '->' . __('Method( arguments )', |
82 | - 'event_espresso') . '</th> |
|
82 | + 'event_espresso') . '</th> |
|
83 | 83 | </tr>'; |
84 | - $last_on_stack = count($trace) - 1; |
|
85 | - // reverse array so that stack is in proper chronological order |
|
86 | - $sorted_trace = array_reverse($trace); |
|
87 | - foreach ($sorted_trace as $nmbr => $trace) { |
|
88 | - $file = isset($trace['file']) ? $trace['file'] : ''; |
|
89 | - $class = isset($trace['class']) ? $trace['class'] : ''; |
|
90 | - $type = isset($trace['type']) ? $trace['type'] : ''; |
|
91 | - $function = isset($trace['function']) ? $trace['function'] : ''; |
|
92 | - $args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : ''; |
|
93 | - $args = isset($trace['args']) && count($trace['args']) > 4 ? ' <br />' . $args . '<br />' : $args; |
|
94 | - $line = isset($trace['line']) ? $trace['line'] : ''; |
|
95 | - $zebra = $nmbr % 2 !== 0 ? ' odd' : ''; |
|
96 | - if (empty($file) && ! empty($class)) { |
|
97 | - $a = new ReflectionClass($class); |
|
98 | - $file = $a->getFileName(); |
|
99 | - if (empty($line) && ! empty($function)) { |
|
100 | - $b = new \ReflectionMethod($class, $function); |
|
101 | - $line = $b->getStartLine(); |
|
102 | - } |
|
103 | - } |
|
104 | - if ($nmbr === $last_on_stack) { |
|
105 | - $file = $exception->getFile() !== '' ? $exception->getFile() : $file; |
|
106 | - $line = $exception->getLine() !== '' ? $exception->getLine() : $line; |
|
107 | - $error_code = $this->generate_error_code($file, $trace['function'], $line); |
|
108 | - } |
|
109 | - $file = \EEH_File::standardise_directory_separators($file); |
|
110 | - $nmbr = ! empty($nmbr) ? $nmbr : ' '; |
|
111 | - $line = ! empty($line) ? $line : ' '; |
|
112 | - $file = ! empty($file) ? $file : ' '; |
|
113 | - $class_display = ! empty($class) ? $class : ''; |
|
114 | - $type = ! empty($type) ? $type : ''; |
|
115 | - $function = ! empty($function) ? $function : ''; |
|
116 | - $args = ! empty($args) ? '( ' . $args . ' )' : '()'; |
|
117 | - $trace_details .= ' |
|
84 | + $last_on_stack = count($trace) - 1; |
|
85 | + // reverse array so that stack is in proper chronological order |
|
86 | + $sorted_trace = array_reverse($trace); |
|
87 | + foreach ($sorted_trace as $nmbr => $trace) { |
|
88 | + $file = isset($trace['file']) ? $trace['file'] : ''; |
|
89 | + $class = isset($trace['class']) ? $trace['class'] : ''; |
|
90 | + $type = isset($trace['type']) ? $trace['type'] : ''; |
|
91 | + $function = isset($trace['function']) ? $trace['function'] : ''; |
|
92 | + $args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : ''; |
|
93 | + $args = isset($trace['args']) && count($trace['args']) > 4 ? ' <br />' . $args . '<br />' : $args; |
|
94 | + $line = isset($trace['line']) ? $trace['line'] : ''; |
|
95 | + $zebra = $nmbr % 2 !== 0 ? ' odd' : ''; |
|
96 | + if (empty($file) && ! empty($class)) { |
|
97 | + $a = new ReflectionClass($class); |
|
98 | + $file = $a->getFileName(); |
|
99 | + if (empty($line) && ! empty($function)) { |
|
100 | + $b = new \ReflectionMethod($class, $function); |
|
101 | + $line = $b->getStartLine(); |
|
102 | + } |
|
103 | + } |
|
104 | + if ($nmbr === $last_on_stack) { |
|
105 | + $file = $exception->getFile() !== '' ? $exception->getFile() : $file; |
|
106 | + $line = $exception->getLine() !== '' ? $exception->getLine() : $line; |
|
107 | + $error_code = $this->generate_error_code($file, $trace['function'], $line); |
|
108 | + } |
|
109 | + $file = \EEH_File::standardise_directory_separators($file); |
|
110 | + $nmbr = ! empty($nmbr) ? $nmbr : ' '; |
|
111 | + $line = ! empty($line) ? $line : ' '; |
|
112 | + $file = ! empty($file) ? $file : ' '; |
|
113 | + $class_display = ! empty($class) ? $class : ''; |
|
114 | + $type = ! empty($type) ? $type : ''; |
|
115 | + $function = ! empty($function) ? $function : ''; |
|
116 | + $args = ! empty($args) ? '( ' . $args . ' )' : '()'; |
|
117 | + $trace_details .= ' |
|
118 | 118 | <tr> |
119 | 119 | <td align="right" valign="top" class="' |
120 | - . $zebra |
|
121 | - . '">' |
|
122 | - . $nmbr |
|
123 | - . '</td> |
|
120 | + . $zebra |
|
121 | + . '">' |
|
122 | + . $nmbr |
|
123 | + . '</td> |
|
124 | 124 | <td align="right" valign="top" class="' |
125 | - . $zebra |
|
126 | - . '">' |
|
127 | - . $line |
|
128 | - . '</td> |
|
125 | + . $zebra |
|
126 | + . '">' |
|
127 | + . $line |
|
128 | + . '</td> |
|
129 | 129 | <td align="left" valign="top" class="' |
130 | - . $zebra |
|
131 | - . '">' |
|
132 | - . $file |
|
133 | - . '</td> |
|
130 | + . $zebra |
|
131 | + . '">' |
|
132 | + . $file |
|
133 | + . '</td> |
|
134 | 134 | <td align="left" valign="top" class="' |
135 | - . $zebra |
|
136 | - . '">' |
|
137 | - . $class_display |
|
138 | - . $type |
|
139 | - . $function |
|
140 | - . $args |
|
141 | - . '</td> |
|
135 | + . $zebra |
|
136 | + . '">' |
|
137 | + . $class_display |
|
138 | + . $type |
|
139 | + . $function |
|
140 | + . $args |
|
141 | + . '</td> |
|
142 | 142 | </tr>'; |
143 | - } |
|
144 | - $trace_details .= ' |
|
143 | + } |
|
144 | + $trace_details .= ' |
|
145 | 145 | </table> |
146 | 146 | </div>'; |
147 | - } |
|
148 | - $code = $exception->getCode() ? $exception->getCode() : $error_code; |
|
149 | - // add generic non-identifying messages for non-privileged users |
|
150 | - if (! WP_DEBUG) { |
|
151 | - $output .= '<span class="ee-error-user-msg-spn">' |
|
152 | - . trim($msg) |
|
153 | - . '</span> <sup>' |
|
154 | - . $code |
|
155 | - . '</sup><br />'; |
|
156 | - } else { |
|
157 | - // or helpful developer messages if debugging is on |
|
158 | - $output .= ' |
|
147 | + } |
|
148 | + $code = $exception->getCode() ? $exception->getCode() : $error_code; |
|
149 | + // add generic non-identifying messages for non-privileged users |
|
150 | + if (! WP_DEBUG) { |
|
151 | + $output .= '<span class="ee-error-user-msg-spn">' |
|
152 | + . trim($msg) |
|
153 | + . '</span> <sup>' |
|
154 | + . $code |
|
155 | + . '</sup><br />'; |
|
156 | + } else { |
|
157 | + // or helpful developer messages if debugging is on |
|
158 | + $output .= ' |
|
159 | 159 | <div class="ee-error-dev-msg-dv"> |
160 | 160 | <p class="ee-error-dev-msg-pg"> |
161 | 161 | ' |
162 | - . sprintf( |
|
163 | - __('%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso'), |
|
164 | - '<strong class="ee-error-dev-msg-str">', |
|
165 | - get_class($exception), |
|
166 | - '</strong> <span>', |
|
167 | - $code . '</span>' |
|
168 | - ) |
|
169 | - . '<br /> |
|
162 | + . sprintf( |
|
163 | + __('%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso'), |
|
164 | + '<strong class="ee-error-dev-msg-str">', |
|
165 | + get_class($exception), |
|
166 | + '</strong> <span>', |
|
167 | + $code . '</span>' |
|
168 | + ) |
|
169 | + . '<br /> |
|
170 | 170 | <span class="big-text">"' |
171 | - . trim($msg) |
|
172 | - . '"</span><br/> |
|
171 | + . trim($msg) |
|
172 | + . '"</span><br/> |
|
173 | 173 | <a id="display-ee-error-trace-1' |
174 | - . $time |
|
175 | - . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-1' |
|
176 | - . $time |
|
177 | - . '"> |
|
174 | + . $time |
|
175 | + . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-1' |
|
176 | + . $time |
|
177 | + . '"> |
|
178 | 178 | ' |
179 | - . __('click to view backtrace and class/method details', 'event_espresso') |
|
180 | - . ' |
|
179 | + . __('click to view backtrace and class/method details', 'event_espresso') |
|
180 | + . ' |
|
181 | 181 | </a><br /> |
182 | 182 | ' |
183 | - . $exception->getFile() |
|
184 | - . sprintf( |
|
185 | - __('%1$s( line no: %2$s )%3$s', 'event_espresso'), |
|
186 | - ' <span class="small-text lt-grey-text">', |
|
187 | - $exception->getLine(), |
|
188 | - '</span>' |
|
189 | - ) |
|
190 | - . ' |
|
183 | + . $exception->getFile() |
|
184 | + . sprintf( |
|
185 | + __('%1$s( line no: %2$s )%3$s', 'event_espresso'), |
|
186 | + ' <span class="small-text lt-grey-text">', |
|
187 | + $exception->getLine(), |
|
188 | + '</span>' |
|
189 | + ) |
|
190 | + . ' |
|
191 | 191 | </p> |
192 | 192 | <div id="ee-error-trace-1' |
193 | - . $time |
|
194 | - . '-dv" class="ee-error-trace-dv" style="display: none;"> |
|
193 | + . $time |
|
194 | + . '-dv" class="ee-error-trace-dv" style="display: none;"> |
|
195 | 195 | ' |
196 | - . $trace_details; |
|
197 | - if (! empty($class)) { |
|
198 | - $output .= ' |
|
196 | + . $trace_details; |
|
197 | + if (! empty($class)) { |
|
198 | + $output .= ' |
|
199 | 199 | <div style="padding:3px; margin:0 0 1em; border:1px solid #999; background:#fff; border-radius:3px;"> |
200 | 200 | <div style="padding:1em 2em; border:1px solid #999; background:#fcfcfc;"> |
201 | 201 | <h3>' . __('Class Details', 'event_espresso') . '</h3>'; |
202 | - $a = new ReflectionClass($class); |
|
203 | - $output .= ' |
|
202 | + $a = new ReflectionClass($class); |
|
203 | + $output .= ' |
|
204 | 204 | <pre>' . $a . '</pre> |
205 | 205 | </div> |
206 | 206 | </div>'; |
207 | - } |
|
208 | - $output .= ' |
|
207 | + } |
|
208 | + $output .= ' |
|
209 | 209 | </div> |
210 | 210 | </div> |
211 | 211 | <br />'; |
212 | - } |
|
213 | - // remove last linebreak |
|
214 | - $output = substr($output, 0, -6); |
|
215 | - if (! WP_DEBUG) { |
|
216 | - $output .= ' |
|
212 | + } |
|
213 | + // remove last linebreak |
|
214 | + $output = substr($output, 0, -6); |
|
215 | + if (! WP_DEBUG) { |
|
216 | + $output .= ' |
|
217 | 217 | </p>'; |
218 | - } |
|
219 | - $output .= ' |
|
218 | + } |
|
219 | + $output .= ' |
|
220 | 220 | </div>'; |
221 | - $output .= $this->printScripts(true); |
|
222 | - if (defined('DOING_AJAX')) { |
|
223 | - echo wp_json_encode(array('error' => $output)); |
|
224 | - exit(); |
|
225 | - } |
|
226 | - echo $output; |
|
227 | - } |
|
221 | + $output .= $this->printScripts(true); |
|
222 | + if (defined('DOING_AJAX')) { |
|
223 | + echo wp_json_encode(array('error' => $output)); |
|
224 | + exit(); |
|
225 | + } |
|
226 | + echo $output; |
|
227 | + } |
|
228 | 228 | |
229 | 229 | |
230 | 230 | |
231 | - /** |
|
232 | - * generate string from exception trace args |
|
233 | - * |
|
234 | - * @param array $arguments |
|
235 | - * @param int $indent |
|
236 | - * @param bool $array |
|
237 | - * @return string |
|
238 | - */ |
|
239 | - private function _convert_args_to_string($arguments = array(), $indent = 0, $array = false) |
|
240 | - { |
|
241 | - $args = array(); |
|
242 | - $args_count = count($arguments); |
|
243 | - if ($args_count > 2) { |
|
244 | - $indent++; |
|
245 | - $args[] = '<br />'; |
|
246 | - } |
|
247 | - $x = 0; |
|
248 | - foreach ($arguments as $arg) { |
|
249 | - $x++; |
|
250 | - for ($i = 0; $i < $indent; $i++) { |
|
251 | - $args[] = ' '; |
|
252 | - } |
|
253 | - if (is_string($arg)) { |
|
254 | - if (! $array && strlen($arg) > 75) { |
|
255 | - $args[] = '<br />'; |
|
256 | - for ($i = 0; $i <= $indent; $i++) { |
|
257 | - $args[] = ' '; |
|
258 | - } |
|
259 | - $args[] = "'" . $arg . "'<br />"; |
|
260 | - } else { |
|
261 | - $args[] = " '" . $arg . "'"; |
|
262 | - } |
|
263 | - } elseif (is_array($arg)) { |
|
264 | - $arg_count = count($arg); |
|
265 | - if ($arg_count > 2) { |
|
266 | - $indent++; |
|
267 | - $args[] = ' array(' . $this->_convert_args_to_string($arg, $indent, true) . ')'; |
|
268 | - $indent--; |
|
269 | - } else if ($arg_count === 0) { |
|
270 | - $args[] = ' array()'; |
|
271 | - } else { |
|
272 | - $args[] = ' array( ' . $this->_convert_args_to_string($arg) . ' )'; |
|
273 | - } |
|
274 | - } elseif ($arg === null) { |
|
275 | - $args[] = ' null'; |
|
276 | - } elseif (is_bool($arg)) { |
|
277 | - $args[] = $arg ? ' true' : ' false'; |
|
278 | - } elseif (is_object($arg)) { |
|
279 | - $args[] = get_class($arg); |
|
280 | - } elseif (is_resource($arg)) { |
|
281 | - $args[] = get_resource_type($arg); |
|
282 | - } else { |
|
283 | - $args[] = $arg; |
|
284 | - } |
|
285 | - if ($x === $args_count) { |
|
286 | - if ($args_count > 2) { |
|
287 | - $args[] = '<br />'; |
|
288 | - $indent--; |
|
289 | - for ($i = 1; $i < $indent; $i++) { |
|
290 | - $args[] = ' '; |
|
291 | - } |
|
292 | - } |
|
293 | - } else { |
|
294 | - $args[] = $args_count > 2 ? ',<br />' : ', '; |
|
295 | - } |
|
296 | - } |
|
297 | - return implode('', $args); |
|
298 | - } |
|
231 | + /** |
|
232 | + * generate string from exception trace args |
|
233 | + * |
|
234 | + * @param array $arguments |
|
235 | + * @param int $indent |
|
236 | + * @param bool $array |
|
237 | + * @return string |
|
238 | + */ |
|
239 | + private function _convert_args_to_string($arguments = array(), $indent = 0, $array = false) |
|
240 | + { |
|
241 | + $args = array(); |
|
242 | + $args_count = count($arguments); |
|
243 | + if ($args_count > 2) { |
|
244 | + $indent++; |
|
245 | + $args[] = '<br />'; |
|
246 | + } |
|
247 | + $x = 0; |
|
248 | + foreach ($arguments as $arg) { |
|
249 | + $x++; |
|
250 | + for ($i = 0; $i < $indent; $i++) { |
|
251 | + $args[] = ' '; |
|
252 | + } |
|
253 | + if (is_string($arg)) { |
|
254 | + if (! $array && strlen($arg) > 75) { |
|
255 | + $args[] = '<br />'; |
|
256 | + for ($i = 0; $i <= $indent; $i++) { |
|
257 | + $args[] = ' '; |
|
258 | + } |
|
259 | + $args[] = "'" . $arg . "'<br />"; |
|
260 | + } else { |
|
261 | + $args[] = " '" . $arg . "'"; |
|
262 | + } |
|
263 | + } elseif (is_array($arg)) { |
|
264 | + $arg_count = count($arg); |
|
265 | + if ($arg_count > 2) { |
|
266 | + $indent++; |
|
267 | + $args[] = ' array(' . $this->_convert_args_to_string($arg, $indent, true) . ')'; |
|
268 | + $indent--; |
|
269 | + } else if ($arg_count === 0) { |
|
270 | + $args[] = ' array()'; |
|
271 | + } else { |
|
272 | + $args[] = ' array( ' . $this->_convert_args_to_string($arg) . ' )'; |
|
273 | + } |
|
274 | + } elseif ($arg === null) { |
|
275 | + $args[] = ' null'; |
|
276 | + } elseif (is_bool($arg)) { |
|
277 | + $args[] = $arg ? ' true' : ' false'; |
|
278 | + } elseif (is_object($arg)) { |
|
279 | + $args[] = get_class($arg); |
|
280 | + } elseif (is_resource($arg)) { |
|
281 | + $args[] = get_resource_type($arg); |
|
282 | + } else { |
|
283 | + $args[] = $arg; |
|
284 | + } |
|
285 | + if ($x === $args_count) { |
|
286 | + if ($args_count > 2) { |
|
287 | + $args[] = '<br />'; |
|
288 | + $indent--; |
|
289 | + for ($i = 1; $i < $indent; $i++) { |
|
290 | + $args[] = ' '; |
|
291 | + } |
|
292 | + } |
|
293 | + } else { |
|
294 | + $args[] = $args_count > 2 ? ',<br />' : ', '; |
|
295 | + } |
|
296 | + } |
|
297 | + return implode('', $args); |
|
298 | + } |
|
299 | 299 | |
300 | 300 | |
301 | 301 | |
302 | - /** |
|
303 | - * create error code from filepath, function name, |
|
304 | - * and line number where exception or error was thrown |
|
305 | - * |
|
306 | - * @access protected |
|
307 | - * @param string $file |
|
308 | - * @param string $func |
|
309 | - * @param string $line |
|
310 | - * @return string |
|
311 | - */ |
|
312 | - protected function generate_error_code($file = '', $func = '', $line = '') |
|
313 | - { |
|
314 | - $file_bits = explode('.', basename($file)); |
|
315 | - $error_code = ! empty($file_bits[0]) ? $file_bits[0] : ''; |
|
316 | - $error_code .= ! empty($func) ? ' - ' . $func : ''; |
|
317 | - $error_code .= ! empty($line) ? ' - ' . $line : ''; |
|
318 | - return $error_code; |
|
319 | - } |
|
302 | + /** |
|
303 | + * create error code from filepath, function name, |
|
304 | + * and line number where exception or error was thrown |
|
305 | + * |
|
306 | + * @access protected |
|
307 | + * @param string $file |
|
308 | + * @param string $func |
|
309 | + * @param string $line |
|
310 | + * @return string |
|
311 | + */ |
|
312 | + protected function generate_error_code($file = '', $func = '', $line = '') |
|
313 | + { |
|
314 | + $file_bits = explode('.', basename($file)); |
|
315 | + $error_code = ! empty($file_bits[0]) ? $file_bits[0] : ''; |
|
316 | + $error_code .= ! empty($func) ? ' - ' . $func : ''; |
|
317 | + $error_code .= ! empty($line) ? ' - ' . $line : ''; |
|
318 | + return $error_code; |
|
319 | + } |
|
320 | 320 | |
321 | 321 | |
322 | 322 | |
323 | - /** |
|
324 | - * _exception_styles |
|
325 | - * |
|
326 | - * @return string |
|
327 | - */ |
|
328 | - private function exceptionStyles() |
|
329 | - { |
|
330 | - return ' |
|
323 | + /** |
|
324 | + * _exception_styles |
|
325 | + * |
|
326 | + * @return string |
|
327 | + */ |
|
328 | + private function exceptionStyles() |
|
329 | + { |
|
330 | + return ' |
|
331 | 331 | <style type="text/css"> |
332 | 332 | #ee-error-message { |
333 | 333 | max-width:90% !important; |
@@ -384,30 +384,30 @@ discard block |
||
384 | 384 | color: #999; |
385 | 385 | } |
386 | 386 | </style>'; |
387 | - } |
|
387 | + } |
|
388 | 388 | |
389 | 389 | |
390 | 390 | |
391 | - /** |
|
392 | - * _print_scripts |
|
393 | - * |
|
394 | - * @param bool $force_print |
|
395 | - * @return string |
|
396 | - */ |
|
397 | - private function printScripts($force_print = false) |
|
398 | - { |
|
399 | - if (! $force_print && (did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts'))) { |
|
400 | - if (wp_script_is('ee_error_js', 'enqueued')) { |
|
401 | - return ''; |
|
402 | - } |
|
403 | - if (wp_script_is('ee_error_js', 'registered')) { |
|
404 | - wp_enqueue_style('espresso_default'); |
|
405 | - wp_enqueue_style('espresso_custom_css'); |
|
406 | - wp_enqueue_script( 'ee_error_js' ); |
|
391 | + /** |
|
392 | + * _print_scripts |
|
393 | + * |
|
394 | + * @param bool $force_print |
|
395 | + * @return string |
|
396 | + */ |
|
397 | + private function printScripts($force_print = false) |
|
398 | + { |
|
399 | + if (! $force_print && (did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts'))) { |
|
400 | + if (wp_script_is('ee_error_js', 'enqueued')) { |
|
401 | + return ''; |
|
402 | + } |
|
403 | + if (wp_script_is('ee_error_js', 'registered')) { |
|
404 | + wp_enqueue_style('espresso_default'); |
|
405 | + wp_enqueue_style('espresso_custom_css'); |
|
406 | + wp_enqueue_script( 'ee_error_js' ); |
|
407 | 407 | wp_localize_script( 'ee_error_js', 'ee_settings', array( 'wp_debug' => WP_DEBUG ) ); |
408 | - } |
|
409 | - } else { |
|
410 | - return ' |
|
408 | + } |
|
409 | + } else { |
|
410 | + return ' |
|
411 | 411 | <script> |
412 | 412 | /* <![CDATA[ */ |
413 | 413 | var ee_settings = {"wp_debug":"' . WP_DEBUG . '"}; |
@@ -417,9 +417,9 @@ discard block |
||
417 | 417 | <script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
418 | 418 | <script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
419 | 419 | '; |
420 | - } |
|
421 | - return ''; |
|
422 | - } |
|
420 | + } |
|
421 | + return ''; |
|
422 | + } |
|
423 | 423 | |
424 | 424 | |
425 | 425 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | use ReflectionClass; |
7 | 7 | use ReflectionException; |
8 | 8 | |
9 | -if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
10 | 10 | exit('No direct script access allowed'); |
11 | 11 | } |
12 | 12 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $output = $this->exceptionStyles(); |
61 | 61 | $output .= ' |
62 | 62 | <div id="ee-error-message" class="error">'; |
63 | - if (! WP_DEBUG) { |
|
63 | + if ( ! WP_DEBUG) { |
|
64 | 64 | $output .= ' |
65 | 65 | <p>'; |
66 | 66 | } |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | <th scope="col" align="right" style="width:2.5%;">#</th> |
79 | 79 | <th scope="col" align="right" style="width:3.5%;">Line</th> |
80 | 80 | <th scope="col" align="left" style="width:40%;">File</th> |
81 | - <th scope="col" align="left">' . __('Class', 'event_espresso') . '->' . __('Method( arguments )', |
|
82 | - 'event_espresso') . '</th> |
|
81 | + <th scope="col" align="left">' . __('Class', 'event_espresso').'->'.__('Method( arguments )', |
|
82 | + 'event_espresso').'</th> |
|
83 | 83 | </tr>'; |
84 | 84 | $last_on_stack = count($trace) - 1; |
85 | 85 | // reverse array so that stack is in proper chronological order |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $type = isset($trace['type']) ? $trace['type'] : ''; |
91 | 91 | $function = isset($trace['function']) ? $trace['function'] : ''; |
92 | 92 | $args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : ''; |
93 | - $args = isset($trace['args']) && count($trace['args']) > 4 ? ' <br />' . $args . '<br />' : $args; |
|
93 | + $args = isset($trace['args']) && count($trace['args']) > 4 ? ' <br />'.$args.'<br />' : $args; |
|
94 | 94 | $line = isset($trace['line']) ? $trace['line'] : ''; |
95 | 95 | $zebra = $nmbr % 2 !== 0 ? ' odd' : ''; |
96 | 96 | if (empty($file) && ! empty($class)) { |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $class_display = ! empty($class) ? $class : ''; |
114 | 114 | $type = ! empty($type) ? $type : ''; |
115 | 115 | $function = ! empty($function) ? $function : ''; |
116 | - $args = ! empty($args) ? '( ' . $args . ' )' : '()'; |
|
116 | + $args = ! empty($args) ? '( '.$args.' )' : '()'; |
|
117 | 117 | $trace_details .= ' |
118 | 118 | <tr> |
119 | 119 | <td align="right" valign="top" class="' |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | $code = $exception->getCode() ? $exception->getCode() : $error_code; |
149 | 149 | // add generic non-identifying messages for non-privileged users |
150 | - if (! WP_DEBUG) { |
|
150 | + if ( ! WP_DEBUG) { |
|
151 | 151 | $output .= '<span class="ee-error-user-msg-spn">' |
152 | 152 | . trim($msg) |
153 | 153 | . '</span> <sup>' |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | '<strong class="ee-error-dev-msg-str">', |
165 | 165 | get_class($exception), |
166 | 166 | '</strong> <span>', |
167 | - $code . '</span>' |
|
167 | + $code.'</span>' |
|
168 | 168 | ) |
169 | 169 | . '<br /> |
170 | 170 | <span class="big-text">"' |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | . '-dv" class="ee-error-trace-dv" style="display: none;"> |
195 | 195 | ' |
196 | 196 | . $trace_details; |
197 | - if (! empty($class)) { |
|
197 | + if ( ! empty($class)) { |
|
198 | 198 | $output .= ' |
199 | 199 | <div style="padding:3px; margin:0 0 1em; border:1px solid #999; background:#fff; border-radius:3px;"> |
200 | 200 | <div style="padding:1em 2em; border:1px solid #999; background:#fcfcfc;"> |
201 | - <h3>' . __('Class Details', 'event_espresso') . '</h3>'; |
|
201 | + <h3>' . __('Class Details', 'event_espresso').'</h3>'; |
|
202 | 202 | $a = new ReflectionClass($class); |
203 | 203 | $output .= ' |
204 | - <pre>' . $a . '</pre> |
|
204 | + <pre>' . $a.'</pre> |
|
205 | 205 | </div> |
206 | 206 | </div>'; |
207 | 207 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | } |
213 | 213 | // remove last linebreak |
214 | 214 | $output = substr($output, 0, -6); |
215 | - if (! WP_DEBUG) { |
|
215 | + if ( ! WP_DEBUG) { |
|
216 | 216 | $output .= ' |
217 | 217 | </p>'; |
218 | 218 | } |
@@ -251,25 +251,25 @@ discard block |
||
251 | 251 | $args[] = ' '; |
252 | 252 | } |
253 | 253 | if (is_string($arg)) { |
254 | - if (! $array && strlen($arg) > 75) { |
|
254 | + if ( ! $array && strlen($arg) > 75) { |
|
255 | 255 | $args[] = '<br />'; |
256 | 256 | for ($i = 0; $i <= $indent; $i++) { |
257 | 257 | $args[] = ' '; |
258 | 258 | } |
259 | - $args[] = "'" . $arg . "'<br />"; |
|
259 | + $args[] = "'".$arg."'<br />"; |
|
260 | 260 | } else { |
261 | - $args[] = " '" . $arg . "'"; |
|
261 | + $args[] = " '".$arg."'"; |
|
262 | 262 | } |
263 | 263 | } elseif (is_array($arg)) { |
264 | 264 | $arg_count = count($arg); |
265 | 265 | if ($arg_count > 2) { |
266 | 266 | $indent++; |
267 | - $args[] = ' array(' . $this->_convert_args_to_string($arg, $indent, true) . ')'; |
|
267 | + $args[] = ' array('.$this->_convert_args_to_string($arg, $indent, true).')'; |
|
268 | 268 | $indent--; |
269 | 269 | } else if ($arg_count === 0) { |
270 | 270 | $args[] = ' array()'; |
271 | 271 | } else { |
272 | - $args[] = ' array( ' . $this->_convert_args_to_string($arg) . ' )'; |
|
272 | + $args[] = ' array( '.$this->_convert_args_to_string($arg).' )'; |
|
273 | 273 | } |
274 | 274 | } elseif ($arg === null) { |
275 | 275 | $args[] = ' null'; |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | { |
314 | 314 | $file_bits = explode('.', basename($file)); |
315 | 315 | $error_code = ! empty($file_bits[0]) ? $file_bits[0] : ''; |
316 | - $error_code .= ! empty($func) ? ' - ' . $func : ''; |
|
317 | - $error_code .= ! empty($line) ? ' - ' . $line : ''; |
|
316 | + $error_code .= ! empty($func) ? ' - '.$func : ''; |
|
317 | + $error_code .= ! empty($line) ? ' - '.$line : ''; |
|
318 | 318 | return $error_code; |
319 | 319 | } |
320 | 320 | |
@@ -396,26 +396,26 @@ discard block |
||
396 | 396 | */ |
397 | 397 | private function printScripts($force_print = false) |
398 | 398 | { |
399 | - if (! $force_print && (did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts'))) { |
|
399 | + if ( ! $force_print && (did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts'))) { |
|
400 | 400 | if (wp_script_is('ee_error_js', 'enqueued')) { |
401 | 401 | return ''; |
402 | 402 | } |
403 | 403 | if (wp_script_is('ee_error_js', 'registered')) { |
404 | 404 | wp_enqueue_style('espresso_default'); |
405 | 405 | wp_enqueue_style('espresso_custom_css'); |
406 | - wp_enqueue_script( 'ee_error_js' ); |
|
407 | - wp_localize_script( 'ee_error_js', 'ee_settings', array( 'wp_debug' => WP_DEBUG ) ); |
|
406 | + wp_enqueue_script('ee_error_js'); |
|
407 | + wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug' => WP_DEBUG)); |
|
408 | 408 | } |
409 | 409 | } else { |
410 | 410 | return ' |
411 | 411 | <script> |
412 | 412 | /* <![CDATA[ */ |
413 | -var ee_settings = {"wp_debug":"' . WP_DEBUG . '"}; |
|
413 | +var ee_settings = {"wp_debug":"' . WP_DEBUG.'"}; |
|
414 | 414 | /* ]]> */ |
415 | 415 | </script> |
416 | -<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script> |
|
417 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
418 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
416 | +<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script> |
|
417 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
418 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
419 | 419 | '; |
420 | 420 | } |
421 | 421 | return ''; |
@@ -151,7 +151,7 @@ |
||
151 | 151 | * This provides a count of events using this custom template |
152 | 152 | * |
153 | 153 | * @param EE_Message_Template_Group $item message_template group data |
154 | - * @return string column output |
|
154 | + * @return integer column output |
|
155 | 155 | */ |
156 | 156 | public function column_events($item) |
157 | 157 | { |
@@ -12,246 +12,246 @@ |
||
12 | 12 | class Custom_Messages_Template_List_Table extends Messages_Template_List_Table |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Setup initial data. |
|
17 | - */ |
|
18 | - protected function _setup_data() |
|
19 | - { |
|
20 | - $this->_data = $this->get_admin_page()->get_message_templates( |
|
21 | - $this->_per_page, |
|
22 | - $this->_view, |
|
23 | - false, |
|
24 | - false, |
|
25 | - false |
|
26 | - ); |
|
27 | - $this->_all_data_count = $this->get_admin_page()->get_message_templates( |
|
28 | - $this->_per_page, |
|
29 | - $this->_view, |
|
30 | - true, |
|
31 | - true, |
|
32 | - false |
|
33 | - ); |
|
34 | - } |
|
15 | + /** |
|
16 | + * Setup initial data. |
|
17 | + */ |
|
18 | + protected function _setup_data() |
|
19 | + { |
|
20 | + $this->_data = $this->get_admin_page()->get_message_templates( |
|
21 | + $this->_per_page, |
|
22 | + $this->_view, |
|
23 | + false, |
|
24 | + false, |
|
25 | + false |
|
26 | + ); |
|
27 | + $this->_all_data_count = $this->get_admin_page()->get_message_templates( |
|
28 | + $this->_per_page, |
|
29 | + $this->_view, |
|
30 | + true, |
|
31 | + true, |
|
32 | + false |
|
33 | + ); |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * Set initial properties |
|
39 | - */ |
|
40 | - protected function _set_properties() |
|
41 | - { |
|
42 | - parent::_set_properties(); |
|
43 | - $this->_wp_list_args = array( |
|
44 | - 'singular' => esc_html__('Message Template Group', 'event_espresso'), |
|
45 | - 'plural' => esc_html__('Message Template', 'event_espresso'), |
|
46 | - 'ajax' => true, //for now, |
|
47 | - 'screen' => $this->get_admin_page()->get_current_screen()->id, |
|
48 | - ); |
|
37 | + /** |
|
38 | + * Set initial properties |
|
39 | + */ |
|
40 | + protected function _set_properties() |
|
41 | + { |
|
42 | + parent::_set_properties(); |
|
43 | + $this->_wp_list_args = array( |
|
44 | + 'singular' => esc_html__('Message Template Group', 'event_espresso'), |
|
45 | + 'plural' => esc_html__('Message Template', 'event_espresso'), |
|
46 | + 'ajax' => true, //for now, |
|
47 | + 'screen' => $this->get_admin_page()->get_current_screen()->id, |
|
48 | + ); |
|
49 | 49 | |
50 | - $this->_columns = array_merge( |
|
51 | - array( |
|
52 | - 'cb' => '<input type="checkbox" />', |
|
53 | - 'name' => esc_html__('Template Name', 'event_espresso'), |
|
54 | - ), |
|
55 | - $this->_columns, |
|
56 | - array( |
|
57 | - 'events' => esc_html__('Events', 'event_espresso'), |
|
58 | - 'actions' => '' |
|
59 | - ) |
|
60 | - ); |
|
61 | - } |
|
50 | + $this->_columns = array_merge( |
|
51 | + array( |
|
52 | + 'cb' => '<input type="checkbox" />', |
|
53 | + 'name' => esc_html__('Template Name', 'event_espresso'), |
|
54 | + ), |
|
55 | + $this->_columns, |
|
56 | + array( |
|
57 | + 'events' => esc_html__('Events', 'event_espresso'), |
|
58 | + 'actions' => '' |
|
59 | + ) |
|
60 | + ); |
|
61 | + } |
|
62 | 62 | |
63 | 63 | |
64 | - /** |
|
65 | - * Custom message for when there are no items found. |
|
66 | - * |
|
67 | - * @since 4.3.0 |
|
68 | - */ |
|
69 | - public function no_items() |
|
70 | - { |
|
71 | - if ($this->_view !== 'trashed') { |
|
72 | - printf( |
|
73 | - esc_html__( |
|
74 | - '%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', |
|
75 | - 'event_espresso' |
|
76 | - ), |
|
77 | - '<strong>', |
|
78 | - '</strong>' |
|
79 | - ); |
|
80 | - } else { |
|
81 | - parent::no_items(); |
|
82 | - } |
|
83 | - } |
|
64 | + /** |
|
65 | + * Custom message for when there are no items found. |
|
66 | + * |
|
67 | + * @since 4.3.0 |
|
68 | + */ |
|
69 | + public function no_items() |
|
70 | + { |
|
71 | + if ($this->_view !== 'trashed') { |
|
72 | + printf( |
|
73 | + esc_html__( |
|
74 | + '%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', |
|
75 | + 'event_espresso' |
|
76 | + ), |
|
77 | + '<strong>', |
|
78 | + '</strong>' |
|
79 | + ); |
|
80 | + } else { |
|
81 | + parent::no_items(); |
|
82 | + } |
|
83 | + } |
|
84 | 84 | |
85 | 85 | |
86 | - /** |
|
87 | - * @param EE_Message_Template_Group $item |
|
88 | - * @return string |
|
89 | - */ |
|
90 | - public function column_cb($item) |
|
91 | - { |
|
92 | - return sprintf('<input type="checkbox" name="checkbox[%s]" value="1" />', $item->GRP_ID()); |
|
93 | - } |
|
86 | + /** |
|
87 | + * @param EE_Message_Template_Group $item |
|
88 | + * @return string |
|
89 | + */ |
|
90 | + public function column_cb($item) |
|
91 | + { |
|
92 | + return sprintf('<input type="checkbox" name="checkbox[%s]" value="1" />', $item->GRP_ID()); |
|
93 | + } |
|
94 | 94 | |
95 | 95 | |
96 | - /** |
|
97 | - * @param EE_Message_Template_Group $item |
|
98 | - * @return string |
|
99 | - */ |
|
100 | - public function column_name($item) |
|
101 | - { |
|
102 | - return '<p>' . $item->name() . '</p>'; |
|
103 | - } |
|
96 | + /** |
|
97 | + * @param EE_Message_Template_Group $item |
|
98 | + * @return string |
|
99 | + */ |
|
100 | + public function column_name($item) |
|
101 | + { |
|
102 | + return '<p>' . $item->name() . '</p>'; |
|
103 | + } |
|
104 | 104 | |
105 | 105 | |
106 | - /** |
|
107 | - * @param EE_Message_Template_Group $item |
|
108 | - * @return string |
|
109 | - */ |
|
110 | - public function column_actions($item) |
|
111 | - { |
|
112 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
113 | - 'ee_edit_messages', |
|
114 | - 'espresso_messages_add_new_message_template' |
|
115 | - )) { |
|
116 | - $create_args = array( |
|
117 | - 'GRP_ID' => $item->ID(), |
|
118 | - 'messenger' => $item->messenger(), |
|
119 | - 'message_type' => $item->message_type(), |
|
120 | - 'action' => 'add_new_message_template', |
|
121 | - ); |
|
122 | - $create_link = EE_Admin_Page::add_query_args_and_nonce($create_args, EE_MSG_ADMIN_URL); |
|
123 | - return sprintf( |
|
124 | - '<p><a href="%s" class="button button-small">%s</a></p>', |
|
125 | - $create_link, |
|
126 | - esc_html__('Create Custom', 'event_espresso') |
|
127 | - ); |
|
128 | - } |
|
129 | - return ''; |
|
130 | - } |
|
106 | + /** |
|
107 | + * @param EE_Message_Template_Group $item |
|
108 | + * @return string |
|
109 | + */ |
|
110 | + public function column_actions($item) |
|
111 | + { |
|
112 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
113 | + 'ee_edit_messages', |
|
114 | + 'espresso_messages_add_new_message_template' |
|
115 | + )) { |
|
116 | + $create_args = array( |
|
117 | + 'GRP_ID' => $item->ID(), |
|
118 | + 'messenger' => $item->messenger(), |
|
119 | + 'message_type' => $item->message_type(), |
|
120 | + 'action' => 'add_new_message_template', |
|
121 | + ); |
|
122 | + $create_link = EE_Admin_Page::add_query_args_and_nonce($create_args, EE_MSG_ADMIN_URL); |
|
123 | + return sprintf( |
|
124 | + '<p><a href="%s" class="button button-small">%s</a></p>', |
|
125 | + $create_link, |
|
126 | + esc_html__('Create Custom', 'event_espresso') |
|
127 | + ); |
|
128 | + } |
|
129 | + return ''; |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
133 | - * Set the view counts on the _views property |
|
134 | - */ |
|
135 | - protected function _add_view_counts() |
|
136 | - { |
|
137 | - foreach ($this->_views as $view => $args) { |
|
138 | - $this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates( |
|
139 | - $this->_per_page, |
|
140 | - $view, |
|
141 | - true, |
|
142 | - true, |
|
143 | - false |
|
144 | - ); |
|
145 | - } |
|
146 | - } |
|
132 | + /** |
|
133 | + * Set the view counts on the _views property |
|
134 | + */ |
|
135 | + protected function _add_view_counts() |
|
136 | + { |
|
137 | + foreach ($this->_views as $view => $args) { |
|
138 | + $this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates( |
|
139 | + $this->_per_page, |
|
140 | + $view, |
|
141 | + true, |
|
142 | + true, |
|
143 | + false |
|
144 | + ); |
|
145 | + } |
|
146 | + } |
|
147 | 147 | |
148 | 148 | |
149 | - /** |
|
150 | - * column_events |
|
151 | - * This provides a count of events using this custom template |
|
152 | - * |
|
153 | - * @param EE_Message_Template_Group $item message_template group data |
|
154 | - * @return string column output |
|
155 | - */ |
|
156 | - public function column_events($item) |
|
157 | - { |
|
158 | - return $item->count_events(); |
|
159 | - } |
|
149 | + /** |
|
150 | + * column_events |
|
151 | + * This provides a count of events using this custom template |
|
152 | + * |
|
153 | + * @param EE_Message_Template_Group $item message_template group data |
|
154 | + * @return string column output |
|
155 | + */ |
|
156 | + public function column_events($item) |
|
157 | + { |
|
158 | + return $item->count_events(); |
|
159 | + } |
|
160 | 160 | |
161 | 161 | |
162 | - /** |
|
163 | - * Add additional actions for custom message template list view. |
|
164 | - * @param EE_Message_Template_Group $item |
|
165 | - * @return array |
|
166 | - * @throws EE_Error |
|
167 | - */ |
|
168 | - protected function _get_actions_for_messenger_column(EE_Message_Template_Group $item) |
|
169 | - { |
|
170 | - $actions = parent::_get_actions_for_messenger_column($item); |
|
162 | + /** |
|
163 | + * Add additional actions for custom message template list view. |
|
164 | + * @param EE_Message_Template_Group $item |
|
165 | + * @return array |
|
166 | + * @throws EE_Error |
|
167 | + */ |
|
168 | + protected function _get_actions_for_messenger_column(EE_Message_Template_Group $item) |
|
169 | + { |
|
170 | + $actions = parent::_get_actions_for_messenger_column($item); |
|
171 | 171 | |
172 | - //add additional actions for trash/restore etc. |
|
173 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'trash_message_template', |
|
174 | - 'id' => $item->GRP_ID(), |
|
175 | - 'noheader' => true, |
|
176 | - ), EE_MSG_ADMIN_URL); |
|
177 | - // restore link |
|
178 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'restore_message_template', |
|
179 | - 'id' => $item->GRP_ID(), |
|
180 | - 'noheader' => true, |
|
181 | - ), EE_MSG_ADMIN_URL); |
|
182 | - // delete price link |
|
183 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'delete_message_template', |
|
184 | - 'id' => $item->GRP_ID(), |
|
185 | - 'noheader' => true, |
|
186 | - ), EE_MSG_ADMIN_URL); |
|
172 | + //add additional actions for trash/restore etc. |
|
173 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'trash_message_template', |
|
174 | + 'id' => $item->GRP_ID(), |
|
175 | + 'noheader' => true, |
|
176 | + ), EE_MSG_ADMIN_URL); |
|
177 | + // restore link |
|
178 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'restore_message_template', |
|
179 | + 'id' => $item->GRP_ID(), |
|
180 | + 'noheader' => true, |
|
181 | + ), EE_MSG_ADMIN_URL); |
|
182 | + // delete price link |
|
183 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'delete_message_template', |
|
184 | + 'id' => $item->GRP_ID(), |
|
185 | + 'noheader' => true, |
|
186 | + ), EE_MSG_ADMIN_URL); |
|
187 | 187 | |
188 | - if (! $item->get('MTP_deleted') |
|
189 | - && EE_Registry::instance()->CAP->current_user_can( |
|
190 | - 'ee_delete_message', |
|
191 | - 'espresso_messages_trash_message_template', |
|
192 | - $item->ID() |
|
193 | - ) |
|
194 | - ) { |
|
195 | - $actions['trash'] = '<a href="' |
|
196 | - . $trash_lnk_url |
|
197 | - . '" title="' |
|
198 | - . esc_attr__('Move Template Group to Trash', 'event_espresso') |
|
199 | - . '">' |
|
200 | - . esc_html__('Move to Trash', 'event_espresso') |
|
201 | - . '</a>'; |
|
202 | - } else { |
|
203 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
204 | - 'ee_delete_message', |
|
205 | - 'espresso_messages_restore_message_template', |
|
206 | - $item->ID() |
|
207 | - )) { |
|
208 | - $actions['restore'] = '<a href="' |
|
209 | - . $restore_lnk_url |
|
210 | - . '" title="' |
|
211 | - . esc_attr__('Restore Message Template', 'event_espresso') |
|
212 | - . '">' |
|
213 | - . esc_html__('Restore', 'event_espresso') . '</a>'; |
|
214 | - } |
|
188 | + if (! $item->get('MTP_deleted') |
|
189 | + && EE_Registry::instance()->CAP->current_user_can( |
|
190 | + 'ee_delete_message', |
|
191 | + 'espresso_messages_trash_message_template', |
|
192 | + $item->ID() |
|
193 | + ) |
|
194 | + ) { |
|
195 | + $actions['trash'] = '<a href="' |
|
196 | + . $trash_lnk_url |
|
197 | + . '" title="' |
|
198 | + . esc_attr__('Move Template Group to Trash', 'event_espresso') |
|
199 | + . '">' |
|
200 | + . esc_html__('Move to Trash', 'event_espresso') |
|
201 | + . '</a>'; |
|
202 | + } else { |
|
203 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
204 | + 'ee_delete_message', |
|
205 | + 'espresso_messages_restore_message_template', |
|
206 | + $item->ID() |
|
207 | + )) { |
|
208 | + $actions['restore'] = '<a href="' |
|
209 | + . $restore_lnk_url |
|
210 | + . '" title="' |
|
211 | + . esc_attr__('Restore Message Template', 'event_espresso') |
|
212 | + . '">' |
|
213 | + . esc_html__('Restore', 'event_espresso') . '</a>'; |
|
214 | + } |
|
215 | 215 | |
216 | - if ($this->_view === 'trashed' |
|
217 | - && EE_Registry::instance()->CAP->current_user_can( |
|
218 | - 'ee_delete_message', |
|
219 | - 'espresso_messages_delete_message_template', |
|
220 | - $item->ID() |
|
221 | - )) { |
|
222 | - $actions['delete'] = '<a href="' |
|
223 | - . $delete_lnk_url |
|
224 | - . '" title="' |
|
225 | - . esc_attr__('Delete Template Group Permanently', 'event_espresso') |
|
226 | - . '">' |
|
227 | - . esc_html__('Delete Permanently', 'event_espresso') |
|
228 | - . '</a>'; |
|
229 | - } |
|
230 | - } |
|
231 | - return $actions; |
|
232 | - } |
|
216 | + if ($this->_view === 'trashed' |
|
217 | + && EE_Registry::instance()->CAP->current_user_can( |
|
218 | + 'ee_delete_message', |
|
219 | + 'espresso_messages_delete_message_template', |
|
220 | + $item->ID() |
|
221 | + )) { |
|
222 | + $actions['delete'] = '<a href="' |
|
223 | + . $delete_lnk_url |
|
224 | + . '" title="' |
|
225 | + . esc_attr__('Delete Template Group Permanently', 'event_espresso') |
|
226 | + . '">' |
|
227 | + . esc_html__('Delete Permanently', 'event_espresso') |
|
228 | + . '</a>'; |
|
229 | + } |
|
230 | + } |
|
231 | + return $actions; |
|
232 | + } |
|
233 | 233 | |
234 | 234 | |
235 | - /** |
|
236 | - * Generate dropdown filter select input for messengers |
|
237 | - * @param bool $global |
|
238 | - * @return string |
|
239 | - * @throws EE_Error |
|
240 | - */ |
|
241 | - protected function _get_messengers_dropdown_filter($global = true) |
|
242 | - { |
|
243 | - return parent::_get_messengers_dropdown_filter(false); |
|
244 | - } |
|
235 | + /** |
|
236 | + * Generate dropdown filter select input for messengers |
|
237 | + * @param bool $global |
|
238 | + * @return string |
|
239 | + * @throws EE_Error |
|
240 | + */ |
|
241 | + protected function _get_messengers_dropdown_filter($global = true) |
|
242 | + { |
|
243 | + return parent::_get_messengers_dropdown_filter(false); |
|
244 | + } |
|
245 | 245 | |
246 | 246 | |
247 | - /** |
|
248 | - * Generate dropdown filter select input for message types |
|
249 | - * @param bool $global |
|
250 | - * @return string |
|
251 | - * @throws EE_Error |
|
252 | - */ |
|
253 | - protected function _get_message_types_dropdown_filter($global = true) |
|
254 | - { |
|
255 | - return parent::_get_message_types_dropdown_filter(false); |
|
256 | - } |
|
247 | + /** |
|
248 | + * Generate dropdown filter select input for message types |
|
249 | + * @param bool $global |
|
250 | + * @return string |
|
251 | + * @throws EE_Error |
|
252 | + */ |
|
253 | + protected function _get_message_types_dropdown_filter($global = true) |
|
254 | + { |
|
255 | + return parent::_get_message_types_dropdown_filter(false); |
|
256 | + } |
|
257 | 257 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | protected function _setup_data() |
19 | 19 | { |
20 | - $this->_data = $this->get_admin_page()->get_message_templates( |
|
20 | + $this->_data = $this->get_admin_page()->get_message_templates( |
|
21 | 21 | $this->_per_page, |
22 | 22 | $this->_view, |
23 | 23 | false, |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function column_name($item) |
101 | 101 | { |
102 | - return '<p>' . $item->name() . '</p>'; |
|
102 | + return '<p>'.$item->name().'</p>'; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | 'noheader' => true, |
186 | 186 | ), EE_MSG_ADMIN_URL); |
187 | 187 | |
188 | - if (! $item->get('MTP_deleted') |
|
188 | + if ( ! $item->get('MTP_deleted') |
|
189 | 189 | && EE_Registry::instance()->CAP->current_user_can( |
190 | 190 | 'ee_delete_message', |
191 | 191 | 'espresso_messages_trash_message_template', |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | . '" title="' |
211 | 211 | . esc_attr__('Restore Message Template', 'event_espresso') |
212 | 212 | . '">' |
213 | - . esc_html__('Restore', 'event_espresso') . '</a>'; |
|
213 | + . esc_html__('Restore', 'event_espresso').'</a>'; |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | if ($this->_view === 'trashed' |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | protected function _setup_data() |
29 | 29 | { |
30 | - $this->_data = $this->get_admin_page()->get_message_templates( |
|
30 | + $this->_data = $this->get_admin_page()->get_message_templates( |
|
31 | 31 | $this->_per_page, |
32 | 32 | $this->_view, |
33 | 33 | false |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | 'ajax' => true, //for now, |
53 | 53 | 'screen' => $this->get_admin_page()->get_current_screen()->id, |
54 | 54 | ); |
55 | - $this->_columns = array( |
|
55 | + $this->_columns = array( |
|
56 | 56 | //'cb' => '<input type="checkbox" />', //no deleting default (global) templates! |
57 | 57 | 'message_type' => esc_html__('Message Type', 'event_espresso'), |
58 | 58 | 'messenger' => esc_html__('Messenger', 'event_espresso'), |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $message_type = $item->message_type_obj(); |
81 | 81 | $messenger = $item->messenger_obj(); |
82 | 82 | |
83 | - if (! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) { |
|
83 | + if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) { |
|
84 | 84 | echo ''; |
85 | 85 | return; |
86 | 86 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function column_description($item) |
158 | 158 | { |
159 | - return '<p>' . $item->message_type_obj()->description . '</p>'; |
|
159 | + return '<p>'.$item->message_type_obj()->description.'</p>'; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | { |
269 | 269 | $edit_url = ''; |
270 | 270 | // edit link but only if item isn't trashed. |
271 | - if (! $item->get('MTP_deleted') |
|
271 | + if ( ! $item->get('MTP_deleted') |
|
272 | 272 | && EE_Registry::instance()->CAP->current_user_can( |
273 | 273 | 'ee_edit_message', |
274 | 274 | 'espresso_messages_edit_message_template', |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | protected function _get_context_links(EE_Message_Template_Group $item) |
296 | 296 | { |
297 | 297 | //first check if we even show the context links or not. |
298 | - if (! EE_Registry::instance()->CAP->current_user_can( |
|
298 | + if ( ! EE_Registry::instance()->CAP->current_user_can( |
|
299 | 299 | 'ee_edit_message', |
300 | 300 | 'espresso_messages_edit_message_template', |
301 | 301 | $item->ID() |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | && $context_templates[$context]['to'] instanceof EE_Message_Template |
315 | 315 | ? $context_templates[$context]['to']->get('MTP_content') |
316 | 316 | : null; |
317 | - $inactive = empty($mtp_to) |
|
317 | + $inactive = empty($mtp_to) |
|
318 | 318 | && ! empty($context_templates[$context]['to']) |
319 | 319 | ? ' class="mtp-inactive"' |
320 | 320 | : ''; |
@@ -324,15 +324,15 @@ discard block |
||
324 | 324 | 'id' => $item->GRP_ID(), |
325 | 325 | 'context' => $context, |
326 | 326 | ), EE_MSG_ADMIN_URL); |
327 | - $ctxt[] = '<a' . $inactive |
|
328 | - . ' href="' . $edit_link . '"' |
|
329 | - . ' class="' . $item->message_type() . '-' . $context . '-edit-link"' |
|
330 | - . ' title="' . esc_attr__('Edit Context', 'event_espresso') . '">' |
|
327 | + $ctxt[] = '<a'.$inactive |
|
328 | + . ' href="'.$edit_link.'"' |
|
329 | + . ' class="'.$item->message_type().'-'.$context.'-edit-link"' |
|
330 | + . ' title="'.esc_attr__('Edit Context', 'event_espresso').'">' |
|
331 | 331 | . $context_title |
332 | 332 | . '</a>'; |
333 | 333 | } |
334 | 334 | |
335 | - return sprintf('<strong>%s:</strong> ', ucwords($c_label['plural'])) . implode(' | ', $ctxt); |
|
335 | + return sprintf('<strong>%s:</strong> ', ucwords($c_label['plural'])).implode(' | ', $ctxt); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | |
@@ -346,8 +346,8 @@ discard block |
||
346 | 346 | { |
347 | 347 | $edit_url = $this->_get_edit_url($item); |
348 | 348 | return $edit_url |
349 | - ? '<a href="' . $edit_url . '"' |
|
350 | - . ' title="' . esc_attr__('Edit Template Group', 'event_espresso') . '">' |
|
349 | + ? '<a href="'.$edit_url.'"' |
|
350 | + . ' title="'.esc_attr__('Edit Template Group', 'event_espresso').'">' |
|
351 | 351 | . ucwords($item->messenger_obj()->label['singular']) |
352 | 352 | . '</a>' |
353 | 353 | : ucwords($item->messenger_obj()->label['singular']); |
@@ -365,9 +365,9 @@ discard block |
||
365 | 365 | $actions = array(); |
366 | 366 | if ($edit_url = $this->_get_edit_url($item)) { |
367 | 367 | $actions = array( |
368 | - 'edit' => '<a href="' . $edit_url . '"' |
|
369 | - . ' class="' . $item->message_type() . '-edit-link"' |
|
370 | - . ' title="' . esc_attr__('Edit Template Group', 'event_espresso') . '">' |
|
368 | + 'edit' => '<a href="'.$edit_url.'"' |
|
369 | + . ' class="'.$item->message_type().'-edit-link"' |
|
370 | + . ' title="'.esc_attr__('Edit Template Group', 'event_espresso').'">' |
|
371 | 371 | . esc_html__('Edit', 'event_espresso') |
372 | 372 | . '</a>' |
373 | 373 | ); |
@@ -13,370 +13,370 @@ |
||
13 | 13 | { |
14 | 14 | |
15 | 15 | |
16 | - /** |
|
17 | - * @return Messages_Admin_Page |
|
18 | - */ |
|
19 | - public function get_admin_page() |
|
20 | - { |
|
21 | - return $this->_admin_page; |
|
22 | - } |
|
23 | - |
|
24 | - |
|
25 | - /** |
|
26 | - * Setup data object |
|
27 | - */ |
|
28 | - protected function _setup_data() |
|
29 | - { |
|
30 | - $this->_data = $this->get_admin_page()->get_message_templates( |
|
31 | - $this->_per_page, |
|
32 | - $this->_view, |
|
33 | - false |
|
34 | - ); |
|
35 | - $this->_all_data_count = $this->get_admin_page()->get_message_templates( |
|
36 | - $this->_per_page, |
|
37 | - $this->_view, |
|
38 | - true, |
|
39 | - true |
|
40 | - ); |
|
41 | - } |
|
42 | - |
|
43 | - |
|
44 | - /** |
|
45 | - * Set internal properties |
|
46 | - */ |
|
47 | - protected function _set_properties() |
|
48 | - { |
|
49 | - $this->_wp_list_args = array( |
|
50 | - 'singular' => esc_html__('Message Template Group', 'event_espresso'), |
|
51 | - 'plural' => esc_html__('Message Template', 'event_espresso'), |
|
52 | - 'ajax' => true, //for now, |
|
53 | - 'screen' => $this->get_admin_page()->get_current_screen()->id, |
|
54 | - ); |
|
55 | - $this->_columns = array( |
|
56 | - //'cb' => '<input type="checkbox" />', //no deleting default (global) templates! |
|
57 | - 'message_type' => esc_html__('Message Type', 'event_espresso'), |
|
58 | - 'messenger' => esc_html__('Messenger', 'event_espresso'), |
|
59 | - 'description' => esc_html__('Description', 'event_espresso'), |
|
60 | - ); |
|
61 | - |
|
62 | - $this->_sortable_columns = array( |
|
63 | - 'messenger' => array('MTP_messenger' => true), |
|
64 | - ); |
|
65 | - |
|
66 | - $this->_hidden_columns = array(); |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * Overriding the single_row method from parent to verify whether the $item has an accessible |
|
72 | - * message_type or messenger object before generating the row. |
|
73 | - * |
|
74 | - * @param EE_Message_Template_Group $item |
|
75 | - * @return string |
|
76 | - * @throws EE_Error |
|
77 | - */ |
|
78 | - public function single_row($item) |
|
79 | - { |
|
80 | - $message_type = $item->message_type_obj(); |
|
81 | - $messenger = $item->messenger_obj(); |
|
82 | - |
|
83 | - if (! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) { |
|
84 | - echo ''; |
|
85 | - return; |
|
86 | - } |
|
87 | - |
|
88 | - parent::single_row($item); |
|
89 | - } |
|
90 | - |
|
91 | - |
|
92 | - /** |
|
93 | - * @return array |
|
94 | - * @throws EE_Error |
|
95 | - */ |
|
96 | - protected function _get_table_filters() |
|
97 | - { |
|
98 | - $filters = array(); |
|
99 | - |
|
100 | - //get select inputs |
|
101 | - $select_inputs = array( |
|
102 | - $this->_get_messengers_dropdown_filter(), |
|
103 | - $this->_get_message_types_dropdown_filter(), |
|
104 | - ); |
|
105 | - |
|
106 | - //set filters to select inputs if they aren't empty |
|
107 | - foreach ($select_inputs as $select_input) { |
|
108 | - if ($select_input) { |
|
109 | - $filters[] = $select_input; |
|
110 | - } |
|
111 | - } |
|
112 | - return $filters; |
|
113 | - } |
|
114 | - |
|
115 | - /** |
|
116 | - * We're just removing the search box for message templates, not needed. |
|
117 | - * |
|
118 | - * @param string $text |
|
119 | - * @param string $input_id |
|
120 | - * @return string ; |
|
121 | - */ |
|
122 | - public function search_box($text, $input_id) |
|
123 | - { |
|
124 | - return ''; |
|
125 | - } |
|
126 | - |
|
127 | - |
|
128 | - /** |
|
129 | - * Add counts to the _views property |
|
130 | - */ |
|
131 | - protected function _add_view_counts() |
|
132 | - { |
|
133 | - foreach ($this->_views as $view => $args) { |
|
134 | - $this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates( |
|
135 | - $this->_per_page, |
|
136 | - $view, |
|
137 | - true, |
|
138 | - true |
|
139 | - ); |
|
140 | - } |
|
141 | - } |
|
142 | - |
|
143 | - |
|
144 | - /** |
|
145 | - * @param EE_Message_Template_Group $item |
|
146 | - * @return string |
|
147 | - */ |
|
148 | - public function column_cb($item) |
|
149 | - { |
|
150 | - return ''; |
|
151 | - } |
|
152 | - |
|
153 | - |
|
154 | - /** |
|
155 | - * @param EE_Message_Template_Group $item |
|
156 | - * @return string |
|
157 | - * @throws EE_Error |
|
158 | - */ |
|
159 | - public function column_description($item) |
|
160 | - { |
|
161 | - return '<p>' . $item->message_type_obj()->description . '</p>'; |
|
162 | - } |
|
163 | - |
|
164 | - |
|
165 | - /** |
|
166 | - * @param EE_Message_Template_Group $item |
|
167 | - * @return string |
|
168 | - * @throws EE_Error |
|
169 | - */ |
|
170 | - public function column_messenger($item) |
|
171 | - { |
|
172 | - //Return the name contents |
|
173 | - return sprintf( |
|
174 | - '%1$s <span style="color:silver">(id:%2$s)</span><br />%3$s%4$s', |
|
175 | - /* $1%s */ |
|
176 | - $this->_get_name_link_for_messenger($item), |
|
177 | - /* $2%s */ |
|
178 | - $item->GRP_ID(), |
|
179 | - /* %4$s */ |
|
180 | - $this->_get_context_links($item), |
|
181 | - /* $3%s */ |
|
182 | - $this->row_actions($this->_get_actions_for_messenger_column($item)) |
|
183 | - ); |
|
184 | - } |
|
185 | - |
|
186 | - /** |
|
187 | - * column_message_type |
|
188 | - * |
|
189 | - * @param EE_Message_Template_Group $item message info for the row |
|
190 | - * @return string message_type name |
|
191 | - * @throws EE_Error |
|
192 | - */ |
|
193 | - public function column_message_type($item) |
|
194 | - { |
|
195 | - return ucwords($item->message_type_obj()->label['singular']); |
|
196 | - } |
|
197 | - |
|
198 | - |
|
199 | - /** |
|
200 | - * Generate dropdown filter select input for messengers |
|
201 | - * |
|
202 | - * @param bool $global |
|
203 | - * @return string |
|
204 | - * @throws EE_Error |
|
205 | - */ |
|
206 | - protected function _get_messengers_dropdown_filter($global = true) |
|
207 | - { |
|
208 | - $messenger_options = array(); |
|
209 | - $active_message_template_groups_grouped_by_messenger = EEM_Message_Template_Group::instance()->get_all( |
|
210 | - array( |
|
211 | - array( |
|
212 | - 'MTP_is_active' => true, |
|
213 | - 'MTP_is_global' => $global, |
|
214 | - ), |
|
215 | - 'group_by' => 'MTP_messenger', |
|
216 | - ) |
|
217 | - ); |
|
218 | - |
|
219 | - foreach ($active_message_template_groups_grouped_by_messenger as $active_message_template_group) { |
|
220 | - if ($active_message_template_group instanceof EE_Message_Template_Group) { |
|
221 | - $messenger = $active_message_template_group->messenger_obj(); |
|
222 | - $messenger_label = $messenger instanceof EE_messenger |
|
223 | - ? $messenger->label['singular'] |
|
224 | - : $active_message_template_group->messenger(); |
|
225 | - $messenger_options[$active_message_template_group->messenger()] = ucwords($messenger_label); |
|
226 | - } |
|
227 | - } |
|
228 | - return $this->get_admin_page()->get_messengers_select_input($messenger_options); |
|
229 | - } |
|
230 | - |
|
231 | - |
|
232 | - /** |
|
233 | - * Generate dropdown filter select input for message types |
|
234 | - * |
|
235 | - * @param bool $global |
|
236 | - * @return string |
|
237 | - * @throws EE_Error |
|
238 | - */ |
|
239 | - protected function _get_message_types_dropdown_filter($global = true) |
|
240 | - { |
|
241 | - $message_type_options = array(); |
|
242 | - $active_message_template_groups_grouped_by_message_type = EEM_Message_Template_Group::instance()->get_all( |
|
243 | - array( |
|
244 | - array( |
|
245 | - 'MTP_is_active' => true, |
|
246 | - 'MTP_is_global' => true, |
|
247 | - ), |
|
248 | - 'group_by' => 'MTP_message_type', |
|
249 | - ) |
|
250 | - ); |
|
251 | - |
|
252 | - foreach ($active_message_template_groups_grouped_by_message_type as $active_message_template_group) { |
|
253 | - if ($active_message_template_group instanceof EE_Message_Template_Group) { |
|
254 | - $message_type = $active_message_template_group->message_type_obj(); |
|
255 | - $message_type_label = $message_type instanceof EE_message_type |
|
256 | - ? $message_type->label['singular'] |
|
257 | - : $active_message_template_group->message_type(); |
|
258 | - $message_type_options[$active_message_template_group->message_type()] = ucwords($message_type_label); |
|
259 | - } |
|
260 | - } |
|
261 | - return $this->get_admin_page()->get_message_types_select_input($message_type_options); |
|
262 | - } |
|
263 | - |
|
264 | - |
|
265 | - /** |
|
266 | - * Return the edit url for the message template group. |
|
267 | - * @param EE_Message_Template_Group $item |
|
268 | - * @return string |
|
269 | - * @throws EE_Error |
|
270 | - */ |
|
271 | - protected function _get_edit_url(EE_Message_Template_Group $item) |
|
272 | - { |
|
273 | - $edit_url = ''; |
|
274 | - // edit link but only if item isn't trashed. |
|
275 | - if (! $item->get('MTP_deleted') |
|
276 | - && EE_Registry::instance()->CAP->current_user_can( |
|
277 | - 'ee_edit_message', |
|
278 | - 'espresso_messages_edit_message_template', |
|
279 | - $item->ID() |
|
280 | - )) { |
|
281 | - $edit_url = EE_Admin_Page::add_query_args_and_nonce( |
|
282 | - array( |
|
283 | - 'action' => 'edit_message_template', |
|
284 | - 'id' => $item->GRP_ID(), |
|
285 | - ), |
|
286 | - EE_MSG_ADMIN_URL |
|
287 | - ); |
|
288 | - } |
|
289 | - return $edit_url; |
|
290 | - } |
|
291 | - |
|
292 | - |
|
293 | - /** |
|
294 | - * Get the context link string for the messenger column. |
|
295 | - * @param EE_Message_Template_Group $item |
|
296 | - * @return string |
|
297 | - * @throws EE_Error |
|
298 | - */ |
|
299 | - protected function _get_context_links(EE_Message_Template_Group $item) |
|
300 | - { |
|
301 | - //first check if we even show the context links or not. |
|
302 | - if (! EE_Registry::instance()->CAP->current_user_can( |
|
303 | - 'ee_edit_message', |
|
304 | - 'espresso_messages_edit_message_template', |
|
305 | - $item->ID() |
|
306 | - ) |
|
307 | - || $item->get('MTP_deleted') |
|
308 | - ) { |
|
309 | - return ''; |
|
310 | - } |
|
311 | - //we want to display the contexts in here so we need to set them up |
|
312 | - $c_label = $item->context_label(); |
|
313 | - $c_configs = $item->contexts_config(); |
|
314 | - $ctxt = array(); |
|
315 | - $context_templates = $item->context_templates(); |
|
316 | - foreach ($context_templates as $context => $template_fields) { |
|
317 | - $mtp_to = ! empty($context_templates[$context]['to']) |
|
318 | - && $context_templates[$context]['to'] instanceof EE_Message_Template |
|
319 | - ? $context_templates[$context]['to']->get('MTP_content') |
|
320 | - : null; |
|
321 | - $inactive = empty($mtp_to) |
|
322 | - && ! empty($context_templates[$context]['to']) |
|
323 | - ? ' class="mtp-inactive"' |
|
324 | - : ''; |
|
325 | - $context_title = ucwords($c_configs[$context]['label']); |
|
326 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce(array( |
|
327 | - 'action' => 'edit_message_template', |
|
328 | - 'id' => $item->GRP_ID(), |
|
329 | - 'context' => $context, |
|
330 | - ), EE_MSG_ADMIN_URL); |
|
331 | - $ctxt[] = '<a' . $inactive |
|
332 | - . ' href="' . $edit_link . '"' |
|
333 | - . ' class="' . $item->message_type() . '-' . $context . '-edit-link"' |
|
334 | - . ' title="' . esc_attr__('Edit Context', 'event_espresso') . '">' |
|
335 | - . $context_title |
|
336 | - . '</a>'; |
|
337 | - } |
|
338 | - |
|
339 | - return sprintf('<strong>%s:</strong> ', ucwords($c_label['plural'])) . implode(' | ', $ctxt); |
|
340 | - } |
|
341 | - |
|
342 | - |
|
343 | - /** |
|
344 | - * Get the Name string from the messenger column (linked to edit if the context allows for that). |
|
345 | - * @param EE_Message_Template_Group $item |
|
346 | - * @return string |
|
347 | - * @throws EE_Error |
|
348 | - */ |
|
349 | - protected function _get_name_link_for_messenger(EE_Message_Template_Group $item) |
|
350 | - { |
|
351 | - $edit_url = $this->_get_edit_url($item); |
|
352 | - return $edit_url |
|
353 | - ? '<a href="' . $edit_url . '"' |
|
354 | - . ' title="' . esc_attr__('Edit Template Group', 'event_espresso') . '">' |
|
355 | - . ucwords($item->messenger_obj()->label['singular']) |
|
356 | - . '</a>' |
|
357 | - : ucwords($item->messenger_obj()->label['singular']); |
|
358 | - } |
|
359 | - |
|
360 | - |
|
361 | - /** |
|
362 | - * Return the actions array for the messenger column. |
|
363 | - * @param EE_Message_Template_Group $item |
|
364 | - * @return array |
|
365 | - * @throws EE_Error |
|
366 | - */ |
|
367 | - protected function _get_actions_for_messenger_column(EE_Message_Template_Group $item) |
|
368 | - { |
|
369 | - $actions = array(); |
|
370 | - if ($edit_url = $this->_get_edit_url($item)) { |
|
371 | - $actions = array( |
|
372 | - 'edit' => '<a href="' . $edit_url . '"' |
|
373 | - . ' class="' . $item->message_type() . '-edit-link"' |
|
374 | - . ' title="' . esc_attr__('Edit Template Group', 'event_espresso') . '">' |
|
375 | - . esc_html__('Edit', 'event_espresso') |
|
376 | - . '</a>' |
|
377 | - ); |
|
378 | - } |
|
379 | - return $actions; |
|
380 | - } |
|
16 | + /** |
|
17 | + * @return Messages_Admin_Page |
|
18 | + */ |
|
19 | + public function get_admin_page() |
|
20 | + { |
|
21 | + return $this->_admin_page; |
|
22 | + } |
|
23 | + |
|
24 | + |
|
25 | + /** |
|
26 | + * Setup data object |
|
27 | + */ |
|
28 | + protected function _setup_data() |
|
29 | + { |
|
30 | + $this->_data = $this->get_admin_page()->get_message_templates( |
|
31 | + $this->_per_page, |
|
32 | + $this->_view, |
|
33 | + false |
|
34 | + ); |
|
35 | + $this->_all_data_count = $this->get_admin_page()->get_message_templates( |
|
36 | + $this->_per_page, |
|
37 | + $this->_view, |
|
38 | + true, |
|
39 | + true |
|
40 | + ); |
|
41 | + } |
|
42 | + |
|
43 | + |
|
44 | + /** |
|
45 | + * Set internal properties |
|
46 | + */ |
|
47 | + protected function _set_properties() |
|
48 | + { |
|
49 | + $this->_wp_list_args = array( |
|
50 | + 'singular' => esc_html__('Message Template Group', 'event_espresso'), |
|
51 | + 'plural' => esc_html__('Message Template', 'event_espresso'), |
|
52 | + 'ajax' => true, //for now, |
|
53 | + 'screen' => $this->get_admin_page()->get_current_screen()->id, |
|
54 | + ); |
|
55 | + $this->_columns = array( |
|
56 | + //'cb' => '<input type="checkbox" />', //no deleting default (global) templates! |
|
57 | + 'message_type' => esc_html__('Message Type', 'event_espresso'), |
|
58 | + 'messenger' => esc_html__('Messenger', 'event_espresso'), |
|
59 | + 'description' => esc_html__('Description', 'event_espresso'), |
|
60 | + ); |
|
61 | + |
|
62 | + $this->_sortable_columns = array( |
|
63 | + 'messenger' => array('MTP_messenger' => true), |
|
64 | + ); |
|
65 | + |
|
66 | + $this->_hidden_columns = array(); |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * Overriding the single_row method from parent to verify whether the $item has an accessible |
|
72 | + * message_type or messenger object before generating the row. |
|
73 | + * |
|
74 | + * @param EE_Message_Template_Group $item |
|
75 | + * @return string |
|
76 | + * @throws EE_Error |
|
77 | + */ |
|
78 | + public function single_row($item) |
|
79 | + { |
|
80 | + $message_type = $item->message_type_obj(); |
|
81 | + $messenger = $item->messenger_obj(); |
|
82 | + |
|
83 | + if (! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) { |
|
84 | + echo ''; |
|
85 | + return; |
|
86 | + } |
|
87 | + |
|
88 | + parent::single_row($item); |
|
89 | + } |
|
90 | + |
|
91 | + |
|
92 | + /** |
|
93 | + * @return array |
|
94 | + * @throws EE_Error |
|
95 | + */ |
|
96 | + protected function _get_table_filters() |
|
97 | + { |
|
98 | + $filters = array(); |
|
99 | + |
|
100 | + //get select inputs |
|
101 | + $select_inputs = array( |
|
102 | + $this->_get_messengers_dropdown_filter(), |
|
103 | + $this->_get_message_types_dropdown_filter(), |
|
104 | + ); |
|
105 | + |
|
106 | + //set filters to select inputs if they aren't empty |
|
107 | + foreach ($select_inputs as $select_input) { |
|
108 | + if ($select_input) { |
|
109 | + $filters[] = $select_input; |
|
110 | + } |
|
111 | + } |
|
112 | + return $filters; |
|
113 | + } |
|
114 | + |
|
115 | + /** |
|
116 | + * We're just removing the search box for message templates, not needed. |
|
117 | + * |
|
118 | + * @param string $text |
|
119 | + * @param string $input_id |
|
120 | + * @return string ; |
|
121 | + */ |
|
122 | + public function search_box($text, $input_id) |
|
123 | + { |
|
124 | + return ''; |
|
125 | + } |
|
126 | + |
|
127 | + |
|
128 | + /** |
|
129 | + * Add counts to the _views property |
|
130 | + */ |
|
131 | + protected function _add_view_counts() |
|
132 | + { |
|
133 | + foreach ($this->_views as $view => $args) { |
|
134 | + $this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates( |
|
135 | + $this->_per_page, |
|
136 | + $view, |
|
137 | + true, |
|
138 | + true |
|
139 | + ); |
|
140 | + } |
|
141 | + } |
|
142 | + |
|
143 | + |
|
144 | + /** |
|
145 | + * @param EE_Message_Template_Group $item |
|
146 | + * @return string |
|
147 | + */ |
|
148 | + public function column_cb($item) |
|
149 | + { |
|
150 | + return ''; |
|
151 | + } |
|
152 | + |
|
153 | + |
|
154 | + /** |
|
155 | + * @param EE_Message_Template_Group $item |
|
156 | + * @return string |
|
157 | + * @throws EE_Error |
|
158 | + */ |
|
159 | + public function column_description($item) |
|
160 | + { |
|
161 | + return '<p>' . $item->message_type_obj()->description . '</p>'; |
|
162 | + } |
|
163 | + |
|
164 | + |
|
165 | + /** |
|
166 | + * @param EE_Message_Template_Group $item |
|
167 | + * @return string |
|
168 | + * @throws EE_Error |
|
169 | + */ |
|
170 | + public function column_messenger($item) |
|
171 | + { |
|
172 | + //Return the name contents |
|
173 | + return sprintf( |
|
174 | + '%1$s <span style="color:silver">(id:%2$s)</span><br />%3$s%4$s', |
|
175 | + /* $1%s */ |
|
176 | + $this->_get_name_link_for_messenger($item), |
|
177 | + /* $2%s */ |
|
178 | + $item->GRP_ID(), |
|
179 | + /* %4$s */ |
|
180 | + $this->_get_context_links($item), |
|
181 | + /* $3%s */ |
|
182 | + $this->row_actions($this->_get_actions_for_messenger_column($item)) |
|
183 | + ); |
|
184 | + } |
|
185 | + |
|
186 | + /** |
|
187 | + * column_message_type |
|
188 | + * |
|
189 | + * @param EE_Message_Template_Group $item message info for the row |
|
190 | + * @return string message_type name |
|
191 | + * @throws EE_Error |
|
192 | + */ |
|
193 | + public function column_message_type($item) |
|
194 | + { |
|
195 | + return ucwords($item->message_type_obj()->label['singular']); |
|
196 | + } |
|
197 | + |
|
198 | + |
|
199 | + /** |
|
200 | + * Generate dropdown filter select input for messengers |
|
201 | + * |
|
202 | + * @param bool $global |
|
203 | + * @return string |
|
204 | + * @throws EE_Error |
|
205 | + */ |
|
206 | + protected function _get_messengers_dropdown_filter($global = true) |
|
207 | + { |
|
208 | + $messenger_options = array(); |
|
209 | + $active_message_template_groups_grouped_by_messenger = EEM_Message_Template_Group::instance()->get_all( |
|
210 | + array( |
|
211 | + array( |
|
212 | + 'MTP_is_active' => true, |
|
213 | + 'MTP_is_global' => $global, |
|
214 | + ), |
|
215 | + 'group_by' => 'MTP_messenger', |
|
216 | + ) |
|
217 | + ); |
|
218 | + |
|
219 | + foreach ($active_message_template_groups_grouped_by_messenger as $active_message_template_group) { |
|
220 | + if ($active_message_template_group instanceof EE_Message_Template_Group) { |
|
221 | + $messenger = $active_message_template_group->messenger_obj(); |
|
222 | + $messenger_label = $messenger instanceof EE_messenger |
|
223 | + ? $messenger->label['singular'] |
|
224 | + : $active_message_template_group->messenger(); |
|
225 | + $messenger_options[$active_message_template_group->messenger()] = ucwords($messenger_label); |
|
226 | + } |
|
227 | + } |
|
228 | + return $this->get_admin_page()->get_messengers_select_input($messenger_options); |
|
229 | + } |
|
230 | + |
|
231 | + |
|
232 | + /** |
|
233 | + * Generate dropdown filter select input for message types |
|
234 | + * |
|
235 | + * @param bool $global |
|
236 | + * @return string |
|
237 | + * @throws EE_Error |
|
238 | + */ |
|
239 | + protected function _get_message_types_dropdown_filter($global = true) |
|
240 | + { |
|
241 | + $message_type_options = array(); |
|
242 | + $active_message_template_groups_grouped_by_message_type = EEM_Message_Template_Group::instance()->get_all( |
|
243 | + array( |
|
244 | + array( |
|
245 | + 'MTP_is_active' => true, |
|
246 | + 'MTP_is_global' => true, |
|
247 | + ), |
|
248 | + 'group_by' => 'MTP_message_type', |
|
249 | + ) |
|
250 | + ); |
|
251 | + |
|
252 | + foreach ($active_message_template_groups_grouped_by_message_type as $active_message_template_group) { |
|
253 | + if ($active_message_template_group instanceof EE_Message_Template_Group) { |
|
254 | + $message_type = $active_message_template_group->message_type_obj(); |
|
255 | + $message_type_label = $message_type instanceof EE_message_type |
|
256 | + ? $message_type->label['singular'] |
|
257 | + : $active_message_template_group->message_type(); |
|
258 | + $message_type_options[$active_message_template_group->message_type()] = ucwords($message_type_label); |
|
259 | + } |
|
260 | + } |
|
261 | + return $this->get_admin_page()->get_message_types_select_input($message_type_options); |
|
262 | + } |
|
263 | + |
|
264 | + |
|
265 | + /** |
|
266 | + * Return the edit url for the message template group. |
|
267 | + * @param EE_Message_Template_Group $item |
|
268 | + * @return string |
|
269 | + * @throws EE_Error |
|
270 | + */ |
|
271 | + protected function _get_edit_url(EE_Message_Template_Group $item) |
|
272 | + { |
|
273 | + $edit_url = ''; |
|
274 | + // edit link but only if item isn't trashed. |
|
275 | + if (! $item->get('MTP_deleted') |
|
276 | + && EE_Registry::instance()->CAP->current_user_can( |
|
277 | + 'ee_edit_message', |
|
278 | + 'espresso_messages_edit_message_template', |
|
279 | + $item->ID() |
|
280 | + )) { |
|
281 | + $edit_url = EE_Admin_Page::add_query_args_and_nonce( |
|
282 | + array( |
|
283 | + 'action' => 'edit_message_template', |
|
284 | + 'id' => $item->GRP_ID(), |
|
285 | + ), |
|
286 | + EE_MSG_ADMIN_URL |
|
287 | + ); |
|
288 | + } |
|
289 | + return $edit_url; |
|
290 | + } |
|
291 | + |
|
292 | + |
|
293 | + /** |
|
294 | + * Get the context link string for the messenger column. |
|
295 | + * @param EE_Message_Template_Group $item |
|
296 | + * @return string |
|
297 | + * @throws EE_Error |
|
298 | + */ |
|
299 | + protected function _get_context_links(EE_Message_Template_Group $item) |
|
300 | + { |
|
301 | + //first check if we even show the context links or not. |
|
302 | + if (! EE_Registry::instance()->CAP->current_user_can( |
|
303 | + 'ee_edit_message', |
|
304 | + 'espresso_messages_edit_message_template', |
|
305 | + $item->ID() |
|
306 | + ) |
|
307 | + || $item->get('MTP_deleted') |
|
308 | + ) { |
|
309 | + return ''; |
|
310 | + } |
|
311 | + //we want to display the contexts in here so we need to set them up |
|
312 | + $c_label = $item->context_label(); |
|
313 | + $c_configs = $item->contexts_config(); |
|
314 | + $ctxt = array(); |
|
315 | + $context_templates = $item->context_templates(); |
|
316 | + foreach ($context_templates as $context => $template_fields) { |
|
317 | + $mtp_to = ! empty($context_templates[$context]['to']) |
|
318 | + && $context_templates[$context]['to'] instanceof EE_Message_Template |
|
319 | + ? $context_templates[$context]['to']->get('MTP_content') |
|
320 | + : null; |
|
321 | + $inactive = empty($mtp_to) |
|
322 | + && ! empty($context_templates[$context]['to']) |
|
323 | + ? ' class="mtp-inactive"' |
|
324 | + : ''; |
|
325 | + $context_title = ucwords($c_configs[$context]['label']); |
|
326 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce(array( |
|
327 | + 'action' => 'edit_message_template', |
|
328 | + 'id' => $item->GRP_ID(), |
|
329 | + 'context' => $context, |
|
330 | + ), EE_MSG_ADMIN_URL); |
|
331 | + $ctxt[] = '<a' . $inactive |
|
332 | + . ' href="' . $edit_link . '"' |
|
333 | + . ' class="' . $item->message_type() . '-' . $context . '-edit-link"' |
|
334 | + . ' title="' . esc_attr__('Edit Context', 'event_espresso') . '">' |
|
335 | + . $context_title |
|
336 | + . '</a>'; |
|
337 | + } |
|
338 | + |
|
339 | + return sprintf('<strong>%s:</strong> ', ucwords($c_label['plural'])) . implode(' | ', $ctxt); |
|
340 | + } |
|
341 | + |
|
342 | + |
|
343 | + /** |
|
344 | + * Get the Name string from the messenger column (linked to edit if the context allows for that). |
|
345 | + * @param EE_Message_Template_Group $item |
|
346 | + * @return string |
|
347 | + * @throws EE_Error |
|
348 | + */ |
|
349 | + protected function _get_name_link_for_messenger(EE_Message_Template_Group $item) |
|
350 | + { |
|
351 | + $edit_url = $this->_get_edit_url($item); |
|
352 | + return $edit_url |
|
353 | + ? '<a href="' . $edit_url . '"' |
|
354 | + . ' title="' . esc_attr__('Edit Template Group', 'event_espresso') . '">' |
|
355 | + . ucwords($item->messenger_obj()->label['singular']) |
|
356 | + . '</a>' |
|
357 | + : ucwords($item->messenger_obj()->label['singular']); |
|
358 | + } |
|
359 | + |
|
360 | + |
|
361 | + /** |
|
362 | + * Return the actions array for the messenger column. |
|
363 | + * @param EE_Message_Template_Group $item |
|
364 | + * @return array |
|
365 | + * @throws EE_Error |
|
366 | + */ |
|
367 | + protected function _get_actions_for_messenger_column(EE_Message_Template_Group $item) |
|
368 | + { |
|
369 | + $actions = array(); |
|
370 | + if ($edit_url = $this->_get_edit_url($item)) { |
|
371 | + $actions = array( |
|
372 | + 'edit' => '<a href="' . $edit_url . '"' |
|
373 | + . ' class="' . $item->message_type() . '-edit-link"' |
|
374 | + . ' title="' . esc_attr__('Edit Template Group', 'event_espresso') . '">' |
|
375 | + . esc_html__('Edit', 'event_espresso') |
|
376 | + . '</a>' |
|
377 | + ); |
|
378 | + } |
|
379 | + return $actions; |
|
380 | + } |
|
381 | 381 | } |
382 | 382 |
@@ -39,14 +39,14 @@ |
||
39 | 39 | * @return void |
40 | 40 | */ |
41 | 41 | public static function set_hooks() { |
42 | - $post_type = get_post_type_object('espresso_venues'); |
|
43 | - $custom_post_types = EE_Register_CPTs::get_CPTs(); |
|
44 | - EE_Config::register_route( |
|
45 | - $custom_post_types['espresso_venues']['plural_slug'], |
|
46 | - 'Venues_Archive', |
|
47 | - 'run' |
|
48 | - ); |
|
49 | - } |
|
42 | + $post_type = get_post_type_object('espresso_venues'); |
|
43 | + $custom_post_types = EE_Register_CPTs::get_CPTs(); |
|
44 | + EE_Config::register_route( |
|
45 | + $custom_post_types['espresso_venues']['plural_slug'], |
|
46 | + 'Venues_Archive', |
|
47 | + 'run' |
|
48 | + ); |
|
49 | + } |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return EED_Venues_Archive |
28 | 28 | */ |
29 | 29 | public static function instance() { |
30 | - return parent::get_instance( __CLASS__ ); |
|
30 | + return parent::get_instance(__CLASS__); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | * @access public |
66 | 66 | * @param \WP $WP |
67 | 67 | */ |
68 | - public function run( $WP ) { |
|
68 | + public function run($WP) { |
|
69 | 69 | // check what template is loaded |
70 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
71 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
70 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
71 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -80,18 +80,18 @@ discard block |
||
80 | 80 | * @param string $template |
81 | 81 | * @return string |
82 | 82 | */ |
83 | - public function template_include( $template ) { |
|
83 | + public function template_include($template) { |
|
84 | 84 | // not a custom template? |
85 | - if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'archive-espresso_venues.php' ) { |
|
85 | + if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'archive-espresso_venues.php') { |
|
86 | 86 | EEH_Template::load_espresso_theme_functions(); |
87 | 87 | // then add extra event data via hooks |
88 | - add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 ); |
|
88 | + add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
89 | 89 | // don't know if theme uses the_excerpt |
90 | - add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
90 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
91 | 91 | // or the_content |
92 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
92 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
93 | 93 | // don't display entry meta because the existing theme will take care of that |
94 | - add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' ); |
|
94 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
95 | 95 | } |
96 | 96 | return $template; |
97 | 97 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @param string $title |
106 | 106 | * @return string |
107 | 107 | */ |
108 | - public function the_title( $title = '' ) { |
|
108 | + public function the_title($title = '') { |
|
109 | 109 | return $title; |
110 | 110 | } |
111 | 111 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @param string $content |
118 | 118 | * @return string |
119 | 119 | */ |
120 | - public function venue_details( $content ) { |
|
120 | + public function venue_details($content) { |
|
121 | 121 | global $post; |
122 | 122 | if ( |
123 | 123 | $post->post_type == 'espresso_venues' |
@@ -127,22 +127,22 @@ discard block |
||
127 | 127 | // it uses the_content() for displaying the $post->post_content |
128 | 128 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
129 | 129 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
130 | - remove_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
131 | - remove_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
130 | + remove_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
131 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
132 | 132 | // add filters we want |
133 | - add_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
134 | - add_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 ); |
|
133 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
134 | + add_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
135 | 135 | // now load our template |
136 | - $template = EEH_Template::locate_template( 'content-espresso_venues-details.php' ); |
|
136 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
137 | 137 | //now add our filter back in, plus some others |
138 | - add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
139 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
138 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
139 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
140 | 140 | // remove other filters we added so they won't get applied to the next post |
141 | - remove_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
142 | - remove_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 ); |
|
141 | + remove_filter('the_content', array($this, 'venue_location'), 110); |
|
142 | + remove_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
143 | 143 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
144 | 144 | } |
145 | - return ! empty( $template ) ? $template : $content; |
|
145 | + return ! empty($template) ? $template : $content; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | * @param string $content |
155 | 155 | * @return string |
156 | 156 | */ |
157 | - public function venue_location( $content ) { |
|
158 | - return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' ); |
|
157 | + public function venue_location($content) { |
|
158 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
@@ -169,14 +169,14 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function wp_enqueue_scripts() { |
171 | 171 | // get some style |
172 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_archive() ) { |
|
172 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_archive()) { |
|
173 | 173 | // first check theme folder |
174 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
175 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
176 | - } else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) { |
|
177 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
174 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
175 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
176 | + } else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) { |
|
177 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
178 | 178 | } |
179 | - wp_enqueue_style( $this->theme ); |
|
179 | + wp_enqueue_style($this->theme); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 |
@@ -32,20 +32,20 @@ |
||
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | - /** |
|
35 | + /** |
|
36 | 36 | * set_hooks - for hooking into EE Core, other modules, etc |
37 | 37 | * |
38 | 38 | * @access public |
39 | 39 | * @return void |
40 | 40 | */ |
41 | 41 | public static function set_hooks() { |
42 | - $custom_post_types = EE_Register_CPTs::get_CPTs(); |
|
43 | - EE_Config::register_route( |
|
44 | - $custom_post_types['espresso_venues']['singular_slug'], |
|
45 | - 'Venue_Single', |
|
46 | - 'run' |
|
47 | - ); |
|
48 | - } |
|
42 | + $custom_post_types = EE_Register_CPTs::get_CPTs(); |
|
43 | + EE_Config::register_route( |
|
44 | + $custom_post_types['espresso_venues']['singular_slug'], |
|
45 | + 'Venue_Single', |
|
46 | + 'run' |
|
47 | + ); |
|
48 | + } |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return EED_Venue_Single |
28 | 28 | */ |
29 | 29 | public static function instance() { |
30 | - return parent::get_instance( __CLASS__ ); |
|
30 | + return parent::get_instance(__CLASS__); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | * @access public |
65 | 65 | * @param \WP $WP |
66 | 66 | */ |
67 | - public function run( $WP ) { |
|
67 | + public function run($WP) { |
|
68 | 68 | // check what template is loaded |
69 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
70 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
69 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
70 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -79,15 +79,15 @@ discard block |
||
79 | 79 | * @param string $template |
80 | 80 | * @return string |
81 | 81 | */ |
82 | - public function template_include( $template ) { |
|
82 | + public function template_include($template) { |
|
83 | 83 | // not a custom template? |
84 | - if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'single-espresso_venues.php' ) { |
|
84 | + if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'single-espresso_venues.php') { |
|
85 | 85 | EEH_Template::load_espresso_theme_functions(); |
86 | 86 | // then add extra event data via hooks |
87 | - add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 ); |
|
88 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
87 | + add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
88 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
89 | 89 | // don't display entry meta because the existing theme will take car of that |
90 | - add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' ); |
|
90 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
91 | 91 | } |
92 | 92 | return $template; |
93 | 93 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @param string $title |
102 | 102 | * @return string |
103 | 103 | */ |
104 | - public function the_title( $title = '' ) { |
|
104 | + public function the_title($title = '') { |
|
105 | 105 | return $title; |
106 | 106 | } |
107 | 107 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @param string $content |
114 | 114 | * @return string |
115 | 115 | */ |
116 | - public function venue_details( $content ) { |
|
116 | + public function venue_details($content) { |
|
117 | 117 | global $post; |
118 | 118 | if ( |
119 | 119 | $post->post_type == 'espresso_venues' |
@@ -123,16 +123,16 @@ discard block |
||
123 | 123 | // it uses the_content() for displaying the $post->post_content |
124 | 124 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
125 | 125 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
126 | - remove_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
126 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
127 | 127 | // add filters we want |
128 | - add_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
128 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
129 | 129 | // now load our template |
130 | - $template = EEH_Template::locate_template( 'content-espresso_venues-details.php' ); |
|
130 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
131 | 131 | // remove other filters we added so they won't get applied to the next post |
132 | - remove_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
132 | + remove_filter('the_content', array($this, 'venue_location'), 110); |
|
133 | 133 | } |
134 | 134 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
135 | - return ! empty( $template ) ? $template : $content; |
|
135 | + return ! empty($template) ? $template : $content; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | * @param string $content |
145 | 145 | * @return string |
146 | 146 | */ |
147 | - public function venue_location( $content ) { |
|
148 | - return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' ); |
|
147 | + public function venue_location($content) { |
|
148 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
@@ -158,16 +158,16 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public function wp_enqueue_scripts() { |
160 | 160 | // get some style |
161 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_single() ) { |
|
161 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_single()) { |
|
162 | 162 | // first check theme folder |
163 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
164 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
165 | - } else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) { |
|
166 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
163 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
164 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
165 | + } else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) { |
|
166 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
167 | 167 | } |
168 | - wp_enqueue_style( $this->theme ); |
|
169 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
170 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
168 | + wp_enqueue_style($this->theme); |
|
169 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
170 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | } |
@@ -13,467 +13,467 @@ discard block |
||
13 | 13 | class EED_Event_Single extends EED_Module |
14 | 14 | { |
15 | 15 | |
16 | - const EVENT_DETAILS_PRIORITY = 100; |
|
17 | - const EVENT_DATETIMES_PRIORITY = 110; |
|
18 | - const EVENT_TICKETS_PRIORITY = 120; |
|
19 | - const EVENT_VENUES_PRIORITY = 130; |
|
20 | - |
|
21 | - /** |
|
22 | - * @type bool $using_get_the_excerpt |
|
23 | - */ |
|
24 | - protected static $using_get_the_excerpt = false; |
|
25 | - |
|
26 | - |
|
27 | - /** |
|
28 | - * @type EE_Template_Part_Manager $template_parts |
|
29 | - */ |
|
30 | - protected $template_parts; |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * @return EED_Module|EED_Event_Single |
|
35 | - */ |
|
36 | - public static function instance() |
|
37 | - { |
|
38 | - return parent::get_instance(__CLASS__); |
|
39 | - } |
|
40 | - |
|
41 | - |
|
42 | - /** |
|
43 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
44 | - * |
|
45 | - * @return void |
|
46 | - */ |
|
47 | - public static function set_hooks() |
|
48 | - { |
|
49 | - add_filter('FHEE_run_EE_wp', '__return_true'); |
|
50 | - add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
51 | - $custom_post_types = EE_Register_CPTs::get_CPTs(); |
|
52 | - EE_Config::register_route( |
|
53 | - $custom_post_types['espresso_events']['singular_slug'], |
|
54 | - 'Event_Single', |
|
55 | - 'run' |
|
56 | - ); |
|
57 | - } |
|
58 | - |
|
59 | - /** |
|
60 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
61 | - * |
|
62 | - * @return void |
|
63 | - */ |
|
64 | - public static function set_hooks_admin() |
|
65 | - { |
|
66 | - add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * set_definitions |
|
72 | - * |
|
73 | - * @static |
|
74 | - * @return void |
|
75 | - */ |
|
76 | - public static function set_definitions() |
|
77 | - { |
|
78 | - define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
79 | - define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__) . 'templates' . DS); |
|
80 | - } |
|
81 | - |
|
82 | - |
|
83 | - /** |
|
84 | - * set_config |
|
85 | - * |
|
86 | - * @void |
|
87 | - */ |
|
88 | - protected function set_config() |
|
89 | - { |
|
90 | - $this->set_config_section('template_settings'); |
|
91 | - $this->set_config_class('EE_Event_Single_Config'); |
|
92 | - $this->set_config_name('EED_Event_Single'); |
|
93 | - } |
|
94 | - |
|
95 | - |
|
96 | - /** |
|
97 | - * initialize_template_parts |
|
98 | - * |
|
99 | - * @param EE_Config_Base|EE_Event_Single_Config $config |
|
100 | - * @return EE_Template_Part_Manager |
|
101 | - */ |
|
102 | - public function initialize_template_parts(EE_Event_Single_Config $config = null) |
|
103 | - { |
|
104 | - /** @type EE_Event_Single_Config $config */ |
|
105 | - $config = $config instanceof EE_Event_Single_Config ? $config : $this->config(); |
|
106 | - EEH_Autoloader::instance()->register_template_part_autoloaders(); |
|
107 | - $template_parts = new EE_Template_Part_Manager(); |
|
108 | - $template_parts->add_template_part( |
|
109 | - 'tickets', |
|
110 | - __('Ticket Selector', 'event_espresso'), |
|
111 | - 'content-espresso_events-tickets.php', |
|
112 | - $config->display_order_tickets |
|
113 | - ); |
|
114 | - $template_parts->add_template_part( |
|
115 | - 'datetimes', |
|
116 | - __('Dates and Times', 'event_espresso'), |
|
117 | - 'content-espresso_events-datetimes.php', |
|
118 | - $config->display_order_datetimes |
|
119 | - ); |
|
120 | - $template_parts->add_template_part( |
|
121 | - 'event', |
|
122 | - __('Event Description', 'event_espresso'), |
|
123 | - 'content-espresso_events-details.php', |
|
124 | - $config->display_order_event |
|
125 | - ); |
|
126 | - $template_parts->add_template_part( |
|
127 | - 'venue', |
|
128 | - __('Venue Information', 'event_espresso'), |
|
129 | - 'content-espresso_events-venues.php', |
|
130 | - $config->display_order_venue |
|
131 | - ); |
|
132 | - do_action('AHEE__EED_Event_Single__initialize_template_parts', $template_parts); |
|
133 | - return $template_parts; |
|
134 | - } |
|
135 | - |
|
136 | - |
|
137 | - /** |
|
138 | - * run - initial module setup |
|
139 | - * |
|
140 | - * @param WP $WP |
|
141 | - * @return void |
|
142 | - */ |
|
143 | - public function run($WP) |
|
144 | - { |
|
145 | - // ensure valid EE_Events_Single_Config() object exists |
|
146 | - $this->set_config(); |
|
147 | - // check what template is loaded |
|
148 | - add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
149 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
150 | - // load css |
|
151 | - add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
152 | - } |
|
153 | - |
|
154 | - |
|
155 | - /** |
|
156 | - * template_include |
|
157 | - * |
|
158 | - * @param string $template |
|
159 | - * @return string |
|
160 | - */ |
|
161 | - public function template_include($template) |
|
162 | - { |
|
163 | - global $post; |
|
164 | - /** @type EE_Event_Single_Config $config */ |
|
165 | - $config = $this->config(); |
|
166 | - if ($config->display_status_banner_single) { |
|
167 | - add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2); |
|
168 | - } |
|
169 | - // not a custom template? |
|
170 | - if ( |
|
171 | - !post_password_required($post) |
|
172 | - && ( |
|
173 | - apply_filters('FHEE__EED_Event_Single__template_include__allow_custom_selected_template', false) |
|
174 | - || EE_Registry::instance() |
|
175 | - ->load_core('Front_Controller') |
|
176 | - ->get_selected_template() !== 'single-espresso_events.php' |
|
177 | - ) |
|
178 | - |
|
179 | - ) { |
|
180 | - EEH_Template::load_espresso_theme_functions(); |
|
181 | - // then add extra event data via hooks |
|
182 | - add_action('loop_start', array('EED_Event_Single', 'loop_start')); |
|
183 | - add_filter('get_the_excerpt', array('EED_Event_Single', 'get_the_excerpt'), 1, 1); |
|
184 | - add_filter( |
|
185 | - 'the_content', |
|
186 | - array('EED_Event_Single', 'event_details'), |
|
187 | - EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
188 | - ); |
|
189 | - add_action('loop_end', array('EED_Event_Single', 'loop_end')); |
|
190 | - // don't display entry meta because the existing theme will take car of that |
|
191 | - add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
192 | - } |
|
193 | - return $template; |
|
194 | - } |
|
195 | - |
|
196 | - |
|
197 | - /** |
|
198 | - * loop_start |
|
199 | - * |
|
200 | - * @param array $wp_query_array an array containing the WP_Query object |
|
201 | - * @return void |
|
202 | - */ |
|
203 | - public static function loop_start($wp_query_array) |
|
204 | - { |
|
205 | - global $post; |
|
206 | - do_action('AHEE_event_details_before_post', $post, $wp_query_array); |
|
207 | - } |
|
208 | - |
|
209 | - |
|
210 | - /** |
|
211 | - * the_title |
|
212 | - * |
|
213 | - * @param string $title |
|
214 | - * @param int $id |
|
215 | - * @return string |
|
216 | - */ |
|
217 | - public static function the_title($title = '', $id = 0) |
|
218 | - { |
|
219 | - global $post; |
|
220 | - return in_the_loop() && $post->ID === (int)$id |
|
221 | - ? espresso_event_status_banner($post->ID) . $title |
|
222 | - : $title; |
|
223 | - } |
|
224 | - |
|
225 | - |
|
226 | - /** |
|
227 | - * get_the_excerpt |
|
228 | - * kinda hacky, but if a theme is using get_the_excerpt(), |
|
229 | - * then we need to remove our filters on the_content() |
|
230 | - * |
|
231 | - * @param string $excerpt |
|
232 | - * @return string |
|
233 | - */ |
|
234 | - public static function get_the_excerpt($excerpt = '') |
|
235 | - { |
|
236 | - EED_Event_Single::$using_get_the_excerpt = true; |
|
237 | - add_filter('wp_trim_excerpt', array('EED_Event_Single', 'end_get_the_excerpt'), 999, 1); |
|
238 | - return $excerpt; |
|
239 | - } |
|
240 | - |
|
241 | - |
|
242 | - /** |
|
243 | - * end_get_the_excerpt |
|
244 | - * |
|
245 | - * @param string $text |
|
246 | - * @return string |
|
247 | - */ |
|
248 | - public static function end_get_the_excerpt($text = '') |
|
249 | - { |
|
250 | - EED_Event_Single::$using_get_the_excerpt = false; |
|
251 | - return $text; |
|
252 | - } |
|
253 | - |
|
254 | - |
|
255 | - /** |
|
256 | - * event_details |
|
257 | - * |
|
258 | - * @param string $content |
|
259 | - * @return string |
|
260 | - */ |
|
261 | - public static function event_details($content) |
|
262 | - { |
|
263 | - global $post; |
|
264 | - static $current_post_ID = 0; |
|
265 | - if ( |
|
266 | - $current_post_ID !== $post->ID |
|
267 | - && $post->post_type === 'espresso_events' |
|
268 | - && !EED_Event_Single::$using_get_the_excerpt |
|
269 | - && !post_password_required() |
|
270 | - ) { |
|
271 | - // Set current post ID to prevent showing content twice, but only if headers have definitely been sent. |
|
272 | - // Reason being is that some plugins, like Yoast, need to run through a copy of the loop early |
|
273 | - // BEFORE headers are sent in order to examine the post content and generate content for the HTML header. |
|
274 | - // We want to allow those plugins to still do their thing and have access to our content, but depending on |
|
275 | - // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
|
276 | - // so the following allows this filter to be applied multiple times, but only once for real |
|
277 | - $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
278 | - if (EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order) { |
|
279 | - // we need to first remove this callback from being applied to the_content() |
|
280 | - // (otherwise it will recurse and blow up the interweb) |
|
281 | - remove_filter( |
|
282 | - 'the_content', |
|
283 | - array('EED_Event_Single', 'event_details'), |
|
284 | - EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
285 | - ); |
|
286 | - EED_Event_Single::instance()->template_parts = EED_Event_Single::instance()->initialize_template_parts(); |
|
287 | - $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
288 | - $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters($content); |
|
289 | - add_filter( |
|
290 | - 'the_content', |
|
291 | - array('EED_Event_Single', 'event_details'), |
|
292 | - EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
293 | - ); |
|
294 | - } else { |
|
295 | - $content = EED_Event_Single::use_filterable_display_order(); |
|
296 | - } |
|
297 | - } |
|
298 | - return $content; |
|
299 | - } |
|
300 | - |
|
301 | - |
|
302 | - /** |
|
303 | - * use_filterable_display_order |
|
304 | - * |
|
305 | - * @return string |
|
306 | - */ |
|
307 | - protected static function use_filterable_display_order() |
|
308 | - { |
|
309 | - // since the 'content-espresso_events-details.php' template might be used directly from within a theme, |
|
310 | - // it uses the_content() for displaying the $post->post_content |
|
311 | - // so in order to load a template that uses the_content() |
|
312 | - // from within a callback being used to filter the_content(), |
|
313 | - // we need to first remove this callback from being applied to the_content() |
|
314 | - // (otherwise it will recurse and blow up the interweb) |
|
315 | - remove_filter( |
|
316 | - 'the_content', |
|
317 | - array('EED_Event_Single', 'event_details'), |
|
318 | - EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
319 | - ); |
|
320 | - //now add additional content |
|
321 | - add_filter( |
|
322 | - 'the_content', |
|
323 | - array('EED_Event_Single', 'event_datetimes'), |
|
324 | - EED_Event_Single::EVENT_DATETIMES_PRIORITY, |
|
325 | - 1 |
|
326 | - ); |
|
327 | - add_filter( |
|
328 | - 'the_content', |
|
329 | - array('EED_Event_Single', 'event_tickets'), |
|
330 | - EED_Event_Single::EVENT_TICKETS_PRIORITY, |
|
331 | - 1 |
|
332 | - ); |
|
333 | - add_filter( |
|
334 | - 'the_content', |
|
335 | - array('EED_Event_Single', 'event_venues'), |
|
336 | - EED_Event_Single::EVENT_VENUES_PRIORITY, |
|
337 | - 1 |
|
338 | - ); |
|
339 | - do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters'); |
|
340 | - // now load our template |
|
341 | - $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
342 | - //now add our filter back in, plus some others |
|
343 | - add_filter( |
|
344 | - 'the_content', |
|
345 | - array('EED_Event_Single', 'event_details'), |
|
346 | - EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
347 | - ); |
|
348 | - remove_filter( |
|
349 | - 'the_content', |
|
350 | - array('EED_Event_Single', 'event_datetimes'), |
|
351 | - EED_Event_Single::EVENT_DATETIMES_PRIORITY |
|
352 | - ); |
|
353 | - remove_filter( |
|
354 | - 'the_content', |
|
355 | - array('EED_Event_Single', 'event_tickets'), |
|
356 | - EED_Event_Single::EVENT_TICKETS_PRIORITY |
|
357 | - ); |
|
358 | - remove_filter( |
|
359 | - 'the_content', |
|
360 | - array('EED_Event_Single', 'event_venues'), |
|
361 | - EED_Event_Single::EVENT_VENUES_PRIORITY |
|
362 | - ); |
|
363 | - do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_remove_filters'); |
|
364 | - // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
|
365 | - return $content; |
|
366 | - } |
|
367 | - |
|
368 | - |
|
369 | - /** |
|
370 | - * event_datetimes - adds datetimes ABOVE content |
|
371 | - * |
|
372 | - * @param string $content |
|
373 | - * @return string |
|
374 | - */ |
|
375 | - public static function event_datetimes($content) |
|
376 | - { |
|
377 | - return EEH_Template::locate_template('content-espresso_events-datetimes.php') . $content; |
|
378 | - } |
|
379 | - |
|
380 | - |
|
381 | - /** |
|
382 | - * event_tickets - adds tickets ABOVE content (which includes datetimes) |
|
383 | - * |
|
384 | - * @param string $content |
|
385 | - * @return string |
|
386 | - */ |
|
387 | - public static function event_tickets($content) |
|
388 | - { |
|
389 | - return EEH_Template::locate_template('content-espresso_events-tickets.php') . $content; |
|
390 | - } |
|
391 | - |
|
392 | - |
|
393 | - /** |
|
394 | - * event_venues |
|
395 | - * |
|
396 | - * @param string $content |
|
397 | - * @return string |
|
398 | - */ |
|
399 | - public static function event_venue($content) |
|
400 | - { |
|
401 | - return EED_Event_Single::event_venues($content); |
|
402 | - } |
|
403 | - |
|
404 | - |
|
405 | - /** |
|
406 | - * event_venues - adds venues BELOW content |
|
407 | - * |
|
408 | - * @param string $content |
|
409 | - * @return string |
|
410 | - */ |
|
411 | - public static function event_venues($content) |
|
412 | - { |
|
413 | - return $content . EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
414 | - } |
|
415 | - |
|
416 | - |
|
417 | - /** |
|
418 | - * loop_end |
|
419 | - * |
|
420 | - * @param array $wp_query_array an array containing the WP_Query object |
|
421 | - * @return void |
|
422 | - */ |
|
423 | - public static function loop_end($wp_query_array) |
|
424 | - { |
|
425 | - global $post; |
|
426 | - do_action('AHEE_event_details_after_post', $post, $wp_query_array); |
|
427 | - } |
|
428 | - |
|
429 | - |
|
430 | - /** |
|
431 | - * wp_enqueue_scripts |
|
432 | - * |
|
433 | - * @return void |
|
434 | - */ |
|
435 | - public function wp_enqueue_scripts() |
|
436 | - { |
|
437 | - // get some style |
|
438 | - if ( |
|
439 | - apply_filters('FHEE_enable_default_espresso_css', TRUE) |
|
440 | - && apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE) |
|
441 | - ) { |
|
442 | - // first check uploads folder |
|
443 | - if (is_readable(get_stylesheet_directory() . $this->theme . DS . 'style.css')) { |
|
444 | - wp_register_style( |
|
445 | - $this->theme, |
|
446 | - get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', |
|
447 | - array('dashicons', 'espresso_default') |
|
448 | - ); |
|
449 | - } else { |
|
450 | - wp_register_style( |
|
451 | - $this->theme, |
|
452 | - EE_TEMPLATES_URL . $this->theme . DS . 'style.css', |
|
453 | - array('dashicons', 'espresso_default') |
|
454 | - ); |
|
455 | - } |
|
456 | - wp_enqueue_script($this->theme); |
|
457 | - if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
458 | - add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
459 | - } |
|
460 | - } |
|
461 | - } |
|
462 | - |
|
463 | - |
|
464 | - /** |
|
465 | - * display_venue |
|
466 | - * |
|
467 | - * @return bool |
|
468 | - */ |
|
469 | - public static function display_venue() |
|
470 | - { |
|
471 | - /** @type EE_Event_Single_Config $config */ |
|
472 | - $config = EED_Event_Single::instance()->config(); |
|
473 | - $display_venue = $config->display_venue === null ? true : $config->display_venue; |
|
474 | - $venue_name = EEH_Venue_View::venue_name(); |
|
475 | - return $display_venue && !empty($venue_name); |
|
476 | - } |
|
16 | + const EVENT_DETAILS_PRIORITY = 100; |
|
17 | + const EVENT_DATETIMES_PRIORITY = 110; |
|
18 | + const EVENT_TICKETS_PRIORITY = 120; |
|
19 | + const EVENT_VENUES_PRIORITY = 130; |
|
20 | + |
|
21 | + /** |
|
22 | + * @type bool $using_get_the_excerpt |
|
23 | + */ |
|
24 | + protected static $using_get_the_excerpt = false; |
|
25 | + |
|
26 | + |
|
27 | + /** |
|
28 | + * @type EE_Template_Part_Manager $template_parts |
|
29 | + */ |
|
30 | + protected $template_parts; |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * @return EED_Module|EED_Event_Single |
|
35 | + */ |
|
36 | + public static function instance() |
|
37 | + { |
|
38 | + return parent::get_instance(__CLASS__); |
|
39 | + } |
|
40 | + |
|
41 | + |
|
42 | + /** |
|
43 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
44 | + * |
|
45 | + * @return void |
|
46 | + */ |
|
47 | + public static function set_hooks() |
|
48 | + { |
|
49 | + add_filter('FHEE_run_EE_wp', '__return_true'); |
|
50 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
51 | + $custom_post_types = EE_Register_CPTs::get_CPTs(); |
|
52 | + EE_Config::register_route( |
|
53 | + $custom_post_types['espresso_events']['singular_slug'], |
|
54 | + 'Event_Single', |
|
55 | + 'run' |
|
56 | + ); |
|
57 | + } |
|
58 | + |
|
59 | + /** |
|
60 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
61 | + * |
|
62 | + * @return void |
|
63 | + */ |
|
64 | + public static function set_hooks_admin() |
|
65 | + { |
|
66 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * set_definitions |
|
72 | + * |
|
73 | + * @static |
|
74 | + * @return void |
|
75 | + */ |
|
76 | + public static function set_definitions() |
|
77 | + { |
|
78 | + define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets' . DS); |
|
79 | + define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__) . 'templates' . DS); |
|
80 | + } |
|
81 | + |
|
82 | + |
|
83 | + /** |
|
84 | + * set_config |
|
85 | + * |
|
86 | + * @void |
|
87 | + */ |
|
88 | + protected function set_config() |
|
89 | + { |
|
90 | + $this->set_config_section('template_settings'); |
|
91 | + $this->set_config_class('EE_Event_Single_Config'); |
|
92 | + $this->set_config_name('EED_Event_Single'); |
|
93 | + } |
|
94 | + |
|
95 | + |
|
96 | + /** |
|
97 | + * initialize_template_parts |
|
98 | + * |
|
99 | + * @param EE_Config_Base|EE_Event_Single_Config $config |
|
100 | + * @return EE_Template_Part_Manager |
|
101 | + */ |
|
102 | + public function initialize_template_parts(EE_Event_Single_Config $config = null) |
|
103 | + { |
|
104 | + /** @type EE_Event_Single_Config $config */ |
|
105 | + $config = $config instanceof EE_Event_Single_Config ? $config : $this->config(); |
|
106 | + EEH_Autoloader::instance()->register_template_part_autoloaders(); |
|
107 | + $template_parts = new EE_Template_Part_Manager(); |
|
108 | + $template_parts->add_template_part( |
|
109 | + 'tickets', |
|
110 | + __('Ticket Selector', 'event_espresso'), |
|
111 | + 'content-espresso_events-tickets.php', |
|
112 | + $config->display_order_tickets |
|
113 | + ); |
|
114 | + $template_parts->add_template_part( |
|
115 | + 'datetimes', |
|
116 | + __('Dates and Times', 'event_espresso'), |
|
117 | + 'content-espresso_events-datetimes.php', |
|
118 | + $config->display_order_datetimes |
|
119 | + ); |
|
120 | + $template_parts->add_template_part( |
|
121 | + 'event', |
|
122 | + __('Event Description', 'event_espresso'), |
|
123 | + 'content-espresso_events-details.php', |
|
124 | + $config->display_order_event |
|
125 | + ); |
|
126 | + $template_parts->add_template_part( |
|
127 | + 'venue', |
|
128 | + __('Venue Information', 'event_espresso'), |
|
129 | + 'content-espresso_events-venues.php', |
|
130 | + $config->display_order_venue |
|
131 | + ); |
|
132 | + do_action('AHEE__EED_Event_Single__initialize_template_parts', $template_parts); |
|
133 | + return $template_parts; |
|
134 | + } |
|
135 | + |
|
136 | + |
|
137 | + /** |
|
138 | + * run - initial module setup |
|
139 | + * |
|
140 | + * @param WP $WP |
|
141 | + * @return void |
|
142 | + */ |
|
143 | + public function run($WP) |
|
144 | + { |
|
145 | + // ensure valid EE_Events_Single_Config() object exists |
|
146 | + $this->set_config(); |
|
147 | + // check what template is loaded |
|
148 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
149 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
150 | + // load css |
|
151 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
152 | + } |
|
153 | + |
|
154 | + |
|
155 | + /** |
|
156 | + * template_include |
|
157 | + * |
|
158 | + * @param string $template |
|
159 | + * @return string |
|
160 | + */ |
|
161 | + public function template_include($template) |
|
162 | + { |
|
163 | + global $post; |
|
164 | + /** @type EE_Event_Single_Config $config */ |
|
165 | + $config = $this->config(); |
|
166 | + if ($config->display_status_banner_single) { |
|
167 | + add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2); |
|
168 | + } |
|
169 | + // not a custom template? |
|
170 | + if ( |
|
171 | + !post_password_required($post) |
|
172 | + && ( |
|
173 | + apply_filters('FHEE__EED_Event_Single__template_include__allow_custom_selected_template', false) |
|
174 | + || EE_Registry::instance() |
|
175 | + ->load_core('Front_Controller') |
|
176 | + ->get_selected_template() !== 'single-espresso_events.php' |
|
177 | + ) |
|
178 | + |
|
179 | + ) { |
|
180 | + EEH_Template::load_espresso_theme_functions(); |
|
181 | + // then add extra event data via hooks |
|
182 | + add_action('loop_start', array('EED_Event_Single', 'loop_start')); |
|
183 | + add_filter('get_the_excerpt', array('EED_Event_Single', 'get_the_excerpt'), 1, 1); |
|
184 | + add_filter( |
|
185 | + 'the_content', |
|
186 | + array('EED_Event_Single', 'event_details'), |
|
187 | + EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
188 | + ); |
|
189 | + add_action('loop_end', array('EED_Event_Single', 'loop_end')); |
|
190 | + // don't display entry meta because the existing theme will take car of that |
|
191 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
192 | + } |
|
193 | + return $template; |
|
194 | + } |
|
195 | + |
|
196 | + |
|
197 | + /** |
|
198 | + * loop_start |
|
199 | + * |
|
200 | + * @param array $wp_query_array an array containing the WP_Query object |
|
201 | + * @return void |
|
202 | + */ |
|
203 | + public static function loop_start($wp_query_array) |
|
204 | + { |
|
205 | + global $post; |
|
206 | + do_action('AHEE_event_details_before_post', $post, $wp_query_array); |
|
207 | + } |
|
208 | + |
|
209 | + |
|
210 | + /** |
|
211 | + * the_title |
|
212 | + * |
|
213 | + * @param string $title |
|
214 | + * @param int $id |
|
215 | + * @return string |
|
216 | + */ |
|
217 | + public static function the_title($title = '', $id = 0) |
|
218 | + { |
|
219 | + global $post; |
|
220 | + return in_the_loop() && $post->ID === (int)$id |
|
221 | + ? espresso_event_status_banner($post->ID) . $title |
|
222 | + : $title; |
|
223 | + } |
|
224 | + |
|
225 | + |
|
226 | + /** |
|
227 | + * get_the_excerpt |
|
228 | + * kinda hacky, but if a theme is using get_the_excerpt(), |
|
229 | + * then we need to remove our filters on the_content() |
|
230 | + * |
|
231 | + * @param string $excerpt |
|
232 | + * @return string |
|
233 | + */ |
|
234 | + public static function get_the_excerpt($excerpt = '') |
|
235 | + { |
|
236 | + EED_Event_Single::$using_get_the_excerpt = true; |
|
237 | + add_filter('wp_trim_excerpt', array('EED_Event_Single', 'end_get_the_excerpt'), 999, 1); |
|
238 | + return $excerpt; |
|
239 | + } |
|
240 | + |
|
241 | + |
|
242 | + /** |
|
243 | + * end_get_the_excerpt |
|
244 | + * |
|
245 | + * @param string $text |
|
246 | + * @return string |
|
247 | + */ |
|
248 | + public static function end_get_the_excerpt($text = '') |
|
249 | + { |
|
250 | + EED_Event_Single::$using_get_the_excerpt = false; |
|
251 | + return $text; |
|
252 | + } |
|
253 | + |
|
254 | + |
|
255 | + /** |
|
256 | + * event_details |
|
257 | + * |
|
258 | + * @param string $content |
|
259 | + * @return string |
|
260 | + */ |
|
261 | + public static function event_details($content) |
|
262 | + { |
|
263 | + global $post; |
|
264 | + static $current_post_ID = 0; |
|
265 | + if ( |
|
266 | + $current_post_ID !== $post->ID |
|
267 | + && $post->post_type === 'espresso_events' |
|
268 | + && !EED_Event_Single::$using_get_the_excerpt |
|
269 | + && !post_password_required() |
|
270 | + ) { |
|
271 | + // Set current post ID to prevent showing content twice, but only if headers have definitely been sent. |
|
272 | + // Reason being is that some plugins, like Yoast, need to run through a copy of the loop early |
|
273 | + // BEFORE headers are sent in order to examine the post content and generate content for the HTML header. |
|
274 | + // We want to allow those plugins to still do their thing and have access to our content, but depending on |
|
275 | + // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
|
276 | + // so the following allows this filter to be applied multiple times, but only once for real |
|
277 | + $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
278 | + if (EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order) { |
|
279 | + // we need to first remove this callback from being applied to the_content() |
|
280 | + // (otherwise it will recurse and blow up the interweb) |
|
281 | + remove_filter( |
|
282 | + 'the_content', |
|
283 | + array('EED_Event_Single', 'event_details'), |
|
284 | + EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
285 | + ); |
|
286 | + EED_Event_Single::instance()->template_parts = EED_Event_Single::instance()->initialize_template_parts(); |
|
287 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
288 | + $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters($content); |
|
289 | + add_filter( |
|
290 | + 'the_content', |
|
291 | + array('EED_Event_Single', 'event_details'), |
|
292 | + EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
293 | + ); |
|
294 | + } else { |
|
295 | + $content = EED_Event_Single::use_filterable_display_order(); |
|
296 | + } |
|
297 | + } |
|
298 | + return $content; |
|
299 | + } |
|
300 | + |
|
301 | + |
|
302 | + /** |
|
303 | + * use_filterable_display_order |
|
304 | + * |
|
305 | + * @return string |
|
306 | + */ |
|
307 | + protected static function use_filterable_display_order() |
|
308 | + { |
|
309 | + // since the 'content-espresso_events-details.php' template might be used directly from within a theme, |
|
310 | + // it uses the_content() for displaying the $post->post_content |
|
311 | + // so in order to load a template that uses the_content() |
|
312 | + // from within a callback being used to filter the_content(), |
|
313 | + // we need to first remove this callback from being applied to the_content() |
|
314 | + // (otherwise it will recurse and blow up the interweb) |
|
315 | + remove_filter( |
|
316 | + 'the_content', |
|
317 | + array('EED_Event_Single', 'event_details'), |
|
318 | + EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
319 | + ); |
|
320 | + //now add additional content |
|
321 | + add_filter( |
|
322 | + 'the_content', |
|
323 | + array('EED_Event_Single', 'event_datetimes'), |
|
324 | + EED_Event_Single::EVENT_DATETIMES_PRIORITY, |
|
325 | + 1 |
|
326 | + ); |
|
327 | + add_filter( |
|
328 | + 'the_content', |
|
329 | + array('EED_Event_Single', 'event_tickets'), |
|
330 | + EED_Event_Single::EVENT_TICKETS_PRIORITY, |
|
331 | + 1 |
|
332 | + ); |
|
333 | + add_filter( |
|
334 | + 'the_content', |
|
335 | + array('EED_Event_Single', 'event_venues'), |
|
336 | + EED_Event_Single::EVENT_VENUES_PRIORITY, |
|
337 | + 1 |
|
338 | + ); |
|
339 | + do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters'); |
|
340 | + // now load our template |
|
341 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
342 | + //now add our filter back in, plus some others |
|
343 | + add_filter( |
|
344 | + 'the_content', |
|
345 | + array('EED_Event_Single', 'event_details'), |
|
346 | + EED_Event_Single::EVENT_DETAILS_PRIORITY |
|
347 | + ); |
|
348 | + remove_filter( |
|
349 | + 'the_content', |
|
350 | + array('EED_Event_Single', 'event_datetimes'), |
|
351 | + EED_Event_Single::EVENT_DATETIMES_PRIORITY |
|
352 | + ); |
|
353 | + remove_filter( |
|
354 | + 'the_content', |
|
355 | + array('EED_Event_Single', 'event_tickets'), |
|
356 | + EED_Event_Single::EVENT_TICKETS_PRIORITY |
|
357 | + ); |
|
358 | + remove_filter( |
|
359 | + 'the_content', |
|
360 | + array('EED_Event_Single', 'event_venues'), |
|
361 | + EED_Event_Single::EVENT_VENUES_PRIORITY |
|
362 | + ); |
|
363 | + do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_remove_filters'); |
|
364 | + // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
|
365 | + return $content; |
|
366 | + } |
|
367 | + |
|
368 | + |
|
369 | + /** |
|
370 | + * event_datetimes - adds datetimes ABOVE content |
|
371 | + * |
|
372 | + * @param string $content |
|
373 | + * @return string |
|
374 | + */ |
|
375 | + public static function event_datetimes($content) |
|
376 | + { |
|
377 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php') . $content; |
|
378 | + } |
|
379 | + |
|
380 | + |
|
381 | + /** |
|
382 | + * event_tickets - adds tickets ABOVE content (which includes datetimes) |
|
383 | + * |
|
384 | + * @param string $content |
|
385 | + * @return string |
|
386 | + */ |
|
387 | + public static function event_tickets($content) |
|
388 | + { |
|
389 | + return EEH_Template::locate_template('content-espresso_events-tickets.php') . $content; |
|
390 | + } |
|
391 | + |
|
392 | + |
|
393 | + /** |
|
394 | + * event_venues |
|
395 | + * |
|
396 | + * @param string $content |
|
397 | + * @return string |
|
398 | + */ |
|
399 | + public static function event_venue($content) |
|
400 | + { |
|
401 | + return EED_Event_Single::event_venues($content); |
|
402 | + } |
|
403 | + |
|
404 | + |
|
405 | + /** |
|
406 | + * event_venues - adds venues BELOW content |
|
407 | + * |
|
408 | + * @param string $content |
|
409 | + * @return string |
|
410 | + */ |
|
411 | + public static function event_venues($content) |
|
412 | + { |
|
413 | + return $content . EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
414 | + } |
|
415 | + |
|
416 | + |
|
417 | + /** |
|
418 | + * loop_end |
|
419 | + * |
|
420 | + * @param array $wp_query_array an array containing the WP_Query object |
|
421 | + * @return void |
|
422 | + */ |
|
423 | + public static function loop_end($wp_query_array) |
|
424 | + { |
|
425 | + global $post; |
|
426 | + do_action('AHEE_event_details_after_post', $post, $wp_query_array); |
|
427 | + } |
|
428 | + |
|
429 | + |
|
430 | + /** |
|
431 | + * wp_enqueue_scripts |
|
432 | + * |
|
433 | + * @return void |
|
434 | + */ |
|
435 | + public function wp_enqueue_scripts() |
|
436 | + { |
|
437 | + // get some style |
|
438 | + if ( |
|
439 | + apply_filters('FHEE_enable_default_espresso_css', TRUE) |
|
440 | + && apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE) |
|
441 | + ) { |
|
442 | + // first check uploads folder |
|
443 | + if (is_readable(get_stylesheet_directory() . $this->theme . DS . 'style.css')) { |
|
444 | + wp_register_style( |
|
445 | + $this->theme, |
|
446 | + get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', |
|
447 | + array('dashicons', 'espresso_default') |
|
448 | + ); |
|
449 | + } else { |
|
450 | + wp_register_style( |
|
451 | + $this->theme, |
|
452 | + EE_TEMPLATES_URL . $this->theme . DS . 'style.css', |
|
453 | + array('dashicons', 'espresso_default') |
|
454 | + ); |
|
455 | + } |
|
456 | + wp_enqueue_script($this->theme); |
|
457 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
458 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
459 | + } |
|
460 | + } |
|
461 | + } |
|
462 | + |
|
463 | + |
|
464 | + /** |
|
465 | + * display_venue |
|
466 | + * |
|
467 | + * @return bool |
|
468 | + */ |
|
469 | + public static function display_venue() |
|
470 | + { |
|
471 | + /** @type EE_Event_Single_Config $config */ |
|
472 | + $config = EED_Event_Single::instance()->config(); |
|
473 | + $display_venue = $config->display_venue === null ? true : $config->display_venue; |
|
474 | + $venue_name = EEH_Venue_View::venue_name(); |
|
475 | + return $display_venue && !empty($venue_name); |
|
476 | + } |
|
477 | 477 | |
478 | 478 | |
479 | 479 | } |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | */ |
488 | 488 | function espresso_display_venue_in_event_details() |
489 | 489 | { |
490 | - return EED_Event_Single::display_venue(); |
|
490 | + return EED_Event_Single::display_venue(); |
|
491 | 491 | } |
492 | 492 | |
493 | 493 |