@@ -11,8 +11,8 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_No_Sensitive_Data_Removal extends EE_Sensitive_Data_Removal_Base |
13 | 13 | { |
14 | - public function remove_sensitive_data($normalized_value) |
|
15 | - { |
|
16 | - return $normalized_value; |
|
17 | - } |
|
14 | + public function remove_sensitive_data($normalized_value) |
|
15 | + { |
|
16 | + return $normalized_value; |
|
17 | + } |
|
18 | 18 | } |
@@ -11,11 +11,11 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_Form_Section_HTML_From_Template extends EE_Form_Section_HTML |
13 | 13 | { |
14 | - public function __construct($template_file, $args = array(), $options_array = array()) |
|
15 | - { |
|
16 | - $html = EEH_Template::locate_template($template_file, $args); |
|
14 | + public function __construct($template_file, $args = array(), $options_array = array()) |
|
15 | + { |
|
16 | + $html = EEH_Template::locate_template($template_file, $args); |
|
17 | 17 | |
18 | 18 | // echo " filepath:$template_file html $html"; |
19 | - parent::__construct($html, $options_array); |
|
20 | - } |
|
19 | + parent::__construct($html, $options_array); |
|
20 | + } |
|
21 | 21 | } |
@@ -2,47 +2,47 @@ |
||
2 | 2 | |
3 | 3 | class EE_Validation_Error extends Exception |
4 | 4 | { |
5 | - /** |
|
6 | - * Form Section from which this error originated. |
|
7 | - * @var EE_Form_Section |
|
8 | - */ |
|
9 | - protected $_form_section; |
|
10 | - /** |
|
11 | - * a short string for uniquely identifying the error, which isn't internationalized and |
|
12 | - * machines can use to identify the error |
|
13 | - * @var string |
|
14 | - */ |
|
15 | - protected $_string_code; |
|
5 | + /** |
|
6 | + * Form Section from which this error originated. |
|
7 | + * @var EE_Form_Section |
|
8 | + */ |
|
9 | + protected $_form_section; |
|
10 | + /** |
|
11 | + * a short string for uniquely identifying the error, which isn't internationalized and |
|
12 | + * machines can use to identify the error |
|
13 | + * @var string |
|
14 | + */ |
|
15 | + protected $_string_code; |
|
16 | 16 | |
17 | - /** |
|
18 | - * When creating a validation error, we need to know which field the error relates to. |
|
19 | - * @param string $message message you want to display about this error |
|
20 | - * @param string $string_code a code for uniquely identifying the exception |
|
21 | - * @param EE_Form_Section_Validatable $form_section |
|
22 | - * @param Exception $previous if there was an exception that caused this exception |
|
23 | - */ |
|
24 | - public function __construct($message = null, $string_code = null, $form_section = null, $previous = null) |
|
25 | - { |
|
26 | - $this->_form_section = $form_section; |
|
27 | - $this->_string_code = $string_code; |
|
28 | - parent::__construct($message, 500, $previous); |
|
29 | - } |
|
17 | + /** |
|
18 | + * When creating a validation error, we need to know which field the error relates to. |
|
19 | + * @param string $message message you want to display about this error |
|
20 | + * @param string $string_code a code for uniquely identifying the exception |
|
21 | + * @param EE_Form_Section_Validatable $form_section |
|
22 | + * @param Exception $previous if there was an exception that caused this exception |
|
23 | + */ |
|
24 | + public function __construct($message = null, $string_code = null, $form_section = null, $previous = null) |
|
25 | + { |
|
26 | + $this->_form_section = $form_section; |
|
27 | + $this->_string_code = $string_code; |
|
28 | + parent::__construct($message, 500, $previous); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * returns teh form section which caused the error. |
|
33 | - * @return EE_Form_Section_Validatable |
|
34 | - */ |
|
35 | - public function get_form_section() |
|
36 | - { |
|
37 | - return $this->_form_section; |
|
38 | - } |
|
39 | - /** |
|
40 | - * Sets teh form seciton of the error, in case it wasnt set previously |
|
41 | - * @param EE_Form_Section_Validatable $form_section |
|
42 | - * @return void |
|
43 | - */ |
|
44 | - public function set_form_section($form_section) |
|
45 | - { |
|
46 | - $this->_form_section = $form_section; |
|
47 | - } |
|
31 | + /** |
|
32 | + * returns teh form section which caused the error. |
|
33 | + * @return EE_Form_Section_Validatable |
|
34 | + */ |
|
35 | + public function get_form_section() |
|
36 | + { |
|
37 | + return $this->_form_section; |
|
38 | + } |
|
39 | + /** |
|
40 | + * Sets teh form seciton of the error, in case it wasnt set previously |
|
41 | + * @param EE_Form_Section_Validatable $form_section |
|
42 | + * @return void |
|
43 | + */ |
|
44 | + public function set_form_section($form_section) |
|
45 | + { |
|
46 | + $this->_form_section = $form_section; |
|
47 | + } |
|
48 | 48 | } |
@@ -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 |
@@ -1,223 +1,223 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /** |
4 | - * |
|
5 | - * Class EE_Invoice_Line_Item_Display_Strategy |
|
6 | - * |
|
7 | - * Description |
|
8 | - * |
|
9 | - * @package Event Espresso |
|
10 | - * @subpackage core |
|
11 | - * @author Brent Christensen |
|
12 | - * |
|
13 | - * |
|
14 | - */ |
|
4 | + * |
|
5 | + * Class EE_Invoice_Line_Item_Display_Strategy |
|
6 | + * |
|
7 | + * Description |
|
8 | + * |
|
9 | + * @package Event Espresso |
|
10 | + * @subpackage core |
|
11 | + * @author Brent Christensen |
|
12 | + * |
|
13 | + * |
|
14 | + */ |
|
15 | 15 | class EE_Invoice_Line_Item_Display_Strategy implements EEI_Line_Item_Display |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @param EE_Line_Item $line_item |
|
20 | - * @param array $options |
|
21 | - * @return mixed |
|
22 | - */ |
|
23 | - public function display_line_item(EE_Line_Item $line_item, $options = array()) |
|
24 | - { |
|
25 | - |
|
26 | - $html = ''; |
|
27 | - // set some default options and merge with incoming |
|
28 | - $default_options = array( |
|
29 | - 'show_desc' => true, |
|
30 | - 'odd' => false |
|
31 | - ); |
|
32 | - $options = array_merge($default_options, (array) $options); |
|
33 | - |
|
34 | - switch ($line_item->type()) { |
|
35 | - case EEM_Line_Item::type_total: |
|
36 | - // loop thru children |
|
37 | - foreach ($line_item->children() as $child_line_item) { |
|
38 | - // recursively feed children back into this method |
|
39 | - $html .= $this->display_line_item($child_line_item, $options); |
|
40 | - } |
|
41 | - $html .= $this->_separator_row($options); |
|
42 | - $html .= $this->_total_row($line_item, esc_html__('Total', 'event_espresso'), $options); |
|
43 | - break; |
|
44 | - |
|
45 | - |
|
46 | - case EEM_Line_Item::type_sub_total: |
|
47 | - // loop thru children |
|
48 | - foreach ($line_item->children() as $child_line_item) { |
|
49 | - // recursively feed children back into this method |
|
50 | - $html .= $this->display_line_item($child_line_item, $options); |
|
51 | - } |
|
52 | - $html .= $this->_total_row($line_item, esc_html__('Sub-Total', 'event_espresso'), $options); |
|
53 | - break; |
|
54 | - |
|
55 | - |
|
56 | - case EEM_Line_Item::type_tax_sub_total: |
|
57 | - // loop thru children |
|
58 | - foreach ($line_item->children() as $child_line_item) { |
|
59 | - // recursively feed children back into this method |
|
60 | - $html .= $this->display_line_item($child_line_item, $options); |
|
61 | - } |
|
62 | - $html .= $this->_total_row($line_item, esc_html__('Tax Total', 'event_espresso'), $options); |
|
63 | - break; |
|
64 | - |
|
65 | - |
|
66 | - case EEM_Line_Item::type_line_item: |
|
67 | - // item row |
|
68 | - $html .= $this->_item_row($line_item, $options); |
|
69 | - // got any kids? |
|
70 | - foreach ($line_item->children() as $child_line_item) { |
|
71 | - $this->display_line_item($child_line_item, $options); |
|
72 | - } |
|
73 | - break; |
|
74 | - |
|
75 | - |
|
76 | - case EEM_Line_Item::type_sub_line_item: |
|
77 | - $html .= $this->_sub_item_row($line_item, $options); |
|
78 | - break; |
|
79 | - |
|
80 | - |
|
81 | - case EEM_Line_Item::type_tax: |
|
82 | - $html .= $this->_tax_row($line_item, $options); |
|
83 | - break; |
|
84 | - } |
|
85 | - |
|
86 | - return $html; |
|
87 | - } |
|
88 | - |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * _total_row |
|
93 | - * |
|
94 | - * @param EE_Line_Item $line_item |
|
95 | - * @param array $options |
|
96 | - * @return mixed |
|
97 | - */ |
|
98 | - private function _item_row(EE_Line_Item $line_item, $options = array()) |
|
99 | - { |
|
100 | - // start of row |
|
101 | - $row_class = $options['odd'] ? 'item odd' : 'item'; |
|
102 | - $html = EEH_HTML::tr('', $row_class); |
|
103 | - // name td |
|
104 | - $html .= EEH_HTML::td($line_item->name(), '', 'item_l'); |
|
105 | - // desc td |
|
106 | - $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
107 | - // quantity td |
|
108 | - $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l'); |
|
109 | - // price td |
|
110 | - $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c'); |
|
111 | - // total td |
|
112 | - $total = $line_item->is_taxable() ? $line_item->total_no_code() . '*' : $line_item->total_no_code(); |
|
113 | - $html .= EEH_HTML::td($total, '', 'item_r'); |
|
114 | - // end of row |
|
115 | - $html .= EEH_HTML::trx(); |
|
116 | - return $html; |
|
117 | - } |
|
118 | - |
|
119 | - |
|
120 | - |
|
121 | - /** |
|
122 | - * _sub_item_row |
|
123 | - * |
|
124 | - * @param EE_Line_Item $line_item |
|
125 | - * @param array $options |
|
126 | - * @return mixed |
|
127 | - */ |
|
128 | - private function _sub_item_row(EE_Line_Item $line_item, $options = array()) |
|
129 | - { |
|
130 | - // start of row |
|
131 | - $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
132 | - // name td |
|
133 | - $html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item'); |
|
134 | - // desc td |
|
135 | - $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
136 | - $html .= EEH_HTML::td() . EEH_HTML::tdx(); |
|
137 | - // discount/surcharge td |
|
138 | - if ($line_item->is_percent()) { |
|
139 | - $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c'); |
|
140 | - } else { |
|
141 | - $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c'); |
|
142 | - } |
|
143 | - // total td |
|
144 | - $html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r'); |
|
145 | - // end of row |
|
146 | - $html .= EEH_HTML::trx(); |
|
147 | - return $html; |
|
148 | - } |
|
149 | - |
|
150 | - |
|
151 | - |
|
152 | - /** |
|
153 | - * _tax_row |
|
154 | - * |
|
155 | - * @param EE_Line_Item $line_item |
|
156 | - * @param array $options |
|
157 | - * @return mixed |
|
158 | - */ |
|
159 | - private function _tax_row(EE_Line_Item $line_item, $options = array()) |
|
160 | - { |
|
161 | - // start of row |
|
162 | - $html = EEH_HTML::tr('', 'item sub-item tax-total'); |
|
163 | - // name td |
|
164 | - $html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item'); |
|
165 | - // desc td |
|
166 | - $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
167 | - // percent td |
|
168 | - $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c', '', ' colspan="2"'); |
|
169 | - // total td |
|
170 | - $html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r'); |
|
171 | - // end of row |
|
172 | - $html .= EEH_HTML::trx(); |
|
173 | - return $html; |
|
174 | - } |
|
175 | - |
|
176 | - |
|
177 | - |
|
178 | - /** |
|
179 | - * _total_row |
|
180 | - * |
|
181 | - * @param EE_Line_Item $line_item |
|
182 | - * @param string $text |
|
183 | - * @param array $options |
|
184 | - * @return mixed |
|
185 | - */ |
|
186 | - private function _total_row(EE_Line_Item $line_item, $text = '', $options = array()) |
|
187 | - { |
|
188 | - // colspan |
|
189 | - $colspan = $options['show_desc'] ? ' colspan="2"' : ''; |
|
190 | - // start of row |
|
191 | - $html = EEH_HTML::tr('', '', 'total_tr odd'); |
|
192 | - // empty td |
|
193 | - $html .= EEH_HTML::td(EEH_HTML::nbsp(), '', '', '', $colspan); |
|
194 | - // total td |
|
195 | - $html .= EEH_HTML::td($text, '', 'total_currency total', '', $colspan); |
|
196 | - // total td |
|
197 | - $html .= EEH_HTML::td($line_item->total_no_code(), '', 'total'); |
|
198 | - // end of row |
|
199 | - $html .= EEH_HTML::trx(); |
|
200 | - return $html; |
|
201 | - } |
|
202 | - |
|
203 | - |
|
204 | - |
|
205 | - /** |
|
206 | - * _separator_row |
|
207 | - * |
|
208 | - * @param array $options |
|
209 | - * @return mixed |
|
210 | - */ |
|
211 | - private function _separator_row($options = array()) |
|
212 | - { |
|
213 | - // colspan |
|
214 | - $colspan = $options['show_desc'] ? ' colspan="5"' : ' colspan="4"'; |
|
215 | - // start of row |
|
216 | - $html = EEH_HTML::tr(EEH_HTML::td('<hr>', '', '', '', $colspan)); |
|
18 | + /** |
|
19 | + * @param EE_Line_Item $line_item |
|
20 | + * @param array $options |
|
21 | + * @return mixed |
|
22 | + */ |
|
23 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) |
|
24 | + { |
|
25 | + |
|
26 | + $html = ''; |
|
27 | + // set some default options and merge with incoming |
|
28 | + $default_options = array( |
|
29 | + 'show_desc' => true, |
|
30 | + 'odd' => false |
|
31 | + ); |
|
32 | + $options = array_merge($default_options, (array) $options); |
|
33 | + |
|
34 | + switch ($line_item->type()) { |
|
35 | + case EEM_Line_Item::type_total: |
|
36 | + // loop thru children |
|
37 | + foreach ($line_item->children() as $child_line_item) { |
|
38 | + // recursively feed children back into this method |
|
39 | + $html .= $this->display_line_item($child_line_item, $options); |
|
40 | + } |
|
41 | + $html .= $this->_separator_row($options); |
|
42 | + $html .= $this->_total_row($line_item, esc_html__('Total', 'event_espresso'), $options); |
|
43 | + break; |
|
44 | + |
|
45 | + |
|
46 | + case EEM_Line_Item::type_sub_total: |
|
47 | + // loop thru children |
|
48 | + foreach ($line_item->children() as $child_line_item) { |
|
49 | + // recursively feed children back into this method |
|
50 | + $html .= $this->display_line_item($child_line_item, $options); |
|
51 | + } |
|
52 | + $html .= $this->_total_row($line_item, esc_html__('Sub-Total', 'event_espresso'), $options); |
|
53 | + break; |
|
54 | + |
|
55 | + |
|
56 | + case EEM_Line_Item::type_tax_sub_total: |
|
57 | + // loop thru children |
|
58 | + foreach ($line_item->children() as $child_line_item) { |
|
59 | + // recursively feed children back into this method |
|
60 | + $html .= $this->display_line_item($child_line_item, $options); |
|
61 | + } |
|
62 | + $html .= $this->_total_row($line_item, esc_html__('Tax Total', 'event_espresso'), $options); |
|
63 | + break; |
|
64 | + |
|
65 | + |
|
66 | + case EEM_Line_Item::type_line_item: |
|
67 | + // item row |
|
68 | + $html .= $this->_item_row($line_item, $options); |
|
69 | + // got any kids? |
|
70 | + foreach ($line_item->children() as $child_line_item) { |
|
71 | + $this->display_line_item($child_line_item, $options); |
|
72 | + } |
|
73 | + break; |
|
74 | + |
|
75 | + |
|
76 | + case EEM_Line_Item::type_sub_line_item: |
|
77 | + $html .= $this->_sub_item_row($line_item, $options); |
|
78 | + break; |
|
79 | + |
|
80 | + |
|
81 | + case EEM_Line_Item::type_tax: |
|
82 | + $html .= $this->_tax_row($line_item, $options); |
|
83 | + break; |
|
84 | + } |
|
85 | + |
|
86 | + return $html; |
|
87 | + } |
|
88 | + |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * _total_row |
|
93 | + * |
|
94 | + * @param EE_Line_Item $line_item |
|
95 | + * @param array $options |
|
96 | + * @return mixed |
|
97 | + */ |
|
98 | + private function _item_row(EE_Line_Item $line_item, $options = array()) |
|
99 | + { |
|
100 | + // start of row |
|
101 | + $row_class = $options['odd'] ? 'item odd' : 'item'; |
|
102 | + $html = EEH_HTML::tr('', $row_class); |
|
103 | + // name td |
|
104 | + $html .= EEH_HTML::td($line_item->name(), '', 'item_l'); |
|
105 | + // desc td |
|
106 | + $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
107 | + // quantity td |
|
108 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l'); |
|
109 | + // price td |
|
110 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c'); |
|
111 | + // total td |
|
112 | + $total = $line_item->is_taxable() ? $line_item->total_no_code() . '*' : $line_item->total_no_code(); |
|
113 | + $html .= EEH_HTML::td($total, '', 'item_r'); |
|
114 | + // end of row |
|
115 | + $html .= EEH_HTML::trx(); |
|
116 | + return $html; |
|
117 | + } |
|
118 | + |
|
119 | + |
|
120 | + |
|
121 | + /** |
|
122 | + * _sub_item_row |
|
123 | + * |
|
124 | + * @param EE_Line_Item $line_item |
|
125 | + * @param array $options |
|
126 | + * @return mixed |
|
127 | + */ |
|
128 | + private function _sub_item_row(EE_Line_Item $line_item, $options = array()) |
|
129 | + { |
|
130 | + // start of row |
|
131 | + $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
132 | + // name td |
|
133 | + $html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item'); |
|
134 | + // desc td |
|
135 | + $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
136 | + $html .= EEH_HTML::td() . EEH_HTML::tdx(); |
|
137 | + // discount/surcharge td |
|
138 | + if ($line_item->is_percent()) { |
|
139 | + $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c'); |
|
140 | + } else { |
|
141 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c'); |
|
142 | + } |
|
143 | + // total td |
|
144 | + $html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r'); |
|
145 | + // end of row |
|
146 | + $html .= EEH_HTML::trx(); |
|
147 | + return $html; |
|
148 | + } |
|
149 | + |
|
150 | + |
|
151 | + |
|
152 | + /** |
|
153 | + * _tax_row |
|
154 | + * |
|
155 | + * @param EE_Line_Item $line_item |
|
156 | + * @param array $options |
|
157 | + * @return mixed |
|
158 | + */ |
|
159 | + private function _tax_row(EE_Line_Item $line_item, $options = array()) |
|
160 | + { |
|
161 | + // start of row |
|
162 | + $html = EEH_HTML::tr('', 'item sub-item tax-total'); |
|
163 | + // name td |
|
164 | + $html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item'); |
|
165 | + // desc td |
|
166 | + $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
167 | + // percent td |
|
168 | + $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c', '', ' colspan="2"'); |
|
169 | + // total td |
|
170 | + $html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r'); |
|
171 | + // end of row |
|
172 | + $html .= EEH_HTML::trx(); |
|
173 | + return $html; |
|
174 | + } |
|
175 | + |
|
176 | + |
|
177 | + |
|
178 | + /** |
|
179 | + * _total_row |
|
180 | + * |
|
181 | + * @param EE_Line_Item $line_item |
|
182 | + * @param string $text |
|
183 | + * @param array $options |
|
184 | + * @return mixed |
|
185 | + */ |
|
186 | + private function _total_row(EE_Line_Item $line_item, $text = '', $options = array()) |
|
187 | + { |
|
188 | + // colspan |
|
189 | + $colspan = $options['show_desc'] ? ' colspan="2"' : ''; |
|
190 | + // start of row |
|
191 | + $html = EEH_HTML::tr('', '', 'total_tr odd'); |
|
192 | + // empty td |
|
193 | + $html .= EEH_HTML::td(EEH_HTML::nbsp(), '', '', '', $colspan); |
|
194 | + // total td |
|
195 | + $html .= EEH_HTML::td($text, '', 'total_currency total', '', $colspan); |
|
196 | + // total td |
|
197 | + $html .= EEH_HTML::td($line_item->total_no_code(), '', 'total'); |
|
198 | + // end of row |
|
199 | + $html .= EEH_HTML::trx(); |
|
200 | + return $html; |
|
201 | + } |
|
202 | + |
|
203 | + |
|
204 | + |
|
205 | + /** |
|
206 | + * _separator_row |
|
207 | + * |
|
208 | + * @param array $options |
|
209 | + * @return mixed |
|
210 | + */ |
|
211 | + private function _separator_row($options = array()) |
|
212 | + { |
|
213 | + // colspan |
|
214 | + $colspan = $options['show_desc'] ? ' colspan="5"' : ' colspan="4"'; |
|
215 | + // start of row |
|
216 | + $html = EEH_HTML::tr(EEH_HTML::td('<hr>', '', '', '', $colspan)); |
|
217 | 217 | // // separator td |
218 | 218 | // $html .= EEH_HTML::td( '<hr>', '', '', '', $colspan ); |
219 | 219 | // // end of row |
220 | 220 | // $html .= EEH_HTML::trx(); |
221 | - return $html; |
|
222 | - } |
|
221 | + return $html; |
|
222 | + } |
|
223 | 223 | } |
@@ -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 |
@@ -12,146 +12,146 @@ |
||
12 | 12 | */ |
13 | 13 | class EE_Response |
14 | 14 | { |
15 | - /** |
|
16 | - * @access protected |
|
17 | - * @type array $_notice |
|
18 | - */ |
|
19 | - protected $_notice = array(); |
|
20 | - |
|
21 | - /** |
|
22 | - * rendered output to be returned to WP |
|
23 | - * |
|
24 | - * @access protected |
|
25 | - * @type string |
|
26 | - */ |
|
27 | - protected $_output = ''; |
|
28 | - |
|
29 | - /** |
|
30 | - * @access protected |
|
31 | - * @type bool |
|
32 | - */ |
|
33 | - protected $request_terminated = false; |
|
34 | - |
|
35 | - /** |
|
36 | - * @access protected |
|
37 | - * @type bool |
|
38 | - */ |
|
39 | - protected $deactivate_plugin = false; |
|
40 | - |
|
41 | - |
|
42 | - /** |
|
43 | - * @deprecated 4.9.53 |
|
44 | - * @return \EE_Response |
|
45 | - */ |
|
46 | - public function __construct() |
|
47 | - { |
|
48 | - $this->terminate_request(false); |
|
49 | - EE_Error::doing_it_wrong( |
|
50 | - __METHOD__, |
|
51 | - sprintf( |
|
52 | - esc_html__( |
|
53 | - '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', |
|
54 | - 'event_espresso' |
|
55 | - ), |
|
56 | - 'EventEspresso\core\services\request\Response', |
|
57 | - '\core\services\request', |
|
58 | - 'EventEspresso\core\services\request' |
|
59 | - ), |
|
60 | - '4.9.53' |
|
61 | - ); |
|
62 | - } |
|
63 | - |
|
64 | - |
|
65 | - /** |
|
66 | - * @deprecated 4.9.53 |
|
67 | - * @param $key |
|
68 | - * @param $value |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - public function set_notice($key, $value) |
|
72 | - { |
|
73 | - $this->_notice[ $key ] = $value; |
|
74 | - } |
|
75 | - |
|
76 | - |
|
77 | - /** |
|
78 | - * @deprecated 4.9.53 |
|
79 | - * @param $key |
|
80 | - * @return mixed |
|
81 | - */ |
|
82 | - public function get_notice($key) |
|
83 | - { |
|
84 | - return isset($this->_notice[ $key ]) ? $this->_notice[ $key ] : null; |
|
85 | - } |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * @deprecated 4.9.53 |
|
90 | - * @return array |
|
91 | - */ |
|
92 | - public function get_notices() |
|
93 | - { |
|
94 | - return $this->_notice; |
|
95 | - } |
|
96 | - |
|
97 | - |
|
98 | - /** |
|
99 | - * @deprecated 4.9.53 |
|
100 | - * @param $string |
|
101 | - * @param bool $append |
|
102 | - */ |
|
103 | - public function add_output($string, $append = true) |
|
104 | - { |
|
105 | - $this->_output = $append ? $this->_output . $string : $string . $this->_output; |
|
106 | - } |
|
107 | - |
|
108 | - |
|
109 | - /** |
|
110 | - * @deprecated 4.9.53 |
|
111 | - * @return string |
|
112 | - */ |
|
113 | - public function get_output() |
|
114 | - { |
|
115 | - return $this->_output; |
|
116 | - } |
|
117 | - |
|
118 | - |
|
119 | - /** |
|
120 | - * @deprecated 4.9.53 |
|
121 | - * @return boolean |
|
122 | - */ |
|
123 | - public function request_terminated() |
|
124 | - { |
|
125 | - return $this->request_terminated; |
|
126 | - } |
|
127 | - |
|
128 | - |
|
129 | - /** |
|
130 | - * @deprecated 4.9.53 |
|
131 | - * @param boolean $request_terminated |
|
132 | - */ |
|
133 | - public function terminate_request($request_terminated = true) |
|
134 | - { |
|
135 | - $this->request_terminated = filter_var($request_terminated, FILTER_VALIDATE_BOOLEAN); |
|
136 | - } |
|
137 | - |
|
138 | - |
|
139 | - /** |
|
140 | - * @deprecated 4.9.53 |
|
141 | - * @return boolean |
|
142 | - */ |
|
143 | - public function plugin_deactivated() |
|
144 | - { |
|
145 | - return $this->deactivate_plugin; |
|
146 | - } |
|
147 | - |
|
148 | - |
|
149 | - /** |
|
150 | - * @deprecated 4.9.53 |
|
151 | - * sets $deactivate_plugin to true |
|
152 | - */ |
|
153 | - public function deactivate_plugin() |
|
154 | - { |
|
155 | - $this->deactivate_plugin = true; |
|
156 | - } |
|
15 | + /** |
|
16 | + * @access protected |
|
17 | + * @type array $_notice |
|
18 | + */ |
|
19 | + protected $_notice = array(); |
|
20 | + |
|
21 | + /** |
|
22 | + * rendered output to be returned to WP |
|
23 | + * |
|
24 | + * @access protected |
|
25 | + * @type string |
|
26 | + */ |
|
27 | + protected $_output = ''; |
|
28 | + |
|
29 | + /** |
|
30 | + * @access protected |
|
31 | + * @type bool |
|
32 | + */ |
|
33 | + protected $request_terminated = false; |
|
34 | + |
|
35 | + /** |
|
36 | + * @access protected |
|
37 | + * @type bool |
|
38 | + */ |
|
39 | + protected $deactivate_plugin = false; |
|
40 | + |
|
41 | + |
|
42 | + /** |
|
43 | + * @deprecated 4.9.53 |
|
44 | + * @return \EE_Response |
|
45 | + */ |
|
46 | + public function __construct() |
|
47 | + { |
|
48 | + $this->terminate_request(false); |
|
49 | + EE_Error::doing_it_wrong( |
|
50 | + __METHOD__, |
|
51 | + sprintf( |
|
52 | + esc_html__( |
|
53 | + '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', |
|
54 | + 'event_espresso' |
|
55 | + ), |
|
56 | + 'EventEspresso\core\services\request\Response', |
|
57 | + '\core\services\request', |
|
58 | + 'EventEspresso\core\services\request' |
|
59 | + ), |
|
60 | + '4.9.53' |
|
61 | + ); |
|
62 | + } |
|
63 | + |
|
64 | + |
|
65 | + /** |
|
66 | + * @deprecated 4.9.53 |
|
67 | + * @param $key |
|
68 | + * @param $value |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + public function set_notice($key, $value) |
|
72 | + { |
|
73 | + $this->_notice[ $key ] = $value; |
|
74 | + } |
|
75 | + |
|
76 | + |
|
77 | + /** |
|
78 | + * @deprecated 4.9.53 |
|
79 | + * @param $key |
|
80 | + * @return mixed |
|
81 | + */ |
|
82 | + public function get_notice($key) |
|
83 | + { |
|
84 | + return isset($this->_notice[ $key ]) ? $this->_notice[ $key ] : null; |
|
85 | + } |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * @deprecated 4.9.53 |
|
90 | + * @return array |
|
91 | + */ |
|
92 | + public function get_notices() |
|
93 | + { |
|
94 | + return $this->_notice; |
|
95 | + } |
|
96 | + |
|
97 | + |
|
98 | + /** |
|
99 | + * @deprecated 4.9.53 |
|
100 | + * @param $string |
|
101 | + * @param bool $append |
|
102 | + */ |
|
103 | + public function add_output($string, $append = true) |
|
104 | + { |
|
105 | + $this->_output = $append ? $this->_output . $string : $string . $this->_output; |
|
106 | + } |
|
107 | + |
|
108 | + |
|
109 | + /** |
|
110 | + * @deprecated 4.9.53 |
|
111 | + * @return string |
|
112 | + */ |
|
113 | + public function get_output() |
|
114 | + { |
|
115 | + return $this->_output; |
|
116 | + } |
|
117 | + |
|
118 | + |
|
119 | + /** |
|
120 | + * @deprecated 4.9.53 |
|
121 | + * @return boolean |
|
122 | + */ |
|
123 | + public function request_terminated() |
|
124 | + { |
|
125 | + return $this->request_terminated; |
|
126 | + } |
|
127 | + |
|
128 | + |
|
129 | + /** |
|
130 | + * @deprecated 4.9.53 |
|
131 | + * @param boolean $request_terminated |
|
132 | + */ |
|
133 | + public function terminate_request($request_terminated = true) |
|
134 | + { |
|
135 | + $this->request_terminated = filter_var($request_terminated, FILTER_VALIDATE_BOOLEAN); |
|
136 | + } |
|
137 | + |
|
138 | + |
|
139 | + /** |
|
140 | + * @deprecated 4.9.53 |
|
141 | + * @return boolean |
|
142 | + */ |
|
143 | + public function plugin_deactivated() |
|
144 | + { |
|
145 | + return $this->deactivate_plugin; |
|
146 | + } |
|
147 | + |
|
148 | + |
|
149 | + /** |
|
150 | + * @deprecated 4.9.53 |
|
151 | + * sets $deactivate_plugin to true |
|
152 | + */ |
|
153 | + public function deactivate_plugin() |
|
154 | + { |
|
155 | + $this->deactivate_plugin = true; |
|
156 | + } |
|
157 | 157 | } |
@@ -62,49 +62,49 @@ discard block |
||
62 | 62 | ); |
63 | 63 | $cpt_models = array_keys(EE_Registry::instance()->cpt_models()); |
64 | 64 | foreach ($cpt_models as $model_name) { |
65 | - $this->_model_relations[ $model_name ] = new EE_HABTM_Relation('Term_Relationship'); |
|
65 | + $this->_model_relations[$model_name] = new EE_HABTM_Relation('Term_Relationship'); |
|
66 | 66 | } |
67 | 67 | $this->_wp_core_model = true; |
68 | 68 | $this->_indexes = array( |
69 | 69 | 'term_id_taxonomy' => new EE_Unique_Index(array('term_id', 'taxonomy')), |
70 | 70 | ); |
71 | 71 | $path_to_tax_model = ''; |
72 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
73 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected( |
|
72 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
73 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Taxonomy_Protected( |
|
74 | 74 | $path_to_tax_model |
75 | 75 | ); |
76 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false; |
|
77 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false; |
|
76 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = false; |
|
77 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = false; |
|
78 | 78 | // add cap restrictions for editing relating to the "ee_edit_*" |
79 | - $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions( |
|
79 | + $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_category'] = new EE_Default_Where_Conditions( |
|
80 | 80 | array( |
81 | - $path_to_tax_model . 'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'), |
|
81 | + $path_to_tax_model.'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'), |
|
82 | 82 | ) |
83 | 83 | ); |
84 | - $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions( |
|
84 | + $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_venue_category'] = new EE_Default_Where_Conditions( |
|
85 | 85 | array( |
86 | - $path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'), |
|
86 | + $path_to_tax_model.'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'), |
|
87 | 87 | ) |
88 | 88 | ); |
89 | - $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions( |
|
89 | + $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_type'] = new EE_Default_Where_Conditions( |
|
90 | 90 | array( |
91 | - $path_to_tax_model . 'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'), |
|
91 | + $path_to_tax_model.'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'), |
|
92 | 92 | ) |
93 | 93 | ); |
94 | 94 | // add cap restrictions for deleting relating to the "ee_deleting_*" |
95 | - $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions( |
|
95 | + $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_category'] = new EE_Default_Where_Conditions( |
|
96 | 96 | array( |
97 | - $path_to_tax_model . 'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'), |
|
97 | + $path_to_tax_model.'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'), |
|
98 | 98 | ) |
99 | 99 | ); |
100 | - $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions( |
|
100 | + $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_venue_category'] = new EE_Default_Where_Conditions( |
|
101 | 101 | array( |
102 | - $path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'), |
|
102 | + $path_to_tax_model.'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'), |
|
103 | 103 | ) |
104 | 104 | ); |
105 | - $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions( |
|
105 | + $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_type'] = new EE_Default_Where_Conditions( |
|
106 | 106 | array( |
107 | - $path_to_tax_model . 'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'), |
|
107 | + $path_to_tax_model.'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'), |
|
108 | 108 | ) |
109 | 109 | ); |
110 | 110 | parent::__construct($timezone); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | { |
127 | 127 | if ($model === EEM_Term_Taxonomy::instance()) { |
128 | 128 | $taxonomies = get_taxonomies(array('show_in_rest' => true)); |
129 | - if (! empty($taxonomies)) { |
|
129 | + if ( ! empty($taxonomies)) { |
|
130 | 130 | $model_query_params[0]['taxonomy'] = array('IN', $taxonomies); |
131 | 131 | } |
132 | 132 | } |
@@ -10,133 +10,133 @@ |
||
10 | 10 | */ |
11 | 11 | class EEM_Term_Taxonomy extends EEM_Base |
12 | 12 | { |
13 | - /** |
|
14 | - * @var EEM_Term_Taxonomy |
|
15 | - */ |
|
16 | - protected static $_instance = null; |
|
13 | + /** |
|
14 | + * @var EEM_Term_Taxonomy |
|
15 | + */ |
|
16 | + protected static $_instance = null; |
|
17 | 17 | |
18 | 18 | |
19 | - /** |
|
20 | - * @param $timezone |
|
21 | - * @throws EE_Error |
|
22 | - */ |
|
23 | - protected function __construct($timezone = null) |
|
24 | - { |
|
25 | - $this->singular_item = esc_html__('Term Taxonomy', 'event_espresso'); |
|
26 | - $this->plural_item = esc_html__('Term Taxonomy', 'event_espresso'); |
|
27 | - $this->_tables = array( |
|
28 | - 'Term_Taxonomy' => new EE_Primary_Table('term_taxonomy', 'term_taxonomy_id'), |
|
29 | - ); |
|
30 | - $this->_fields = array( |
|
31 | - 'Term_Taxonomy' => array( |
|
32 | - 'term_taxonomy_id' => new EE_Primary_Key_Int_Field( |
|
33 | - 'term_taxonomy_id', |
|
34 | - esc_html__('Term-Taxonomy ID', 'event_espresso') |
|
35 | - ), |
|
36 | - 'term_id' => new EE_Foreign_Key_Int_Field( |
|
37 | - 'term_id', |
|
38 | - esc_html__("Term Id", "event_espresso"), |
|
39 | - false, |
|
40 | - 0, |
|
41 | - 'Term' |
|
42 | - ), |
|
43 | - 'taxonomy' => new EE_Plain_Text_Field( |
|
44 | - 'taxonomy', |
|
45 | - esc_html__('Taxonomy Name', 'event_espresso'), |
|
46 | - false, |
|
47 | - 'category' |
|
48 | - ), |
|
49 | - 'description' => new EE_Post_Content_Field( |
|
50 | - 'description', |
|
51 | - esc_html__("Description of Term", "event_espresso"), |
|
52 | - false, |
|
53 | - '' |
|
54 | - ), |
|
55 | - 'parent' => new EE_Integer_Field('parent', esc_html__("Parent Term ID", "event_espresso"), false, 0), |
|
56 | - 'term_count' => new EE_Integer_Field( |
|
57 | - 'count', |
|
58 | - esc_html__("Count of Objects attached", 'event_espresso'), |
|
59 | - false, |
|
60 | - 0 |
|
61 | - ), |
|
62 | - ), |
|
63 | - ); |
|
64 | - $this->_model_relations = array( |
|
65 | - 'Term_Relationship' => new EE_Has_Many_Relation(), |
|
66 | - 'Term' => new EE_Belongs_To_Relation(), |
|
67 | - ); |
|
68 | - $cpt_models = array_keys(EE_Registry::instance()->cpt_models()); |
|
69 | - foreach ($cpt_models as $model_name) { |
|
70 | - $this->_model_relations[ $model_name ] = new EE_HABTM_Relation('Term_Relationship'); |
|
71 | - } |
|
72 | - $this->_wp_core_model = true; |
|
73 | - $this->_indexes = array( |
|
74 | - 'term_id_taxonomy' => new EE_Unique_Index(array('term_id', 'taxonomy')), |
|
75 | - ); |
|
76 | - $path_to_tax_model = ''; |
|
77 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
78 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected( |
|
79 | - $path_to_tax_model |
|
80 | - ); |
|
81 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false; |
|
82 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false; |
|
83 | - // add cap restrictions for editing relating to the "ee_edit_*" |
|
84 | - $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions( |
|
85 | - array( |
|
86 | - $path_to_tax_model . 'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'), |
|
87 | - ) |
|
88 | - ); |
|
89 | - $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions( |
|
90 | - array( |
|
91 | - $path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'), |
|
92 | - ) |
|
93 | - ); |
|
94 | - $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions( |
|
95 | - array( |
|
96 | - $path_to_tax_model . 'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'), |
|
97 | - ) |
|
98 | - ); |
|
99 | - // add cap restrictions for deleting relating to the "ee_deleting_*" |
|
100 | - $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions( |
|
101 | - array( |
|
102 | - $path_to_tax_model . 'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'), |
|
103 | - ) |
|
104 | - ); |
|
105 | - $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions( |
|
106 | - array( |
|
107 | - $path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'), |
|
108 | - ) |
|
109 | - ); |
|
110 | - $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions( |
|
111 | - array( |
|
112 | - $path_to_tax_model . 'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'), |
|
113 | - ) |
|
114 | - ); |
|
115 | - parent::__construct($timezone); |
|
116 | - add_filter('FHEE__Read__create_model_query_params', array('EEM_Term_Taxonomy', 'rest_api_query_params'), 10, 3); |
|
117 | - } |
|
19 | + /** |
|
20 | + * @param $timezone |
|
21 | + * @throws EE_Error |
|
22 | + */ |
|
23 | + protected function __construct($timezone = null) |
|
24 | + { |
|
25 | + $this->singular_item = esc_html__('Term Taxonomy', 'event_espresso'); |
|
26 | + $this->plural_item = esc_html__('Term Taxonomy', 'event_espresso'); |
|
27 | + $this->_tables = array( |
|
28 | + 'Term_Taxonomy' => new EE_Primary_Table('term_taxonomy', 'term_taxonomy_id'), |
|
29 | + ); |
|
30 | + $this->_fields = array( |
|
31 | + 'Term_Taxonomy' => array( |
|
32 | + 'term_taxonomy_id' => new EE_Primary_Key_Int_Field( |
|
33 | + 'term_taxonomy_id', |
|
34 | + esc_html__('Term-Taxonomy ID', 'event_espresso') |
|
35 | + ), |
|
36 | + 'term_id' => new EE_Foreign_Key_Int_Field( |
|
37 | + 'term_id', |
|
38 | + esc_html__("Term Id", "event_espresso"), |
|
39 | + false, |
|
40 | + 0, |
|
41 | + 'Term' |
|
42 | + ), |
|
43 | + 'taxonomy' => new EE_Plain_Text_Field( |
|
44 | + 'taxonomy', |
|
45 | + esc_html__('Taxonomy Name', 'event_espresso'), |
|
46 | + false, |
|
47 | + 'category' |
|
48 | + ), |
|
49 | + 'description' => new EE_Post_Content_Field( |
|
50 | + 'description', |
|
51 | + esc_html__("Description of Term", "event_espresso"), |
|
52 | + false, |
|
53 | + '' |
|
54 | + ), |
|
55 | + 'parent' => new EE_Integer_Field('parent', esc_html__("Parent Term ID", "event_espresso"), false, 0), |
|
56 | + 'term_count' => new EE_Integer_Field( |
|
57 | + 'count', |
|
58 | + esc_html__("Count of Objects attached", 'event_espresso'), |
|
59 | + false, |
|
60 | + 0 |
|
61 | + ), |
|
62 | + ), |
|
63 | + ); |
|
64 | + $this->_model_relations = array( |
|
65 | + 'Term_Relationship' => new EE_Has_Many_Relation(), |
|
66 | + 'Term' => new EE_Belongs_To_Relation(), |
|
67 | + ); |
|
68 | + $cpt_models = array_keys(EE_Registry::instance()->cpt_models()); |
|
69 | + foreach ($cpt_models as $model_name) { |
|
70 | + $this->_model_relations[ $model_name ] = new EE_HABTM_Relation('Term_Relationship'); |
|
71 | + } |
|
72 | + $this->_wp_core_model = true; |
|
73 | + $this->_indexes = array( |
|
74 | + 'term_id_taxonomy' => new EE_Unique_Index(array('term_id', 'taxonomy')), |
|
75 | + ); |
|
76 | + $path_to_tax_model = ''; |
|
77 | + $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
78 | + $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected( |
|
79 | + $path_to_tax_model |
|
80 | + ); |
|
81 | + $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false; |
|
82 | + $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false; |
|
83 | + // add cap restrictions for editing relating to the "ee_edit_*" |
|
84 | + $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions( |
|
85 | + array( |
|
86 | + $path_to_tax_model . 'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'), |
|
87 | + ) |
|
88 | + ); |
|
89 | + $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions( |
|
90 | + array( |
|
91 | + $path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'), |
|
92 | + ) |
|
93 | + ); |
|
94 | + $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions( |
|
95 | + array( |
|
96 | + $path_to_tax_model . 'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'), |
|
97 | + ) |
|
98 | + ); |
|
99 | + // add cap restrictions for deleting relating to the "ee_deleting_*" |
|
100 | + $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions( |
|
101 | + array( |
|
102 | + $path_to_tax_model . 'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'), |
|
103 | + ) |
|
104 | + ); |
|
105 | + $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions( |
|
106 | + array( |
|
107 | + $path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'), |
|
108 | + ) |
|
109 | + ); |
|
110 | + $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions( |
|
111 | + array( |
|
112 | + $path_to_tax_model . 'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'), |
|
113 | + ) |
|
114 | + ); |
|
115 | + parent::__construct($timezone); |
|
116 | + add_filter('FHEE__Read__create_model_query_params', array('EEM_Term_Taxonomy', 'rest_api_query_params'), 10, 3); |
|
117 | + } |
|
118 | 118 | |
119 | 119 | |
120 | - /** |
|
121 | - * Makes sure that during REST API queries, we only return term-taxonomies |
|
122 | - * for term taxonomies which should be shown in the rest api |
|
123 | - * |
|
124 | - * @param array $model_query_params |
|
125 | - * @param array $querystring_query_params |
|
126 | - * @param EEM_Base $model |
|
127 | - * @return array |
|
128 | - * @throws EE_Error |
|
129 | - */ |
|
130 | - public static function rest_api_query_params($model_query_params, $querystring_query_params, $model) |
|
131 | - { |
|
132 | - if ($model === EEM_Term_Taxonomy::instance()) { |
|
133 | - $taxonomies = get_taxonomies(array('show_in_rest' => true)); |
|
134 | - if (! empty($taxonomies)) { |
|
135 | - $model_query_params[0]['taxonomy'] = array('IN', $taxonomies); |
|
136 | - } |
|
137 | - } |
|
138 | - return $model_query_params; |
|
139 | - } |
|
120 | + /** |
|
121 | + * Makes sure that during REST API queries, we only return term-taxonomies |
|
122 | + * for term taxonomies which should be shown in the rest api |
|
123 | + * |
|
124 | + * @param array $model_query_params |
|
125 | + * @param array $querystring_query_params |
|
126 | + * @param EEM_Base $model |
|
127 | + * @return array |
|
128 | + * @throws EE_Error |
|
129 | + */ |
|
130 | + public static function rest_api_query_params($model_query_params, $querystring_query_params, $model) |
|
131 | + { |
|
132 | + if ($model === EEM_Term_Taxonomy::instance()) { |
|
133 | + $taxonomies = get_taxonomies(array('show_in_rest' => true)); |
|
134 | + if (! empty($taxonomies)) { |
|
135 | + $model_query_params[0]['taxonomy'] = array('IN', $taxonomies); |
|
136 | + } |
|
137 | + } |
|
138 | + return $model_query_params; |
|
139 | + } |
|
140 | 140 | } |
141 | 141 | // End of file EEM_Term_Taxonomy.model.php |
142 | 142 | // Location: /includes/models/EEM_Term_Taxonomy.model.php |
@@ -38,10 +38,10 @@ |
||
38 | 38 | )); |
39 | 39 | $this->_model_relations = array(); |
40 | 40 | foreach ($models_this_can_attach_to as $model) { |
41 | - $this->_model_relations[ $model ] = new EE_Belongs_To_Any_Relation(); |
|
41 | + $this->_model_relations[$model] = new EE_Belongs_To_Any_Relation(); |
|
42 | 42 | } |
43 | 43 | foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) { |
44 | - $this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta('EXM_key', 'EXM_value'); |
|
44 | + $this->_cap_restriction_generators[$cap_context] = new EE_Restriction_Generator_Meta('EXM_key', 'EXM_value'); |
|
45 | 45 | } |
46 | 46 | parent::__construct($timezone); |
47 | 47 | } |
@@ -16,33 +16,33 @@ |
||
16 | 16 | */ |
17 | 17 | class EEM_Extra_Meta extends EEM_Base |
18 | 18 | { |
19 | - // private instance of the Attendee object |
|
20 | - protected static $_instance = null; |
|
19 | + // private instance of the Attendee object |
|
20 | + protected static $_instance = null; |
|
21 | 21 | |
22 | - protected function __construct($timezone = null) |
|
23 | - { |
|
24 | - $this->singular_item = esc_html__('Extra Meta', 'event_espresso'); |
|
25 | - $this->plural_item = esc_html__('Extra Metas', 'event_espresso'); |
|
26 | - $this->_tables = array( |
|
27 | - 'Extra_Meta' => new EE_Primary_Table('esp_extra_meta', 'EXM_ID') |
|
28 | - ); |
|
29 | - $models_this_can_attach_to = array_keys(EE_Registry::instance()->non_abstract_db_models); |
|
30 | - $this->_fields = array( |
|
31 | - 'Extra_Meta' => array( |
|
32 | - 'EXM_ID' => new EE_Primary_Key_Int_Field('EXM_ID', esc_html__("Extra Meta ID", "event_espresso")), |
|
33 | - 'OBJ_ID' => new EE_Foreign_Key_Int_Field('OBJ_ID', esc_html__("Primary Key of Attached Thing", "event_espresso"), false, 0, $models_this_can_attach_to), |
|
34 | - 'EXM_type' => new EE_Any_Foreign_Model_Name_Field('EXM_type', esc_html__("Model of Attached Thing", "event_espresso"), false, 'Transaction', $models_this_can_attach_to), |
|
35 | - 'EXM_key' => new EE_Plain_Text_Field('EXM_key', esc_html__("Meta Key", "event_espresso"), false, ''), |
|
36 | - 'EXM_value' => new EE_Maybe_Serialized_Text_Field('EXM_value', esc_html__("Meta Value", "event_espresso"), true) |
|
22 | + protected function __construct($timezone = null) |
|
23 | + { |
|
24 | + $this->singular_item = esc_html__('Extra Meta', 'event_espresso'); |
|
25 | + $this->plural_item = esc_html__('Extra Metas', 'event_espresso'); |
|
26 | + $this->_tables = array( |
|
27 | + 'Extra_Meta' => new EE_Primary_Table('esp_extra_meta', 'EXM_ID') |
|
28 | + ); |
|
29 | + $models_this_can_attach_to = array_keys(EE_Registry::instance()->non_abstract_db_models); |
|
30 | + $this->_fields = array( |
|
31 | + 'Extra_Meta' => array( |
|
32 | + 'EXM_ID' => new EE_Primary_Key_Int_Field('EXM_ID', esc_html__("Extra Meta ID", "event_espresso")), |
|
33 | + 'OBJ_ID' => new EE_Foreign_Key_Int_Field('OBJ_ID', esc_html__("Primary Key of Attached Thing", "event_espresso"), false, 0, $models_this_can_attach_to), |
|
34 | + 'EXM_type' => new EE_Any_Foreign_Model_Name_Field('EXM_type', esc_html__("Model of Attached Thing", "event_espresso"), false, 'Transaction', $models_this_can_attach_to), |
|
35 | + 'EXM_key' => new EE_Plain_Text_Field('EXM_key', esc_html__("Meta Key", "event_espresso"), false, ''), |
|
36 | + 'EXM_value' => new EE_Maybe_Serialized_Text_Field('EXM_value', esc_html__("Meta Value", "event_espresso"), true) |
|
37 | 37 | |
38 | - )); |
|
39 | - $this->_model_relations = array(); |
|
40 | - foreach ($models_this_can_attach_to as $model) { |
|
41 | - $this->_model_relations[ $model ] = new EE_Belongs_To_Any_Relation(); |
|
42 | - } |
|
43 | - foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) { |
|
44 | - $this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta('EXM_key', 'EXM_value'); |
|
45 | - } |
|
46 | - parent::__construct($timezone); |
|
47 | - } |
|
38 | + )); |
|
39 | + $this->_model_relations = array(); |
|
40 | + foreach ($models_this_can_attach_to as $model) { |
|
41 | + $this->_model_relations[ $model ] = new EE_Belongs_To_Any_Relation(); |
|
42 | + } |
|
43 | + foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) { |
|
44 | + $this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta('EXM_key', 'EXM_value'); |
|
45 | + } |
|
46 | + parent::__construct($timezone); |
|
47 | + } |
|
48 | 48 | } |
@@ -284,8 +284,8 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public function get_attendee_field_for_system_question($system_question_string) |
286 | 286 | { |
287 | - return isset($this->_system_question_to_attendee_field_name[ $system_question_string ]) |
|
288 | - ? $this->_system_question_to_attendee_field_name[ $system_question_string ] |
|
287 | + return isset($this->_system_question_to_attendee_field_name[$system_question_string]) |
|
288 | + ? $this->_system_question_to_attendee_field_name[$system_question_string] |
|
289 | 289 | : null; |
290 | 290 | } |
291 | 291 | |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | return false; |
354 | 354 | } |
355 | 355 | $attendee = $this->get_all(array($where_cols_n_values)); |
356 | - if (! empty($attendee)) { |
|
356 | + if ( ! empty($attendee)) { |
|
357 | 357 | return array_shift($attendee); |
358 | 358 | } |
359 | 359 | return false; |
@@ -12,432 +12,432 @@ |
||
12 | 12 | */ |
13 | 13 | class EEM_Attendee extends EEM_CPT_Base |
14 | 14 | { |
15 | - // private instance of the Attendee object |
|
16 | - protected static $_instance = null; |
|
15 | + // private instance of the Attendee object |
|
16 | + protected static $_instance = null; |
|
17 | 17 | |
18 | - /** |
|
19 | - * QST_system for questions are strings not integers now, |
|
20 | - * so these constants are deprecated. |
|
21 | - * Please instead use the EEM_Attendee::system_question_* constants |
|
22 | - * |
|
23 | - * @deprecated |
|
24 | - */ |
|
25 | - const fname_question_id = 1; |
|
18 | + /** |
|
19 | + * QST_system for questions are strings not integers now, |
|
20 | + * so these constants are deprecated. |
|
21 | + * Please instead use the EEM_Attendee::system_question_* constants |
|
22 | + * |
|
23 | + * @deprecated |
|
24 | + */ |
|
25 | + const fname_question_id = 1; |
|
26 | 26 | |
27 | - /** |
|
28 | - * @deprecated |
|
29 | - */ |
|
30 | - const lname_question_id = 2; |
|
27 | + /** |
|
28 | + * @deprecated |
|
29 | + */ |
|
30 | + const lname_question_id = 2; |
|
31 | 31 | |
32 | 32 | |
33 | - /** |
|
34 | - * @deprecated |
|
35 | - */ |
|
36 | - const email_question_id = 3; |
|
33 | + /** |
|
34 | + * @deprecated |
|
35 | + */ |
|
36 | + const email_question_id = 3; |
|
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * @deprecated |
|
41 | - */ |
|
42 | - const address_question_id = 4; |
|
39 | + /** |
|
40 | + * @deprecated |
|
41 | + */ |
|
42 | + const address_question_id = 4; |
|
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * @deprecated |
|
47 | - */ |
|
48 | - const address2_question_id = 5; |
|
45 | + /** |
|
46 | + * @deprecated |
|
47 | + */ |
|
48 | + const address2_question_id = 5; |
|
49 | 49 | |
50 | - |
|
51 | - /** |
|
52 | - * @deprecated |
|
53 | - */ |
|
54 | - const city_question_id = 6; |
|
55 | - |
|
56 | - |
|
57 | - /** |
|
58 | - * @deprecated |
|
59 | - */ |
|
60 | - const state_question_id = 7; |
|
61 | - |
|
62 | - |
|
63 | - /** |
|
64 | - * @deprecated |
|
65 | - */ |
|
66 | - const country_question_id = 8; |
|
67 | - |
|
68 | - |
|
69 | - /** |
|
70 | - * @deprecated |
|
71 | - */ |
|
72 | - const zip_question_id = 9; |
|
73 | - |
|
74 | - |
|
75 | - /** |
|
76 | - * @deprecated |
|
77 | - */ |
|
78 | - const phone_question_id = 10; |
|
79 | - |
|
80 | - /** |
|
81 | - * When looking for questions that correspond to attendee fields, |
|
82 | - * look for the question with this QST_system value. |
|
83 | - * These replace the old constants like EEM_Attendee::*_question_id |
|
84 | - */ |
|
85 | - const system_question_fname = 'fname'; |
|
86 | - |
|
87 | - const system_question_lname = 'lname'; |
|
88 | - |
|
89 | - const system_question_email = 'email'; |
|
90 | - |
|
91 | - const system_question_email_confirm = 'email_confirm'; |
|
92 | - |
|
93 | - const system_question_address = 'address'; |
|
94 | - |
|
95 | - const system_question_address2 = 'address2'; |
|
96 | - |
|
97 | - const system_question_city = 'city'; |
|
98 | - |
|
99 | - const system_question_state = 'state'; |
|
100 | - |
|
101 | - const system_question_country = 'country'; |
|
102 | - |
|
103 | - const system_question_zip = 'zip'; |
|
104 | - |
|
105 | - const system_question_phone = 'phone'; |
|
106 | - |
|
107 | - /** |
|
108 | - * Keys are all the EEM_Attendee::system_question_* constants, which are |
|
109 | - * also all the values of QST_system in the questions table, and values |
|
110 | - * are their corresponding Attendee field names |
|
111 | - * |
|
112 | - * @var array |
|
113 | - */ |
|
114 | - protected $_system_question_to_attendee_field_name = array( |
|
115 | - EEM_Attendee::system_question_fname => 'ATT_fname', |
|
116 | - EEM_Attendee::system_question_lname => 'ATT_lname', |
|
117 | - EEM_Attendee::system_question_email => 'ATT_email', |
|
118 | - EEM_Attendee::system_question_address => 'ATT_address', |
|
119 | - EEM_Attendee::system_question_address2 => 'ATT_address2', |
|
120 | - EEM_Attendee::system_question_city => 'ATT_city', |
|
121 | - EEM_Attendee::system_question_state => 'STA_ID', |
|
122 | - EEM_Attendee::system_question_country => 'CNT_ISO', |
|
123 | - EEM_Attendee::system_question_zip => 'ATT_zip', |
|
124 | - EEM_Attendee::system_question_phone => 'ATT_phone', |
|
125 | - ); |
|
126 | - |
|
127 | - |
|
128 | - |
|
129 | - /** |
|
130 | - * EEM_Attendee constructor. |
|
131 | - * |
|
132 | - * @param null $timezone |
|
133 | - * @param ModelFieldFactory $model_field_factory |
|
134 | - * @throws EE_Error |
|
135 | - * @throws InvalidArgumentException |
|
136 | - */ |
|
137 | - protected function __construct($timezone, ModelFieldFactory $model_field_factory) |
|
138 | - { |
|
139 | - $this->singular_item = esc_html__('Attendee', 'event_espresso'); |
|
140 | - $this->plural_item = esc_html__('Attendees', 'event_espresso'); |
|
141 | - $this->_tables = array( |
|
142 | - 'Attendee_CPT' => new EE_Primary_Table('posts', 'ID'), |
|
143 | - 'Attendee_Meta' => new EE_Secondary_Table( |
|
144 | - 'esp_attendee_meta', |
|
145 | - 'ATTM_ID', |
|
146 | - 'ATT_ID' |
|
147 | - ), |
|
148 | - ); |
|
149 | - $this->_fields = array( |
|
150 | - 'Attendee_CPT' => array( |
|
151 | - 'ATT_ID' => $model_field_factory->createPrimaryKeyIntField( |
|
152 | - 'ID', |
|
153 | - esc_html__('Attendee ID', 'event_espresso') |
|
154 | - ), |
|
155 | - 'ATT_full_name' => $model_field_factory->createPlainTextField( |
|
156 | - 'post_title', |
|
157 | - esc_html__('Attendee Full Name', 'event_espresso'), |
|
158 | - false, |
|
159 | - esc_html__('Unknown', 'event_espresso') |
|
160 | - ), |
|
161 | - 'ATT_bio' => $model_field_factory->createPostContentField( |
|
162 | - 'post_content', |
|
163 | - esc_html__('Attendee Biography', 'event_espresso'), |
|
164 | - false, |
|
165 | - esc_html__('No Biography Provided', 'event_espresso') |
|
166 | - ), |
|
167 | - 'ATT_slug' => $model_field_factory->createSlugField( |
|
168 | - 'post_name', |
|
169 | - esc_html__('Attendee URL Slug', 'event_espresso') |
|
170 | - ), |
|
171 | - 'ATT_created' => $model_field_factory->createDatetimeField( |
|
172 | - 'post_date', |
|
173 | - esc_html__('Time Attendee Created', 'event_espresso') |
|
174 | - ), |
|
175 | - 'ATT_short_bio' => $model_field_factory->createSimpleHtmlField( |
|
176 | - 'post_excerpt', |
|
177 | - esc_html__('Attendee Short Biography', 'event_espresso'), |
|
178 | - true, |
|
179 | - esc_html__('No Biography Provided', 'event_espresso') |
|
180 | - ), |
|
181 | - 'ATT_modified' => $model_field_factory->createDatetimeField( |
|
182 | - 'post_modified', |
|
183 | - esc_html__('Time Attendee Last Modified', 'event_espresso') |
|
184 | - ), |
|
185 | - 'ATT_author' => $model_field_factory->createWpUserField( |
|
186 | - 'post_author', |
|
187 | - esc_html__('Creator ID of the first Event attended', 'event_espresso'), |
|
188 | - false |
|
189 | - ), |
|
190 | - 'ATT_parent' => $model_field_factory->createDbOnlyIntField( |
|
191 | - 'post_parent', |
|
192 | - esc_html__('Parent Attendee (unused)', 'event_espresso'), |
|
193 | - false, |
|
194 | - 0 |
|
195 | - ), |
|
196 | - 'post_type' => $model_field_factory->createWpPostTypeField('espresso_attendees'), |
|
197 | - 'status' => $model_field_factory->createWpPostStatusField( |
|
198 | - 'post_status', |
|
199 | - esc_html__('Attendee Status', 'event_espresso'), |
|
200 | - false, |
|
201 | - 'publish' |
|
202 | - ), |
|
203 | - 'password' => new EE_Password_Field( |
|
204 | - 'post_password', |
|
205 | - esc_html__('Password', 'event_espresso'), |
|
206 | - false, |
|
207 | - '', |
|
208 | - array( |
|
209 | - 'ATT_bio', |
|
210 | - 'ATT_short_bio', |
|
211 | - 'ATT_address', |
|
212 | - 'ATT_address2', |
|
213 | - 'ATT_city', |
|
214 | - 'STA_ID', |
|
215 | - 'CNT_ISO', |
|
216 | - 'ATT_zip', |
|
217 | - 'ATT_email', |
|
218 | - 'ATT_phone' |
|
219 | - ) |
|
220 | - ) |
|
221 | - ), |
|
222 | - 'Attendee_Meta' => array( |
|
223 | - 'ATTM_ID' => $model_field_factory->createDbOnlyIntField( |
|
224 | - 'ATTM_ID', |
|
225 | - esc_html__('Attendee Meta Row ID', 'event_espresso'), |
|
226 | - false |
|
227 | - ), |
|
228 | - 'ATT_ID_fk' => $model_field_factory->createDbOnlyIntField( |
|
229 | - 'ATT_ID', |
|
230 | - esc_html__('Foreign Key to Attendee in Post Table', 'event_espresso'), |
|
231 | - false |
|
232 | - ), |
|
233 | - 'ATT_fname' => $model_field_factory->createPlainTextField( |
|
234 | - 'ATT_fname', |
|
235 | - esc_html__('First Name', 'event_espresso') |
|
236 | - ), |
|
237 | - 'ATT_lname' => $model_field_factory->createPlainTextField( |
|
238 | - 'ATT_lname', |
|
239 | - esc_html__('Last Name', 'event_espresso') |
|
240 | - ), |
|
241 | - 'ATT_address' => $model_field_factory->createPlainTextField( |
|
242 | - 'ATT_address', |
|
243 | - esc_html__('Address Part 1', 'event_espresso') |
|
244 | - ), |
|
245 | - 'ATT_address2' => $model_field_factory->createPlainTextField( |
|
246 | - 'ATT_address2', |
|
247 | - esc_html__('Address Part 2', 'event_espresso') |
|
248 | - ), |
|
249 | - 'ATT_city' => $model_field_factory->createPlainTextField( |
|
250 | - 'ATT_city', |
|
251 | - esc_html__('City', 'event_espresso') |
|
252 | - ), |
|
253 | - 'STA_ID' => $model_field_factory->createForeignKeyIntField( |
|
254 | - 'STA_ID', |
|
255 | - esc_html__('State', 'event_espresso'), |
|
256 | - true, |
|
257 | - 0, |
|
258 | - 'State' |
|
259 | - ), |
|
260 | - 'CNT_ISO' => $model_field_factory->createForeignKeyStringField( |
|
261 | - 'CNT_ISO', |
|
262 | - esc_html__('Country', 'event_espresso'), |
|
263 | - true, |
|
264 | - '', |
|
265 | - 'Country' |
|
266 | - ), |
|
267 | - 'ATT_zip' => $model_field_factory->createPlainTextField( |
|
268 | - 'ATT_zip', |
|
269 | - esc_html__('ZIP/Postal Code', 'event_espresso') |
|
270 | - ), |
|
271 | - 'ATT_email' => $model_field_factory->createEmailField( |
|
272 | - 'ATT_email', |
|
273 | - esc_html__('Email Address', 'event_espresso') |
|
274 | - ), |
|
275 | - 'ATT_phone' => $model_field_factory->createPlainTextField( |
|
276 | - 'ATT_phone', |
|
277 | - esc_html__('Phone', 'event_espresso') |
|
278 | - ), |
|
279 | - ), |
|
280 | - ); |
|
281 | - $this->_model_relations = array( |
|
282 | - 'Registration' => new EE_Has_Many_Relation(), |
|
283 | - 'State' => new EE_Belongs_To_Relation(), |
|
284 | - 'Country' => new EE_Belongs_To_Relation(), |
|
285 | - 'Event' => new EE_HABTM_Relation('Registration', false), |
|
286 | - 'WP_User' => new EE_Belongs_To_Relation(), |
|
287 | - 'Message' => new EE_Has_Many_Any_Relation(false), |
|
288 | - // allow deletion of attendees even if they have messages in the queue for them. |
|
289 | - 'Term_Relationship' => new EE_Has_Many_Relation(), |
|
290 | - 'Term_Taxonomy' => new EE_HABTM_Relation('Term_Relationship'), |
|
291 | - ); |
|
292 | - $this->_caps_slug = 'contacts'; |
|
293 | - $this->model_chain_to_password = ''; |
|
294 | - parent::__construct($timezone); |
|
295 | - } |
|
296 | - |
|
297 | - |
|
298 | - |
|
299 | - /** |
|
300 | - * Gets the name of the field on the attendee model corresponding to the system question string |
|
301 | - * which should be one of the keys from EEM_Attendee::_system_question_to_attendee_field_name |
|
302 | - * |
|
303 | - * @param string $system_question_string |
|
304 | - * @return string|null if not found |
|
305 | - */ |
|
306 | - public function get_attendee_field_for_system_question($system_question_string) |
|
307 | - { |
|
308 | - return isset($this->_system_question_to_attendee_field_name[ $system_question_string ]) |
|
309 | - ? $this->_system_question_to_attendee_field_name[ $system_question_string ] |
|
310 | - : null; |
|
311 | - } |
|
312 | - |
|
313 | - |
|
314 | - |
|
315 | - /** |
|
316 | - * Gets mapping from esp_question.QST_system values to their corresponding attendee field names |
|
317 | - * |
|
318 | - * @return array |
|
319 | - */ |
|
320 | - public function system_question_to_attendee_field_mapping() |
|
321 | - { |
|
322 | - return $this->_system_question_to_attendee_field_name; |
|
323 | - } |
|
324 | - |
|
325 | - |
|
326 | - |
|
327 | - /** |
|
328 | - * Gets all the attendees for a transaction (by using the esp_registration as a join table) |
|
329 | - * |
|
330 | - * @param EE_Transaction /int $transaction_id_or_obj EE_Transaction or its ID |
|
331 | - * @return EE_Attendee[]|EE_Base_Class[] |
|
332 | - * @throws EE_Error |
|
333 | - */ |
|
334 | - public function get_attendees_for_transaction($transaction_id_or_obj) |
|
335 | - { |
|
336 | - return $this->get_all( |
|
337 | - array( |
|
338 | - array( |
|
339 | - 'Registration.Transaction.TXN_ID' => $transaction_id_or_obj instanceof EE_Transaction |
|
340 | - ? $transaction_id_or_obj->ID() |
|
341 | - : $transaction_id_or_obj, |
|
342 | - ), |
|
343 | - ) |
|
344 | - ); |
|
345 | - } |
|
346 | - |
|
347 | - |
|
348 | - |
|
349 | - /** |
|
350 | - * retrieve a single attendee from db via their ID |
|
351 | - * |
|
352 | - * @param $ATT_ID |
|
353 | - * @return mixed array on success, FALSE on fail |
|
354 | - * @deprecated |
|
355 | - */ |
|
356 | - public function get_attendee_by_ID($ATT_ID = false) |
|
357 | - { |
|
358 | - // retrieve a particular EE_Attendee |
|
359 | - return $this->get_one_by_ID($ATT_ID); |
|
360 | - } |
|
361 | - |
|
362 | - |
|
363 | - |
|
364 | - /** |
|
365 | - * retrieve a single attendee from db via their ID |
|
366 | - * |
|
367 | - * @param array $where_cols_n_values |
|
368 | - * @return mixed array on success, FALSE on fail |
|
369 | - * @throws EE_Error |
|
370 | - */ |
|
371 | - public function get_attendee($where_cols_n_values = array()) |
|
372 | - { |
|
373 | - if (empty($where_cols_n_values)) { |
|
374 | - return false; |
|
375 | - } |
|
376 | - $attendee = $this->get_all(array($where_cols_n_values)); |
|
377 | - if (! empty($attendee)) { |
|
378 | - return array_shift($attendee); |
|
379 | - } |
|
380 | - return false; |
|
381 | - } |
|
382 | - |
|
383 | - |
|
384 | - |
|
385 | - /** |
|
386 | - * Search for an existing Attendee record in the DB |
|
387 | - * |
|
388 | - * @param array $where_cols_n_values |
|
389 | - * @return bool|mixed |
|
390 | - * @throws EE_Error |
|
391 | - */ |
|
392 | - public function find_existing_attendee($where_cols_n_values = null) |
|
393 | - { |
|
394 | - // search by combo of first and last names plus the email address |
|
395 | - $attendee_data_keys = array( |
|
396 | - 'ATT_fname' => $this->_ATT_fname, |
|
397 | - 'ATT_lname' => $this->_ATT_lname, |
|
398 | - 'ATT_email' => $this->_ATT_email, |
|
399 | - ); |
|
400 | - // no search params means attendee object already exists. |
|
401 | - $where_cols_n_values = is_array($where_cols_n_values) && ! empty($where_cols_n_values) |
|
402 | - ? $where_cols_n_values |
|
403 | - : $attendee_data_keys; |
|
404 | - $valid_data = true; |
|
405 | - // check for required values |
|
406 | - $valid_data = isset($where_cols_n_values['ATT_fname']) && ! empty($where_cols_n_values['ATT_fname']) |
|
407 | - ? $valid_data |
|
408 | - : false; |
|
409 | - $valid_data = isset($where_cols_n_values['ATT_lname']) && ! empty($where_cols_n_values['ATT_lname']) |
|
410 | - ? $valid_data |
|
411 | - : false; |
|
412 | - $valid_data = isset($where_cols_n_values['ATT_email']) && ! empty($where_cols_n_values['ATT_email']) |
|
413 | - ? $valid_data |
|
414 | - : false; |
|
415 | - if ($valid_data) { |
|
416 | - $attendee = $this->get_attendee($where_cols_n_values); |
|
417 | - if ($attendee instanceof EE_Attendee) { |
|
418 | - return $attendee; |
|
419 | - } |
|
420 | - } |
|
421 | - return false; |
|
422 | - } |
|
423 | - |
|
424 | - |
|
425 | - |
|
426 | - /** |
|
427 | - * Takes an incoming array of EE_Registration ids |
|
428 | - * and sends back a list of corresponding non duplicate EE_Attendee objects. |
|
429 | - * |
|
430 | - * @since 4.3.0 |
|
431 | - * @param array $ids array of EE_Registration ids |
|
432 | - * @return EE_Attendee[]|EE_Base_Class[] |
|
433 | - * @throws EE_Error |
|
434 | - */ |
|
435 | - public function get_array_of_contacts_from_reg_ids($ids) |
|
436 | - { |
|
437 | - $ids = (array) $ids; |
|
438 | - $_where = array( |
|
439 | - 'Registration.REG_ID' => array('in', $ids), |
|
440 | - ); |
|
441 | - return $this->get_all(array($_where)); |
|
442 | - } |
|
50 | + |
|
51 | + /** |
|
52 | + * @deprecated |
|
53 | + */ |
|
54 | + const city_question_id = 6; |
|
55 | + |
|
56 | + |
|
57 | + /** |
|
58 | + * @deprecated |
|
59 | + */ |
|
60 | + const state_question_id = 7; |
|
61 | + |
|
62 | + |
|
63 | + /** |
|
64 | + * @deprecated |
|
65 | + */ |
|
66 | + const country_question_id = 8; |
|
67 | + |
|
68 | + |
|
69 | + /** |
|
70 | + * @deprecated |
|
71 | + */ |
|
72 | + const zip_question_id = 9; |
|
73 | + |
|
74 | + |
|
75 | + /** |
|
76 | + * @deprecated |
|
77 | + */ |
|
78 | + const phone_question_id = 10; |
|
79 | + |
|
80 | + /** |
|
81 | + * When looking for questions that correspond to attendee fields, |
|
82 | + * look for the question with this QST_system value. |
|
83 | + * These replace the old constants like EEM_Attendee::*_question_id |
|
84 | + */ |
|
85 | + const system_question_fname = 'fname'; |
|
86 | + |
|
87 | + const system_question_lname = 'lname'; |
|
88 | + |
|
89 | + const system_question_email = 'email'; |
|
90 | + |
|
91 | + const system_question_email_confirm = 'email_confirm'; |
|
92 | + |
|
93 | + const system_question_address = 'address'; |
|
94 | + |
|
95 | + const system_question_address2 = 'address2'; |
|
96 | + |
|
97 | + const system_question_city = 'city'; |
|
98 | + |
|
99 | + const system_question_state = 'state'; |
|
100 | + |
|
101 | + const system_question_country = 'country'; |
|
102 | + |
|
103 | + const system_question_zip = 'zip'; |
|
104 | + |
|
105 | + const system_question_phone = 'phone'; |
|
106 | + |
|
107 | + /** |
|
108 | + * Keys are all the EEM_Attendee::system_question_* constants, which are |
|
109 | + * also all the values of QST_system in the questions table, and values |
|
110 | + * are their corresponding Attendee field names |
|
111 | + * |
|
112 | + * @var array |
|
113 | + */ |
|
114 | + protected $_system_question_to_attendee_field_name = array( |
|
115 | + EEM_Attendee::system_question_fname => 'ATT_fname', |
|
116 | + EEM_Attendee::system_question_lname => 'ATT_lname', |
|
117 | + EEM_Attendee::system_question_email => 'ATT_email', |
|
118 | + EEM_Attendee::system_question_address => 'ATT_address', |
|
119 | + EEM_Attendee::system_question_address2 => 'ATT_address2', |
|
120 | + EEM_Attendee::system_question_city => 'ATT_city', |
|
121 | + EEM_Attendee::system_question_state => 'STA_ID', |
|
122 | + EEM_Attendee::system_question_country => 'CNT_ISO', |
|
123 | + EEM_Attendee::system_question_zip => 'ATT_zip', |
|
124 | + EEM_Attendee::system_question_phone => 'ATT_phone', |
|
125 | + ); |
|
126 | + |
|
127 | + |
|
128 | + |
|
129 | + /** |
|
130 | + * EEM_Attendee constructor. |
|
131 | + * |
|
132 | + * @param null $timezone |
|
133 | + * @param ModelFieldFactory $model_field_factory |
|
134 | + * @throws EE_Error |
|
135 | + * @throws InvalidArgumentException |
|
136 | + */ |
|
137 | + protected function __construct($timezone, ModelFieldFactory $model_field_factory) |
|
138 | + { |
|
139 | + $this->singular_item = esc_html__('Attendee', 'event_espresso'); |
|
140 | + $this->plural_item = esc_html__('Attendees', 'event_espresso'); |
|
141 | + $this->_tables = array( |
|
142 | + 'Attendee_CPT' => new EE_Primary_Table('posts', 'ID'), |
|
143 | + 'Attendee_Meta' => new EE_Secondary_Table( |
|
144 | + 'esp_attendee_meta', |
|
145 | + 'ATTM_ID', |
|
146 | + 'ATT_ID' |
|
147 | + ), |
|
148 | + ); |
|
149 | + $this->_fields = array( |
|
150 | + 'Attendee_CPT' => array( |
|
151 | + 'ATT_ID' => $model_field_factory->createPrimaryKeyIntField( |
|
152 | + 'ID', |
|
153 | + esc_html__('Attendee ID', 'event_espresso') |
|
154 | + ), |
|
155 | + 'ATT_full_name' => $model_field_factory->createPlainTextField( |
|
156 | + 'post_title', |
|
157 | + esc_html__('Attendee Full Name', 'event_espresso'), |
|
158 | + false, |
|
159 | + esc_html__('Unknown', 'event_espresso') |
|
160 | + ), |
|
161 | + 'ATT_bio' => $model_field_factory->createPostContentField( |
|
162 | + 'post_content', |
|
163 | + esc_html__('Attendee Biography', 'event_espresso'), |
|
164 | + false, |
|
165 | + esc_html__('No Biography Provided', 'event_espresso') |
|
166 | + ), |
|
167 | + 'ATT_slug' => $model_field_factory->createSlugField( |
|
168 | + 'post_name', |
|
169 | + esc_html__('Attendee URL Slug', 'event_espresso') |
|
170 | + ), |
|
171 | + 'ATT_created' => $model_field_factory->createDatetimeField( |
|
172 | + 'post_date', |
|
173 | + esc_html__('Time Attendee Created', 'event_espresso') |
|
174 | + ), |
|
175 | + 'ATT_short_bio' => $model_field_factory->createSimpleHtmlField( |
|
176 | + 'post_excerpt', |
|
177 | + esc_html__('Attendee Short Biography', 'event_espresso'), |
|
178 | + true, |
|
179 | + esc_html__('No Biography Provided', 'event_espresso') |
|
180 | + ), |
|
181 | + 'ATT_modified' => $model_field_factory->createDatetimeField( |
|
182 | + 'post_modified', |
|
183 | + esc_html__('Time Attendee Last Modified', 'event_espresso') |
|
184 | + ), |
|
185 | + 'ATT_author' => $model_field_factory->createWpUserField( |
|
186 | + 'post_author', |
|
187 | + esc_html__('Creator ID of the first Event attended', 'event_espresso'), |
|
188 | + false |
|
189 | + ), |
|
190 | + 'ATT_parent' => $model_field_factory->createDbOnlyIntField( |
|
191 | + 'post_parent', |
|
192 | + esc_html__('Parent Attendee (unused)', 'event_espresso'), |
|
193 | + false, |
|
194 | + 0 |
|
195 | + ), |
|
196 | + 'post_type' => $model_field_factory->createWpPostTypeField('espresso_attendees'), |
|
197 | + 'status' => $model_field_factory->createWpPostStatusField( |
|
198 | + 'post_status', |
|
199 | + esc_html__('Attendee Status', 'event_espresso'), |
|
200 | + false, |
|
201 | + 'publish' |
|
202 | + ), |
|
203 | + 'password' => new EE_Password_Field( |
|
204 | + 'post_password', |
|
205 | + esc_html__('Password', 'event_espresso'), |
|
206 | + false, |
|
207 | + '', |
|
208 | + array( |
|
209 | + 'ATT_bio', |
|
210 | + 'ATT_short_bio', |
|
211 | + 'ATT_address', |
|
212 | + 'ATT_address2', |
|
213 | + 'ATT_city', |
|
214 | + 'STA_ID', |
|
215 | + 'CNT_ISO', |
|
216 | + 'ATT_zip', |
|
217 | + 'ATT_email', |
|
218 | + 'ATT_phone' |
|
219 | + ) |
|
220 | + ) |
|
221 | + ), |
|
222 | + 'Attendee_Meta' => array( |
|
223 | + 'ATTM_ID' => $model_field_factory->createDbOnlyIntField( |
|
224 | + 'ATTM_ID', |
|
225 | + esc_html__('Attendee Meta Row ID', 'event_espresso'), |
|
226 | + false |
|
227 | + ), |
|
228 | + 'ATT_ID_fk' => $model_field_factory->createDbOnlyIntField( |
|
229 | + 'ATT_ID', |
|
230 | + esc_html__('Foreign Key to Attendee in Post Table', 'event_espresso'), |
|
231 | + false |
|
232 | + ), |
|
233 | + 'ATT_fname' => $model_field_factory->createPlainTextField( |
|
234 | + 'ATT_fname', |
|
235 | + esc_html__('First Name', 'event_espresso') |
|
236 | + ), |
|
237 | + 'ATT_lname' => $model_field_factory->createPlainTextField( |
|
238 | + 'ATT_lname', |
|
239 | + esc_html__('Last Name', 'event_espresso') |
|
240 | + ), |
|
241 | + 'ATT_address' => $model_field_factory->createPlainTextField( |
|
242 | + 'ATT_address', |
|
243 | + esc_html__('Address Part 1', 'event_espresso') |
|
244 | + ), |
|
245 | + 'ATT_address2' => $model_field_factory->createPlainTextField( |
|
246 | + 'ATT_address2', |
|
247 | + esc_html__('Address Part 2', 'event_espresso') |
|
248 | + ), |
|
249 | + 'ATT_city' => $model_field_factory->createPlainTextField( |
|
250 | + 'ATT_city', |
|
251 | + esc_html__('City', 'event_espresso') |
|
252 | + ), |
|
253 | + 'STA_ID' => $model_field_factory->createForeignKeyIntField( |
|
254 | + 'STA_ID', |
|
255 | + esc_html__('State', 'event_espresso'), |
|
256 | + true, |
|
257 | + 0, |
|
258 | + 'State' |
|
259 | + ), |
|
260 | + 'CNT_ISO' => $model_field_factory->createForeignKeyStringField( |
|
261 | + 'CNT_ISO', |
|
262 | + esc_html__('Country', 'event_espresso'), |
|
263 | + true, |
|
264 | + '', |
|
265 | + 'Country' |
|
266 | + ), |
|
267 | + 'ATT_zip' => $model_field_factory->createPlainTextField( |
|
268 | + 'ATT_zip', |
|
269 | + esc_html__('ZIP/Postal Code', 'event_espresso') |
|
270 | + ), |
|
271 | + 'ATT_email' => $model_field_factory->createEmailField( |
|
272 | + 'ATT_email', |
|
273 | + esc_html__('Email Address', 'event_espresso') |
|
274 | + ), |
|
275 | + 'ATT_phone' => $model_field_factory->createPlainTextField( |
|
276 | + 'ATT_phone', |
|
277 | + esc_html__('Phone', 'event_espresso') |
|
278 | + ), |
|
279 | + ), |
|
280 | + ); |
|
281 | + $this->_model_relations = array( |
|
282 | + 'Registration' => new EE_Has_Many_Relation(), |
|
283 | + 'State' => new EE_Belongs_To_Relation(), |
|
284 | + 'Country' => new EE_Belongs_To_Relation(), |
|
285 | + 'Event' => new EE_HABTM_Relation('Registration', false), |
|
286 | + 'WP_User' => new EE_Belongs_To_Relation(), |
|
287 | + 'Message' => new EE_Has_Many_Any_Relation(false), |
|
288 | + // allow deletion of attendees even if they have messages in the queue for them. |
|
289 | + 'Term_Relationship' => new EE_Has_Many_Relation(), |
|
290 | + 'Term_Taxonomy' => new EE_HABTM_Relation('Term_Relationship'), |
|
291 | + ); |
|
292 | + $this->_caps_slug = 'contacts'; |
|
293 | + $this->model_chain_to_password = ''; |
|
294 | + parent::__construct($timezone); |
|
295 | + } |
|
296 | + |
|
297 | + |
|
298 | + |
|
299 | + /** |
|
300 | + * Gets the name of the field on the attendee model corresponding to the system question string |
|
301 | + * which should be one of the keys from EEM_Attendee::_system_question_to_attendee_field_name |
|
302 | + * |
|
303 | + * @param string $system_question_string |
|
304 | + * @return string|null if not found |
|
305 | + */ |
|
306 | + public function get_attendee_field_for_system_question($system_question_string) |
|
307 | + { |
|
308 | + return isset($this->_system_question_to_attendee_field_name[ $system_question_string ]) |
|
309 | + ? $this->_system_question_to_attendee_field_name[ $system_question_string ] |
|
310 | + : null; |
|
311 | + } |
|
312 | + |
|
313 | + |
|
314 | + |
|
315 | + /** |
|
316 | + * Gets mapping from esp_question.QST_system values to their corresponding attendee field names |
|
317 | + * |
|
318 | + * @return array |
|
319 | + */ |
|
320 | + public function system_question_to_attendee_field_mapping() |
|
321 | + { |
|
322 | + return $this->_system_question_to_attendee_field_name; |
|
323 | + } |
|
324 | + |
|
325 | + |
|
326 | + |
|
327 | + /** |
|
328 | + * Gets all the attendees for a transaction (by using the esp_registration as a join table) |
|
329 | + * |
|
330 | + * @param EE_Transaction /int $transaction_id_or_obj EE_Transaction or its ID |
|
331 | + * @return EE_Attendee[]|EE_Base_Class[] |
|
332 | + * @throws EE_Error |
|
333 | + */ |
|
334 | + public function get_attendees_for_transaction($transaction_id_or_obj) |
|
335 | + { |
|
336 | + return $this->get_all( |
|
337 | + array( |
|
338 | + array( |
|
339 | + 'Registration.Transaction.TXN_ID' => $transaction_id_or_obj instanceof EE_Transaction |
|
340 | + ? $transaction_id_or_obj->ID() |
|
341 | + : $transaction_id_or_obj, |
|
342 | + ), |
|
343 | + ) |
|
344 | + ); |
|
345 | + } |
|
346 | + |
|
347 | + |
|
348 | + |
|
349 | + /** |
|
350 | + * retrieve a single attendee from db via their ID |
|
351 | + * |
|
352 | + * @param $ATT_ID |
|
353 | + * @return mixed array on success, FALSE on fail |
|
354 | + * @deprecated |
|
355 | + */ |
|
356 | + public function get_attendee_by_ID($ATT_ID = false) |
|
357 | + { |
|
358 | + // retrieve a particular EE_Attendee |
|
359 | + return $this->get_one_by_ID($ATT_ID); |
|
360 | + } |
|
361 | + |
|
362 | + |
|
363 | + |
|
364 | + /** |
|
365 | + * retrieve a single attendee from db via their ID |
|
366 | + * |
|
367 | + * @param array $where_cols_n_values |
|
368 | + * @return mixed array on success, FALSE on fail |
|
369 | + * @throws EE_Error |
|
370 | + */ |
|
371 | + public function get_attendee($where_cols_n_values = array()) |
|
372 | + { |
|
373 | + if (empty($where_cols_n_values)) { |
|
374 | + return false; |
|
375 | + } |
|
376 | + $attendee = $this->get_all(array($where_cols_n_values)); |
|
377 | + if (! empty($attendee)) { |
|
378 | + return array_shift($attendee); |
|
379 | + } |
|
380 | + return false; |
|
381 | + } |
|
382 | + |
|
383 | + |
|
384 | + |
|
385 | + /** |
|
386 | + * Search for an existing Attendee record in the DB |
|
387 | + * |
|
388 | + * @param array $where_cols_n_values |
|
389 | + * @return bool|mixed |
|
390 | + * @throws EE_Error |
|
391 | + */ |
|
392 | + public function find_existing_attendee($where_cols_n_values = null) |
|
393 | + { |
|
394 | + // search by combo of first and last names plus the email address |
|
395 | + $attendee_data_keys = array( |
|
396 | + 'ATT_fname' => $this->_ATT_fname, |
|
397 | + 'ATT_lname' => $this->_ATT_lname, |
|
398 | + 'ATT_email' => $this->_ATT_email, |
|
399 | + ); |
|
400 | + // no search params means attendee object already exists. |
|
401 | + $where_cols_n_values = is_array($where_cols_n_values) && ! empty($where_cols_n_values) |
|
402 | + ? $where_cols_n_values |
|
403 | + : $attendee_data_keys; |
|
404 | + $valid_data = true; |
|
405 | + // check for required values |
|
406 | + $valid_data = isset($where_cols_n_values['ATT_fname']) && ! empty($where_cols_n_values['ATT_fname']) |
|
407 | + ? $valid_data |
|
408 | + : false; |
|
409 | + $valid_data = isset($where_cols_n_values['ATT_lname']) && ! empty($where_cols_n_values['ATT_lname']) |
|
410 | + ? $valid_data |
|
411 | + : false; |
|
412 | + $valid_data = isset($where_cols_n_values['ATT_email']) && ! empty($where_cols_n_values['ATT_email']) |
|
413 | + ? $valid_data |
|
414 | + : false; |
|
415 | + if ($valid_data) { |
|
416 | + $attendee = $this->get_attendee($where_cols_n_values); |
|
417 | + if ($attendee instanceof EE_Attendee) { |
|
418 | + return $attendee; |
|
419 | + } |
|
420 | + } |
|
421 | + return false; |
|
422 | + } |
|
423 | + |
|
424 | + |
|
425 | + |
|
426 | + /** |
|
427 | + * Takes an incoming array of EE_Registration ids |
|
428 | + * and sends back a list of corresponding non duplicate EE_Attendee objects. |
|
429 | + * |
|
430 | + * @since 4.3.0 |
|
431 | + * @param array $ids array of EE_Registration ids |
|
432 | + * @return EE_Attendee[]|EE_Base_Class[] |
|
433 | + * @throws EE_Error |
|
434 | + */ |
|
435 | + public function get_array_of_contacts_from_reg_ids($ids) |
|
436 | + { |
|
437 | + $ids = (array) $ids; |
|
438 | + $_where = array( |
|
439 | + 'Registration.REG_ID' => array('in', $ids), |
|
440 | + ); |
|
441 | + return $this->get_all(array($_where)); |
|
442 | + } |
|
443 | 443 | } |
@@ -59,11 +59,11 @@ |
||
59 | 59 | ); |
60 | 60 | $this->_model_relations = array(); |
61 | 61 | foreach ($models_this_can_attach_to as $model) { |
62 | - $this->_model_relations[ $model ] = new EE_Belongs_To_Relation(); |
|
62 | + $this->_model_relations[$model] = new EE_Belongs_To_Relation(); |
|
63 | 63 | } |
64 | 64 | $this->_wp_core_model = true; |
65 | 65 | foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) { |
66 | - $this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta( |
|
66 | + $this->_cap_restriction_generators[$cap_context] = new EE_Restriction_Generator_Meta( |
|
67 | 67 | 'meta_key', |
68 | 68 | 'meta_value' |
69 | 69 | ); |
@@ -18,56 +18,56 @@ |
||
18 | 18 | */ |
19 | 19 | class EEM_Post_Meta extends EEM_Base |
20 | 20 | { |
21 | - // private instance of the EE_Post_Meta object |
|
22 | - protected static $_instance = null; |
|
21 | + // private instance of the EE_Post_Meta object |
|
22 | + protected static $_instance = null; |
|
23 | 23 | |
24 | 24 | |
25 | 25 | |
26 | - protected function __construct($timezone = null) |
|
27 | - { |
|
28 | - $this->singular_item = esc_html__('Post Meta', 'event_espresso'); |
|
29 | - $this->plural_item = esc_html__('Post Metas', 'event_espresso'); |
|
30 | - $this->_tables = array( |
|
31 | - 'Post_Meta' => new EE_Primary_Table('postmeta', 'meta_id'), |
|
32 | - ); |
|
33 | - $models_this_can_attach_to = array_keys(EE_Registry::instance()->cpt_models()); |
|
34 | - $this->_fields = array( |
|
35 | - 'Post_Meta' => array( |
|
36 | - 'meta_id' => new EE_Primary_Key_Int_Field( |
|
37 | - 'meta_id', |
|
38 | - esc_html__("Meta ID", "event_espresso") |
|
39 | - ), |
|
40 | - 'post_id' => new EE_Foreign_Key_Int_Field( |
|
41 | - 'post_id', |
|
42 | - esc_html__("Primary Key of Post", "event_espresso"), |
|
43 | - false, |
|
44 | - 0, |
|
45 | - $models_this_can_attach_to |
|
46 | - ), |
|
47 | - 'meta_key' => new EE_Plain_Text_Field( |
|
48 | - 'meta_key', |
|
49 | - esc_html__("Meta Key", "event_espresso"), |
|
50 | - false, |
|
51 | - '' |
|
52 | - ), |
|
53 | - 'meta_value' => new EE_Maybe_Serialized_Text_Field( |
|
54 | - 'meta_value', |
|
55 | - esc_html__("Meta Value", "event_espresso"), |
|
56 | - true |
|
57 | - ), |
|
58 | - ), |
|
59 | - ); |
|
60 | - $this->_model_relations = array(); |
|
61 | - foreach ($models_this_can_attach_to as $model) { |
|
62 | - $this->_model_relations[ $model ] = new EE_Belongs_To_Relation(); |
|
63 | - } |
|
64 | - $this->_wp_core_model = true; |
|
65 | - foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) { |
|
66 | - $this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta( |
|
67 | - 'meta_key', |
|
68 | - 'meta_value' |
|
69 | - ); |
|
70 | - } |
|
71 | - parent::__construct($timezone); |
|
72 | - } |
|
26 | + protected function __construct($timezone = null) |
|
27 | + { |
|
28 | + $this->singular_item = esc_html__('Post Meta', 'event_espresso'); |
|
29 | + $this->plural_item = esc_html__('Post Metas', 'event_espresso'); |
|
30 | + $this->_tables = array( |
|
31 | + 'Post_Meta' => new EE_Primary_Table('postmeta', 'meta_id'), |
|
32 | + ); |
|
33 | + $models_this_can_attach_to = array_keys(EE_Registry::instance()->cpt_models()); |
|
34 | + $this->_fields = array( |
|
35 | + 'Post_Meta' => array( |
|
36 | + 'meta_id' => new EE_Primary_Key_Int_Field( |
|
37 | + 'meta_id', |
|
38 | + esc_html__("Meta ID", "event_espresso") |
|
39 | + ), |
|
40 | + 'post_id' => new EE_Foreign_Key_Int_Field( |
|
41 | + 'post_id', |
|
42 | + esc_html__("Primary Key of Post", "event_espresso"), |
|
43 | + false, |
|
44 | + 0, |
|
45 | + $models_this_can_attach_to |
|
46 | + ), |
|
47 | + 'meta_key' => new EE_Plain_Text_Field( |
|
48 | + 'meta_key', |
|
49 | + esc_html__("Meta Key", "event_espresso"), |
|
50 | + false, |
|
51 | + '' |
|
52 | + ), |
|
53 | + 'meta_value' => new EE_Maybe_Serialized_Text_Field( |
|
54 | + 'meta_value', |
|
55 | + esc_html__("Meta Value", "event_espresso"), |
|
56 | + true |
|
57 | + ), |
|
58 | + ), |
|
59 | + ); |
|
60 | + $this->_model_relations = array(); |
|
61 | + foreach ($models_this_can_attach_to as $model) { |
|
62 | + $this->_model_relations[ $model ] = new EE_Belongs_To_Relation(); |
|
63 | + } |
|
64 | + $this->_wp_core_model = true; |
|
65 | + foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) { |
|
66 | + $this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta( |
|
67 | + 'meta_key', |
|
68 | + 'meta_value' |
|
69 | + ); |
|
70 | + } |
|
71 | + parent::__construct($timezone); |
|
72 | + } |
|
73 | 73 | } |