@@ -14,88 +14,88 @@ |
||
14 | 14 | * ------------------------------------------------------------------------ |
15 | 15 | */ |
16 | 16 | /** |
17 | - * |
|
18 | - * Class EE_Receipt_Line_Item_Display_Strategy |
|
19 | - * |
|
20 | - * Description |
|
21 | - * |
|
22 | - * @package Event Espresso |
|
23 | - * @subpackage core |
|
24 | - * @author Brent Christensen |
|
25 | - * |
|
26 | - * |
|
27 | - */ |
|
17 | + * |
|
18 | + * Class EE_Receipt_Line_Item_Display_Strategy |
|
19 | + * |
|
20 | + * Description |
|
21 | + * |
|
22 | + * @package Event Espresso |
|
23 | + * @subpackage core |
|
24 | + * @author Brent Christensen |
|
25 | + * |
|
26 | + * |
|
27 | + */ |
|
28 | 28 | |
29 | 29 | class EE_Receipt_Line_Item_Display_Strategy implements EEI_Line_Item_Display |
30 | 30 | { |
31 | 31 | |
32 | - /** |
|
33 | - * @param EE_Line_Item $line_item |
|
34 | - * @param array $options |
|
35 | - * @return mixed |
|
36 | - */ |
|
37 | - public function display_line_item(EE_Line_Item $line_item, $options = array()) |
|
38 | - { |
|
32 | + /** |
|
33 | + * @param EE_Line_Item $line_item |
|
34 | + * @param array $options |
|
35 | + * @return mixed |
|
36 | + */ |
|
37 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) |
|
38 | + { |
|
39 | 39 | |
40 | - $html = ''; |
|
41 | - // set some default options and merge with incoming |
|
42 | - $default_options = array( |
|
43 | - 'show_desc' => true, |
|
44 | - 'odd' => false |
|
45 | - ); |
|
46 | - $options = array_merge($default_options, (array) $options); |
|
47 | - switch ($line_item->type()) { |
|
48 | - case EEM_Line_Item::type_total: |
|
49 | - // loop thru children |
|
50 | - foreach ($line_item->children() as $child_line_item) { |
|
51 | - // recursively feed children back into this method |
|
40 | + $html = ''; |
|
41 | + // set some default options and merge with incoming |
|
42 | + $default_options = array( |
|
43 | + 'show_desc' => true, |
|
44 | + 'odd' => false |
|
45 | + ); |
|
46 | + $options = array_merge($default_options, (array) $options); |
|
47 | + switch ($line_item->type()) { |
|
48 | + case EEM_Line_Item::type_total: |
|
49 | + // loop thru children |
|
50 | + foreach ($line_item->children() as $child_line_item) { |
|
51 | + // recursively feed children back into this method |
|
52 | 52 | // $html .= $this->display_line_item( $child_line_item, $options ); |
53 | - } |
|
53 | + } |
|
54 | 54 | // $html .= $this->_separator_row( $options ); |
55 | 55 | // $html .= $this->_total_row( $line_item, __('Total', 'event_espresso'), $options ); |
56 | - break; |
|
56 | + break; |
|
57 | 57 | |
58 | 58 | |
59 | - case EEM_Line_Item::type_sub_total: |
|
60 | - // loop thru children |
|
61 | - foreach ($line_item->children() as $child_line_item) { |
|
62 | - // recursively feed children back into this method |
|
59 | + case EEM_Line_Item::type_sub_total: |
|
60 | + // loop thru children |
|
61 | + foreach ($line_item->children() as $child_line_item) { |
|
62 | + // recursively feed children back into this method |
|
63 | 63 | // $html .= $this->display_line_item( $child_line_item, $options ); |
64 | - } |
|
64 | + } |
|
65 | 65 | // $html .= $this->_total_row( $line_item, __('Sub-Total', 'event_espresso'), $options ); |
66 | - break; |
|
66 | + break; |
|
67 | 67 | |
68 | 68 | |
69 | - case EEM_Line_Item::type_tax_sub_total: |
|
70 | - // loop thru children |
|
71 | - foreach ($line_item->children() as $child_line_item) { |
|
72 | - // recursively feed children back into this method |
|
69 | + case EEM_Line_Item::type_tax_sub_total: |
|
70 | + // loop thru children |
|
71 | + foreach ($line_item->children() as $child_line_item) { |
|
72 | + // recursively feed children back into this method |
|
73 | 73 | // $html .= $this->display_line_item( $child_line_item, $options ); |
74 | - } |
|
74 | + } |
|
75 | 75 | // $html .= $this->_total_row( $line_item, __('Tax Total', 'event_espresso'), $options ); |
76 | - break; |
|
76 | + break; |
|
77 | 77 | |
78 | 78 | |
79 | - case EEM_Line_Item::type_line_item: |
|
80 | - // item row |
|
79 | + case EEM_Line_Item::type_line_item: |
|
80 | + // item row |
|
81 | 81 | // $html .= $this->_item_row( $line_item, $options ); |
82 | - // got any kids? |
|
83 | - foreach ($line_item->children() as $child_line_item) { |
|
82 | + // got any kids? |
|
83 | + foreach ($line_item->children() as $child_line_item) { |
|
84 | 84 | // $this->display_line_item( $child_line_item, $options ); |
85 | - } |
|
86 | - break; |
|
85 | + } |
|
86 | + break; |
|
87 | 87 | |
88 | 88 | |
89 | - case EEM_Line_Item::type_sub_line_item: |
|
89 | + case EEM_Line_Item::type_sub_line_item: |
|
90 | 90 | // $html .= $this->_sub_item_row( $line_item, $options ); |
91 | - break; |
|
91 | + break; |
|
92 | 92 | |
93 | 93 | |
94 | - case EEM_Line_Item::type_tax: |
|
94 | + case EEM_Line_Item::type_tax: |
|
95 | 95 | // $html .= $this->_tax_row( $line_item, $options ); |
96 | - break; |
|
97 | - } |
|
96 | + break; |
|
97 | + } |
|
98 | 98 | |
99 | - return $html; |
|
100 | - } |
|
99 | + return $html; |
|
100 | + } |
|
101 | 101 | } |
@@ -71,22 +71,22 @@ discard block |
||
71 | 71 | |
72 | 72 | $name_html = $line_item_related_object instanceof EEI_Line_Item_Object |
73 | 73 | ? $line_item_related_object->name() : $line_item->name(); |
74 | - $name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' |
|
74 | + $name_html = $name_link ? '<a href="'.$name_link.'">'.$name_html.'</a>' |
|
75 | 75 | : $name_html; |
76 | 76 | $name_html .= $line_item->is_taxable() ? ' *' : ''; |
77 | 77 | // maybe preface with icon? |
78 | 78 | $name_html = $line_item_related_object instanceof EEI_Has_Icon |
79 | - ? $line_item_related_object->get_icon() . $name_html |
|
79 | + ? $line_item_related_object->get_icon().$name_html |
|
80 | 80 | : $name_html; |
81 | - $name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>'; |
|
82 | - $name_html .= sprintf( |
|
81 | + $name_html = '<span class="ee-line-item-name linked">'.$name_html.'</span><br>'; |
|
82 | + $name_html .= sprintf( |
|
83 | 83 | _x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), |
84 | 84 | '<span class="ee-line-item-related-parent-object">', |
85 | 85 | $line_item->parent() instanceof EE_Line_Item |
86 | 86 | ? $line_item->parent()->OBJ_type_i18n() |
87 | 87 | : __('Item:', 'event_espresso'), |
88 | 88 | $parent_related_object_link |
89 | - ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' |
|
89 | + ? '<a href="'.$parent_related_object_link.'">'.$parent_related_object_name.'</a>' |
|
90 | 90 | : $parent_related_object_name, |
91 | 91 | '</span>' |
92 | 92 | ); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $type_html .= $this->_get_cancellations($line_item); |
97 | 97 | $type_html .= $line_item->OBJ_type() ? '<br />' : ''; |
98 | 98 | $code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : ''; |
99 | - $type_html .= ! empty($code) ? '<span class="ee-line-item-id">' . sprintf(__('Code: %s', 'event_espresso'), $code) . '</span>' : ''; |
|
99 | + $type_html .= ! empty($code) ? '<span class="ee-line-item-id">'.sprintf(__('Code: %s', 'event_espresso'), $code).'</span>' : ''; |
|
100 | 100 | $html .= EEH_HTML::td($type_html, '', 'jst-left'); |
101 | 101 | |
102 | 102 | // Date column |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $datetimes = $line_item_related_object->datetimes(); |
106 | 106 | foreach ($datetimes as $datetime) { |
107 | 107 | if ($datetime instanceof EE_Datetime) { |
108 | - $datetime_content .= $datetime->get_dtt_display_name() . '<br>'; |
|
108 | + $datetime_content .= $datetime->get_dtt_display_name().'<br>'; |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | // Amount Column |
115 | 115 | if ($line_item->is_percent()) { |
116 | - $html .= EEH_HTML::td($line_item->percent() . '%', '', 'jst-rght'); |
|
116 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'jst-rght'); |
|
117 | 117 | } else { |
118 | 118 | $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght'); |
119 | 119 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | // start of row |
139 | 139 | $html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr'); |
140 | 140 | // name th |
141 | - $html .= EEH_HTML::th($line_item->name() . '(' . $line_item->get_pretty('LIN_percent') . '%)', '', 'jst-rght', '', ' colspan="3"'); |
|
141 | + $html .= EEH_HTML::th($line_item->name().'('.$line_item->get_pretty('LIN_percent').'%)', '', 'jst-rght', '', ' colspan="3"'); |
|
142 | 142 | // total th |
143 | 143 | $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
144 | 144 | // end of row |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | $html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr'); |
172 | 172 | // Total th label |
173 | 173 | if ($total_match) { |
174 | - $total_label = sprintf(__('This registration\'s total %s:', 'event_espresso'), '(' . EE_Registry::instance()->CFG->currency->code . ')'); |
|
174 | + $total_label = sprintf(__('This registration\'s total %s:', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')'); |
|
175 | 175 | } else { |
176 | - $total_label = sprintf(__('This registration\'s approximate total %s', 'event_espresso'), '(' . EE_Registry::instance()->CFG->currency->code . ')'); |
|
176 | + $total_label = sprintf(__('This registration\'s approximate total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')'); |
|
177 | 177 | $total_label .= '<br>'; |
178 | 178 | $total_label .= '<p class="ee-footnote-text">' |
179 | 179 | . sprintf( |
@@ -13,191 +13,191 @@ |
||
13 | 13 | class EE_Admin_Table_Registration_Line_Item_Display_Strategy extends EE_Admin_Table_Line_Item_Display_Strategy |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * Table header for display. |
|
18 | - * @since 4.8 |
|
19 | - * @param array $options |
|
20 | - * @return string |
|
21 | - */ |
|
22 | - protected function _table_header($options) |
|
23 | - { |
|
24 | - $html = EEH_HTML::table('', '', $options['table_css_class']); |
|
25 | - $html .= EEH_HTML::thead(); |
|
26 | - $html .= EEH_HTML::tr(); |
|
27 | - $html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left'); |
|
28 | - $html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left'); |
|
29 | - $html .= EEH_HTML::th(__('Date(s)', 'event_espresso'), '', 'jst-left'); |
|
30 | - $html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr'); |
|
31 | - $html .= EEH_HTML::tbody(); |
|
32 | - return $html; |
|
33 | - } |
|
34 | - |
|
35 | - |
|
36 | - |
|
37 | - |
|
38 | - |
|
39 | - /** |
|
40 | - * _item_row |
|
41 | - * |
|
42 | - * @param EE_Line_Item $line_item |
|
43 | - * @param array $options |
|
44 | - * @return mixed |
|
45 | - */ |
|
46 | - protected function _item_row(EE_Line_Item $line_item, $options = array()) |
|
47 | - { |
|
48 | - $line_item_related_object = $line_item->get_object(); |
|
49 | - $parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item |
|
50 | - ? $line_item->parent()->get_object() |
|
51 | - : null; |
|
52 | - // start of row |
|
53 | - $row_class = $options['odd'] ? 'item odd' : 'item'; |
|
54 | - $html = EEH_HTML::tr('', '', $row_class); |
|
55 | - |
|
56 | - |
|
57 | - // Name Column |
|
58 | - $name_link = $line_item_related_object instanceof EEI_Admin_Links ? $line_item_related_object->get_admin_details_link() : ''; |
|
59 | - |
|
60 | - // related object scope. |
|
61 | - $parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object |
|
62 | - ? $parent_line_item_related_object->name() |
|
63 | - : ''; |
|
64 | - $parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item |
|
65 | - ? $line_item->parent()->name() |
|
66 | - : $parent_related_object_name; |
|
67 | - $parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links |
|
68 | - ? $parent_line_item_related_object->get_admin_details_link() |
|
69 | - : ''; |
|
70 | - |
|
71 | - |
|
72 | - $name_html = $line_item_related_object instanceof EEI_Line_Item_Object |
|
73 | - ? $line_item_related_object->name() : $line_item->name(); |
|
74 | - $name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' |
|
75 | - : $name_html; |
|
76 | - $name_html .= $line_item->is_taxable() ? ' *' : ''; |
|
77 | - // maybe preface with icon? |
|
78 | - $name_html = $line_item_related_object instanceof EEI_Has_Icon |
|
79 | - ? $line_item_related_object->get_icon() . $name_html |
|
80 | - : $name_html; |
|
81 | - $name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>'; |
|
82 | - $name_html .= sprintf( |
|
83 | - _x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), |
|
84 | - '<span class="ee-line-item-related-parent-object">', |
|
85 | - $line_item->parent() instanceof EE_Line_Item |
|
86 | - ? $line_item->parent()->OBJ_type_i18n() |
|
87 | - : __('Item:', 'event_espresso'), |
|
88 | - $parent_related_object_link |
|
89 | - ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' |
|
90 | - : $parent_related_object_name, |
|
91 | - '</span>' |
|
92 | - ); |
|
93 | - |
|
94 | - $name_html = apply_filters( |
|
95 | - 'FHEE__EE_Admin_Table_Registration_Line_Item_Display_Strategy___item_row__name_html', |
|
96 | - $name_html, |
|
97 | - $line_item, |
|
98 | - $options |
|
99 | - ); |
|
16 | + /** |
|
17 | + * Table header for display. |
|
18 | + * @since 4.8 |
|
19 | + * @param array $options |
|
20 | + * @return string |
|
21 | + */ |
|
22 | + protected function _table_header($options) |
|
23 | + { |
|
24 | + $html = EEH_HTML::table('', '', $options['table_css_class']); |
|
25 | + $html .= EEH_HTML::thead(); |
|
26 | + $html .= EEH_HTML::tr(); |
|
27 | + $html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left'); |
|
28 | + $html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left'); |
|
29 | + $html .= EEH_HTML::th(__('Date(s)', 'event_espresso'), '', 'jst-left'); |
|
30 | + $html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr'); |
|
31 | + $html .= EEH_HTML::tbody(); |
|
32 | + return $html; |
|
33 | + } |
|
34 | + |
|
35 | + |
|
36 | + |
|
37 | + |
|
38 | + |
|
39 | + /** |
|
40 | + * _item_row |
|
41 | + * |
|
42 | + * @param EE_Line_Item $line_item |
|
43 | + * @param array $options |
|
44 | + * @return mixed |
|
45 | + */ |
|
46 | + protected function _item_row(EE_Line_Item $line_item, $options = array()) |
|
47 | + { |
|
48 | + $line_item_related_object = $line_item->get_object(); |
|
49 | + $parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item |
|
50 | + ? $line_item->parent()->get_object() |
|
51 | + : null; |
|
52 | + // start of row |
|
53 | + $row_class = $options['odd'] ? 'item odd' : 'item'; |
|
54 | + $html = EEH_HTML::tr('', '', $row_class); |
|
55 | + |
|
56 | + |
|
57 | + // Name Column |
|
58 | + $name_link = $line_item_related_object instanceof EEI_Admin_Links ? $line_item_related_object->get_admin_details_link() : ''; |
|
59 | + |
|
60 | + // related object scope. |
|
61 | + $parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object |
|
62 | + ? $parent_line_item_related_object->name() |
|
63 | + : ''; |
|
64 | + $parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item |
|
65 | + ? $line_item->parent()->name() |
|
66 | + : $parent_related_object_name; |
|
67 | + $parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links |
|
68 | + ? $parent_line_item_related_object->get_admin_details_link() |
|
69 | + : ''; |
|
70 | + |
|
71 | + |
|
72 | + $name_html = $line_item_related_object instanceof EEI_Line_Item_Object |
|
73 | + ? $line_item_related_object->name() : $line_item->name(); |
|
74 | + $name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' |
|
75 | + : $name_html; |
|
76 | + $name_html .= $line_item->is_taxable() ? ' *' : ''; |
|
77 | + // maybe preface with icon? |
|
78 | + $name_html = $line_item_related_object instanceof EEI_Has_Icon |
|
79 | + ? $line_item_related_object->get_icon() . $name_html |
|
80 | + : $name_html; |
|
81 | + $name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>'; |
|
82 | + $name_html .= sprintf( |
|
83 | + _x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), |
|
84 | + '<span class="ee-line-item-related-parent-object">', |
|
85 | + $line_item->parent() instanceof EE_Line_Item |
|
86 | + ? $line_item->parent()->OBJ_type_i18n() |
|
87 | + : __('Item:', 'event_espresso'), |
|
88 | + $parent_related_object_link |
|
89 | + ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' |
|
90 | + : $parent_related_object_name, |
|
91 | + '</span>' |
|
92 | + ); |
|
93 | + |
|
94 | + $name_html = apply_filters( |
|
95 | + 'FHEE__EE_Admin_Table_Registration_Line_Item_Display_Strategy___item_row__name_html', |
|
96 | + $name_html, |
|
97 | + $line_item, |
|
98 | + $options |
|
99 | + ); |
|
100 | 100 | |
101 | - $html .= EEH_HTML::td($name_html, '', 'jst-left'); |
|
102 | - // Type Column |
|
103 | - $type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() : ''; |
|
104 | - $type_html .= $this->_get_cancellations($line_item); |
|
105 | - $type_html .= $line_item->OBJ_type() ? '<br />' : ''; |
|
106 | - $code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : ''; |
|
107 | - $type_html .= ! empty($code) ? '<span class="ee-line-item-id">' . sprintf(__('Code: %s', 'event_espresso'), $code) . '</span>' : ''; |
|
108 | - $html .= EEH_HTML::td($type_html, '', 'jst-left'); |
|
109 | - |
|
110 | - // Date column |
|
111 | - $datetime_content = ''; |
|
112 | - if ($line_item_related_object instanceof EE_Ticket) { |
|
113 | - $datetimes = $line_item_related_object->datetimes(); |
|
114 | - foreach ($datetimes as $datetime) { |
|
115 | - if ($datetime instanceof EE_Datetime) { |
|
116 | - $datetime_content .= $datetime->get_dtt_display_name() . '<br>'; |
|
117 | - } |
|
118 | - } |
|
119 | - } |
|
120 | - $html .= EEH_HTML::td($datetime_content, '', 'jst-left'); |
|
121 | - |
|
122 | - // Amount Column |
|
123 | - if ($line_item->is_percent()) { |
|
124 | - $html .= EEH_HTML::td($line_item->percent() . '%', '', 'jst-rght'); |
|
125 | - } else { |
|
126 | - $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght'); |
|
127 | - } |
|
128 | - |
|
129 | - |
|
130 | - // finish things off and return |
|
131 | - $html .= EEH_HTML::trx(); |
|
132 | - return $html; |
|
133 | - } |
|
134 | - |
|
135 | - |
|
136 | - |
|
137 | - /** |
|
138 | - * _tax_row |
|
139 | - * |
|
140 | - * @param EE_Line_Item $line_item |
|
141 | - * @param array $options |
|
142 | - * @return mixed |
|
143 | - */ |
|
144 | - protected function _tax_row(EE_Line_Item $line_item, $options = array()) |
|
145 | - { |
|
146 | - // start of row |
|
147 | - $html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr'); |
|
148 | - // name th |
|
149 | - $html .= EEH_HTML::th($line_item->name() . '(' . $line_item->get_pretty('LIN_percent') . '%)', '', 'jst-rght', '', ' colspan="3"'); |
|
150 | - // total th |
|
151 | - $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
152 | - // end of row |
|
153 | - $html .= EEH_HTML::trx(); |
|
154 | - return $html; |
|
155 | - } |
|
156 | - |
|
157 | - |
|
158 | - |
|
159 | - |
|
160 | - |
|
161 | - /** |
|
162 | - * _total_row |
|
163 | - * |
|
164 | - * @param EE_Line_Item $line_item |
|
165 | - * @param array $options |
|
166 | - * @return mixed |
|
167 | - */ |
|
168 | - protected function _total_row(EE_Line_Item $line_item, $options = array()) |
|
169 | - { |
|
170 | - |
|
171 | - $registration = isset($options['EE_Registration']) ? $options['EE_Registration'] : null; |
|
172 | - $registration_total = $registration instanceof EE_Registration ? $registration->pretty_final_price() : 0; |
|
173 | - // if no valid registration object then we're not going to show the approximate text. |
|
174 | - $total_match = $registration instanceof EE_Registration |
|
175 | - ? $registration->final_price() === $line_item->total() |
|
176 | - : true; |
|
177 | - |
|
178 | - // start of row |
|
179 | - $html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr'); |
|
180 | - // Total th label |
|
181 | - if ($total_match) { |
|
182 | - $total_label = sprintf(__('This registration\'s total %s:', 'event_espresso'), '(' . EE_Registry::instance()->CFG->currency->code . ')'); |
|
183 | - } else { |
|
184 | - $total_label = sprintf(__('This registration\'s approximate total %s', 'event_espresso'), '(' . EE_Registry::instance()->CFG->currency->code . ')'); |
|
185 | - $total_label .= '<br>'; |
|
186 | - $total_label .= '<p class="ee-footnote-text">' |
|
187 | - . sprintf( |
|
188 | - __('The registrations\' share of the transaction total is approximate because it might not be possible to evenly divide the transaction total among each registration, and so some registrations may need to pay a penny more than others. This registration\'s final share is actually %1$s%2$s%3$s.', 'event_espresso'), |
|
189 | - '<strong>', |
|
190 | - $registration_total, |
|
191 | - '</strong>' |
|
192 | - ) |
|
193 | - . '</p>'; |
|
194 | - } |
|
195 | - $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="3"'); |
|
196 | - // total th |
|
197 | - |
|
198 | - $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
199 | - // end of row |
|
200 | - $html .= EEH_HTML::trx(); |
|
201 | - return $html; |
|
202 | - } |
|
101 | + $html .= EEH_HTML::td($name_html, '', 'jst-left'); |
|
102 | + // Type Column |
|
103 | + $type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() : ''; |
|
104 | + $type_html .= $this->_get_cancellations($line_item); |
|
105 | + $type_html .= $line_item->OBJ_type() ? '<br />' : ''; |
|
106 | + $code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : ''; |
|
107 | + $type_html .= ! empty($code) ? '<span class="ee-line-item-id">' . sprintf(__('Code: %s', 'event_espresso'), $code) . '</span>' : ''; |
|
108 | + $html .= EEH_HTML::td($type_html, '', 'jst-left'); |
|
109 | + |
|
110 | + // Date column |
|
111 | + $datetime_content = ''; |
|
112 | + if ($line_item_related_object instanceof EE_Ticket) { |
|
113 | + $datetimes = $line_item_related_object->datetimes(); |
|
114 | + foreach ($datetimes as $datetime) { |
|
115 | + if ($datetime instanceof EE_Datetime) { |
|
116 | + $datetime_content .= $datetime->get_dtt_display_name() . '<br>'; |
|
117 | + } |
|
118 | + } |
|
119 | + } |
|
120 | + $html .= EEH_HTML::td($datetime_content, '', 'jst-left'); |
|
121 | + |
|
122 | + // Amount Column |
|
123 | + if ($line_item->is_percent()) { |
|
124 | + $html .= EEH_HTML::td($line_item->percent() . '%', '', 'jst-rght'); |
|
125 | + } else { |
|
126 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght'); |
|
127 | + } |
|
128 | + |
|
129 | + |
|
130 | + // finish things off and return |
|
131 | + $html .= EEH_HTML::trx(); |
|
132 | + return $html; |
|
133 | + } |
|
134 | + |
|
135 | + |
|
136 | + |
|
137 | + /** |
|
138 | + * _tax_row |
|
139 | + * |
|
140 | + * @param EE_Line_Item $line_item |
|
141 | + * @param array $options |
|
142 | + * @return mixed |
|
143 | + */ |
|
144 | + protected function _tax_row(EE_Line_Item $line_item, $options = array()) |
|
145 | + { |
|
146 | + // start of row |
|
147 | + $html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr'); |
|
148 | + // name th |
|
149 | + $html .= EEH_HTML::th($line_item->name() . '(' . $line_item->get_pretty('LIN_percent') . '%)', '', 'jst-rght', '', ' colspan="3"'); |
|
150 | + // total th |
|
151 | + $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
152 | + // end of row |
|
153 | + $html .= EEH_HTML::trx(); |
|
154 | + return $html; |
|
155 | + } |
|
156 | + |
|
157 | + |
|
158 | + |
|
159 | + |
|
160 | + |
|
161 | + /** |
|
162 | + * _total_row |
|
163 | + * |
|
164 | + * @param EE_Line_Item $line_item |
|
165 | + * @param array $options |
|
166 | + * @return mixed |
|
167 | + */ |
|
168 | + protected function _total_row(EE_Line_Item $line_item, $options = array()) |
|
169 | + { |
|
170 | + |
|
171 | + $registration = isset($options['EE_Registration']) ? $options['EE_Registration'] : null; |
|
172 | + $registration_total = $registration instanceof EE_Registration ? $registration->pretty_final_price() : 0; |
|
173 | + // if no valid registration object then we're not going to show the approximate text. |
|
174 | + $total_match = $registration instanceof EE_Registration |
|
175 | + ? $registration->final_price() === $line_item->total() |
|
176 | + : true; |
|
177 | + |
|
178 | + // start of row |
|
179 | + $html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr'); |
|
180 | + // Total th label |
|
181 | + if ($total_match) { |
|
182 | + $total_label = sprintf(__('This registration\'s total %s:', 'event_espresso'), '(' . EE_Registry::instance()->CFG->currency->code . ')'); |
|
183 | + } else { |
|
184 | + $total_label = sprintf(__('This registration\'s approximate total %s', 'event_espresso'), '(' . EE_Registry::instance()->CFG->currency->code . ')'); |
|
185 | + $total_label .= '<br>'; |
|
186 | + $total_label .= '<p class="ee-footnote-text">' |
|
187 | + . sprintf( |
|
188 | + __('The registrations\' share of the transaction total is approximate because it might not be possible to evenly divide the transaction total among each registration, and so some registrations may need to pay a penny more than others. This registration\'s final share is actually %1$s%2$s%3$s.', 'event_espresso'), |
|
189 | + '<strong>', |
|
190 | + $registration_total, |
|
191 | + '</strong>' |
|
192 | + ) |
|
193 | + . '</p>'; |
|
194 | + } |
|
195 | + $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="3"'); |
|
196 | + // total th |
|
197 | + |
|
198 | + $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
199 | + // end of row |
|
200 | + $html .= EEH_HTML::trx(); |
|
201 | + return $html; |
|
202 | + } |
|
203 | 203 | } |
@@ -1,222 +1,222 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_Invoice_Line_Item_Display_Strategy |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_Invoice_Line_Item_Display_Strategy |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_Invoice_Line_Item_Display_Strategy implements EEI_Line_Item_Display |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * @param EE_Line_Item $line_item |
|
19 | - * @param array $options |
|
20 | - * @return mixed |
|
21 | - */ |
|
22 | - public function display_line_item(EE_Line_Item $line_item, $options = array()) |
|
23 | - { |
|
24 | - |
|
25 | - $html = ''; |
|
26 | - // set some default options and merge with incoming |
|
27 | - $default_options = array( |
|
28 | - 'show_desc' => true, |
|
29 | - 'odd' => false |
|
30 | - ); |
|
31 | - $options = array_merge($default_options, (array) $options); |
|
32 | - |
|
33 | - switch ($line_item->type()) { |
|
34 | - case EEM_Line_Item::type_total: |
|
35 | - // loop thru children |
|
36 | - foreach ($line_item->children() as $child_line_item) { |
|
37 | - // recursively feed children back into this method |
|
38 | - $html .= $this->display_line_item($child_line_item, $options); |
|
39 | - } |
|
40 | - $html .= $this->_separator_row($options); |
|
41 | - $html .= $this->_total_row($line_item, __('Total', 'event_espresso'), $options); |
|
42 | - break; |
|
43 | - |
|
44 | - |
|
45 | - case EEM_Line_Item::type_sub_total: |
|
46 | - // loop thru children |
|
47 | - foreach ($line_item->children() as $child_line_item) { |
|
48 | - // recursively feed children back into this method |
|
49 | - $html .= $this->display_line_item($child_line_item, $options); |
|
50 | - } |
|
51 | - $html .= $this->_total_row($line_item, __('Sub-Total', 'event_espresso'), $options); |
|
52 | - break; |
|
53 | - |
|
54 | - |
|
55 | - case EEM_Line_Item::type_tax_sub_total: |
|
56 | - // loop thru children |
|
57 | - foreach ($line_item->children() as $child_line_item) { |
|
58 | - // recursively feed children back into this method |
|
59 | - $html .= $this->display_line_item($child_line_item, $options); |
|
60 | - } |
|
61 | - $html .= $this->_total_row($line_item, __('Tax Total', 'event_espresso'), $options); |
|
62 | - break; |
|
63 | - |
|
64 | - |
|
65 | - case EEM_Line_Item::type_line_item: |
|
66 | - // item row |
|
67 | - $html .= $this->_item_row($line_item, $options); |
|
68 | - // got any kids? |
|
69 | - foreach ($line_item->children() as $child_line_item) { |
|
70 | - $this->display_line_item($child_line_item, $options); |
|
71 | - } |
|
72 | - break; |
|
73 | - |
|
74 | - |
|
75 | - case EEM_Line_Item::type_sub_line_item: |
|
76 | - $html .= $this->_sub_item_row($line_item, $options); |
|
77 | - break; |
|
78 | - |
|
79 | - |
|
80 | - case EEM_Line_Item::type_tax: |
|
81 | - $html .= $this->_tax_row($line_item, $options); |
|
82 | - break; |
|
83 | - } |
|
84 | - |
|
85 | - return $html; |
|
86 | - } |
|
87 | - |
|
88 | - |
|
89 | - |
|
90 | - /** |
|
91 | - * _total_row |
|
92 | - * |
|
93 | - * @param EE_Line_Item $line_item |
|
94 | - * @param array $options |
|
95 | - * @return mixed |
|
96 | - */ |
|
97 | - private function _item_row(EE_Line_Item $line_item, $options = array()) |
|
98 | - { |
|
99 | - // start of row |
|
100 | - $row_class = $options['odd'] ? 'item odd' : 'item'; |
|
101 | - $html = EEH_HTML::tr('', $row_class); |
|
102 | - // name td |
|
103 | - $html .= EEH_HTML::td($line_item->name(), '', 'item_l'); |
|
104 | - // desc td |
|
105 | - $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
106 | - // quantity td |
|
107 | - $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l'); |
|
108 | - // price td |
|
109 | - $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c'); |
|
110 | - // total td |
|
111 | - $total = $line_item->is_taxable() ? $line_item->total_no_code() . '*' : $line_item->total_no_code(); |
|
112 | - $html .= EEH_HTML::td($total, '', 'item_r'); |
|
113 | - // end of row |
|
114 | - $html .= EEH_HTML::trx(); |
|
115 | - return $html; |
|
116 | - } |
|
117 | - |
|
118 | - |
|
119 | - |
|
120 | - /** |
|
121 | - * _sub_item_row |
|
122 | - * |
|
123 | - * @param EE_Line_Item $line_item |
|
124 | - * @param array $options |
|
125 | - * @return mixed |
|
126 | - */ |
|
127 | - private function _sub_item_row(EE_Line_Item $line_item, $options = array()) |
|
128 | - { |
|
129 | - // start of row |
|
130 | - $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
131 | - // name td |
|
132 | - $html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item'); |
|
133 | - // desc td |
|
134 | - $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
135 | - $html .= EEH_HTML::td() . EEH_HTML::tdx(); |
|
136 | - // discount/surcharge td |
|
137 | - if ($line_item->is_percent()) { |
|
138 | - $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c'); |
|
139 | - } else { |
|
140 | - $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c'); |
|
141 | - } |
|
142 | - // total td |
|
143 | - $html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r'); |
|
144 | - // end of row |
|
145 | - $html .= EEH_HTML::trx(); |
|
146 | - return $html; |
|
147 | - } |
|
148 | - |
|
149 | - |
|
150 | - |
|
151 | - /** |
|
152 | - * _tax_row |
|
153 | - * |
|
154 | - * @param EE_Line_Item $line_item |
|
155 | - * @param array $options |
|
156 | - * @return mixed |
|
157 | - */ |
|
158 | - private function _tax_row(EE_Line_Item $line_item, $options = array()) |
|
159 | - { |
|
160 | - // start of row |
|
161 | - $html = EEH_HTML::tr('', 'item sub-item tax-total'); |
|
162 | - // name td |
|
163 | - $html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item'); |
|
164 | - // desc td |
|
165 | - $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
166 | - // percent td |
|
167 | - $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c', '', ' colspan="2"'); |
|
168 | - // total td |
|
169 | - $html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r'); |
|
170 | - // end of row |
|
171 | - $html .= EEH_HTML::trx(); |
|
172 | - return $html; |
|
173 | - } |
|
174 | - |
|
175 | - |
|
176 | - |
|
177 | - /** |
|
178 | - * _total_row |
|
179 | - * |
|
180 | - * @param EE_Line_Item $line_item |
|
181 | - * @param string $text |
|
182 | - * @param array $options |
|
183 | - * @return mixed |
|
184 | - */ |
|
185 | - private function _total_row(EE_Line_Item $line_item, $text = '', $options = array()) |
|
186 | - { |
|
187 | - // colspan |
|
188 | - $colspan = $options['show_desc'] ? ' colspan="2"' : ''; |
|
189 | - // start of row |
|
190 | - $html = EEH_HTML::tr('', '', 'total_tr odd'); |
|
191 | - // empty td |
|
192 | - $html .= EEH_HTML::td(EEH_HTML::nbsp(), '', '', '', $colspan); |
|
193 | - // total td |
|
194 | - $html .= EEH_HTML::td($text, '', 'total_currency total', '', $colspan); |
|
195 | - // total td |
|
196 | - $html .= EEH_HTML::td($line_item->total_no_code(), '', 'total'); |
|
197 | - // end of row |
|
198 | - $html .= EEH_HTML::trx(); |
|
199 | - return $html; |
|
200 | - } |
|
201 | - |
|
202 | - |
|
203 | - |
|
204 | - /** |
|
205 | - * _separator_row |
|
206 | - * |
|
207 | - * @param array $options |
|
208 | - * @return mixed |
|
209 | - */ |
|
210 | - private function _separator_row($options = array()) |
|
211 | - { |
|
212 | - // colspan |
|
213 | - $colspan = $options['show_desc'] ? ' colspan="5"' : ' colspan="4"'; |
|
214 | - // start of row |
|
215 | - $html = EEH_HTML::tr(EEH_HTML::td('<hr>', '', '', '', $colspan)); |
|
17 | + /** |
|
18 | + * @param EE_Line_Item $line_item |
|
19 | + * @param array $options |
|
20 | + * @return mixed |
|
21 | + */ |
|
22 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) |
|
23 | + { |
|
24 | + |
|
25 | + $html = ''; |
|
26 | + // set some default options and merge with incoming |
|
27 | + $default_options = array( |
|
28 | + 'show_desc' => true, |
|
29 | + 'odd' => false |
|
30 | + ); |
|
31 | + $options = array_merge($default_options, (array) $options); |
|
32 | + |
|
33 | + switch ($line_item->type()) { |
|
34 | + case EEM_Line_Item::type_total: |
|
35 | + // loop thru children |
|
36 | + foreach ($line_item->children() as $child_line_item) { |
|
37 | + // recursively feed children back into this method |
|
38 | + $html .= $this->display_line_item($child_line_item, $options); |
|
39 | + } |
|
40 | + $html .= $this->_separator_row($options); |
|
41 | + $html .= $this->_total_row($line_item, __('Total', 'event_espresso'), $options); |
|
42 | + break; |
|
43 | + |
|
44 | + |
|
45 | + case EEM_Line_Item::type_sub_total: |
|
46 | + // loop thru children |
|
47 | + foreach ($line_item->children() as $child_line_item) { |
|
48 | + // recursively feed children back into this method |
|
49 | + $html .= $this->display_line_item($child_line_item, $options); |
|
50 | + } |
|
51 | + $html .= $this->_total_row($line_item, __('Sub-Total', 'event_espresso'), $options); |
|
52 | + break; |
|
53 | + |
|
54 | + |
|
55 | + case EEM_Line_Item::type_tax_sub_total: |
|
56 | + // loop thru children |
|
57 | + foreach ($line_item->children() as $child_line_item) { |
|
58 | + // recursively feed children back into this method |
|
59 | + $html .= $this->display_line_item($child_line_item, $options); |
|
60 | + } |
|
61 | + $html .= $this->_total_row($line_item, __('Tax Total', 'event_espresso'), $options); |
|
62 | + break; |
|
63 | + |
|
64 | + |
|
65 | + case EEM_Line_Item::type_line_item: |
|
66 | + // item row |
|
67 | + $html .= $this->_item_row($line_item, $options); |
|
68 | + // got any kids? |
|
69 | + foreach ($line_item->children() as $child_line_item) { |
|
70 | + $this->display_line_item($child_line_item, $options); |
|
71 | + } |
|
72 | + break; |
|
73 | + |
|
74 | + |
|
75 | + case EEM_Line_Item::type_sub_line_item: |
|
76 | + $html .= $this->_sub_item_row($line_item, $options); |
|
77 | + break; |
|
78 | + |
|
79 | + |
|
80 | + case EEM_Line_Item::type_tax: |
|
81 | + $html .= $this->_tax_row($line_item, $options); |
|
82 | + break; |
|
83 | + } |
|
84 | + |
|
85 | + return $html; |
|
86 | + } |
|
87 | + |
|
88 | + |
|
89 | + |
|
90 | + /** |
|
91 | + * _total_row |
|
92 | + * |
|
93 | + * @param EE_Line_Item $line_item |
|
94 | + * @param array $options |
|
95 | + * @return mixed |
|
96 | + */ |
|
97 | + private function _item_row(EE_Line_Item $line_item, $options = array()) |
|
98 | + { |
|
99 | + // start of row |
|
100 | + $row_class = $options['odd'] ? 'item odd' : 'item'; |
|
101 | + $html = EEH_HTML::tr('', $row_class); |
|
102 | + // name td |
|
103 | + $html .= EEH_HTML::td($line_item->name(), '', 'item_l'); |
|
104 | + // desc td |
|
105 | + $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
106 | + // quantity td |
|
107 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l'); |
|
108 | + // price td |
|
109 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c'); |
|
110 | + // total td |
|
111 | + $total = $line_item->is_taxable() ? $line_item->total_no_code() . '*' : $line_item->total_no_code(); |
|
112 | + $html .= EEH_HTML::td($total, '', 'item_r'); |
|
113 | + // end of row |
|
114 | + $html .= EEH_HTML::trx(); |
|
115 | + return $html; |
|
116 | + } |
|
117 | + |
|
118 | + |
|
119 | + |
|
120 | + /** |
|
121 | + * _sub_item_row |
|
122 | + * |
|
123 | + * @param EE_Line_Item $line_item |
|
124 | + * @param array $options |
|
125 | + * @return mixed |
|
126 | + */ |
|
127 | + private function _sub_item_row(EE_Line_Item $line_item, $options = array()) |
|
128 | + { |
|
129 | + // start of row |
|
130 | + $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
131 | + // name td |
|
132 | + $html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item'); |
|
133 | + // desc td |
|
134 | + $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
135 | + $html .= EEH_HTML::td() . EEH_HTML::tdx(); |
|
136 | + // discount/surcharge td |
|
137 | + if ($line_item->is_percent()) { |
|
138 | + $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c'); |
|
139 | + } else { |
|
140 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c'); |
|
141 | + } |
|
142 | + // total td |
|
143 | + $html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r'); |
|
144 | + // end of row |
|
145 | + $html .= EEH_HTML::trx(); |
|
146 | + return $html; |
|
147 | + } |
|
148 | + |
|
149 | + |
|
150 | + |
|
151 | + /** |
|
152 | + * _tax_row |
|
153 | + * |
|
154 | + * @param EE_Line_Item $line_item |
|
155 | + * @param array $options |
|
156 | + * @return mixed |
|
157 | + */ |
|
158 | + private function _tax_row(EE_Line_Item $line_item, $options = array()) |
|
159 | + { |
|
160 | + // start of row |
|
161 | + $html = EEH_HTML::tr('', 'item sub-item tax-total'); |
|
162 | + // name td |
|
163 | + $html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item'); |
|
164 | + // desc td |
|
165 | + $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
166 | + // percent td |
|
167 | + $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c', '', ' colspan="2"'); |
|
168 | + // total td |
|
169 | + $html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r'); |
|
170 | + // end of row |
|
171 | + $html .= EEH_HTML::trx(); |
|
172 | + return $html; |
|
173 | + } |
|
174 | + |
|
175 | + |
|
176 | + |
|
177 | + /** |
|
178 | + * _total_row |
|
179 | + * |
|
180 | + * @param EE_Line_Item $line_item |
|
181 | + * @param string $text |
|
182 | + * @param array $options |
|
183 | + * @return mixed |
|
184 | + */ |
|
185 | + private function _total_row(EE_Line_Item $line_item, $text = '', $options = array()) |
|
186 | + { |
|
187 | + // colspan |
|
188 | + $colspan = $options['show_desc'] ? ' colspan="2"' : ''; |
|
189 | + // start of row |
|
190 | + $html = EEH_HTML::tr('', '', 'total_tr odd'); |
|
191 | + // empty td |
|
192 | + $html .= EEH_HTML::td(EEH_HTML::nbsp(), '', '', '', $colspan); |
|
193 | + // total td |
|
194 | + $html .= EEH_HTML::td($text, '', 'total_currency total', '', $colspan); |
|
195 | + // total td |
|
196 | + $html .= EEH_HTML::td($line_item->total_no_code(), '', 'total'); |
|
197 | + // end of row |
|
198 | + $html .= EEH_HTML::trx(); |
|
199 | + return $html; |
|
200 | + } |
|
201 | + |
|
202 | + |
|
203 | + |
|
204 | + /** |
|
205 | + * _separator_row |
|
206 | + * |
|
207 | + * @param array $options |
|
208 | + * @return mixed |
|
209 | + */ |
|
210 | + private function _separator_row($options = array()) |
|
211 | + { |
|
212 | + // colspan |
|
213 | + $colspan = $options['show_desc'] ? ' colspan="5"' : ' colspan="4"'; |
|
214 | + // start of row |
|
215 | + $html = EEH_HTML::tr(EEH_HTML::td('<hr>', '', '', '', $colspan)); |
|
216 | 216 | // // separator td |
217 | 217 | // $html .= EEH_HTML::td( '<hr>', '', '', '', $colspan ); |
218 | 218 | // // end of row |
219 | 219 | // $html .= EEH_HTML::trx(); |
220 | - return $html; |
|
221 | - } |
|
220 | + return $html; |
|
221 | + } |
|
222 | 222 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | // price td |
109 | 109 | $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c'); |
110 | 110 | // total td |
111 | - $total = $line_item->is_taxable() ? $line_item->total_no_code() . '*' : $line_item->total_no_code(); |
|
111 | + $total = $line_item->is_taxable() ? $line_item->total_no_code().'*' : $line_item->total_no_code(); |
|
112 | 112 | $html .= EEH_HTML::td($total, '', 'item_r'); |
113 | 113 | // end of row |
114 | 114 | $html .= EEH_HTML::trx(); |
@@ -132,10 +132,10 @@ discard block |
||
132 | 132 | $html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item'); |
133 | 133 | // desc td |
134 | 134 | $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
135 | - $html .= EEH_HTML::td() . EEH_HTML::tdx(); |
|
135 | + $html .= EEH_HTML::td().EEH_HTML::tdx(); |
|
136 | 136 | // discount/surcharge td |
137 | 137 | if ($line_item->is_percent()) { |
138 | - $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c'); |
|
138 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c'); |
|
139 | 139 | } else { |
140 | 140 | $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c'); |
141 | 141 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | // desc td |
165 | 165 | $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
166 | 166 | // percent td |
167 | - $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c', '', ' colspan="2"'); |
|
167 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c', '', ' colspan="2"'); |
|
168 | 168 | // total td |
169 | 169 | $html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r'); |
170 | 170 | // end of row |
@@ -22,30 +22,30 @@ |
||
22 | 22 | |
23 | 23 | interface JobHandlerInterface |
24 | 24 | { |
25 | - /** |
|
26 | - * Performs any necessary setup for starting the job. This is also a good |
|
27 | - * place to setup the $job_arguments which will be used for subsequent HTTP requests |
|
28 | - * when continue_job will be called |
|
29 | - * @param JobParameters $job_parameters |
|
30 | - * @throws BatchRequestException |
|
31 | - * @return JobStepResponse |
|
32 | - */ |
|
33 | - public function create_job(JobParameters $job_parameters); |
|
25 | + /** |
|
26 | + * Performs any necessary setup for starting the job. This is also a good |
|
27 | + * place to setup the $job_arguments which will be used for subsequent HTTP requests |
|
28 | + * when continue_job will be called |
|
29 | + * @param JobParameters $job_parameters |
|
30 | + * @throws BatchRequestException |
|
31 | + * @return JobStepResponse |
|
32 | + */ |
|
33 | + public function create_job(JobParameters $job_parameters); |
|
34 | 34 | |
35 | - /** |
|
36 | - * Performs another step of the job |
|
37 | - * @param JobParameters $job_parameters |
|
38 | - * @param int $batch_size |
|
39 | - * @return JobStepResponse |
|
40 | - * @throws BatchRequestException |
|
41 | - */ |
|
42 | - public function continue_job(JobParameters $job_parameters, $batch_size = 50); |
|
35 | + /** |
|
36 | + * Performs another step of the job |
|
37 | + * @param JobParameters $job_parameters |
|
38 | + * @param int $batch_size |
|
39 | + * @return JobStepResponse |
|
40 | + * @throws BatchRequestException |
|
41 | + */ |
|
42 | + public function continue_job(JobParameters $job_parameters, $batch_size = 50); |
|
43 | 43 | |
44 | - /** |
|
45 | - * Performs any clean-up logic when we know the job is completed |
|
46 | - * @param JobParameters $job_parameters |
|
47 | - * @return JobStepResponse |
|
48 | - * @throws BatchRequestException |
|
49 | - */ |
|
50 | - public function cleanup_job(JobParameters $job_parameters); |
|
44 | + /** |
|
45 | + * Performs any clean-up logic when we know the job is completed |
|
46 | + * @param JobParameters $job_parameters |
|
47 | + * @return JobStepResponse |
|
48 | + * @throws BatchRequestException |
|
49 | + */ |
|
50 | + public function cleanup_job(JobParameters $job_parameters); |
|
51 | 51 | } |
@@ -18,359 +18,359 @@ |
||
18 | 18 | class EE_Request implements LegacyRequestInterface, InterminableInterface |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * @var RequestInterface $request |
|
23 | - */ |
|
24 | - private $request; |
|
25 | - |
|
26 | - /** |
|
27 | - * whether current request is for the admin but NOT via AJAX |
|
28 | - * |
|
29 | - * @var boolean $admin |
|
30 | - */ |
|
31 | - public $admin = false; |
|
32 | - |
|
33 | - /** |
|
34 | - * whether current request is via AJAX |
|
35 | - * |
|
36 | - * @var boolean $ajax |
|
37 | - */ |
|
38 | - public $ajax = false; |
|
39 | - |
|
40 | - /** |
|
41 | - * whether current request is via AJAX from the frontend of the site |
|
42 | - * |
|
43 | - * @var boolean $front_ajax |
|
44 | - */ |
|
45 | - public $front_ajax = false; |
|
46 | - |
|
47 | - |
|
48 | - /** |
|
49 | - * @deprecated 4.9.53 |
|
50 | - * @param array $get |
|
51 | - * @param array $post |
|
52 | - * @param array $cookie |
|
53 | - * @param array $server |
|
54 | - */ |
|
55 | - public function __construct( |
|
56 | - array $get = array(), |
|
57 | - array $post = array(), |
|
58 | - array $cookie = array(), |
|
59 | - array $server = array() |
|
60 | - ) { |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - /** |
|
65 | - * @return RequestInterface |
|
66 | - * @throws InvalidArgumentException |
|
67 | - * @throws InvalidInterfaceException |
|
68 | - * @throws InvalidDataTypeException |
|
69 | - */ |
|
70 | - private function request() |
|
71 | - { |
|
72 | - if ($this->request instanceof RequestInterface) { |
|
73 | - return $this->request; |
|
74 | - } |
|
75 | - $loader = LoaderFactory::getLoader(); |
|
76 | - $this->request = $loader->getShared('EventEspresso\core\services\request\RequestInterface'); |
|
77 | - return $this->request; |
|
78 | - } |
|
79 | - |
|
80 | - |
|
81 | - /** |
|
82 | - * @param RequestInterface $request |
|
83 | - */ |
|
84 | - public function setRequest(RequestInterface $request) |
|
85 | - { |
|
86 | - $this->request = $request; |
|
87 | - } |
|
88 | - |
|
89 | - |
|
90 | - /** |
|
91 | - * @deprecated 4.9.53 |
|
92 | - * @return array |
|
93 | - * @throws InvalidArgumentException |
|
94 | - * @throws InvalidDataTypeException |
|
95 | - * @throws InvalidInterfaceException |
|
96 | - */ |
|
97 | - public function get_params() |
|
98 | - { |
|
99 | - return $this->request()->getParams(); |
|
100 | - } |
|
101 | - |
|
102 | - |
|
103 | - /** |
|
104 | - * @deprecated 4.9.53 |
|
105 | - * @return array |
|
106 | - * @throws InvalidArgumentException |
|
107 | - * @throws InvalidDataTypeException |
|
108 | - * @throws InvalidInterfaceException |
|
109 | - */ |
|
110 | - public function post_params() |
|
111 | - { |
|
112 | - return $this->request()->postParams(); |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - /** |
|
117 | - * @deprecated 4.9.53 |
|
118 | - * @return array |
|
119 | - * @throws InvalidArgumentException |
|
120 | - * @throws InvalidDataTypeException |
|
121 | - * @throws InvalidInterfaceException |
|
122 | - */ |
|
123 | - public function cookie_params() |
|
124 | - { |
|
125 | - return $this->request()->cookieParams(); |
|
126 | - } |
|
127 | - |
|
128 | - |
|
129 | - /** |
|
130 | - * @deprecated 4.9.53 |
|
131 | - * @return array |
|
132 | - * @throws InvalidArgumentException |
|
133 | - * @throws InvalidDataTypeException |
|
134 | - * @throws InvalidInterfaceException |
|
135 | - */ |
|
136 | - public function server_params() |
|
137 | - { |
|
138 | - return $this->request()->serverParams(); |
|
139 | - } |
|
140 | - |
|
141 | - |
|
142 | - /** |
|
143 | - * returns contents of $_REQUEST |
|
144 | - * |
|
145 | - * @deprecated 4.9.53 |
|
146 | - * @return array |
|
147 | - * @throws InvalidArgumentException |
|
148 | - * @throws InvalidDataTypeException |
|
149 | - * @throws InvalidInterfaceException |
|
150 | - */ |
|
151 | - public function params() |
|
152 | - { |
|
153 | - return $this->request()->requestParams(); |
|
154 | - } |
|
155 | - |
|
156 | - |
|
157 | - /** |
|
158 | - * @deprecated 4.9.53 |
|
159 | - * @param $key |
|
160 | - * @param $value |
|
161 | - * @param bool $override_ee |
|
162 | - * @return void |
|
163 | - * @throws InvalidArgumentException |
|
164 | - * @throws InvalidDataTypeException |
|
165 | - * @throws InvalidInterfaceException |
|
166 | - */ |
|
167 | - public function set($key, $value, $override_ee = false) |
|
168 | - { |
|
169 | - $this->request()->setRequestParam($key, $value, $override_ee); |
|
170 | - } |
|
171 | - |
|
172 | - |
|
173 | - /** |
|
174 | - * returns the value for a request param if the given key exists |
|
175 | - * |
|
176 | - * @deprecated 4.9.53 |
|
177 | - * @param $key |
|
178 | - * @param null $default |
|
179 | - * @return mixed |
|
180 | - * @throws InvalidArgumentException |
|
181 | - * @throws InvalidDataTypeException |
|
182 | - * @throws InvalidInterfaceException |
|
183 | - */ |
|
184 | - public function get($key, $default = null) |
|
185 | - { |
|
186 | - return $this->request()->getRequestParam($key, $default); |
|
187 | - } |
|
188 | - |
|
189 | - |
|
190 | - /** |
|
191 | - * check if param exists |
|
192 | - * |
|
193 | - * @deprecated 4.9.53 |
|
194 | - * @param $key |
|
195 | - * @return bool |
|
196 | - * @throws InvalidArgumentException |
|
197 | - * @throws InvalidDataTypeException |
|
198 | - * @throws InvalidInterfaceException |
|
199 | - */ |
|
200 | - public function is_set($key) |
|
201 | - { |
|
202 | - return $this->request()->requestParamIsSet($key); |
|
203 | - } |
|
204 | - |
|
205 | - |
|
206 | - /** |
|
207 | - * remove param |
|
208 | - * |
|
209 | - * @deprecated 4.9.53 |
|
210 | - * @param $key |
|
211 | - * @param bool $unset_from_global_too |
|
212 | - * @throws InvalidArgumentException |
|
213 | - * @throws InvalidDataTypeException |
|
214 | - * @throws InvalidInterfaceException |
|
215 | - */ |
|
216 | - public function un_set($key, $unset_from_global_too = false) |
|
217 | - { |
|
218 | - $this->request()->unSetRequestParam($key, $unset_from_global_too); |
|
219 | - } |
|
220 | - |
|
221 | - |
|
222 | - /** |
|
223 | - * @deprecated 4.9.53 |
|
224 | - * @return string |
|
225 | - * @throws InvalidArgumentException |
|
226 | - * @throws InvalidDataTypeException |
|
227 | - * @throws InvalidInterfaceException |
|
228 | - */ |
|
229 | - public function ip_address() |
|
230 | - { |
|
231 | - return $this->request()->ipAddress(); |
|
232 | - } |
|
233 | - |
|
234 | - |
|
235 | - /** |
|
236 | - * @deprecated 4.9.53 |
|
237 | - * @return bool |
|
238 | - * @throws InvalidArgumentException |
|
239 | - * @throws InvalidDataTypeException |
|
240 | - * @throws InvalidInterfaceException |
|
241 | - */ |
|
242 | - public function isAdmin() |
|
243 | - { |
|
244 | - return $this->request()->isAdmin(); |
|
245 | - } |
|
246 | - |
|
247 | - |
|
248 | - /** |
|
249 | - * @deprecated 4.9.53 |
|
250 | - * @return mixed |
|
251 | - * @throws InvalidArgumentException |
|
252 | - * @throws InvalidDataTypeException |
|
253 | - * @throws InvalidInterfaceException |
|
254 | - */ |
|
255 | - public function isAjax() |
|
256 | - { |
|
257 | - return $this->request()->isAjax(); |
|
258 | - } |
|
259 | - |
|
260 | - |
|
261 | - /** |
|
262 | - * @deprecated 4.9.53 |
|
263 | - * @return mixed |
|
264 | - * @throws InvalidArgumentException |
|
265 | - * @throws InvalidDataTypeException |
|
266 | - * @throws InvalidInterfaceException |
|
267 | - */ |
|
268 | - public function isFrontAjax() |
|
269 | - { |
|
270 | - return $this->request()->isFrontAjax(); |
|
271 | - } |
|
272 | - |
|
273 | - |
|
274 | - /** |
|
275 | - * @deprecated 4.9.53 |
|
276 | - * @return mixed|string |
|
277 | - * @throws InvalidArgumentException |
|
278 | - * @throws InvalidDataTypeException |
|
279 | - * @throws InvalidInterfaceException |
|
280 | - */ |
|
281 | - public function requestUri() |
|
282 | - { |
|
283 | - return $this->request()->requestUri(); |
|
284 | - } |
|
285 | - |
|
286 | - |
|
287 | - /** |
|
288 | - * @deprecated 4.9.53 |
|
289 | - * @return string |
|
290 | - * @throws InvalidArgumentException |
|
291 | - * @throws InvalidDataTypeException |
|
292 | - * @throws InvalidInterfaceException |
|
293 | - */ |
|
294 | - public function userAgent() |
|
295 | - { |
|
296 | - return $this->request()->userAgent(); |
|
297 | - } |
|
298 | - |
|
299 | - |
|
300 | - /** |
|
301 | - * @deprecated 4.9.53 |
|
302 | - * @param string $user_agent |
|
303 | - * @throws InvalidArgumentException |
|
304 | - * @throws InvalidDataTypeException |
|
305 | - * @throws InvalidInterfaceException |
|
306 | - */ |
|
307 | - public function setUserAgent($user_agent = '') |
|
308 | - { |
|
309 | - $this->request()->setUserAgent($user_agent); |
|
310 | - } |
|
311 | - |
|
312 | - |
|
313 | - /** |
|
314 | - * @deprecated 4.9.53 |
|
315 | - * @return bool |
|
316 | - * @throws InvalidArgumentException |
|
317 | - * @throws InvalidDataTypeException |
|
318 | - * @throws InvalidInterfaceException |
|
319 | - */ |
|
320 | - public function isBot() |
|
321 | - { |
|
322 | - return $this->request()->isBot(); |
|
323 | - } |
|
324 | - |
|
325 | - |
|
326 | - /** |
|
327 | - * @deprecated 4.9.53 |
|
328 | - * @param bool $is_bot |
|
329 | - * @throws InvalidArgumentException |
|
330 | - * @throws InvalidDataTypeException |
|
331 | - * @throws InvalidInterfaceException |
|
332 | - */ |
|
333 | - public function setIsBot($is_bot) |
|
334 | - { |
|
335 | - $this->request()->setIsBot($is_bot); |
|
336 | - } |
|
337 | - |
|
338 | - |
|
339 | - /** |
|
340 | - * check if a request parameter exists whose key that matches the supplied wildcard pattern |
|
341 | - * and return the value for the first match found |
|
342 | - * wildcards can be either of the following: |
|
343 | - * ? to represent a single character of any type |
|
344 | - * * to represent one or more characters of any type |
|
345 | - * |
|
346 | - * @param string $pattern |
|
347 | - * @param null|mixed $default |
|
348 | - * @return false|int |
|
349 | - * @throws InvalidArgumentException |
|
350 | - * @throws InvalidInterfaceException |
|
351 | - * @throws InvalidDataTypeException |
|
352 | - */ |
|
353 | - public function getMatch($pattern, $default = null) |
|
354 | - { |
|
355 | - return $this->request()->getMatch($pattern, $default); |
|
356 | - } |
|
357 | - |
|
358 | - |
|
359 | - /** |
|
360 | - * check if a request parameter exists whose key matches the supplied wildcard pattern |
|
361 | - * wildcards can be either of the following: |
|
362 | - * ? to represent a single character of any type |
|
363 | - * * to represent one or more characters of any type |
|
364 | - * returns true if a match is found or false if not |
|
365 | - * |
|
366 | - * @param string $pattern |
|
367 | - * @return false|int |
|
368 | - * @throws InvalidArgumentException |
|
369 | - * @throws InvalidInterfaceException |
|
370 | - * @throws InvalidDataTypeException |
|
371 | - */ |
|
372 | - public function matches($pattern) |
|
373 | - { |
|
374 | - return $this->request()->matches($pattern); |
|
375 | - } |
|
21 | + /** |
|
22 | + * @var RequestInterface $request |
|
23 | + */ |
|
24 | + private $request; |
|
25 | + |
|
26 | + /** |
|
27 | + * whether current request is for the admin but NOT via AJAX |
|
28 | + * |
|
29 | + * @var boolean $admin |
|
30 | + */ |
|
31 | + public $admin = false; |
|
32 | + |
|
33 | + /** |
|
34 | + * whether current request is via AJAX |
|
35 | + * |
|
36 | + * @var boolean $ajax |
|
37 | + */ |
|
38 | + public $ajax = false; |
|
39 | + |
|
40 | + /** |
|
41 | + * whether current request is via AJAX from the frontend of the site |
|
42 | + * |
|
43 | + * @var boolean $front_ajax |
|
44 | + */ |
|
45 | + public $front_ajax = false; |
|
46 | + |
|
47 | + |
|
48 | + /** |
|
49 | + * @deprecated 4.9.53 |
|
50 | + * @param array $get |
|
51 | + * @param array $post |
|
52 | + * @param array $cookie |
|
53 | + * @param array $server |
|
54 | + */ |
|
55 | + public function __construct( |
|
56 | + array $get = array(), |
|
57 | + array $post = array(), |
|
58 | + array $cookie = array(), |
|
59 | + array $server = array() |
|
60 | + ) { |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + /** |
|
65 | + * @return RequestInterface |
|
66 | + * @throws InvalidArgumentException |
|
67 | + * @throws InvalidInterfaceException |
|
68 | + * @throws InvalidDataTypeException |
|
69 | + */ |
|
70 | + private function request() |
|
71 | + { |
|
72 | + if ($this->request instanceof RequestInterface) { |
|
73 | + return $this->request; |
|
74 | + } |
|
75 | + $loader = LoaderFactory::getLoader(); |
|
76 | + $this->request = $loader->getShared('EventEspresso\core\services\request\RequestInterface'); |
|
77 | + return $this->request; |
|
78 | + } |
|
79 | + |
|
80 | + |
|
81 | + /** |
|
82 | + * @param RequestInterface $request |
|
83 | + */ |
|
84 | + public function setRequest(RequestInterface $request) |
|
85 | + { |
|
86 | + $this->request = $request; |
|
87 | + } |
|
88 | + |
|
89 | + |
|
90 | + /** |
|
91 | + * @deprecated 4.9.53 |
|
92 | + * @return array |
|
93 | + * @throws InvalidArgumentException |
|
94 | + * @throws InvalidDataTypeException |
|
95 | + * @throws InvalidInterfaceException |
|
96 | + */ |
|
97 | + public function get_params() |
|
98 | + { |
|
99 | + return $this->request()->getParams(); |
|
100 | + } |
|
101 | + |
|
102 | + |
|
103 | + /** |
|
104 | + * @deprecated 4.9.53 |
|
105 | + * @return array |
|
106 | + * @throws InvalidArgumentException |
|
107 | + * @throws InvalidDataTypeException |
|
108 | + * @throws InvalidInterfaceException |
|
109 | + */ |
|
110 | + public function post_params() |
|
111 | + { |
|
112 | + return $this->request()->postParams(); |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + /** |
|
117 | + * @deprecated 4.9.53 |
|
118 | + * @return array |
|
119 | + * @throws InvalidArgumentException |
|
120 | + * @throws InvalidDataTypeException |
|
121 | + * @throws InvalidInterfaceException |
|
122 | + */ |
|
123 | + public function cookie_params() |
|
124 | + { |
|
125 | + return $this->request()->cookieParams(); |
|
126 | + } |
|
127 | + |
|
128 | + |
|
129 | + /** |
|
130 | + * @deprecated 4.9.53 |
|
131 | + * @return array |
|
132 | + * @throws InvalidArgumentException |
|
133 | + * @throws InvalidDataTypeException |
|
134 | + * @throws InvalidInterfaceException |
|
135 | + */ |
|
136 | + public function server_params() |
|
137 | + { |
|
138 | + return $this->request()->serverParams(); |
|
139 | + } |
|
140 | + |
|
141 | + |
|
142 | + /** |
|
143 | + * returns contents of $_REQUEST |
|
144 | + * |
|
145 | + * @deprecated 4.9.53 |
|
146 | + * @return array |
|
147 | + * @throws InvalidArgumentException |
|
148 | + * @throws InvalidDataTypeException |
|
149 | + * @throws InvalidInterfaceException |
|
150 | + */ |
|
151 | + public function params() |
|
152 | + { |
|
153 | + return $this->request()->requestParams(); |
|
154 | + } |
|
155 | + |
|
156 | + |
|
157 | + /** |
|
158 | + * @deprecated 4.9.53 |
|
159 | + * @param $key |
|
160 | + * @param $value |
|
161 | + * @param bool $override_ee |
|
162 | + * @return void |
|
163 | + * @throws InvalidArgumentException |
|
164 | + * @throws InvalidDataTypeException |
|
165 | + * @throws InvalidInterfaceException |
|
166 | + */ |
|
167 | + public function set($key, $value, $override_ee = false) |
|
168 | + { |
|
169 | + $this->request()->setRequestParam($key, $value, $override_ee); |
|
170 | + } |
|
171 | + |
|
172 | + |
|
173 | + /** |
|
174 | + * returns the value for a request param if the given key exists |
|
175 | + * |
|
176 | + * @deprecated 4.9.53 |
|
177 | + * @param $key |
|
178 | + * @param null $default |
|
179 | + * @return mixed |
|
180 | + * @throws InvalidArgumentException |
|
181 | + * @throws InvalidDataTypeException |
|
182 | + * @throws InvalidInterfaceException |
|
183 | + */ |
|
184 | + public function get($key, $default = null) |
|
185 | + { |
|
186 | + return $this->request()->getRequestParam($key, $default); |
|
187 | + } |
|
188 | + |
|
189 | + |
|
190 | + /** |
|
191 | + * check if param exists |
|
192 | + * |
|
193 | + * @deprecated 4.9.53 |
|
194 | + * @param $key |
|
195 | + * @return bool |
|
196 | + * @throws InvalidArgumentException |
|
197 | + * @throws InvalidDataTypeException |
|
198 | + * @throws InvalidInterfaceException |
|
199 | + */ |
|
200 | + public function is_set($key) |
|
201 | + { |
|
202 | + return $this->request()->requestParamIsSet($key); |
|
203 | + } |
|
204 | + |
|
205 | + |
|
206 | + /** |
|
207 | + * remove param |
|
208 | + * |
|
209 | + * @deprecated 4.9.53 |
|
210 | + * @param $key |
|
211 | + * @param bool $unset_from_global_too |
|
212 | + * @throws InvalidArgumentException |
|
213 | + * @throws InvalidDataTypeException |
|
214 | + * @throws InvalidInterfaceException |
|
215 | + */ |
|
216 | + public function un_set($key, $unset_from_global_too = false) |
|
217 | + { |
|
218 | + $this->request()->unSetRequestParam($key, $unset_from_global_too); |
|
219 | + } |
|
220 | + |
|
221 | + |
|
222 | + /** |
|
223 | + * @deprecated 4.9.53 |
|
224 | + * @return string |
|
225 | + * @throws InvalidArgumentException |
|
226 | + * @throws InvalidDataTypeException |
|
227 | + * @throws InvalidInterfaceException |
|
228 | + */ |
|
229 | + public function ip_address() |
|
230 | + { |
|
231 | + return $this->request()->ipAddress(); |
|
232 | + } |
|
233 | + |
|
234 | + |
|
235 | + /** |
|
236 | + * @deprecated 4.9.53 |
|
237 | + * @return bool |
|
238 | + * @throws InvalidArgumentException |
|
239 | + * @throws InvalidDataTypeException |
|
240 | + * @throws InvalidInterfaceException |
|
241 | + */ |
|
242 | + public function isAdmin() |
|
243 | + { |
|
244 | + return $this->request()->isAdmin(); |
|
245 | + } |
|
246 | + |
|
247 | + |
|
248 | + /** |
|
249 | + * @deprecated 4.9.53 |
|
250 | + * @return mixed |
|
251 | + * @throws InvalidArgumentException |
|
252 | + * @throws InvalidDataTypeException |
|
253 | + * @throws InvalidInterfaceException |
|
254 | + */ |
|
255 | + public function isAjax() |
|
256 | + { |
|
257 | + return $this->request()->isAjax(); |
|
258 | + } |
|
259 | + |
|
260 | + |
|
261 | + /** |
|
262 | + * @deprecated 4.9.53 |
|
263 | + * @return mixed |
|
264 | + * @throws InvalidArgumentException |
|
265 | + * @throws InvalidDataTypeException |
|
266 | + * @throws InvalidInterfaceException |
|
267 | + */ |
|
268 | + public function isFrontAjax() |
|
269 | + { |
|
270 | + return $this->request()->isFrontAjax(); |
|
271 | + } |
|
272 | + |
|
273 | + |
|
274 | + /** |
|
275 | + * @deprecated 4.9.53 |
|
276 | + * @return mixed|string |
|
277 | + * @throws InvalidArgumentException |
|
278 | + * @throws InvalidDataTypeException |
|
279 | + * @throws InvalidInterfaceException |
|
280 | + */ |
|
281 | + public function requestUri() |
|
282 | + { |
|
283 | + return $this->request()->requestUri(); |
|
284 | + } |
|
285 | + |
|
286 | + |
|
287 | + /** |
|
288 | + * @deprecated 4.9.53 |
|
289 | + * @return string |
|
290 | + * @throws InvalidArgumentException |
|
291 | + * @throws InvalidDataTypeException |
|
292 | + * @throws InvalidInterfaceException |
|
293 | + */ |
|
294 | + public function userAgent() |
|
295 | + { |
|
296 | + return $this->request()->userAgent(); |
|
297 | + } |
|
298 | + |
|
299 | + |
|
300 | + /** |
|
301 | + * @deprecated 4.9.53 |
|
302 | + * @param string $user_agent |
|
303 | + * @throws InvalidArgumentException |
|
304 | + * @throws InvalidDataTypeException |
|
305 | + * @throws InvalidInterfaceException |
|
306 | + */ |
|
307 | + public function setUserAgent($user_agent = '') |
|
308 | + { |
|
309 | + $this->request()->setUserAgent($user_agent); |
|
310 | + } |
|
311 | + |
|
312 | + |
|
313 | + /** |
|
314 | + * @deprecated 4.9.53 |
|
315 | + * @return bool |
|
316 | + * @throws InvalidArgumentException |
|
317 | + * @throws InvalidDataTypeException |
|
318 | + * @throws InvalidInterfaceException |
|
319 | + */ |
|
320 | + public function isBot() |
|
321 | + { |
|
322 | + return $this->request()->isBot(); |
|
323 | + } |
|
324 | + |
|
325 | + |
|
326 | + /** |
|
327 | + * @deprecated 4.9.53 |
|
328 | + * @param bool $is_bot |
|
329 | + * @throws InvalidArgumentException |
|
330 | + * @throws InvalidDataTypeException |
|
331 | + * @throws InvalidInterfaceException |
|
332 | + */ |
|
333 | + public function setIsBot($is_bot) |
|
334 | + { |
|
335 | + $this->request()->setIsBot($is_bot); |
|
336 | + } |
|
337 | + |
|
338 | + |
|
339 | + /** |
|
340 | + * check if a request parameter exists whose key that matches the supplied wildcard pattern |
|
341 | + * and return the value for the first match found |
|
342 | + * wildcards can be either of the following: |
|
343 | + * ? to represent a single character of any type |
|
344 | + * * to represent one or more characters of any type |
|
345 | + * |
|
346 | + * @param string $pattern |
|
347 | + * @param null|mixed $default |
|
348 | + * @return false|int |
|
349 | + * @throws InvalidArgumentException |
|
350 | + * @throws InvalidInterfaceException |
|
351 | + * @throws InvalidDataTypeException |
|
352 | + */ |
|
353 | + public function getMatch($pattern, $default = null) |
|
354 | + { |
|
355 | + return $this->request()->getMatch($pattern, $default); |
|
356 | + } |
|
357 | + |
|
358 | + |
|
359 | + /** |
|
360 | + * check if a request parameter exists whose key matches the supplied wildcard pattern |
|
361 | + * wildcards can be either of the following: |
|
362 | + * ? to represent a single character of any type |
|
363 | + * * to represent one or more characters of any type |
|
364 | + * returns true if a match is found or false if not |
|
365 | + * |
|
366 | + * @param string $pattern |
|
367 | + * @return false|int |
|
368 | + * @throws InvalidArgumentException |
|
369 | + * @throws InvalidInterfaceException |
|
370 | + * @throws InvalidDataTypeException |
|
371 | + */ |
|
372 | + public function matches($pattern) |
|
373 | + { |
|
374 | + return $this->request()->matches($pattern); |
|
375 | + } |
|
376 | 376 | } |
@@ -13,146 +13,146 @@ |
||
13 | 13 | class EE_Response |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @access protected |
|
18 | - * @type array $_notice |
|
19 | - */ |
|
20 | - protected $_notice = array(); |
|
21 | - |
|
22 | - /** |
|
23 | - * rendered output to be returned to WP |
|
24 | - * |
|
25 | - * @access protected |
|
26 | - * @type string |
|
27 | - */ |
|
28 | - protected $_output = ''; |
|
29 | - |
|
30 | - /** |
|
31 | - * @access protected |
|
32 | - * @type bool |
|
33 | - */ |
|
34 | - protected $request_terminated = false; |
|
35 | - |
|
36 | - /** |
|
37 | - * @access protected |
|
38 | - * @type bool |
|
39 | - */ |
|
40 | - protected $deactivate_plugin = false; |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * @deprecated 4.9.53 |
|
45 | - * @return \EE_Response |
|
46 | - */ |
|
47 | - public function __construct() |
|
48 | - { |
|
49 | - $this->terminate_request(false); |
|
50 | - EE_Error::doing_it_wrong( |
|
51 | - __METHOD__, |
|
52 | - sprintf( |
|
53 | - esc_html__( |
|
54 | - 'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
55 | - 'event_espresso' |
|
56 | - ), |
|
57 | - 'EventEspresso\core\services\request\Response', |
|
58 | - '\core\services\request', |
|
59 | - 'EventEspresso\core\services\request' |
|
60 | - ), |
|
61 | - '4.9.53' |
|
62 | - ); |
|
63 | - } |
|
64 | - |
|
65 | - |
|
66 | - /** |
|
67 | - * @deprecated 4.9.53 |
|
68 | - * @param $key |
|
69 | - * @param $value |
|
70 | - * @return void |
|
71 | - */ |
|
72 | - public function set_notice($key, $value) |
|
73 | - { |
|
74 | - $this->_notice[ $key ] = $value; |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - /** |
|
79 | - * @deprecated 4.9.53 |
|
80 | - * @param $key |
|
81 | - * @return mixed |
|
82 | - */ |
|
83 | - public function get_notice($key) |
|
84 | - { |
|
85 | - return isset($this->_notice[ $key ]) ? $this->_notice[ $key ] : null; |
|
86 | - } |
|
87 | - |
|
88 | - |
|
89 | - /** |
|
90 | - * @deprecated 4.9.53 |
|
91 | - * @return array |
|
92 | - */ |
|
93 | - public function get_notices() |
|
94 | - { |
|
95 | - return $this->_notice; |
|
96 | - } |
|
97 | - |
|
98 | - |
|
99 | - /** |
|
100 | - * @deprecated 4.9.53 |
|
101 | - * @param $string |
|
102 | - * @param bool $append |
|
103 | - */ |
|
104 | - public function add_output($string, $append = true) |
|
105 | - { |
|
106 | - $this->_output = $append ? $this->_output . $string : $string . $this->_output; |
|
107 | - } |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * @deprecated 4.9.53 |
|
112 | - * @return string |
|
113 | - */ |
|
114 | - public function get_output() |
|
115 | - { |
|
116 | - return $this->_output; |
|
117 | - } |
|
118 | - |
|
119 | - |
|
120 | - /** |
|
121 | - * @deprecated 4.9.53 |
|
122 | - * @return boolean |
|
123 | - */ |
|
124 | - public function request_terminated() |
|
125 | - { |
|
126 | - return $this->request_terminated; |
|
127 | - } |
|
128 | - |
|
129 | - |
|
130 | - /** |
|
131 | - * @deprecated 4.9.53 |
|
132 | - * @param boolean $request_terminated |
|
133 | - */ |
|
134 | - public function terminate_request($request_terminated = true) |
|
135 | - { |
|
136 | - $this->request_terminated = filter_var($request_terminated, FILTER_VALIDATE_BOOLEAN); |
|
137 | - } |
|
138 | - |
|
139 | - |
|
140 | - /** |
|
141 | - * @deprecated 4.9.53 |
|
142 | - * @return boolean |
|
143 | - */ |
|
144 | - public function plugin_deactivated() |
|
145 | - { |
|
146 | - return $this->deactivate_plugin; |
|
147 | - } |
|
148 | - |
|
149 | - |
|
150 | - /** |
|
151 | - * @deprecated 4.9.53 |
|
152 | - * sets $deactivate_plugin to true |
|
153 | - */ |
|
154 | - public function deactivate_plugin() |
|
155 | - { |
|
156 | - $this->deactivate_plugin = true; |
|
157 | - } |
|
16 | + /** |
|
17 | + * @access protected |
|
18 | + * @type array $_notice |
|
19 | + */ |
|
20 | + protected $_notice = array(); |
|
21 | + |
|
22 | + /** |
|
23 | + * rendered output to be returned to WP |
|
24 | + * |
|
25 | + * @access protected |
|
26 | + * @type string |
|
27 | + */ |
|
28 | + protected $_output = ''; |
|
29 | + |
|
30 | + /** |
|
31 | + * @access protected |
|
32 | + * @type bool |
|
33 | + */ |
|
34 | + protected $request_terminated = false; |
|
35 | + |
|
36 | + /** |
|
37 | + * @access protected |
|
38 | + * @type bool |
|
39 | + */ |
|
40 | + protected $deactivate_plugin = false; |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * @deprecated 4.9.53 |
|
45 | + * @return \EE_Response |
|
46 | + */ |
|
47 | + public function __construct() |
|
48 | + { |
|
49 | + $this->terminate_request(false); |
|
50 | + EE_Error::doing_it_wrong( |
|
51 | + __METHOD__, |
|
52 | + sprintf( |
|
53 | + esc_html__( |
|
54 | + 'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
55 | + 'event_espresso' |
|
56 | + ), |
|
57 | + 'EventEspresso\core\services\request\Response', |
|
58 | + '\core\services\request', |
|
59 | + 'EventEspresso\core\services\request' |
|
60 | + ), |
|
61 | + '4.9.53' |
|
62 | + ); |
|
63 | + } |
|
64 | + |
|
65 | + |
|
66 | + /** |
|
67 | + * @deprecated 4.9.53 |
|
68 | + * @param $key |
|
69 | + * @param $value |
|
70 | + * @return void |
|
71 | + */ |
|
72 | + public function set_notice($key, $value) |
|
73 | + { |
|
74 | + $this->_notice[ $key ] = $value; |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + /** |
|
79 | + * @deprecated 4.9.53 |
|
80 | + * @param $key |
|
81 | + * @return mixed |
|
82 | + */ |
|
83 | + public function get_notice($key) |
|
84 | + { |
|
85 | + return isset($this->_notice[ $key ]) ? $this->_notice[ $key ] : null; |
|
86 | + } |
|
87 | + |
|
88 | + |
|
89 | + /** |
|
90 | + * @deprecated 4.9.53 |
|
91 | + * @return array |
|
92 | + */ |
|
93 | + public function get_notices() |
|
94 | + { |
|
95 | + return $this->_notice; |
|
96 | + } |
|
97 | + |
|
98 | + |
|
99 | + /** |
|
100 | + * @deprecated 4.9.53 |
|
101 | + * @param $string |
|
102 | + * @param bool $append |
|
103 | + */ |
|
104 | + public function add_output($string, $append = true) |
|
105 | + { |
|
106 | + $this->_output = $append ? $this->_output . $string : $string . $this->_output; |
|
107 | + } |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * @deprecated 4.9.53 |
|
112 | + * @return string |
|
113 | + */ |
|
114 | + public function get_output() |
|
115 | + { |
|
116 | + return $this->_output; |
|
117 | + } |
|
118 | + |
|
119 | + |
|
120 | + /** |
|
121 | + * @deprecated 4.9.53 |
|
122 | + * @return boolean |
|
123 | + */ |
|
124 | + public function request_terminated() |
|
125 | + { |
|
126 | + return $this->request_terminated; |
|
127 | + } |
|
128 | + |
|
129 | + |
|
130 | + /** |
|
131 | + * @deprecated 4.9.53 |
|
132 | + * @param boolean $request_terminated |
|
133 | + */ |
|
134 | + public function terminate_request($request_terminated = true) |
|
135 | + { |
|
136 | + $this->request_terminated = filter_var($request_terminated, FILTER_VALIDATE_BOOLEAN); |
|
137 | + } |
|
138 | + |
|
139 | + |
|
140 | + /** |
|
141 | + * @deprecated 4.9.53 |
|
142 | + * @return boolean |
|
143 | + */ |
|
144 | + public function plugin_deactivated() |
|
145 | + { |
|
146 | + return $this->deactivate_plugin; |
|
147 | + } |
|
148 | + |
|
149 | + |
|
150 | + /** |
|
151 | + * @deprecated 4.9.53 |
|
152 | + * sets $deactivate_plugin to true |
|
153 | + */ |
|
154 | + public function deactivate_plugin() |
|
155 | + { |
|
156 | + $this->deactivate_plugin = true; |
|
157 | + } |
|
158 | 158 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function set_notice($key, $value) |
73 | 73 | { |
74 | - $this->_notice[ $key ] = $value; |
|
74 | + $this->_notice[$key] = $value; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function get_notice($key) |
84 | 84 | { |
85 | - return isset($this->_notice[ $key ]) ? $this->_notice[ $key ] : null; |
|
85 | + return isset($this->_notice[$key]) ? $this->_notice[$key] : null; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function add_output($string, $append = true) |
105 | 105 | { |
106 | - $this->_output = $append ? $this->_output . $string : $string . $this->_output; |
|
106 | + $this->_output = $append ? $this->_output.$string : $string.$this->_output; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 |
@@ -13,46 +13,46 @@ |
||
13 | 13 | class EE_Request_Stack_Builder |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * EE_Request_Stack_Builder |
|
18 | - */ |
|
19 | - public function __construct() |
|
20 | - { |
|
21 | - EE_Error::doing_it_wrong( |
|
22 | - __METHOD__, |
|
23 | - sprintf( |
|
24 | - esc_html__( |
|
25 | - 'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
26 | - 'event_espresso' |
|
27 | - ), |
|
28 | - 'EventEspresso\core\services\request\RequestStackBuilder', |
|
29 | - '\core\services\request', |
|
30 | - 'EventEspresso\core\services\request' |
|
31 | - ), |
|
32 | - '4.9.53' |
|
33 | - ); |
|
34 | - } |
|
16 | + /** |
|
17 | + * EE_Request_Stack_Builder |
|
18 | + */ |
|
19 | + public function __construct() |
|
20 | + { |
|
21 | + EE_Error::doing_it_wrong( |
|
22 | + __METHOD__, |
|
23 | + sprintf( |
|
24 | + esc_html__( |
|
25 | + 'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
26 | + 'event_espresso' |
|
27 | + ), |
|
28 | + 'EventEspresso\core\services\request\RequestStackBuilder', |
|
29 | + '\core\services\request', |
|
30 | + 'EventEspresso\core\services\request' |
|
31 | + ), |
|
32 | + '4.9.53' |
|
33 | + ); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * @deprecated 4.9.53 |
|
38 | - */ |
|
39 | - public function unshift() |
|
40 | - { |
|
41 | - } |
|
36 | + /** |
|
37 | + * @deprecated 4.9.53 |
|
38 | + */ |
|
39 | + public function unshift() |
|
40 | + { |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | - /** |
|
45 | - * @deprecated 4.9.53 |
|
46 | - */ |
|
47 | - public function push() |
|
48 | - { |
|
49 | - } |
|
44 | + /** |
|
45 | + * @deprecated 4.9.53 |
|
46 | + */ |
|
47 | + public function push() |
|
48 | + { |
|
49 | + } |
|
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * @deprecated 4.9.53 |
|
54 | - */ |
|
55 | - public function resolve(EEI_Request_Decorator $application) |
|
56 | - { |
|
57 | - } |
|
52 | + /** |
|
53 | + * @deprecated 4.9.53 |
|
54 | + */ |
|
55 | + public function resolve(EEI_Request_Decorator $application) |
|
56 | + { |
|
57 | + } |
|
58 | 58 | } |
@@ -13,25 +13,25 @@ |
||
13 | 13 | { |
14 | 14 | |
15 | 15 | |
16 | - /** |
|
17 | - * @deprecated 4.9.53 |
|
18 | - * @param EEI_Request_Decorator $application |
|
19 | - * @param array $middlewares |
|
20 | - */ |
|
21 | - public function __construct(EEI_Request_Decorator $application, $middlewares = array()) |
|
22 | - { |
|
23 | - EE_Error::doing_it_wrong( |
|
24 | - __METHOD__, |
|
25 | - sprintf( |
|
26 | - esc_html__( |
|
27 | - 'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
28 | - 'event_espresso' |
|
29 | - ), |
|
30 | - 'EventEspresso\core\services\request\RequestStack', |
|
31 | - '\core\services\request', |
|
32 | - 'EventEspresso\core\services\request' |
|
33 | - ), |
|
34 | - '4.9.53' |
|
35 | - ); |
|
36 | - } |
|
16 | + /** |
|
17 | + * @deprecated 4.9.53 |
|
18 | + * @param EEI_Request_Decorator $application |
|
19 | + * @param array $middlewares |
|
20 | + */ |
|
21 | + public function __construct(EEI_Request_Decorator $application, $middlewares = array()) |
|
22 | + { |
|
23 | + EE_Error::doing_it_wrong( |
|
24 | + __METHOD__, |
|
25 | + sprintf( |
|
26 | + esc_html__( |
|
27 | + 'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
28 | + 'event_espresso' |
|
29 | + ), |
|
30 | + 'EventEspresso\core\services\request\RequestStack', |
|
31 | + '\core\services\request', |
|
32 | + 'EventEspresso\core\services\request' |
|
33 | + ), |
|
34 | + '4.9.53' |
|
35 | + ); |
|
36 | + } |
|
37 | 37 | } |
@@ -12,184 +12,184 @@ |
||
12 | 12 | abstract class EES_Shortcode extends EE_Base |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * @protected public |
|
17 | - * @var array $_attributes |
|
18 | - */ |
|
19 | - protected $_attributes = array(); |
|
20 | - |
|
21 | - |
|
22 | - |
|
23 | - /** |
|
24 | - * class constructor - should ONLY be instantiated by EE_Front_Controller |
|
25 | - */ |
|
26 | - final public function __construct() |
|
27 | - { |
|
28 | - $shortcode = LegacyShortcodesManager::generateShortcodeTagFromClassName(get_class($this)); |
|
29 | - // assign shortcode to the preferred callback, which overwrites the "fallback shortcode processor" assigned earlier |
|
30 | - add_shortcode($shortcode, array($this, 'process_shortcode')); |
|
31 | - // make sure system knows this is an EE page |
|
32 | - EE_Registry::instance()->REQ->set_espresso_page(true); |
|
33 | - } |
|
34 | - |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * run - initial shortcode module setup called during "parse_request" hook by |
|
39 | - * \EE_Front_Controller::_initialize_shortcodes() IF this shortcode is going to execute during this request ! |
|
40 | - * It may also get called by \EES_Shortcode::fallback_shortcode_processor() if the shortcode is being implemented |
|
41 | - * by a theme or plugin in a non-standard way. |
|
42 | - * Basically this method is primarily used for loading resources and assets like CSS or JS |
|
43 | - * that will be required by the shortcode when it is actually processed. |
|
44 | - * Please note that assets may not load if the fallback_shortcode_processor() is being used. |
|
45 | - * |
|
46 | - * @access public |
|
47 | - * @param WP $WP |
|
48 | - * @return void |
|
49 | - */ |
|
50 | - abstract public function run(WP $WP); |
|
51 | - |
|
52 | - |
|
53 | - |
|
54 | - /** |
|
55 | - * process_shortcode |
|
56 | - * this method is the callback function for the actual shortcode, and is what runs when WP encounters the shortcode within the_content |
|
57 | - * |
|
58 | - * @access public |
|
59 | - * @param array $attributes |
|
60 | - * @return mixed |
|
61 | - */ |
|
62 | - abstract public function process_shortcode($attributes = array()); |
|
63 | - |
|
64 | - |
|
65 | - |
|
66 | - /** |
|
67 | - * instance - returns instance of child class object |
|
68 | - * |
|
69 | - * @access public |
|
70 | - * @param string $shortcode_class |
|
71 | - * @return \EES_Shortcode |
|
72 | - */ |
|
73 | - final public static function instance($shortcode_class = null) |
|
74 | - { |
|
75 | - $shortcode_class = ! empty($shortcode_class) ? $shortcode_class : get_called_class(); |
|
76 | - if ($shortcode_class === 'EES_Shortcode' || empty($shortcode_class)) { |
|
77 | - return null; |
|
78 | - } |
|
79 | - $shortcode = str_replace('EES_', '', strtoupper($shortcode_class)); |
|
80 | - $shortcode_obj = isset(EE_Registry::instance()->shortcodes->{$shortcode}) |
|
81 | - ? EE_Registry::instance()->shortcodes->{$shortcode} |
|
82 | - : null; |
|
83 | - return $shortcode_obj instanceof $shortcode_class || $shortcode_class === 'self' |
|
84 | - ? $shortcode_obj |
|
85 | - : new $shortcode_class(); |
|
86 | - } |
|
87 | - |
|
88 | - |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * fallback_shortcode_processor - create instance and call process_shortcode |
|
93 | - * NOTE: shortcode may not function perfectly dues to missing assets, but it's better than not having things work at all |
|
94 | - * |
|
95 | - * @access public |
|
96 | - * @param $attributes |
|
97 | - * @return mixed |
|
98 | - */ |
|
99 | - final public static function fallback_shortcode_processor($attributes) |
|
100 | - { |
|
101 | - if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
102 | - return null; |
|
103 | - } |
|
104 | - // what shortcode was actually parsed ? |
|
105 | - $shortcode_class = get_called_class(); |
|
106 | - // notify rest of system that fallback processor was triggered |
|
107 | - add_filter('FHEE__fallback_shortcode_processor__' . $shortcode_class, '__return_true'); |
|
108 | - // get instance of actual shortcode |
|
109 | - $shortcode_obj = self::instance($shortcode_class); |
|
110 | - // verify class |
|
111 | - if ($shortcode_obj instanceof EES_Shortcode) { |
|
112 | - global $wp; |
|
113 | - $shortcode_obj->run($wp); |
|
114 | - // set attributes and run the shortcode |
|
115 | - $shortcode_obj->_attributes = (array) $attributes; |
|
116 | - return $shortcode_obj->process_shortcode($shortcode_obj->_attributes); |
|
117 | - } else { |
|
118 | - return null; |
|
119 | - } |
|
120 | - } |
|
121 | - |
|
122 | - |
|
123 | - |
|
124 | - |
|
125 | - /** |
|
126 | - * invalid_shortcode_processor - used in cases where we know the shortcode is invalid, most likely due to a deactivated addon, and simply returns an empty string |
|
127 | - * |
|
128 | - * @access public |
|
129 | - * @param $attributes |
|
130 | - * @return string |
|
131 | - */ |
|
132 | - final public static function invalid_shortcode_processor($attributes) |
|
133 | - { |
|
134 | - return ''; |
|
135 | - } |
|
136 | - |
|
137 | - |
|
138 | - |
|
139 | - |
|
140 | - |
|
141 | - /** |
|
142 | - * Performs basic sanitization on shortcode attributes |
|
143 | - * Since incoming attributes from the shortcode usage in the WP editor will all be strings, |
|
144 | - * most attributes will by default be sanitized using the sanitize_text_field() function. |
|
145 | - * This can be overridden by supplying an array for the $custom_sanitization param, |
|
146 | - * where keys match keys in your attributes array, |
|
147 | - * and values represent the sanitization function you wish to be applied to that attribute. |
|
148 | - * So for example, if you had an integer attribute named "event_id" |
|
149 | - * that you wanted to be sanitized using absint(), |
|
150 | - * then you would pass the following for your $custom_sanitization array: |
|
151 | - * array('event_id' => 'absint') |
|
152 | - * all other attributes would be sanitized using the defaults in the switch statement below |
|
153 | - * |
|
154 | - * @param array $attributes |
|
155 | - * @param array $custom_sanitization |
|
156 | - * @return array |
|
157 | - */ |
|
158 | - public static function sanitize_attributes(array $attributes, $custom_sanitization = array()) |
|
159 | - { |
|
160 | - foreach ($attributes as $key => $value) { |
|
161 | - // is a custom sanitization callback specified ? |
|
162 | - if (isset($custom_sanitization[ $key ])) { |
|
163 | - $callback = $custom_sanitization[ $key ]; |
|
164 | - if ($callback === 'skip_sanitization') { |
|
165 | - $attributes[ $key ] = $value; |
|
166 | - continue; |
|
167 | - } elseif (function_exists($callback)) { |
|
168 | - $attributes[ $key ] = $callback($value); |
|
169 | - continue; |
|
170 | - } |
|
171 | - } |
|
172 | - switch (true) { |
|
173 | - case $value === null: |
|
174 | - case is_int($value): |
|
175 | - case is_float($value): |
|
176 | - // typical booleans |
|
177 | - case in_array($value, array(true, 'true', '1', 'on', 'yes', false, 'false', '0', 'off', 'no'), true): |
|
178 | - $attributes[ $key ] = $value; |
|
179 | - break; |
|
180 | - case is_string($value): |
|
181 | - $attributes[ $key ] = sanitize_text_field($value); |
|
182 | - break; |
|
183 | - case is_array($value): |
|
184 | - $attributes[ $key ] = \EES_Shortcode::sanitize_attributes($value); |
|
185 | - break; |
|
186 | - default: |
|
187 | - // only remaining data types are Object and Resource |
|
188 | - // which are not allowed as shortcode attributes |
|
189 | - $attributes[ $key ] = null; |
|
190 | - break; |
|
191 | - } |
|
192 | - } |
|
193 | - return $attributes; |
|
194 | - } |
|
15 | + /** |
|
16 | + * @protected public |
|
17 | + * @var array $_attributes |
|
18 | + */ |
|
19 | + protected $_attributes = array(); |
|
20 | + |
|
21 | + |
|
22 | + |
|
23 | + /** |
|
24 | + * class constructor - should ONLY be instantiated by EE_Front_Controller |
|
25 | + */ |
|
26 | + final public function __construct() |
|
27 | + { |
|
28 | + $shortcode = LegacyShortcodesManager::generateShortcodeTagFromClassName(get_class($this)); |
|
29 | + // assign shortcode to the preferred callback, which overwrites the "fallback shortcode processor" assigned earlier |
|
30 | + add_shortcode($shortcode, array($this, 'process_shortcode')); |
|
31 | + // make sure system knows this is an EE page |
|
32 | + EE_Registry::instance()->REQ->set_espresso_page(true); |
|
33 | + } |
|
34 | + |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * run - initial shortcode module setup called during "parse_request" hook by |
|
39 | + * \EE_Front_Controller::_initialize_shortcodes() IF this shortcode is going to execute during this request ! |
|
40 | + * It may also get called by \EES_Shortcode::fallback_shortcode_processor() if the shortcode is being implemented |
|
41 | + * by a theme or plugin in a non-standard way. |
|
42 | + * Basically this method is primarily used for loading resources and assets like CSS or JS |
|
43 | + * that will be required by the shortcode when it is actually processed. |
|
44 | + * Please note that assets may not load if the fallback_shortcode_processor() is being used. |
|
45 | + * |
|
46 | + * @access public |
|
47 | + * @param WP $WP |
|
48 | + * @return void |
|
49 | + */ |
|
50 | + abstract public function run(WP $WP); |
|
51 | + |
|
52 | + |
|
53 | + |
|
54 | + /** |
|
55 | + * process_shortcode |
|
56 | + * this method is the callback function for the actual shortcode, and is what runs when WP encounters the shortcode within the_content |
|
57 | + * |
|
58 | + * @access public |
|
59 | + * @param array $attributes |
|
60 | + * @return mixed |
|
61 | + */ |
|
62 | + abstract public function process_shortcode($attributes = array()); |
|
63 | + |
|
64 | + |
|
65 | + |
|
66 | + /** |
|
67 | + * instance - returns instance of child class object |
|
68 | + * |
|
69 | + * @access public |
|
70 | + * @param string $shortcode_class |
|
71 | + * @return \EES_Shortcode |
|
72 | + */ |
|
73 | + final public static function instance($shortcode_class = null) |
|
74 | + { |
|
75 | + $shortcode_class = ! empty($shortcode_class) ? $shortcode_class : get_called_class(); |
|
76 | + if ($shortcode_class === 'EES_Shortcode' || empty($shortcode_class)) { |
|
77 | + return null; |
|
78 | + } |
|
79 | + $shortcode = str_replace('EES_', '', strtoupper($shortcode_class)); |
|
80 | + $shortcode_obj = isset(EE_Registry::instance()->shortcodes->{$shortcode}) |
|
81 | + ? EE_Registry::instance()->shortcodes->{$shortcode} |
|
82 | + : null; |
|
83 | + return $shortcode_obj instanceof $shortcode_class || $shortcode_class === 'self' |
|
84 | + ? $shortcode_obj |
|
85 | + : new $shortcode_class(); |
|
86 | + } |
|
87 | + |
|
88 | + |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * fallback_shortcode_processor - create instance and call process_shortcode |
|
93 | + * NOTE: shortcode may not function perfectly dues to missing assets, but it's better than not having things work at all |
|
94 | + * |
|
95 | + * @access public |
|
96 | + * @param $attributes |
|
97 | + * @return mixed |
|
98 | + */ |
|
99 | + final public static function fallback_shortcode_processor($attributes) |
|
100 | + { |
|
101 | + if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) { |
|
102 | + return null; |
|
103 | + } |
|
104 | + // what shortcode was actually parsed ? |
|
105 | + $shortcode_class = get_called_class(); |
|
106 | + // notify rest of system that fallback processor was triggered |
|
107 | + add_filter('FHEE__fallback_shortcode_processor__' . $shortcode_class, '__return_true'); |
|
108 | + // get instance of actual shortcode |
|
109 | + $shortcode_obj = self::instance($shortcode_class); |
|
110 | + // verify class |
|
111 | + if ($shortcode_obj instanceof EES_Shortcode) { |
|
112 | + global $wp; |
|
113 | + $shortcode_obj->run($wp); |
|
114 | + // set attributes and run the shortcode |
|
115 | + $shortcode_obj->_attributes = (array) $attributes; |
|
116 | + return $shortcode_obj->process_shortcode($shortcode_obj->_attributes); |
|
117 | + } else { |
|
118 | + return null; |
|
119 | + } |
|
120 | + } |
|
121 | + |
|
122 | + |
|
123 | + |
|
124 | + |
|
125 | + /** |
|
126 | + * invalid_shortcode_processor - used in cases where we know the shortcode is invalid, most likely due to a deactivated addon, and simply returns an empty string |
|
127 | + * |
|
128 | + * @access public |
|
129 | + * @param $attributes |
|
130 | + * @return string |
|
131 | + */ |
|
132 | + final public static function invalid_shortcode_processor($attributes) |
|
133 | + { |
|
134 | + return ''; |
|
135 | + } |
|
136 | + |
|
137 | + |
|
138 | + |
|
139 | + |
|
140 | + |
|
141 | + /** |
|
142 | + * Performs basic sanitization on shortcode attributes |
|
143 | + * Since incoming attributes from the shortcode usage in the WP editor will all be strings, |
|
144 | + * most attributes will by default be sanitized using the sanitize_text_field() function. |
|
145 | + * This can be overridden by supplying an array for the $custom_sanitization param, |
|
146 | + * where keys match keys in your attributes array, |
|
147 | + * and values represent the sanitization function you wish to be applied to that attribute. |
|
148 | + * So for example, if you had an integer attribute named "event_id" |
|
149 | + * that you wanted to be sanitized using absint(), |
|
150 | + * then you would pass the following for your $custom_sanitization array: |
|
151 | + * array('event_id' => 'absint') |
|
152 | + * all other attributes would be sanitized using the defaults in the switch statement below |
|
153 | + * |
|
154 | + * @param array $attributes |
|
155 | + * @param array $custom_sanitization |
|
156 | + * @return array |
|
157 | + */ |
|
158 | + public static function sanitize_attributes(array $attributes, $custom_sanitization = array()) |
|
159 | + { |
|
160 | + foreach ($attributes as $key => $value) { |
|
161 | + // is a custom sanitization callback specified ? |
|
162 | + if (isset($custom_sanitization[ $key ])) { |
|
163 | + $callback = $custom_sanitization[ $key ]; |
|
164 | + if ($callback === 'skip_sanitization') { |
|
165 | + $attributes[ $key ] = $value; |
|
166 | + continue; |
|
167 | + } elseif (function_exists($callback)) { |
|
168 | + $attributes[ $key ] = $callback($value); |
|
169 | + continue; |
|
170 | + } |
|
171 | + } |
|
172 | + switch (true) { |
|
173 | + case $value === null: |
|
174 | + case is_int($value): |
|
175 | + case is_float($value): |
|
176 | + // typical booleans |
|
177 | + case in_array($value, array(true, 'true', '1', 'on', 'yes', false, 'false', '0', 'off', 'no'), true): |
|
178 | + $attributes[ $key ] = $value; |
|
179 | + break; |
|
180 | + case is_string($value): |
|
181 | + $attributes[ $key ] = sanitize_text_field($value); |
|
182 | + break; |
|
183 | + case is_array($value): |
|
184 | + $attributes[ $key ] = \EES_Shortcode::sanitize_attributes($value); |
|
185 | + break; |
|
186 | + default: |
|
187 | + // only remaining data types are Object and Resource |
|
188 | + // which are not allowed as shortcode attributes |
|
189 | + $attributes[ $key ] = null; |
|
190 | + break; |
|
191 | + } |
|
192 | + } |
|
193 | + return $attributes; |
|
194 | + } |
|
195 | 195 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | // what shortcode was actually parsed ? |
105 | 105 | $shortcode_class = get_called_class(); |
106 | 106 | // notify rest of system that fallback processor was triggered |
107 | - add_filter('FHEE__fallback_shortcode_processor__' . $shortcode_class, '__return_true'); |
|
107 | + add_filter('FHEE__fallback_shortcode_processor__'.$shortcode_class, '__return_true'); |
|
108 | 108 | // get instance of actual shortcode |
109 | 109 | $shortcode_obj = self::instance($shortcode_class); |
110 | 110 | // verify class |
@@ -159,13 +159,13 @@ discard block |
||
159 | 159 | { |
160 | 160 | foreach ($attributes as $key => $value) { |
161 | 161 | // is a custom sanitization callback specified ? |
162 | - if (isset($custom_sanitization[ $key ])) { |
|
163 | - $callback = $custom_sanitization[ $key ]; |
|
162 | + if (isset($custom_sanitization[$key])) { |
|
163 | + $callback = $custom_sanitization[$key]; |
|
164 | 164 | if ($callback === 'skip_sanitization') { |
165 | - $attributes[ $key ] = $value; |
|
165 | + $attributes[$key] = $value; |
|
166 | 166 | continue; |
167 | 167 | } elseif (function_exists($callback)) { |
168 | - $attributes[ $key ] = $callback($value); |
|
168 | + $attributes[$key] = $callback($value); |
|
169 | 169 | continue; |
170 | 170 | } |
171 | 171 | } |
@@ -175,18 +175,18 @@ discard block |
||
175 | 175 | case is_float($value): |
176 | 176 | // typical booleans |
177 | 177 | case in_array($value, array(true, 'true', '1', 'on', 'yes', false, 'false', '0', 'off', 'no'), true): |
178 | - $attributes[ $key ] = $value; |
|
178 | + $attributes[$key] = $value; |
|
179 | 179 | break; |
180 | 180 | case is_string($value): |
181 | - $attributes[ $key ] = sanitize_text_field($value); |
|
181 | + $attributes[$key] = sanitize_text_field($value); |
|
182 | 182 | break; |
183 | 183 | case is_array($value): |
184 | - $attributes[ $key ] = \EES_Shortcode::sanitize_attributes($value); |
|
184 | + $attributes[$key] = \EES_Shortcode::sanitize_attributes($value); |
|
185 | 185 | break; |
186 | 186 | default: |
187 | 187 | // only remaining data types are Object and Resource |
188 | 188 | // which are not allowed as shortcode attributes |
189 | - $attributes[ $key ] = null; |
|
189 | + $attributes[$key] = null; |
|
190 | 190 | break; |
191 | 191 | } |
192 | 192 | } |