@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | self::$_instance = new self($grand_total, $session); |
66 | 66 | } |
67 | 67 | // or maybe retrieve an existing one ? |
68 | - if (! self::$_instance instanceof EE_Cart) { |
|
68 | + if ( ! self::$_instance instanceof EE_Cart) { |
|
69 | 69 | // try getting the cart out of the session |
70 | 70 | $saved_cart = $session instanceof EE_Session ? $session->cart() : null; |
71 | 71 | self::$_instance = $saved_cart instanceof EE_Cart ? $saved_cart : new self($grand_total, $session); |
72 | 72 | unset($saved_cart); |
73 | 73 | } |
74 | 74 | // verify that cart is ok and grand total line item exists |
75 | - if (! self::$_instance instanceof EE_Cart || ! self::$_instance->_grand_total instanceof EE_Line_Item) { |
|
75 | + if ( ! self::$_instance instanceof EE_Cart || ! self::$_instance->_grand_total instanceof EE_Line_Item) { |
|
76 | 76 | self::$_instance = new self($grand_total, $session); |
77 | 77 | } |
78 | 78 | self::$_instance->get_grand_total(); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function session() |
126 | 126 | { |
127 | - if (! $this->_session instanceof EE_Session) { |
|
127 | + if ( ! $this->_session instanceof EE_Session) { |
|
128 | 128 | $this->set_session(); |
129 | 129 | } |
130 | 130 | return $this->_session; |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | |
393 | 393 | public function __wakeup() |
394 | 394 | { |
395 | - if (! $this->_grand_total instanceof EE_Line_Item && absint($this->_grand_total) !== 0) { |
|
395 | + if ( ! $this->_grand_total instanceof EE_Line_Item && absint($this->_grand_total) !== 0) { |
|
396 | 396 | // $this->_grand_total is actually just an ID, so use it to get the object from the db |
397 | 397 | $this->_grand_total = EEM_Line_Item::instance()->get_one_by_ID($this->_grand_total); |
398 | 398 | } |
@@ -16,397 +16,397 @@ |
||
16 | 16 | */ |
17 | 17 | class EE_Cart implements ResettableInterface |
18 | 18 | { |
19 | - /** |
|
20 | - * instance of the EE_Cart object |
|
21 | - * |
|
22 | - * @access private |
|
23 | - * @var EE_Cart $_instance |
|
24 | - */ |
|
25 | - private static $_instance; |
|
26 | - |
|
27 | - /** |
|
28 | - * instance of the EE_Session object |
|
29 | - * |
|
30 | - * @access protected |
|
31 | - * @var EE_Session $_session |
|
32 | - */ |
|
33 | - protected $_session; |
|
34 | - |
|
35 | - /** |
|
36 | - * The total Line item which comprises all the children line-item subtotals, |
|
37 | - * which in turn each have their line items. |
|
38 | - * Typically, the line item structure will look like: |
|
39 | - * grand total |
|
40 | - * -tickets-sub-total |
|
41 | - * --ticket1 |
|
42 | - * --ticket2 |
|
43 | - * --... |
|
44 | - * -taxes-sub-total |
|
45 | - * --tax1 |
|
46 | - * --tax2 |
|
47 | - * |
|
48 | - * @var EE_Line_Item |
|
49 | - */ |
|
50 | - private $_grand_total; |
|
51 | - |
|
52 | - |
|
53 | - /** |
|
54 | - * @singleton method used to instantiate class object |
|
55 | - * @access public |
|
56 | - * @param EE_Line_Item $grand_total |
|
57 | - * @param EE_Session $session |
|
58 | - * @return \EE_Cart |
|
59 | - * @throws \EE_Error |
|
60 | - */ |
|
61 | - public static function instance(EE_Line_Item $grand_total = null, EE_Session $session = null) |
|
62 | - { |
|
63 | - if ($grand_total instanceof EE_Line_Item && $grand_total->is_total()) { |
|
64 | - self::$_instance = new self($grand_total, $session); |
|
65 | - } |
|
66 | - // or maybe retrieve an existing one ? |
|
67 | - if (! self::$_instance instanceof EE_Cart) { |
|
68 | - // try getting the cart out of the session |
|
69 | - $saved_cart = $session instanceof EE_Session ? $session->cart() : null; |
|
70 | - self::$_instance = $saved_cart instanceof EE_Cart ? $saved_cart : new self($grand_total, $session); |
|
71 | - unset($saved_cart); |
|
72 | - } |
|
73 | - // verify that cart is ok and grand total line item exists |
|
74 | - if (! self::$_instance instanceof EE_Cart || ! self::$_instance->_grand_total instanceof EE_Line_Item) { |
|
75 | - self::$_instance = new self($grand_total, $session); |
|
76 | - } |
|
77 | - self::$_instance->get_grand_total(); |
|
78 | - // once everything is all said and done, save the cart to the EE_Session |
|
79 | - add_action('shutdown', array(self::$_instance, 'save_cart'), 90); |
|
80 | - return self::$_instance; |
|
81 | - } |
|
82 | - |
|
83 | - |
|
84 | - /** |
|
85 | - * private constructor to prevent direct creation |
|
86 | - * |
|
87 | - * @Constructor |
|
88 | - * @access private |
|
89 | - * @param EE_Line_Item $grand_total |
|
90 | - * @param EE_Session $session |
|
91 | - */ |
|
92 | - private function __construct(EE_Line_Item $grand_total = null, EE_Session $session = null) |
|
93 | - { |
|
94 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
95 | - $this->set_session($session); |
|
96 | - if ($grand_total instanceof EE_Line_Item && $grand_total->is_total()) { |
|
97 | - $this->set_grand_total_line_item($grand_total); |
|
98 | - } |
|
99 | - } |
|
100 | - |
|
101 | - |
|
102 | - /** |
|
103 | - * Resets the cart completely (whereas empty_cart |
|
104 | - * |
|
105 | - * @param EE_Line_Item $grand_total |
|
106 | - * @param EE_Session $session |
|
107 | - * @return EE_Cart |
|
108 | - * @throws \EE_Error |
|
109 | - */ |
|
110 | - public static function reset(EE_Line_Item $grand_total = null, EE_Session $session = null) |
|
111 | - { |
|
112 | - remove_action('shutdown', array(self::$_instance, 'save_cart'), 90); |
|
113 | - if ($session instanceof EE_Session) { |
|
114 | - $session->reset_cart(); |
|
115 | - } |
|
116 | - self::$_instance = null; |
|
117 | - return self::instance($grand_total, $session); |
|
118 | - } |
|
119 | - |
|
120 | - |
|
121 | - /** |
|
122 | - * @return \EE_Session |
|
123 | - */ |
|
124 | - public function session() |
|
125 | - { |
|
126 | - if (! $this->_session instanceof EE_Session) { |
|
127 | - $this->set_session(); |
|
128 | - } |
|
129 | - return $this->_session; |
|
130 | - } |
|
131 | - |
|
132 | - |
|
133 | - /** |
|
134 | - * @param EE_Session $session |
|
135 | - */ |
|
136 | - public function set_session(EE_Session $session = null) |
|
137 | - { |
|
138 | - $this->_session = $session instanceof EE_Session ? $session : EE_Registry::instance()->load_core('Session'); |
|
139 | - } |
|
140 | - |
|
141 | - |
|
142 | - /** |
|
143 | - * Sets the cart to match the line item. Especially handy for loading an old cart where you |
|
144 | - * know the grand total line item on it |
|
145 | - * |
|
146 | - * @param EE_Line_Item $line_item |
|
147 | - */ |
|
148 | - public function set_grand_total_line_item(EE_Line_Item $line_item) |
|
149 | - { |
|
150 | - $this->_grand_total = $line_item; |
|
151 | - } |
|
152 | - |
|
153 | - |
|
154 | - /** |
|
155 | - * get_cart_from_reg_url_link |
|
156 | - * |
|
157 | - * @access public |
|
158 | - * @param EE_Transaction $transaction |
|
159 | - * @param EE_Session $session |
|
160 | - * @return \EE_Cart |
|
161 | - * @throws \EE_Error |
|
162 | - */ |
|
163 | - public static function get_cart_from_txn(EE_Transaction $transaction, EE_Session $session = null) |
|
164 | - { |
|
165 | - $grand_total = $transaction->total_line_item(); |
|
166 | - $grand_total->get_items(); |
|
167 | - $grand_total->tax_descendants(); |
|
168 | - return EE_Cart::instance($grand_total, $session); |
|
169 | - } |
|
170 | - |
|
171 | - |
|
172 | - /** |
|
173 | - * Creates the total line item, and ensures it has its 'tickets' and 'taxes' sub-items |
|
174 | - * |
|
175 | - * @return EE_Line_Item |
|
176 | - * @throws \EE_Error |
|
177 | - */ |
|
178 | - private function _create_grand_total() |
|
179 | - { |
|
180 | - $this->_grand_total = EEH_Line_Item::create_total_line_item(); |
|
181 | - return $this->_grand_total; |
|
182 | - } |
|
183 | - |
|
184 | - |
|
185 | - /** |
|
186 | - * Gets all the line items of object type Ticket |
|
187 | - * |
|
188 | - * @access public |
|
189 | - * @return \EE_Line_Item[] |
|
190 | - */ |
|
191 | - public function get_tickets() |
|
192 | - { |
|
193 | - if ($this->_grand_total === null) { |
|
194 | - return array(); |
|
195 | - } |
|
196 | - return EEH_Line_Item::get_ticket_line_items($this->_grand_total); |
|
197 | - } |
|
198 | - |
|
199 | - |
|
200 | - /** |
|
201 | - * returns the total quantity of tickets in the cart |
|
202 | - * |
|
203 | - * @access public |
|
204 | - * @return int |
|
205 | - * @throws \EE_Error |
|
206 | - */ |
|
207 | - public function all_ticket_quantity_count() |
|
208 | - { |
|
209 | - $tickets = $this->get_tickets(); |
|
210 | - if (empty($tickets)) { |
|
211 | - return 0; |
|
212 | - } |
|
213 | - $count = 0; |
|
214 | - foreach ($tickets as $ticket) { |
|
215 | - $count += $ticket->get('LIN_quantity'); |
|
216 | - } |
|
217 | - return $count; |
|
218 | - } |
|
219 | - |
|
220 | - |
|
221 | - /** |
|
222 | - * Gets all the tax line items |
|
223 | - * |
|
224 | - * @return \EE_Line_Item[] |
|
225 | - * @throws \EE_Error |
|
226 | - */ |
|
227 | - public function get_taxes() |
|
228 | - { |
|
229 | - return EEH_Line_Item::get_taxes_subtotal($this->_grand_total)->children(); |
|
230 | - } |
|
231 | - |
|
232 | - |
|
233 | - /** |
|
234 | - * Gets the total line item (which is a parent of all other line items) on this cart |
|
235 | - * |
|
236 | - * @return EE_Line_Item |
|
237 | - * @throws \EE_Error |
|
238 | - */ |
|
239 | - public function get_grand_total() |
|
240 | - { |
|
241 | - return $this->_grand_total instanceof EE_Line_Item ? $this->_grand_total : $this->_create_grand_total(); |
|
242 | - } |
|
243 | - |
|
244 | - |
|
245 | - /** |
|
246 | - * @process items for adding to cart |
|
247 | - * @access public |
|
248 | - * @param EE_Ticket $ticket |
|
249 | - * @param int $qty |
|
250 | - * @return TRUE on success, FALSE on fail |
|
251 | - * @throws \EE_Error |
|
252 | - */ |
|
253 | - public function add_ticket_to_cart(EE_Ticket $ticket, $qty = 1) |
|
254 | - { |
|
255 | - EEH_Line_Item::add_ticket_purchase($this->get_grand_total(), $ticket, $qty); |
|
256 | - return $this->save_cart() ? true : false; |
|
257 | - } |
|
258 | - |
|
259 | - |
|
260 | - /** |
|
261 | - * get_cart_total_before_tax |
|
262 | - * |
|
263 | - * @access public |
|
264 | - * @return float |
|
265 | - * @throws \EE_Error |
|
266 | - */ |
|
267 | - public function get_cart_total_before_tax() |
|
268 | - { |
|
269 | - return $this->get_grand_total()->recalculate_pre_tax_total(); |
|
270 | - } |
|
271 | - |
|
272 | - |
|
273 | - /** |
|
274 | - * gets the total amount of tax paid for items in this cart |
|
275 | - * |
|
276 | - * @access public |
|
277 | - * @return float |
|
278 | - * @throws \EE_Error |
|
279 | - */ |
|
280 | - public function get_applied_taxes() |
|
281 | - { |
|
282 | - return EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
283 | - } |
|
284 | - |
|
285 | - |
|
286 | - /** |
|
287 | - * Gets the total amount to be paid for the items in the cart, including taxes and other modifiers |
|
288 | - * |
|
289 | - * @access public |
|
290 | - * @return float |
|
291 | - * @throws \EE_Error |
|
292 | - */ |
|
293 | - public function get_cart_grand_total() |
|
294 | - { |
|
295 | - EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
296 | - return $this->get_grand_total()->total(); |
|
297 | - } |
|
298 | - |
|
299 | - |
|
300 | - /** |
|
301 | - * Gets the total amount to be paid for the items in the cart, including taxes and other modifiers |
|
302 | - * |
|
303 | - * @access public |
|
304 | - * @return float |
|
305 | - * @throws \EE_Error |
|
306 | - */ |
|
307 | - public function recalculate_all_cart_totals() |
|
308 | - { |
|
309 | - $pre_tax_total = $this->get_cart_total_before_tax(); |
|
310 | - $taxes_total = EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
311 | - $this->_grand_total->set_total($pre_tax_total + $taxes_total); |
|
312 | - $this->_grand_total->save_this_and_descendants_to_txn(); |
|
313 | - return $this->get_grand_total()->total(); |
|
314 | - } |
|
315 | - |
|
316 | - |
|
317 | - /** |
|
318 | - * deletes an item from the cart |
|
319 | - * |
|
320 | - * @access public |
|
321 | - * @param array|bool|string $line_item_codes |
|
322 | - * @return int on success, FALSE on fail |
|
323 | - * @throws \EE_Error |
|
324 | - */ |
|
325 | - public function delete_items($line_item_codes = false) |
|
326 | - { |
|
327 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
328 | - return EEH_Line_Item::delete_items($this->get_grand_total(), $line_item_codes); |
|
329 | - } |
|
330 | - |
|
331 | - |
|
332 | - /** |
|
333 | - * @remove ALL items from cart and zero ALL totals |
|
334 | - * @access public |
|
335 | - * @return bool |
|
336 | - * @throws \EE_Error |
|
337 | - */ |
|
338 | - public function empty_cart() |
|
339 | - { |
|
340 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
341 | - $this->_grand_total = $this->_create_grand_total(); |
|
342 | - return $this->save_cart(true); |
|
343 | - } |
|
344 | - |
|
345 | - |
|
346 | - /** |
|
347 | - * @remove ALL items from cart and delete total as well |
|
348 | - * @access public |
|
349 | - * @return bool |
|
350 | - * @throws \EE_Error |
|
351 | - */ |
|
352 | - public function delete_cart() |
|
353 | - { |
|
354 | - if ($this->_grand_total instanceof EE_Line_Item) { |
|
355 | - $deleted = EEH_Line_Item::delete_all_child_items($this->_grand_total); |
|
356 | - if ($deleted) { |
|
357 | - $deleted += $this->_grand_total->delete(); |
|
358 | - $this->_grand_total = null; |
|
359 | - return true; |
|
360 | - } |
|
361 | - } |
|
362 | - return false; |
|
363 | - } |
|
364 | - |
|
365 | - |
|
366 | - /** |
|
367 | - * @save cart to session |
|
368 | - * @access public |
|
369 | - * @param bool $apply_taxes |
|
370 | - * @return TRUE on success, FALSE on fail |
|
371 | - * @throws \EE_Error |
|
372 | - */ |
|
373 | - public function save_cart($apply_taxes = true) |
|
374 | - { |
|
375 | - if ($apply_taxes && $this->_grand_total instanceof EE_Line_Item) { |
|
376 | - EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
377 | - // make sure we don't cache the transaction because it can get stale |
|
378 | - if ( |
|
379 | - $this->_grand_total->get_one_from_cache('Transaction') instanceof EE_Transaction |
|
380 | - && $this->_grand_total->get_one_from_cache('Transaction')->ID() |
|
381 | - ) { |
|
382 | - $this->_grand_total->clear_cache('Transaction', null, true); |
|
383 | - } |
|
384 | - } |
|
385 | - if ($this->session() instanceof EE_Session) { |
|
386 | - return $this->session()->set_cart($this); |
|
387 | - } else { |
|
388 | - return false; |
|
389 | - } |
|
390 | - } |
|
391 | - |
|
392 | - |
|
393 | - public function __wakeup() |
|
394 | - { |
|
395 | - if (! $this->_grand_total instanceof EE_Line_Item && absint($this->_grand_total) !== 0) { |
|
396 | - // $this->_grand_total is actually just an ID, so use it to get the object from the db |
|
397 | - $this->_grand_total = EEM_Line_Item::instance()->get_one_by_ID($this->_grand_total); |
|
398 | - } |
|
399 | - } |
|
400 | - |
|
401 | - |
|
402 | - /** |
|
403 | - * @return array |
|
404 | - */ |
|
405 | - public function __sleep() |
|
406 | - { |
|
407 | - if ($this->_grand_total instanceof EE_Line_Item && $this->_grand_total->ID()) { |
|
408 | - $this->_grand_total = $this->_grand_total->ID(); |
|
409 | - } |
|
410 | - return array('_grand_total'); |
|
411 | - } |
|
19 | + /** |
|
20 | + * instance of the EE_Cart object |
|
21 | + * |
|
22 | + * @access private |
|
23 | + * @var EE_Cart $_instance |
|
24 | + */ |
|
25 | + private static $_instance; |
|
26 | + |
|
27 | + /** |
|
28 | + * instance of the EE_Session object |
|
29 | + * |
|
30 | + * @access protected |
|
31 | + * @var EE_Session $_session |
|
32 | + */ |
|
33 | + protected $_session; |
|
34 | + |
|
35 | + /** |
|
36 | + * The total Line item which comprises all the children line-item subtotals, |
|
37 | + * which in turn each have their line items. |
|
38 | + * Typically, the line item structure will look like: |
|
39 | + * grand total |
|
40 | + * -tickets-sub-total |
|
41 | + * --ticket1 |
|
42 | + * --ticket2 |
|
43 | + * --... |
|
44 | + * -taxes-sub-total |
|
45 | + * --tax1 |
|
46 | + * --tax2 |
|
47 | + * |
|
48 | + * @var EE_Line_Item |
|
49 | + */ |
|
50 | + private $_grand_total; |
|
51 | + |
|
52 | + |
|
53 | + /** |
|
54 | + * @singleton method used to instantiate class object |
|
55 | + * @access public |
|
56 | + * @param EE_Line_Item $grand_total |
|
57 | + * @param EE_Session $session |
|
58 | + * @return \EE_Cart |
|
59 | + * @throws \EE_Error |
|
60 | + */ |
|
61 | + public static function instance(EE_Line_Item $grand_total = null, EE_Session $session = null) |
|
62 | + { |
|
63 | + if ($grand_total instanceof EE_Line_Item && $grand_total->is_total()) { |
|
64 | + self::$_instance = new self($grand_total, $session); |
|
65 | + } |
|
66 | + // or maybe retrieve an existing one ? |
|
67 | + if (! self::$_instance instanceof EE_Cart) { |
|
68 | + // try getting the cart out of the session |
|
69 | + $saved_cart = $session instanceof EE_Session ? $session->cart() : null; |
|
70 | + self::$_instance = $saved_cart instanceof EE_Cart ? $saved_cart : new self($grand_total, $session); |
|
71 | + unset($saved_cart); |
|
72 | + } |
|
73 | + // verify that cart is ok and grand total line item exists |
|
74 | + if (! self::$_instance instanceof EE_Cart || ! self::$_instance->_grand_total instanceof EE_Line_Item) { |
|
75 | + self::$_instance = new self($grand_total, $session); |
|
76 | + } |
|
77 | + self::$_instance->get_grand_total(); |
|
78 | + // once everything is all said and done, save the cart to the EE_Session |
|
79 | + add_action('shutdown', array(self::$_instance, 'save_cart'), 90); |
|
80 | + return self::$_instance; |
|
81 | + } |
|
82 | + |
|
83 | + |
|
84 | + /** |
|
85 | + * private constructor to prevent direct creation |
|
86 | + * |
|
87 | + * @Constructor |
|
88 | + * @access private |
|
89 | + * @param EE_Line_Item $grand_total |
|
90 | + * @param EE_Session $session |
|
91 | + */ |
|
92 | + private function __construct(EE_Line_Item $grand_total = null, EE_Session $session = null) |
|
93 | + { |
|
94 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
95 | + $this->set_session($session); |
|
96 | + if ($grand_total instanceof EE_Line_Item && $grand_total->is_total()) { |
|
97 | + $this->set_grand_total_line_item($grand_total); |
|
98 | + } |
|
99 | + } |
|
100 | + |
|
101 | + |
|
102 | + /** |
|
103 | + * Resets the cart completely (whereas empty_cart |
|
104 | + * |
|
105 | + * @param EE_Line_Item $grand_total |
|
106 | + * @param EE_Session $session |
|
107 | + * @return EE_Cart |
|
108 | + * @throws \EE_Error |
|
109 | + */ |
|
110 | + public static function reset(EE_Line_Item $grand_total = null, EE_Session $session = null) |
|
111 | + { |
|
112 | + remove_action('shutdown', array(self::$_instance, 'save_cart'), 90); |
|
113 | + if ($session instanceof EE_Session) { |
|
114 | + $session->reset_cart(); |
|
115 | + } |
|
116 | + self::$_instance = null; |
|
117 | + return self::instance($grand_total, $session); |
|
118 | + } |
|
119 | + |
|
120 | + |
|
121 | + /** |
|
122 | + * @return \EE_Session |
|
123 | + */ |
|
124 | + public function session() |
|
125 | + { |
|
126 | + if (! $this->_session instanceof EE_Session) { |
|
127 | + $this->set_session(); |
|
128 | + } |
|
129 | + return $this->_session; |
|
130 | + } |
|
131 | + |
|
132 | + |
|
133 | + /** |
|
134 | + * @param EE_Session $session |
|
135 | + */ |
|
136 | + public function set_session(EE_Session $session = null) |
|
137 | + { |
|
138 | + $this->_session = $session instanceof EE_Session ? $session : EE_Registry::instance()->load_core('Session'); |
|
139 | + } |
|
140 | + |
|
141 | + |
|
142 | + /** |
|
143 | + * Sets the cart to match the line item. Especially handy for loading an old cart where you |
|
144 | + * know the grand total line item on it |
|
145 | + * |
|
146 | + * @param EE_Line_Item $line_item |
|
147 | + */ |
|
148 | + public function set_grand_total_line_item(EE_Line_Item $line_item) |
|
149 | + { |
|
150 | + $this->_grand_total = $line_item; |
|
151 | + } |
|
152 | + |
|
153 | + |
|
154 | + /** |
|
155 | + * get_cart_from_reg_url_link |
|
156 | + * |
|
157 | + * @access public |
|
158 | + * @param EE_Transaction $transaction |
|
159 | + * @param EE_Session $session |
|
160 | + * @return \EE_Cart |
|
161 | + * @throws \EE_Error |
|
162 | + */ |
|
163 | + public static function get_cart_from_txn(EE_Transaction $transaction, EE_Session $session = null) |
|
164 | + { |
|
165 | + $grand_total = $transaction->total_line_item(); |
|
166 | + $grand_total->get_items(); |
|
167 | + $grand_total->tax_descendants(); |
|
168 | + return EE_Cart::instance($grand_total, $session); |
|
169 | + } |
|
170 | + |
|
171 | + |
|
172 | + /** |
|
173 | + * Creates the total line item, and ensures it has its 'tickets' and 'taxes' sub-items |
|
174 | + * |
|
175 | + * @return EE_Line_Item |
|
176 | + * @throws \EE_Error |
|
177 | + */ |
|
178 | + private function _create_grand_total() |
|
179 | + { |
|
180 | + $this->_grand_total = EEH_Line_Item::create_total_line_item(); |
|
181 | + return $this->_grand_total; |
|
182 | + } |
|
183 | + |
|
184 | + |
|
185 | + /** |
|
186 | + * Gets all the line items of object type Ticket |
|
187 | + * |
|
188 | + * @access public |
|
189 | + * @return \EE_Line_Item[] |
|
190 | + */ |
|
191 | + public function get_tickets() |
|
192 | + { |
|
193 | + if ($this->_grand_total === null) { |
|
194 | + return array(); |
|
195 | + } |
|
196 | + return EEH_Line_Item::get_ticket_line_items($this->_grand_total); |
|
197 | + } |
|
198 | + |
|
199 | + |
|
200 | + /** |
|
201 | + * returns the total quantity of tickets in the cart |
|
202 | + * |
|
203 | + * @access public |
|
204 | + * @return int |
|
205 | + * @throws \EE_Error |
|
206 | + */ |
|
207 | + public function all_ticket_quantity_count() |
|
208 | + { |
|
209 | + $tickets = $this->get_tickets(); |
|
210 | + if (empty($tickets)) { |
|
211 | + return 0; |
|
212 | + } |
|
213 | + $count = 0; |
|
214 | + foreach ($tickets as $ticket) { |
|
215 | + $count += $ticket->get('LIN_quantity'); |
|
216 | + } |
|
217 | + return $count; |
|
218 | + } |
|
219 | + |
|
220 | + |
|
221 | + /** |
|
222 | + * Gets all the tax line items |
|
223 | + * |
|
224 | + * @return \EE_Line_Item[] |
|
225 | + * @throws \EE_Error |
|
226 | + */ |
|
227 | + public function get_taxes() |
|
228 | + { |
|
229 | + return EEH_Line_Item::get_taxes_subtotal($this->_grand_total)->children(); |
|
230 | + } |
|
231 | + |
|
232 | + |
|
233 | + /** |
|
234 | + * Gets the total line item (which is a parent of all other line items) on this cart |
|
235 | + * |
|
236 | + * @return EE_Line_Item |
|
237 | + * @throws \EE_Error |
|
238 | + */ |
|
239 | + public function get_grand_total() |
|
240 | + { |
|
241 | + return $this->_grand_total instanceof EE_Line_Item ? $this->_grand_total : $this->_create_grand_total(); |
|
242 | + } |
|
243 | + |
|
244 | + |
|
245 | + /** |
|
246 | + * @process items for adding to cart |
|
247 | + * @access public |
|
248 | + * @param EE_Ticket $ticket |
|
249 | + * @param int $qty |
|
250 | + * @return TRUE on success, FALSE on fail |
|
251 | + * @throws \EE_Error |
|
252 | + */ |
|
253 | + public function add_ticket_to_cart(EE_Ticket $ticket, $qty = 1) |
|
254 | + { |
|
255 | + EEH_Line_Item::add_ticket_purchase($this->get_grand_total(), $ticket, $qty); |
|
256 | + return $this->save_cart() ? true : false; |
|
257 | + } |
|
258 | + |
|
259 | + |
|
260 | + /** |
|
261 | + * get_cart_total_before_tax |
|
262 | + * |
|
263 | + * @access public |
|
264 | + * @return float |
|
265 | + * @throws \EE_Error |
|
266 | + */ |
|
267 | + public function get_cart_total_before_tax() |
|
268 | + { |
|
269 | + return $this->get_grand_total()->recalculate_pre_tax_total(); |
|
270 | + } |
|
271 | + |
|
272 | + |
|
273 | + /** |
|
274 | + * gets the total amount of tax paid for items in this cart |
|
275 | + * |
|
276 | + * @access public |
|
277 | + * @return float |
|
278 | + * @throws \EE_Error |
|
279 | + */ |
|
280 | + public function get_applied_taxes() |
|
281 | + { |
|
282 | + return EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
283 | + } |
|
284 | + |
|
285 | + |
|
286 | + /** |
|
287 | + * Gets the total amount to be paid for the items in the cart, including taxes and other modifiers |
|
288 | + * |
|
289 | + * @access public |
|
290 | + * @return float |
|
291 | + * @throws \EE_Error |
|
292 | + */ |
|
293 | + public function get_cart_grand_total() |
|
294 | + { |
|
295 | + EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
296 | + return $this->get_grand_total()->total(); |
|
297 | + } |
|
298 | + |
|
299 | + |
|
300 | + /** |
|
301 | + * Gets the total amount to be paid for the items in the cart, including taxes and other modifiers |
|
302 | + * |
|
303 | + * @access public |
|
304 | + * @return float |
|
305 | + * @throws \EE_Error |
|
306 | + */ |
|
307 | + public function recalculate_all_cart_totals() |
|
308 | + { |
|
309 | + $pre_tax_total = $this->get_cart_total_before_tax(); |
|
310 | + $taxes_total = EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
311 | + $this->_grand_total->set_total($pre_tax_total + $taxes_total); |
|
312 | + $this->_grand_total->save_this_and_descendants_to_txn(); |
|
313 | + return $this->get_grand_total()->total(); |
|
314 | + } |
|
315 | + |
|
316 | + |
|
317 | + /** |
|
318 | + * deletes an item from the cart |
|
319 | + * |
|
320 | + * @access public |
|
321 | + * @param array|bool|string $line_item_codes |
|
322 | + * @return int on success, FALSE on fail |
|
323 | + * @throws \EE_Error |
|
324 | + */ |
|
325 | + public function delete_items($line_item_codes = false) |
|
326 | + { |
|
327 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
328 | + return EEH_Line_Item::delete_items($this->get_grand_total(), $line_item_codes); |
|
329 | + } |
|
330 | + |
|
331 | + |
|
332 | + /** |
|
333 | + * @remove ALL items from cart and zero ALL totals |
|
334 | + * @access public |
|
335 | + * @return bool |
|
336 | + * @throws \EE_Error |
|
337 | + */ |
|
338 | + public function empty_cart() |
|
339 | + { |
|
340 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
341 | + $this->_grand_total = $this->_create_grand_total(); |
|
342 | + return $this->save_cart(true); |
|
343 | + } |
|
344 | + |
|
345 | + |
|
346 | + /** |
|
347 | + * @remove ALL items from cart and delete total as well |
|
348 | + * @access public |
|
349 | + * @return bool |
|
350 | + * @throws \EE_Error |
|
351 | + */ |
|
352 | + public function delete_cart() |
|
353 | + { |
|
354 | + if ($this->_grand_total instanceof EE_Line_Item) { |
|
355 | + $deleted = EEH_Line_Item::delete_all_child_items($this->_grand_total); |
|
356 | + if ($deleted) { |
|
357 | + $deleted += $this->_grand_total->delete(); |
|
358 | + $this->_grand_total = null; |
|
359 | + return true; |
|
360 | + } |
|
361 | + } |
|
362 | + return false; |
|
363 | + } |
|
364 | + |
|
365 | + |
|
366 | + /** |
|
367 | + * @save cart to session |
|
368 | + * @access public |
|
369 | + * @param bool $apply_taxes |
|
370 | + * @return TRUE on success, FALSE on fail |
|
371 | + * @throws \EE_Error |
|
372 | + */ |
|
373 | + public function save_cart($apply_taxes = true) |
|
374 | + { |
|
375 | + if ($apply_taxes && $this->_grand_total instanceof EE_Line_Item) { |
|
376 | + EEH_Line_Item::ensure_taxes_applied($this->_grand_total); |
|
377 | + // make sure we don't cache the transaction because it can get stale |
|
378 | + if ( |
|
379 | + $this->_grand_total->get_one_from_cache('Transaction') instanceof EE_Transaction |
|
380 | + && $this->_grand_total->get_one_from_cache('Transaction')->ID() |
|
381 | + ) { |
|
382 | + $this->_grand_total->clear_cache('Transaction', null, true); |
|
383 | + } |
|
384 | + } |
|
385 | + if ($this->session() instanceof EE_Session) { |
|
386 | + return $this->session()->set_cart($this); |
|
387 | + } else { |
|
388 | + return false; |
|
389 | + } |
|
390 | + } |
|
391 | + |
|
392 | + |
|
393 | + public function __wakeup() |
|
394 | + { |
|
395 | + if (! $this->_grand_total instanceof EE_Line_Item && absint($this->_grand_total) !== 0) { |
|
396 | + // $this->_grand_total is actually just an ID, so use it to get the object from the db |
|
397 | + $this->_grand_total = EEM_Line_Item::instance()->get_one_by_ID($this->_grand_total); |
|
398 | + } |
|
399 | + } |
|
400 | + |
|
401 | + |
|
402 | + /** |
|
403 | + * @return array |
|
404 | + */ |
|
405 | + public function __sleep() |
|
406 | + { |
|
407 | + if ($this->_grand_total instanceof EE_Line_Item && $this->_grand_total->ID()) { |
|
408 | + $this->_grand_total = $this->_grand_total->ID(); |
|
409 | + } |
|
410 | + return array('_grand_total'); |
|
411 | + } |
|
412 | 412 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | return htmlspecialchars($string); |
47 | 47 | } else { |
48 | 48 | if ($translate === false) { |
49 | - return self::ee_tep_parse_input_field_data($string, array( '"' => '"' )); |
|
49 | + return self::ee_tep_parse_input_field_data($string, array('"' => '"')); |
|
50 | 50 | } else { |
51 | 51 | return self::ee_tep_parse_input_field_data($string, $translate); |
52 | 52 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | return false; |
85 | 85 | } |
86 | 86 | } else { |
87 | - if (( $value !== '' ) && ( strtolower($value) !== 'null' ) && ( strlen(trim($value)) > 0 )) { |
|
87 | + if (($value !== '') && (strtolower($value) !== 'null') && (strlen(trim($value)) > 0)) { |
|
88 | 88 | return true; |
89 | 89 | } else { |
90 | 90 | return false; |
@@ -10,108 +10,108 @@ |
||
10 | 10 | */ |
11 | 11 | class EEH_Formatter |
12 | 12 | { |
13 | - /** |
|
14 | - * _admin_format_content |
|
15 | - * Text formatting function for wp_editor. |
|
16 | - * This should fix all of the formatting issues of text output from the database. |
|
17 | - * |
|
18 | - * @static |
|
19 | - * @access public |
|
20 | - * @param string $content content to format |
|
21 | - * @return string formatted content |
|
22 | - */ |
|
23 | - public static function admin_format_content($content = '') |
|
24 | - { |
|
25 | - return wpautop(stripslashes_deep(html_entity_decode($content, ENT_QUOTES, "UTF-8"))); |
|
26 | - } |
|
13 | + /** |
|
14 | + * _admin_format_content |
|
15 | + * Text formatting function for wp_editor. |
|
16 | + * This should fix all of the formatting issues of text output from the database. |
|
17 | + * |
|
18 | + * @static |
|
19 | + * @access public |
|
20 | + * @param string $content content to format |
|
21 | + * @return string formatted content |
|
22 | + */ |
|
23 | + public static function admin_format_content($content = '') |
|
24 | + { |
|
25 | + return wpautop(stripslashes_deep(html_entity_decode($content, ENT_QUOTES, "UTF-8"))); |
|
26 | + } |
|
27 | 27 | |
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * ee_tep_output_string |
|
32 | - * todo: we need a description for this. |
|
33 | - * |
|
34 | - * @static |
|
35 | - * @access public |
|
36 | - * @param string $string string to handle |
|
37 | - * @param boolean $translate //todo what is this for? |
|
38 | - * @param boolean $protected true then we run htmlspecialchars and return |
|
39 | - * @return string |
|
40 | - */ |
|
41 | - public static function ee_tep_output_string($string, $translate = false, $protected = false) |
|
42 | - { |
|
43 | - if ($protected === true) { |
|
44 | - return htmlspecialchars($string); |
|
45 | - } else { |
|
46 | - if ($translate === false) { |
|
47 | - return self::ee_tep_parse_input_field_data($string, array( '"' => '"' )); |
|
48 | - } else { |
|
49 | - return self::ee_tep_parse_input_field_data($string, $translate); |
|
50 | - } |
|
51 | - } |
|
52 | - } |
|
30 | + /** |
|
31 | + * ee_tep_output_string |
|
32 | + * todo: we need a description for this. |
|
33 | + * |
|
34 | + * @static |
|
35 | + * @access public |
|
36 | + * @param string $string string to handle |
|
37 | + * @param boolean $translate //todo what is this for? |
|
38 | + * @param boolean $protected true then we run htmlspecialchars and return |
|
39 | + * @return string |
|
40 | + */ |
|
41 | + public static function ee_tep_output_string($string, $translate = false, $protected = false) |
|
42 | + { |
|
43 | + if ($protected === true) { |
|
44 | + return htmlspecialchars($string); |
|
45 | + } else { |
|
46 | + if ($translate === false) { |
|
47 | + return self::ee_tep_parse_input_field_data($string, array( '"' => '"' )); |
|
48 | + } else { |
|
49 | + return self::ee_tep_parse_input_field_data($string, $translate); |
|
50 | + } |
|
51 | + } |
|
52 | + } |
|
53 | 53 | |
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * ee_tep_parse_input_field_data |
|
58 | - * |
|
59 | - * @param string $data string to be "translated" |
|
60 | - * @param array ] $parse array in the form array( 'from' => 'to', ... ) |
|
61 | - * @return string |
|
62 | - */ |
|
63 | - public static function ee_tep_parse_input_field_data($data, $parse) |
|
64 | - { |
|
65 | - return strtr(trim($data), $parse); |
|
66 | - } |
|
56 | + /** |
|
57 | + * ee_tep_parse_input_field_data |
|
58 | + * |
|
59 | + * @param string $data string to be "translated" |
|
60 | + * @param array ] $parse array in the form array( 'from' => 'to', ... ) |
|
61 | + * @return string |
|
62 | + */ |
|
63 | + public static function ee_tep_parse_input_field_data($data, $parse) |
|
64 | + { |
|
65 | + return strtr(trim($data), $parse); |
|
66 | + } |
|
67 | 67 | |
68 | 68 | |
69 | 69 | |
70 | - /** |
|
71 | - * [ee_tep_not_null description] |
|
72 | - * |
|
73 | - * @param string | array $value [description] |
|
74 | - * @return bool [description] |
|
75 | - */ |
|
76 | - public static function ee_tep_not_null($value) |
|
77 | - { |
|
78 | - if (is_array($value)) { |
|
79 | - if (count($value) > 0) { |
|
80 | - return true; |
|
81 | - } else { |
|
82 | - return false; |
|
83 | - } |
|
84 | - } else { |
|
85 | - if (( $value !== '' ) && ( strtolower($value) !== 'null' ) && ( strlen(trim($value)) > 0 )) { |
|
86 | - return true; |
|
87 | - } else { |
|
88 | - return false; |
|
89 | - } |
|
90 | - } |
|
91 | - } |
|
70 | + /** |
|
71 | + * [ee_tep_not_null description] |
|
72 | + * |
|
73 | + * @param string | array $value [description] |
|
74 | + * @return bool [description] |
|
75 | + */ |
|
76 | + public static function ee_tep_not_null($value) |
|
77 | + { |
|
78 | + if (is_array($value)) { |
|
79 | + if (count($value) > 0) { |
|
80 | + return true; |
|
81 | + } else { |
|
82 | + return false; |
|
83 | + } |
|
84 | + } else { |
|
85 | + if (( $value !== '' ) && ( strtolower($value) !== 'null' ) && ( strlen(trim($value)) > 0 )) { |
|
86 | + return true; |
|
87 | + } else { |
|
88 | + return false; |
|
89 | + } |
|
90 | + } |
|
91 | + } |
|
92 | 92 | |
93 | 93 | |
94 | 94 | |
95 | - /** |
|
96 | - * Formats a date |
|
97 | - * |
|
98 | - * @param string $date |
|
99 | - * @param string $format - format for the date |
|
100 | - * @deprecated 4.6.12 Note, a search revealed this was not used anywhere in core or in our |
|
101 | - * addons at time of writing this. So just deprecated in case of third party use. |
|
102 | - * @return string |
|
103 | - * @deprecated v4.6.21 |
|
104 | - */ |
|
105 | - public static function event_date_display($date, $format = '') |
|
106 | - { |
|
107 | - EE_Error::doing_it_wrong( |
|
108 | - __METHOD__, |
|
109 | - esc_html__( |
|
110 | - 'This method is deprecated as of EE 4.6.12. Currently it does not reformat as with prior behaviour but just returns the incoming string. Please use the EE_Datetime helpers for Datetime on the event to display as desired.', |
|
111 | - 'event_espresso' |
|
112 | - ), |
|
113 | - '4.6.21' |
|
114 | - ); |
|
115 | - return $date; |
|
116 | - } |
|
95 | + /** |
|
96 | + * Formats a date |
|
97 | + * |
|
98 | + * @param string $date |
|
99 | + * @param string $format - format for the date |
|
100 | + * @deprecated 4.6.12 Note, a search revealed this was not used anywhere in core or in our |
|
101 | + * addons at time of writing this. So just deprecated in case of third party use. |
|
102 | + * @return string |
|
103 | + * @deprecated v4.6.21 |
|
104 | + */ |
|
105 | + public static function event_date_display($date, $format = '') |
|
106 | + { |
|
107 | + EE_Error::doing_it_wrong( |
|
108 | + __METHOD__, |
|
109 | + esc_html__( |
|
110 | + 'This method is deprecated as of EE 4.6.12. Currently it does not reformat as with prior behaviour but just returns the incoming string. Please use the EE_Datetime helpers for Datetime on the event to display as desired.', |
|
111 | + 'event_espresso' |
|
112 | + ), |
|
113 | + '4.6.21' |
|
114 | + ); |
|
115 | + return $date; |
|
116 | + } |
|
117 | 117 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | */ |
45 | 45 | public function pre_get_posts(WP_Query $WP_Query) |
46 | 46 | { |
47 | - if (! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) { |
|
47 | + if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) { |
|
48 | 48 | return $WP_Query; |
49 | 49 | } |
50 | 50 | return $WP_Query; |
@@ -11,70 +11,70 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_CPT_Default_Strategy |
13 | 13 | { |
14 | - /** |
|
15 | - * $CPT - the current page, if it utilizes CPTs |
|
16 | - * |
|
17 | - * @var object |
|
18 | - * @access protected |
|
19 | - */ |
|
20 | - protected $CPT = null; |
|
14 | + /** |
|
15 | + * $CPT - the current page, if it utilizes CPTs |
|
16 | + * |
|
17 | + * @var object |
|
18 | + * @access protected |
|
19 | + */ |
|
20 | + protected $CPT = null; |
|
21 | 21 | |
22 | 22 | |
23 | - /** |
|
24 | - * class constructor |
|
25 | - * |
|
26 | - * @access private |
|
27 | - * @param array $arguments |
|
28 | - * @return \EE_CPT_Default_Strategy |
|
29 | - */ |
|
30 | - public function __construct($arguments = array()) |
|
31 | - { |
|
32 | - $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : null; |
|
33 | - } |
|
23 | + /** |
|
24 | + * class constructor |
|
25 | + * |
|
26 | + * @access private |
|
27 | + * @param array $arguments |
|
28 | + * @return \EE_CPT_Default_Strategy |
|
29 | + */ |
|
30 | + public function __construct($arguments = array()) |
|
31 | + { |
|
32 | + $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : null; |
|
33 | + } |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * pre_get_posts |
|
38 | - * |
|
39 | - * @access public |
|
40 | - * @param \WP_Query $WP_Query |
|
41 | - * @return \WP_Query |
|
42 | - */ |
|
43 | - public function pre_get_posts(WP_Query $WP_Query) |
|
44 | - { |
|
45 | - if (! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) { |
|
46 | - return $WP_Query; |
|
47 | - } |
|
48 | - return $WP_Query; |
|
49 | - } |
|
36 | + /** |
|
37 | + * pre_get_posts |
|
38 | + * |
|
39 | + * @access public |
|
40 | + * @param \WP_Query $WP_Query |
|
41 | + * @return \WP_Query |
|
42 | + */ |
|
43 | + public function pre_get_posts(WP_Query $WP_Query) |
|
44 | + { |
|
45 | + if (! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) { |
|
46 | + return $WP_Query; |
|
47 | + } |
|
48 | + return $WP_Query; |
|
49 | + } |
|
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * wp |
|
54 | - * |
|
55 | - * @access public |
|
56 | - * @param \WP_Post[] $posts |
|
57 | - * @param \WP_Query $WP_Query |
|
58 | - * @return \WP_Post[] |
|
59 | - */ |
|
60 | - public function the_posts($posts, WP_Query $WP_Query) |
|
61 | - { |
|
62 | - return $posts; |
|
63 | - } |
|
52 | + /** |
|
53 | + * wp |
|
54 | + * |
|
55 | + * @access public |
|
56 | + * @param \WP_Post[] $posts |
|
57 | + * @param \WP_Query $WP_Query |
|
58 | + * @return \WP_Post[] |
|
59 | + */ |
|
60 | + public function the_posts($posts, WP_Query $WP_Query) |
|
61 | + { |
|
62 | + return $posts; |
|
63 | + } |
|
64 | 64 | |
65 | 65 | |
66 | - /** |
|
67 | - * get_EE_post_type_metadata |
|
68 | - * |
|
69 | - * @access public |
|
70 | - * @param mixed $meta_value |
|
71 | - * @param int $post_id |
|
72 | - * @param string $meta_key |
|
73 | - * @param string $single |
|
74 | - * @return mixed |
|
75 | - */ |
|
76 | - public function get_EE_post_type_metadata($meta_value = null, $post_id, $meta_key, $single) |
|
77 | - { |
|
78 | - return $meta_value; |
|
79 | - } |
|
66 | + /** |
|
67 | + * get_EE_post_type_metadata |
|
68 | + * |
|
69 | + * @access public |
|
70 | + * @param mixed $meta_value |
|
71 | + * @param int $post_id |
|
72 | + * @param string $meta_key |
|
73 | + * @param string $single |
|
74 | + * @return mixed |
|
75 | + */ |
|
76 | + public function get_EE_post_type_metadata($meta_value = null, $post_id, $meta_key, $single) |
|
77 | + { |
|
78 | + return $meta_value; |
|
79 | + } |
|
80 | 80 | } |
@@ -60,7 +60,7 @@ |
||
60 | 60 | */ |
61 | 61 | public static function getInvalidCheckoutAccess() |
62 | 62 | { |
63 | - if (! self::$invalid_checkout_access_form instanceof InvalidCheckoutAccess) { |
|
63 | + if ( ! self::$invalid_checkout_access_form instanceof InvalidCheckoutAccess) { |
|
64 | 64 | self::$invalid_checkout_access_form = new InvalidCheckoutAccess(); |
65 | 65 | } |
66 | 66 | return self::$invalid_checkout_access_form; |
@@ -13,84 +13,84 @@ |
||
13 | 13 | */ |
14 | 14 | class EED_Invalid_Checkout_Access extends EED_Module |
15 | 15 | { |
16 | - /** |
|
17 | - * @var InvalidCheckoutAccess $invalid_checkout_access_form |
|
18 | - */ |
|
19 | - private static $invalid_checkout_access_form; |
|
16 | + /** |
|
17 | + * @var InvalidCheckoutAccess $invalid_checkout_access_form |
|
18 | + */ |
|
19 | + private static $invalid_checkout_access_form; |
|
20 | 20 | |
21 | - /** |
|
22 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
23 | - */ |
|
24 | - public static function set_hooks() |
|
25 | - { |
|
26 | - } |
|
21 | + /** |
|
22 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
23 | + */ |
|
24 | + public static function set_hooks() |
|
25 | + { |
|
26 | + } |
|
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
31 | - */ |
|
32 | - public static function set_hooks_admin() |
|
33 | - { |
|
34 | - add_action( |
|
35 | - 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', |
|
36 | - array('EED_Invalid_Checkout_Access', 'display_invalid_checkout_access_form'), |
|
37 | - 15 |
|
38 | - ); |
|
39 | - add_filter( |
|
40 | - 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', |
|
41 | - array('EED_Invalid_Checkout_Access', 'process_invalid_checkout_access_form') |
|
42 | - ); |
|
43 | - } |
|
29 | + /** |
|
30 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
31 | + */ |
|
32 | + public static function set_hooks_admin() |
|
33 | + { |
|
34 | + add_action( |
|
35 | + 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', |
|
36 | + array('EED_Invalid_Checkout_Access', 'display_invalid_checkout_access_form'), |
|
37 | + 15 |
|
38 | + ); |
|
39 | + add_filter( |
|
40 | + 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', |
|
41 | + array('EED_Invalid_Checkout_Access', 'process_invalid_checkout_access_form') |
|
42 | + ); |
|
43 | + } |
|
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * run - initial module setup |
|
48 | - * this method is primarily used for activating resources in the EE_Front_Controller thru the use of filters |
|
49 | - * |
|
50 | - * @var WP $WP |
|
51 | - */ |
|
52 | - public function run($WP) |
|
53 | - { |
|
54 | - // TODO: Implement run() method. |
|
55 | - } |
|
46 | + /** |
|
47 | + * run - initial module setup |
|
48 | + * this method is primarily used for activating resources in the EE_Front_Controller thru the use of filters |
|
49 | + * |
|
50 | + * @var WP $WP |
|
51 | + */ |
|
52 | + public function run($WP) |
|
53 | + { |
|
54 | + // TODO: Implement run() method. |
|
55 | + } |
|
56 | 56 | |
57 | 57 | |
58 | - /** |
|
59 | - * @return InvalidCheckoutAccess |
|
60 | - */ |
|
61 | - public static function getInvalidCheckoutAccess() |
|
62 | - { |
|
63 | - if (! self::$invalid_checkout_access_form instanceof InvalidCheckoutAccess) { |
|
64 | - self::$invalid_checkout_access_form = new InvalidCheckoutAccess(); |
|
65 | - } |
|
66 | - return self::$invalid_checkout_access_form; |
|
67 | - } |
|
58 | + /** |
|
59 | + * @return InvalidCheckoutAccess |
|
60 | + */ |
|
61 | + public static function getInvalidCheckoutAccess() |
|
62 | + { |
|
63 | + if (! self::$invalid_checkout_access_form instanceof InvalidCheckoutAccess) { |
|
64 | + self::$invalid_checkout_access_form = new InvalidCheckoutAccess(); |
|
65 | + } |
|
66 | + return self::$invalid_checkout_access_form; |
|
67 | + } |
|
68 | 68 | |
69 | 69 | |
70 | - /** |
|
71 | - * email_validation_settings_form |
|
72 | - * |
|
73 | - * @return void |
|
74 | - * @throws EE_Error |
|
75 | - */ |
|
76 | - public static function display_invalid_checkout_access_form() |
|
77 | - { |
|
78 | - $invalid_checkout_access_form = EED_Invalid_Checkout_Access::getInvalidCheckoutAccess(); |
|
79 | - echo wp_kses($invalid_checkout_access_form->getForm()->get_html(), AllowedTags::getWithFormTags()); |
|
80 | - } |
|
70 | + /** |
|
71 | + * email_validation_settings_form |
|
72 | + * |
|
73 | + * @return void |
|
74 | + * @throws EE_Error |
|
75 | + */ |
|
76 | + public static function display_invalid_checkout_access_form() |
|
77 | + { |
|
78 | + $invalid_checkout_access_form = EED_Invalid_Checkout_Access::getInvalidCheckoutAccess(); |
|
79 | + echo wp_kses($invalid_checkout_access_form->getForm()->get_html(), AllowedTags::getWithFormTags()); |
|
80 | + } |
|
81 | 81 | |
82 | 82 | |
83 | - /** |
|
84 | - * email_validation_settings_form |
|
85 | - * |
|
86 | - * @param EE_Registration_Config $EE_Registration_Config |
|
87 | - * @return EE_Registration_Config |
|
88 | - * @throws EE_Error |
|
89 | - * @throws ReflectionException |
|
90 | - */ |
|
91 | - public static function process_invalid_checkout_access_form(EE_Registration_Config $EE_Registration_Config) |
|
92 | - { |
|
93 | - $invalid_checkout_access_form = EED_Invalid_Checkout_Access::getInvalidCheckoutAccess(); |
|
94 | - return $invalid_checkout_access_form->processForm($EE_Registration_Config); |
|
95 | - } |
|
83 | + /** |
|
84 | + * email_validation_settings_form |
|
85 | + * |
|
86 | + * @param EE_Registration_Config $EE_Registration_Config |
|
87 | + * @return EE_Registration_Config |
|
88 | + * @throws EE_Error |
|
89 | + * @throws ReflectionException |
|
90 | + */ |
|
91 | + public static function process_invalid_checkout_access_form(EE_Registration_Config $EE_Registration_Config) |
|
92 | + { |
|
93 | + $invalid_checkout_access_form = EED_Invalid_Checkout_Access::getInvalidCheckoutAccess(); |
|
94 | + return $invalid_checkout_access_form->processForm($EE_Registration_Config); |
|
95 | + } |
|
96 | 96 | } |
@@ -3,13 +3,13 @@ |
||
3 | 3 | // if this is decaf, which is put on WordPress.org, we need to inform users that |
4 | 4 | // we just put an affiliate link there. See https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/ section 12 |
5 | 5 | if (apply_filters('FHEE__ee_show_affiliate_links', true)) { |
6 | - $closing_tag .= esc_html__(' (affiliate link)', 'event_espresso'); |
|
6 | + $closing_tag .= esc_html__(' (affiliate link)', 'event_espresso'); |
|
7 | 7 | } |
8 | 8 | printf( |
9 | - esc_html__( |
|
10 | - 'PayPal Standard (PayPal Payments Standard) is an off-site payment method and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', |
|
11 | - 'event_espresso' |
|
12 | - ), |
|
13 | - '<a href="https://eventespresso.com/go/paypalstandard/" target="_blank">', |
|
14 | - $closing_tag |
|
9 | + esc_html__( |
|
10 | + 'PayPal Standard (PayPal Payments Standard) is an off-site payment method and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', |
|
11 | + 'event_espresso' |
|
12 | + ), |
|
13 | + '<a href="https://eventespresso.com/go/paypalstandard/" target="_blank">', |
|
14 | + $closing_tag |
|
15 | 15 | ); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $limit = array($offset, $per_page); |
217 | 217 | |
218 | 218 | if (isset($this->_req_data['s'])) { |
219 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
219 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
220 | 220 | $_where['OR'] = array( |
221 | 221 | 'TKT_name' => array('LIKE', $sstr), |
222 | 222 | 'TKT_description' => array('LIKE', $sstr), |
@@ -245,18 +245,18 @@ discard block |
||
245 | 245 | $TKT = EEM_Ticket::instance(); |
246 | 246 | |
247 | 247 | // checkboxes? |
248 | - if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
248 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
249 | 249 | // if array has more than one element then success message should be plural |
250 | 250 | $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
251 | 251 | |
252 | 252 | // cycle thru the boxes |
253 | 253 | while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
254 | 254 | if ($trash) { |
255 | - if (! $TKT->delete_by_ID($TKT_ID)) { |
|
255 | + if ( ! $TKT->delete_by_ID($TKT_ID)) { |
|
256 | 256 | $success = 0; |
257 | 257 | } |
258 | 258 | } else { |
259 | - if (! $TKT->restore_by_ID($TKT_ID)) { |
|
259 | + if ( ! $TKT->restore_by_ID($TKT_ID)) { |
|
260 | 260 | $success = 0; |
261 | 261 | } |
262 | 262 | } |
@@ -266,11 +266,11 @@ discard block |
||
266 | 266 | $TKT_ID = absint($this->_req_data['TKT_ID']); |
267 | 267 | |
268 | 268 | if ($trash) { |
269 | - if (! $TKT->delete_by_ID($TKT_ID)) { |
|
269 | + if ( ! $TKT->delete_by_ID($TKT_ID)) { |
|
270 | 270 | $success = 0; |
271 | 271 | } |
272 | 272 | } else { |
273 | - if (! $TKT->restore_by_ID($TKT_ID)) { |
|
273 | + if ( ! $TKT->restore_by_ID($TKT_ID)) { |
|
274 | 274 | $success = 0; |
275 | 275 | } |
276 | 276 | } |
@@ -288,21 +288,21 @@ discard block |
||
288 | 288 | $TKT = EEM_Ticket::instance(); |
289 | 289 | |
290 | 290 | // checkboxes? |
291 | - if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
291 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
292 | 292 | // if array has more than one element then success message should be plural |
293 | 293 | $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
294 | 294 | |
295 | 295 | // cycle thru the boxes |
296 | 296 | while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
297 | 297 | // delete |
298 | - if (! $this->_delete_the_ticket($TKT_ID)) { |
|
298 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
299 | 299 | $success = 0; |
300 | 300 | } |
301 | 301 | } |
302 | 302 | } else { |
303 | 303 | // grab single id and trash |
304 | 304 | $TKT_ID = absint($this->_req_data['TKT_ID']); |
305 | - if (! $this->_delete_the_ticket($TKT_ID)) { |
|
305 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
306 | 306 | $success = 0; |
307 | 307 | } |
308 | 308 | } |
@@ -11,312 +11,312 @@ |
||
11 | 11 | */ |
12 | 12 | class Tickets_Admin_Page extends EE_Admin_Page |
13 | 13 | { |
14 | - protected function _init_page_props() |
|
15 | - { |
|
16 | - $this->page_slug = TICKETS_PG_SLUG; |
|
17 | - $this->page_label = TICKETS_LABEL; |
|
18 | - $this->_admin_base_url = TICKETS_ADMIN_URL; |
|
19 | - $this->_admin_base_path = TICKETS_ADMIN; |
|
20 | - } |
|
21 | - |
|
22 | - |
|
23 | - protected function _ajax_hooks() |
|
24 | - { |
|
25 | - } |
|
26 | - |
|
27 | - |
|
28 | - protected function _define_page_props() |
|
29 | - { |
|
30 | - $this->_admin_page_title = TICKETS_LABEL; |
|
31 | - $this->_labels = array( |
|
32 | - 'buttons' => array( |
|
33 | - 'add' => esc_html__('Add New Default Ticket', 'event_espresso'), |
|
34 | - 'edit' => esc_html__('Edit Default Ticket', 'event_espresso'), |
|
35 | - 'delete' => esc_html__('Delete Default Ticket', 'event_espresso'), |
|
36 | - ), |
|
37 | - ); |
|
38 | - } |
|
39 | - |
|
40 | - |
|
41 | - protected function _set_page_routes() |
|
42 | - { |
|
43 | - |
|
44 | - $tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID']) |
|
45 | - ? $this->_req_data['TKT_ID'] : 0; |
|
46 | - |
|
47 | - $this->_page_routes = array( |
|
48 | - 'default' => array( |
|
49 | - 'func' => '_tickets_overview_list_table', |
|
50 | - 'capability' => 'ee_read_default_tickets', |
|
51 | - ), |
|
52 | - 'trash_ticket' => array( |
|
53 | - 'func' => '_trash_or_restore_ticket', |
|
54 | - 'noheader' => true, |
|
55 | - 'args' => array('trash' => true), |
|
56 | - 'capability' => 'ee_delete_default_ticket', |
|
57 | - 'obj_id' => $tkt_id, |
|
58 | - ), |
|
59 | - 'trash_tickets' => array( |
|
60 | - 'func' => '_trash_or_restore_ticket', |
|
61 | - 'noheader' => true, |
|
62 | - 'args' => array('trash' => true), |
|
63 | - 'capability' => 'ee_delete_default_tickets', |
|
64 | - ), |
|
65 | - 'restore_ticket' => array( |
|
66 | - 'func' => '_trash_or_restore_ticket', |
|
67 | - 'noheader' => true, |
|
68 | - 'capability' => 'ee_delete_default_ticket', |
|
69 | - 'obj_id' => $tkt_id, |
|
70 | - ), |
|
71 | - 'restore_tickets' => array( |
|
72 | - 'func' => '_trash_or_restore_ticket', |
|
73 | - 'noheader' => true, |
|
74 | - 'capability' => 'ee_delete_default_tickets', |
|
75 | - ), |
|
76 | - 'delete_ticket' => array( |
|
77 | - 'func' => '_delete_ticket', |
|
78 | - 'noheader' => true, |
|
79 | - 'capability' => 'ee_delete_default_ticket', |
|
80 | - 'obj_id' => $tkt_id, |
|
81 | - ), |
|
82 | - 'delete_tickets' => array( |
|
83 | - 'func' => '_delete_ticket', |
|
84 | - 'noheader' => true, |
|
85 | - 'capability' => 'ee_delete_default_tickets', |
|
86 | - ), |
|
87 | - ); |
|
88 | - } |
|
89 | - |
|
90 | - |
|
91 | - protected function _set_page_config() |
|
92 | - { |
|
93 | - $this->_page_config = array( |
|
94 | - 'default' => array( |
|
95 | - 'nav' => array( |
|
96 | - 'label' => esc_html__('Default Tickets', 'event_espresso'), |
|
97 | - 'order' => 10, |
|
98 | - ), |
|
99 | - 'list_table' => 'Tickets_List_Table', |
|
100 | - 'require_nonce' => false, |
|
101 | - ), |
|
102 | - ); |
|
103 | - } |
|
104 | - |
|
105 | - |
|
106 | - protected function _add_screen_options() |
|
107 | - { |
|
108 | - } |
|
109 | - |
|
110 | - protected function _add_screen_options_default() |
|
111 | - { |
|
112 | - $this->_per_page_screen_option(); |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - protected function _add_feature_pointers() |
|
117 | - { |
|
118 | - } |
|
119 | - |
|
120 | - public function load_scripts_styles() |
|
121 | - { |
|
122 | - } |
|
123 | - |
|
124 | - public function load_scripts_styles_default() |
|
125 | - { |
|
126 | - } |
|
127 | - |
|
128 | - public function admin_footer_scripts() |
|
129 | - { |
|
130 | - } |
|
131 | - |
|
132 | - public function admin_init() |
|
133 | - { |
|
134 | - } |
|
135 | - |
|
136 | - public function admin_notices() |
|
137 | - { |
|
138 | - } |
|
139 | - |
|
140 | - |
|
141 | - public function _set_list_table_views_default() |
|
142 | - { |
|
143 | - $this->_views = array( |
|
144 | - 'all' => array( |
|
145 | - 'slug' => 'all', |
|
146 | - 'label' => esc_html__('All', 'event_espresso'), |
|
147 | - 'count' => 0, |
|
148 | - 'bulk_action' => array( |
|
149 | - 'trash_tickets' => esc_html__('Move to Trash', 'event_espresso'), |
|
150 | - ), |
|
151 | - ), |
|
152 | - 'trashed' => array( |
|
153 | - 'slug' => 'trashed', |
|
154 | - 'label' => esc_html__('Trash', 'event_espresso'), |
|
155 | - 'count' => 0, |
|
156 | - 'bulk_action' => array( |
|
157 | - 'restore_tickets' => esc_html__('Restore from Trash', 'event_espresso'), |
|
158 | - 'delete_tickets' => esc_html__('Delete Permanently', 'event_espresso'), |
|
159 | - ), |
|
160 | - ), |
|
161 | - ); |
|
162 | - } |
|
163 | - |
|
164 | - |
|
165 | - public function _tickets_overview_list_table() |
|
166 | - { |
|
167 | - $this->_search_btn_label = esc_html__('Tickets', 'event_espresso'); |
|
168 | - $this->display_admin_list_table_page_with_no_sidebar(); |
|
169 | - } |
|
170 | - |
|
171 | - |
|
172 | - public function get_default_tickets($per_page = 10, $count = false, $trashed = false) |
|
173 | - { |
|
174 | - |
|
175 | - $orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby']; |
|
176 | - $order = empty($this->_req_data['order']) ? 'ASC' : $order; |
|
177 | - |
|
178 | - switch ($orderby) { |
|
179 | - case 'TKT_name': |
|
180 | - $orderby = array('TKT_name' => $order); |
|
181 | - break; |
|
182 | - |
|
183 | - case 'TKT_price': |
|
184 | - $orderby = array('TKT_price' => $order); |
|
185 | - break; |
|
186 | - |
|
187 | - case 'TKT_uses': |
|
188 | - $orderby = array('TKT_uses' => $order); |
|
189 | - break; |
|
190 | - |
|
191 | - case 'TKT_min': |
|
192 | - $orderby = array('TKT_min' => $order); |
|
193 | - break; |
|
194 | - |
|
195 | - case 'TKT_max': |
|
196 | - $orderby = array('TKT_max' => $order); |
|
197 | - break; |
|
198 | - |
|
199 | - case 'TKT_qty': |
|
200 | - $orderby = array('TKT_qty' => $order); |
|
201 | - break; |
|
202 | - } |
|
203 | - |
|
204 | - $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
205 | - ? $this->_req_data['paged'] : 1; |
|
206 | - $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
207 | - ? $this->_req_data['perpage'] : $per_page; |
|
208 | - |
|
209 | - $_where = array( |
|
210 | - 'TKT_is_default' => 1, |
|
211 | - 'TKT_deleted' => $trashed, |
|
212 | - ); |
|
213 | - |
|
214 | - $offset = ($current_page - 1) * $per_page; |
|
215 | - $limit = array($offset, $per_page); |
|
216 | - |
|
217 | - if (isset($this->_req_data['s'])) { |
|
218 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
219 | - $_where['OR'] = array( |
|
220 | - 'TKT_name' => array('LIKE', $sstr), |
|
221 | - 'TKT_description' => array('LIKE', $sstr), |
|
222 | - ); |
|
223 | - } |
|
224 | - |
|
225 | - $query_params = array( |
|
226 | - $_where, |
|
227 | - 'order_by' => $orderby, |
|
228 | - 'limit' => $limit, |
|
229 | - 'group_by' => 'TKT_ID', |
|
230 | - ); |
|
231 | - |
|
232 | - if ($count) { |
|
233 | - return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
|
234 | - } else { |
|
235 | - return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
|
236 | - } |
|
237 | - } |
|
238 | - |
|
239 | - |
|
240 | - protected function _trash_or_restore_ticket($trash = false) |
|
241 | - { |
|
242 | - $success = 1; |
|
243 | - |
|
244 | - $TKT = EEM_Ticket::instance(); |
|
245 | - |
|
246 | - // checkboxes? |
|
247 | - if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
248 | - // if array has more than one element then success message should be plural |
|
249 | - $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
250 | - |
|
251 | - // cycle thru the boxes |
|
252 | - while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
253 | - if ($trash) { |
|
254 | - if (! $TKT->delete_by_ID($TKT_ID)) { |
|
255 | - $success = 0; |
|
256 | - } |
|
257 | - } else { |
|
258 | - if (! $TKT->restore_by_ID($TKT_ID)) { |
|
259 | - $success = 0; |
|
260 | - } |
|
261 | - } |
|
262 | - } |
|
263 | - } else { |
|
264 | - // grab single id and trash |
|
265 | - $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
266 | - |
|
267 | - if ($trash) { |
|
268 | - if (! $TKT->delete_by_ID($TKT_ID)) { |
|
269 | - $success = 0; |
|
270 | - } |
|
271 | - } else { |
|
272 | - if (! $TKT->restore_by_ID($TKT_ID)) { |
|
273 | - $success = 0; |
|
274 | - } |
|
275 | - } |
|
276 | - } |
|
277 | - |
|
278 | - $action_desc = $trash ? 'moved to the trash' : 'restored'; |
|
279 | - $this->_redirect_after_action($success, 'Tickets', $action_desc, array()); |
|
280 | - } |
|
281 | - |
|
282 | - |
|
283 | - protected function _delete_ticket() |
|
284 | - { |
|
285 | - $success = 1; |
|
286 | - |
|
287 | - $TKT = EEM_Ticket::instance(); |
|
288 | - |
|
289 | - // checkboxes? |
|
290 | - if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
291 | - // if array has more than one element then success message should be plural |
|
292 | - $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
293 | - |
|
294 | - // cycle thru the boxes |
|
295 | - while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
296 | - // delete |
|
297 | - if (! $this->_delete_the_ticket($TKT_ID)) { |
|
298 | - $success = 0; |
|
299 | - } |
|
300 | - } |
|
301 | - } else { |
|
302 | - // grab single id and trash |
|
303 | - $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
304 | - if (! $this->_delete_the_ticket($TKT_ID)) { |
|
305 | - $success = 0; |
|
306 | - } |
|
307 | - } |
|
308 | - |
|
309 | - $action_desc = 'deleted'; |
|
310 | - $this->_redirect_after_action($success, 'Tickets', $action_desc, array()); |
|
311 | - } |
|
312 | - |
|
313 | - |
|
314 | - protected function _delete_the_ticket($TKT_ID) |
|
315 | - { |
|
316 | - $tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID); |
|
317 | - |
|
318 | - // delete all related prices first |
|
319 | - $tkt->delete_related_permanently('Price'); |
|
320 | - return $tkt->delete_permanently(); |
|
321 | - } |
|
14 | + protected function _init_page_props() |
|
15 | + { |
|
16 | + $this->page_slug = TICKETS_PG_SLUG; |
|
17 | + $this->page_label = TICKETS_LABEL; |
|
18 | + $this->_admin_base_url = TICKETS_ADMIN_URL; |
|
19 | + $this->_admin_base_path = TICKETS_ADMIN; |
|
20 | + } |
|
21 | + |
|
22 | + |
|
23 | + protected function _ajax_hooks() |
|
24 | + { |
|
25 | + } |
|
26 | + |
|
27 | + |
|
28 | + protected function _define_page_props() |
|
29 | + { |
|
30 | + $this->_admin_page_title = TICKETS_LABEL; |
|
31 | + $this->_labels = array( |
|
32 | + 'buttons' => array( |
|
33 | + 'add' => esc_html__('Add New Default Ticket', 'event_espresso'), |
|
34 | + 'edit' => esc_html__('Edit Default Ticket', 'event_espresso'), |
|
35 | + 'delete' => esc_html__('Delete Default Ticket', 'event_espresso'), |
|
36 | + ), |
|
37 | + ); |
|
38 | + } |
|
39 | + |
|
40 | + |
|
41 | + protected function _set_page_routes() |
|
42 | + { |
|
43 | + |
|
44 | + $tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID']) |
|
45 | + ? $this->_req_data['TKT_ID'] : 0; |
|
46 | + |
|
47 | + $this->_page_routes = array( |
|
48 | + 'default' => array( |
|
49 | + 'func' => '_tickets_overview_list_table', |
|
50 | + 'capability' => 'ee_read_default_tickets', |
|
51 | + ), |
|
52 | + 'trash_ticket' => array( |
|
53 | + 'func' => '_trash_or_restore_ticket', |
|
54 | + 'noheader' => true, |
|
55 | + 'args' => array('trash' => true), |
|
56 | + 'capability' => 'ee_delete_default_ticket', |
|
57 | + 'obj_id' => $tkt_id, |
|
58 | + ), |
|
59 | + 'trash_tickets' => array( |
|
60 | + 'func' => '_trash_or_restore_ticket', |
|
61 | + 'noheader' => true, |
|
62 | + 'args' => array('trash' => true), |
|
63 | + 'capability' => 'ee_delete_default_tickets', |
|
64 | + ), |
|
65 | + 'restore_ticket' => array( |
|
66 | + 'func' => '_trash_or_restore_ticket', |
|
67 | + 'noheader' => true, |
|
68 | + 'capability' => 'ee_delete_default_ticket', |
|
69 | + 'obj_id' => $tkt_id, |
|
70 | + ), |
|
71 | + 'restore_tickets' => array( |
|
72 | + 'func' => '_trash_or_restore_ticket', |
|
73 | + 'noheader' => true, |
|
74 | + 'capability' => 'ee_delete_default_tickets', |
|
75 | + ), |
|
76 | + 'delete_ticket' => array( |
|
77 | + 'func' => '_delete_ticket', |
|
78 | + 'noheader' => true, |
|
79 | + 'capability' => 'ee_delete_default_ticket', |
|
80 | + 'obj_id' => $tkt_id, |
|
81 | + ), |
|
82 | + 'delete_tickets' => array( |
|
83 | + 'func' => '_delete_ticket', |
|
84 | + 'noheader' => true, |
|
85 | + 'capability' => 'ee_delete_default_tickets', |
|
86 | + ), |
|
87 | + ); |
|
88 | + } |
|
89 | + |
|
90 | + |
|
91 | + protected function _set_page_config() |
|
92 | + { |
|
93 | + $this->_page_config = array( |
|
94 | + 'default' => array( |
|
95 | + 'nav' => array( |
|
96 | + 'label' => esc_html__('Default Tickets', 'event_espresso'), |
|
97 | + 'order' => 10, |
|
98 | + ), |
|
99 | + 'list_table' => 'Tickets_List_Table', |
|
100 | + 'require_nonce' => false, |
|
101 | + ), |
|
102 | + ); |
|
103 | + } |
|
104 | + |
|
105 | + |
|
106 | + protected function _add_screen_options() |
|
107 | + { |
|
108 | + } |
|
109 | + |
|
110 | + protected function _add_screen_options_default() |
|
111 | + { |
|
112 | + $this->_per_page_screen_option(); |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + protected function _add_feature_pointers() |
|
117 | + { |
|
118 | + } |
|
119 | + |
|
120 | + public function load_scripts_styles() |
|
121 | + { |
|
122 | + } |
|
123 | + |
|
124 | + public function load_scripts_styles_default() |
|
125 | + { |
|
126 | + } |
|
127 | + |
|
128 | + public function admin_footer_scripts() |
|
129 | + { |
|
130 | + } |
|
131 | + |
|
132 | + public function admin_init() |
|
133 | + { |
|
134 | + } |
|
135 | + |
|
136 | + public function admin_notices() |
|
137 | + { |
|
138 | + } |
|
139 | + |
|
140 | + |
|
141 | + public function _set_list_table_views_default() |
|
142 | + { |
|
143 | + $this->_views = array( |
|
144 | + 'all' => array( |
|
145 | + 'slug' => 'all', |
|
146 | + 'label' => esc_html__('All', 'event_espresso'), |
|
147 | + 'count' => 0, |
|
148 | + 'bulk_action' => array( |
|
149 | + 'trash_tickets' => esc_html__('Move to Trash', 'event_espresso'), |
|
150 | + ), |
|
151 | + ), |
|
152 | + 'trashed' => array( |
|
153 | + 'slug' => 'trashed', |
|
154 | + 'label' => esc_html__('Trash', 'event_espresso'), |
|
155 | + 'count' => 0, |
|
156 | + 'bulk_action' => array( |
|
157 | + 'restore_tickets' => esc_html__('Restore from Trash', 'event_espresso'), |
|
158 | + 'delete_tickets' => esc_html__('Delete Permanently', 'event_espresso'), |
|
159 | + ), |
|
160 | + ), |
|
161 | + ); |
|
162 | + } |
|
163 | + |
|
164 | + |
|
165 | + public function _tickets_overview_list_table() |
|
166 | + { |
|
167 | + $this->_search_btn_label = esc_html__('Tickets', 'event_espresso'); |
|
168 | + $this->display_admin_list_table_page_with_no_sidebar(); |
|
169 | + } |
|
170 | + |
|
171 | + |
|
172 | + public function get_default_tickets($per_page = 10, $count = false, $trashed = false) |
|
173 | + { |
|
174 | + |
|
175 | + $orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby']; |
|
176 | + $order = empty($this->_req_data['order']) ? 'ASC' : $order; |
|
177 | + |
|
178 | + switch ($orderby) { |
|
179 | + case 'TKT_name': |
|
180 | + $orderby = array('TKT_name' => $order); |
|
181 | + break; |
|
182 | + |
|
183 | + case 'TKT_price': |
|
184 | + $orderby = array('TKT_price' => $order); |
|
185 | + break; |
|
186 | + |
|
187 | + case 'TKT_uses': |
|
188 | + $orderby = array('TKT_uses' => $order); |
|
189 | + break; |
|
190 | + |
|
191 | + case 'TKT_min': |
|
192 | + $orderby = array('TKT_min' => $order); |
|
193 | + break; |
|
194 | + |
|
195 | + case 'TKT_max': |
|
196 | + $orderby = array('TKT_max' => $order); |
|
197 | + break; |
|
198 | + |
|
199 | + case 'TKT_qty': |
|
200 | + $orderby = array('TKT_qty' => $order); |
|
201 | + break; |
|
202 | + } |
|
203 | + |
|
204 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
205 | + ? $this->_req_data['paged'] : 1; |
|
206 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
207 | + ? $this->_req_data['perpage'] : $per_page; |
|
208 | + |
|
209 | + $_where = array( |
|
210 | + 'TKT_is_default' => 1, |
|
211 | + 'TKT_deleted' => $trashed, |
|
212 | + ); |
|
213 | + |
|
214 | + $offset = ($current_page - 1) * $per_page; |
|
215 | + $limit = array($offset, $per_page); |
|
216 | + |
|
217 | + if (isset($this->_req_data['s'])) { |
|
218 | + $sstr = '%' . $this->_req_data['s'] . '%'; |
|
219 | + $_where['OR'] = array( |
|
220 | + 'TKT_name' => array('LIKE', $sstr), |
|
221 | + 'TKT_description' => array('LIKE', $sstr), |
|
222 | + ); |
|
223 | + } |
|
224 | + |
|
225 | + $query_params = array( |
|
226 | + $_where, |
|
227 | + 'order_by' => $orderby, |
|
228 | + 'limit' => $limit, |
|
229 | + 'group_by' => 'TKT_ID', |
|
230 | + ); |
|
231 | + |
|
232 | + if ($count) { |
|
233 | + return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
|
234 | + } else { |
|
235 | + return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
|
236 | + } |
|
237 | + } |
|
238 | + |
|
239 | + |
|
240 | + protected function _trash_or_restore_ticket($trash = false) |
|
241 | + { |
|
242 | + $success = 1; |
|
243 | + |
|
244 | + $TKT = EEM_Ticket::instance(); |
|
245 | + |
|
246 | + // checkboxes? |
|
247 | + if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
248 | + // if array has more than one element then success message should be plural |
|
249 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
250 | + |
|
251 | + // cycle thru the boxes |
|
252 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
253 | + if ($trash) { |
|
254 | + if (! $TKT->delete_by_ID($TKT_ID)) { |
|
255 | + $success = 0; |
|
256 | + } |
|
257 | + } else { |
|
258 | + if (! $TKT->restore_by_ID($TKT_ID)) { |
|
259 | + $success = 0; |
|
260 | + } |
|
261 | + } |
|
262 | + } |
|
263 | + } else { |
|
264 | + // grab single id and trash |
|
265 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
266 | + |
|
267 | + if ($trash) { |
|
268 | + if (! $TKT->delete_by_ID($TKT_ID)) { |
|
269 | + $success = 0; |
|
270 | + } |
|
271 | + } else { |
|
272 | + if (! $TKT->restore_by_ID($TKT_ID)) { |
|
273 | + $success = 0; |
|
274 | + } |
|
275 | + } |
|
276 | + } |
|
277 | + |
|
278 | + $action_desc = $trash ? 'moved to the trash' : 'restored'; |
|
279 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, array()); |
|
280 | + } |
|
281 | + |
|
282 | + |
|
283 | + protected function _delete_ticket() |
|
284 | + { |
|
285 | + $success = 1; |
|
286 | + |
|
287 | + $TKT = EEM_Ticket::instance(); |
|
288 | + |
|
289 | + // checkboxes? |
|
290 | + if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
291 | + // if array has more than one element then success message should be plural |
|
292 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
293 | + |
|
294 | + // cycle thru the boxes |
|
295 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
296 | + // delete |
|
297 | + if (! $this->_delete_the_ticket($TKT_ID)) { |
|
298 | + $success = 0; |
|
299 | + } |
|
300 | + } |
|
301 | + } else { |
|
302 | + // grab single id and trash |
|
303 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
304 | + if (! $this->_delete_the_ticket($TKT_ID)) { |
|
305 | + $success = 0; |
|
306 | + } |
|
307 | + } |
|
308 | + |
|
309 | + $action_desc = 'deleted'; |
|
310 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, array()); |
|
311 | + } |
|
312 | + |
|
313 | + |
|
314 | + protected function _delete_the_ticket($TKT_ID) |
|
315 | + { |
|
316 | + $tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID); |
|
317 | + |
|
318 | + // delete all related prices first |
|
319 | + $tkt->delete_related_permanently('Price'); |
|
320 | + return $tkt->delete_permanently(); |
|
321 | + } |
|
322 | 322 | } |
@@ -4,14 +4,14 @@ |
||
4 | 4 | <h4><?php esc_html_e('New to Event Espresso?', 'event_espresso'); ?></h4> |
5 | 5 | |
6 | 6 | <p><?php |
7 | - printf( |
|
8 | - esc_html__( |
|
9 | - 'Check out the %1$squick start guide for Event Espresso 4%2$s. It has recommendations, tips, and tutorials so you can get your project started %3$squicker%4$s.', |
|
10 | - 'event_espresso' |
|
11 | - ), |
|
12 | - '<a href="https://eventespresso.com/wiki/welcome-to-event-espresso/#event-espresso-4" target="_blank">', |
|
13 | - '</a>', |
|
14 | - '<em>', |
|
15 | - '</em>' |
|
16 | - ); ?></p> |
|
7 | + printf( |
|
8 | + esc_html__( |
|
9 | + 'Check out the %1$squick start guide for Event Espresso 4%2$s. It has recommendations, tips, and tutorials so you can get your project started %3$squicker%4$s.', |
|
10 | + 'event_espresso' |
|
11 | + ), |
|
12 | + '<a href="https://eventespresso.com/wiki/welcome-to-event-espresso/#event-espresso-4" target="_blank">', |
|
13 | + '</a>', |
|
14 | + '<em>', |
|
15 | + '</em>' |
|
16 | + ); ?></p> |
|
17 | 17 | </div> |
18 | 18 | \ No newline at end of file |
@@ -21,17 +21,17 @@ discard block |
||
21 | 21 | public function __construct($routing = true) |
22 | 22 | { |
23 | 23 | parent::__construct($routing); |
24 | - if (! defined('EE_MSG_CAF_ASSETS_PATH')) { |
|
25 | - define('EE_MSG_CAF_ASSETS_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'messages/assets/'); |
|
26 | - define('EE_MSG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/'); |
|
27 | - define('EE_MSG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/'); |
|
28 | - define('EE_MSG_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/templates/'); |
|
24 | + if ( ! defined('EE_MSG_CAF_ASSETS_PATH')) { |
|
25 | + define('EE_MSG_CAF_ASSETS_PATH', EE_CORE_CAF_ADMIN_EXTEND.'messages/assets/'); |
|
26 | + define('EE_MSG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/assets/'); |
|
27 | + define('EE_MSG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'messages/templates/'); |
|
28 | + define('EE_MSG_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/templates/'); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | 32 | protected function _extend_page_config() |
33 | 33 | { |
34 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'messages'; |
|
34 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'messages'; |
|
35 | 35 | $this->_page_routes['custom_mtps'] = array( |
36 | 36 | 'func' => '_ee_custom_messages_overview_list_table', |
37 | 37 | 'capability' => 'ee_read_messages', |
@@ -76,13 +76,13 @@ discard block |
||
76 | 76 | { |
77 | 77 | global $admin_page_hooks; |
78 | 78 | |
79 | - if (! empty($admin_page_hooks['espresso_events'])) { |
|
79 | + if ( ! empty($admin_page_hooks['espresso_events'])) { |
|
80 | 80 | // we're on a EE specific page... good stuff! |
81 | 81 | $hook_prefix = $admin_page_hooks['espresso_events']; |
82 | - $filter_ref = $hook_prefix . '_page_' . $this->page_slug; |
|
83 | - add_filter('FHEE_manage_' . $filter_ref . '_columns', array($this, 'add_custom_mtps_columns'), 10, 2); |
|
82 | + $filter_ref = $hook_prefix.'_page_'.$this->page_slug; |
|
83 | + add_filter('FHEE_manage_'.$filter_ref.'_columns', array($this, 'add_custom_mtps_columns'), 10, 2); |
|
84 | 84 | add_action( |
85 | - 'AHEE__EE_Admin_List_Table__column_actions__' . $filter_ref, |
|
85 | + 'AHEE__EE_Admin_List_Table__column_actions__'.$filter_ref, |
|
86 | 86 | array($this, 'custom_mtp_create_button_column'), |
87 | 87 | 10, |
88 | 88 | 2 |
@@ -16,191 +16,191 @@ |
||
16 | 16 | */ |
17 | 17 | class Extend_Messages_Admin_Page extends Messages_Admin_Page |
18 | 18 | { |
19 | - public function __construct($routing = true) |
|
20 | - { |
|
21 | - parent::__construct($routing); |
|
22 | - if (! defined('EE_MSG_CAF_ASSETS_PATH')) { |
|
23 | - define('EE_MSG_CAF_ASSETS_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'messages/assets/'); |
|
24 | - define('EE_MSG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/'); |
|
25 | - define('EE_MSG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/'); |
|
26 | - define('EE_MSG_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/templates/'); |
|
27 | - } |
|
28 | - } |
|
29 | - |
|
30 | - protected function _extend_page_config() |
|
31 | - { |
|
32 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'messages'; |
|
33 | - $this->_page_routes['custom_mtps'] = array( |
|
34 | - 'func' => '_ee_custom_messages_overview_list_table', |
|
35 | - 'capability' => 'ee_read_messages', |
|
36 | - ); |
|
37 | - $this->_page_config['custom_mtps'] = array( |
|
38 | - 'nav' => array( |
|
39 | - 'label' => esc_html__('Custom Message Templates', 'event_espresso'), |
|
40 | - 'icon' => 'dashicons-art', |
|
41 | - 'order' => 30, |
|
42 | - ), |
|
43 | - 'list_table' => 'Custom_Messages_Template_List_Table', |
|
44 | - 'help_tabs' => array( |
|
45 | - 'message_overview_message_types_help_tab' => array( |
|
46 | - 'title' => esc_html__('Message Types', 'event_espresso'), |
|
47 | - 'filename' => 'messages_overview_types', |
|
48 | - ), |
|
49 | - 'messages_overview_messengers_help_tab' => array( |
|
50 | - 'title' => esc_html__('Messengers', 'event_espresso'), |
|
51 | - 'filename' => 'messages_overview_messengers', |
|
52 | - ), |
|
53 | - 'messages_overview_other_help_tab' => array( |
|
54 | - 'title' => esc_html__('Messages Other', 'event_espresso'), |
|
55 | - 'filename' => 'messages_overview_other', |
|
56 | - ), |
|
57 | - ), |
|
58 | - 'require_nonce' => false, |
|
59 | - ); |
|
60 | - |
|
61 | - add_action('current_screen', array($this, 'dynamic_screen_hooks'), 10); |
|
62 | - } |
|
63 | - |
|
64 | - |
|
65 | - /** |
|
66 | - * Callback for current_screen action |
|
67 | - * This is used for any filters and/or actions that require the dynamic screen hook_prefix to be correct. |
|
68 | - * |
|
69 | - * @since 4.5.0 |
|
70 | - * |
|
71 | - * @return void |
|
72 | - */ |
|
73 | - public function dynamic_screen_hooks() |
|
74 | - { |
|
75 | - global $admin_page_hooks; |
|
76 | - |
|
77 | - if (! empty($admin_page_hooks['espresso_events'])) { |
|
78 | - // we're on a EE specific page... good stuff! |
|
79 | - $hook_prefix = $admin_page_hooks['espresso_events']; |
|
80 | - $filter_ref = $hook_prefix . '_page_' . $this->page_slug; |
|
81 | - add_filter('FHEE_manage_' . $filter_ref . '_columns', array($this, 'add_custom_mtps_columns'), 10, 2); |
|
82 | - add_action( |
|
83 | - 'AHEE__EE_Admin_List_Table__column_actions__' . $filter_ref, |
|
84 | - array($this, 'custom_mtp_create_button_column'), |
|
85 | - 10, |
|
86 | - 2 |
|
87 | - ); |
|
88 | - } |
|
89 | - } |
|
90 | - |
|
91 | - |
|
92 | - /** |
|
93 | - * This is the callback for the FHEE__manage_event-espresso_page_espresso_messages_columns to register the |
|
94 | - * caffeinated columns for the global message templates list table. |
|
95 | - * |
|
96 | - * @since 4.3.2 |
|
97 | - * |
|
98 | - * @param array $columns Original defined list of columns |
|
99 | - * @param string $screen_id The unique screen id for the page. |
|
100 | - */ |
|
101 | - public function add_custom_mtps_columns($columns, $screen_id) |
|
102 | - { |
|
103 | - if ($screen_id !== 'espresso_messages_global_mtps') { |
|
104 | - return $columns; |
|
105 | - } |
|
106 | - |
|
107 | - $columns['actions'] = ''; |
|
108 | - return $columns; |
|
109 | - } |
|
110 | - |
|
111 | - |
|
112 | - /** |
|
113 | - * Callback for FHEE__EE_Admin_List_Table__column_actions__event-espresso_page_espresso_messages action that allows |
|
114 | - * for adding the content for the registered "action" column. |
|
115 | - * |
|
116 | - * @since 4.3.2 |
|
117 | - * |
|
118 | - * @param EE_Base_Class |
|
119 | - * @param string $screen_id Unique screen id for the page |
|
120 | - * |
|
121 | - * @return string html content for the page. |
|
122 | - */ |
|
123 | - public function custom_mtp_create_button_column($item, $screen_id) |
|
124 | - { |
|
125 | - if ( |
|
126 | - $screen_id !== 'espresso_messages_global_mtps' || ! EE_Registry::instance()->CAP->current_user_can( |
|
127 | - 'ee_edit_messages', |
|
128 | - 'espresso_messages_add_new_message_template' |
|
129 | - ) |
|
130 | - ) { |
|
131 | - return ''; |
|
132 | - } |
|
133 | - |
|
134 | - // first we consider whether this template has override set. If it does then that means no custom templates can be created from this template as a base. So let's just skip the button creation. |
|
135 | - if ($item->get('MTP_is_override')) { |
|
136 | - return ''; |
|
137 | - } |
|
138 | - |
|
139 | - |
|
140 | - $create_args = array( |
|
141 | - 'GRP_ID' => $item->ID(), |
|
142 | - 'messenger' => $item->messenger(), |
|
143 | - 'message_type' => $item->message_type(), |
|
144 | - 'action' => 'add_new_message_template', |
|
145 | - ); |
|
146 | - $create_link = EE_Admin_Page::add_query_args_and_nonce($create_args, EE_MSG_ADMIN_URL); |
|
147 | - echo sprintf( |
|
148 | - '<a href="%s" class="button button--secondary button--small">%s</a>', |
|
149 | - $create_link, |
|
150 | - esc_html__('Create Custom', 'event_espresso') |
|
151 | - ); |
|
152 | - } |
|
153 | - |
|
154 | - |
|
155 | - protected function _add_screen_options_custom_mtps() |
|
156 | - { |
|
157 | - $page_title = $this->_admin_page_title; |
|
158 | - $this->_admin_page_title = esc_html__('Custom Message Templates', 'event_espresso'); |
|
159 | - $this->_per_page_screen_option(); |
|
160 | - $this->_admin_page_title = $page_title; |
|
161 | - } |
|
162 | - |
|
163 | - |
|
164 | - /** |
|
165 | - * set views array for Custom Templates list table |
|
166 | - * |
|
167 | - * @access public |
|
168 | - * @return void |
|
169 | - */ |
|
170 | - public function _set_list_table_views_custom_mtps() |
|
171 | - { |
|
172 | - $this->_views = array( |
|
173 | - 'in_use' => array( |
|
174 | - 'slug' => 'in_use', |
|
175 | - 'label' => esc_html__('In Use', 'event_espresso'), |
|
176 | - 'count' => 0, |
|
177 | - 'bulk_action' => array( |
|
178 | - 'trash_message_template' => esc_html__('Move to Trash', 'event_espresso'), |
|
179 | - ), |
|
180 | - ), |
|
181 | - ); |
|
182 | - if ( |
|
183 | - EE_Registry::instance()->CAP->current_user_can( |
|
184 | - 'ee_delete_messages', |
|
185 | - 'espresso_messages_trash_message_template' |
|
186 | - ) |
|
187 | - ) { |
|
188 | - $this->_views['trashed'] = array( |
|
189 | - 'slug' => 'trashed', |
|
190 | - 'label' => esc_html__('Trash', 'event_espresso'), |
|
191 | - 'count' => 0, |
|
192 | - 'bulk_action' => array( |
|
193 | - 'restore_message_template' => esc_html__('Restore From Trash', 'event_espresso'), |
|
194 | - 'delete_message_template' => esc_html__('Delete Permanently', 'event_espresso'), |
|
195 | - ), |
|
196 | - ); |
|
197 | - } |
|
198 | - } |
|
199 | - |
|
200 | - |
|
201 | - protected function _ee_custom_messages_overview_list_table() |
|
202 | - { |
|
203 | - $this->_admin_page_title = esc_html__('Custom Message Templates', 'event_espresso'); |
|
204 | - $this->display_admin_list_table_page_with_no_sidebar(); |
|
205 | - } |
|
19 | + public function __construct($routing = true) |
|
20 | + { |
|
21 | + parent::__construct($routing); |
|
22 | + if (! defined('EE_MSG_CAF_ASSETS_PATH')) { |
|
23 | + define('EE_MSG_CAF_ASSETS_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'messages/assets/'); |
|
24 | + define('EE_MSG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/'); |
|
25 | + define('EE_MSG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/'); |
|
26 | + define('EE_MSG_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/templates/'); |
|
27 | + } |
|
28 | + } |
|
29 | + |
|
30 | + protected function _extend_page_config() |
|
31 | + { |
|
32 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'messages'; |
|
33 | + $this->_page_routes['custom_mtps'] = array( |
|
34 | + 'func' => '_ee_custom_messages_overview_list_table', |
|
35 | + 'capability' => 'ee_read_messages', |
|
36 | + ); |
|
37 | + $this->_page_config['custom_mtps'] = array( |
|
38 | + 'nav' => array( |
|
39 | + 'label' => esc_html__('Custom Message Templates', 'event_espresso'), |
|
40 | + 'icon' => 'dashicons-art', |
|
41 | + 'order' => 30, |
|
42 | + ), |
|
43 | + 'list_table' => 'Custom_Messages_Template_List_Table', |
|
44 | + 'help_tabs' => array( |
|
45 | + 'message_overview_message_types_help_tab' => array( |
|
46 | + 'title' => esc_html__('Message Types', 'event_espresso'), |
|
47 | + 'filename' => 'messages_overview_types', |
|
48 | + ), |
|
49 | + 'messages_overview_messengers_help_tab' => array( |
|
50 | + 'title' => esc_html__('Messengers', 'event_espresso'), |
|
51 | + 'filename' => 'messages_overview_messengers', |
|
52 | + ), |
|
53 | + 'messages_overview_other_help_tab' => array( |
|
54 | + 'title' => esc_html__('Messages Other', 'event_espresso'), |
|
55 | + 'filename' => 'messages_overview_other', |
|
56 | + ), |
|
57 | + ), |
|
58 | + 'require_nonce' => false, |
|
59 | + ); |
|
60 | + |
|
61 | + add_action('current_screen', array($this, 'dynamic_screen_hooks'), 10); |
|
62 | + } |
|
63 | + |
|
64 | + |
|
65 | + /** |
|
66 | + * Callback for current_screen action |
|
67 | + * This is used for any filters and/or actions that require the dynamic screen hook_prefix to be correct. |
|
68 | + * |
|
69 | + * @since 4.5.0 |
|
70 | + * |
|
71 | + * @return void |
|
72 | + */ |
|
73 | + public function dynamic_screen_hooks() |
|
74 | + { |
|
75 | + global $admin_page_hooks; |
|
76 | + |
|
77 | + if (! empty($admin_page_hooks['espresso_events'])) { |
|
78 | + // we're on a EE specific page... good stuff! |
|
79 | + $hook_prefix = $admin_page_hooks['espresso_events']; |
|
80 | + $filter_ref = $hook_prefix . '_page_' . $this->page_slug; |
|
81 | + add_filter('FHEE_manage_' . $filter_ref . '_columns', array($this, 'add_custom_mtps_columns'), 10, 2); |
|
82 | + add_action( |
|
83 | + 'AHEE__EE_Admin_List_Table__column_actions__' . $filter_ref, |
|
84 | + array($this, 'custom_mtp_create_button_column'), |
|
85 | + 10, |
|
86 | + 2 |
|
87 | + ); |
|
88 | + } |
|
89 | + } |
|
90 | + |
|
91 | + |
|
92 | + /** |
|
93 | + * This is the callback for the FHEE__manage_event-espresso_page_espresso_messages_columns to register the |
|
94 | + * caffeinated columns for the global message templates list table. |
|
95 | + * |
|
96 | + * @since 4.3.2 |
|
97 | + * |
|
98 | + * @param array $columns Original defined list of columns |
|
99 | + * @param string $screen_id The unique screen id for the page. |
|
100 | + */ |
|
101 | + public function add_custom_mtps_columns($columns, $screen_id) |
|
102 | + { |
|
103 | + if ($screen_id !== 'espresso_messages_global_mtps') { |
|
104 | + return $columns; |
|
105 | + } |
|
106 | + |
|
107 | + $columns['actions'] = ''; |
|
108 | + return $columns; |
|
109 | + } |
|
110 | + |
|
111 | + |
|
112 | + /** |
|
113 | + * Callback for FHEE__EE_Admin_List_Table__column_actions__event-espresso_page_espresso_messages action that allows |
|
114 | + * for adding the content for the registered "action" column. |
|
115 | + * |
|
116 | + * @since 4.3.2 |
|
117 | + * |
|
118 | + * @param EE_Base_Class |
|
119 | + * @param string $screen_id Unique screen id for the page |
|
120 | + * |
|
121 | + * @return string html content for the page. |
|
122 | + */ |
|
123 | + public function custom_mtp_create_button_column($item, $screen_id) |
|
124 | + { |
|
125 | + if ( |
|
126 | + $screen_id !== 'espresso_messages_global_mtps' || ! EE_Registry::instance()->CAP->current_user_can( |
|
127 | + 'ee_edit_messages', |
|
128 | + 'espresso_messages_add_new_message_template' |
|
129 | + ) |
|
130 | + ) { |
|
131 | + return ''; |
|
132 | + } |
|
133 | + |
|
134 | + // first we consider whether this template has override set. If it does then that means no custom templates can be created from this template as a base. So let's just skip the button creation. |
|
135 | + if ($item->get('MTP_is_override')) { |
|
136 | + return ''; |
|
137 | + } |
|
138 | + |
|
139 | + |
|
140 | + $create_args = array( |
|
141 | + 'GRP_ID' => $item->ID(), |
|
142 | + 'messenger' => $item->messenger(), |
|
143 | + 'message_type' => $item->message_type(), |
|
144 | + 'action' => 'add_new_message_template', |
|
145 | + ); |
|
146 | + $create_link = EE_Admin_Page::add_query_args_and_nonce($create_args, EE_MSG_ADMIN_URL); |
|
147 | + echo sprintf( |
|
148 | + '<a href="%s" class="button button--secondary button--small">%s</a>', |
|
149 | + $create_link, |
|
150 | + esc_html__('Create Custom', 'event_espresso') |
|
151 | + ); |
|
152 | + } |
|
153 | + |
|
154 | + |
|
155 | + protected function _add_screen_options_custom_mtps() |
|
156 | + { |
|
157 | + $page_title = $this->_admin_page_title; |
|
158 | + $this->_admin_page_title = esc_html__('Custom Message Templates', 'event_espresso'); |
|
159 | + $this->_per_page_screen_option(); |
|
160 | + $this->_admin_page_title = $page_title; |
|
161 | + } |
|
162 | + |
|
163 | + |
|
164 | + /** |
|
165 | + * set views array for Custom Templates list table |
|
166 | + * |
|
167 | + * @access public |
|
168 | + * @return void |
|
169 | + */ |
|
170 | + public function _set_list_table_views_custom_mtps() |
|
171 | + { |
|
172 | + $this->_views = array( |
|
173 | + 'in_use' => array( |
|
174 | + 'slug' => 'in_use', |
|
175 | + 'label' => esc_html__('In Use', 'event_espresso'), |
|
176 | + 'count' => 0, |
|
177 | + 'bulk_action' => array( |
|
178 | + 'trash_message_template' => esc_html__('Move to Trash', 'event_espresso'), |
|
179 | + ), |
|
180 | + ), |
|
181 | + ); |
|
182 | + if ( |
|
183 | + EE_Registry::instance()->CAP->current_user_can( |
|
184 | + 'ee_delete_messages', |
|
185 | + 'espresso_messages_trash_message_template' |
|
186 | + ) |
|
187 | + ) { |
|
188 | + $this->_views['trashed'] = array( |
|
189 | + 'slug' => 'trashed', |
|
190 | + 'label' => esc_html__('Trash', 'event_espresso'), |
|
191 | + 'count' => 0, |
|
192 | + 'bulk_action' => array( |
|
193 | + 'restore_message_template' => esc_html__('Restore From Trash', 'event_espresso'), |
|
194 | + 'delete_message_template' => esc_html__('Delete Permanently', 'event_espresso'), |
|
195 | + ), |
|
196 | + ); |
|
197 | + } |
|
198 | + } |
|
199 | + |
|
200 | + |
|
201 | + protected function _ee_custom_messages_overview_list_table() |
|
202 | + { |
|
203 | + $this->_admin_page_title = esc_html__('Custom Message Templates', 'event_espresso'); |
|
204 | + $this->display_admin_list_table_page_with_no_sidebar(); |
|
205 | + } |
|
206 | 206 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | ), |
72 | 72 | 7 => array( |
73 | 73 | 'content_id' => 'tkt-status-archived', |
74 | - 'target' => '.ticket-row .tkt-status-' . EE_Ticket::archived, |
|
74 | + 'target' => '.ticket-row .tkt-status-'.EE_Ticket::archived, |
|
75 | 75 | 'content' => $this->_ticket_status_legend(EE_Ticket::archived), |
76 | 76 | 'options' => array( |
77 | 77 | 'position' => array( |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | ), |
85 | 85 | 8 => array( |
86 | 86 | 'content_id' => 'tkt-status-expired', |
87 | - 'target' => '.ticket-row .tkt-status-' . EE_Ticket::expired, |
|
87 | + 'target' => '.ticket-row .tkt-status-'.EE_Ticket::expired, |
|
88 | 88 | 'content' => $this->_ticket_status_legend(EE_Ticket::expired), |
89 | 89 | 'options' => array( |
90 | 90 | 'position' => array( |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | ), |
98 | 98 | 9 => array( |
99 | 99 | 'content_id' => 'tkt-status-sold_out', |
100 | - 'target' => '.ticket-row .tkt-status-' . EE_Ticket::sold_out, |
|
100 | + 'target' => '.ticket-row .tkt-status-'.EE_Ticket::sold_out, |
|
101 | 101 | 'content' => $this->_ticket_status_legend(EE_Ticket::sold_out), |
102 | 102 | 'options' => array( |
103 | 103 | 'position' => array( |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | ), |
111 | 111 | 10 => array( |
112 | 112 | 'content_id' => 'tkt-status-pending', |
113 | - 'target' => '.ticket-row .tkt-status-' . EE_Ticket::pending, |
|
113 | + 'target' => '.ticket-row .tkt-status-'.EE_Ticket::pending, |
|
114 | 114 | 'content' => $this->_ticket_status_legend(EE_Ticket::pending), |
115 | 115 | 'options' => array( |
116 | 116 | 'position' => array( |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | ), |
124 | 124 | 11 => array( |
125 | 125 | 'content_id' => 'tkt-status-onsale', |
126 | - 'target' => '.ticket-row .tkt-status-' . EE_Ticket::onsale, |
|
126 | + 'target' => '.ticket-row .tkt-status-'.EE_Ticket::onsale, |
|
127 | 127 | 'content' => $this->_ticket_status_legend(EE_Ticket::onsale), |
128 | 128 | 'options' => array( |
129 | 129 | 'position' => array( |
@@ -173,12 +173,12 @@ discard block |
||
173 | 173 | 'Clicking the taxable ticket toggle checkbox has enabled taxes for this ticket. What this means is that when a person purchases this ticket, the tax will be applied to all prices on this ticket. You can edit the existing tax price modifier that was setup in Event Espresso by going to %sDefault Pricing Admin Page%s (labelled "Pricing" in the Event Espresso Menu)', |
174 | 174 | 'event_espresso' |
175 | 175 | ), |
176 | - '<a href="' . $price_admin_link . '" title="' . esc_attr__( |
|
176 | + '<a href="'.$price_admin_link.'" title="'.esc_attr__( |
|
177 | 177 | 'Pricing Admin Page', |
178 | 178 | 'event_espresso' |
179 | - ) . '">', |
|
179 | + ).'">', |
|
180 | 180 | '</a>' |
181 | - ) . '</p>'; |
|
181 | + ).'</p>'; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -13,189 +13,189 @@ |
||
13 | 13 | */ |
14 | 14 | class EE_Event_Editor_Tips extends EE_Qtip_Config |
15 | 15 | { |
16 | - protected function _set_tips_array() |
|
17 | - { |
|
18 | - $this->_qtipsa = array( |
|
19 | - 0 => array( |
|
20 | - 'content_id' => 'about-taxable-toggle', |
|
21 | - 'target' => '.TKT-taxable-checkbox', |
|
22 | - 'content' => $this->_get_taxable_info_content(), |
|
23 | - 'options' => array( |
|
24 | - 'show_only_once' => true, |
|
25 | - 'content' => array( |
|
26 | - 'title' => esc_html__('Taxable Ticket Toggle', 'event_espresso'), |
|
27 | - 'button' => true, |
|
28 | - ), |
|
29 | - 'show' => array( |
|
30 | - 'event' => 'click', |
|
31 | - ), |
|
32 | - 'hide' => array( |
|
33 | - 'event' => false, |
|
34 | - ), |
|
35 | - 'style' => array( |
|
36 | - 'classes' => '', |
|
37 | - ), |
|
38 | - )// defaults |
|
39 | - ), |
|
40 | - 1 => array( |
|
41 | - 'content_id' => 'ticket-icon-help', |
|
42 | - 'target' => '.ticket-icon', |
|
43 | - 'content' => esc_html__('Assigned Tickets', 'event_espresso'), |
|
44 | - ), |
|
45 | - 2 => array( |
|
46 | - 'content_id' => 'clone-icon-help', |
|
47 | - 'target' => '.clone-icon', |
|
48 | - 'content' => esc_html__('Duplicate this Item', 'event_espresso'), |
|
49 | - ), |
|
50 | - 3 => array( |
|
51 | - 'content_id' => 'trash-datetime-help', |
|
52 | - 'target' => '.datetime-edit-table .trash-icon', |
|
53 | - 'content' => esc_html__('Trash Datetime', 'event_espresso'), |
|
54 | - ), |
|
55 | - 4 => array( |
|
56 | - 'content_id' => 'trash-ticket-help', |
|
57 | - 'target' => '.ticket-row .trash-icon', |
|
58 | - 'content' => esc_html__('Trash Ticket', 'event_espresso'), |
|
59 | - ), |
|
60 | - 5 => array( |
|
61 | - 'content_id' => 'trash-price-modifier-help', |
|
62 | - 'target' => '.ticket-price-rows .trash-icon', |
|
63 | - 'content' => esc_html__('Trash Price Modifier', 'event_espresso'), |
|
64 | - ), |
|
65 | - 6 => array( |
|
66 | - 'content_id' => 'gear-icon-help', |
|
67 | - 'target' => '.gear-icon', |
|
68 | - 'content' => esc_html__('Advanced Settings', 'event_espresso'), |
|
69 | - ), |
|
70 | - 7 => array( |
|
71 | - 'content_id' => 'tkt-status-archived', |
|
72 | - 'target' => '.ticket-row .tkt-status-' . EE_Ticket::archived, |
|
73 | - 'content' => $this->_ticket_status_legend(EE_Ticket::archived), |
|
74 | - 'options' => array( |
|
75 | - 'position' => array( |
|
76 | - 'target' => 'mouse', |
|
77 | - 'adjust' => array( |
|
78 | - 'mouse' => false, |
|
79 | - ), |
|
80 | - ), |
|
81 | - ), |
|
82 | - ), |
|
83 | - 8 => array( |
|
84 | - 'content_id' => 'tkt-status-expired', |
|
85 | - 'target' => '.ticket-row .tkt-status-' . EE_Ticket::expired, |
|
86 | - 'content' => $this->_ticket_status_legend(EE_Ticket::expired), |
|
87 | - 'options' => array( |
|
88 | - 'position' => array( |
|
89 | - 'target' => 'mouse', |
|
90 | - 'adjust' => array( |
|
91 | - 'mouse' => false, |
|
92 | - ), |
|
93 | - ), |
|
94 | - ), |
|
95 | - ), |
|
96 | - 9 => array( |
|
97 | - 'content_id' => 'tkt-status-sold_out', |
|
98 | - 'target' => '.ticket-row .tkt-status-' . EE_Ticket::sold_out, |
|
99 | - 'content' => $this->_ticket_status_legend(EE_Ticket::sold_out), |
|
100 | - 'options' => array( |
|
101 | - 'position' => array( |
|
102 | - 'target' => 'mouse', |
|
103 | - 'adjust' => array( |
|
104 | - 'mouse' => false, |
|
105 | - ), |
|
106 | - ), |
|
107 | - ), |
|
108 | - ), |
|
109 | - 10 => array( |
|
110 | - 'content_id' => 'tkt-status-pending', |
|
111 | - 'target' => '.ticket-row .tkt-status-' . EE_Ticket::pending, |
|
112 | - 'content' => $this->_ticket_status_legend(EE_Ticket::pending), |
|
113 | - 'options' => array( |
|
114 | - 'position' => array( |
|
115 | - 'target' => 'mouse', |
|
116 | - 'adjust' => array( |
|
117 | - 'mouse' => false, |
|
118 | - ), |
|
119 | - ), |
|
120 | - ), |
|
121 | - ), |
|
122 | - 11 => array( |
|
123 | - 'content_id' => 'tkt-status-onsale', |
|
124 | - 'target' => '.ticket-row .tkt-status-' . EE_Ticket::onsale, |
|
125 | - 'content' => $this->_ticket_status_legend(EE_Ticket::onsale), |
|
126 | - 'options' => array( |
|
127 | - 'position' => array( |
|
128 | - 'target' => 'mouse', |
|
129 | - 'adjust' => array( |
|
130 | - 'mouse' => false, |
|
131 | - ), |
|
132 | - ), |
|
133 | - ), |
|
134 | - ), |
|
135 | - 12 => array( |
|
136 | - 'content_id' => 'sortable-tkt-drag-handle-tip', |
|
137 | - 'target' => '.ee-ticket-sortable .sortable-drag-handle', |
|
138 | - 'content' => esc_html__('Click and drag-n-drop to reorder tickets.', 'event_espresso'), |
|
139 | - 'options' => array( |
|
140 | - 'position' => array( |
|
141 | - 'adjust' => array( |
|
142 | - 'mouse' => false, |
|
143 | - 'y' => 5, |
|
144 | - ), |
|
145 | - ), |
|
146 | - ), |
|
147 | - ), |
|
148 | - 13 => array( |
|
149 | - 'content_id' => 'sortable-dtt-drag-handle-tip', |
|
150 | - 'target' => '.ee-dtt-sortable .sortable-drag-handle', |
|
151 | - 'content' => esc_html__('Click and drag-n-drop to reorder datetimes.', 'event_espresso'), |
|
152 | - 'options' => array( |
|
153 | - 'position' => array( |
|
154 | - 'adjust' => array( |
|
155 | - 'mouse' => false, |
|
156 | - 'y' => 5, |
|
157 | - ), |
|
158 | - ), |
|
159 | - ), |
|
160 | - ), |
|
161 | - ); |
|
162 | - } |
|
16 | + protected function _set_tips_array() |
|
17 | + { |
|
18 | + $this->_qtipsa = array( |
|
19 | + 0 => array( |
|
20 | + 'content_id' => 'about-taxable-toggle', |
|
21 | + 'target' => '.TKT-taxable-checkbox', |
|
22 | + 'content' => $this->_get_taxable_info_content(), |
|
23 | + 'options' => array( |
|
24 | + 'show_only_once' => true, |
|
25 | + 'content' => array( |
|
26 | + 'title' => esc_html__('Taxable Ticket Toggle', 'event_espresso'), |
|
27 | + 'button' => true, |
|
28 | + ), |
|
29 | + 'show' => array( |
|
30 | + 'event' => 'click', |
|
31 | + ), |
|
32 | + 'hide' => array( |
|
33 | + 'event' => false, |
|
34 | + ), |
|
35 | + 'style' => array( |
|
36 | + 'classes' => '', |
|
37 | + ), |
|
38 | + )// defaults |
|
39 | + ), |
|
40 | + 1 => array( |
|
41 | + 'content_id' => 'ticket-icon-help', |
|
42 | + 'target' => '.ticket-icon', |
|
43 | + 'content' => esc_html__('Assigned Tickets', 'event_espresso'), |
|
44 | + ), |
|
45 | + 2 => array( |
|
46 | + 'content_id' => 'clone-icon-help', |
|
47 | + 'target' => '.clone-icon', |
|
48 | + 'content' => esc_html__('Duplicate this Item', 'event_espresso'), |
|
49 | + ), |
|
50 | + 3 => array( |
|
51 | + 'content_id' => 'trash-datetime-help', |
|
52 | + 'target' => '.datetime-edit-table .trash-icon', |
|
53 | + 'content' => esc_html__('Trash Datetime', 'event_espresso'), |
|
54 | + ), |
|
55 | + 4 => array( |
|
56 | + 'content_id' => 'trash-ticket-help', |
|
57 | + 'target' => '.ticket-row .trash-icon', |
|
58 | + 'content' => esc_html__('Trash Ticket', 'event_espresso'), |
|
59 | + ), |
|
60 | + 5 => array( |
|
61 | + 'content_id' => 'trash-price-modifier-help', |
|
62 | + 'target' => '.ticket-price-rows .trash-icon', |
|
63 | + 'content' => esc_html__('Trash Price Modifier', 'event_espresso'), |
|
64 | + ), |
|
65 | + 6 => array( |
|
66 | + 'content_id' => 'gear-icon-help', |
|
67 | + 'target' => '.gear-icon', |
|
68 | + 'content' => esc_html__('Advanced Settings', 'event_espresso'), |
|
69 | + ), |
|
70 | + 7 => array( |
|
71 | + 'content_id' => 'tkt-status-archived', |
|
72 | + 'target' => '.ticket-row .tkt-status-' . EE_Ticket::archived, |
|
73 | + 'content' => $this->_ticket_status_legend(EE_Ticket::archived), |
|
74 | + 'options' => array( |
|
75 | + 'position' => array( |
|
76 | + 'target' => 'mouse', |
|
77 | + 'adjust' => array( |
|
78 | + 'mouse' => false, |
|
79 | + ), |
|
80 | + ), |
|
81 | + ), |
|
82 | + ), |
|
83 | + 8 => array( |
|
84 | + 'content_id' => 'tkt-status-expired', |
|
85 | + 'target' => '.ticket-row .tkt-status-' . EE_Ticket::expired, |
|
86 | + 'content' => $this->_ticket_status_legend(EE_Ticket::expired), |
|
87 | + 'options' => array( |
|
88 | + 'position' => array( |
|
89 | + 'target' => 'mouse', |
|
90 | + 'adjust' => array( |
|
91 | + 'mouse' => false, |
|
92 | + ), |
|
93 | + ), |
|
94 | + ), |
|
95 | + ), |
|
96 | + 9 => array( |
|
97 | + 'content_id' => 'tkt-status-sold_out', |
|
98 | + 'target' => '.ticket-row .tkt-status-' . EE_Ticket::sold_out, |
|
99 | + 'content' => $this->_ticket_status_legend(EE_Ticket::sold_out), |
|
100 | + 'options' => array( |
|
101 | + 'position' => array( |
|
102 | + 'target' => 'mouse', |
|
103 | + 'adjust' => array( |
|
104 | + 'mouse' => false, |
|
105 | + ), |
|
106 | + ), |
|
107 | + ), |
|
108 | + ), |
|
109 | + 10 => array( |
|
110 | + 'content_id' => 'tkt-status-pending', |
|
111 | + 'target' => '.ticket-row .tkt-status-' . EE_Ticket::pending, |
|
112 | + 'content' => $this->_ticket_status_legend(EE_Ticket::pending), |
|
113 | + 'options' => array( |
|
114 | + 'position' => array( |
|
115 | + 'target' => 'mouse', |
|
116 | + 'adjust' => array( |
|
117 | + 'mouse' => false, |
|
118 | + ), |
|
119 | + ), |
|
120 | + ), |
|
121 | + ), |
|
122 | + 11 => array( |
|
123 | + 'content_id' => 'tkt-status-onsale', |
|
124 | + 'target' => '.ticket-row .tkt-status-' . EE_Ticket::onsale, |
|
125 | + 'content' => $this->_ticket_status_legend(EE_Ticket::onsale), |
|
126 | + 'options' => array( |
|
127 | + 'position' => array( |
|
128 | + 'target' => 'mouse', |
|
129 | + 'adjust' => array( |
|
130 | + 'mouse' => false, |
|
131 | + ), |
|
132 | + ), |
|
133 | + ), |
|
134 | + ), |
|
135 | + 12 => array( |
|
136 | + 'content_id' => 'sortable-tkt-drag-handle-tip', |
|
137 | + 'target' => '.ee-ticket-sortable .sortable-drag-handle', |
|
138 | + 'content' => esc_html__('Click and drag-n-drop to reorder tickets.', 'event_espresso'), |
|
139 | + 'options' => array( |
|
140 | + 'position' => array( |
|
141 | + 'adjust' => array( |
|
142 | + 'mouse' => false, |
|
143 | + 'y' => 5, |
|
144 | + ), |
|
145 | + ), |
|
146 | + ), |
|
147 | + ), |
|
148 | + 13 => array( |
|
149 | + 'content_id' => 'sortable-dtt-drag-handle-tip', |
|
150 | + 'target' => '.ee-dtt-sortable .sortable-drag-handle', |
|
151 | + 'content' => esc_html__('Click and drag-n-drop to reorder datetimes.', 'event_espresso'), |
|
152 | + 'options' => array( |
|
153 | + 'position' => array( |
|
154 | + 'adjust' => array( |
|
155 | + 'mouse' => false, |
|
156 | + 'y' => 5, |
|
157 | + ), |
|
158 | + ), |
|
159 | + ), |
|
160 | + ), |
|
161 | + ); |
|
162 | + } |
|
163 | 163 | |
164 | 164 | |
165 | - private function _get_taxable_info_content() |
|
166 | - { |
|
167 | - $price_admin_link = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default'), PRICING_ADMIN_URL); |
|
168 | - return '<p>' |
|
169 | - . sprintf( |
|
170 | - esc_html__( |
|
171 | - 'Clicking the taxable ticket toggle checkbox has enabled taxes for this ticket. What this means is that when a person purchases this ticket, the tax will be applied to all prices on this ticket. You can edit the existing tax price modifier that was setup in Event Espresso by going to %sDefault Pricing Admin Page%s (labelled "Pricing" in the Event Espresso Menu)', |
|
172 | - 'event_espresso' |
|
173 | - ), |
|
174 | - '<a href="' . $price_admin_link . '" title="' . esc_attr__( |
|
175 | - 'Pricing Admin Page', |
|
176 | - 'event_espresso' |
|
177 | - ) . '">', |
|
178 | - '</a>' |
|
179 | - ) . '</p>'; |
|
180 | - } |
|
165 | + private function _get_taxable_info_content() |
|
166 | + { |
|
167 | + $price_admin_link = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default'), PRICING_ADMIN_URL); |
|
168 | + return '<p>' |
|
169 | + . sprintf( |
|
170 | + esc_html__( |
|
171 | + 'Clicking the taxable ticket toggle checkbox has enabled taxes for this ticket. What this means is that when a person purchases this ticket, the tax will be applied to all prices on this ticket. You can edit the existing tax price modifier that was setup in Event Espresso by going to %sDefault Pricing Admin Page%s (labelled "Pricing" in the Event Espresso Menu)', |
|
172 | + 'event_espresso' |
|
173 | + ), |
|
174 | + '<a href="' . $price_admin_link . '" title="' . esc_attr__( |
|
175 | + 'Pricing Admin Page', |
|
176 | + 'event_espresso' |
|
177 | + ) . '">', |
|
178 | + '</a>' |
|
179 | + ) . '</p>'; |
|
180 | + } |
|
181 | 181 | |
182 | - /** |
|
183 | - * output the relevant ee-status-legend with the designated status highlighted. |
|
184 | - * |
|
185 | - * @param EE_Ticket constant $status What status is set (by class) |
|
186 | - * @return string The status legend with the related status highlighted |
|
187 | - */ |
|
188 | - private function _ticket_status_legend($status) |
|
189 | - { |
|
182 | + /** |
|
183 | + * output the relevant ee-status-legend with the designated status highlighted. |
|
184 | + * |
|
185 | + * @param EE_Ticket constant $status What status is set (by class) |
|
186 | + * @return string The status legend with the related status highlighted |
|
187 | + */ |
|
188 | + private function _ticket_status_legend($status) |
|
189 | + { |
|
190 | 190 | |
191 | - $status_array = array( |
|
192 | - 'archived' => EE_Ticket::archived, |
|
193 | - 'expired' => EE_Ticket::expired, |
|
194 | - 'sold_out' => EE_Ticket::sold_out, |
|
195 | - 'pending' => EE_Ticket::pending, |
|
196 | - 'onsale' => EE_Ticket::onsale, |
|
197 | - ); |
|
191 | + $status_array = array( |
|
192 | + 'archived' => EE_Ticket::archived, |
|
193 | + 'expired' => EE_Ticket::expired, |
|
194 | + 'sold_out' => EE_Ticket::sold_out, |
|
195 | + 'pending' => EE_Ticket::pending, |
|
196 | + 'onsale' => EE_Ticket::onsale, |
|
197 | + ); |
|
198 | 198 | |
199 | - return EEH_Template::status_legend($status_array, $status); |
|
200 | - } |
|
199 | + return EEH_Template::status_legend($status_array, $status); |
|
200 | + } |
|
201 | 201 | } |