@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
2 | - exit('No direct script access allowed'); |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | require_once(EE_MODELS . 'EEM_Base.model.php'); |
5 | 5 | |
@@ -15,192 +15,192 @@ discard block |
||
15 | 15 | class EEM_Transaction extends EEM_Base |
16 | 16 | { |
17 | 17 | |
18 | - // private instance of the Transaction object |
|
19 | - protected static $_instance; |
|
18 | + // private instance of the Transaction object |
|
19 | + protected static $_instance; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Status ID(STS_ID on esp_status table) to indicate the transaction is complete, |
|
23 | - * but payment is pending. This is the state for transactions where payment is promised |
|
24 | - * from an offline gateway. |
|
25 | - */ |
|
26 | - // const open_status_code = 'TPN'; |
|
21 | + /** |
|
22 | + * Status ID(STS_ID on esp_status table) to indicate the transaction is complete, |
|
23 | + * but payment is pending. This is the state for transactions where payment is promised |
|
24 | + * from an offline gateway. |
|
25 | + */ |
|
26 | + // const open_status_code = 'TPN'; |
|
27 | 27 | |
28 | - /** |
|
29 | - * Status ID(STS_ID on esp_status table) to indicate the transaction failed, |
|
30 | - * either due to a technical reason (server or computer crash during registration), |
|
31 | - * or some other reason that prevent the collection of any useful contact information from any of the registrants |
|
32 | - */ |
|
33 | - const failed_status_code = 'TFL'; |
|
28 | + /** |
|
29 | + * Status ID(STS_ID on esp_status table) to indicate the transaction failed, |
|
30 | + * either due to a technical reason (server or computer crash during registration), |
|
31 | + * or some other reason that prevent the collection of any useful contact information from any of the registrants |
|
32 | + */ |
|
33 | + const failed_status_code = 'TFL'; |
|
34 | 34 | |
35 | - /** |
|
36 | - * Status ID(STS_ID on esp_status table) to indicate the transaction was abandoned, |
|
37 | - * either due to a technical reason (server or computer crash during registration), |
|
38 | - * or due to an abandoned cart after registrant chose not to complete the registration process |
|
39 | - * HOWEVER... |
|
40 | - * an abandoned TXN differs from a failed TXN in that it was able to capture contact information for at least one |
|
41 | - * registrant |
|
42 | - */ |
|
43 | - const abandoned_status_code = 'TAB'; |
|
35 | + /** |
|
36 | + * Status ID(STS_ID on esp_status table) to indicate the transaction was abandoned, |
|
37 | + * either due to a technical reason (server or computer crash during registration), |
|
38 | + * or due to an abandoned cart after registrant chose not to complete the registration process |
|
39 | + * HOWEVER... |
|
40 | + * an abandoned TXN differs from a failed TXN in that it was able to capture contact information for at least one |
|
41 | + * registrant |
|
42 | + */ |
|
43 | + const abandoned_status_code = 'TAB'; |
|
44 | 44 | |
45 | - /** |
|
46 | - * Status ID(STS_ID on esp_status table) to indicate an incomplete transaction, |
|
47 | - * meaning that monies are still owing: TXN_paid < TXN_total |
|
48 | - */ |
|
49 | - const incomplete_status_code = 'TIN'; |
|
45 | + /** |
|
46 | + * Status ID(STS_ID on esp_status table) to indicate an incomplete transaction, |
|
47 | + * meaning that monies are still owing: TXN_paid < TXN_total |
|
48 | + */ |
|
49 | + const incomplete_status_code = 'TIN'; |
|
50 | 50 | |
51 | - /** |
|
52 | - * Status ID (STS_ID on esp_status table) to indicate a complete transaction. |
|
53 | - * meaning that NO monies are owing: TXN_paid == TXN_total |
|
54 | - */ |
|
55 | - const complete_status_code = 'TCM'; |
|
51 | + /** |
|
52 | + * Status ID (STS_ID on esp_status table) to indicate a complete transaction. |
|
53 | + * meaning that NO monies are owing: TXN_paid == TXN_total |
|
54 | + */ |
|
55 | + const complete_status_code = 'TCM'; |
|
56 | 56 | |
57 | - /** |
|
58 | - * Status ID(STS_ID on esp_status table) to indicate the transaction is overpaid. |
|
59 | - * This is the same as complete, but site admins actually owe clients the moneys! TXN_paid > TXN_total |
|
60 | - */ |
|
61 | - const overpaid_status_code = 'TOP'; |
|
57 | + /** |
|
58 | + * Status ID(STS_ID on esp_status table) to indicate the transaction is overpaid. |
|
59 | + * This is the same as complete, but site admins actually owe clients the moneys! TXN_paid > TXN_total |
|
60 | + */ |
|
61 | + const overpaid_status_code = 'TOP'; |
|
62 | 62 | |
63 | 63 | |
64 | - /** |
|
65 | - * private constructor to prevent direct creation |
|
66 | - * |
|
67 | - * @Constructor |
|
68 | - * @access protected |
|
69 | - * |
|
70 | - * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any |
|
71 | - * incoming timezone data that gets saved). Note this just sends the timezone info to the |
|
72 | - * date time model field objects. Default is NULL (and will be assumed using the set |
|
73 | - * timezone in the 'timezone_string' wp option) |
|
74 | - * |
|
75 | - * @return EEM_Transaction |
|
76 | - * @throws \EE_Error |
|
77 | - */ |
|
78 | - protected function __construct($timezone) |
|
79 | - { |
|
80 | - $this->singular_item = __('Transaction', 'event_espresso'); |
|
81 | - $this->plural_item = __('Transactions', 'event_espresso'); |
|
64 | + /** |
|
65 | + * private constructor to prevent direct creation |
|
66 | + * |
|
67 | + * @Constructor |
|
68 | + * @access protected |
|
69 | + * |
|
70 | + * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any |
|
71 | + * incoming timezone data that gets saved). Note this just sends the timezone info to the |
|
72 | + * date time model field objects. Default is NULL (and will be assumed using the set |
|
73 | + * timezone in the 'timezone_string' wp option) |
|
74 | + * |
|
75 | + * @return EEM_Transaction |
|
76 | + * @throws \EE_Error |
|
77 | + */ |
|
78 | + protected function __construct($timezone) |
|
79 | + { |
|
80 | + $this->singular_item = __('Transaction', 'event_espresso'); |
|
81 | + $this->plural_item = __('Transactions', 'event_espresso'); |
|
82 | 82 | |
83 | - $this->_tables = array( |
|
84 | - 'TransactionTable' => new EE_Primary_Table('esp_transaction', 'TXN_ID') |
|
85 | - ); |
|
86 | - $this->_fields = array( |
|
87 | - 'TransactionTable' => array( |
|
88 | - 'TXN_ID' => new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso')), |
|
89 | - 'TXN_timestamp' => new EE_Datetime_Field('TXN_timestamp', |
|
90 | - __('date when transaction was created', 'event_espresso'), false, EE_Datetime_Field::now, |
|
91 | - $timezone), |
|
92 | - 'TXN_total' => new EE_Money_Field('TXN_total', |
|
93 | - __('Total value of Transaction', 'event_espresso'), false, 0), |
|
94 | - 'TXN_paid' => new EE_Money_Field('TXN_paid', |
|
95 | - __('Amount paid towards transaction to date', 'event_espresso'), false, 0), |
|
96 | - 'STS_ID' => new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), |
|
97 | - false, EEM_Transaction::failed_status_code, 'Status'), |
|
98 | - 'TXN_session_data' => new EE_Serialized_Text_Field('TXN_session_data', |
|
99 | - __('Serialized session data', 'event_espresso'), true, ''), |
|
100 | - 'TXN_hash_salt' => new EE_Plain_Text_Field('TXN_hash_salt', |
|
101 | - __('Transaction Hash Salt', 'event_espresso'), true, ''), |
|
102 | - 'PMD_ID' => new EE_Foreign_Key_Int_Field('PMD_ID', |
|
103 | - __("Last Used Payment Method", 'event_espresso'), true, null, 'Payment_Method'), |
|
104 | - 'TXN_reg_steps' => new EE_Serialized_Text_Field('TXN_reg_steps', |
|
105 | - __('Registration Steps', 'event_espresso'), false, array()), |
|
106 | - ) |
|
107 | - ); |
|
108 | - $this->_model_relations = array( |
|
109 | - 'Registration' => new EE_Has_Many_Relation(), |
|
110 | - 'Payment' => new EE_Has_Many_Relation(), |
|
111 | - 'Status' => new EE_Belongs_To_Relation(), |
|
112 | - 'Line_Item' => new EE_Has_Many_Relation(false), |
|
113 | - //you can delete a transaction without needing to delete its line items |
|
114 | - 'Payment_Method' => new EE_Belongs_To_Relation(), |
|
115 | - 'Message' => new EE_Has_Many_Relation() |
|
116 | - ); |
|
117 | - $this->_model_chain_to_wp_user = 'Registration.Event'; |
|
118 | - parent::__construct($timezone); |
|
83 | + $this->_tables = array( |
|
84 | + 'TransactionTable' => new EE_Primary_Table('esp_transaction', 'TXN_ID') |
|
85 | + ); |
|
86 | + $this->_fields = array( |
|
87 | + 'TransactionTable' => array( |
|
88 | + 'TXN_ID' => new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso')), |
|
89 | + 'TXN_timestamp' => new EE_Datetime_Field('TXN_timestamp', |
|
90 | + __('date when transaction was created', 'event_espresso'), false, EE_Datetime_Field::now, |
|
91 | + $timezone), |
|
92 | + 'TXN_total' => new EE_Money_Field('TXN_total', |
|
93 | + __('Total value of Transaction', 'event_espresso'), false, 0), |
|
94 | + 'TXN_paid' => new EE_Money_Field('TXN_paid', |
|
95 | + __('Amount paid towards transaction to date', 'event_espresso'), false, 0), |
|
96 | + 'STS_ID' => new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), |
|
97 | + false, EEM_Transaction::failed_status_code, 'Status'), |
|
98 | + 'TXN_session_data' => new EE_Serialized_Text_Field('TXN_session_data', |
|
99 | + __('Serialized session data', 'event_espresso'), true, ''), |
|
100 | + 'TXN_hash_salt' => new EE_Plain_Text_Field('TXN_hash_salt', |
|
101 | + __('Transaction Hash Salt', 'event_espresso'), true, ''), |
|
102 | + 'PMD_ID' => new EE_Foreign_Key_Int_Field('PMD_ID', |
|
103 | + __("Last Used Payment Method", 'event_espresso'), true, null, 'Payment_Method'), |
|
104 | + 'TXN_reg_steps' => new EE_Serialized_Text_Field('TXN_reg_steps', |
|
105 | + __('Registration Steps', 'event_espresso'), false, array()), |
|
106 | + ) |
|
107 | + ); |
|
108 | + $this->_model_relations = array( |
|
109 | + 'Registration' => new EE_Has_Many_Relation(), |
|
110 | + 'Payment' => new EE_Has_Many_Relation(), |
|
111 | + 'Status' => new EE_Belongs_To_Relation(), |
|
112 | + 'Line_Item' => new EE_Has_Many_Relation(false), |
|
113 | + //you can delete a transaction without needing to delete its line items |
|
114 | + 'Payment_Method' => new EE_Belongs_To_Relation(), |
|
115 | + 'Message' => new EE_Has_Many_Relation() |
|
116 | + ); |
|
117 | + $this->_model_chain_to_wp_user = 'Registration.Event'; |
|
118 | + parent::__construct($timezone); |
|
119 | 119 | |
120 | - } |
|
120 | + } |
|
121 | 121 | |
122 | 122 | |
123 | - /** |
|
124 | - * txn_status_array |
|
125 | - * get list of transaction statuses |
|
126 | - * |
|
127 | - * @access public |
|
128 | - * @return array |
|
129 | - */ |
|
130 | - public static function txn_status_array() |
|
131 | - { |
|
132 | - return apply_filters( |
|
133 | - 'FHEE__EEM_Transaction__txn_status_array', |
|
134 | - array( |
|
135 | - EEM_Transaction::overpaid_status_code, |
|
136 | - EEM_Transaction::complete_status_code, |
|
137 | - EEM_Transaction::incomplete_status_code, |
|
138 | - EEM_Transaction::abandoned_status_code, |
|
139 | - EEM_Transaction::failed_status_code, |
|
140 | - ) |
|
141 | - ); |
|
142 | - } |
|
123 | + /** |
|
124 | + * txn_status_array |
|
125 | + * get list of transaction statuses |
|
126 | + * |
|
127 | + * @access public |
|
128 | + * @return array |
|
129 | + */ |
|
130 | + public static function txn_status_array() |
|
131 | + { |
|
132 | + return apply_filters( |
|
133 | + 'FHEE__EEM_Transaction__txn_status_array', |
|
134 | + array( |
|
135 | + EEM_Transaction::overpaid_status_code, |
|
136 | + EEM_Transaction::complete_status_code, |
|
137 | + EEM_Transaction::incomplete_status_code, |
|
138 | + EEM_Transaction::abandoned_status_code, |
|
139 | + EEM_Transaction::failed_status_code, |
|
140 | + ) |
|
141 | + ); |
|
142 | + } |
|
143 | 143 | |
144 | - /** |
|
145 | - * get the revenue per day for the Transaction Admin page Reports Tab |
|
146 | - * |
|
147 | - * @access public |
|
148 | - * |
|
149 | - * @param string $period |
|
150 | - * |
|
151 | - * @return \stdClass[] |
|
152 | - */ |
|
153 | - public function get_revenue_per_day_report($period = '-1 month') |
|
154 | - { |
|
155 | - $sql_date = $this->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', strtotime($period)), |
|
156 | - 'Y-m-d H:i:s', 'UTC'); |
|
144 | + /** |
|
145 | + * get the revenue per day for the Transaction Admin page Reports Tab |
|
146 | + * |
|
147 | + * @access public |
|
148 | + * |
|
149 | + * @param string $period |
|
150 | + * |
|
151 | + * @return \stdClass[] |
|
152 | + */ |
|
153 | + public function get_revenue_per_day_report($period = '-1 month') |
|
154 | + { |
|
155 | + $sql_date = $this->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', strtotime($period)), |
|
156 | + 'Y-m-d H:i:s', 'UTC'); |
|
157 | 157 | |
158 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'TXN_timestamp'); |
|
158 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'TXN_timestamp'); |
|
159 | 159 | |
160 | - return $this->_get_all_wpdb_results( |
|
161 | - array( |
|
162 | - array( |
|
163 | - 'TXN_timestamp' => array('>=', $sql_date) |
|
164 | - ), |
|
165 | - 'group_by' => 'txnDate', |
|
166 | - 'order_by' => array('TXN_timestamp' => 'ASC') |
|
167 | - ), |
|
168 | - OBJECT, |
|
169 | - array( |
|
170 | - 'txnDate' => array('DATE(' . $query_interval . ')', '%s'), |
|
171 | - 'revenue' => array('SUM(TransactionTable.TXN_paid)', '%d') |
|
172 | - ) |
|
173 | - ); |
|
174 | - } |
|
160 | + return $this->_get_all_wpdb_results( |
|
161 | + array( |
|
162 | + array( |
|
163 | + 'TXN_timestamp' => array('>=', $sql_date) |
|
164 | + ), |
|
165 | + 'group_by' => 'txnDate', |
|
166 | + 'order_by' => array('TXN_timestamp' => 'ASC') |
|
167 | + ), |
|
168 | + OBJECT, |
|
169 | + array( |
|
170 | + 'txnDate' => array('DATE(' . $query_interval . ')', '%s'), |
|
171 | + 'revenue' => array('SUM(TransactionTable.TXN_paid)', '%d') |
|
172 | + ) |
|
173 | + ); |
|
174 | + } |
|
175 | 175 | |
176 | 176 | |
177 | - /** |
|
178 | - * get the revenue per event for the Transaction Admin page Reports Tab |
|
179 | - * |
|
180 | - * @access public |
|
181 | - * |
|
182 | - * @param string $period |
|
183 | - * |
|
184 | - * @throws \EE_Error |
|
185 | - * @return mixed |
|
186 | - */ |
|
187 | - public function get_revenue_per_event_report($period = '-1 month') |
|
188 | - { |
|
189 | - global $wpdb; |
|
190 | - $transaction_table = $wpdb->prefix . 'esp_transaction'; |
|
191 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
192 | - $event_table = $wpdb->posts; |
|
193 | - $payment_table = $wpdb->prefix . 'esp_payment'; |
|
194 | - $sql_date = date('Y-m-d H:i:s', strtotime($period)); |
|
195 | - $approved_payment_status = EEM_Payment::status_id_approved; |
|
196 | - $extra_event_on_join = ''; |
|
197 | - //exclude events not authored by user if permissions in effect |
|
198 | - if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
199 | - $extra_event_on_join = ' AND Event.post_author = ' . get_current_user_id(); |
|
200 | - } |
|
177 | + /** |
|
178 | + * get the revenue per event for the Transaction Admin page Reports Tab |
|
179 | + * |
|
180 | + * @access public |
|
181 | + * |
|
182 | + * @param string $period |
|
183 | + * |
|
184 | + * @throws \EE_Error |
|
185 | + * @return mixed |
|
186 | + */ |
|
187 | + public function get_revenue_per_event_report($period = '-1 month') |
|
188 | + { |
|
189 | + global $wpdb; |
|
190 | + $transaction_table = $wpdb->prefix . 'esp_transaction'; |
|
191 | + $registration_table = $wpdb->prefix . 'esp_registration'; |
|
192 | + $event_table = $wpdb->posts; |
|
193 | + $payment_table = $wpdb->prefix . 'esp_payment'; |
|
194 | + $sql_date = date('Y-m-d H:i:s', strtotime($period)); |
|
195 | + $approved_payment_status = EEM_Payment::status_id_approved; |
|
196 | + $extra_event_on_join = ''; |
|
197 | + //exclude events not authored by user if permissions in effect |
|
198 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
199 | + $extra_event_on_join = ' AND Event.post_author = ' . get_current_user_id(); |
|
200 | + } |
|
201 | 201 | |
202 | - return $wpdb->get_results( |
|
203 | - "SELECT |
|
202 | + return $wpdb->get_results( |
|
203 | + "SELECT |
|
204 | 204 | Transaction_Event.event_name AS event_name, |
205 | 205 | SUM(Transaction_Event.paid) AS revenue |
206 | 206 | FROM |
@@ -220,151 +220,151 @@ discard block |
||
220 | 220 | $extra_event_on_join |
221 | 221 | ) AS Transaction_Event |
222 | 222 | GROUP BY event_name", |
223 | - OBJECT |
|
224 | - ); |
|
225 | - } |
|
223 | + OBJECT |
|
224 | + ); |
|
225 | + } |
|
226 | 226 | |
227 | 227 | |
228 | - /** |
|
229 | - * Gets the current transaction given the reg_url_link, or assumes the reg_url_link is in the |
|
230 | - * $_REQUEST global variable. Either way, tries to find the current transaction (through |
|
231 | - * the registration pointed to by reg_url_link), if not returns null |
|
232 | - * |
|
233 | - * @param string $reg_url_link |
|
234 | - * |
|
235 | - * @return EE_Transaction |
|
236 | - */ |
|
237 | - public function get_transaction_from_reg_url_link($reg_url_link = '') |
|
238 | - { |
|
239 | - return $this->get_one(array( |
|
240 | - array( |
|
241 | - 'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get('e_reg_url_link', |
|
242 | - '') |
|
243 | - ) |
|
244 | - )); |
|
245 | - } |
|
228 | + /** |
|
229 | + * Gets the current transaction given the reg_url_link, or assumes the reg_url_link is in the |
|
230 | + * $_REQUEST global variable. Either way, tries to find the current transaction (through |
|
231 | + * the registration pointed to by reg_url_link), if not returns null |
|
232 | + * |
|
233 | + * @param string $reg_url_link |
|
234 | + * |
|
235 | + * @return EE_Transaction |
|
236 | + */ |
|
237 | + public function get_transaction_from_reg_url_link($reg_url_link = '') |
|
238 | + { |
|
239 | + return $this->get_one(array( |
|
240 | + array( |
|
241 | + 'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get('e_reg_url_link', |
|
242 | + '') |
|
243 | + ) |
|
244 | + )); |
|
245 | + } |
|
246 | 246 | |
247 | 247 | |
248 | - /** |
|
249 | - * Updates the provided EE_Transaction with all the applicable payments |
|
250 | - * (or fetch the EE_Transaction from its ID) |
|
251 | - * |
|
252 | - * @deprecated |
|
253 | - * |
|
254 | - * @param EE_Transaction|int $transaction_obj_or_id |
|
255 | - * @param boolean $save_txn whether or not to save the transaction during this function call |
|
256 | - * |
|
257 | - * @return boolean |
|
258 | - * @throws \EE_Error |
|
259 | - */ |
|
260 | - public function update_based_on_payments($transaction_obj_or_id, $save_txn = true) |
|
261 | - { |
|
262 | - EE_Error::doing_it_wrong( |
|
263 | - __CLASS__ . '::' . __FUNCTION__, |
|
264 | - sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
|
265 | - 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'), |
|
266 | - '4.6.0' |
|
267 | - ); |
|
268 | - /** @type EE_Transaction_Processor $transaction_processor */ |
|
269 | - $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
248 | + /** |
|
249 | + * Updates the provided EE_Transaction with all the applicable payments |
|
250 | + * (or fetch the EE_Transaction from its ID) |
|
251 | + * |
|
252 | + * @deprecated |
|
253 | + * |
|
254 | + * @param EE_Transaction|int $transaction_obj_or_id |
|
255 | + * @param boolean $save_txn whether or not to save the transaction during this function call |
|
256 | + * |
|
257 | + * @return boolean |
|
258 | + * @throws \EE_Error |
|
259 | + */ |
|
260 | + public function update_based_on_payments($transaction_obj_or_id, $save_txn = true) |
|
261 | + { |
|
262 | + EE_Error::doing_it_wrong( |
|
263 | + __CLASS__ . '::' . __FUNCTION__, |
|
264 | + sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
|
265 | + 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'), |
|
266 | + '4.6.0' |
|
267 | + ); |
|
268 | + /** @type EE_Transaction_Processor $transaction_processor */ |
|
269 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
270 | 270 | |
271 | - return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
|
272 | - $this->ensure_is_obj($transaction_obj_or_id) |
|
273 | - ); |
|
274 | - } |
|
271 | + return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
|
272 | + $this->ensure_is_obj($transaction_obj_or_id) |
|
273 | + ); |
|
274 | + } |
|
275 | 275 | |
276 | - /** |
|
277 | - * Deletes "junk" transactions that were probably added by bots. There might be TONS |
|
278 | - * of these, so we are very careful to NOT select (which the models do even when deleting), |
|
279 | - * and so we only use wpdb directly and NOT do any joins. |
|
280 | - * The downside to this approach is that is addons are listening for object deletions |
|
281 | - * on EEM_Base::delete() they won't be notified of this. |
|
282 | - * @global WPDB $wpdb |
|
283 | - * @return mixed |
|
284 | - */ |
|
285 | - public function delete_junk_transactions() |
|
286 | - { |
|
287 | - /** @type WPDB $wpdb */ |
|
288 | - global $wpdb; |
|
289 | - $deleted = false; |
|
290 | - $time_to_leave_alone = apply_filters( |
|
291 | - 'FHEE__EEM_Transaction__delete_junk_transactions__time_to_leave_alone', WEEK_IN_SECONDS |
|
292 | - ); |
|
276 | + /** |
|
277 | + * Deletes "junk" transactions that were probably added by bots. There might be TONS |
|
278 | + * of these, so we are very careful to NOT select (which the models do even when deleting), |
|
279 | + * and so we only use wpdb directly and NOT do any joins. |
|
280 | + * The downside to this approach is that is addons are listening for object deletions |
|
281 | + * on EEM_Base::delete() they won't be notified of this. |
|
282 | + * @global WPDB $wpdb |
|
283 | + * @return mixed |
|
284 | + */ |
|
285 | + public function delete_junk_transactions() |
|
286 | + { |
|
287 | + /** @type WPDB $wpdb */ |
|
288 | + global $wpdb; |
|
289 | + $deleted = false; |
|
290 | + $time_to_leave_alone = apply_filters( |
|
291 | + 'FHEE__EEM_Transaction__delete_junk_transactions__time_to_leave_alone', WEEK_IN_SECONDS |
|
292 | + ); |
|
293 | 293 | |
294 | 294 | |
295 | - /** |
|
296 | - * This allows code to filter the query arguments used for retrieving the transaction IDs to delete. |
|
297 | - * Useful for plugins that want to exclude transactions matching certain query parameters. |
|
298 | - * The query parameters should be in the format accepted by the EEM_Base model queries. |
|
299 | - */ |
|
300 | - $ids_query = apply_filters( |
|
301 | - 'FHEE__EEM_Transaction__delete_junk_transactions__initial_query_args', |
|
302 | - array( |
|
303 | - 0 => array( |
|
304 | - 'STS_ID' => EEM_Transaction::failed_status_code, |
|
305 | - 'TXN_timestamp' => array('<', time() - $time_to_leave_alone) |
|
306 | - ) |
|
307 | - ), |
|
308 | - $time_to_leave_alone |
|
309 | - ); |
|
295 | + /** |
|
296 | + * This allows code to filter the query arguments used for retrieving the transaction IDs to delete. |
|
297 | + * Useful for plugins that want to exclude transactions matching certain query parameters. |
|
298 | + * The query parameters should be in the format accepted by the EEM_Base model queries. |
|
299 | + */ |
|
300 | + $ids_query = apply_filters( |
|
301 | + 'FHEE__EEM_Transaction__delete_junk_transactions__initial_query_args', |
|
302 | + array( |
|
303 | + 0 => array( |
|
304 | + 'STS_ID' => EEM_Transaction::failed_status_code, |
|
305 | + 'TXN_timestamp' => array('<', time() - $time_to_leave_alone) |
|
306 | + ) |
|
307 | + ), |
|
308 | + $time_to_leave_alone |
|
309 | + ); |
|
310 | 310 | |
311 | 311 | |
312 | - /** |
|
313 | - * This filter is for when code needs to filter the list of transaction ids that represent transactions |
|
314 | - * about to be deleted based on some other criteria that isn't easily done via the query args filter. |
|
315 | - */ |
|
316 | - $txn_ids = apply_filters( |
|
317 | - 'FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete', |
|
318 | - EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'), |
|
319 | - $time_to_leave_alone |
|
320 | - ); |
|
321 | - //now that we have the ids to delete |
|
322 | - if ( ! empty($txn_ids) && is_array($txn_ids)) { |
|
323 | - // first, make sure these TXN's are removed the "ee_locked_transactions" array |
|
324 | - EEM_Transaction::unset_locked_transactions($txn_ids); |
|
325 | - // let's get deletin'... |
|
326 | - // Why no wpdb->prepare? Because the data is trusted. |
|
327 | - // We got the ids from the original query to get them FROM |
|
328 | - // the db (which is sanitized) so no need to prepare them again. |
|
329 | - $query = ' |
|
312 | + /** |
|
313 | + * This filter is for when code needs to filter the list of transaction ids that represent transactions |
|
314 | + * about to be deleted based on some other criteria that isn't easily done via the query args filter. |
|
315 | + */ |
|
316 | + $txn_ids = apply_filters( |
|
317 | + 'FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete', |
|
318 | + EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'), |
|
319 | + $time_to_leave_alone |
|
320 | + ); |
|
321 | + //now that we have the ids to delete |
|
322 | + if ( ! empty($txn_ids) && is_array($txn_ids)) { |
|
323 | + // first, make sure these TXN's are removed the "ee_locked_transactions" array |
|
324 | + EEM_Transaction::unset_locked_transactions($txn_ids); |
|
325 | + // let's get deletin'... |
|
326 | + // Why no wpdb->prepare? Because the data is trusted. |
|
327 | + // We got the ids from the original query to get them FROM |
|
328 | + // the db (which is sanitized) so no need to prepare them again. |
|
329 | + $query = ' |
|
330 | 330 | DELETE |
331 | 331 | FROM ' . $this->table() . ' |
332 | 332 | WHERE |
333 | 333 | TXN_ID IN ( ' . implode(",", $txn_ids) . ')'; |
334 | - $deleted = $wpdb->query($query); |
|
335 | - } |
|
336 | - if ($deleted) { |
|
337 | - /** |
|
338 | - * Allows code to do something after the transactions have been deleted. |
|
339 | - */ |
|
340 | - do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids); |
|
341 | - } |
|
334 | + $deleted = $wpdb->query($query); |
|
335 | + } |
|
336 | + if ($deleted) { |
|
337 | + /** |
|
338 | + * Allows code to do something after the transactions have been deleted. |
|
339 | + */ |
|
340 | + do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids); |
|
341 | + } |
|
342 | 342 | |
343 | - return $deleted; |
|
344 | - } |
|
343 | + return $deleted; |
|
344 | + } |
|
345 | 345 | |
346 | 346 | |
347 | - /** |
|
348 | - * @param array $transaction_IDs |
|
349 | - * |
|
350 | - * @return bool |
|
351 | - */ |
|
352 | - public static function unset_locked_transactions(array $transaction_IDs) |
|
353 | - { |
|
354 | - $locked_transactions = get_option('ee_locked_transactions', array()); |
|
355 | - $update = false; |
|
356 | - foreach ($transaction_IDs as $TXN_ID) { |
|
357 | - if (isset($locked_transactions[$TXN_ID])) { |
|
358 | - unset($locked_transactions[$TXN_ID]); |
|
359 | - $update = true; |
|
360 | - } |
|
361 | - } |
|
362 | - if ($update) { |
|
363 | - update_option('ee_locked_transactions', $locked_transactions); |
|
364 | - } |
|
347 | + /** |
|
348 | + * @param array $transaction_IDs |
|
349 | + * |
|
350 | + * @return bool |
|
351 | + */ |
|
352 | + public static function unset_locked_transactions(array $transaction_IDs) |
|
353 | + { |
|
354 | + $locked_transactions = get_option('ee_locked_transactions', array()); |
|
355 | + $update = false; |
|
356 | + foreach ($transaction_IDs as $TXN_ID) { |
|
357 | + if (isset($locked_transactions[$TXN_ID])) { |
|
358 | + unset($locked_transactions[$TXN_ID]); |
|
359 | + $update = true; |
|
360 | + } |
|
361 | + } |
|
362 | + if ($update) { |
|
363 | + update_option('ee_locked_transactions', $locked_transactions); |
|
364 | + } |
|
365 | 365 | |
366 | - return $update; |
|
367 | - } |
|
366 | + return $update; |
|
367 | + } |
|
368 | 368 | |
369 | 369 | |
370 | 370 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
2 | 2 | exit('No direct script access allowed'); |
3 | 3 | } |
4 | -require_once(EE_MODELS . 'EEM_Base.model.php'); |
|
4 | +require_once(EE_MODELS.'EEM_Base.model.php'); |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | __('Registration Steps', 'event_espresso'), false, array()), |
106 | 106 | ) |
107 | 107 | ); |
108 | - $this->_model_relations = array( |
|
108 | + $this->_model_relations = array( |
|
109 | 109 | 'Registration' => new EE_Has_Many_Relation(), |
110 | 110 | 'Payment' => new EE_Has_Many_Relation(), |
111 | 111 | 'Status' => new EE_Belongs_To_Relation(), |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | ), |
168 | 168 | OBJECT, |
169 | 169 | array( |
170 | - 'txnDate' => array('DATE(' . $query_interval . ')', '%s'), |
|
170 | + 'txnDate' => array('DATE('.$query_interval.')', '%s'), |
|
171 | 171 | 'revenue' => array('SUM(TransactionTable.TXN_paid)', '%d') |
172 | 172 | ) |
173 | 173 | ); |
@@ -187,16 +187,16 @@ discard block |
||
187 | 187 | public function get_revenue_per_event_report($period = '-1 month') |
188 | 188 | { |
189 | 189 | global $wpdb; |
190 | - $transaction_table = $wpdb->prefix . 'esp_transaction'; |
|
191 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
190 | + $transaction_table = $wpdb->prefix.'esp_transaction'; |
|
191 | + $registration_table = $wpdb->prefix.'esp_registration'; |
|
192 | 192 | $event_table = $wpdb->posts; |
193 | - $payment_table = $wpdb->prefix . 'esp_payment'; |
|
193 | + $payment_table = $wpdb->prefix.'esp_payment'; |
|
194 | 194 | $sql_date = date('Y-m-d H:i:s', strtotime($period)); |
195 | 195 | $approved_payment_status = EEM_Payment::status_id_approved; |
196 | 196 | $extra_event_on_join = ''; |
197 | 197 | //exclude events not authored by user if permissions in effect |
198 | 198 | if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
199 | - $extra_event_on_join = ' AND Event.post_author = ' . get_current_user_id(); |
|
199 | + $extra_event_on_join = ' AND Event.post_author = '.get_current_user_id(); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | return $wpdb->get_results( |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | public function update_based_on_payments($transaction_obj_or_id, $save_txn = true) |
261 | 261 | { |
262 | 262 | EE_Error::doing_it_wrong( |
263 | - __CLASS__ . '::' . __FUNCTION__, |
|
263 | + __CLASS__.'::'.__FUNCTION__, |
|
264 | 264 | sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
265 | 265 | 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'), |
266 | 266 | '4.6.0' |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | // Why no wpdb->prepare? Because the data is trusted. |
327 | 327 | // We got the ids from the original query to get them FROM |
328 | 328 | // the db (which is sanitized) so no need to prepare them again. |
329 | - $query = ' |
|
329 | + $query = ' |
|
330 | 330 | DELETE |
331 | - FROM ' . $this->table() . ' |
|
331 | + FROM ' . $this->table().' |
|
332 | 332 | WHERE |
333 | - TXN_ID IN ( ' . implode(",", $txn_ids) . ')'; |
|
333 | + TXN_ID IN ( ' . implode(",", $txn_ids).')'; |
|
334 | 334 | $deleted = $wpdb->query($query); |
335 | 335 | } |
336 | 336 | if ($deleted) { |
@@ -33,7 +33,7 @@ |
||
33 | 33 | <?php if ( ! empty($create_link)) : ?> |
34 | 34 | <a class="button button-small" href="<?php echo $create_link; ?>" |
35 | 35 | title="<?php esc_attr_e('This registration shares the contact details for the primary registration in this group. If you\'d like this registration to have its own details, you can do so by clicking this button', |
36 | - 'event_espresso'); ?>"> |
|
36 | + 'event_espresso'); ?>"> |
|
37 | 37 | <span class="ee-icon ee-icon-user-add-new"></span><?php echo $create_label; ?> |
38 | 38 | </a> |
39 | 39 | <?php endif; ?> |
@@ -2,7 +2,7 @@ |
||
2 | 2 | <p class="clearfix"> |
3 | 3 | <span class="admin-side-mbox-label-spn lt-grey-txt float-left"> |
4 | 4 | <?php _e('Name', 'event_espresso'); ?> |
5 | - </span><?php echo $fname . ' ' . $lname; ?> |
|
5 | + </span><?php echo $fname.' '.$lname; ?> |
|
6 | 6 | </p> |
7 | 7 | <p class="clearfix"> |
8 | 8 | <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php _e('Email', 'event_espresso'); ?></span><a |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
4 | - exit('NO direct script access allowed'); |
|
4 | + exit('NO direct script access allowed'); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | /** |
@@ -24,585 +24,585 @@ discard block |
||
24 | 24 | class EE_Messages_Preview_incoming_data extends EE_Messages_incoming_data |
25 | 25 | { |
26 | 26 | |
27 | - //some specific properties we need for this class |
|
28 | - private $_events = array(); |
|
29 | - private $_attendees = array(); |
|
30 | - private $_registrations = array(); |
|
27 | + //some specific properties we need for this class |
|
28 | + private $_events = array(); |
|
29 | + private $_attendees = array(); |
|
30 | + private $_registrations = array(); |
|
31 | 31 | |
32 | 32 | |
33 | - /** |
|
34 | - * For the constructor of this special preview class. We're either looking for an event id or empty data. If we |
|
35 | - * have an event id (or ids) then we'll use that as the source for the "dummy" data. If the data is empty then |
|
36 | - * we'll get the first three published events from the users database and use that as a source. |
|
37 | - * |
|
38 | - * @param array $data |
|
39 | - */ |
|
40 | - public function __construct($data = array()) |
|
41 | - { |
|
42 | - $this->_data = isset($data['event_ids']) ? $data['event_ids'] : array(); |
|
43 | - $this->_setup_attendees_events(); |
|
44 | - parent::__construct($data); |
|
45 | - } |
|
33 | + /** |
|
34 | + * For the constructor of this special preview class. We're either looking for an event id or empty data. If we |
|
35 | + * have an event id (or ids) then we'll use that as the source for the "dummy" data. If the data is empty then |
|
36 | + * we'll get the first three published events from the users database and use that as a source. |
|
37 | + * |
|
38 | + * @param array $data |
|
39 | + */ |
|
40 | + public function __construct($data = array()) |
|
41 | + { |
|
42 | + $this->_data = isset($data['event_ids']) ? $data['event_ids'] : array(); |
|
43 | + $this->_setup_attendees_events(); |
|
44 | + parent::__construct($data); |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * Returns database safe representation of the data later used to when instantiating this object. |
|
50 | - * |
|
51 | - * @param array $data The incoming data to be prepped. |
|
52 | - * |
|
53 | - * @return array The prepped data for db |
|
54 | - */ |
|
55 | - static public function convert_data_for_persistent_storage($data) |
|
56 | - { |
|
57 | - return $data; |
|
58 | - } |
|
48 | + /** |
|
49 | + * Returns database safe representation of the data later used to when instantiating this object. |
|
50 | + * |
|
51 | + * @param array $data The incoming data to be prepped. |
|
52 | + * |
|
53 | + * @return array The prepped data for db |
|
54 | + */ |
|
55 | + static public function convert_data_for_persistent_storage($data) |
|
56 | + { |
|
57 | + return $data; |
|
58 | + } |
|
59 | 59 | |
60 | 60 | |
61 | - /** |
|
62 | - * Data that has been stored in persistent storage that was prepped by _convert_data_for_persistent_storage |
|
63 | - * can be sent into this method and converted back into the format used for instantiating with this data handler. |
|
64 | - * |
|
65 | - * @param array $data |
|
66 | - * |
|
67 | - * @return array |
|
68 | - */ |
|
69 | - static public function convert_data_from_persistent_storage($data) |
|
70 | - { |
|
71 | - return $data; |
|
72 | - } |
|
61 | + /** |
|
62 | + * Data that has been stored in persistent storage that was prepped by _convert_data_for_persistent_storage |
|
63 | + * can be sent into this method and converted back into the format used for instantiating with this data handler. |
|
64 | + * |
|
65 | + * @param array $data |
|
66 | + * |
|
67 | + * @return array |
|
68 | + */ |
|
69 | + static public function convert_data_from_persistent_storage($data) |
|
70 | + { |
|
71 | + return $data; |
|
72 | + } |
|
73 | 73 | |
74 | 74 | |
75 | - /** |
|
76 | - * This will just setup the _events property in the expected format. |
|
77 | - * |
|
78 | - * @throws \EE_Error |
|
79 | - */ |
|
80 | - private function _setup_attendees_events() |
|
81 | - { |
|
82 | - |
|
83 | - //setup some attendee objects |
|
84 | - $attendees = $this->_get_some_attendees(); |
|
85 | - |
|
86 | - //if empty $data we'll do a query to get some events from the server. otherwise we'll retrieve the event data for the given ids. |
|
87 | - $events = $this->_get_some_events($this->_data); |
|
88 | - |
|
89 | - $answers_n_questions = $this->_get_some_q_and_as(); |
|
90 | - |
|
91 | - if (count($events) < 1) { |
|
92 | - throw new EE_Error(__('We can\'t generate a preview for you because there are no active events in your database', |
|
93 | - 'event_espresso')); |
|
94 | - } |
|
95 | - |
|
96 | - |
|
97 | - //now let's loop and set up the _events property. At the same time we'll set up attendee properties. |
|
98 | - |
|
99 | - |
|
100 | - //we'll actually use the generated line_item identifiers for our loop |
|
101 | - $dtts = $tkts = array(); |
|
102 | - foreach ($events as $id => $event) { |
|
103 | - if ( ! $event instanceof EE_Event) { |
|
104 | - continue; |
|
105 | - } |
|
106 | - $this->_events[$id]['ID'] = $id; |
|
107 | - $this->_events[$id]['name'] = $event->get('EVT_name'); |
|
108 | - $datetime = $event->get_first_related('Datetime'); |
|
109 | - $tickets = $datetime instanceof EE_Datetime ? $datetime->get_many_related('Ticket', |
|
110 | - array('default_where_conditions' => 'none')) : array(); |
|
111 | - $this->_events[$id]['event'] = $event; |
|
112 | - $this->_events[$id]['reg_objs'] = array(); |
|
113 | - $this->_events[$id]['tkt_objs'] = $tickets; |
|
114 | - $this->_events[$id]['dtt_objs'] = array(); |
|
75 | + /** |
|
76 | + * This will just setup the _events property in the expected format. |
|
77 | + * |
|
78 | + * @throws \EE_Error |
|
79 | + */ |
|
80 | + private function _setup_attendees_events() |
|
81 | + { |
|
82 | + |
|
83 | + //setup some attendee objects |
|
84 | + $attendees = $this->_get_some_attendees(); |
|
85 | + |
|
86 | + //if empty $data we'll do a query to get some events from the server. otherwise we'll retrieve the event data for the given ids. |
|
87 | + $events = $this->_get_some_events($this->_data); |
|
88 | + |
|
89 | + $answers_n_questions = $this->_get_some_q_and_as(); |
|
90 | + |
|
91 | + if (count($events) < 1) { |
|
92 | + throw new EE_Error(__('We can\'t generate a preview for you because there are no active events in your database', |
|
93 | + 'event_espresso')); |
|
94 | + } |
|
95 | + |
|
96 | + |
|
97 | + //now let's loop and set up the _events property. At the same time we'll set up attendee properties. |
|
98 | + |
|
99 | + |
|
100 | + //we'll actually use the generated line_item identifiers for our loop |
|
101 | + $dtts = $tkts = array(); |
|
102 | + foreach ($events as $id => $event) { |
|
103 | + if ( ! $event instanceof EE_Event) { |
|
104 | + continue; |
|
105 | + } |
|
106 | + $this->_events[$id]['ID'] = $id; |
|
107 | + $this->_events[$id]['name'] = $event->get('EVT_name'); |
|
108 | + $datetime = $event->get_first_related('Datetime'); |
|
109 | + $tickets = $datetime instanceof EE_Datetime ? $datetime->get_many_related('Ticket', |
|
110 | + array('default_where_conditions' => 'none')) : array(); |
|
111 | + $this->_events[$id]['event'] = $event; |
|
112 | + $this->_events[$id]['reg_objs'] = array(); |
|
113 | + $this->_events[$id]['tkt_objs'] = $tickets; |
|
114 | + $this->_events[$id]['dtt_objs'] = array(); |
|
115 | 115 | |
116 | - $dttcache = array(); |
|
117 | - $tkts = array(); |
|
118 | - foreach ($tickets as $ticket) { |
|
119 | - if ( ! $ticket instanceof EE_Ticket) { |
|
120 | - continue; |
|
121 | - } |
|
122 | - $reldatetime = $ticket->datetimes(); |
|
123 | - $tkts[$ticket->ID()] = array(); |
|
124 | - $tkts[$ticket->ID()]['ticket'] = $ticket; |
|
125 | - $tkts[$ticket->ID()]['dtt_objs'] = $reldatetime; |
|
126 | - $tkts[$ticket->ID()]['att_objs'] = $attendees; |
|
127 | - $tkts[$ticket->ID()]['count'] = count($attendees); |
|
128 | - $tkts[$ticket->ID()]['EE_Event'] = $event; |
|
129 | - foreach ($reldatetime as $datetime) { |
|
130 | - if ($datetime instanceof EE_Datetime && ! isset($dtts[$datetime->ID()])) { |
|
131 | - $this->_events[$id]['dtt_objs'][$datetime->ID()] = $datetime; |
|
132 | - $dtts[$datetime->ID()]['datetime'] = $datetime; |
|
133 | - $dtts[$datetime->ID()]['tkt_objs'][] = $ticket; |
|
134 | - $dtts[$datetime->ID()]['evt_objs'][] = $event; |
|
135 | - $dttcache[$datetime->ID()] = $datetime; |
|
136 | - } |
|
137 | - } |
|
138 | - } |
|
116 | + $dttcache = array(); |
|
117 | + $tkts = array(); |
|
118 | + foreach ($tickets as $ticket) { |
|
119 | + if ( ! $ticket instanceof EE_Ticket) { |
|
120 | + continue; |
|
121 | + } |
|
122 | + $reldatetime = $ticket->datetimes(); |
|
123 | + $tkts[$ticket->ID()] = array(); |
|
124 | + $tkts[$ticket->ID()]['ticket'] = $ticket; |
|
125 | + $tkts[$ticket->ID()]['dtt_objs'] = $reldatetime; |
|
126 | + $tkts[$ticket->ID()]['att_objs'] = $attendees; |
|
127 | + $tkts[$ticket->ID()]['count'] = count($attendees); |
|
128 | + $tkts[$ticket->ID()]['EE_Event'] = $event; |
|
129 | + foreach ($reldatetime as $datetime) { |
|
130 | + if ($datetime instanceof EE_Datetime && ! isset($dtts[$datetime->ID()])) { |
|
131 | + $this->_events[$id]['dtt_objs'][$datetime->ID()] = $datetime; |
|
132 | + $dtts[$datetime->ID()]['datetime'] = $datetime; |
|
133 | + $dtts[$datetime->ID()]['tkt_objs'][] = $ticket; |
|
134 | + $dtts[$datetime->ID()]['evt_objs'][] = $event; |
|
135 | + $dttcache[$datetime->ID()] = $datetime; |
|
136 | + } |
|
137 | + } |
|
138 | + } |
|
139 | 139 | |
140 | - $this->_events[$id]['total_attendees'] = count($attendees); |
|
141 | - $this->_events[$id]['att_objs'] = $attendees; |
|
140 | + $this->_events[$id]['total_attendees'] = count($attendees); |
|
141 | + $this->_events[$id]['att_objs'] = $attendees; |
|
142 | 142 | |
143 | - //let's also setup the dummy attendees property! |
|
144 | - foreach ($attendees as $att_key => $attendee) { |
|
145 | - if ( ! $attendee instanceof EE_Attendee) { |
|
146 | - continue; |
|
147 | - } |
|
148 | - $this->_attendees[$att_key]['line_ref'][] = $id; //so later it can be determined what events this attendee registered for! |
|
149 | - $this->_attendees[$att_key]['evt_objs'][] = $event; |
|
150 | - $this->_attendees[$att_key]['att_obj'] = $attendee; |
|
151 | - //$this->_attendees[$att_key]['registration_id'] = 0; |
|
152 | - $this->_attendees[$att_key]['attendee_email'] = $attendee->email(); |
|
153 | - $this->_attendees[$att_key]['tkt_objs'] = $tickets; |
|
154 | - if ($att_key == 999999991) { |
|
155 | - $this->_attendees[$att_key]['ans_objs'][999] = $answers_n_questions['answers'][999]; |
|
156 | - $this->_attendees[$att_key]['ans_objs'][1002] = $answers_n_questions['answers'][1002]; |
|
157 | - $this->_attendees[$att_key]['ans_objs'][1005] = $answers_n_questions['answers'][1005]; |
|
158 | - } elseif ($att_key == 999999992) { |
|
159 | - $this->_attendees[$att_key]['ans_objs'][1000] = $answers_n_questions['answers'][1000]; |
|
160 | - $this->_attendees[$att_key]['ans_objs'][1003] = $answers_n_questions['answers'][1003]; |
|
161 | - $this->_attendees[$att_key]['ans_objs'][1006] = $answers_n_questions['answers'][1006]; |
|
162 | - } elseif ($att_key == 999999993) { |
|
163 | - $this->_attendees[$att_key]['ans_objs'][1001] = $answers_n_questions['answers'][1001]; |
|
164 | - $this->_attendees[$att_key]['ans_objs'][1004] = $answers_n_questions['answers'][1004]; |
|
165 | - $this->_attendees[$att_key]['ans_objs'][1007] = $answers_n_questions['answers'][1007]; |
|
166 | - } |
|
167 | - } |
|
168 | - } |
|
169 | - |
|
170 | - $this->tickets = $tkts; |
|
171 | - $this->datetimes = $dtts; |
|
172 | - $this->answers = $answers_n_questions['answers']; |
|
173 | - $this->questions = $answers_n_questions['questions']; |
|
174 | - $this->total_ticket_count = count($tkts) * count($this->_attendees); |
|
175 | - |
|
176 | - } |
|
143 | + //let's also setup the dummy attendees property! |
|
144 | + foreach ($attendees as $att_key => $attendee) { |
|
145 | + if ( ! $attendee instanceof EE_Attendee) { |
|
146 | + continue; |
|
147 | + } |
|
148 | + $this->_attendees[$att_key]['line_ref'][] = $id; //so later it can be determined what events this attendee registered for! |
|
149 | + $this->_attendees[$att_key]['evt_objs'][] = $event; |
|
150 | + $this->_attendees[$att_key]['att_obj'] = $attendee; |
|
151 | + //$this->_attendees[$att_key]['registration_id'] = 0; |
|
152 | + $this->_attendees[$att_key]['attendee_email'] = $attendee->email(); |
|
153 | + $this->_attendees[$att_key]['tkt_objs'] = $tickets; |
|
154 | + if ($att_key == 999999991) { |
|
155 | + $this->_attendees[$att_key]['ans_objs'][999] = $answers_n_questions['answers'][999]; |
|
156 | + $this->_attendees[$att_key]['ans_objs'][1002] = $answers_n_questions['answers'][1002]; |
|
157 | + $this->_attendees[$att_key]['ans_objs'][1005] = $answers_n_questions['answers'][1005]; |
|
158 | + } elseif ($att_key == 999999992) { |
|
159 | + $this->_attendees[$att_key]['ans_objs'][1000] = $answers_n_questions['answers'][1000]; |
|
160 | + $this->_attendees[$att_key]['ans_objs'][1003] = $answers_n_questions['answers'][1003]; |
|
161 | + $this->_attendees[$att_key]['ans_objs'][1006] = $answers_n_questions['answers'][1006]; |
|
162 | + } elseif ($att_key == 999999993) { |
|
163 | + $this->_attendees[$att_key]['ans_objs'][1001] = $answers_n_questions['answers'][1001]; |
|
164 | + $this->_attendees[$att_key]['ans_objs'][1004] = $answers_n_questions['answers'][1004]; |
|
165 | + $this->_attendees[$att_key]['ans_objs'][1007] = $answers_n_questions['answers'][1007]; |
|
166 | + } |
|
167 | + } |
|
168 | + } |
|
169 | + |
|
170 | + $this->tickets = $tkts; |
|
171 | + $this->datetimes = $dtts; |
|
172 | + $this->answers = $answers_n_questions['answers']; |
|
173 | + $this->questions = $answers_n_questions['questions']; |
|
174 | + $this->total_ticket_count = count($tkts) * count($this->_attendees); |
|
175 | + |
|
176 | + } |
|
177 | 177 | |
178 | 178 | |
179 | - /** |
|
180 | - * This just returns an array of dummy attendee objects that we'll use to attach to events for our preview data |
|
181 | - * |
|
182 | - * @access private |
|
183 | - * @return array an array of attendee objects |
|
184 | - */ |
|
185 | - private function _get_some_attendees() |
|
186 | - { |
|
187 | - //let's just setup a dummy array of various attendee details |
|
188 | - $dummy_attendees = array( |
|
189 | - 0 => array( |
|
190 | - 'Luke', |
|
191 | - 'Skywalker', |
|
192 | - '[email protected]', |
|
193 | - '804 Bantha Dr.', |
|
194 | - 'Complex 8', |
|
195 | - 'Mos Eisley', |
|
196 | - 32, |
|
197 | - 'US', |
|
198 | - 'f0r3e', |
|
199 | - '222-333-4763', |
|
200 | - false, |
|
201 | - '999999991' |
|
202 | - ), |
|
203 | - 1 => array( |
|
204 | - 'Princess', |
|
205 | - 'Leia', |
|
206 | - '[email protected]', |
|
207 | - '1456 Valley Way Boulevard', |
|
208 | - 'Suite 9', |
|
209 | - 'Alderaan', |
|
210 | - 15, |
|
211 | - 'US', |
|
212 | - 'c1h2c', |
|
213 | - '78-123-111-1111', |
|
214 | - false, |
|
215 | - '999999992' |
|
216 | - ), |
|
217 | - 2 => array( |
|
218 | - 'Yoda', |
|
219 | - 'I Am', |
|
220 | - '[email protected]', |
|
221 | - '4th Tree', |
|
222 | - '5th Knot', |
|
223 | - 'Marsh', |
|
224 | - 22, |
|
225 | - 'US', |
|
226 | - 'l18n', |
|
227 | - '999-999-9999', |
|
228 | - false, |
|
229 | - '999999993' |
|
230 | - ), |
|
231 | - ); |
|
232 | - |
|
233 | - //let's generate the attendee objects |
|
234 | - $attendees = array(); |
|
235 | - $var_array = array( |
|
236 | - 'fname', |
|
237 | - 'lname', |
|
238 | - 'email', |
|
239 | - 'address', |
|
240 | - 'address2', |
|
241 | - 'city', |
|
242 | - 'staid', |
|
243 | - 'cntry', |
|
244 | - 'zip', |
|
245 | - 'phone', |
|
246 | - 'deleted', |
|
247 | - 'attid' |
|
248 | - ); |
|
249 | - |
|
250 | - //EE_Registry::instance()->load_class( 'Attendee', array(), FALSE, false, TRUE ); |
|
251 | - foreach ($dummy_attendees as $dummy) { |
|
252 | - $att = array_combine($var_array, $dummy); |
|
253 | - extract($att); |
|
254 | - /** @var $fname string */ |
|
255 | - /** @var $lname string */ |
|
256 | - /** @var $address string */ |
|
257 | - /** @var $address2 string */ |
|
258 | - /** @var $city string */ |
|
259 | - /** @var $staid string */ |
|
260 | - /** @var $cntry string */ |
|
261 | - /** @var $zip string */ |
|
262 | - /** @var $email string */ |
|
263 | - /** @var $phone string */ |
|
264 | - /** @var $attid string */ |
|
265 | - $attendees[$attid] = EE_Attendee::new_instance( |
|
266 | - array( |
|
267 | - 'ATT_fname' => $fname, |
|
268 | - 'ATT_lname' => $lname, |
|
269 | - 'ATT_address' => $address, |
|
270 | - 'ATT_address2' => $address2, |
|
271 | - 'ATT_city' => $city, |
|
272 | - 'STA_ID' => $staid, |
|
273 | - 'CNT_ISO' => $cntry, |
|
274 | - 'ATT_zip' => $zip, |
|
275 | - 'ATT_email' => $email, |
|
276 | - 'ATT_phone' => $phone, |
|
277 | - 'ATT_ID' => $attid |
|
278 | - ) |
|
279 | - ); |
|
280 | - } |
|
281 | - |
|
282 | - return $attendees; |
|
283 | - } |
|
179 | + /** |
|
180 | + * This just returns an array of dummy attendee objects that we'll use to attach to events for our preview data |
|
181 | + * |
|
182 | + * @access private |
|
183 | + * @return array an array of attendee objects |
|
184 | + */ |
|
185 | + private function _get_some_attendees() |
|
186 | + { |
|
187 | + //let's just setup a dummy array of various attendee details |
|
188 | + $dummy_attendees = array( |
|
189 | + 0 => array( |
|
190 | + 'Luke', |
|
191 | + 'Skywalker', |
|
192 | + '[email protected]', |
|
193 | + '804 Bantha Dr.', |
|
194 | + 'Complex 8', |
|
195 | + 'Mos Eisley', |
|
196 | + 32, |
|
197 | + 'US', |
|
198 | + 'f0r3e', |
|
199 | + '222-333-4763', |
|
200 | + false, |
|
201 | + '999999991' |
|
202 | + ), |
|
203 | + 1 => array( |
|
204 | + 'Princess', |
|
205 | + 'Leia', |
|
206 | + '[email protected]', |
|
207 | + '1456 Valley Way Boulevard', |
|
208 | + 'Suite 9', |
|
209 | + 'Alderaan', |
|
210 | + 15, |
|
211 | + 'US', |
|
212 | + 'c1h2c', |
|
213 | + '78-123-111-1111', |
|
214 | + false, |
|
215 | + '999999992' |
|
216 | + ), |
|
217 | + 2 => array( |
|
218 | + 'Yoda', |
|
219 | + 'I Am', |
|
220 | + '[email protected]', |
|
221 | + '4th Tree', |
|
222 | + '5th Knot', |
|
223 | + 'Marsh', |
|
224 | + 22, |
|
225 | + 'US', |
|
226 | + 'l18n', |
|
227 | + '999-999-9999', |
|
228 | + false, |
|
229 | + '999999993' |
|
230 | + ), |
|
231 | + ); |
|
232 | + |
|
233 | + //let's generate the attendee objects |
|
234 | + $attendees = array(); |
|
235 | + $var_array = array( |
|
236 | + 'fname', |
|
237 | + 'lname', |
|
238 | + 'email', |
|
239 | + 'address', |
|
240 | + 'address2', |
|
241 | + 'city', |
|
242 | + 'staid', |
|
243 | + 'cntry', |
|
244 | + 'zip', |
|
245 | + 'phone', |
|
246 | + 'deleted', |
|
247 | + 'attid' |
|
248 | + ); |
|
249 | + |
|
250 | + //EE_Registry::instance()->load_class( 'Attendee', array(), FALSE, false, TRUE ); |
|
251 | + foreach ($dummy_attendees as $dummy) { |
|
252 | + $att = array_combine($var_array, $dummy); |
|
253 | + extract($att); |
|
254 | + /** @var $fname string */ |
|
255 | + /** @var $lname string */ |
|
256 | + /** @var $address string */ |
|
257 | + /** @var $address2 string */ |
|
258 | + /** @var $city string */ |
|
259 | + /** @var $staid string */ |
|
260 | + /** @var $cntry string */ |
|
261 | + /** @var $zip string */ |
|
262 | + /** @var $email string */ |
|
263 | + /** @var $phone string */ |
|
264 | + /** @var $attid string */ |
|
265 | + $attendees[$attid] = EE_Attendee::new_instance( |
|
266 | + array( |
|
267 | + 'ATT_fname' => $fname, |
|
268 | + 'ATT_lname' => $lname, |
|
269 | + 'ATT_address' => $address, |
|
270 | + 'ATT_address2' => $address2, |
|
271 | + 'ATT_city' => $city, |
|
272 | + 'STA_ID' => $staid, |
|
273 | + 'CNT_ISO' => $cntry, |
|
274 | + 'ATT_zip' => $zip, |
|
275 | + 'ATT_email' => $email, |
|
276 | + 'ATT_phone' => $phone, |
|
277 | + 'ATT_ID' => $attid |
|
278 | + ) |
|
279 | + ); |
|
280 | + } |
|
281 | + |
|
282 | + return $attendees; |
|
283 | + } |
|
284 | 284 | |
285 | 285 | |
286 | - /** |
|
287 | - * Return an array of dummy question objects indexed by answer id and dummy answer objects indexed by answer id. |
|
288 | - * This will be used in our dummy data setup |
|
289 | - * @return array |
|
290 | - */ |
|
291 | - private function _get_some_q_and_as() |
|
292 | - { |
|
293 | - |
|
294 | - |
|
295 | - $quests_array = array( |
|
296 | - 0 => array( |
|
297 | - 555, |
|
298 | - __('What is your favorite planet?', 'event_espresso'), |
|
299 | - 0 |
|
300 | - ), |
|
301 | - 1 => array( |
|
302 | - 556, |
|
303 | - __('What is your favorite food?', 'event_espresso'), |
|
304 | - 0 |
|
305 | - ), |
|
306 | - 2 => array( |
|
307 | - 557, |
|
308 | - __('How many lightyears have you travelled', 'event_espresso'), |
|
309 | - 0 |
|
310 | - ) |
|
311 | - ); |
|
312 | - |
|
313 | - |
|
314 | - $ans_array = array( |
|
315 | - 0 => array( |
|
316 | - 999, |
|
317 | - 555, |
|
318 | - 'Tattoine' |
|
319 | - ), |
|
320 | - 1 => array( |
|
321 | - 1000, |
|
322 | - 555, |
|
323 | - 'Alderaan' |
|
324 | - ), |
|
325 | - 2 => array( |
|
326 | - 1001, |
|
327 | - 555, |
|
328 | - 'Dantooine' |
|
329 | - ), |
|
330 | - 3 => array( |
|
331 | - 1002, |
|
332 | - 556, |
|
333 | - 'Fish Fingers' |
|
334 | - ), |
|
335 | - 4 => array( |
|
336 | - 1003, |
|
337 | - 556, |
|
338 | - 'Sushi' |
|
339 | - ), |
|
340 | - 5 => array( |
|
341 | - 1004, |
|
342 | - 556, |
|
343 | - 'Water' |
|
344 | - ), |
|
345 | - 6 => array( |
|
346 | - 1005, |
|
347 | - 557, |
|
348 | - 'A lot', |
|
349 | - ), |
|
350 | - 7 => array( |
|
351 | - 1006, |
|
352 | - 557, |
|
353 | - "That's none of your business." |
|
354 | - ), |
|
355 | - 8 => array( |
|
356 | - 1007, |
|
357 | - 557, |
|
358 | - "People less travel me then." |
|
359 | - ) |
|
360 | - ); |
|
361 | - |
|
362 | - $qst_columns = array('QST_ID', 'QST_display_text', 'QST_system'); |
|
363 | - $ans_columns = array('ANS_ID', 'QST_ID', 'ANS_value'); |
|
364 | - |
|
365 | - //EE_Registry::instance()->load_class( 'Question', array(), FALSE, TRUE, TRUE ); |
|
366 | - //EE_Registry::instance()->load_class( 'Answer', array(), FALSE, TRUE, TRUE ); |
|
367 | - |
|
368 | - $qsts = array(); |
|
369 | - //first the questions |
|
370 | - foreach ($quests_array as $qst) { |
|
371 | - $qstobj = array_combine($qst_columns, $qst); |
|
372 | - $qsts[$qstobj['QST_ID']] = EE_Question::new_instance($qstobj); |
|
373 | - } |
|
374 | - |
|
375 | - //now the answers (and we'll setup our arrays) |
|
376 | - $q_n_as = array(); |
|
377 | - foreach ($ans_array as $ans) { |
|
378 | - $ansobj = array_combine($ans_columns, $ans); |
|
379 | - $ansobj = EE_Answer::new_instance($ansobj); |
|
380 | - $q_n_as['answers'][$ansobj->ID()] = $ansobj; |
|
381 | - $q_n_as['questions'][$ansobj->ID()] = $qsts[$ansobj->get('QST_ID')]; |
|
382 | - } |
|
383 | - |
|
384 | - return $q_n_as; |
|
385 | - |
|
386 | - } |
|
286 | + /** |
|
287 | + * Return an array of dummy question objects indexed by answer id and dummy answer objects indexed by answer id. |
|
288 | + * This will be used in our dummy data setup |
|
289 | + * @return array |
|
290 | + */ |
|
291 | + private function _get_some_q_and_as() |
|
292 | + { |
|
293 | + |
|
294 | + |
|
295 | + $quests_array = array( |
|
296 | + 0 => array( |
|
297 | + 555, |
|
298 | + __('What is your favorite planet?', 'event_espresso'), |
|
299 | + 0 |
|
300 | + ), |
|
301 | + 1 => array( |
|
302 | + 556, |
|
303 | + __('What is your favorite food?', 'event_espresso'), |
|
304 | + 0 |
|
305 | + ), |
|
306 | + 2 => array( |
|
307 | + 557, |
|
308 | + __('How many lightyears have you travelled', 'event_espresso'), |
|
309 | + 0 |
|
310 | + ) |
|
311 | + ); |
|
312 | + |
|
313 | + |
|
314 | + $ans_array = array( |
|
315 | + 0 => array( |
|
316 | + 999, |
|
317 | + 555, |
|
318 | + 'Tattoine' |
|
319 | + ), |
|
320 | + 1 => array( |
|
321 | + 1000, |
|
322 | + 555, |
|
323 | + 'Alderaan' |
|
324 | + ), |
|
325 | + 2 => array( |
|
326 | + 1001, |
|
327 | + 555, |
|
328 | + 'Dantooine' |
|
329 | + ), |
|
330 | + 3 => array( |
|
331 | + 1002, |
|
332 | + 556, |
|
333 | + 'Fish Fingers' |
|
334 | + ), |
|
335 | + 4 => array( |
|
336 | + 1003, |
|
337 | + 556, |
|
338 | + 'Sushi' |
|
339 | + ), |
|
340 | + 5 => array( |
|
341 | + 1004, |
|
342 | + 556, |
|
343 | + 'Water' |
|
344 | + ), |
|
345 | + 6 => array( |
|
346 | + 1005, |
|
347 | + 557, |
|
348 | + 'A lot', |
|
349 | + ), |
|
350 | + 7 => array( |
|
351 | + 1006, |
|
352 | + 557, |
|
353 | + "That's none of your business." |
|
354 | + ), |
|
355 | + 8 => array( |
|
356 | + 1007, |
|
357 | + 557, |
|
358 | + "People less travel me then." |
|
359 | + ) |
|
360 | + ); |
|
361 | + |
|
362 | + $qst_columns = array('QST_ID', 'QST_display_text', 'QST_system'); |
|
363 | + $ans_columns = array('ANS_ID', 'QST_ID', 'ANS_value'); |
|
364 | + |
|
365 | + //EE_Registry::instance()->load_class( 'Question', array(), FALSE, TRUE, TRUE ); |
|
366 | + //EE_Registry::instance()->load_class( 'Answer', array(), FALSE, TRUE, TRUE ); |
|
367 | + |
|
368 | + $qsts = array(); |
|
369 | + //first the questions |
|
370 | + foreach ($quests_array as $qst) { |
|
371 | + $qstobj = array_combine($qst_columns, $qst); |
|
372 | + $qsts[$qstobj['QST_ID']] = EE_Question::new_instance($qstobj); |
|
373 | + } |
|
374 | + |
|
375 | + //now the answers (and we'll setup our arrays) |
|
376 | + $q_n_as = array(); |
|
377 | + foreach ($ans_array as $ans) { |
|
378 | + $ansobj = array_combine($ans_columns, $ans); |
|
379 | + $ansobj = EE_Answer::new_instance($ansobj); |
|
380 | + $q_n_as['answers'][$ansobj->ID()] = $ansobj; |
|
381 | + $q_n_as['questions'][$ansobj->ID()] = $qsts[$ansobj->get('QST_ID')]; |
|
382 | + } |
|
383 | + |
|
384 | + return $q_n_as; |
|
385 | + |
|
386 | + } |
|
387 | 387 | |
388 | 388 | |
389 | - /** |
|
390 | - * Return an array of event objects from the database |
|
391 | - * |
|
392 | - * If event ids are not included then we'll just retrieve the first published event from the database. |
|
393 | - * |
|
394 | - * @param array $event_ids if set, this will be an array of event ids to obtain events for. |
|
395 | - * |
|
396 | - * @return array An array of event objects from the db. |
|
397 | - */ |
|
398 | - private function _get_some_events($event_ids = array()) |
|
399 | - { |
|
400 | - |
|
401 | - //HEY, if we have an evt_id then we want to make sure we use that for the preview (because a specific event template is being viewed); |
|
402 | - $event_ids = isset($_REQUEST['evt_id']) && ! empty($_REQUEST['evt_id']) |
|
403 | - ? array($_REQUEST['evt_id']) |
|
404 | - : $event_ids; |
|
405 | - |
|
406 | - $limit = ! empty($event_ids) |
|
407 | - ? null |
|
408 | - : apply_filters('FHEE__EE_Messages_Preview_incoming_data___get_some_events__limit', '0,1'); |
|
409 | - |
|
410 | - $where = ! empty($event_ids) |
|
411 | - ? array( |
|
412 | - 'EVT_ID' => array('IN', $event_ids), |
|
413 | - 'Datetime.Ticket.TKT_ID' => array('>', 1) |
|
414 | - ) |
|
415 | - : array('Datetime.Ticket.TKT_ID' => array('>', 1)); |
|
416 | - |
|
417 | - $events = EE_Registry::instance()->load_model('Event')->get_all(array($where, 'limit' => $limit)); |
|
418 | - |
|
419 | - return $events; |
|
420 | - } |
|
389 | + /** |
|
390 | + * Return an array of event objects from the database |
|
391 | + * |
|
392 | + * If event ids are not included then we'll just retrieve the first published event from the database. |
|
393 | + * |
|
394 | + * @param array $event_ids if set, this will be an array of event ids to obtain events for. |
|
395 | + * |
|
396 | + * @return array An array of event objects from the db. |
|
397 | + */ |
|
398 | + private function _get_some_events($event_ids = array()) |
|
399 | + { |
|
400 | + |
|
401 | + //HEY, if we have an evt_id then we want to make sure we use that for the preview (because a specific event template is being viewed); |
|
402 | + $event_ids = isset($_REQUEST['evt_id']) && ! empty($_REQUEST['evt_id']) |
|
403 | + ? array($_REQUEST['evt_id']) |
|
404 | + : $event_ids; |
|
405 | + |
|
406 | + $limit = ! empty($event_ids) |
|
407 | + ? null |
|
408 | + : apply_filters('FHEE__EE_Messages_Preview_incoming_data___get_some_events__limit', '0,1'); |
|
409 | + |
|
410 | + $where = ! empty($event_ids) |
|
411 | + ? array( |
|
412 | + 'EVT_ID' => array('IN', $event_ids), |
|
413 | + 'Datetime.Ticket.TKT_ID' => array('>', 1) |
|
414 | + ) |
|
415 | + : array('Datetime.Ticket.TKT_ID' => array('>', 1)); |
|
416 | + |
|
417 | + $events = EE_Registry::instance()->load_model('Event')->get_all(array($where, 'limit' => $limit)); |
|
418 | + |
|
419 | + return $events; |
|
420 | + } |
|
421 | 421 | |
422 | 422 | |
423 | - protected function _setup_data() |
|
424 | - { |
|
425 | - |
|
426 | - //need to figure out the running total for test purposes so... we're going to create a temp cart and add the tickets to it! |
|
427 | - if (EE_Registry::instance()->SSN instanceof EE_Session) { |
|
428 | - EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
429 | - $session = EE_Registry::instance()->SSN; |
|
430 | - } else { |
|
431 | - $session = EE_Registry::instance()->load_core('Session'); |
|
432 | - } |
|
433 | - $cart = EE_Cart::instance(null, $session); |
|
434 | - |
|
435 | - |
|
436 | - //add tickets to cart |
|
437 | - foreach ($this->tickets as $ticket) { |
|
438 | - $cart->add_ticket_to_cart($ticket['ticket']); |
|
439 | - } |
|
440 | - |
|
441 | - |
|
442 | - //setup txn property |
|
443 | - $this->txn = EE_Transaction::new_instance( |
|
444 | - array( |
|
445 | - 'TXN_timestamp' => time(), //unix timestamp |
|
446 | - 'TXN_total' => 0, //txn_total |
|
447 | - 'TXN_paid' => 0, //txn_paid |
|
448 | - 'STS_ID' => EEM_Transaction::incomplete_status_code, //sts_id |
|
449 | - 'TXN_session_data' => null, //dump of txn session object (we're just going to leave blank here) |
|
450 | - 'TXN_hash_salt' => null, //hash salt blank as well |
|
451 | - 'TXN_ID' => 999999 |
|
452 | - ) |
|
453 | - ); |
|
454 | - |
|
455 | - |
|
456 | - //setup reg_objects |
|
457 | - //note we're setting up a reg object for each attendee in each event but ALSO adding to the reg_object array. |
|
458 | - $this->reg_objs = array(); |
|
459 | - $regid = 9999990; |
|
460 | - foreach ($this->_attendees as $key => $attendee) { |
|
461 | - //note we need to setup reg_objects for each event this attendee belongs to |
|
462 | - $regatt = $attendee['att_obj'] instanceof EE_Attendee ? $attendee['att_obj']->ID() : null; |
|
463 | - $regtxn = $this->txn->ID(); |
|
464 | - $regcnt = 1; |
|
465 | - foreach ($attendee['line_ref'] as $evtid) { |
|
466 | - foreach ($this->_events[$evtid]['tkt_objs'] as $ticket) { |
|
467 | - if ( ! $ticket instanceof EE_Ticket) { |
|
468 | - continue; |
|
469 | - } |
|
470 | - $reg_array = array( |
|
471 | - 'EVT_ID' => $evtid, |
|
472 | - 'ATT_ID' => $regatt, |
|
473 | - 'TXN_ID' => $regtxn, |
|
474 | - 'TKT_ID' => $ticket->ID(), |
|
475 | - 'STS_ID' => EEM_Registration::status_id_pending_payment, |
|
476 | - 'REG_date' => time(), |
|
477 | - 'REG_final_price' => $ticket->get('TKT_price'), |
|
478 | - 'REG_session' => 'dummy_session_id', |
|
479 | - 'REG_code' => $regid . '-dummy-generated-code', |
|
480 | - 'REG_url_link' => $regcnt . '-daafpapasdlfakasdfpqasdfasdf', |
|
481 | - 'REG_count' => $regcnt, |
|
482 | - 'REG_group_size' => $this->_events[$evtid]['total_attendees'], |
|
483 | - 'REG_att_is_going' => true, |
|
484 | - 'REG_ID' => $regid |
|
485 | - ); |
|
486 | - $REG_OBJ = EE_Registration::new_instance($reg_array); |
|
487 | - $this->_attendees[$key]['reg_objs'][$regid] = $REG_OBJ; |
|
488 | - $this->_events[$evtid]['reg_objs'][] = $REG_OBJ; |
|
489 | - $this->reg_objs[] = $REG_OBJ; |
|
490 | - $this->tickets[$ticket->ID()]['reg_objs'][$regid] = $REG_OBJ; |
|
423 | + protected function _setup_data() |
|
424 | + { |
|
425 | + |
|
426 | + //need to figure out the running total for test purposes so... we're going to create a temp cart and add the tickets to it! |
|
427 | + if (EE_Registry::instance()->SSN instanceof EE_Session) { |
|
428 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
429 | + $session = EE_Registry::instance()->SSN; |
|
430 | + } else { |
|
431 | + $session = EE_Registry::instance()->load_core('Session'); |
|
432 | + } |
|
433 | + $cart = EE_Cart::instance(null, $session); |
|
434 | + |
|
435 | + |
|
436 | + //add tickets to cart |
|
437 | + foreach ($this->tickets as $ticket) { |
|
438 | + $cart->add_ticket_to_cart($ticket['ticket']); |
|
439 | + } |
|
440 | + |
|
441 | + |
|
442 | + //setup txn property |
|
443 | + $this->txn = EE_Transaction::new_instance( |
|
444 | + array( |
|
445 | + 'TXN_timestamp' => time(), //unix timestamp |
|
446 | + 'TXN_total' => 0, //txn_total |
|
447 | + 'TXN_paid' => 0, //txn_paid |
|
448 | + 'STS_ID' => EEM_Transaction::incomplete_status_code, //sts_id |
|
449 | + 'TXN_session_data' => null, //dump of txn session object (we're just going to leave blank here) |
|
450 | + 'TXN_hash_salt' => null, //hash salt blank as well |
|
451 | + 'TXN_ID' => 999999 |
|
452 | + ) |
|
453 | + ); |
|
454 | + |
|
455 | + |
|
456 | + //setup reg_objects |
|
457 | + //note we're setting up a reg object for each attendee in each event but ALSO adding to the reg_object array. |
|
458 | + $this->reg_objs = array(); |
|
459 | + $regid = 9999990; |
|
460 | + foreach ($this->_attendees as $key => $attendee) { |
|
461 | + //note we need to setup reg_objects for each event this attendee belongs to |
|
462 | + $regatt = $attendee['att_obj'] instanceof EE_Attendee ? $attendee['att_obj']->ID() : null; |
|
463 | + $regtxn = $this->txn->ID(); |
|
464 | + $regcnt = 1; |
|
465 | + foreach ($attendee['line_ref'] as $evtid) { |
|
466 | + foreach ($this->_events[$evtid]['tkt_objs'] as $ticket) { |
|
467 | + if ( ! $ticket instanceof EE_Ticket) { |
|
468 | + continue; |
|
469 | + } |
|
470 | + $reg_array = array( |
|
471 | + 'EVT_ID' => $evtid, |
|
472 | + 'ATT_ID' => $regatt, |
|
473 | + 'TXN_ID' => $regtxn, |
|
474 | + 'TKT_ID' => $ticket->ID(), |
|
475 | + 'STS_ID' => EEM_Registration::status_id_pending_payment, |
|
476 | + 'REG_date' => time(), |
|
477 | + 'REG_final_price' => $ticket->get('TKT_price'), |
|
478 | + 'REG_session' => 'dummy_session_id', |
|
479 | + 'REG_code' => $regid . '-dummy-generated-code', |
|
480 | + 'REG_url_link' => $regcnt . '-daafpapasdlfakasdfpqasdfasdf', |
|
481 | + 'REG_count' => $regcnt, |
|
482 | + 'REG_group_size' => $this->_events[$evtid]['total_attendees'], |
|
483 | + 'REG_att_is_going' => true, |
|
484 | + 'REG_ID' => $regid |
|
485 | + ); |
|
486 | + $REG_OBJ = EE_Registration::new_instance($reg_array); |
|
487 | + $this->_attendees[$key]['reg_objs'][$regid] = $REG_OBJ; |
|
488 | + $this->_events[$evtid]['reg_objs'][] = $REG_OBJ; |
|
489 | + $this->reg_objs[] = $REG_OBJ; |
|
490 | + $this->tickets[$ticket->ID()]['reg_objs'][$regid] = $REG_OBJ; |
|
491 | 491 | |
492 | - $regcnt++; |
|
493 | - $regid++; |
|
494 | - } |
|
495 | - } |
|
496 | - } |
|
497 | - |
|
498 | - |
|
499 | - //setup line items! |
|
500 | - $line_item_total = EEH_Line_Item::create_total_line_item($this->txn); |
|
501 | - |
|
502 | - //add tickets |
|
503 | - foreach ($this->tickets as $tktid => $item) { |
|
504 | - $qty = $item['count']; |
|
505 | - $ticket = $item['ticket']; |
|
506 | - EEH_Line_Item::add_ticket_purchase($line_item_total, $ticket, $qty); |
|
507 | - } |
|
508 | - |
|
509 | - $shipping_line_item = EE_Line_Item::new_instance(array( |
|
510 | - 'LIN_name' => __('Shipping Surcharge', 'event_espresso'), |
|
511 | - 'LIN_desc' => __('Sent via Millenium Falcon', 'event_espresso'), |
|
512 | - 'LIN_unit_price' => 20, |
|
513 | - 'LIN_quantity' => 1, |
|
514 | - 'LIN_is_taxable' => true, |
|
515 | - 'LIN_total' => 20, |
|
516 | - 'LIN_type' => EEM_Line_Item::type_line_item |
|
517 | - )); |
|
518 | - EEH_Line_Item::add_item($line_item_total, $shipping_line_item); |
|
519 | - $this->additional_line_items = array($shipping_line_item); |
|
520 | - |
|
521 | - //now let's add taxes |
|
522 | - EEH_Line_Item::apply_taxes($line_item_total); |
|
523 | - |
|
524 | - //now we should be able to get the items we need from this object |
|
525 | - $event_line_items = EEH_Line_Item::get_pre_tax_subtotal($line_item_total)->children(); |
|
526 | - $line_items = array(); |
|
527 | - foreach ($event_line_items as $line_id => $line_item) { |
|
528 | - if ( ! $line_item instanceof EE_Line_Item || $line_item->OBJ_type() !== 'Event') { |
|
529 | - continue; |
|
530 | - } |
|
531 | - $ticket_line_items = EEH_Line_Item::get_ticket_line_items($line_item); |
|
532 | - foreach ($ticket_line_items as $ticket_line_id => $ticket_line_item) { |
|
533 | - if ( ! $ticket_line_item instanceof EE_Line_Item) { |
|
534 | - continue; |
|
535 | - } |
|
536 | - $this->tickets[$ticket_line_item->OBJ_ID()]['line_item'] = $ticket_line_item; |
|
537 | - $this->tickets[$ticket_line_item->OBJ_ID()]['sub_line_items'] = $ticket_line_item->children(); |
|
538 | - $line_items[$ticket_line_item->ID()]['children'] = $ticket_line_item->children(); |
|
539 | - $line_items[$ticket_line_item->ID()]['EE_Ticket'] = $this->tickets[$ticket_line_item->OBJ_ID()]['ticket']; |
|
540 | - } |
|
541 | - } |
|
542 | - |
|
543 | - $this->line_items_with_children = $line_items; |
|
544 | - $this->tax_line_items = $line_item_total->tax_descendants(); |
|
545 | - |
|
546 | - //add proper total to transaction object. |
|
547 | - $grand_total = $line_item_total->recalculate_total_including_taxes(); |
|
548 | - $this->grand_total_line_item = $line_item_total; |
|
549 | - $this->txn->set_total($grand_total); |
|
550 | - |
|
551 | - |
|
552 | - //add additional details for each registration |
|
553 | - foreach ($this->reg_objs as $reg) { |
|
554 | - if ( ! $reg instanceof EE_Registration) { |
|
555 | - continue; |
|
556 | - } |
|
557 | - $this->_registrations[$reg->ID()]['tkt_obj'] = $this->tickets[$reg->get('TKT_ID')]['ticket']; |
|
558 | - $this->_registrations[$reg->ID()]['evt_obj'] = $this->_events[$reg->get('EVT_ID')]['event']; |
|
559 | - $this->_registrations[$reg->ID()]['reg_obj'] = $reg; |
|
560 | - $this->_registrations[$reg->ID()]['ans_objs'] = $this->_attendees[$reg->get('ATT_ID')]['ans_objs']; |
|
561 | - $this->_registrations[$reg->ID()]['att_obj'] = $this->_attendees[$reg->get('ATT_ID')]['att_obj']; |
|
562 | - $this->_registrations[$reg->ID()]['dtt_objs'] = $this->tickets[$reg->get('TKT_ID')]['dtt_objs']; |
|
563 | - } |
|
564 | - |
|
565 | - |
|
566 | - //events and attendees |
|
567 | - $this->events = $this->_events; |
|
568 | - $this->attendees = $this->_attendees; |
|
569 | - $this->registrations = $this->_registrations; |
|
570 | - |
|
571 | - $attendees_to_shift = $this->_attendees; |
|
572 | - |
|
573 | - //setup primary attendee property |
|
574 | - $this->primary_attendee_data = array( |
|
575 | - 'fname' => $this->_attendees[999999991]['att_obj'] instanceof EE_Attendee |
|
576 | - ? $this->_attendees[999999991]['att_obj']->fname() |
|
577 | - : '', |
|
492 | + $regcnt++; |
|
493 | + $regid++; |
|
494 | + } |
|
495 | + } |
|
496 | + } |
|
497 | + |
|
498 | + |
|
499 | + //setup line items! |
|
500 | + $line_item_total = EEH_Line_Item::create_total_line_item($this->txn); |
|
501 | + |
|
502 | + //add tickets |
|
503 | + foreach ($this->tickets as $tktid => $item) { |
|
504 | + $qty = $item['count']; |
|
505 | + $ticket = $item['ticket']; |
|
506 | + EEH_Line_Item::add_ticket_purchase($line_item_total, $ticket, $qty); |
|
507 | + } |
|
508 | + |
|
509 | + $shipping_line_item = EE_Line_Item::new_instance(array( |
|
510 | + 'LIN_name' => __('Shipping Surcharge', 'event_espresso'), |
|
511 | + 'LIN_desc' => __('Sent via Millenium Falcon', 'event_espresso'), |
|
512 | + 'LIN_unit_price' => 20, |
|
513 | + 'LIN_quantity' => 1, |
|
514 | + 'LIN_is_taxable' => true, |
|
515 | + 'LIN_total' => 20, |
|
516 | + 'LIN_type' => EEM_Line_Item::type_line_item |
|
517 | + )); |
|
518 | + EEH_Line_Item::add_item($line_item_total, $shipping_line_item); |
|
519 | + $this->additional_line_items = array($shipping_line_item); |
|
520 | + |
|
521 | + //now let's add taxes |
|
522 | + EEH_Line_Item::apply_taxes($line_item_total); |
|
523 | + |
|
524 | + //now we should be able to get the items we need from this object |
|
525 | + $event_line_items = EEH_Line_Item::get_pre_tax_subtotal($line_item_total)->children(); |
|
526 | + $line_items = array(); |
|
527 | + foreach ($event_line_items as $line_id => $line_item) { |
|
528 | + if ( ! $line_item instanceof EE_Line_Item || $line_item->OBJ_type() !== 'Event') { |
|
529 | + continue; |
|
530 | + } |
|
531 | + $ticket_line_items = EEH_Line_Item::get_ticket_line_items($line_item); |
|
532 | + foreach ($ticket_line_items as $ticket_line_id => $ticket_line_item) { |
|
533 | + if ( ! $ticket_line_item instanceof EE_Line_Item) { |
|
534 | + continue; |
|
535 | + } |
|
536 | + $this->tickets[$ticket_line_item->OBJ_ID()]['line_item'] = $ticket_line_item; |
|
537 | + $this->tickets[$ticket_line_item->OBJ_ID()]['sub_line_items'] = $ticket_line_item->children(); |
|
538 | + $line_items[$ticket_line_item->ID()]['children'] = $ticket_line_item->children(); |
|
539 | + $line_items[$ticket_line_item->ID()]['EE_Ticket'] = $this->tickets[$ticket_line_item->OBJ_ID()]['ticket']; |
|
540 | + } |
|
541 | + } |
|
542 | + |
|
543 | + $this->line_items_with_children = $line_items; |
|
544 | + $this->tax_line_items = $line_item_total->tax_descendants(); |
|
545 | + |
|
546 | + //add proper total to transaction object. |
|
547 | + $grand_total = $line_item_total->recalculate_total_including_taxes(); |
|
548 | + $this->grand_total_line_item = $line_item_total; |
|
549 | + $this->txn->set_total($grand_total); |
|
550 | + |
|
551 | + |
|
552 | + //add additional details for each registration |
|
553 | + foreach ($this->reg_objs as $reg) { |
|
554 | + if ( ! $reg instanceof EE_Registration) { |
|
555 | + continue; |
|
556 | + } |
|
557 | + $this->_registrations[$reg->ID()]['tkt_obj'] = $this->tickets[$reg->get('TKT_ID')]['ticket']; |
|
558 | + $this->_registrations[$reg->ID()]['evt_obj'] = $this->_events[$reg->get('EVT_ID')]['event']; |
|
559 | + $this->_registrations[$reg->ID()]['reg_obj'] = $reg; |
|
560 | + $this->_registrations[$reg->ID()]['ans_objs'] = $this->_attendees[$reg->get('ATT_ID')]['ans_objs']; |
|
561 | + $this->_registrations[$reg->ID()]['att_obj'] = $this->_attendees[$reg->get('ATT_ID')]['att_obj']; |
|
562 | + $this->_registrations[$reg->ID()]['dtt_objs'] = $this->tickets[$reg->get('TKT_ID')]['dtt_objs']; |
|
563 | + } |
|
564 | + |
|
565 | + |
|
566 | + //events and attendees |
|
567 | + $this->events = $this->_events; |
|
568 | + $this->attendees = $this->_attendees; |
|
569 | + $this->registrations = $this->_registrations; |
|
570 | + |
|
571 | + $attendees_to_shift = $this->_attendees; |
|
572 | + |
|
573 | + //setup primary attendee property |
|
574 | + $this->primary_attendee_data = array( |
|
575 | + 'fname' => $this->_attendees[999999991]['att_obj'] instanceof EE_Attendee |
|
576 | + ? $this->_attendees[999999991]['att_obj']->fname() |
|
577 | + : '', |
|
578 | 578 | |
579 | - 'lname' => $this->_attendees[999999991]['att_obj'] instanceof EE_Attendee |
|
580 | - ? $this->_attendees[999999991]['att_obj']->lname() |
|
581 | - : '', |
|
579 | + 'lname' => $this->_attendees[999999991]['att_obj'] instanceof EE_Attendee |
|
580 | + ? $this->_attendees[999999991]['att_obj']->lname() |
|
581 | + : '', |
|
582 | 582 | |
583 | - 'email' => $this->_attendees[999999991]['att_obj'] instanceof EE_Attendee |
|
584 | - ? $this->_attendees[999999991]['att_obj']->email() |
|
585 | - : '', |
|
583 | + 'email' => $this->_attendees[999999991]['att_obj'] instanceof EE_Attendee |
|
584 | + ? $this->_attendees[999999991]['att_obj']->email() |
|
585 | + : '', |
|
586 | 586 | |
587 | - 'att_obj' => $this->_attendees[999999991]['att_obj'], |
|
587 | + 'att_obj' => $this->_attendees[999999991]['att_obj'], |
|
588 | 588 | |
589 | - 'reg_obj' => array_shift($attendees_to_shift[999999991]['reg_objs']) |
|
590 | - ); |
|
589 | + 'reg_obj' => array_shift($attendees_to_shift[999999991]['reg_objs']) |
|
590 | + ); |
|
591 | 591 | |
592 | - //reg_info property |
|
593 | - //note this isn't referenced by any shortcode parsers so we'll ignore for now. |
|
594 | - $this->reg_info = array(); |
|
592 | + //reg_info property |
|
593 | + //note this isn't referenced by any shortcode parsers so we'll ignore for now. |
|
594 | + $this->reg_info = array(); |
|
595 | 595 | |
596 | - //let's set a reg_obj for messengers expecting one. |
|
597 | - $this->reg_obj = array_pop($this->_attendees[999999991]['reg_objs']); |
|
596 | + //let's set a reg_obj for messengers expecting one. |
|
597 | + $this->reg_obj = array_pop($this->_attendees[999999991]['reg_objs']); |
|
598 | 598 | |
599 | 599 | |
600 | - //the below are just dummy items. |
|
601 | - $this->user_id = 1; |
|
602 | - $this->ip_address = '192.0.2.1'; |
|
603 | - $this->user_agent = ''; |
|
604 | - $this->init_access = time(); |
|
605 | - $this->last_access = time(); |
|
606 | - } |
|
600 | + //the below are just dummy items. |
|
601 | + $this->user_id = 1; |
|
602 | + $this->ip_address = '192.0.2.1'; |
|
603 | + $this->user_agent = ''; |
|
604 | + $this->init_access = time(); |
|
605 | + $this->last_access = time(); |
|
606 | + } |
|
607 | 607 | |
608 | 608 | } //end EE_Messages_Preview_incoming_data class |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | if ( ! $attendee instanceof EE_Attendee) { |
146 | 146 | continue; |
147 | 147 | } |
148 | - $this->_attendees[$att_key]['line_ref'][] = $id; //so later it can be determined what events this attendee registered for! |
|
148 | + $this->_attendees[$att_key]['line_ref'][] = $id; //so later it can be determined what events this attendee registered for! |
|
149 | 149 | $this->_attendees[$att_key]['evt_objs'][] = $event; |
150 | 150 | $this->_attendees[$att_key]['att_obj'] = $attendee; |
151 | 151 | //$this->_attendees[$att_key]['registration_id'] = 0; |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | if ( ! $ticket instanceof EE_Ticket) { |
468 | 468 | continue; |
469 | 469 | } |
470 | - $reg_array = array( |
|
470 | + $reg_array = array( |
|
471 | 471 | 'EVT_ID' => $evtid, |
472 | 472 | 'ATT_ID' => $regatt, |
473 | 473 | 'TXN_ID' => $regtxn, |
@@ -476,8 +476,8 @@ discard block |
||
476 | 476 | 'REG_date' => time(), |
477 | 477 | 'REG_final_price' => $ticket->get('TKT_price'), |
478 | 478 | 'REG_session' => 'dummy_session_id', |
479 | - 'REG_code' => $regid . '-dummy-generated-code', |
|
480 | - 'REG_url_link' => $regcnt . '-daafpapasdlfakasdfpqasdfasdf', |
|
479 | + 'REG_code' => $regid.'-dummy-generated-code', |
|
480 | + 'REG_url_link' => $regcnt.'-daafpapasdlfakasdfpqasdfasdf', |
|
481 | 481 | 'REG_count' => $regcnt, |
482 | 482 | 'REG_group_size' => $this->_events[$evtid]['total_attendees'], |
483 | 483 | 'REG_att_is_going' => true, |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
4 | - exit('NO direct script access allowed'); |
|
4 | + exit('NO direct script access allowed'); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | /** |
@@ -36,82 +36,82 @@ discard block |
||
36 | 36 | { |
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * _init_props |
|
41 | - * |
|
42 | - * @access protected |
|
43 | - * @return void |
|
44 | - */ |
|
45 | - protected function _init_props() |
|
46 | - { |
|
47 | - $this->label = __('Attendee Shortcodes', 'event_espresso'); |
|
48 | - $this->description = __('All shortcodes specific to attendee related data', 'event_espresso'); |
|
49 | - $this->_shortcodes = array( |
|
50 | - '[QUESTION]' => __('Will parse to a question.', 'event_espresso'), |
|
51 | - '[ANSWER]' => __('Will parse to the answer for a question', 'event_espresso') |
|
52 | - ); |
|
53 | - } |
|
39 | + /** |
|
40 | + * _init_props |
|
41 | + * |
|
42 | + * @access protected |
|
43 | + * @return void |
|
44 | + */ |
|
45 | + protected function _init_props() |
|
46 | + { |
|
47 | + $this->label = __('Attendee Shortcodes', 'event_espresso'); |
|
48 | + $this->description = __('All shortcodes specific to attendee related data', 'event_espresso'); |
|
49 | + $this->_shortcodes = array( |
|
50 | + '[QUESTION]' => __('Will parse to a question.', 'event_espresso'), |
|
51 | + '[ANSWER]' => __('Will parse to the answer for a question', 'event_espresso') |
|
52 | + ); |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * This method will give parsing instructions for each shortcode defined in the _shortcodes array. Child methods |
|
58 | - * will have to take care of handling. |
|
59 | - * |
|
60 | - * @access protected |
|
61 | - * |
|
62 | - * @param string $shortcode the shortcode to be parsed. |
|
63 | - * |
|
64 | - * @return string parsed shortcode |
|
65 | - */ |
|
66 | - protected function _parser($shortcode) |
|
67 | - { |
|
56 | + /** |
|
57 | + * This method will give parsing instructions for each shortcode defined in the _shortcodes array. Child methods |
|
58 | + * will have to take care of handling. |
|
59 | + * |
|
60 | + * @access protected |
|
61 | + * |
|
62 | + * @param string $shortcode the shortcode to be parsed. |
|
63 | + * |
|
64 | + * @return string parsed shortcode |
|
65 | + */ |
|
66 | + protected function _parser($shortcode) |
|
67 | + { |
|
68 | 68 | |
69 | - if ( ! $this->_data instanceof EE_Answer || ! isset($this->_extra_data['data']) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
70 | - return ''; |
|
71 | - } |
|
69 | + if ( ! $this->_data instanceof EE_Answer || ! isset($this->_extra_data['data']) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
70 | + return ''; |
|
71 | + } |
|
72 | 72 | |
73 | - switch ($shortcode) { |
|
73 | + switch ($shortcode) { |
|
74 | 74 | |
75 | - case '[QUESTION]' : |
|
76 | - $question = isset($this->_extra_data['data']->questions[$this->_data->ID()]) ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question(); |
|
77 | - if ( ! $question instanceof EE_Question) { |
|
78 | - return ''; //get out because we can't figure out what the question is. |
|
79 | - } |
|
75 | + case '[QUESTION]' : |
|
76 | + $question = isset($this->_extra_data['data']->questions[$this->_data->ID()]) ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question(); |
|
77 | + if ( ! $question instanceof EE_Question) { |
|
78 | + return ''; //get out because we can't figure out what the question is. |
|
79 | + } |
|
80 | 80 | |
81 | - return $question->get_pretty('QST_display_text', 'no_wpautop'); |
|
82 | - break; |
|
81 | + return $question->get_pretty('QST_display_text', 'no_wpautop'); |
|
82 | + break; |
|
83 | 83 | |
84 | - case '[ANSWER]' : |
|
85 | - //need to get the question to determine the type of question (some questions require translation of the answer). |
|
86 | - $question = isset($this->_extra_data['data']->questions[$this->_data->ID()]) ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question(); |
|
87 | - if ( ! $question instanceof EE_Question) { |
|
88 | - return ''; //get out cause we can't figure out what the question type is! |
|
89 | - } |
|
84 | + case '[ANSWER]' : |
|
85 | + //need to get the question to determine the type of question (some questions require translation of the answer). |
|
86 | + $question = isset($this->_extra_data['data']->questions[$this->_data->ID()]) ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question(); |
|
87 | + if ( ! $question instanceof EE_Question) { |
|
88 | + return ''; //get out cause we can't figure out what the question type is! |
|
89 | + } |
|
90 | 90 | |
91 | - //what we show for the answer depends on the question type! |
|
92 | - switch ($question->get('QST_type')) { |
|
91 | + //what we show for the answer depends on the question type! |
|
92 | + switch ($question->get('QST_type')) { |
|
93 | 93 | |
94 | - case 'STATE' : |
|
95 | - $state = EEM_State::instance()->get_one_by_ID($this->_data->get('ANS_value')); |
|
96 | - $answer = $state instanceof EE_State ? $state->name() : ''; |
|
97 | - break; |
|
94 | + case 'STATE' : |
|
95 | + $state = EEM_State::instance()->get_one_by_ID($this->_data->get('ANS_value')); |
|
96 | + $answer = $state instanceof EE_State ? $state->name() : ''; |
|
97 | + break; |
|
98 | 98 | |
99 | - case 'COUNTRY' : |
|
100 | - $country = EEM_Country::instance()->get_one_by_ID($this->_data->get('ANS_value')); |
|
101 | - $answer = $country instanceof EE_Country ? $country->name() : ''; |
|
102 | - break; |
|
99 | + case 'COUNTRY' : |
|
100 | + $country = EEM_Country::instance()->get_one_by_ID($this->_data->get('ANS_value')); |
|
101 | + $answer = $country instanceof EE_Country ? $country->name() : ''; |
|
102 | + break; |
|
103 | 103 | |
104 | - default : |
|
105 | - $answer = $this->_data->get_pretty('ANS_value', 'no_wpautop'); |
|
106 | - break; |
|
107 | - } |
|
104 | + default : |
|
105 | + $answer = $this->_data->get_pretty('ANS_value', 'no_wpautop'); |
|
106 | + break; |
|
107 | + } |
|
108 | 108 | |
109 | - return $answer; |
|
110 | - break; |
|
109 | + return $answer; |
|
110 | + break; |
|
111 | 111 | |
112 | - } |
|
112 | + } |
|
113 | 113 | |
114 | - return ''; |
|
115 | - } |
|
114 | + return ''; |
|
115 | + } |
|
116 | 116 | |
117 | 117 | } //end EE_Question_Shortcodes class |
@@ -91,7 +91,7 @@ |
||
91 | 91 | * |
92 | 92 | * @param array $dir_ref original array of paths |
93 | 93 | * |
94 | - * @return array appended paths |
|
94 | + * @return string[] appended paths |
|
95 | 95 | */ |
96 | 96 | public function messages_autoload_paths($dir_ref) |
97 | 97 | { |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @since 4.3.2 |
8 | 8 | */ |
9 | 9 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
10 | - exit('No direct script access allowed'); |
|
10 | + exit('No direct script access allowed'); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | /** |
@@ -22,651 +22,651 @@ discard block |
||
22 | 22 | { |
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * constructor. |
|
27 | - */ |
|
28 | - public function __construct() |
|
29 | - { |
|
30 | - $this->_caf_hooks(); |
|
31 | - } |
|
32 | - |
|
33 | - |
|
34 | - /** |
|
35 | - * Contains all the hooks filters for setting up caffeinated messages functionality. |
|
36 | - * |
|
37 | - * @since 4.3.2 |
|
38 | - * |
|
39 | - * @return void |
|
40 | - */ |
|
41 | - private function _caf_hooks() |
|
42 | - { |
|
43 | - add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array($this, 'messages_autoload_paths'), 5); |
|
44 | - add_filter('FHEE__EE_Email_messenger__get_validator_config', array($this, 'email_messenger_validator_config'), |
|
45 | - 5, 2); |
|
46 | - add_filter('FHEE__EE_Email_messenger__get_template_fields', array($this, 'email_messenger_template_fields'), 5, |
|
47 | - 2); |
|
48 | - add_filter('FHEE__EE_Html_messenger__get_template_fields', array($this, 'html_messenger_template_fields'), 5, |
|
49 | - 2); |
|
50 | - add_filter('FHEE__EE_Html_messenger__get_validator_config', array($this, 'html_messenger_validator_config'), 5, |
|
51 | - 2); |
|
52 | - add_filter('FHEE__EE_Pdf_messenger__get_template_fields', array($this, 'pdf_messenger_template_fields'), 5, 2); |
|
53 | - add_filter('FHEE__EE_Pdf_messenger__get_validator_config', array($this, 'pdf_messenger_validator_config'), 5, |
|
54 | - 2); |
|
55 | - add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', |
|
56 | - array($this, 'new_default_templates'), 5, 7); |
|
57 | - add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', array($this, 'message_types_valid_shortcodes'), 5, |
|
58 | - 2); |
|
59 | - |
|
60 | - //shortcode parsers |
|
61 | - add_filter('FHEE__EE_Attendee_Shortcodes__shortcodes', array($this, 'additional_attendee_shortcodes'), 5, 2); |
|
62 | - add_filter('FHEE__EE_Attendee_Shortcodes__parser_after', array($this, 'additional_attendee_parser'), 5, 5); |
|
63 | - add_filter('FHEE__EE_Recipient_List_Shortcodes__shortcodes', |
|
64 | - array($this, 'additional_recipient_details_shortcodes'), 5, 2); |
|
65 | - add_filter('FHEE__EE_Recipient_List_Shortcodes__parser_after', |
|
66 | - array($this, 'additional_recipient_details_parser'), 5, 5); |
|
67 | - add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__shortcodes', |
|
68 | - array($this, 'additional_primary_registration_details_shortcodes'), 5, 2); |
|
69 | - add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__parser_after', |
|
70 | - array($this, 'additional_primary_registration_details_parser'), 5, 5); |
|
71 | - |
|
72 | - /** |
|
73 | - * @since 4.2.0 |
|
74 | - */ |
|
75 | - add_filter('FHEE__EE_Datetime_Shortcodes__shortcodes', array($this, 'additional_datetime_shortcodes'), 10, 2); |
|
76 | - add_filter('FHEE__EE_Datetime_Shortcodes__parser_after', array($this, 'additional_datetime_parser'), 10, 5); |
|
77 | - |
|
78 | - /** |
|
79 | - * @since 4.3.0 |
|
80 | - */ |
|
81 | - //eat our own dog food! |
|
82 | - add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_message_types')); |
|
83 | - add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_shortcodes')); |
|
84 | - do_action('EE_Brewing_Regular___messages_caf'); |
|
85 | - } |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * This just allows us to add additional paths to the autoloader (EED_Messages::autoload_messages()) for the |
|
90 | - * messages system. |
|
91 | - * |
|
92 | - * @param array $dir_ref original array of paths |
|
93 | - * |
|
94 | - * @return array appended paths |
|
95 | - */ |
|
96 | - public function messages_autoload_paths($dir_ref) |
|
97 | - { |
|
98 | - $dir_ref[] = EE_CAF_LIBRARIES . 'shortcodes/'; |
|
99 | - |
|
100 | - return $dir_ref; |
|
101 | - } |
|
102 | - |
|
103 | - |
|
104 | - public function email_messenger_validator_config($validator_config, EE_Email_messenger $messenger) |
|
105 | - { |
|
106 | - $validator_config['attendee_list'] = array( |
|
107 | - 'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'), |
|
108 | - 'required' => array('[ATTENDEE_LIST]') |
|
109 | - ); |
|
110 | - $validator_config['question_list'] = array( |
|
111 | - 'shortcodes' => array('question'), |
|
112 | - 'required' => array('[QUESTION_LIST]') |
|
113 | - ); |
|
114 | - |
|
115 | - return $validator_config; |
|
116 | - } |
|
117 | - |
|
118 | - |
|
119 | - public function html_messenger_validator_config($validator_config, EE_Html_messenger $messenger) |
|
120 | - { |
|
121 | - $validator_config['attendee_list'] = array( |
|
122 | - 'shortcodes' => array('attendee', 'question_list'), |
|
123 | - 'required' => array('[ATTENDEE_LIST]') |
|
124 | - ); |
|
125 | - $validator_config['question_list'] = array( |
|
126 | - 'shortcodes' => array('question'), |
|
127 | - 'required' => array('[QUESTION_LIST]') |
|
128 | - ); |
|
129 | - |
|
130 | - return $validator_config; |
|
131 | - } |
|
132 | - |
|
133 | - |
|
134 | - public function pdf_messenger_validator_config($validator_config, EE_Pdf_messenger $messenger) |
|
135 | - { |
|
136 | - $validator_config['attendee_list'] = array( |
|
137 | - 'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'), |
|
138 | - 'required' => array('[ATTENDEE_LIST]') |
|
139 | - ); |
|
140 | - $validator_config['question_list'] = array( |
|
141 | - 'shortcodes' => array('question'), |
|
142 | - 'required' => array('[QUESTION_LIST]') |
|
143 | - ); |
|
144 | - |
|
145 | - return $validator_config; |
|
146 | - } |
|
147 | - |
|
148 | - |
|
149 | - public function email_messenger_template_fields($template_fields, EE_Email_messenger $messenger) |
|
150 | - { |
|
151 | - $template_fields['extra']['content']['question_list'] = array( |
|
152 | - 'input' => 'textarea', |
|
153 | - 'label' => '[QUESTION_LIST]', |
|
154 | - 'type' => 'string', |
|
155 | - 'required' => true, |
|
156 | - 'validation' => true, |
|
157 | - 'format' => '%s', |
|
158 | - 'css_class' => 'large-text', |
|
159 | - 'rows' => '5', |
|
160 | - 'shortcodes_required' => array('[QUESTION_LIST]') |
|
161 | - ); |
|
162 | - |
|
163 | - return $template_fields; |
|
164 | - } |
|
165 | - |
|
166 | - |
|
167 | - public function html_messenger_template_fields($template_fields, EE_Html_messenger $messenger) |
|
168 | - { |
|
169 | - $template_fields['extra']['content']['question_list'] = array( |
|
170 | - 'input' => 'textarea', |
|
171 | - 'label' => '[QUESTION_LIST]', |
|
172 | - 'type' => 'string', |
|
173 | - 'required' => true, |
|
174 | - 'validation' => true, |
|
175 | - 'format' => '%s', |
|
176 | - 'css_class' => 'large-text', |
|
177 | - 'rows' => '5', |
|
178 | - 'shortcodes_required' => array('[QUESTION_LIST]') |
|
179 | - ); |
|
180 | - |
|
181 | - return $template_fields; |
|
182 | - } |
|
183 | - |
|
184 | - |
|
185 | - public function pdf_messenger_template_fields($template_fields, EE_Pdf_messenger $messenger) |
|
186 | - { |
|
187 | - $template_fields['extra']['content']['question_list'] = array( |
|
188 | - 'input' => 'textarea', |
|
189 | - 'label' => '[QUESTION_LIST]', |
|
190 | - 'type' => 'string', |
|
191 | - 'required' => true, |
|
192 | - 'validation' => true, |
|
193 | - 'format' => '%s', |
|
194 | - 'css_class' => 'large-text', |
|
195 | - 'rows' => '5', |
|
196 | - 'shortcodes_required' => array('[QUESTION_LIST]') |
|
197 | - ); |
|
198 | - |
|
199 | - return $template_fields; |
|
200 | - } |
|
201 | - |
|
202 | - |
|
203 | - public function new_default_templates( |
|
204 | - $contents, |
|
205 | - $actual_path, |
|
206 | - EE_messenger $messenger, |
|
207 | - EE_message_type $message_type, |
|
208 | - $field, |
|
209 | - $context, |
|
210 | - EE_Messages_Template_Pack $template_pack |
|
211 | - ) { |
|
212 | - |
|
213 | - //we're only modifying templates for the default template pack |
|
214 | - if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default) { |
|
215 | - return $contents; |
|
216 | - } |
|
217 | - |
|
218 | - //the template file name we're replacing contents for. |
|
219 | - $template_file_prefix = $field . '_' . $context; |
|
220 | - $msg_prefix = $messenger->name . '_' . $message_type->name . '_'; |
|
221 | - |
|
222 | - $base_path = EE_CAF_LIBRARIES . 'messages/defaults/default/'; |
|
223 | - |
|
224 | - if ($messenger->name == 'email' && $message_type->name == 'registration') { |
|
25 | + /** |
|
26 | + * constructor. |
|
27 | + */ |
|
28 | + public function __construct() |
|
29 | + { |
|
30 | + $this->_caf_hooks(); |
|
31 | + } |
|
32 | + |
|
33 | + |
|
34 | + /** |
|
35 | + * Contains all the hooks filters for setting up caffeinated messages functionality. |
|
36 | + * |
|
37 | + * @since 4.3.2 |
|
38 | + * |
|
39 | + * @return void |
|
40 | + */ |
|
41 | + private function _caf_hooks() |
|
42 | + { |
|
43 | + add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array($this, 'messages_autoload_paths'), 5); |
|
44 | + add_filter('FHEE__EE_Email_messenger__get_validator_config', array($this, 'email_messenger_validator_config'), |
|
45 | + 5, 2); |
|
46 | + add_filter('FHEE__EE_Email_messenger__get_template_fields', array($this, 'email_messenger_template_fields'), 5, |
|
47 | + 2); |
|
48 | + add_filter('FHEE__EE_Html_messenger__get_template_fields', array($this, 'html_messenger_template_fields'), 5, |
|
49 | + 2); |
|
50 | + add_filter('FHEE__EE_Html_messenger__get_validator_config', array($this, 'html_messenger_validator_config'), 5, |
|
51 | + 2); |
|
52 | + add_filter('FHEE__EE_Pdf_messenger__get_template_fields', array($this, 'pdf_messenger_template_fields'), 5, 2); |
|
53 | + add_filter('FHEE__EE_Pdf_messenger__get_validator_config', array($this, 'pdf_messenger_validator_config'), 5, |
|
54 | + 2); |
|
55 | + add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', |
|
56 | + array($this, 'new_default_templates'), 5, 7); |
|
57 | + add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', array($this, 'message_types_valid_shortcodes'), 5, |
|
58 | + 2); |
|
59 | + |
|
60 | + //shortcode parsers |
|
61 | + add_filter('FHEE__EE_Attendee_Shortcodes__shortcodes', array($this, 'additional_attendee_shortcodes'), 5, 2); |
|
62 | + add_filter('FHEE__EE_Attendee_Shortcodes__parser_after', array($this, 'additional_attendee_parser'), 5, 5); |
|
63 | + add_filter('FHEE__EE_Recipient_List_Shortcodes__shortcodes', |
|
64 | + array($this, 'additional_recipient_details_shortcodes'), 5, 2); |
|
65 | + add_filter('FHEE__EE_Recipient_List_Shortcodes__parser_after', |
|
66 | + array($this, 'additional_recipient_details_parser'), 5, 5); |
|
67 | + add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__shortcodes', |
|
68 | + array($this, 'additional_primary_registration_details_shortcodes'), 5, 2); |
|
69 | + add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__parser_after', |
|
70 | + array($this, 'additional_primary_registration_details_parser'), 5, 5); |
|
71 | + |
|
72 | + /** |
|
73 | + * @since 4.2.0 |
|
74 | + */ |
|
75 | + add_filter('FHEE__EE_Datetime_Shortcodes__shortcodes', array($this, 'additional_datetime_shortcodes'), 10, 2); |
|
76 | + add_filter('FHEE__EE_Datetime_Shortcodes__parser_after', array($this, 'additional_datetime_parser'), 10, 5); |
|
77 | + |
|
78 | + /** |
|
79 | + * @since 4.3.0 |
|
80 | + */ |
|
81 | + //eat our own dog food! |
|
82 | + add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_message_types')); |
|
83 | + add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_shortcodes')); |
|
84 | + do_action('EE_Brewing_Regular___messages_caf'); |
|
85 | + } |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * This just allows us to add additional paths to the autoloader (EED_Messages::autoload_messages()) for the |
|
90 | + * messages system. |
|
91 | + * |
|
92 | + * @param array $dir_ref original array of paths |
|
93 | + * |
|
94 | + * @return array appended paths |
|
95 | + */ |
|
96 | + public function messages_autoload_paths($dir_ref) |
|
97 | + { |
|
98 | + $dir_ref[] = EE_CAF_LIBRARIES . 'shortcodes/'; |
|
99 | + |
|
100 | + return $dir_ref; |
|
101 | + } |
|
102 | + |
|
103 | + |
|
104 | + public function email_messenger_validator_config($validator_config, EE_Email_messenger $messenger) |
|
105 | + { |
|
106 | + $validator_config['attendee_list'] = array( |
|
107 | + 'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'), |
|
108 | + 'required' => array('[ATTENDEE_LIST]') |
|
109 | + ); |
|
110 | + $validator_config['question_list'] = array( |
|
111 | + 'shortcodes' => array('question'), |
|
112 | + 'required' => array('[QUESTION_LIST]') |
|
113 | + ); |
|
114 | + |
|
115 | + return $validator_config; |
|
116 | + } |
|
117 | + |
|
118 | + |
|
119 | + public function html_messenger_validator_config($validator_config, EE_Html_messenger $messenger) |
|
120 | + { |
|
121 | + $validator_config['attendee_list'] = array( |
|
122 | + 'shortcodes' => array('attendee', 'question_list'), |
|
123 | + 'required' => array('[ATTENDEE_LIST]') |
|
124 | + ); |
|
125 | + $validator_config['question_list'] = array( |
|
126 | + 'shortcodes' => array('question'), |
|
127 | + 'required' => array('[QUESTION_LIST]') |
|
128 | + ); |
|
129 | + |
|
130 | + return $validator_config; |
|
131 | + } |
|
132 | + |
|
133 | + |
|
134 | + public function pdf_messenger_validator_config($validator_config, EE_Pdf_messenger $messenger) |
|
135 | + { |
|
136 | + $validator_config['attendee_list'] = array( |
|
137 | + 'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'), |
|
138 | + 'required' => array('[ATTENDEE_LIST]') |
|
139 | + ); |
|
140 | + $validator_config['question_list'] = array( |
|
141 | + 'shortcodes' => array('question'), |
|
142 | + 'required' => array('[QUESTION_LIST]') |
|
143 | + ); |
|
144 | + |
|
145 | + return $validator_config; |
|
146 | + } |
|
147 | + |
|
148 | + |
|
149 | + public function email_messenger_template_fields($template_fields, EE_Email_messenger $messenger) |
|
150 | + { |
|
151 | + $template_fields['extra']['content']['question_list'] = array( |
|
152 | + 'input' => 'textarea', |
|
153 | + 'label' => '[QUESTION_LIST]', |
|
154 | + 'type' => 'string', |
|
155 | + 'required' => true, |
|
156 | + 'validation' => true, |
|
157 | + 'format' => '%s', |
|
158 | + 'css_class' => 'large-text', |
|
159 | + 'rows' => '5', |
|
160 | + 'shortcodes_required' => array('[QUESTION_LIST]') |
|
161 | + ); |
|
162 | + |
|
163 | + return $template_fields; |
|
164 | + } |
|
165 | + |
|
166 | + |
|
167 | + public function html_messenger_template_fields($template_fields, EE_Html_messenger $messenger) |
|
168 | + { |
|
169 | + $template_fields['extra']['content']['question_list'] = array( |
|
170 | + 'input' => 'textarea', |
|
171 | + 'label' => '[QUESTION_LIST]', |
|
172 | + 'type' => 'string', |
|
173 | + 'required' => true, |
|
174 | + 'validation' => true, |
|
175 | + 'format' => '%s', |
|
176 | + 'css_class' => 'large-text', |
|
177 | + 'rows' => '5', |
|
178 | + 'shortcodes_required' => array('[QUESTION_LIST]') |
|
179 | + ); |
|
180 | + |
|
181 | + return $template_fields; |
|
182 | + } |
|
183 | + |
|
184 | + |
|
185 | + public function pdf_messenger_template_fields($template_fields, EE_Pdf_messenger $messenger) |
|
186 | + { |
|
187 | + $template_fields['extra']['content']['question_list'] = array( |
|
188 | + 'input' => 'textarea', |
|
189 | + 'label' => '[QUESTION_LIST]', |
|
190 | + 'type' => 'string', |
|
191 | + 'required' => true, |
|
192 | + 'validation' => true, |
|
193 | + 'format' => '%s', |
|
194 | + 'css_class' => 'large-text', |
|
195 | + 'rows' => '5', |
|
196 | + 'shortcodes_required' => array('[QUESTION_LIST]') |
|
197 | + ); |
|
198 | + |
|
199 | + return $template_fields; |
|
200 | + } |
|
201 | + |
|
202 | + |
|
203 | + public function new_default_templates( |
|
204 | + $contents, |
|
205 | + $actual_path, |
|
206 | + EE_messenger $messenger, |
|
207 | + EE_message_type $message_type, |
|
208 | + $field, |
|
209 | + $context, |
|
210 | + EE_Messages_Template_Pack $template_pack |
|
211 | + ) { |
|
212 | + |
|
213 | + //we're only modifying templates for the default template pack |
|
214 | + if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default) { |
|
215 | + return $contents; |
|
216 | + } |
|
217 | + |
|
218 | + //the template file name we're replacing contents for. |
|
219 | + $template_file_prefix = $field . '_' . $context; |
|
220 | + $msg_prefix = $messenger->name . '_' . $message_type->name . '_'; |
|
221 | + |
|
222 | + $base_path = EE_CAF_LIBRARIES . 'messages/defaults/default/'; |
|
223 | + |
|
224 | + if ($messenger->name == 'email' && $message_type->name == 'registration') { |
|
225 | 225 | |
226 | - switch ($template_file_prefix) { |
|
226 | + switch ($template_file_prefix) { |
|
227 | 227 | |
228 | - case 'question_list_admin' : |
|
229 | - case 'question_list_attendee' : |
|
230 | - case 'question_list_primary_attendee' : |
|
231 | - $path = $base_path . $msg_prefix . 'question_list.template.php'; |
|
232 | - $contents = EEH_Template::display_template($path, array(), true); |
|
233 | - break; |
|
228 | + case 'question_list_admin' : |
|
229 | + case 'question_list_attendee' : |
|
230 | + case 'question_list_primary_attendee' : |
|
231 | + $path = $base_path . $msg_prefix . 'question_list.template.php'; |
|
232 | + $contents = EEH_Template::display_template($path, array(), true); |
|
233 | + break; |
|
234 | 234 | |
235 | - case 'attendee_list_primary_attendee' : |
|
236 | - $path = $base_path . $msg_prefix . 'attendee_list.template.php'; |
|
237 | - $contents = EEH_Template::display_template($path, array(), true); |
|
238 | - break; |
|
235 | + case 'attendee_list_primary_attendee' : |
|
236 | + $path = $base_path . $msg_prefix . 'attendee_list.template.php'; |
|
237 | + $contents = EEH_Template::display_template($path, array(), true); |
|
238 | + break; |
|
239 | 239 | |
240 | - case 'attendee_list_admin' : |
|
241 | - $path = $base_path . $msg_prefix . 'attendee_list_admin.template.php'; |
|
242 | - $contents = EEH_Template::display_template($path, |
|
243 | - array(), true); |
|
244 | - break; |
|
240 | + case 'attendee_list_admin' : |
|
241 | + $path = $base_path . $msg_prefix . 'attendee_list_admin.template.php'; |
|
242 | + $contents = EEH_Template::display_template($path, |
|
243 | + array(), true); |
|
244 | + break; |
|
245 | 245 | |
246 | - case 'attendee_list_attendee' : |
|
247 | - $contents = ''; |
|
248 | - break; |
|
246 | + case 'attendee_list_attendee' : |
|
247 | + $contents = ''; |
|
248 | + break; |
|
249 | 249 | |
250 | - case 'event_list_attendee' : |
|
251 | - $path = $base_path . $msg_prefix . 'event_list_attendee.template.php'; |
|
252 | - $contents = EEH_Template::display_template($path, array(), true); |
|
253 | - break; |
|
254 | - } |
|
255 | - } elseif ($messenger->name == 'email' && $message_type->name == 'newsletter') { |
|
256 | - switch ($template_file_prefix) { |
|
250 | + case 'event_list_attendee' : |
|
251 | + $path = $base_path . $msg_prefix . 'event_list_attendee.template.php'; |
|
252 | + $contents = EEH_Template::display_template($path, array(), true); |
|
253 | + break; |
|
254 | + } |
|
255 | + } elseif ($messenger->name == 'email' && $message_type->name == 'newsletter') { |
|
256 | + switch ($template_file_prefix) { |
|
257 | 257 | |
258 | - case 'content_attendee' : |
|
259 | - $path = $base_path . $msg_prefix . 'content.template.php'; |
|
260 | - $contents = EEH_Template::display_template($path, array(), true); |
|
261 | - break; |
|
258 | + case 'content_attendee' : |
|
259 | + $path = $base_path . $msg_prefix . 'content.template.php'; |
|
260 | + $contents = EEH_Template::display_template($path, array(), true); |
|
261 | + break; |
|
262 | 262 | |
263 | - case 'newsletter_content_attendee' : |
|
264 | - $path = $base_path . $msg_prefix . 'newsletter_content.template.php'; |
|
265 | - $contents = EEH_Template::display_template($path, array(), true); |
|
266 | - break; |
|
263 | + case 'newsletter_content_attendee' : |
|
264 | + $path = $base_path . $msg_prefix . 'newsletter_content.template.php'; |
|
265 | + $contents = EEH_Template::display_template($path, array(), true); |
|
266 | + break; |
|
267 | 267 | |
268 | - case 'newsletter_subject_attendee' : |
|
269 | - $path = $base_path . $msg_prefix . 'subject.template.php'; |
|
270 | - $contents = EEH_Template::display_template($path, array(), true); |
|
271 | - break; |
|
272 | - } |
|
273 | - } elseif ($messenger->name == 'html' && $message_type->name == 'receipt') { |
|
274 | - switch ($template_file_prefix) { |
|
275 | - case 'attendee_list_purchaser' : |
|
276 | - $path = $base_path . $msg_prefix . 'attendee_list.template.php'; |
|
277 | - $contents = EEH_Template::display_template($path, array(), true); |
|
278 | - break; |
|
279 | - } |
|
280 | - } |
|
281 | - |
|
282 | - return $contents; |
|
283 | - |
|
284 | - } |
|
285 | - |
|
286 | - |
|
287 | - public function message_types_valid_shortcodes($valid_shortcodes, EE_Messages_Base $msg) |
|
288 | - { |
|
289 | - //make sure question_list and question are ONLY added for the core message types. Any other message types will have to explicitly set question_list as a valid shortcode. |
|
290 | - $include_with = array( |
|
291 | - 'registration', |
|
292 | - 'cancelled_registration', |
|
293 | - 'declined_registration', |
|
294 | - 'not_approved_registration', |
|
295 | - 'payment_declined', |
|
296 | - 'payment_failed', |
|
297 | - 'payment_cancelled', |
|
298 | - 'payment', |
|
299 | - 'payment_reminder', |
|
300 | - 'pending_approval', |
|
301 | - 'registration_summary', |
|
302 | - 'invoice', |
|
303 | - 'receipt' |
|
304 | - ); |
|
305 | - if ($msg instanceof EE_message_type && in_array($msg->name, $include_with)) { |
|
306 | - $contexts = array_keys($msg->get_contexts()); |
|
307 | - foreach ($contexts as $context) { |
|
308 | - $valid_shortcodes[$context][] = 'question_list'; |
|
309 | - $valid_shortcodes[$context][] = 'question'; |
|
310 | - } |
|
311 | - } |
|
312 | - |
|
313 | - return $valid_shortcodes; |
|
314 | - } |
|
315 | - |
|
316 | - |
|
317 | - public function additional_attendee_shortcodes($shortcodes, $shortcode_parser) |
|
318 | - { |
|
319 | - $shortcodes['[ANSWER_*]'] = __('This is a special dynamic shortcode. Right after the "*", add the exact text of a existing question, and if there is an answer for that question for this registrant, that will take the place of this shortcode.', |
|
320 | - 'event_espresso'); |
|
321 | - |
|
322 | - return $shortcodes; |
|
323 | - } |
|
324 | - |
|
325 | - |
|
326 | - public function additional_attendee_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) |
|
327 | - { |
|
328 | - |
|
329 | - if (strpos($shortcode, |
|
330 | - '[ANSWER_*') === false || ! isset($extra_data['data']->questions) || ! isset($extra_data['data']->registrations) |
|
331 | - ) { |
|
332 | - return $parsed; |
|
333 | - } |
|
334 | - |
|
335 | - //let's get the question from the code. |
|
336 | - $shortcode = str_replace('[ANSWER_*', '', $shortcode); |
|
337 | - $shortcode = trim(str_replace(']', '', $shortcode)); |
|
338 | - |
|
339 | - $registration = $data instanceof EE_Registration ? $data : null; |
|
340 | - $registration = ! $registration instanceof EE_Registration && is_array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Registration ? $extra_data['data'] : $registration; |
|
341 | - |
|
342 | - $aee = $data instanceof EE_Messages_Addressee ? $data : null; |
|
343 | - $aee = ! $aee instanceof EE_Messages_Addressee && is_array($extra_data) && isset($extra_data['data']) ? $extra_data['data'] : $aee; |
|
344 | - |
|
345 | - if ( ! $registration instanceof EE_Registration || ! $aee instanceof EE_Messages_Addressee) { |
|
346 | - return $parsed; |
|
347 | - } |
|
348 | - |
|
349 | - //now let's figure out which question has this text. |
|
350 | - foreach ($aee->questions as $ansid => $question) { |
|
351 | - if ( |
|
352 | - $question instanceof EE_Question |
|
353 | - && trim($question->display_text()) == trim($shortcode) |
|
354 | - && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid]) |
|
355 | - ) { |
|
356 | - return $aee->registrations[$registration->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', |
|
357 | - 'no_wpautop'); |
|
358 | - } |
|
359 | - } |
|
360 | - |
|
361 | - //nothing! |
|
362 | - return $parsed; |
|
363 | - } |
|
364 | - |
|
365 | - |
|
366 | - /** |
|
367 | - * Callback for additional shortcodes filter for adding additional datetime shortcodes. |
|
368 | - * |
|
369 | - * @since 4.2 |
|
370 | - * |
|
371 | - * @param array $shortcodes array of shortcodes and |
|
372 | - * descriptions |
|
373 | - * @param EE_Datetime_Shortcodes $shortcode_parser EE_Shortcodes object |
|
374 | - * |
|
375 | - * @return array array of shortcodes and |
|
376 | - * descriptions |
|
377 | - */ |
|
378 | - public function additional_datetime_shortcodes($shortcodes, $shortcode_parser) |
|
379 | - { |
|
380 | - $shortcodes['[DTT_NAME]'] = __('This will be parsed to the Title given for a Datetime', |
|
381 | - 'event_espresso'); |
|
382 | - $shortcodes['[DTT_DESCRIPTION]'] = __('This will be parsed to the description for a Datetime', |
|
383 | - 'event_espresso'); |
|
384 | - $shortcodes['[DTT_NAME_OR_DATES]'] = __('When parsed, if the Datetime has a name, it is used, otherwise a formatted string including the start date and end date will be used.', |
|
385 | - 'event_espresso'); |
|
386 | - |
|
387 | - return $shortcodes; |
|
388 | - } |
|
389 | - |
|
390 | - |
|
391 | - /** |
|
392 | - * Callback for additional shortcodes parser filter used for adding parser for new |
|
393 | - * Datetime shortcodes |
|
394 | - * |
|
395 | - * @since 4.2 |
|
396 | - * |
|
397 | - * @param string $parsed The finished parsed string for the given shortcode. |
|
398 | - * @param string $shortcode The shortcode being parsed. |
|
399 | - * @param object $data The incoming data object for the Shortcode Parser. |
|
400 | - * @param object $extra_data The incoming extra date object for the Shortcode |
|
401 | - * Parser. |
|
402 | - * @param EE_Datetime_Shortcodes $shortcode_parser |
|
403 | - * |
|
404 | - * @return string The new parsed string. |
|
405 | - */ |
|
406 | - public function additional_datetime_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) |
|
407 | - { |
|
408 | - |
|
409 | - if ( ! $data instanceof EE_Datetime) { |
|
410 | - return ''; //get out because we can only parse with the datetime object. |
|
411 | - } |
|
412 | - |
|
413 | - switch ($shortcode) { |
|
414 | - case '[DTT_NAME]' : |
|
415 | - return $data->name(); |
|
416 | - break; |
|
417 | - case '[DTT_DESCRIPTION]' : |
|
418 | - return $data->description(); |
|
419 | - break; |
|
420 | - case '[DTT_NAME_OR_DATES]' : |
|
421 | - return $data->get_dtt_display_name(true); |
|
422 | - break; |
|
423 | - default : |
|
424 | - return $parsed; |
|
425 | - break; |
|
426 | - } |
|
427 | - } |
|
428 | - |
|
429 | - |
|
430 | - public function additional_recipient_details_shortcodes($shortcodes, $shortcode_parser) |
|
431 | - { |
|
432 | - $shortcodes['[RECIPIENT_QUESTION_LIST]'] = __('This is used to indicate where you want the list of questions and answers to show for the person receiving the message.', |
|
433 | - 'event_espresso'); |
|
434 | - |
|
435 | - return $shortcodes; |
|
436 | - } |
|
437 | - |
|
438 | - |
|
439 | - public function additional_recipient_details_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) |
|
440 | - { |
|
441 | - |
|
442 | - if (array($data) && ! isset($data['data'])) { |
|
443 | - return $parsed; |
|
444 | - } |
|
445 | - |
|
446 | - $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : null; |
|
447 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
448 | - |
|
449 | - if ( ! $recipient instanceof EE_Messages_Addressee) { |
|
450 | - return $parsed; |
|
451 | - } |
|
452 | - |
|
453 | - switch ($shortcode) { |
|
454 | - case '[RECIPIENT_QUESTION_LIST]' : |
|
455 | - $att = $recipient->att_obj; |
|
456 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $recipient->attendees[$att->ID()]['reg_objs'] : array(); |
|
457 | - $registrations_on_attendee = empty($registrations_on_attendee) && $recipient->reg_obj instanceof EE_Registration ? array($recipient->reg_obj) : $registrations_on_attendee; |
|
458 | - $answers = array(); |
|
268 | + case 'newsletter_subject_attendee' : |
|
269 | + $path = $base_path . $msg_prefix . 'subject.template.php'; |
|
270 | + $contents = EEH_Template::display_template($path, array(), true); |
|
271 | + break; |
|
272 | + } |
|
273 | + } elseif ($messenger->name == 'html' && $message_type->name == 'receipt') { |
|
274 | + switch ($template_file_prefix) { |
|
275 | + case 'attendee_list_purchaser' : |
|
276 | + $path = $base_path . $msg_prefix . 'attendee_list.template.php'; |
|
277 | + $contents = EEH_Template::display_template($path, array(), true); |
|
278 | + break; |
|
279 | + } |
|
280 | + } |
|
281 | + |
|
282 | + return $contents; |
|
283 | + |
|
284 | + } |
|
285 | + |
|
286 | + |
|
287 | + public function message_types_valid_shortcodes($valid_shortcodes, EE_Messages_Base $msg) |
|
288 | + { |
|
289 | + //make sure question_list and question are ONLY added for the core message types. Any other message types will have to explicitly set question_list as a valid shortcode. |
|
290 | + $include_with = array( |
|
291 | + 'registration', |
|
292 | + 'cancelled_registration', |
|
293 | + 'declined_registration', |
|
294 | + 'not_approved_registration', |
|
295 | + 'payment_declined', |
|
296 | + 'payment_failed', |
|
297 | + 'payment_cancelled', |
|
298 | + 'payment', |
|
299 | + 'payment_reminder', |
|
300 | + 'pending_approval', |
|
301 | + 'registration_summary', |
|
302 | + 'invoice', |
|
303 | + 'receipt' |
|
304 | + ); |
|
305 | + if ($msg instanceof EE_message_type && in_array($msg->name, $include_with)) { |
|
306 | + $contexts = array_keys($msg->get_contexts()); |
|
307 | + foreach ($contexts as $context) { |
|
308 | + $valid_shortcodes[$context][] = 'question_list'; |
|
309 | + $valid_shortcodes[$context][] = 'question'; |
|
310 | + } |
|
311 | + } |
|
312 | + |
|
313 | + return $valid_shortcodes; |
|
314 | + } |
|
315 | + |
|
316 | + |
|
317 | + public function additional_attendee_shortcodes($shortcodes, $shortcode_parser) |
|
318 | + { |
|
319 | + $shortcodes['[ANSWER_*]'] = __('This is a special dynamic shortcode. Right after the "*", add the exact text of a existing question, and if there is an answer for that question for this registrant, that will take the place of this shortcode.', |
|
320 | + 'event_espresso'); |
|
321 | + |
|
322 | + return $shortcodes; |
|
323 | + } |
|
324 | + |
|
325 | + |
|
326 | + public function additional_attendee_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) |
|
327 | + { |
|
328 | + |
|
329 | + if (strpos($shortcode, |
|
330 | + '[ANSWER_*') === false || ! isset($extra_data['data']->questions) || ! isset($extra_data['data']->registrations) |
|
331 | + ) { |
|
332 | + return $parsed; |
|
333 | + } |
|
334 | + |
|
335 | + //let's get the question from the code. |
|
336 | + $shortcode = str_replace('[ANSWER_*', '', $shortcode); |
|
337 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
338 | + |
|
339 | + $registration = $data instanceof EE_Registration ? $data : null; |
|
340 | + $registration = ! $registration instanceof EE_Registration && is_array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Registration ? $extra_data['data'] : $registration; |
|
341 | + |
|
342 | + $aee = $data instanceof EE_Messages_Addressee ? $data : null; |
|
343 | + $aee = ! $aee instanceof EE_Messages_Addressee && is_array($extra_data) && isset($extra_data['data']) ? $extra_data['data'] : $aee; |
|
344 | + |
|
345 | + if ( ! $registration instanceof EE_Registration || ! $aee instanceof EE_Messages_Addressee) { |
|
346 | + return $parsed; |
|
347 | + } |
|
348 | + |
|
349 | + //now let's figure out which question has this text. |
|
350 | + foreach ($aee->questions as $ansid => $question) { |
|
351 | + if ( |
|
352 | + $question instanceof EE_Question |
|
353 | + && trim($question->display_text()) == trim($shortcode) |
|
354 | + && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid]) |
|
355 | + ) { |
|
356 | + return $aee->registrations[$registration->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', |
|
357 | + 'no_wpautop'); |
|
358 | + } |
|
359 | + } |
|
360 | + |
|
361 | + //nothing! |
|
362 | + return $parsed; |
|
363 | + } |
|
364 | + |
|
365 | + |
|
366 | + /** |
|
367 | + * Callback for additional shortcodes filter for adding additional datetime shortcodes. |
|
368 | + * |
|
369 | + * @since 4.2 |
|
370 | + * |
|
371 | + * @param array $shortcodes array of shortcodes and |
|
372 | + * descriptions |
|
373 | + * @param EE_Datetime_Shortcodes $shortcode_parser EE_Shortcodes object |
|
374 | + * |
|
375 | + * @return array array of shortcodes and |
|
376 | + * descriptions |
|
377 | + */ |
|
378 | + public function additional_datetime_shortcodes($shortcodes, $shortcode_parser) |
|
379 | + { |
|
380 | + $shortcodes['[DTT_NAME]'] = __('This will be parsed to the Title given for a Datetime', |
|
381 | + 'event_espresso'); |
|
382 | + $shortcodes['[DTT_DESCRIPTION]'] = __('This will be parsed to the description for a Datetime', |
|
383 | + 'event_espresso'); |
|
384 | + $shortcodes['[DTT_NAME_OR_DATES]'] = __('When parsed, if the Datetime has a name, it is used, otherwise a formatted string including the start date and end date will be used.', |
|
385 | + 'event_espresso'); |
|
386 | + |
|
387 | + return $shortcodes; |
|
388 | + } |
|
389 | + |
|
390 | + |
|
391 | + /** |
|
392 | + * Callback for additional shortcodes parser filter used for adding parser for new |
|
393 | + * Datetime shortcodes |
|
394 | + * |
|
395 | + * @since 4.2 |
|
396 | + * |
|
397 | + * @param string $parsed The finished parsed string for the given shortcode. |
|
398 | + * @param string $shortcode The shortcode being parsed. |
|
399 | + * @param object $data The incoming data object for the Shortcode Parser. |
|
400 | + * @param object $extra_data The incoming extra date object for the Shortcode |
|
401 | + * Parser. |
|
402 | + * @param EE_Datetime_Shortcodes $shortcode_parser |
|
403 | + * |
|
404 | + * @return string The new parsed string. |
|
405 | + */ |
|
406 | + public function additional_datetime_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) |
|
407 | + { |
|
408 | + |
|
409 | + if ( ! $data instanceof EE_Datetime) { |
|
410 | + return ''; //get out because we can only parse with the datetime object. |
|
411 | + } |
|
412 | + |
|
413 | + switch ($shortcode) { |
|
414 | + case '[DTT_NAME]' : |
|
415 | + return $data->name(); |
|
416 | + break; |
|
417 | + case '[DTT_DESCRIPTION]' : |
|
418 | + return $data->description(); |
|
419 | + break; |
|
420 | + case '[DTT_NAME_OR_DATES]' : |
|
421 | + return $data->get_dtt_display_name(true); |
|
422 | + break; |
|
423 | + default : |
|
424 | + return $parsed; |
|
425 | + break; |
|
426 | + } |
|
427 | + } |
|
428 | + |
|
429 | + |
|
430 | + public function additional_recipient_details_shortcodes($shortcodes, $shortcode_parser) |
|
431 | + { |
|
432 | + $shortcodes['[RECIPIENT_QUESTION_LIST]'] = __('This is used to indicate where you want the list of questions and answers to show for the person receiving the message.', |
|
433 | + 'event_espresso'); |
|
434 | + |
|
435 | + return $shortcodes; |
|
436 | + } |
|
437 | + |
|
438 | + |
|
439 | + public function additional_recipient_details_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) |
|
440 | + { |
|
441 | + |
|
442 | + if (array($data) && ! isset($data['data'])) { |
|
443 | + return $parsed; |
|
444 | + } |
|
445 | + |
|
446 | + $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : null; |
|
447 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
448 | + |
|
449 | + if ( ! $recipient instanceof EE_Messages_Addressee) { |
|
450 | + return $parsed; |
|
451 | + } |
|
452 | + |
|
453 | + switch ($shortcode) { |
|
454 | + case '[RECIPIENT_QUESTION_LIST]' : |
|
455 | + $att = $recipient->att_obj; |
|
456 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $recipient->attendees[$att->ID()]['reg_objs'] : array(); |
|
457 | + $registrations_on_attendee = empty($registrations_on_attendee) && $recipient->reg_obj instanceof EE_Registration ? array($recipient->reg_obj) : $registrations_on_attendee; |
|
458 | + $answers = array(); |
|
459 | 459 | |
460 | - $template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
461 | - $valid_shortcodes = array('question'); |
|
460 | + $template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
461 | + $valid_shortcodes = array('question'); |
|
462 | 462 | |
463 | - //if the context is main_content then get all answers for all registrations on this attendee |
|
464 | - if ($data['data'] instanceof EE_Messages_Addressee) { |
|
465 | - foreach ($registrations_on_attendee as $reg) { |
|
466 | - if ($reg instanceof EE_Registration) { |
|
467 | - $anss = ! empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array(); |
|
468 | - foreach ($anss as $ans) { |
|
469 | - if ($ans instanceof EE_Answer) { |
|
470 | - $answers[$ans->ID()] = $ans; |
|
471 | - } |
|
472 | - } |
|
473 | - } |
|
474 | - } |
|
475 | - } |
|
463 | + //if the context is main_content then get all answers for all registrations on this attendee |
|
464 | + if ($data['data'] instanceof EE_Messages_Addressee) { |
|
465 | + foreach ($registrations_on_attendee as $reg) { |
|
466 | + if ($reg instanceof EE_Registration) { |
|
467 | + $anss = ! empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array(); |
|
468 | + foreach ($anss as $ans) { |
|
469 | + if ($ans instanceof EE_Answer) { |
|
470 | + $answers[$ans->ID()] = $ans; |
|
471 | + } |
|
472 | + } |
|
473 | + } |
|
474 | + } |
|
475 | + } |
|
476 | 476 | |
477 | - //if the context is the event list parser, then let's return just the answers for all registrations attached to the recipient for that event. |
|
478 | - if ($data['data'] instanceof EE_Event) { |
|
479 | - $event = $data['data']; |
|
480 | - foreach ($registrations_on_attendee as $reg) { |
|
481 | - if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
482 | - $anss = ! empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array(); |
|
483 | - foreach ($anss as $ans) { |
|
484 | - if ($ans instanceof EE_Answer) { |
|
485 | - $answers[$ans->ID()] = $ans; |
|
486 | - } |
|
487 | - } |
|
488 | - } |
|
489 | - } |
|
490 | - } |
|
477 | + //if the context is the event list parser, then let's return just the answers for all registrations attached to the recipient for that event. |
|
478 | + if ($data['data'] instanceof EE_Event) { |
|
479 | + $event = $data['data']; |
|
480 | + foreach ($registrations_on_attendee as $reg) { |
|
481 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
482 | + $anss = ! empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array(); |
|
483 | + foreach ($anss as $ans) { |
|
484 | + if ($ans instanceof EE_Answer) { |
|
485 | + $answers[$ans->ID()] = $ans; |
|
486 | + } |
|
487 | + } |
|
488 | + } |
|
489 | + } |
|
490 | + } |
|
491 | 491 | |
492 | - $question_list = ''; |
|
493 | - $shortcode_helper = $shortcode_parser->get_shortcode_helper(); |
|
494 | - foreach ($answers as $answer) { |
|
495 | - if ($answer instanceof EE_Answer) { |
|
496 | - $question = $answer->question(); |
|
497 | - if ( ! $question instanceof EE_Question || ($question instanceof EE_Question && $question->admin_only())) { |
|
498 | - continue; |
|
499 | - } |
|
500 | - $question_list .= $shortcode_helper->parse_question_list_template($template, $answer, |
|
501 | - $valid_shortcodes, $extra_data); |
|
502 | - } |
|
503 | - } |
|
492 | + $question_list = ''; |
|
493 | + $shortcode_helper = $shortcode_parser->get_shortcode_helper(); |
|
494 | + foreach ($answers as $answer) { |
|
495 | + if ($answer instanceof EE_Answer) { |
|
496 | + $question = $answer->question(); |
|
497 | + if ( ! $question instanceof EE_Question || ($question instanceof EE_Question && $question->admin_only())) { |
|
498 | + continue; |
|
499 | + } |
|
500 | + $question_list .= $shortcode_helper->parse_question_list_template($template, $answer, |
|
501 | + $valid_shortcodes, $extra_data); |
|
502 | + } |
|
503 | + } |
|
504 | 504 | |
505 | - return $question_list; |
|
506 | - break; |
|
505 | + return $question_list; |
|
506 | + break; |
|
507 | 507 | |
508 | - default : |
|
509 | - return $parsed; |
|
510 | - break; |
|
511 | - } |
|
512 | - } |
|
513 | - |
|
514 | - |
|
515 | - public function additional_primary_registration_details_shortcodes($shortcodes, $shortcode_parser) |
|
516 | - { |
|
517 | - $shortcodes['[PRIMARY_REGISTRANT_QUESTION_LIST]'] = __('This is used to indicate the questions and answers for the primary_registrant. It should be placed in the "[attendee_list]" field', |
|
518 | - 'event_espresso'); |
|
519 | - |
|
520 | - return $shortcodes; |
|
521 | - } |
|
522 | - |
|
523 | - |
|
524 | - public function additional_primary_registration_details_parser( |
|
525 | - $parsed, |
|
526 | - $shortcode, |
|
527 | - $data, |
|
528 | - $extra_data, |
|
529 | - $shortcode_parser |
|
530 | - ) { |
|
531 | - if (array($data) && ! isset($data['data'])) { |
|
532 | - return $parsed; |
|
533 | - } |
|
534 | - |
|
535 | - $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : null; |
|
536 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
537 | - |
|
538 | - if ( ! $recipient instanceof EE_Messages_Addressee) { |
|
539 | - return $parsed; |
|
540 | - } |
|
541 | - |
|
542 | - $send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data; |
|
543 | - |
|
544 | - switch ($shortcode) { |
|
545 | - case '[RECIPIENT_QUESTION_LIST]' : |
|
546 | - if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration) { |
|
547 | - return ''; |
|
548 | - } |
|
549 | - $registration = $recipient->primary_reg_obj; |
|
550 | - $template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
551 | - $valid_shortcodes = array('question'); |
|
552 | - $shortcode_helper = $shortcode_parser->get_shortcode_helper(); |
|
553 | - $answers = $recipient->registrations[$registration->ID()]['ans_objs']; |
|
554 | - $question_list = ''; |
|
555 | - foreach ($answers as $answer) { |
|
556 | - if ($answer instanceof EE_Answer) { |
|
557 | - $question = $answer->question(); |
|
558 | - if ($question instanceof EE_Question and $question->admin_only()) { |
|
559 | - continue; |
|
560 | - } |
|
561 | - $question_list .= $shortcode_helper->parse_question_list_template($template, $answer, |
|
562 | - $valid_shortcodes, $send_data); |
|
563 | - } |
|
564 | - } |
|
508 | + default : |
|
509 | + return $parsed; |
|
510 | + break; |
|
511 | + } |
|
512 | + } |
|
513 | + |
|
514 | + |
|
515 | + public function additional_primary_registration_details_shortcodes($shortcodes, $shortcode_parser) |
|
516 | + { |
|
517 | + $shortcodes['[PRIMARY_REGISTRANT_QUESTION_LIST]'] = __('This is used to indicate the questions and answers for the primary_registrant. It should be placed in the "[attendee_list]" field', |
|
518 | + 'event_espresso'); |
|
519 | + |
|
520 | + return $shortcodes; |
|
521 | + } |
|
522 | + |
|
523 | + |
|
524 | + public function additional_primary_registration_details_parser( |
|
525 | + $parsed, |
|
526 | + $shortcode, |
|
527 | + $data, |
|
528 | + $extra_data, |
|
529 | + $shortcode_parser |
|
530 | + ) { |
|
531 | + if (array($data) && ! isset($data['data'])) { |
|
532 | + return $parsed; |
|
533 | + } |
|
534 | + |
|
535 | + $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : null; |
|
536 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
537 | + |
|
538 | + if ( ! $recipient instanceof EE_Messages_Addressee) { |
|
539 | + return $parsed; |
|
540 | + } |
|
541 | + |
|
542 | + $send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data; |
|
543 | + |
|
544 | + switch ($shortcode) { |
|
545 | + case '[RECIPIENT_QUESTION_LIST]' : |
|
546 | + if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration) { |
|
547 | + return ''; |
|
548 | + } |
|
549 | + $registration = $recipient->primary_reg_obj; |
|
550 | + $template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
551 | + $valid_shortcodes = array('question'); |
|
552 | + $shortcode_helper = $shortcode_parser->get_shortcode_helper(); |
|
553 | + $answers = $recipient->registrations[$registration->ID()]['ans_objs']; |
|
554 | + $question_list = ''; |
|
555 | + foreach ($answers as $answer) { |
|
556 | + if ($answer instanceof EE_Answer) { |
|
557 | + $question = $answer->question(); |
|
558 | + if ($question instanceof EE_Question and $question->admin_only()) { |
|
559 | + continue; |
|
560 | + } |
|
561 | + $question_list .= $shortcode_helper->parse_question_list_template($template, $answer, |
|
562 | + $valid_shortcodes, $send_data); |
|
563 | + } |
|
564 | + } |
|
565 | 565 | |
566 | - return $question_list; |
|
567 | - break; |
|
566 | + return $question_list; |
|
567 | + break; |
|
568 | 568 | |
569 | - default : |
|
570 | - return $parsed; |
|
571 | - break; |
|
572 | - } |
|
573 | - } |
|
574 | - |
|
575 | - |
|
576 | - /** |
|
577 | - * Takes care of registering the message types that are only available in caffeinated EE. |
|
578 | - * |
|
579 | - * @since 4.3.2 |
|
580 | - * |
|
581 | - * @return void |
|
582 | - */ |
|
583 | - public function register_caf_message_types() |
|
584 | - { |
|
585 | - //register newsletter message type |
|
586 | - $setup_args = array( |
|
587 | - 'mtfilename' => 'EE_Newsletter_message_type.class.php', |
|
588 | - 'autoloadpaths' => array( |
|
589 | - EE_CAF_LIBRARIES . 'messages/message_type/newsletter/' |
|
590 | - ), |
|
591 | - 'messengers_to_activate_with' => array('email'), |
|
592 | - 'messengers_to_validate_with' => array('email') |
|
593 | - ); |
|
594 | - EE_Register_Message_Type::register('newsletter', $setup_args); |
|
595 | - |
|
596 | - //register payment reminder message type |
|
597 | - $setup_args = array( |
|
598 | - 'mtfilename' => 'EE_Payment_Reminder_message_type.class.php', |
|
599 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_reminder/'), |
|
600 | - 'messengers_to_activate_with' => array('email'), |
|
601 | - 'messengers_to_validate_with' => array('email') |
|
602 | - ); |
|
603 | - EE_Register_Message_Type::register('payment_reminder', $setup_args); |
|
604 | - |
|
605 | - //register payment declined message type |
|
606 | - $setup_args = array( |
|
607 | - 'mtfilename' => 'EE_Payment_Declined_message_type.class.php', |
|
608 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_declined/'), |
|
609 | - 'messengers_to_activate_with' => array('email'), |
|
610 | - 'messengers_to_validate_with' => array('email') |
|
611 | - ); |
|
612 | - EE_Register_Message_Type::register('payment_declined', $setup_args); |
|
613 | - |
|
614 | - //register registration declined message type |
|
615 | - $setup_args = array( |
|
616 | - 'mtfilename' => 'EE_Declined_Registration_message_type.class.php', |
|
617 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/declined_registration/'), |
|
618 | - 'messengers_to_activate_with' => array('email'), |
|
619 | - 'messengers_to_validate_with' => array('email') |
|
620 | - ); |
|
621 | - EE_Register_Message_Type::register('declined_registration', $setup_args); |
|
622 | - |
|
623 | - //register registration cancelled message type |
|
624 | - $setup_args = array( |
|
625 | - 'mtfilename' => 'EE_Cancelled_Registration_message_type.class.php', |
|
626 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/cancelled_registration/'), |
|
627 | - 'messengers_to_activate_with' => array('email'), |
|
628 | - 'messengers_to_validate_with' => array('email') |
|
629 | - ); |
|
630 | - EE_Register_Message_Type::register('cancelled_registration', $setup_args); |
|
631 | - |
|
632 | - |
|
633 | - //register payment failed message type |
|
634 | - $setup_args = array( |
|
635 | - 'mtfilename' => 'EE_Payment_Failed_message_type.class.php', |
|
636 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_failed/'), |
|
637 | - 'messengers_to_activate_with' => array('email'), |
|
638 | - 'messengers_to_validate_with' => array('email') |
|
639 | - ); |
|
640 | - EE_Register_Message_Type::register('payment_failed', $setup_args); |
|
641 | - |
|
642 | - //register payment declined message type |
|
643 | - $setup_args = array( |
|
644 | - 'mtfilename' => 'EE_Payment_Cancelled_message_type.class.php', |
|
645 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_cancelled/'), |
|
646 | - 'messengers_to_activate_with' => array('email'), |
|
647 | - 'messengers_to_validate_with' => array('email') |
|
648 | - ); |
|
649 | - EE_Register_Message_Type::register('payment_cancelled', $setup_args); |
|
650 | - } |
|
651 | - |
|
652 | - |
|
653 | - /** |
|
654 | - * Takes care of registering the shortcode libraries implemented with caffeinated EE and set up related items. |
|
655 | - * |
|
656 | - * @since 4.3.2 |
|
657 | - * |
|
658 | - * @return void |
|
659 | - */ |
|
660 | - public function register_caf_shortcodes() |
|
661 | - { |
|
662 | - $setup_args = array( |
|
663 | - 'autoloadpaths' => array( |
|
664 | - EE_CAF_LIBRARIES . 'shortcodes/' |
|
665 | - ), |
|
666 | - 'msgr_validator_callback' => array('EE_Newsletter_Shortcodes', 'messenger_validator_config'), |
|
667 | - 'msgr_template_fields_callback' => array('EE_Newsletter_Shortcodes', 'messenger_template_fields'), |
|
668 | - 'list_type_shortcodes' => array('[NEWSLETTER_CONTENT]') |
|
669 | - ); |
|
670 | - EE_Register_Messages_Shortcode_Library::register('newsletter', $setup_args); |
|
671 | - } |
|
569 | + default : |
|
570 | + return $parsed; |
|
571 | + break; |
|
572 | + } |
|
573 | + } |
|
574 | + |
|
575 | + |
|
576 | + /** |
|
577 | + * Takes care of registering the message types that are only available in caffeinated EE. |
|
578 | + * |
|
579 | + * @since 4.3.2 |
|
580 | + * |
|
581 | + * @return void |
|
582 | + */ |
|
583 | + public function register_caf_message_types() |
|
584 | + { |
|
585 | + //register newsletter message type |
|
586 | + $setup_args = array( |
|
587 | + 'mtfilename' => 'EE_Newsletter_message_type.class.php', |
|
588 | + 'autoloadpaths' => array( |
|
589 | + EE_CAF_LIBRARIES . 'messages/message_type/newsletter/' |
|
590 | + ), |
|
591 | + 'messengers_to_activate_with' => array('email'), |
|
592 | + 'messengers_to_validate_with' => array('email') |
|
593 | + ); |
|
594 | + EE_Register_Message_Type::register('newsletter', $setup_args); |
|
595 | + |
|
596 | + //register payment reminder message type |
|
597 | + $setup_args = array( |
|
598 | + 'mtfilename' => 'EE_Payment_Reminder_message_type.class.php', |
|
599 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_reminder/'), |
|
600 | + 'messengers_to_activate_with' => array('email'), |
|
601 | + 'messengers_to_validate_with' => array('email') |
|
602 | + ); |
|
603 | + EE_Register_Message_Type::register('payment_reminder', $setup_args); |
|
604 | + |
|
605 | + //register payment declined message type |
|
606 | + $setup_args = array( |
|
607 | + 'mtfilename' => 'EE_Payment_Declined_message_type.class.php', |
|
608 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_declined/'), |
|
609 | + 'messengers_to_activate_with' => array('email'), |
|
610 | + 'messengers_to_validate_with' => array('email') |
|
611 | + ); |
|
612 | + EE_Register_Message_Type::register('payment_declined', $setup_args); |
|
613 | + |
|
614 | + //register registration declined message type |
|
615 | + $setup_args = array( |
|
616 | + 'mtfilename' => 'EE_Declined_Registration_message_type.class.php', |
|
617 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/declined_registration/'), |
|
618 | + 'messengers_to_activate_with' => array('email'), |
|
619 | + 'messengers_to_validate_with' => array('email') |
|
620 | + ); |
|
621 | + EE_Register_Message_Type::register('declined_registration', $setup_args); |
|
622 | + |
|
623 | + //register registration cancelled message type |
|
624 | + $setup_args = array( |
|
625 | + 'mtfilename' => 'EE_Cancelled_Registration_message_type.class.php', |
|
626 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/cancelled_registration/'), |
|
627 | + 'messengers_to_activate_with' => array('email'), |
|
628 | + 'messengers_to_validate_with' => array('email') |
|
629 | + ); |
|
630 | + EE_Register_Message_Type::register('cancelled_registration', $setup_args); |
|
631 | + |
|
632 | + |
|
633 | + //register payment failed message type |
|
634 | + $setup_args = array( |
|
635 | + 'mtfilename' => 'EE_Payment_Failed_message_type.class.php', |
|
636 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_failed/'), |
|
637 | + 'messengers_to_activate_with' => array('email'), |
|
638 | + 'messengers_to_validate_with' => array('email') |
|
639 | + ); |
|
640 | + EE_Register_Message_Type::register('payment_failed', $setup_args); |
|
641 | + |
|
642 | + //register payment declined message type |
|
643 | + $setup_args = array( |
|
644 | + 'mtfilename' => 'EE_Payment_Cancelled_message_type.class.php', |
|
645 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_cancelled/'), |
|
646 | + 'messengers_to_activate_with' => array('email'), |
|
647 | + 'messengers_to_validate_with' => array('email') |
|
648 | + ); |
|
649 | + EE_Register_Message_Type::register('payment_cancelled', $setup_args); |
|
650 | + } |
|
651 | + |
|
652 | + |
|
653 | + /** |
|
654 | + * Takes care of registering the shortcode libraries implemented with caffeinated EE and set up related items. |
|
655 | + * |
|
656 | + * @since 4.3.2 |
|
657 | + * |
|
658 | + * @return void |
|
659 | + */ |
|
660 | + public function register_caf_shortcodes() |
|
661 | + { |
|
662 | + $setup_args = array( |
|
663 | + 'autoloadpaths' => array( |
|
664 | + EE_CAF_LIBRARIES . 'shortcodes/' |
|
665 | + ), |
|
666 | + 'msgr_validator_callback' => array('EE_Newsletter_Shortcodes', 'messenger_validator_config'), |
|
667 | + 'msgr_template_fields_callback' => array('EE_Newsletter_Shortcodes', 'messenger_template_fields'), |
|
668 | + 'list_type_shortcodes' => array('[NEWSLETTER_CONTENT]') |
|
669 | + ); |
|
670 | + EE_Register_Messages_Shortcode_Library::register('newsletter', $setup_args); |
|
671 | + } |
|
672 | 672 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function messages_autoload_paths($dir_ref) |
97 | 97 | { |
98 | - $dir_ref[] = EE_CAF_LIBRARIES . 'shortcodes/'; |
|
98 | + $dir_ref[] = EE_CAF_LIBRARIES.'shortcodes/'; |
|
99 | 99 | |
100 | 100 | return $dir_ref; |
101 | 101 | } |
@@ -216,10 +216,10 @@ discard block |
||
216 | 216 | } |
217 | 217 | |
218 | 218 | //the template file name we're replacing contents for. |
219 | - $template_file_prefix = $field . '_' . $context; |
|
220 | - $msg_prefix = $messenger->name . '_' . $message_type->name . '_'; |
|
219 | + $template_file_prefix = $field.'_'.$context; |
|
220 | + $msg_prefix = $messenger->name.'_'.$message_type->name.'_'; |
|
221 | 221 | |
222 | - $base_path = EE_CAF_LIBRARIES . 'messages/defaults/default/'; |
|
222 | + $base_path = EE_CAF_LIBRARIES.'messages/defaults/default/'; |
|
223 | 223 | |
224 | 224 | if ($messenger->name == 'email' && $message_type->name == 'registration') { |
225 | 225 | |
@@ -228,17 +228,17 @@ discard block |
||
228 | 228 | case 'question_list_admin' : |
229 | 229 | case 'question_list_attendee' : |
230 | 230 | case 'question_list_primary_attendee' : |
231 | - $path = $base_path . $msg_prefix . 'question_list.template.php'; |
|
231 | + $path = $base_path.$msg_prefix.'question_list.template.php'; |
|
232 | 232 | $contents = EEH_Template::display_template($path, array(), true); |
233 | 233 | break; |
234 | 234 | |
235 | 235 | case 'attendee_list_primary_attendee' : |
236 | - $path = $base_path . $msg_prefix . 'attendee_list.template.php'; |
|
236 | + $path = $base_path.$msg_prefix.'attendee_list.template.php'; |
|
237 | 237 | $contents = EEH_Template::display_template($path, array(), true); |
238 | 238 | break; |
239 | 239 | |
240 | 240 | case 'attendee_list_admin' : |
241 | - $path = $base_path . $msg_prefix . 'attendee_list_admin.template.php'; |
|
241 | + $path = $base_path.$msg_prefix.'attendee_list_admin.template.php'; |
|
242 | 242 | $contents = EEH_Template::display_template($path, |
243 | 243 | array(), true); |
244 | 244 | break; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | break; |
249 | 249 | |
250 | 250 | case 'event_list_attendee' : |
251 | - $path = $base_path . $msg_prefix . 'event_list_attendee.template.php'; |
|
251 | + $path = $base_path.$msg_prefix.'event_list_attendee.template.php'; |
|
252 | 252 | $contents = EEH_Template::display_template($path, array(), true); |
253 | 253 | break; |
254 | 254 | } |
@@ -256,24 +256,24 @@ discard block |
||
256 | 256 | switch ($template_file_prefix) { |
257 | 257 | |
258 | 258 | case 'content_attendee' : |
259 | - $path = $base_path . $msg_prefix . 'content.template.php'; |
|
259 | + $path = $base_path.$msg_prefix.'content.template.php'; |
|
260 | 260 | $contents = EEH_Template::display_template($path, array(), true); |
261 | 261 | break; |
262 | 262 | |
263 | 263 | case 'newsletter_content_attendee' : |
264 | - $path = $base_path . $msg_prefix . 'newsletter_content.template.php'; |
|
264 | + $path = $base_path.$msg_prefix.'newsletter_content.template.php'; |
|
265 | 265 | $contents = EEH_Template::display_template($path, array(), true); |
266 | 266 | break; |
267 | 267 | |
268 | 268 | case 'newsletter_subject_attendee' : |
269 | - $path = $base_path . $msg_prefix . 'subject.template.php'; |
|
269 | + $path = $base_path.$msg_prefix.'subject.template.php'; |
|
270 | 270 | $contents = EEH_Template::display_template($path, array(), true); |
271 | 271 | break; |
272 | 272 | } |
273 | 273 | } elseif ($messenger->name == 'html' && $message_type->name == 'receipt') { |
274 | 274 | switch ($template_file_prefix) { |
275 | 275 | case 'attendee_list_purchaser' : |
276 | - $path = $base_path . $msg_prefix . 'attendee_list.template.php'; |
|
276 | + $path = $base_path.$msg_prefix.'attendee_list.template.php'; |
|
277 | 277 | $contents = EEH_Template::display_template($path, array(), true); |
278 | 278 | break; |
279 | 279 | } |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | $setup_args = array( |
587 | 587 | 'mtfilename' => 'EE_Newsletter_message_type.class.php', |
588 | 588 | 'autoloadpaths' => array( |
589 | - EE_CAF_LIBRARIES . 'messages/message_type/newsletter/' |
|
589 | + EE_CAF_LIBRARIES.'messages/message_type/newsletter/' |
|
590 | 590 | ), |
591 | 591 | 'messengers_to_activate_with' => array('email'), |
592 | 592 | 'messengers_to_validate_with' => array('email') |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | //register payment reminder message type |
597 | 597 | $setup_args = array( |
598 | 598 | 'mtfilename' => 'EE_Payment_Reminder_message_type.class.php', |
599 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_reminder/'), |
|
599 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_reminder/'), |
|
600 | 600 | 'messengers_to_activate_with' => array('email'), |
601 | 601 | 'messengers_to_validate_with' => array('email') |
602 | 602 | ); |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | //register payment declined message type |
606 | 606 | $setup_args = array( |
607 | 607 | 'mtfilename' => 'EE_Payment_Declined_message_type.class.php', |
608 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_declined/'), |
|
608 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_declined/'), |
|
609 | 609 | 'messengers_to_activate_with' => array('email'), |
610 | 610 | 'messengers_to_validate_with' => array('email') |
611 | 611 | ); |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | //register registration declined message type |
615 | 615 | $setup_args = array( |
616 | 616 | 'mtfilename' => 'EE_Declined_Registration_message_type.class.php', |
617 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/declined_registration/'), |
|
617 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/declined_registration/'), |
|
618 | 618 | 'messengers_to_activate_with' => array('email'), |
619 | 619 | 'messengers_to_validate_with' => array('email') |
620 | 620 | ); |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | //register registration cancelled message type |
624 | 624 | $setup_args = array( |
625 | 625 | 'mtfilename' => 'EE_Cancelled_Registration_message_type.class.php', |
626 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/cancelled_registration/'), |
|
626 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/cancelled_registration/'), |
|
627 | 627 | 'messengers_to_activate_with' => array('email'), |
628 | 628 | 'messengers_to_validate_with' => array('email') |
629 | 629 | ); |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | //register payment failed message type |
634 | 634 | $setup_args = array( |
635 | 635 | 'mtfilename' => 'EE_Payment_Failed_message_type.class.php', |
636 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_failed/'), |
|
636 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_failed/'), |
|
637 | 637 | 'messengers_to_activate_with' => array('email'), |
638 | 638 | 'messengers_to_validate_with' => array('email') |
639 | 639 | ); |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | //register payment declined message type |
643 | 643 | $setup_args = array( |
644 | 644 | 'mtfilename' => 'EE_Payment_Cancelled_message_type.class.php', |
645 | - 'autoloadpaths' => array(EE_CAF_LIBRARIES . 'messages/message_type/payment_cancelled/'), |
|
645 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_cancelled/'), |
|
646 | 646 | 'messengers_to_activate_with' => array('email'), |
647 | 647 | 'messengers_to_validate_with' => array('email') |
648 | 648 | ); |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | { |
662 | 662 | $setup_args = array( |
663 | 663 | 'autoloadpaths' => array( |
664 | - EE_CAF_LIBRARIES . 'shortcodes/' |
|
664 | + EE_CAF_LIBRARIES.'shortcodes/' |
|
665 | 665 | ), |
666 | 666 | 'msgr_validator_callback' => array('EE_Newsletter_Shortcodes', 'messenger_validator_config'), |
667 | 667 | 'msgr_template_fields_callback' => array('EE_Newsletter_Shortcodes', 'messenger_template_fields'), |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
4 | - exit('NO direct script access allowed'); |
|
4 | + exit('NO direct script access allowed'); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | /** |
@@ -36,77 +36,77 @@ discard block |
||
36 | 36 | { |
37 | 37 | |
38 | 38 | |
39 | - public function __construct() |
|
40 | - { |
|
41 | - parent::__construct(); |
|
42 | - } |
|
39 | + public function __construct() |
|
40 | + { |
|
41 | + parent::__construct(); |
|
42 | + } |
|
43 | 43 | |
44 | 44 | |
45 | - protected function _init_props() |
|
46 | - { |
|
47 | - $this->label = __('Questions and Answers Shortcodes', 'event_espresso'); |
|
48 | - $this->description = __('All shortcodes related to custom questions and answers', 'event_espresso'); |
|
49 | - $this->_shortcodes = array( |
|
50 | - '[QUESTION_LIST]' => __('This is used to indicate where you want the list of questions and answers to show for the registrant. You place this within the "[attendee_list]" field.', |
|
51 | - 'event_espresso') |
|
52 | - ); |
|
53 | - } |
|
45 | + protected function _init_props() |
|
46 | + { |
|
47 | + $this->label = __('Questions and Answers Shortcodes', 'event_espresso'); |
|
48 | + $this->description = __('All shortcodes related to custom questions and answers', 'event_espresso'); |
|
49 | + $this->_shortcodes = array( |
|
50 | + '[QUESTION_LIST]' => __('This is used to indicate where you want the list of questions and answers to show for the registrant. You place this within the "[attendee_list]" field.', |
|
51 | + 'event_espresso') |
|
52 | + ); |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - protected function _parser($shortcode) |
|
57 | - { |
|
56 | + protected function _parser($shortcode) |
|
57 | + { |
|
58 | 58 | |
59 | 59 | |
60 | - switch ($shortcode) { |
|
61 | - case '[QUESTION_LIST]' : |
|
62 | - return $this->_get_question_list(); |
|
63 | - break; |
|
64 | - } |
|
60 | + switch ($shortcode) { |
|
61 | + case '[QUESTION_LIST]' : |
|
62 | + return $this->_get_question_list(); |
|
63 | + break; |
|
64 | + } |
|
65 | 65 | |
66 | - return ''; |
|
67 | - } |
|
66 | + return ''; |
|
67 | + } |
|
68 | 68 | |
69 | 69 | |
70 | - protected function _get_question_list() |
|
71 | - { |
|
72 | - $this->_validate_list_requirements(); |
|
70 | + protected function _get_question_list() |
|
71 | + { |
|
72 | + $this->_validate_list_requirements(); |
|
73 | 73 | |
74 | - //for when [QUESTION_LIST] is used in the [attendee_list] field. |
|
75 | - if ($this->_data['data'] instanceof EE_Registration) { |
|
76 | - return $this->_get_question_answer_list_for_attendee(); |
|
77 | - } //for when [QUESTION_LIST] is used in the main content field. |
|
78 | - else if ($this->_data['data'] instanceof EE_Messages_Addressee && $this->_data['data']->reg_obj instanceof EE_Registration) { |
|
79 | - return $this->_get_question_answer_list_for_attendee($this->_data['data']->reg_obj); |
|
80 | - } else { |
|
81 | - return ''; |
|
82 | - } |
|
83 | - } |
|
74 | + //for when [QUESTION_LIST] is used in the [attendee_list] field. |
|
75 | + if ($this->_data['data'] instanceof EE_Registration) { |
|
76 | + return $this->_get_question_answer_list_for_attendee(); |
|
77 | + } //for when [QUESTION_LIST] is used in the main content field. |
|
78 | + else if ($this->_data['data'] instanceof EE_Messages_Addressee && $this->_data['data']->reg_obj instanceof EE_Registration) { |
|
79 | + return $this->_get_question_answer_list_for_attendee($this->_data['data']->reg_obj); |
|
80 | + } else { |
|
81 | + return ''; |
|
82 | + } |
|
83 | + } |
|
84 | 84 | |
85 | 85 | |
86 | - /** |
|
87 | - * Note when we parse the "[question_list]" shortcode for attendees we're actually going to retrieve the list of |
|
88 | - * answers for that attendee since that is what we really need (we can derive the questions from the answers); |
|
89 | - * @return string parsed template. |
|
90 | - */ |
|
91 | - private function _get_question_answer_list_for_attendee($reg_obj = null) |
|
92 | - { |
|
93 | - $valid_shortcodes = array('question'); |
|
94 | - $reg_obj = $reg_obj instanceof EE_Registration ? $reg_obj : $this->_data['data']; |
|
95 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['question_list']) ? $this->_data['template']['question_list'] : ''; |
|
96 | - $template = empty($template) && isset($this->_extra_data['template']['question_list']) ? $this->_extra_data['template']['question_list'] : $template; |
|
97 | - $ans_result = ''; |
|
98 | - $answers = ! empty($this->_extra_data['data']->registrations[$reg_obj->ID()]['ans_objs']) ? $this->_extra_data['data']->registrations[$reg_obj->ID()]['ans_objs'] : array(); |
|
99 | - foreach ($answers as $answer) { |
|
100 | - $question = $answer->question(); |
|
101 | - if ($question instanceof EE_Question and $question->admin_only()) { |
|
102 | - continue; |
|
103 | - } |
|
104 | - $ans_result .= $this->_shortcode_helper->parse_question_list_template($template, $answer, $valid_shortcodes, |
|
105 | - $this->_extra_data); |
|
106 | - } |
|
86 | + /** |
|
87 | + * Note when we parse the "[question_list]" shortcode for attendees we're actually going to retrieve the list of |
|
88 | + * answers for that attendee since that is what we really need (we can derive the questions from the answers); |
|
89 | + * @return string parsed template. |
|
90 | + */ |
|
91 | + private function _get_question_answer_list_for_attendee($reg_obj = null) |
|
92 | + { |
|
93 | + $valid_shortcodes = array('question'); |
|
94 | + $reg_obj = $reg_obj instanceof EE_Registration ? $reg_obj : $this->_data['data']; |
|
95 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['question_list']) ? $this->_data['template']['question_list'] : ''; |
|
96 | + $template = empty($template) && isset($this->_extra_data['template']['question_list']) ? $this->_extra_data['template']['question_list'] : $template; |
|
97 | + $ans_result = ''; |
|
98 | + $answers = ! empty($this->_extra_data['data']->registrations[$reg_obj->ID()]['ans_objs']) ? $this->_extra_data['data']->registrations[$reg_obj->ID()]['ans_objs'] : array(); |
|
99 | + foreach ($answers as $answer) { |
|
100 | + $question = $answer->question(); |
|
101 | + if ($question instanceof EE_Question and $question->admin_only()) { |
|
102 | + continue; |
|
103 | + } |
|
104 | + $ans_result .= $this->_shortcode_helper->parse_question_list_template($template, $answer, $valid_shortcodes, |
|
105 | + $this->_extra_data); |
|
106 | + } |
|
107 | 107 | |
108 | - return $ans_result; |
|
109 | - } |
|
108 | + return $ans_result; |
|
109 | + } |
|
110 | 110 | |
111 | 111 | |
112 | 112 | } //end EE_Question_List_Shortcodes class |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | * |
599 | 599 | * @param string $CNT_ISO |
600 | 600 | * |
601 | - * @return mixed string | array |
|
601 | + * @return string|null string | array |
|
602 | 602 | */ |
603 | 603 | public function display_country_settings($CNT_ISO = '') |
604 | 604 | { |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | * delete_state |
885 | 885 | * |
886 | 886 | * @access public |
887 | - * @return boolean | void |
|
887 | + * @return false|null | void |
|
888 | 888 | */ |
889 | 889 | public function delete_state() |
890 | 890 | { |
@@ -1126,11 +1126,11 @@ discard block |
||
1126 | 1126 | /** |
1127 | 1127 | * generates a dropdown of all parent pages - copied from WP core |
1128 | 1128 | * |
1129 | - * @param unknown_type $default |
|
1130 | - * @param unknown_type $parent |
|
1131 | - * @param unknown_type $level |
|
1129 | + * @param integer $default |
|
1130 | + * @param integer $parent |
|
1131 | + * @param integer $level |
|
1132 | 1132 | * |
1133 | - * @return unknown |
|
1133 | + * @return null|false |
|
1134 | 1134 | */ |
1135 | 1135 | public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0) |
1136 | 1136 | { |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | use EventEspresso\admin_pages\general_settings\AdminOptionsSettings; |
3 | 3 | |
4 | 4 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
5 | - exit('NO direct script access allowed'); |
|
5 | + exit('NO direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | /** |
@@ -22,1138 +22,1138 @@ discard block |
||
22 | 22 | { |
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * _question_group |
|
27 | - * holds the specific question group object for the question group details screen |
|
28 | - * @var object |
|
29 | - */ |
|
30 | - protected $_question_group; |
|
25 | + /** |
|
26 | + * _question_group |
|
27 | + * holds the specific question group object for the question group details screen |
|
28 | + * @var object |
|
29 | + */ |
|
30 | + protected $_question_group; |
|
31 | 31 | |
32 | 32 | |
33 | - public function __construct($routing = true) |
|
34 | - { |
|
35 | - parent::__construct($routing); |
|
36 | - } |
|
33 | + public function __construct($routing = true) |
|
34 | + { |
|
35 | + parent::__construct($routing); |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | - protected function _init_page_props() |
|
40 | - { |
|
41 | - $this->page_slug = GEN_SET_PG_SLUG; |
|
42 | - $this->page_label = GEN_SET_LABEL; |
|
43 | - $this->_admin_base_url = GEN_SET_ADMIN_URL; |
|
44 | - $this->_admin_base_path = GEN_SET_ADMIN; |
|
45 | - } |
|
39 | + protected function _init_page_props() |
|
40 | + { |
|
41 | + $this->page_slug = GEN_SET_PG_SLUG; |
|
42 | + $this->page_label = GEN_SET_LABEL; |
|
43 | + $this->_admin_base_url = GEN_SET_ADMIN_URL; |
|
44 | + $this->_admin_base_path = GEN_SET_ADMIN; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - protected function _ajax_hooks() |
|
49 | - { |
|
50 | - add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings')); |
|
51 | - add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states')); |
|
52 | - add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3); |
|
53 | - add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state')); |
|
54 | - } |
|
48 | + protected function _ajax_hooks() |
|
49 | + { |
|
50 | + add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings')); |
|
51 | + add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states')); |
|
52 | + add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3); |
|
53 | + add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state')); |
|
54 | + } |
|
55 | 55 | |
56 | 56 | |
57 | - protected function _define_page_props() |
|
58 | - { |
|
59 | - $this->_admin_page_title = GEN_SET_LABEL; |
|
60 | - $this->_labels = array( |
|
61 | - 'publishbox' => __('Update Settings', 'event_espresso') |
|
62 | - ); |
|
63 | - } |
|
57 | + protected function _define_page_props() |
|
58 | + { |
|
59 | + $this->_admin_page_title = GEN_SET_LABEL; |
|
60 | + $this->_labels = array( |
|
61 | + 'publishbox' => __('Update Settings', 'event_espresso') |
|
62 | + ); |
|
63 | + } |
|
64 | 64 | |
65 | 65 | |
66 | - protected function _set_page_routes() |
|
67 | - { |
|
68 | - $this->_page_routes = array( |
|
66 | + protected function _set_page_routes() |
|
67 | + { |
|
68 | + $this->_page_routes = array( |
|
69 | 69 | |
70 | - 'critical_pages' => array( |
|
71 | - 'func' => '_espresso_page_settings', |
|
72 | - 'capability' => 'manage_options' |
|
73 | - ), |
|
74 | - 'update_espresso_page_settings' => array( |
|
75 | - 'func' => '_update_espresso_page_settings', |
|
76 | - 'capability' => 'manage_options', |
|
77 | - 'noheader' => true, |
|
78 | - ), |
|
79 | - 'default' => array( |
|
80 | - 'func' => '_your_organization_settings', |
|
81 | - 'capability' => 'manage_options', |
|
82 | - ), |
|
70 | + 'critical_pages' => array( |
|
71 | + 'func' => '_espresso_page_settings', |
|
72 | + 'capability' => 'manage_options' |
|
73 | + ), |
|
74 | + 'update_espresso_page_settings' => array( |
|
75 | + 'func' => '_update_espresso_page_settings', |
|
76 | + 'capability' => 'manage_options', |
|
77 | + 'noheader' => true, |
|
78 | + ), |
|
79 | + 'default' => array( |
|
80 | + 'func' => '_your_organization_settings', |
|
81 | + 'capability' => 'manage_options', |
|
82 | + ), |
|
83 | 83 | |
84 | - 'update_your_organization_settings' => array( |
|
85 | - 'func' => '_update_your_organization_settings', |
|
86 | - 'capability' => 'manage_options', |
|
87 | - 'noheader' => true, |
|
88 | - ), |
|
84 | + 'update_your_organization_settings' => array( |
|
85 | + 'func' => '_update_your_organization_settings', |
|
86 | + 'capability' => 'manage_options', |
|
87 | + 'noheader' => true, |
|
88 | + ), |
|
89 | 89 | |
90 | - 'admin_option_settings' => array( |
|
91 | - 'func' => '_admin_option_settings', |
|
92 | - 'capability' => 'manage_options', |
|
93 | - ), |
|
90 | + 'admin_option_settings' => array( |
|
91 | + 'func' => '_admin_option_settings', |
|
92 | + 'capability' => 'manage_options', |
|
93 | + ), |
|
94 | 94 | |
95 | - 'update_admin_option_settings' => array( |
|
96 | - 'func' => '_update_admin_option_settings', |
|
97 | - 'capability' => 'manage_options', |
|
98 | - 'noheader' => true, |
|
99 | - ), |
|
95 | + 'update_admin_option_settings' => array( |
|
96 | + 'func' => '_update_admin_option_settings', |
|
97 | + 'capability' => 'manage_options', |
|
98 | + 'noheader' => true, |
|
99 | + ), |
|
100 | 100 | |
101 | - 'country_settings' => array( |
|
102 | - 'func' => '_country_settings', |
|
103 | - 'capability' => 'manage_options' |
|
104 | - ), |
|
101 | + 'country_settings' => array( |
|
102 | + 'func' => '_country_settings', |
|
103 | + 'capability' => 'manage_options' |
|
104 | + ), |
|
105 | 105 | |
106 | - 'update_country_settings' => array( |
|
107 | - 'func' => '_update_country_settings', |
|
108 | - 'capability' => 'manage_options', |
|
109 | - 'noheader' => true, |
|
110 | - ), |
|
106 | + 'update_country_settings' => array( |
|
107 | + 'func' => '_update_country_settings', |
|
108 | + 'capability' => 'manage_options', |
|
109 | + 'noheader' => true, |
|
110 | + ), |
|
111 | 111 | |
112 | - 'display_country_settings' => array( |
|
113 | - 'func' => 'display_country_settings', |
|
114 | - 'capability' => 'manage_options', |
|
115 | - 'noheader' => true, |
|
116 | - ), |
|
112 | + 'display_country_settings' => array( |
|
113 | + 'func' => 'display_country_settings', |
|
114 | + 'capability' => 'manage_options', |
|
115 | + 'noheader' => true, |
|
116 | + ), |
|
117 | 117 | |
118 | - 'add_new_state' => array( |
|
119 | - 'func' => 'add_new_state', |
|
120 | - 'capability' => 'manage_options', |
|
121 | - 'noheader' => true, |
|
122 | - ), |
|
118 | + 'add_new_state' => array( |
|
119 | + 'func' => 'add_new_state', |
|
120 | + 'capability' => 'manage_options', |
|
121 | + 'noheader' => true, |
|
122 | + ), |
|
123 | 123 | |
124 | - 'delete_state' => array( |
|
125 | - 'func' => 'delete_state', |
|
126 | - 'capability' => 'manage_options', |
|
127 | - 'noheader' => true, |
|
128 | - ) |
|
129 | - ); |
|
130 | - } |
|
131 | - |
|
132 | - |
|
133 | - protected function _set_page_config() |
|
134 | - { |
|
135 | - $this->_page_config = array( |
|
136 | - 'critical_pages' => array( |
|
137 | - 'nav' => array( |
|
138 | - 'label' => __('Critical Pages', 'event_espresso'), |
|
139 | - 'order' => 50 |
|
140 | - ), |
|
141 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
142 | - 'help_tabs' => array( |
|
143 | - 'general_settings_critical_pages_help_tab' => array( |
|
144 | - 'title' => __('Critical Pages', 'event_espresso'), |
|
145 | - 'filename' => 'general_settings_critical_pages' |
|
146 | - ) |
|
147 | - ), |
|
148 | - 'help_tour' => array('Critical_Pages_Help_Tour'), |
|
149 | - 'require_nonce' => false |
|
150 | - ), |
|
151 | - 'default' => array( |
|
152 | - 'nav' => array( |
|
153 | - 'label' => __('Your Organization', 'event_espresso'), |
|
154 | - 'order' => 20 |
|
155 | - ), |
|
156 | - 'help_tabs' => array( |
|
157 | - 'general_settings_your_organization_help_tab' => array( |
|
158 | - 'title' => __('Your Organization', 'event_espresso'), |
|
159 | - 'filename' => 'general_settings_your_organization' |
|
160 | - ) |
|
161 | - ), |
|
162 | - 'help_tour' => array('Your_Organization_Help_Tour'), |
|
163 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
164 | - 'require_nonce' => false |
|
165 | - ), |
|
166 | - 'admin_option_settings' => array( |
|
167 | - 'nav' => array( |
|
168 | - 'label' => __('Admin Options', 'event_espresso'), |
|
169 | - 'order' => 60 |
|
170 | - ), |
|
171 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
172 | - 'help_tabs' => array( |
|
173 | - 'general_settings_admin_options_help_tab' => array( |
|
174 | - 'title' => __('Admin Options', 'event_espresso'), |
|
175 | - 'filename' => 'general_settings_admin_options' |
|
176 | - ) |
|
177 | - ), |
|
178 | - 'help_tour' => array('Admin_Options_Help_Tour'), |
|
179 | - 'require_nonce' => false |
|
180 | - ), |
|
181 | - 'country_settings' => array( |
|
182 | - 'nav' => array( |
|
183 | - 'label' => __('Countries', 'event_espresso'), |
|
184 | - 'order' => 70 |
|
185 | - ), |
|
186 | - 'help_tabs' => array( |
|
187 | - 'general_settings_countries_help_tab' => array( |
|
188 | - 'title' => __('Countries', 'event_espresso'), |
|
189 | - 'filename' => 'general_settings_countries' |
|
190 | - ) |
|
191 | - ), |
|
192 | - 'help_tour' => array('Countries_Help_Tour'), |
|
193 | - 'require_nonce' => false |
|
194 | - ) |
|
195 | - ); |
|
196 | - } |
|
197 | - |
|
198 | - |
|
199 | - protected function _add_screen_options() |
|
200 | - { |
|
201 | - } |
|
202 | - |
|
203 | - protected function _add_feature_pointers() |
|
204 | - { |
|
205 | - } |
|
206 | - |
|
207 | - public function load_scripts_styles() |
|
208 | - { |
|
209 | - //styles |
|
210 | - wp_enqueue_style('espresso-ui-theme'); |
|
211 | - //scripts |
|
212 | - wp_enqueue_script('ee_admin_js'); |
|
213 | - } |
|
214 | - |
|
215 | - public function admin_init() |
|
216 | - { |
|
217 | - EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', |
|
218 | - 'event_espresso'); |
|
219 | - EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', |
|
220 | - 'event_espresso'); |
|
221 | - EE_Registry::$i18n_js_strings['confirm_delete_state'] = __('Are you sure you want to delete this State / Province?', |
|
222 | - 'event_espresso'); |
|
223 | - $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; |
|
224 | - EE_Registry::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php?page=espresso_general_settings', |
|
225 | - $protocol); |
|
226 | - } |
|
227 | - |
|
228 | - public function admin_notices() |
|
229 | - { |
|
230 | - } |
|
231 | - |
|
232 | - public function admin_footer_scripts() |
|
233 | - { |
|
234 | - } |
|
235 | - |
|
236 | - |
|
237 | - public function load_scripts_styles_default() |
|
238 | - { |
|
239 | - //styles |
|
240 | - wp_enqueue_style('thickbox'); |
|
241 | - //scripts |
|
242 | - wp_enqueue_script('media-upload'); |
|
243 | - wp_enqueue_script('thickbox'); |
|
244 | - wp_register_script('organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js', |
|
245 | - array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, true); |
|
246 | - wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION); |
|
247 | - wp_enqueue_script('organization_settings'); |
|
248 | - wp_enqueue_style('organization-css'); |
|
249 | - $confirm_image_delete = array( |
|
250 | - 'text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', |
|
251 | - 'event_espresso') |
|
252 | - ); |
|
253 | - wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete); |
|
124 | + 'delete_state' => array( |
|
125 | + 'func' => 'delete_state', |
|
126 | + 'capability' => 'manage_options', |
|
127 | + 'noheader' => true, |
|
128 | + ) |
|
129 | + ); |
|
130 | + } |
|
131 | + |
|
132 | + |
|
133 | + protected function _set_page_config() |
|
134 | + { |
|
135 | + $this->_page_config = array( |
|
136 | + 'critical_pages' => array( |
|
137 | + 'nav' => array( |
|
138 | + 'label' => __('Critical Pages', 'event_espresso'), |
|
139 | + 'order' => 50 |
|
140 | + ), |
|
141 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
142 | + 'help_tabs' => array( |
|
143 | + 'general_settings_critical_pages_help_tab' => array( |
|
144 | + 'title' => __('Critical Pages', 'event_espresso'), |
|
145 | + 'filename' => 'general_settings_critical_pages' |
|
146 | + ) |
|
147 | + ), |
|
148 | + 'help_tour' => array('Critical_Pages_Help_Tour'), |
|
149 | + 'require_nonce' => false |
|
150 | + ), |
|
151 | + 'default' => array( |
|
152 | + 'nav' => array( |
|
153 | + 'label' => __('Your Organization', 'event_espresso'), |
|
154 | + 'order' => 20 |
|
155 | + ), |
|
156 | + 'help_tabs' => array( |
|
157 | + 'general_settings_your_organization_help_tab' => array( |
|
158 | + 'title' => __('Your Organization', 'event_espresso'), |
|
159 | + 'filename' => 'general_settings_your_organization' |
|
160 | + ) |
|
161 | + ), |
|
162 | + 'help_tour' => array('Your_Organization_Help_Tour'), |
|
163 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
164 | + 'require_nonce' => false |
|
165 | + ), |
|
166 | + 'admin_option_settings' => array( |
|
167 | + 'nav' => array( |
|
168 | + 'label' => __('Admin Options', 'event_espresso'), |
|
169 | + 'order' => 60 |
|
170 | + ), |
|
171 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
172 | + 'help_tabs' => array( |
|
173 | + 'general_settings_admin_options_help_tab' => array( |
|
174 | + 'title' => __('Admin Options', 'event_espresso'), |
|
175 | + 'filename' => 'general_settings_admin_options' |
|
176 | + ) |
|
177 | + ), |
|
178 | + 'help_tour' => array('Admin_Options_Help_Tour'), |
|
179 | + 'require_nonce' => false |
|
180 | + ), |
|
181 | + 'country_settings' => array( |
|
182 | + 'nav' => array( |
|
183 | + 'label' => __('Countries', 'event_espresso'), |
|
184 | + 'order' => 70 |
|
185 | + ), |
|
186 | + 'help_tabs' => array( |
|
187 | + 'general_settings_countries_help_tab' => array( |
|
188 | + 'title' => __('Countries', 'event_espresso'), |
|
189 | + 'filename' => 'general_settings_countries' |
|
190 | + ) |
|
191 | + ), |
|
192 | + 'help_tour' => array('Countries_Help_Tour'), |
|
193 | + 'require_nonce' => false |
|
194 | + ) |
|
195 | + ); |
|
196 | + } |
|
197 | + |
|
198 | + |
|
199 | + protected function _add_screen_options() |
|
200 | + { |
|
201 | + } |
|
202 | + |
|
203 | + protected function _add_feature_pointers() |
|
204 | + { |
|
205 | + } |
|
206 | + |
|
207 | + public function load_scripts_styles() |
|
208 | + { |
|
209 | + //styles |
|
210 | + wp_enqueue_style('espresso-ui-theme'); |
|
211 | + //scripts |
|
212 | + wp_enqueue_script('ee_admin_js'); |
|
213 | + } |
|
214 | + |
|
215 | + public function admin_init() |
|
216 | + { |
|
217 | + EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', |
|
218 | + 'event_espresso'); |
|
219 | + EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', |
|
220 | + 'event_espresso'); |
|
221 | + EE_Registry::$i18n_js_strings['confirm_delete_state'] = __('Are you sure you want to delete this State / Province?', |
|
222 | + 'event_espresso'); |
|
223 | + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; |
|
224 | + EE_Registry::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php?page=espresso_general_settings', |
|
225 | + $protocol); |
|
226 | + } |
|
227 | + |
|
228 | + public function admin_notices() |
|
229 | + { |
|
230 | + } |
|
231 | + |
|
232 | + public function admin_footer_scripts() |
|
233 | + { |
|
234 | + } |
|
235 | + |
|
236 | + |
|
237 | + public function load_scripts_styles_default() |
|
238 | + { |
|
239 | + //styles |
|
240 | + wp_enqueue_style('thickbox'); |
|
241 | + //scripts |
|
242 | + wp_enqueue_script('media-upload'); |
|
243 | + wp_enqueue_script('thickbox'); |
|
244 | + wp_register_script('organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js', |
|
245 | + array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, true); |
|
246 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION); |
|
247 | + wp_enqueue_script('organization_settings'); |
|
248 | + wp_enqueue_style('organization-css'); |
|
249 | + $confirm_image_delete = array( |
|
250 | + 'text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', |
|
251 | + 'event_espresso') |
|
252 | + ); |
|
253 | + wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete); |
|
254 | 254 | |
255 | - } |
|
256 | - |
|
257 | - public function load_scripts_styles_country_settings() |
|
258 | - { |
|
259 | - //scripts |
|
260 | - wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js', |
|
261 | - array('ee_admin_js'), EVENT_ESPRESSO_VERSION, true); |
|
262 | - wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION); |
|
263 | - wp_enqueue_script('gen_settings_countries'); |
|
264 | - wp_enqueue_style('organization-css'); |
|
255 | + } |
|
256 | + |
|
257 | + public function load_scripts_styles_country_settings() |
|
258 | + { |
|
259 | + //scripts |
|
260 | + wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js', |
|
261 | + array('ee_admin_js'), EVENT_ESPRESSO_VERSION, true); |
|
262 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION); |
|
263 | + wp_enqueue_script('gen_settings_countries'); |
|
264 | + wp_enqueue_style('organization-css'); |
|
265 | 265 | |
266 | - } |
|
267 | - |
|
268 | - |
|
269 | - /************* Espresso Pages *************/ |
|
270 | - /** |
|
271 | - * _espresso_page_settings |
|
272 | - * |
|
273 | - * @throws \EE_Error |
|
274 | - */ |
|
275 | - protected function _espresso_page_settings() |
|
276 | - { |
|
277 | - // Check to make sure all of the main pages are setup properly, |
|
278 | - // if not create the default pages and display an admin notice |
|
279 | - EEH_Activation::verify_default_pages_exist(); |
|
280 | - $this->_transient_garbage_collection(); |
|
281 | - $this->_template_args['values'] = $this->_yes_no_values; |
|
282 | - $this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) |
|
283 | - ? EE_Registry::instance()->CFG->core->reg_page_id |
|
284 | - : null; |
|
285 | - $this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) |
|
286 | - ? get_page(EE_Registry::instance()->CFG->core->reg_page_id) |
|
287 | - : false; |
|
288 | - $this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) |
|
289 | - ? EE_Registry::instance()->CFG->core->txn_page_id |
|
290 | - : null; |
|
291 | - $this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) |
|
292 | - ? get_page(EE_Registry::instance()->CFG->core->txn_page_id) |
|
293 | - : false; |
|
294 | - $this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) |
|
295 | - ? EE_Registry::instance()->CFG->core->thank_you_page_id |
|
296 | - : null; |
|
297 | - $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) |
|
298 | - ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id) |
|
299 | - : false; |
|
300 | - $this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) |
|
301 | - ? EE_Registry::instance()->CFG->core->cancel_page_id |
|
302 | - : null; |
|
303 | - $this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) |
|
304 | - ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id) |
|
305 | - : false; |
|
306 | - $this->_set_add_edit_form_tags('update_espresso_page_settings'); |
|
307 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
308 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
309 | - GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', |
|
310 | - $this->_template_args, |
|
311 | - true |
|
312 | - ); |
|
313 | - $this->display_admin_page_with_sidebar(); |
|
266 | + } |
|
267 | + |
|
268 | + |
|
269 | + /************* Espresso Pages *************/ |
|
270 | + /** |
|
271 | + * _espresso_page_settings |
|
272 | + * |
|
273 | + * @throws \EE_Error |
|
274 | + */ |
|
275 | + protected function _espresso_page_settings() |
|
276 | + { |
|
277 | + // Check to make sure all of the main pages are setup properly, |
|
278 | + // if not create the default pages and display an admin notice |
|
279 | + EEH_Activation::verify_default_pages_exist(); |
|
280 | + $this->_transient_garbage_collection(); |
|
281 | + $this->_template_args['values'] = $this->_yes_no_values; |
|
282 | + $this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) |
|
283 | + ? EE_Registry::instance()->CFG->core->reg_page_id |
|
284 | + : null; |
|
285 | + $this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) |
|
286 | + ? get_page(EE_Registry::instance()->CFG->core->reg_page_id) |
|
287 | + : false; |
|
288 | + $this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) |
|
289 | + ? EE_Registry::instance()->CFG->core->txn_page_id |
|
290 | + : null; |
|
291 | + $this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) |
|
292 | + ? get_page(EE_Registry::instance()->CFG->core->txn_page_id) |
|
293 | + : false; |
|
294 | + $this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) |
|
295 | + ? EE_Registry::instance()->CFG->core->thank_you_page_id |
|
296 | + : null; |
|
297 | + $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) |
|
298 | + ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id) |
|
299 | + : false; |
|
300 | + $this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) |
|
301 | + ? EE_Registry::instance()->CFG->core->cancel_page_id |
|
302 | + : null; |
|
303 | + $this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) |
|
304 | + ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id) |
|
305 | + : false; |
|
306 | + $this->_set_add_edit_form_tags('update_espresso_page_settings'); |
|
307 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
308 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
309 | + GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', |
|
310 | + $this->_template_args, |
|
311 | + true |
|
312 | + ); |
|
313 | + $this->display_admin_page_with_sidebar(); |
|
314 | 314 | |
315 | - } |
|
316 | - |
|
317 | - protected function _update_espresso_page_settings() |
|
318 | - { |
|
319 | - // capture incoming request data |
|
320 | - $reg_page_id = isset($this->_req_data['reg_page_id']) ? absint($this->_req_data['reg_page_id']) : EE_Registry::instance()->CFG->core->reg_page_id; |
|
321 | - $txn_page_id = isset($this->_req_data['txn_page_id']) ? absint($this->_req_data['txn_page_id']) : EE_Registry::instance()->CFG->core->txn_page_id; |
|
322 | - $thank_you_page_id = isset($this->_req_data['thank_you_page_id']) ? absint($this->_req_data['thank_you_page_id']) : EE_Registry::instance()->CFG->core->thank_you_page_id; |
|
323 | - $cancel_page_id = isset($this->_req_data['cancel_page_id']) ? absint($this->_req_data['cancel_page_id']) : EE_Registry::instance()->CFG->core->cancel_page_id; |
|
324 | - // pack critical_pages into an array |
|
325 | - $critical_pages = array( |
|
326 | - 'reg_page_id' => $reg_page_id, |
|
327 | - 'txn_page_id' => $txn_page_id, |
|
328 | - 'thank_you_page_id' => $thank_you_page_id, |
|
329 | - 'cancel_page_id' => $cancel_page_id |
|
330 | - ); |
|
331 | - foreach ($critical_pages as $critical_page_name => $critical_page_id) { |
|
332 | - // has the page changed ? |
|
333 | - if (EE_Registry::instance()->CFG->core->{$critical_page_name} !== $critical_page_id) { |
|
334 | - // grab post object for old page |
|
335 | - $post = get_post(EE_Registry::instance()->CFG->core->{$critical_page_name}); |
|
336 | - // update post shortcodes for old page |
|
337 | - EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($critical_page_id, $post); |
|
338 | - // grab post object for new page |
|
339 | - $post = get_post($critical_page_id); |
|
340 | - // update post shortcodes for new page |
|
341 | - EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($critical_page_id, $post); |
|
342 | - } |
|
343 | - } |
|
344 | - // set page IDs |
|
345 | - EE_Registry::instance()->CFG->core->reg_page_id = $reg_page_id; |
|
346 | - EE_Registry::instance()->CFG->core->txn_page_id = $txn_page_id; |
|
347 | - EE_Registry::instance()->CFG->core->thank_you_page_id = $thank_you_page_id; |
|
348 | - EE_Registry::instance()->CFG->core->cancel_page_id = $cancel_page_id; |
|
315 | + } |
|
316 | + |
|
317 | + protected function _update_espresso_page_settings() |
|
318 | + { |
|
319 | + // capture incoming request data |
|
320 | + $reg_page_id = isset($this->_req_data['reg_page_id']) ? absint($this->_req_data['reg_page_id']) : EE_Registry::instance()->CFG->core->reg_page_id; |
|
321 | + $txn_page_id = isset($this->_req_data['txn_page_id']) ? absint($this->_req_data['txn_page_id']) : EE_Registry::instance()->CFG->core->txn_page_id; |
|
322 | + $thank_you_page_id = isset($this->_req_data['thank_you_page_id']) ? absint($this->_req_data['thank_you_page_id']) : EE_Registry::instance()->CFG->core->thank_you_page_id; |
|
323 | + $cancel_page_id = isset($this->_req_data['cancel_page_id']) ? absint($this->_req_data['cancel_page_id']) : EE_Registry::instance()->CFG->core->cancel_page_id; |
|
324 | + // pack critical_pages into an array |
|
325 | + $critical_pages = array( |
|
326 | + 'reg_page_id' => $reg_page_id, |
|
327 | + 'txn_page_id' => $txn_page_id, |
|
328 | + 'thank_you_page_id' => $thank_you_page_id, |
|
329 | + 'cancel_page_id' => $cancel_page_id |
|
330 | + ); |
|
331 | + foreach ($critical_pages as $critical_page_name => $critical_page_id) { |
|
332 | + // has the page changed ? |
|
333 | + if (EE_Registry::instance()->CFG->core->{$critical_page_name} !== $critical_page_id) { |
|
334 | + // grab post object for old page |
|
335 | + $post = get_post(EE_Registry::instance()->CFG->core->{$critical_page_name}); |
|
336 | + // update post shortcodes for old page |
|
337 | + EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($critical_page_id, $post); |
|
338 | + // grab post object for new page |
|
339 | + $post = get_post($critical_page_id); |
|
340 | + // update post shortcodes for new page |
|
341 | + EventEspresso\core\admin\PostShortcodeTracking::parse_post_content_on_save($critical_page_id, $post); |
|
342 | + } |
|
343 | + } |
|
344 | + // set page IDs |
|
345 | + EE_Registry::instance()->CFG->core->reg_page_id = $reg_page_id; |
|
346 | + EE_Registry::instance()->CFG->core->txn_page_id = $txn_page_id; |
|
347 | + EE_Registry::instance()->CFG->core->thank_you_page_id = $thank_you_page_id; |
|
348 | + EE_Registry::instance()->CFG->core->cancel_page_id = $cancel_page_id; |
|
349 | 349 | |
350 | - EE_Registry::instance()->CFG->core = apply_filters('FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', |
|
351 | - EE_Registry::instance()->CFG->core, $this->_req_data); |
|
350 | + EE_Registry::instance()->CFG->core = apply_filters('FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', |
|
351 | + EE_Registry::instance()->CFG->core, $this->_req_data); |
|
352 | 352 | |
353 | - $what = __('Critical Pages & Shortcodes', 'event_espresso'); |
|
354 | - $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->core, __FILE__, |
|
355 | - __FUNCTION__, __LINE__); |
|
356 | - $query_args = array( |
|
357 | - 'action' => 'critical_pages' |
|
358 | - ); |
|
359 | - $this->_redirect_after_action(false, '', '', $query_args, true); |
|
353 | + $what = __('Critical Pages & Shortcodes', 'event_espresso'); |
|
354 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->core, __FILE__, |
|
355 | + __FUNCTION__, __LINE__); |
|
356 | + $query_args = array( |
|
357 | + 'action' => 'critical_pages' |
|
358 | + ); |
|
359 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
360 | 360 | |
361 | - } |
|
361 | + } |
|
362 | 362 | |
363 | 363 | |
364 | - /************* Your Organization *************/ |
|
364 | + /************* Your Organization *************/ |
|
365 | 365 | |
366 | 366 | |
367 | - protected function _your_organization_settings() |
|
368 | - { |
|
367 | + protected function _your_organization_settings() |
|
368 | + { |
|
369 | 369 | |
370 | - $this->_template_args['site_license_key'] = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->get_pretty('site_license_key') : ''; |
|
371 | - $this->_template_args['organization_name'] = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : ''; |
|
372 | - $this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : ''; |
|
373 | - $this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : ''; |
|
374 | - $this->_template_args['organization_city'] = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : ''; |
|
375 | - $this->_template_args['organization_zip'] = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : ''; |
|
376 | - $this->_template_args['organization_email'] = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : ''; |
|
377 | - $this->_template_args['organization_phone'] = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : ''; |
|
378 | - $this->_template_args['organization_vat'] = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : ''; |
|
379 | - $this->_template_args['currency_sign'] = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$'; |
|
380 | - $this->_template_args['organization_logo_url'] = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : false; |
|
381 | - $this->_template_args['organization_facebook'] = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : ''; |
|
382 | - $this->_template_args['organization_twitter'] = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : ''; |
|
383 | - $this->_template_args['organization_linkedin'] = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : ''; |
|
384 | - $this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : ''; |
|
385 | - $this->_template_args['organization_google'] = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : ''; |
|
386 | - $this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : ''; |
|
387 | - //UXIP settings |
|
388 | - $this->_template_args['ee_ueip_optin'] = isset(EE_Registry::instance()->CFG->core->ee_ueip_optin) ? EE_Registry::instance()->CFG->core->get_pretty('ee_ueip_optin') : true; |
|
370 | + $this->_template_args['site_license_key'] = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->get_pretty('site_license_key') : ''; |
|
371 | + $this->_template_args['organization_name'] = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : ''; |
|
372 | + $this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : ''; |
|
373 | + $this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : ''; |
|
374 | + $this->_template_args['organization_city'] = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : ''; |
|
375 | + $this->_template_args['organization_zip'] = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : ''; |
|
376 | + $this->_template_args['organization_email'] = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : ''; |
|
377 | + $this->_template_args['organization_phone'] = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : ''; |
|
378 | + $this->_template_args['organization_vat'] = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : ''; |
|
379 | + $this->_template_args['currency_sign'] = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$'; |
|
380 | + $this->_template_args['organization_logo_url'] = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : false; |
|
381 | + $this->_template_args['organization_facebook'] = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : ''; |
|
382 | + $this->_template_args['organization_twitter'] = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : ''; |
|
383 | + $this->_template_args['organization_linkedin'] = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : ''; |
|
384 | + $this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : ''; |
|
385 | + $this->_template_args['organization_google'] = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : ''; |
|
386 | + $this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : ''; |
|
387 | + //UXIP settings |
|
388 | + $this->_template_args['ee_ueip_optin'] = isset(EE_Registry::instance()->CFG->core->ee_ueip_optin) ? EE_Registry::instance()->CFG->core->get_pretty('ee_ueip_optin') : true; |
|
389 | 389 | |
390 | - $STA_ID = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4; |
|
391 | - $this->_template_args['states'] = new EE_Question_Form_Input( |
|
392 | - EE_Question::new_instance(array( |
|
393 | - 'QST_ID' => 0, |
|
394 | - 'QST_display_text' => __('State/Province', 'event_espresso'), |
|
395 | - 'QST_system' => 'admin-state' |
|
396 | - )), |
|
397 | - EE_Answer::new_instance(array( |
|
398 | - 'ANS_ID' => 0, |
|
399 | - 'ANS_value' => $STA_ID |
|
400 | - )), |
|
401 | - array( |
|
402 | - 'input_id' => 'organization_state', |
|
403 | - 'input_name' => 'organization_state', |
|
404 | - 'input_prefix' => '', |
|
405 | - 'append_qstn_id' => false |
|
406 | - ) |
|
407 | - ); |
|
390 | + $STA_ID = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4; |
|
391 | + $this->_template_args['states'] = new EE_Question_Form_Input( |
|
392 | + EE_Question::new_instance(array( |
|
393 | + 'QST_ID' => 0, |
|
394 | + 'QST_display_text' => __('State/Province', 'event_espresso'), |
|
395 | + 'QST_system' => 'admin-state' |
|
396 | + )), |
|
397 | + EE_Answer::new_instance(array( |
|
398 | + 'ANS_ID' => 0, |
|
399 | + 'ANS_value' => $STA_ID |
|
400 | + )), |
|
401 | + array( |
|
402 | + 'input_id' => 'organization_state', |
|
403 | + 'input_name' => 'organization_state', |
|
404 | + 'input_prefix' => '', |
|
405 | + 'append_qstn_id' => false |
|
406 | + ) |
|
407 | + ); |
|
408 | 408 | |
409 | - $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
410 | - $this->_template_args['countries'] = new EE_Question_Form_Input( |
|
411 | - EE_Question::new_instance(array( |
|
412 | - 'QST_ID' => 0, |
|
413 | - 'QST_display_text' => __('Country', 'event_espresso'), |
|
414 | - 'QST_system' => 'admin-country' |
|
415 | - )), |
|
416 | - EE_Answer::new_instance(array( |
|
417 | - 'ANS_ID' => 0, |
|
418 | - 'ANS_value' => $CNT_ISO |
|
419 | - )), |
|
420 | - array( |
|
421 | - 'input_id' => 'organization_country', |
|
422 | - 'input_name' => 'organization_country', |
|
423 | - 'input_prefix' => '', |
|
424 | - 'append_qstn_id' => false |
|
425 | - ) |
|
426 | - ); |
|
409 | + $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
410 | + $this->_template_args['countries'] = new EE_Question_Form_Input( |
|
411 | + EE_Question::new_instance(array( |
|
412 | + 'QST_ID' => 0, |
|
413 | + 'QST_display_text' => __('Country', 'event_espresso'), |
|
414 | + 'QST_system' => 'admin-country' |
|
415 | + )), |
|
416 | + EE_Answer::new_instance(array( |
|
417 | + 'ANS_ID' => 0, |
|
418 | + 'ANS_value' => $CNT_ISO |
|
419 | + )), |
|
420 | + array( |
|
421 | + 'input_id' => 'organization_country', |
|
422 | + 'input_name' => 'organization_country', |
|
423 | + 'input_prefix' => '', |
|
424 | + 'append_qstn_id' => false |
|
425 | + ) |
|
426 | + ); |
|
427 | 427 | |
428 | - add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
429 | - add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
428 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
429 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
430 | 430 | |
431 | - //PUE verification stuff |
|
432 | - $ver_option_key = 'puvererr_' . basename(EE_PLUGIN_BASENAME); |
|
433 | - $verify_fail = get_option($ver_option_key); |
|
434 | - $this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>'; |
|
431 | + //PUE verification stuff |
|
432 | + $ver_option_key = 'puvererr_' . basename(EE_PLUGIN_BASENAME); |
|
433 | + $verify_fail = get_option($ver_option_key); |
|
434 | + $this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>'; |
|
435 | 435 | |
436 | - $this->_set_add_edit_form_tags('update_your_organization_settings'); |
|
437 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
438 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php', |
|
439 | - $this->_template_args, true); |
|
436 | + $this->_set_add_edit_form_tags('update_your_organization_settings'); |
|
437 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
438 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php', |
|
439 | + $this->_template_args, true); |
|
440 | 440 | |
441 | - $this->display_admin_page_with_sidebar(); |
|
442 | - } |
|
443 | - |
|
444 | - protected function _update_your_organization_settings() |
|
445 | - { |
|
446 | - if (is_main_site()) { |
|
447 | - EE_Registry::instance()->NET_CFG->core->site_license_key = isset($this->_req_data['site_license_key']) ? sanitize_text_field($this->_req_data['site_license_key']) : EE_Registry::instance()->NET_CFG->core->site_license_key; |
|
448 | - } |
|
449 | - EE_Registry::instance()->CFG->organization->name = isset($this->_req_data['organization_name']) ? sanitize_text_field($this->_req_data['organization_name']) : EE_Registry::instance()->CFG->organization->name; |
|
450 | - EE_Registry::instance()->CFG->organization->address_1 = isset($this->_req_data['organization_address_1']) ? sanitize_text_field($this->_req_data['organization_address_1']) : EE_Registry::instance()->CFG->organization->address_1; |
|
451 | - EE_Registry::instance()->CFG->organization->address_2 = isset($this->_req_data['organization_address_2']) ? sanitize_text_field($this->_req_data['organization_address_2']) : EE_Registry::instance()->CFG->organization->address_2; |
|
452 | - EE_Registry::instance()->CFG->organization->city = isset($this->_req_data['organization_city']) ? sanitize_text_field($this->_req_data['organization_city']) : EE_Registry::instance()->CFG->organization->city; |
|
453 | - EE_Registry::instance()->CFG->organization->STA_ID = isset($this->_req_data['organization_state']) ? absint($this->_req_data['organization_state']) : EE_Registry::instance()->CFG->organization->STA_ID; |
|
454 | - EE_Registry::instance()->CFG->organization->CNT_ISO = isset($this->_req_data['organization_country']) ? sanitize_text_field($this->_req_data['organization_country']) : EE_Registry::instance()->CFG->organization->CNT_ISO; |
|
455 | - EE_Registry::instance()->CFG->organization->zip = isset($this->_req_data['organization_zip']) ? sanitize_text_field($this->_req_data['organization_zip']) : EE_Registry::instance()->CFG->organization->zip; |
|
456 | - EE_Registry::instance()->CFG->organization->email = isset($this->_req_data['organization_email']) ? sanitize_email($this->_req_data['organization_email']) : EE_Registry::instance()->CFG->organization->email; |
|
457 | - EE_Registry::instance()->CFG->organization->vat = isset($this->_req_data['organization_vat']) ? sanitize_text_field($this->_req_data['organization_vat']) : EE_Registry::instance()->CFG->organization->vat; |
|
458 | - EE_Registry::instance()->CFG->organization->phone = isset($this->_req_data['organization_phone']) ? sanitize_text_field($this->_req_data['organization_phone']) : EE_Registry::instance()->CFG->organization->phone; |
|
459 | - EE_Registry::instance()->CFG->organization->logo_url = isset($this->_req_data['organization_logo_url']) ? esc_url_raw($this->_req_data['organization_logo_url']) : EE_Registry::instance()->CFG->organization->logo_url; |
|
460 | - EE_Registry::instance()->CFG->organization->facebook = isset($this->_req_data['organization_facebook']) ? esc_url_raw($this->_req_data['organization_facebook']) : EE_Registry::instance()->CFG->organization->facebook; |
|
461 | - EE_Registry::instance()->CFG->organization->twitter = isset($this->_req_data['organization_twitter']) ? esc_url_raw($this->_req_data['organization_twitter']) : EE_Registry::instance()->CFG->organization->twitter; |
|
462 | - EE_Registry::instance()->CFG->organization->linkedin = isset($this->_req_data['organization_linkedin']) ? esc_url_raw($this->_req_data['organization_linkedin']) : EE_Registry::instance()->CFG->organization->linkedin; |
|
463 | - EE_Registry::instance()->CFG->organization->pinterest = isset($this->_req_data['organization_pinterest']) ? esc_url_raw($this->_req_data['organization_pinterest']) : EE_Registry::instance()->CFG->organization->pinterest; |
|
464 | - EE_Registry::instance()->CFG->organization->google = isset($this->_req_data['organization_google']) ? esc_url_raw($this->_req_data['organization_google']) : EE_Registry::instance()->CFG->organization->google; |
|
465 | - EE_Registry::instance()->CFG->organization->instagram = isset($this->_req_data['organization_instagram']) ? esc_url_raw($this->_req_data['organization_instagram']) : EE_Registry::instance()->CFG->organization->instagram; |
|
466 | - EE_Registry::instance()->CFG->core->ee_ueip_optin = isset($this->_req_data['ueip_optin']) && ! empty($this->_req_data['ueip_optin']) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin; |
|
441 | + $this->display_admin_page_with_sidebar(); |
|
442 | + } |
|
443 | + |
|
444 | + protected function _update_your_organization_settings() |
|
445 | + { |
|
446 | + if (is_main_site()) { |
|
447 | + EE_Registry::instance()->NET_CFG->core->site_license_key = isset($this->_req_data['site_license_key']) ? sanitize_text_field($this->_req_data['site_license_key']) : EE_Registry::instance()->NET_CFG->core->site_license_key; |
|
448 | + } |
|
449 | + EE_Registry::instance()->CFG->organization->name = isset($this->_req_data['organization_name']) ? sanitize_text_field($this->_req_data['organization_name']) : EE_Registry::instance()->CFG->organization->name; |
|
450 | + EE_Registry::instance()->CFG->organization->address_1 = isset($this->_req_data['organization_address_1']) ? sanitize_text_field($this->_req_data['organization_address_1']) : EE_Registry::instance()->CFG->organization->address_1; |
|
451 | + EE_Registry::instance()->CFG->organization->address_2 = isset($this->_req_data['organization_address_2']) ? sanitize_text_field($this->_req_data['organization_address_2']) : EE_Registry::instance()->CFG->organization->address_2; |
|
452 | + EE_Registry::instance()->CFG->organization->city = isset($this->_req_data['organization_city']) ? sanitize_text_field($this->_req_data['organization_city']) : EE_Registry::instance()->CFG->organization->city; |
|
453 | + EE_Registry::instance()->CFG->organization->STA_ID = isset($this->_req_data['organization_state']) ? absint($this->_req_data['organization_state']) : EE_Registry::instance()->CFG->organization->STA_ID; |
|
454 | + EE_Registry::instance()->CFG->organization->CNT_ISO = isset($this->_req_data['organization_country']) ? sanitize_text_field($this->_req_data['organization_country']) : EE_Registry::instance()->CFG->organization->CNT_ISO; |
|
455 | + EE_Registry::instance()->CFG->organization->zip = isset($this->_req_data['organization_zip']) ? sanitize_text_field($this->_req_data['organization_zip']) : EE_Registry::instance()->CFG->organization->zip; |
|
456 | + EE_Registry::instance()->CFG->organization->email = isset($this->_req_data['organization_email']) ? sanitize_email($this->_req_data['organization_email']) : EE_Registry::instance()->CFG->organization->email; |
|
457 | + EE_Registry::instance()->CFG->organization->vat = isset($this->_req_data['organization_vat']) ? sanitize_text_field($this->_req_data['organization_vat']) : EE_Registry::instance()->CFG->organization->vat; |
|
458 | + EE_Registry::instance()->CFG->organization->phone = isset($this->_req_data['organization_phone']) ? sanitize_text_field($this->_req_data['organization_phone']) : EE_Registry::instance()->CFG->organization->phone; |
|
459 | + EE_Registry::instance()->CFG->organization->logo_url = isset($this->_req_data['organization_logo_url']) ? esc_url_raw($this->_req_data['organization_logo_url']) : EE_Registry::instance()->CFG->organization->logo_url; |
|
460 | + EE_Registry::instance()->CFG->organization->facebook = isset($this->_req_data['organization_facebook']) ? esc_url_raw($this->_req_data['organization_facebook']) : EE_Registry::instance()->CFG->organization->facebook; |
|
461 | + EE_Registry::instance()->CFG->organization->twitter = isset($this->_req_data['organization_twitter']) ? esc_url_raw($this->_req_data['organization_twitter']) : EE_Registry::instance()->CFG->organization->twitter; |
|
462 | + EE_Registry::instance()->CFG->organization->linkedin = isset($this->_req_data['organization_linkedin']) ? esc_url_raw($this->_req_data['organization_linkedin']) : EE_Registry::instance()->CFG->organization->linkedin; |
|
463 | + EE_Registry::instance()->CFG->organization->pinterest = isset($this->_req_data['organization_pinterest']) ? esc_url_raw($this->_req_data['organization_pinterest']) : EE_Registry::instance()->CFG->organization->pinterest; |
|
464 | + EE_Registry::instance()->CFG->organization->google = isset($this->_req_data['organization_google']) ? esc_url_raw($this->_req_data['organization_google']) : EE_Registry::instance()->CFG->organization->google; |
|
465 | + EE_Registry::instance()->CFG->organization->instagram = isset($this->_req_data['organization_instagram']) ? esc_url_raw($this->_req_data['organization_instagram']) : EE_Registry::instance()->CFG->organization->instagram; |
|
466 | + EE_Registry::instance()->CFG->core->ee_ueip_optin = isset($this->_req_data['ueip_optin']) && ! empty($this->_req_data['ueip_optin']) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin; |
|
467 | 467 | |
468 | - EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO); |
|
468 | + EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO); |
|
469 | 469 | |
470 | - EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', |
|
471 | - EE_Registry::instance()->CFG); |
|
470 | + EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', |
|
471 | + EE_Registry::instance()->CFG); |
|
472 | 472 | |
473 | - $what = 'Your Organization Settings'; |
|
474 | - $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, |
|
475 | - __LINE__); |
|
473 | + $what = 'Your Organization Settings'; |
|
474 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, |
|
475 | + __LINE__); |
|
476 | 476 | |
477 | - $this->_redirect_after_action($success, $what, 'updated', array('action' => 'default')); |
|
477 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'default')); |
|
478 | 478 | |
479 | - } |
|
480 | - |
|
481 | - |
|
482 | - |
|
483 | - /************* Admin Options *************/ |
|
484 | - |
|
485 | - |
|
486 | - /** |
|
487 | - * _admin_option_settings |
|
488 | - * |
|
489 | - * @throws \EE_Error |
|
490 | - * @throws \LogicException |
|
491 | - */ |
|
492 | - protected function _admin_option_settings() |
|
493 | - { |
|
494 | - $this->_template_args['admin_page_content'] = ''; |
|
495 | - try { |
|
496 | - $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance()); |
|
497 | - // still need this for the old school form in Extend_General_Settings_Admin_Page |
|
498 | - $this->_template_args['values'] = $this->_yes_no_values; |
|
499 | - // also need to account for the do_action that was in the old template |
|
500 | - $admin_options_settings_form->setTemplateArgs($this->_template_args); |
|
501 | - $this->_template_args['admin_page_content'] = $admin_options_settings_form->display(); |
|
502 | - } catch (Exception $e) { |
|
503 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
504 | - } |
|
505 | - $this->_set_add_edit_form_tags('update_admin_option_settings'); |
|
506 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
507 | - $this->display_admin_page_with_sidebar(); |
|
508 | - } |
|
509 | - |
|
510 | - |
|
511 | - /** |
|
512 | - * _update_admin_option_settings |
|
513 | - * |
|
514 | - * @throws \EE_Error |
|
515 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
516 | - * @throws \EventEspresso\core\exceptions\InvalidFormSubmissionException |
|
517 | - * @throws \InvalidArgumentException |
|
518 | - * @throws \LogicException |
|
519 | - */ |
|
520 | - protected function _update_admin_option_settings() |
|
521 | - { |
|
522 | - try { |
|
523 | - $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance()); |
|
524 | - $admin_options_settings_form->process($this->_req_data[$admin_options_settings_form->slug()]); |
|
525 | - EE_Registry::instance()->CFG->admin = apply_filters( |
|
526 | - 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', |
|
527 | - EE_Registry::instance()->CFG->admin |
|
528 | - ); |
|
529 | - } catch (Exception $e) { |
|
530 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
531 | - } |
|
532 | - $this->_redirect_after_action( |
|
533 | - apply_filters( |
|
534 | - 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', |
|
535 | - $this->_update_espresso_configuration( |
|
536 | - 'Admin Options', |
|
537 | - EE_Registry::instance()->CFG->admin, |
|
538 | - __FILE__, __FUNCTION__, __LINE__ |
|
539 | - ) |
|
540 | - ), |
|
541 | - 'Admin Options', |
|
542 | - 'updated', |
|
543 | - array('action' => 'admin_option_settings') |
|
544 | - ); |
|
479 | + } |
|
480 | + |
|
481 | + |
|
482 | + |
|
483 | + /************* Admin Options *************/ |
|
484 | + |
|
485 | + |
|
486 | + /** |
|
487 | + * _admin_option_settings |
|
488 | + * |
|
489 | + * @throws \EE_Error |
|
490 | + * @throws \LogicException |
|
491 | + */ |
|
492 | + protected function _admin_option_settings() |
|
493 | + { |
|
494 | + $this->_template_args['admin_page_content'] = ''; |
|
495 | + try { |
|
496 | + $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance()); |
|
497 | + // still need this for the old school form in Extend_General_Settings_Admin_Page |
|
498 | + $this->_template_args['values'] = $this->_yes_no_values; |
|
499 | + // also need to account for the do_action that was in the old template |
|
500 | + $admin_options_settings_form->setTemplateArgs($this->_template_args); |
|
501 | + $this->_template_args['admin_page_content'] = $admin_options_settings_form->display(); |
|
502 | + } catch (Exception $e) { |
|
503 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
504 | + } |
|
505 | + $this->_set_add_edit_form_tags('update_admin_option_settings'); |
|
506 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
507 | + $this->display_admin_page_with_sidebar(); |
|
508 | + } |
|
509 | + |
|
510 | + |
|
511 | + /** |
|
512 | + * _update_admin_option_settings |
|
513 | + * |
|
514 | + * @throws \EE_Error |
|
515 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
516 | + * @throws \EventEspresso\core\exceptions\InvalidFormSubmissionException |
|
517 | + * @throws \InvalidArgumentException |
|
518 | + * @throws \LogicException |
|
519 | + */ |
|
520 | + protected function _update_admin_option_settings() |
|
521 | + { |
|
522 | + try { |
|
523 | + $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance()); |
|
524 | + $admin_options_settings_form->process($this->_req_data[$admin_options_settings_form->slug()]); |
|
525 | + EE_Registry::instance()->CFG->admin = apply_filters( |
|
526 | + 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', |
|
527 | + EE_Registry::instance()->CFG->admin |
|
528 | + ); |
|
529 | + } catch (Exception $e) { |
|
530 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
531 | + } |
|
532 | + $this->_redirect_after_action( |
|
533 | + apply_filters( |
|
534 | + 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', |
|
535 | + $this->_update_espresso_configuration( |
|
536 | + 'Admin Options', |
|
537 | + EE_Registry::instance()->CFG->admin, |
|
538 | + __FILE__, __FUNCTION__, __LINE__ |
|
539 | + ) |
|
540 | + ), |
|
541 | + 'Admin Options', |
|
542 | + 'updated', |
|
543 | + array('action' => 'admin_option_settings') |
|
544 | + ); |
|
545 | 545 | |
546 | - } |
|
546 | + } |
|
547 | 547 | |
548 | 548 | |
549 | - /************* Countries *************/ |
|
549 | + /************* Countries *************/ |
|
550 | 550 | |
551 | 551 | |
552 | - protected function _country_settings() |
|
553 | - { |
|
552 | + protected function _country_settings() |
|
553 | + { |
|
554 | 554 | |
555 | - $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
556 | - $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO; |
|
555 | + $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
556 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO; |
|
557 | 557 | |
558 | - //load field generator helper |
|
558 | + //load field generator helper |
|
559 | 559 | |
560 | - $this->_template_args['values'] = $this->_yes_no_values; |
|
560 | + $this->_template_args['values'] = $this->_yes_no_values; |
|
561 | 561 | |
562 | - $this->_template_args['countries'] = new EE_Question_Form_Input( |
|
563 | - EE_Question::new_instance(array( |
|
564 | - 'QST_ID' => 0, |
|
565 | - 'QST_display_text' => __('Select Country', 'event_espresso'), |
|
566 | - 'QST_system' => 'admin-country' |
|
567 | - )), |
|
568 | - EE_Answer::new_instance(array( |
|
569 | - 'ANS_ID' => 0, |
|
570 | - 'ANS_value' => $CNT_ISO |
|
571 | - )), |
|
572 | - array( |
|
573 | - 'input_id' => 'country', |
|
574 | - 'input_name' => 'country', |
|
575 | - 'input_prefix' => '', |
|
576 | - 'append_qstn_id' => false |
|
577 | - ) |
|
578 | - ); |
|
562 | + $this->_template_args['countries'] = new EE_Question_Form_Input( |
|
563 | + EE_Question::new_instance(array( |
|
564 | + 'QST_ID' => 0, |
|
565 | + 'QST_display_text' => __('Select Country', 'event_espresso'), |
|
566 | + 'QST_system' => 'admin-country' |
|
567 | + )), |
|
568 | + EE_Answer::new_instance(array( |
|
569 | + 'ANS_ID' => 0, |
|
570 | + 'ANS_value' => $CNT_ISO |
|
571 | + )), |
|
572 | + array( |
|
573 | + 'input_id' => 'country', |
|
574 | + 'input_name' => 'country', |
|
575 | + 'input_prefix' => '', |
|
576 | + 'append_qstn_id' => false |
|
577 | + ) |
|
578 | + ); |
|
579 | 579 | // EEH_Debug_Tools::printr( $this->_template_args['countries'], 'countries <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
580 | 580 | |
581 | - add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
582 | - add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
583 | - $this->_template_args['country_details_settings'] = $this->display_country_settings(); |
|
584 | - $this->_template_args['country_states_settings'] = $this->display_country_states(); |
|
581 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
582 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
583 | + $this->_template_args['country_details_settings'] = $this->display_country_settings(); |
|
584 | + $this->_template_args['country_states_settings'] = $this->display_country_states(); |
|
585 | 585 | |
586 | - $this->_set_add_edit_form_tags('update_country_settings'); |
|
587 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
588 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', |
|
589 | - $this->_template_args, true); |
|
590 | - $this->display_admin_page_with_no_sidebar(); |
|
591 | - } |
|
592 | - |
|
593 | - |
|
594 | - /** |
|
595 | - * display_country_settings |
|
596 | - * |
|
597 | - * @access public |
|
598 | - * |
|
599 | - * @param string $CNT_ISO |
|
600 | - * |
|
601 | - * @return mixed string | array |
|
602 | - */ |
|
603 | - public function display_country_settings($CNT_ISO = '') |
|
604 | - { |
|
586 | + $this->_set_add_edit_form_tags('update_country_settings'); |
|
587 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
588 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', |
|
589 | + $this->_template_args, true); |
|
590 | + $this->display_admin_page_with_no_sidebar(); |
|
591 | + } |
|
592 | + |
|
593 | + |
|
594 | + /** |
|
595 | + * display_country_settings |
|
596 | + * |
|
597 | + * @access public |
|
598 | + * |
|
599 | + * @param string $CNT_ISO |
|
600 | + * |
|
601 | + * @return mixed string | array |
|
602 | + */ |
|
603 | + public function display_country_settings($CNT_ISO = '') |
|
604 | + { |
|
605 | 605 | |
606 | - $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO; |
|
607 | - if ( ! $CNT_ISO) { |
|
608 | - return ''; |
|
609 | - } |
|
606 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO; |
|
607 | + if ( ! $CNT_ISO) { |
|
608 | + return ''; |
|
609 | + } |
|
610 | 610 | |
611 | - // for ajax |
|
612 | - remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
613 | - remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
614 | - add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
615 | - add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
616 | - $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
|
617 | - //EEH_Debug_Tools::printr( $country, '$country <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
|
618 | - $country_input_types = array( |
|
619 | - 'CNT_active' => array( |
|
620 | - 'type' => 'RADIO_BTN', |
|
621 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
622 | - 'class' => '', |
|
623 | - 'options' => $this->_yes_no_values, |
|
624 | - 'use_desc_4_label' => true |
|
625 | - ), |
|
626 | - 'CNT_ISO' => array( |
|
627 | - 'type' => 'TEXT', |
|
628 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
629 | - 'class' => 'small-text' |
|
630 | - ), |
|
631 | - 'CNT_ISO3' => array( |
|
632 | - 'type' => 'TEXT', |
|
633 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
634 | - 'class' => 'small-text' |
|
635 | - ), |
|
636 | - 'RGN_ID' => array( |
|
637 | - 'type' => 'TEXT', |
|
638 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
639 | - 'class' => 'small-text' |
|
640 | - ), |
|
641 | - 'CNT_name' => array( |
|
642 | - 'type' => 'TEXT', |
|
643 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
644 | - 'class' => 'regular-text' |
|
645 | - ), |
|
646 | - 'CNT_cur_code' => array( |
|
647 | - 'type' => 'TEXT', |
|
648 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
649 | - 'class' => 'small-text' |
|
650 | - ), |
|
651 | - 'CNT_cur_single' => array( |
|
652 | - 'type' => 'TEXT', |
|
653 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
654 | - 'class' => 'medium-text' |
|
655 | - ), |
|
656 | - 'CNT_cur_plural' => array( |
|
657 | - 'type' => 'TEXT', |
|
658 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
659 | - 'class' => 'medium-text' |
|
660 | - ), |
|
661 | - 'CNT_cur_sign' => array( |
|
662 | - 'type' => 'TEXT', |
|
663 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
664 | - 'class' => 'small-text', |
|
665 | - 'htmlentities' => false |
|
666 | - ), |
|
667 | - 'CNT_cur_sign_b4' => array( |
|
668 | - 'type' => 'RADIO_BTN', |
|
669 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
670 | - 'class' => '', |
|
671 | - 'options' => $this->_yes_no_values, |
|
672 | - 'use_desc_4_label' => true |
|
673 | - ), |
|
674 | - 'CNT_cur_dec_plc' => array( |
|
675 | - 'type' => 'RADIO_BTN', |
|
676 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
677 | - 'class' => '', |
|
678 | - 'options' => array( |
|
679 | - array('id' => 0, 'text' => ''), |
|
680 | - array('id' => 1, 'text' => ''), |
|
681 | - array('id' => 2, 'text' => ''), |
|
682 | - array('id' => 3, 'text' => '') |
|
683 | - ) |
|
684 | - ), |
|
685 | - 'CNT_cur_dec_mrk' => array( |
|
686 | - 'type' => 'RADIO_BTN', |
|
687 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
688 | - 'class' => '', |
|
689 | - 'options' => array( |
|
690 | - array( |
|
691 | - 'id' => ',', |
|
692 | - 'text' => __(', (comma)', 'event_espresso') |
|
693 | - ), |
|
694 | - array('id' => '.', 'text' => __('. (decimal)', 'event_espresso')) |
|
695 | - ), |
|
696 | - 'use_desc_4_label' => true |
|
697 | - ), |
|
698 | - 'CNT_cur_thsnds' => array( |
|
699 | - 'type' => 'RADIO_BTN', |
|
700 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
701 | - 'class' => '', |
|
702 | - 'options' => array( |
|
703 | - array( |
|
704 | - 'id' => ',', |
|
705 | - 'text' => __(', (comma)', 'event_espresso') |
|
706 | - ), |
|
707 | - array('id' => '.', 'text' => __('. (decimal)', 'event_espresso')) |
|
708 | - ), |
|
709 | - 'use_desc_4_label' => true |
|
710 | - ), |
|
711 | - 'CNT_tel_code' => array( |
|
712 | - 'type' => 'TEXT', |
|
713 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
714 | - 'class' => 'small-text' |
|
715 | - ), |
|
716 | - 'CNT_is_EU' => array( |
|
717 | - 'type' => 'RADIO_BTN', |
|
718 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
719 | - 'class' => '', |
|
720 | - 'options' => $this->_yes_no_values, |
|
721 | - 'use_desc_4_label' => true |
|
722 | - ) |
|
723 | - ); |
|
724 | - $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country, |
|
725 | - $country_input_types); |
|
726 | - $country_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', |
|
727 | - $this->_template_args, true); |
|
611 | + // for ajax |
|
612 | + remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
613 | + remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
614 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
615 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
616 | + $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
|
617 | + //EEH_Debug_Tools::printr( $country, '$country <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
|
618 | + $country_input_types = array( |
|
619 | + 'CNT_active' => array( |
|
620 | + 'type' => 'RADIO_BTN', |
|
621 | + 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
622 | + 'class' => '', |
|
623 | + 'options' => $this->_yes_no_values, |
|
624 | + 'use_desc_4_label' => true |
|
625 | + ), |
|
626 | + 'CNT_ISO' => array( |
|
627 | + 'type' => 'TEXT', |
|
628 | + 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
629 | + 'class' => 'small-text' |
|
630 | + ), |
|
631 | + 'CNT_ISO3' => array( |
|
632 | + 'type' => 'TEXT', |
|
633 | + 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
634 | + 'class' => 'small-text' |
|
635 | + ), |
|
636 | + 'RGN_ID' => array( |
|
637 | + 'type' => 'TEXT', |
|
638 | + 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
639 | + 'class' => 'small-text' |
|
640 | + ), |
|
641 | + 'CNT_name' => array( |
|
642 | + 'type' => 'TEXT', |
|
643 | + 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
644 | + 'class' => 'regular-text' |
|
645 | + ), |
|
646 | + 'CNT_cur_code' => array( |
|
647 | + 'type' => 'TEXT', |
|
648 | + 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
649 | + 'class' => 'small-text' |
|
650 | + ), |
|
651 | + 'CNT_cur_single' => array( |
|
652 | + 'type' => 'TEXT', |
|
653 | + 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
654 | + 'class' => 'medium-text' |
|
655 | + ), |
|
656 | + 'CNT_cur_plural' => array( |
|
657 | + 'type' => 'TEXT', |
|
658 | + 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
659 | + 'class' => 'medium-text' |
|
660 | + ), |
|
661 | + 'CNT_cur_sign' => array( |
|
662 | + 'type' => 'TEXT', |
|
663 | + 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
664 | + 'class' => 'small-text', |
|
665 | + 'htmlentities' => false |
|
666 | + ), |
|
667 | + 'CNT_cur_sign_b4' => array( |
|
668 | + 'type' => 'RADIO_BTN', |
|
669 | + 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
670 | + 'class' => '', |
|
671 | + 'options' => $this->_yes_no_values, |
|
672 | + 'use_desc_4_label' => true |
|
673 | + ), |
|
674 | + 'CNT_cur_dec_plc' => array( |
|
675 | + 'type' => 'RADIO_BTN', |
|
676 | + 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
677 | + 'class' => '', |
|
678 | + 'options' => array( |
|
679 | + array('id' => 0, 'text' => ''), |
|
680 | + array('id' => 1, 'text' => ''), |
|
681 | + array('id' => 2, 'text' => ''), |
|
682 | + array('id' => 3, 'text' => '') |
|
683 | + ) |
|
684 | + ), |
|
685 | + 'CNT_cur_dec_mrk' => array( |
|
686 | + 'type' => 'RADIO_BTN', |
|
687 | + 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
688 | + 'class' => '', |
|
689 | + 'options' => array( |
|
690 | + array( |
|
691 | + 'id' => ',', |
|
692 | + 'text' => __(', (comma)', 'event_espresso') |
|
693 | + ), |
|
694 | + array('id' => '.', 'text' => __('. (decimal)', 'event_espresso')) |
|
695 | + ), |
|
696 | + 'use_desc_4_label' => true |
|
697 | + ), |
|
698 | + 'CNT_cur_thsnds' => array( |
|
699 | + 'type' => 'RADIO_BTN', |
|
700 | + 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
701 | + 'class' => '', |
|
702 | + 'options' => array( |
|
703 | + array( |
|
704 | + 'id' => ',', |
|
705 | + 'text' => __(', (comma)', 'event_espresso') |
|
706 | + ), |
|
707 | + array('id' => '.', 'text' => __('. (decimal)', 'event_espresso')) |
|
708 | + ), |
|
709 | + 'use_desc_4_label' => true |
|
710 | + ), |
|
711 | + 'CNT_tel_code' => array( |
|
712 | + 'type' => 'TEXT', |
|
713 | + 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
714 | + 'class' => 'small-text' |
|
715 | + ), |
|
716 | + 'CNT_is_EU' => array( |
|
717 | + 'type' => 'RADIO_BTN', |
|
718 | + 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
719 | + 'class' => '', |
|
720 | + 'options' => $this->_yes_no_values, |
|
721 | + 'use_desc_4_label' => true |
|
722 | + ) |
|
723 | + ); |
|
724 | + $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country, |
|
725 | + $country_input_types); |
|
726 | + $country_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', |
|
727 | + $this->_template_args, true); |
|
728 | 728 | |
729 | - if (defined('DOING_AJAX')) { |
|
730 | - $notices = EE_Error::get_notices(false, false, false); |
|
731 | - echo json_encode(array( |
|
732 | - 'return_data' => $country_details_settings, |
|
733 | - 'success' => $notices['success'], |
|
734 | - 'errors' => $notices['errors'] |
|
735 | - )); |
|
736 | - die(); |
|
737 | - } else { |
|
738 | - return $country_details_settings; |
|
739 | - } |
|
729 | + if (defined('DOING_AJAX')) { |
|
730 | + $notices = EE_Error::get_notices(false, false, false); |
|
731 | + echo json_encode(array( |
|
732 | + 'return_data' => $country_details_settings, |
|
733 | + 'success' => $notices['success'], |
|
734 | + 'errors' => $notices['errors'] |
|
735 | + )); |
|
736 | + die(); |
|
737 | + } else { |
|
738 | + return $country_details_settings; |
|
739 | + } |
|
740 | 740 | |
741 | - } |
|
742 | - |
|
743 | - |
|
744 | - /** |
|
745 | - * display_country_states |
|
746 | - * |
|
747 | - * @access public |
|
748 | - * |
|
749 | - * @param string $CNT_ISO |
|
750 | - * |
|
751 | - * @return string |
|
752 | - */ |
|
753 | - public function display_country_states($CNT_ISO = '') |
|
754 | - { |
|
741 | + } |
|
742 | + |
|
743 | + |
|
744 | + /** |
|
745 | + * display_country_states |
|
746 | + * |
|
747 | + * @access public |
|
748 | + * |
|
749 | + * @param string $CNT_ISO |
|
750 | + * |
|
751 | + * @return string |
|
752 | + */ |
|
753 | + public function display_country_states($CNT_ISO = '') |
|
754 | + { |
|
755 | 755 | |
756 | - $CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO; |
|
756 | + $CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO; |
|
757 | 757 | |
758 | - if ( ! $CNT_ISO) { |
|
759 | - return ''; |
|
760 | - } |
|
761 | - // for ajax |
|
762 | - remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
763 | - remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
764 | - add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2); |
|
765 | - add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2); |
|
766 | - $states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO)); |
|
758 | + if ( ! $CNT_ISO) { |
|
759 | + return ''; |
|
760 | + } |
|
761 | + // for ajax |
|
762 | + remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
763 | + remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
764 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2); |
|
765 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2); |
|
766 | + $states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO)); |
|
767 | 767 | |
768 | 768 | // echo '<h4>$CNT_ISO : ' . $CNT_ISO . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
769 | 769 | // global $wpdb; |
770 | 770 | // echo '<h4>' . $wpdb->last_query . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
771 | 771 | // EEH_Debug_Tools::printr( $states, '$states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
772 | - if ($states) { |
|
773 | - foreach ($states as $STA_ID => $state) { |
|
774 | - if ($state instanceof EE_State) { |
|
775 | - //STA_abbrev STA_name STA_active |
|
776 | - $state_input_types = array( |
|
777 | - 'STA_abbrev' => array( |
|
778 | - 'type' => 'TEXT', |
|
779 | - 'input_name' => 'states[' . $STA_ID . ']', |
|
780 | - 'class' => 'mid-text' |
|
781 | - ), |
|
782 | - 'STA_name' => array( |
|
783 | - 'type' => 'TEXT', |
|
784 | - 'input_name' => 'states[' . $STA_ID . ']', |
|
785 | - 'class' => 'regular-text' |
|
786 | - ), |
|
787 | - 'STA_active' => array( |
|
788 | - 'type' => 'RADIO_BTN', |
|
789 | - 'input_name' => 'states[' . $STA_ID . ']', |
|
790 | - 'options' => $this->_yes_no_values, |
|
791 | - 'use_desc_4_label' => true |
|
792 | - ) |
|
793 | - ); |
|
794 | - $this->_template_args['states'][$STA_ID]['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($state, |
|
795 | - $state_input_types); |
|
796 | - $query_args = array( |
|
797 | - 'action' => 'delete_state', |
|
798 | - 'STA_ID' => $STA_ID, |
|
799 | - 'CNT_ISO' => $CNT_ISO, |
|
800 | - 'STA_abbrev' => $state->abbrev() |
|
801 | - ); |
|
802 | - $this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, |
|
803 | - GEN_SET_ADMIN_URL); |
|
804 | - } |
|
805 | - } |
|
806 | - } else { |
|
807 | - $this->_template_args['states'] = false; |
|
808 | - } |
|
772 | + if ($states) { |
|
773 | + foreach ($states as $STA_ID => $state) { |
|
774 | + if ($state instanceof EE_State) { |
|
775 | + //STA_abbrev STA_name STA_active |
|
776 | + $state_input_types = array( |
|
777 | + 'STA_abbrev' => array( |
|
778 | + 'type' => 'TEXT', |
|
779 | + 'input_name' => 'states[' . $STA_ID . ']', |
|
780 | + 'class' => 'mid-text' |
|
781 | + ), |
|
782 | + 'STA_name' => array( |
|
783 | + 'type' => 'TEXT', |
|
784 | + 'input_name' => 'states[' . $STA_ID . ']', |
|
785 | + 'class' => 'regular-text' |
|
786 | + ), |
|
787 | + 'STA_active' => array( |
|
788 | + 'type' => 'RADIO_BTN', |
|
789 | + 'input_name' => 'states[' . $STA_ID . ']', |
|
790 | + 'options' => $this->_yes_no_values, |
|
791 | + 'use_desc_4_label' => true |
|
792 | + ) |
|
793 | + ); |
|
794 | + $this->_template_args['states'][$STA_ID]['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($state, |
|
795 | + $state_input_types); |
|
796 | + $query_args = array( |
|
797 | + 'action' => 'delete_state', |
|
798 | + 'STA_ID' => $STA_ID, |
|
799 | + 'CNT_ISO' => $CNT_ISO, |
|
800 | + 'STA_abbrev' => $state->abbrev() |
|
801 | + ); |
|
802 | + $this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, |
|
803 | + GEN_SET_ADMIN_URL); |
|
804 | + } |
|
805 | + } |
|
806 | + } else { |
|
807 | + $this->_template_args['states'] = false; |
|
808 | + } |
|
809 | 809 | // EEH_Debug_Tools::printr( $this->_template_args['states'], 'states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
810 | - $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'), |
|
811 | - GEN_SET_ADMIN_URL); |
|
810 | + $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'), |
|
811 | + GEN_SET_ADMIN_URL); |
|
812 | 812 | |
813 | - $state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', |
|
814 | - $this->_template_args, true); |
|
813 | + $state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', |
|
814 | + $this->_template_args, true); |
|
815 | 815 | |
816 | - if (defined('DOING_AJAX')) { |
|
817 | - $notices = EE_Error::get_notices(false, false, false); |
|
818 | - echo json_encode(array( |
|
819 | - 'return_data' => $state_details_settings, |
|
820 | - 'success' => $notices['success'], |
|
821 | - 'errors' => $notices['errors'] |
|
822 | - )); |
|
823 | - die(); |
|
824 | - } else { |
|
825 | - return $state_details_settings; |
|
826 | - } |
|
816 | + if (defined('DOING_AJAX')) { |
|
817 | + $notices = EE_Error::get_notices(false, false, false); |
|
818 | + echo json_encode(array( |
|
819 | + 'return_data' => $state_details_settings, |
|
820 | + 'success' => $notices['success'], |
|
821 | + 'errors' => $notices['errors'] |
|
822 | + )); |
|
823 | + die(); |
|
824 | + } else { |
|
825 | + return $state_details_settings; |
|
826 | + } |
|
827 | 827 | |
828 | - } |
|
828 | + } |
|
829 | 829 | |
830 | 830 | |
831 | - /** |
|
832 | - * add_new_state |
|
833 | - * |
|
834 | - * @access public |
|
835 | - * @return void |
|
836 | - */ |
|
837 | - public function add_new_state() |
|
838 | - { |
|
831 | + /** |
|
832 | + * add_new_state |
|
833 | + * |
|
834 | + * @access public |
|
835 | + * @return void |
|
836 | + */ |
|
837 | + public function add_new_state() |
|
838 | + { |
|
839 | 839 | |
840 | - $success = true; |
|
840 | + $success = true; |
|
841 | 841 | |
842 | - $CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : false; |
|
843 | - if ( ! $CNT_ISO) { |
|
844 | - EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', |
|
845 | - 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
846 | - $success = false; |
|
847 | - } |
|
848 | - $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : false; |
|
849 | - if ( ! $STA_abbrev) { |
|
850 | - EE_Error::add_error(__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), |
|
851 | - __FILE__, __FUNCTION__, __LINE__); |
|
852 | - $success = false; |
|
853 | - } |
|
854 | - $STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) : |
|
855 | - false; |
|
856 | - if ( ! $STA_name) { |
|
857 | - EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__, |
|
858 | - __FUNCTION__, __LINE__); |
|
859 | - $success = false; |
|
860 | - } |
|
842 | + $CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : false; |
|
843 | + if ( ! $CNT_ISO) { |
|
844 | + EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', |
|
845 | + 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
846 | + $success = false; |
|
847 | + } |
|
848 | + $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : false; |
|
849 | + if ( ! $STA_abbrev) { |
|
850 | + EE_Error::add_error(__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), |
|
851 | + __FILE__, __FUNCTION__, __LINE__); |
|
852 | + $success = false; |
|
853 | + } |
|
854 | + $STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) : |
|
855 | + false; |
|
856 | + if ( ! $STA_name) { |
|
857 | + EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__, |
|
858 | + __FUNCTION__, __LINE__); |
|
859 | + $success = false; |
|
860 | + } |
|
861 | 861 | |
862 | - if ($success) { |
|
863 | - $cols_n_values = array( |
|
864 | - 'CNT_ISO' => $CNT_ISO, |
|
865 | - 'STA_abbrev' => $STA_abbrev, |
|
866 | - 'STA_name' => $STA_name, |
|
867 | - 'STA_active' => true |
|
868 | - ); |
|
869 | - $success = EEM_State::instance()->insert($cols_n_values); |
|
870 | - EE_Error::add_success(__('The State was added successfully.', 'event_espresso')); |
|
871 | - } |
|
862 | + if ($success) { |
|
863 | + $cols_n_values = array( |
|
864 | + 'CNT_ISO' => $CNT_ISO, |
|
865 | + 'STA_abbrev' => $STA_abbrev, |
|
866 | + 'STA_name' => $STA_name, |
|
867 | + 'STA_active' => true |
|
868 | + ); |
|
869 | + $success = EEM_State::instance()->insert($cols_n_values); |
|
870 | + EE_Error::add_success(__('The State was added successfully.', 'event_espresso')); |
|
871 | + } |
|
872 | 872 | |
873 | - if (defined('DOING_AJAX')) { |
|
874 | - $notices = EE_Error::get_notices(false, false, false); |
|
875 | - echo json_encode(array_merge($notices, array('return_data' => $CNT_ISO))); |
|
876 | - die(); |
|
877 | - } else { |
|
878 | - $this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings')); |
|
879 | - } |
|
880 | - } |
|
881 | - |
|
882 | - |
|
883 | - /** |
|
884 | - * delete_state |
|
885 | - * |
|
886 | - * @access public |
|
887 | - * @return boolean | void |
|
888 | - */ |
|
889 | - public function delete_state() |
|
890 | - { |
|
891 | - $CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : false; |
|
892 | - $STA_ID = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : false; |
|
893 | - $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : false; |
|
894 | - if ( ! $STA_ID) { |
|
895 | - EE_Error::add_error(__('No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__, |
|
896 | - __FUNCTION__, __LINE__); |
|
873 | + if (defined('DOING_AJAX')) { |
|
874 | + $notices = EE_Error::get_notices(false, false, false); |
|
875 | + echo json_encode(array_merge($notices, array('return_data' => $CNT_ISO))); |
|
876 | + die(); |
|
877 | + } else { |
|
878 | + $this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings')); |
|
879 | + } |
|
880 | + } |
|
881 | + |
|
882 | + |
|
883 | + /** |
|
884 | + * delete_state |
|
885 | + * |
|
886 | + * @access public |
|
887 | + * @return boolean | void |
|
888 | + */ |
|
889 | + public function delete_state() |
|
890 | + { |
|
891 | + $CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : false; |
|
892 | + $STA_ID = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : false; |
|
893 | + $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : false; |
|
894 | + if ( ! $STA_ID) { |
|
895 | + EE_Error::add_error(__('No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__, |
|
896 | + __FUNCTION__, __LINE__); |
|
897 | 897 | |
898 | - return false; |
|
899 | - } |
|
900 | - $success = EEM_State::instance()->delete_by_ID($STA_ID); |
|
901 | - if ($success !== false) { |
|
902 | - do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, |
|
903 | - array('STA_abbrev' => $STA_abbrev)); |
|
904 | - EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso')); |
|
905 | - } |
|
906 | - if (defined('DOING_AJAX')) { |
|
907 | - $notices = EE_Error::get_notices(false, false); |
|
908 | - $notices['return_data'] = true; |
|
909 | - echo json_encode($notices); |
|
910 | - die(); |
|
911 | - } else { |
|
912 | - $this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings')); |
|
913 | - } |
|
914 | - } |
|
915 | - |
|
916 | - |
|
917 | - /** |
|
918 | - * _update_country_settings |
|
919 | - * |
|
920 | - * @access protected |
|
921 | - * @return void |
|
922 | - */ |
|
923 | - protected function _update_country_settings() |
|
924 | - { |
|
898 | + return false; |
|
899 | + } |
|
900 | + $success = EEM_State::instance()->delete_by_ID($STA_ID); |
|
901 | + if ($success !== false) { |
|
902 | + do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, |
|
903 | + array('STA_abbrev' => $STA_abbrev)); |
|
904 | + EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso')); |
|
905 | + } |
|
906 | + if (defined('DOING_AJAX')) { |
|
907 | + $notices = EE_Error::get_notices(false, false); |
|
908 | + $notices['return_data'] = true; |
|
909 | + echo json_encode($notices); |
|
910 | + die(); |
|
911 | + } else { |
|
912 | + $this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings')); |
|
913 | + } |
|
914 | + } |
|
915 | + |
|
916 | + |
|
917 | + /** |
|
918 | + * _update_country_settings |
|
919 | + * |
|
920 | + * @access protected |
|
921 | + * @return void |
|
922 | + */ |
|
923 | + protected function _update_country_settings() |
|
924 | + { |
|
925 | 925 | // EEH_Debug_Tools::printr( $this->_req_data, '$this->_req_data <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
926 | - // grab the country ISO code |
|
927 | - $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : false; |
|
928 | - if ( ! $CNT_ISO) { |
|
929 | - EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', |
|
930 | - 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
926 | + // grab the country ISO code |
|
927 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : false; |
|
928 | + if ( ! $CNT_ISO) { |
|
929 | + EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', |
|
930 | + 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
931 | 931 | |
932 | - return; |
|
933 | - } |
|
934 | - $cols_n_values = array(); |
|
935 | - $cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])) : false; |
|
936 | - $cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : null; |
|
937 | - $cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) : null; |
|
938 | - $cols_n_values['CNT_cur_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])) : 'USD'; |
|
939 | - $cols_n_values['CNT_cur_single'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) : 'dollar'; |
|
940 | - $cols_n_values['CNT_cur_plural'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) : 'dollars'; |
|
941 | - $cols_n_values['CNT_cur_sign'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) : '$'; |
|
942 | - $cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) : true; |
|
943 | - $cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) : 2; |
|
944 | - $cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) : '.'; |
|
945 | - $cols_n_values['CNT_cur_thsnds'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) : ','; |
|
946 | - $cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) : null; |
|
947 | - $cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) : false; |
|
948 | - $cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : false; |
|
949 | - // allow filtering of country data |
|
950 | - $cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', |
|
951 | - $cols_n_values); |
|
952 | - //EEH_Debug_Tools::printr( $cols_n_values, '$cols_n_values <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
|
953 | - // where values |
|
954 | - $where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO)); |
|
955 | - // run the update |
|
956 | - $success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values); |
|
932 | + return; |
|
933 | + } |
|
934 | + $cols_n_values = array(); |
|
935 | + $cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])) : false; |
|
936 | + $cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : null; |
|
937 | + $cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) : null; |
|
938 | + $cols_n_values['CNT_cur_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])) : 'USD'; |
|
939 | + $cols_n_values['CNT_cur_single'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) : 'dollar'; |
|
940 | + $cols_n_values['CNT_cur_plural'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) : 'dollars'; |
|
941 | + $cols_n_values['CNT_cur_sign'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) : '$'; |
|
942 | + $cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) : true; |
|
943 | + $cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) : 2; |
|
944 | + $cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) : '.'; |
|
945 | + $cols_n_values['CNT_cur_thsnds'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) : ','; |
|
946 | + $cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) : null; |
|
947 | + $cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) : false; |
|
948 | + $cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : false; |
|
949 | + // allow filtering of country data |
|
950 | + $cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', |
|
951 | + $cols_n_values); |
|
952 | + //EEH_Debug_Tools::printr( $cols_n_values, '$cols_n_values <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
|
953 | + // where values |
|
954 | + $where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO)); |
|
955 | + // run the update |
|
956 | + $success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values); |
|
957 | 957 | // global $wpdb; |
958 | 958 | // echo '<h4>' . $wpdb->last_query . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
959 | 959 | // echo '<h4>$success : ' . $success . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
960 | - if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== false) { |
|
961 | - // allow filtering of states data |
|
962 | - $states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states', |
|
963 | - $this->_req_data['states']); |
|
960 | + if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== false) { |
|
961 | + // allow filtering of states data |
|
962 | + $states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states', |
|
963 | + $this->_req_data['states']); |
|
964 | 964 | // EEH_Debug_Tools::printr( $states, '$states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
965 | - // loop thru state data ( looks like : states[75][STA_name] ) |
|
966 | - foreach ($states as $STA_ID => $state) { |
|
967 | - $cols_n_values = array( |
|
968 | - 'CNT_ISO' => $CNT_ISO, |
|
969 | - 'STA_abbrev' => sanitize_text_field($state['STA_abbrev']), |
|
970 | - 'STA_name' => sanitize_text_field($state['STA_name']), |
|
971 | - 'STA_active' => (bool)absint($state['STA_active']) |
|
972 | - ); |
|
973 | - // where values |
|
974 | - $where_cols_n_values = array(array('STA_ID' => $STA_ID)); |
|
975 | - // run the update |
|
976 | - $success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values); |
|
977 | - if ($success !== false) { |
|
978 | - do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, |
|
979 | - $STA_ID, $cols_n_values); |
|
980 | - } |
|
981 | - } |
|
982 | - } |
|
983 | - // check if country being edited matches org option country, and if so, then update EE_Config with new settings |
|
984 | - if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) { |
|
985 | - EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO); |
|
986 | - EE_Registry::instance()->CFG->update_espresso_config(); |
|
987 | - } |
|
988 | - $this->_redirect_after_action($success, 'Countries', 'updated', |
|
989 | - array('action' => 'country_settings', 'country' => $CNT_ISO)); |
|
990 | - } |
|
991 | - |
|
992 | - |
|
993 | - /** |
|
994 | - * form_form_field_label_wrap |
|
995 | - * |
|
996 | - * @access public |
|
997 | - * |
|
998 | - * @param string $label |
|
999 | - * |
|
1000 | - * @return string |
|
1001 | - */ |
|
1002 | - public function country_form_field_label_wrap($label, $required_text) |
|
1003 | - { |
|
1004 | - return ' |
|
965 | + // loop thru state data ( looks like : states[75][STA_name] ) |
|
966 | + foreach ($states as $STA_ID => $state) { |
|
967 | + $cols_n_values = array( |
|
968 | + 'CNT_ISO' => $CNT_ISO, |
|
969 | + 'STA_abbrev' => sanitize_text_field($state['STA_abbrev']), |
|
970 | + 'STA_name' => sanitize_text_field($state['STA_name']), |
|
971 | + 'STA_active' => (bool)absint($state['STA_active']) |
|
972 | + ); |
|
973 | + // where values |
|
974 | + $where_cols_n_values = array(array('STA_ID' => $STA_ID)); |
|
975 | + // run the update |
|
976 | + $success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values); |
|
977 | + if ($success !== false) { |
|
978 | + do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, |
|
979 | + $STA_ID, $cols_n_values); |
|
980 | + } |
|
981 | + } |
|
982 | + } |
|
983 | + // check if country being edited matches org option country, and if so, then update EE_Config with new settings |
|
984 | + if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) { |
|
985 | + EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO); |
|
986 | + EE_Registry::instance()->CFG->update_espresso_config(); |
|
987 | + } |
|
988 | + $this->_redirect_after_action($success, 'Countries', 'updated', |
|
989 | + array('action' => 'country_settings', 'country' => $CNT_ISO)); |
|
990 | + } |
|
991 | + |
|
992 | + |
|
993 | + /** |
|
994 | + * form_form_field_label_wrap |
|
995 | + * |
|
996 | + * @access public |
|
997 | + * |
|
998 | + * @param string $label |
|
999 | + * |
|
1000 | + * @return string |
|
1001 | + */ |
|
1002 | + public function country_form_field_label_wrap($label, $required_text) |
|
1003 | + { |
|
1004 | + return ' |
|
1005 | 1005 | <tr> |
1006 | 1006 | <th> |
1007 | 1007 | ' . $label . ' |
1008 | 1008 | </th>'; |
1009 | - } |
|
1010 | - |
|
1011 | - |
|
1012 | - /** |
|
1013 | - * form_form_field_input__wrap |
|
1014 | - * |
|
1015 | - * @access public |
|
1016 | - * |
|
1017 | - * @param string $label |
|
1018 | - * |
|
1019 | - * @return string |
|
1020 | - */ |
|
1021 | - public function country_form_field_input__wrap($input, $label) |
|
1022 | - { |
|
1023 | - return ' |
|
1009 | + } |
|
1010 | + |
|
1011 | + |
|
1012 | + /** |
|
1013 | + * form_form_field_input__wrap |
|
1014 | + * |
|
1015 | + * @access public |
|
1016 | + * |
|
1017 | + * @param string $label |
|
1018 | + * |
|
1019 | + * @return string |
|
1020 | + */ |
|
1021 | + public function country_form_field_input__wrap($input, $label) |
|
1022 | + { |
|
1023 | + return ' |
|
1024 | 1024 | <td class="general-settings-country-input-td"> |
1025 | 1025 | ' . $input . ' |
1026 | 1026 | </td> |
1027 | 1027 | </tr>'; |
1028 | - } |
|
1029 | - |
|
1030 | - |
|
1031 | - /** |
|
1032 | - * form_form_field_label_wrap |
|
1033 | - * |
|
1034 | - * @access public |
|
1035 | - * |
|
1036 | - * @param string $label |
|
1037 | - * @param string $required_text |
|
1038 | - * |
|
1039 | - * @return string |
|
1040 | - */ |
|
1041 | - public function state_form_field_label_wrap($label, $required_text) |
|
1042 | - { |
|
1043 | - return $required_text; |
|
1044 | - } |
|
1045 | - |
|
1046 | - |
|
1047 | - /** |
|
1048 | - * form_form_field_input__wrap |
|
1049 | - * |
|
1050 | - * @access public |
|
1051 | - * |
|
1052 | - * @param string $label |
|
1053 | - * |
|
1054 | - * @return string |
|
1055 | - */ |
|
1056 | - public function state_form_field_input__wrap($input, $label) |
|
1057 | - { |
|
1058 | - return ' |
|
1028 | + } |
|
1029 | + |
|
1030 | + |
|
1031 | + /** |
|
1032 | + * form_form_field_label_wrap |
|
1033 | + * |
|
1034 | + * @access public |
|
1035 | + * |
|
1036 | + * @param string $label |
|
1037 | + * @param string $required_text |
|
1038 | + * |
|
1039 | + * @return string |
|
1040 | + */ |
|
1041 | + public function state_form_field_label_wrap($label, $required_text) |
|
1042 | + { |
|
1043 | + return $required_text; |
|
1044 | + } |
|
1045 | + |
|
1046 | + |
|
1047 | + /** |
|
1048 | + * form_form_field_input__wrap |
|
1049 | + * |
|
1050 | + * @access public |
|
1051 | + * |
|
1052 | + * @param string $label |
|
1053 | + * |
|
1054 | + * @return string |
|
1055 | + */ |
|
1056 | + public function state_form_field_input__wrap($input, $label) |
|
1057 | + { |
|
1058 | + return ' |
|
1059 | 1059 | <td class="general-settings-country-state-input-td"> |
1060 | 1060 | ' . $input . ' |
1061 | 1061 | </td>'; |
1062 | 1062 | |
1063 | - } |
|
1063 | + } |
|
1064 | 1064 | |
1065 | 1065 | |
1066 | 1066 | |
1067 | 1067 | |
1068 | 1068 | |
1069 | 1069 | |
1070 | - /***********/ |
|
1070 | + /***********/ |
|
1071 | 1071 | |
1072 | 1072 | |
1073 | - /** |
|
1074 | - * displays edit and view links for critical EE pages |
|
1075 | - * |
|
1076 | - * @access public |
|
1077 | - * |
|
1078 | - * @param int $ee_page_id |
|
1079 | - * |
|
1080 | - * @return string |
|
1081 | - */ |
|
1082 | - public static function edit_view_links($ee_page_id) |
|
1083 | - { |
|
1084 | - $links = '<a href="' . add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'), |
|
1085 | - admin_url('post.php')) . '" >' . __('Edit', 'event_espresso') . '</a>'; |
|
1086 | - $links .= ' | '; |
|
1087 | - $links .= '<a href="' . get_permalink($ee_page_id) . '" >' . __('View', 'event_espresso') . '</a>'; |
|
1073 | + /** |
|
1074 | + * displays edit and view links for critical EE pages |
|
1075 | + * |
|
1076 | + * @access public |
|
1077 | + * |
|
1078 | + * @param int $ee_page_id |
|
1079 | + * |
|
1080 | + * @return string |
|
1081 | + */ |
|
1082 | + public static function edit_view_links($ee_page_id) |
|
1083 | + { |
|
1084 | + $links = '<a href="' . add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'), |
|
1085 | + admin_url('post.php')) . '" >' . __('Edit', 'event_espresso') . '</a>'; |
|
1086 | + $links .= ' | '; |
|
1087 | + $links .= '<a href="' . get_permalink($ee_page_id) . '" >' . __('View', 'event_espresso') . '</a>'; |
|
1088 | 1088 | |
1089 | - return $links; |
|
1090 | - } |
|
1091 | - |
|
1092 | - |
|
1093 | - /** |
|
1094 | - * displays page and shortcode status for critical EE pages |
|
1095 | - * |
|
1096 | - * @param WP page object $ee_page |
|
1097 | - * |
|
1098 | - * @return string |
|
1099 | - */ |
|
1100 | - public static function page_and_shortcode_status($ee_page, $shortcode) |
|
1101 | - { |
|
1089 | + return $links; |
|
1090 | + } |
|
1091 | + |
|
1092 | + |
|
1093 | + /** |
|
1094 | + * displays page and shortcode status for critical EE pages |
|
1095 | + * |
|
1096 | + * @param WP page object $ee_page |
|
1097 | + * |
|
1098 | + * @return string |
|
1099 | + */ |
|
1100 | + public static function page_and_shortcode_status($ee_page, $shortcode) |
|
1101 | + { |
|
1102 | 1102 | |
1103 | - // page status |
|
1104 | - if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') { |
|
1105 | - $pg_colour = 'green'; |
|
1106 | - $pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), ' ', ' '); |
|
1107 | - } else { |
|
1108 | - $pg_colour = 'red'; |
|
1109 | - $pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), ' ', ' '); |
|
1110 | - } |
|
1103 | + // page status |
|
1104 | + if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') { |
|
1105 | + $pg_colour = 'green'; |
|
1106 | + $pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), ' ', ' '); |
|
1107 | + } else { |
|
1108 | + $pg_colour = 'red'; |
|
1109 | + $pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), ' ', ' '); |
|
1110 | + } |
|
1111 | 1111 | |
1112 | - // shortcode status |
|
1113 | - if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== false) { |
|
1114 | - $sc_colour = 'green'; |
|
1115 | - $sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), ' '); |
|
1116 | - } else { |
|
1117 | - $sc_colour = 'red'; |
|
1118 | - $sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), ' '); |
|
1119 | - } |
|
1112 | + // shortcode status |
|
1113 | + if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== false) { |
|
1114 | + $sc_colour = 'green'; |
|
1115 | + $sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), ' '); |
|
1116 | + } else { |
|
1117 | + $sc_colour = 'red'; |
|
1118 | + $sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), ' '); |
|
1119 | + } |
|
1120 | 1120 | |
1121 | - return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>'; |
|
1121 | + return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>'; |
|
1122 | 1122 | |
1123 | - } |
|
1124 | - |
|
1125 | - |
|
1126 | - /** |
|
1127 | - * generates a dropdown of all parent pages - copied from WP core |
|
1128 | - * |
|
1129 | - * @param unknown_type $default |
|
1130 | - * @param unknown_type $parent |
|
1131 | - * @param unknown_type $level |
|
1132 | - * |
|
1133 | - * @return unknown |
|
1134 | - */ |
|
1135 | - public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0) |
|
1136 | - { |
|
1137 | - global $wpdb; |
|
1138 | - $items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", |
|
1139 | - $parent)); |
|
1123 | + } |
|
1124 | + |
|
1125 | + |
|
1126 | + /** |
|
1127 | + * generates a dropdown of all parent pages - copied from WP core |
|
1128 | + * |
|
1129 | + * @param unknown_type $default |
|
1130 | + * @param unknown_type $parent |
|
1131 | + * @param unknown_type $level |
|
1132 | + * |
|
1133 | + * @return unknown |
|
1134 | + */ |
|
1135 | + public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0) |
|
1136 | + { |
|
1137 | + global $wpdb; |
|
1138 | + $items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", |
|
1139 | + $parent)); |
|
1140 | 1140 | |
1141 | - if ($items) { |
|
1142 | - foreach ($items as $item) { |
|
1143 | - $pad = str_repeat(' ', $level * 3); |
|
1144 | - if ($item->ID == $default) { |
|
1145 | - $current = ' selected="selected"'; |
|
1146 | - } else { |
|
1147 | - $current = ''; |
|
1148 | - } |
|
1141 | + if ($items) { |
|
1142 | + foreach ($items as $item) { |
|
1143 | + $pad = str_repeat(' ', $level * 3); |
|
1144 | + if ($item->ID == $default) { |
|
1145 | + $current = ' selected="selected"'; |
|
1146 | + } else { |
|
1147 | + $current = ''; |
|
1148 | + } |
|
1149 | 1149 | |
1150 | - echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>"; |
|
1151 | - parent_dropdown($default, $item->ID, $level + 1); |
|
1152 | - } |
|
1153 | - } else { |
|
1154 | - return false; |
|
1155 | - } |
|
1156 | - } |
|
1150 | + echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>"; |
|
1151 | + parent_dropdown($default, $item->ID, $level + 1); |
|
1152 | + } |
|
1153 | + } else { |
|
1154 | + return false; |
|
1155 | + } |
|
1156 | + } |
|
1157 | 1157 | |
1158 | 1158 | |
1159 | 1159 | } //ends Forms_Admin_Page class |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | //scripts |
242 | 242 | wp_enqueue_script('media-upload'); |
243 | 243 | wp_enqueue_script('thickbox'); |
244 | - wp_register_script('organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js', |
|
244 | + wp_register_script('organization_settings', GEN_SET_ASSETS_URL.'your_organization_settings.js', |
|
245 | 245 | array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, true); |
246 | - wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION); |
|
246 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION); |
|
247 | 247 | wp_enqueue_script('organization_settings'); |
248 | 248 | wp_enqueue_style('organization-css'); |
249 | 249 | $confirm_image_delete = array( |
@@ -257,9 +257,9 @@ discard block |
||
257 | 257 | public function load_scripts_styles_country_settings() |
258 | 258 | { |
259 | 259 | //scripts |
260 | - wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js', |
|
260 | + wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL.'gen_settings_countries.js', |
|
261 | 261 | array('ee_admin_js'), EVENT_ESPRESSO_VERSION, true); |
262 | - wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION); |
|
262 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION); |
|
263 | 263 | wp_enqueue_script('gen_settings_countries'); |
264 | 264 | wp_enqueue_style('organization-css'); |
265 | 265 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | $this->_set_add_edit_form_tags('update_espresso_page_settings'); |
307 | 307 | $this->_set_publish_post_box_vars(null, false, false, null, false); |
308 | 308 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
309 | - GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', |
|
309 | + GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php', |
|
310 | 310 | $this->_template_args, |
311 | 311 | true |
312 | 312 | ); |
@@ -429,13 +429,13 @@ discard block |
||
429 | 429 | add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
430 | 430 | |
431 | 431 | //PUE verification stuff |
432 | - $ver_option_key = 'puvererr_' . basename(EE_PLUGIN_BASENAME); |
|
432 | + $ver_option_key = 'puvererr_'.basename(EE_PLUGIN_BASENAME); |
|
433 | 433 | $verify_fail = get_option($ver_option_key); |
434 | 434 | $this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>'; |
435 | 435 | |
436 | 436 | $this->_set_add_edit_form_tags('update_your_organization_settings'); |
437 | 437 | $this->_set_publish_post_box_vars(null, false, false, null, false); |
438 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php', |
|
438 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'your_organization_settings.template.php', |
|
439 | 439 | $this->_template_args, true); |
440 | 440 | |
441 | 441 | $this->display_admin_page_with_sidebar(); |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | |
586 | 586 | $this->_set_add_edit_form_tags('update_country_settings'); |
587 | 587 | $this->_set_publish_post_box_vars(null, false, false, null, false); |
588 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', |
|
588 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'countries_settings.template.php', |
|
589 | 589 | $this->_template_args, true); |
590 | 590 | $this->display_admin_page_with_no_sidebar(); |
591 | 591 | } |
@@ -615,65 +615,65 @@ discard block |
||
615 | 615 | add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
616 | 616 | $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
617 | 617 | //EEH_Debug_Tools::printr( $country, '$country <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
618 | - $country_input_types = array( |
|
618 | + $country_input_types = array( |
|
619 | 619 | 'CNT_active' => array( |
620 | 620 | 'type' => 'RADIO_BTN', |
621 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
621 | + 'input_name' => 'cntry['.$CNT_ISO.']', |
|
622 | 622 | 'class' => '', |
623 | 623 | 'options' => $this->_yes_no_values, |
624 | 624 | 'use_desc_4_label' => true |
625 | 625 | ), |
626 | 626 | 'CNT_ISO' => array( |
627 | 627 | 'type' => 'TEXT', |
628 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
628 | + 'input_name' => 'cntry['.$CNT_ISO.']', |
|
629 | 629 | 'class' => 'small-text' |
630 | 630 | ), |
631 | 631 | 'CNT_ISO3' => array( |
632 | 632 | 'type' => 'TEXT', |
633 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
633 | + 'input_name' => 'cntry['.$CNT_ISO.']', |
|
634 | 634 | 'class' => 'small-text' |
635 | 635 | ), |
636 | 636 | 'RGN_ID' => array( |
637 | 637 | 'type' => 'TEXT', |
638 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
638 | + 'input_name' => 'cntry['.$CNT_ISO.']', |
|
639 | 639 | 'class' => 'small-text' |
640 | 640 | ), |
641 | 641 | 'CNT_name' => array( |
642 | 642 | 'type' => 'TEXT', |
643 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
643 | + 'input_name' => 'cntry['.$CNT_ISO.']', |
|
644 | 644 | 'class' => 'regular-text' |
645 | 645 | ), |
646 | 646 | 'CNT_cur_code' => array( |
647 | 647 | 'type' => 'TEXT', |
648 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
648 | + 'input_name' => 'cntry['.$CNT_ISO.']', |
|
649 | 649 | 'class' => 'small-text' |
650 | 650 | ), |
651 | 651 | 'CNT_cur_single' => array( |
652 | 652 | 'type' => 'TEXT', |
653 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
653 | + 'input_name' => 'cntry['.$CNT_ISO.']', |
|
654 | 654 | 'class' => 'medium-text' |
655 | 655 | ), |
656 | 656 | 'CNT_cur_plural' => array( |
657 | 657 | 'type' => 'TEXT', |
658 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
658 | + 'input_name' => 'cntry['.$CNT_ISO.']', |
|
659 | 659 | 'class' => 'medium-text' |
660 | 660 | ), |
661 | 661 | 'CNT_cur_sign' => array( |
662 | 662 | 'type' => 'TEXT', |
663 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
663 | + 'input_name' => 'cntry['.$CNT_ISO.']', |
|
664 | 664 | 'class' => 'small-text', |
665 | 665 | 'htmlentities' => false |
666 | 666 | ), |
667 | 667 | 'CNT_cur_sign_b4' => array( |
668 | 668 | 'type' => 'RADIO_BTN', |
669 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
669 | + 'input_name' => 'cntry['.$CNT_ISO.']', |
|
670 | 670 | 'class' => '', |
671 | 671 | 'options' => $this->_yes_no_values, |
672 | 672 | 'use_desc_4_label' => true |
673 | 673 | ), |
674 | 674 | 'CNT_cur_dec_plc' => array( |
675 | 675 | 'type' => 'RADIO_BTN', |
676 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
676 | + 'input_name' => 'cntry['.$CNT_ISO.']', |
|
677 | 677 | 'class' => '', |
678 | 678 | 'options' => array( |
679 | 679 | array('id' => 0, 'text' => ''), |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | ), |
685 | 685 | 'CNT_cur_dec_mrk' => array( |
686 | 686 | 'type' => 'RADIO_BTN', |
687 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
687 | + 'input_name' => 'cntry['.$CNT_ISO.']', |
|
688 | 688 | 'class' => '', |
689 | 689 | 'options' => array( |
690 | 690 | array( |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | ), |
698 | 698 | 'CNT_cur_thsnds' => array( |
699 | 699 | 'type' => 'RADIO_BTN', |
700 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
700 | + 'input_name' => 'cntry['.$CNT_ISO.']', |
|
701 | 701 | 'class' => '', |
702 | 702 | 'options' => array( |
703 | 703 | array( |
@@ -710,12 +710,12 @@ discard block |
||
710 | 710 | ), |
711 | 711 | 'CNT_tel_code' => array( |
712 | 712 | 'type' => 'TEXT', |
713 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
713 | + 'input_name' => 'cntry['.$CNT_ISO.']', |
|
714 | 714 | 'class' => 'small-text' |
715 | 715 | ), |
716 | 716 | 'CNT_is_EU' => array( |
717 | 717 | 'type' => 'RADIO_BTN', |
718 | - 'input_name' => 'cntry[' . $CNT_ISO . ']', |
|
718 | + 'input_name' => 'cntry['.$CNT_ISO.']', |
|
719 | 719 | 'class' => '', |
720 | 720 | 'options' => $this->_yes_no_values, |
721 | 721 | 'use_desc_4_label' => true |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | ); |
724 | 724 | $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country, |
725 | 725 | $country_input_types); |
726 | - $country_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', |
|
726 | + $country_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php', |
|
727 | 727 | $this->_template_args, true); |
728 | 728 | |
729 | 729 | if (defined('DOING_AJAX')) { |
@@ -773,20 +773,20 @@ discard block |
||
773 | 773 | foreach ($states as $STA_ID => $state) { |
774 | 774 | if ($state instanceof EE_State) { |
775 | 775 | //STA_abbrev STA_name STA_active |
776 | - $state_input_types = array( |
|
776 | + $state_input_types = array( |
|
777 | 777 | 'STA_abbrev' => array( |
778 | 778 | 'type' => 'TEXT', |
779 | - 'input_name' => 'states[' . $STA_ID . ']', |
|
779 | + 'input_name' => 'states['.$STA_ID.']', |
|
780 | 780 | 'class' => 'mid-text' |
781 | 781 | ), |
782 | 782 | 'STA_name' => array( |
783 | 783 | 'type' => 'TEXT', |
784 | - 'input_name' => 'states[' . $STA_ID . ']', |
|
784 | + 'input_name' => 'states['.$STA_ID.']', |
|
785 | 785 | 'class' => 'regular-text' |
786 | 786 | ), |
787 | 787 | 'STA_active' => array( |
788 | 788 | 'type' => 'RADIO_BTN', |
789 | - 'input_name' => 'states[' . $STA_ID . ']', |
|
789 | + 'input_name' => 'states['.$STA_ID.']', |
|
790 | 790 | 'options' => $this->_yes_no_values, |
791 | 791 | 'use_desc_4_label' => true |
792 | 792 | ) |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'), |
811 | 811 | GEN_SET_ADMIN_URL); |
812 | 812 | |
813 | - $state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', |
|
813 | + $state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php', |
|
814 | 814 | $this->_template_args, true); |
815 | 815 | |
816 | 816 | if (defined('DOING_AJAX')) { |
@@ -851,8 +851,7 @@ discard block |
||
851 | 851 | __FILE__, __FUNCTION__, __LINE__); |
852 | 852 | $success = false; |
853 | 853 | } |
854 | - $STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) : |
|
855 | - false; |
|
854 | + $STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) : false; |
|
856 | 855 | if ( ! $STA_name) { |
857 | 856 | EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__, |
858 | 857 | __FUNCTION__, __LINE__); |
@@ -866,7 +865,7 @@ discard block |
||
866 | 865 | 'STA_name' => $STA_name, |
867 | 866 | 'STA_active' => true |
868 | 867 | ); |
869 | - $success = EEM_State::instance()->insert($cols_n_values); |
|
868 | + $success = EEM_State::instance()->insert($cols_n_values); |
|
870 | 869 | EE_Error::add_success(__('The State was added successfully.', 'event_espresso')); |
871 | 870 | } |
872 | 871 | |
@@ -968,7 +967,7 @@ discard block |
||
968 | 967 | 'CNT_ISO' => $CNT_ISO, |
969 | 968 | 'STA_abbrev' => sanitize_text_field($state['STA_abbrev']), |
970 | 969 | 'STA_name' => sanitize_text_field($state['STA_name']), |
971 | - 'STA_active' => (bool)absint($state['STA_active']) |
|
970 | + 'STA_active' => (bool) absint($state['STA_active']) |
|
972 | 971 | ); |
973 | 972 | // where values |
974 | 973 | $where_cols_n_values = array(array('STA_ID' => $STA_ID)); |
@@ -1004,7 +1003,7 @@ discard block |
||
1004 | 1003 | return ' |
1005 | 1004 | <tr> |
1006 | 1005 | <th> |
1007 | - ' . $label . ' |
|
1006 | + ' . $label.' |
|
1008 | 1007 | </th>'; |
1009 | 1008 | } |
1010 | 1009 | |
@@ -1022,7 +1021,7 @@ discard block |
||
1022 | 1021 | { |
1023 | 1022 | return ' |
1024 | 1023 | <td class="general-settings-country-input-td"> |
1025 | - ' . $input . ' |
|
1024 | + ' . $input.' |
|
1026 | 1025 | </td> |
1027 | 1026 | </tr>'; |
1028 | 1027 | } |
@@ -1057,7 +1056,7 @@ discard block |
||
1057 | 1056 | { |
1058 | 1057 | return ' |
1059 | 1058 | <td class="general-settings-country-state-input-td"> |
1060 | - ' . $input . ' |
|
1059 | + ' . $input.' |
|
1061 | 1060 | </td>'; |
1062 | 1061 | |
1063 | 1062 | } |
@@ -1081,10 +1080,10 @@ discard block |
||
1081 | 1080 | */ |
1082 | 1081 | public static function edit_view_links($ee_page_id) |
1083 | 1082 | { |
1084 | - $links = '<a href="' . add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'), |
|
1085 | - admin_url('post.php')) . '" >' . __('Edit', 'event_espresso') . '</a>'; |
|
1083 | + $links = '<a href="'.add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'), |
|
1084 | + admin_url('post.php')).'" >'.__('Edit', 'event_espresso').'</a>'; |
|
1086 | 1085 | $links .= ' | '; |
1087 | - $links .= '<a href="' . get_permalink($ee_page_id) . '" >' . __('View', 'event_espresso') . '</a>'; |
|
1086 | + $links .= '<a href="'.get_permalink($ee_page_id).'" >'.__('View', 'event_espresso').'</a>'; |
|
1088 | 1087 | |
1089 | 1088 | return $links; |
1090 | 1089 | } |
@@ -1118,7 +1117,7 @@ discard block |
||
1118 | 1117 | $sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), ' '); |
1119 | 1118 | } |
1120 | 1119 | |
1121 | - return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>'; |
|
1120 | + return '<span style="color:'.$pg_colour.'; margin-right:2em;"><strong>'.$pg_status.'</strong></span><span style="color:'.$sc_colour.'"><strong>'.$sc_status.'</strong></span>'; |
|
1122 | 1121 | |
1123 | 1122 | } |
1124 | 1123 | |
@@ -1147,7 +1146,7 @@ discard block |
||
1147 | 1146 | $current = ''; |
1148 | 1147 | } |
1149 | 1148 | |
1150 | - echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>"; |
|
1149 | + echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad ".esc_html($item->post_title)."</option>"; |
|
1151 | 1150 | parent_dropdown($default, $item->ID, $level + 1); |
1152 | 1151 | } |
1153 | 1152 | } else { |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
3 | - exit('NO direct script access allowed'); |
|
3 | + exit('NO direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -16,109 +16,109 @@ discard block |
||
16 | 16 | class Your_Organization_Help_Tour extends EE_Help_Tour |
17 | 17 | { |
18 | 18 | |
19 | - protected function _set_tour_properties() |
|
20 | - { |
|
21 | - $this->_label = __('Your Organization Tour', 'event_espresso'); |
|
22 | - $this->_slug = 'your-organization-joyride'; |
|
23 | - } |
|
19 | + protected function _set_tour_properties() |
|
20 | + { |
|
21 | + $this->_label = __('Your Organization Tour', 'event_espresso'); |
|
22 | + $this->_slug = 'your-organization-joyride'; |
|
23 | + } |
|
24 | 24 | |
25 | 25 | |
26 | - protected function _set_tour_stops() |
|
27 | - { |
|
28 | - $this->_stops = array( |
|
29 | - 10 => array( |
|
30 | - 'content' => $this->_start(), |
|
31 | - ), |
|
26 | + protected function _set_tour_stops() |
|
27 | + { |
|
28 | + $this->_stops = array( |
|
29 | + 10 => array( |
|
30 | + 'content' => $this->_start(), |
|
31 | + ), |
|
32 | 32 | |
33 | - 30 => array( |
|
34 | - 'id' => 'contact_info_h4', |
|
35 | - 'content' => $this->_contact_information_stop(), |
|
36 | - 'options' => array( |
|
37 | - 'tipLocation' => 'left', |
|
38 | - 'tipAdjustmentY' => -50, |
|
39 | - 'tipAdjustmentX' => 15 |
|
40 | - ) |
|
41 | - ), |
|
42 | - 40 => array( |
|
43 | - 'id' => 'upload_image', |
|
44 | - 'content' => $this->_upload_image_stop(), |
|
45 | - 'options' => array( |
|
46 | - 'tipLocation' => 'right', |
|
47 | - 'tipAdjustmentY' => -50, |
|
48 | - 'tipAdjustmentX' => 15 |
|
49 | - ) |
|
50 | - ), |
|
51 | - 50 => array( |
|
52 | - 'id' => 'organization_facebook', |
|
53 | - 'content' => $this->_organization_facebook_stop(), |
|
54 | - 'options' => array( |
|
55 | - 'tipLocation' => 'right', |
|
56 | - 'tipAdjustmentY' => -50, |
|
57 | - 'tipAdjustmentX' => 15 |
|
58 | - ) |
|
59 | - ), |
|
60 | - 60 => array( |
|
61 | - 'id' => 'ueip_optin', |
|
62 | - 'content' => $this->_ueip_option_stop(), |
|
63 | - 'options' => array( |
|
64 | - 'tipLocation' => 'right', |
|
65 | - 'tipAdjustmentY' => -50, |
|
66 | - 'tipAdjustmentX' => 15 |
|
67 | - ) |
|
68 | - ), |
|
69 | - 70 => array( |
|
70 | - 'id' => 'espresso_major_buttons_wrapper', |
|
71 | - 'content' => $this->_end_tour_stop(), |
|
72 | - 'options' => array( |
|
73 | - 'tipLocation' => 'right', |
|
74 | - 'tipAdjustmentY' => -50, |
|
75 | - 'tipAdjustmentX' => 185 |
|
76 | - ) |
|
77 | - ) |
|
78 | - ); |
|
79 | - } |
|
33 | + 30 => array( |
|
34 | + 'id' => 'contact_info_h4', |
|
35 | + 'content' => $this->_contact_information_stop(), |
|
36 | + 'options' => array( |
|
37 | + 'tipLocation' => 'left', |
|
38 | + 'tipAdjustmentY' => -50, |
|
39 | + 'tipAdjustmentX' => 15 |
|
40 | + ) |
|
41 | + ), |
|
42 | + 40 => array( |
|
43 | + 'id' => 'upload_image', |
|
44 | + 'content' => $this->_upload_image_stop(), |
|
45 | + 'options' => array( |
|
46 | + 'tipLocation' => 'right', |
|
47 | + 'tipAdjustmentY' => -50, |
|
48 | + 'tipAdjustmentX' => 15 |
|
49 | + ) |
|
50 | + ), |
|
51 | + 50 => array( |
|
52 | + 'id' => 'organization_facebook', |
|
53 | + 'content' => $this->_organization_facebook_stop(), |
|
54 | + 'options' => array( |
|
55 | + 'tipLocation' => 'right', |
|
56 | + 'tipAdjustmentY' => -50, |
|
57 | + 'tipAdjustmentX' => 15 |
|
58 | + ) |
|
59 | + ), |
|
60 | + 60 => array( |
|
61 | + 'id' => 'ueip_optin', |
|
62 | + 'content' => $this->_ueip_option_stop(), |
|
63 | + 'options' => array( |
|
64 | + 'tipLocation' => 'right', |
|
65 | + 'tipAdjustmentY' => -50, |
|
66 | + 'tipAdjustmentX' => 15 |
|
67 | + ) |
|
68 | + ), |
|
69 | + 70 => array( |
|
70 | + 'id' => 'espresso_major_buttons_wrapper', |
|
71 | + 'content' => $this->_end_tour_stop(), |
|
72 | + 'options' => array( |
|
73 | + 'tipLocation' => 'right', |
|
74 | + 'tipAdjustmentY' => -50, |
|
75 | + 'tipAdjustmentX' => 185 |
|
76 | + ) |
|
77 | + ) |
|
78 | + ); |
|
79 | + } |
|
80 | 80 | |
81 | 81 | |
82 | - protected function _start() |
|
83 | - { |
|
84 | - $content = '<h3>' . __('Organization Settings', 'event_espresso') . '</h3>'; |
|
85 | - $content .= '<p>' . __('This tour of the Your Organization page will go over different areas of the screen to help you understand what they are used for.', |
|
86 | - 'event_espresso') . '</p>'; |
|
82 | + protected function _start() |
|
83 | + { |
|
84 | + $content = '<h3>' . __('Organization Settings', 'event_espresso') . '</h3>'; |
|
85 | + $content .= '<p>' . __('This tour of the Your Organization page will go over different areas of the screen to help you understand what they are used for.', |
|
86 | + 'event_espresso') . '</p>'; |
|
87 | 87 | |
88 | - return $content; |
|
89 | - } |
|
88 | + return $content; |
|
89 | + } |
|
90 | 90 | |
91 | - protected function _site_license_key_stop() |
|
92 | - { |
|
93 | - return '<p>' . __('Enter your support license key here to enable one-click updates.', |
|
94 | - 'event_espresso') . '</p>'; |
|
95 | - } |
|
91 | + protected function _site_license_key_stop() |
|
92 | + { |
|
93 | + return '<p>' . __('Enter your support license key here to enable one-click updates.', |
|
94 | + 'event_espresso') . '</p>'; |
|
95 | + } |
|
96 | 96 | |
97 | - protected function _contact_information_stop() |
|
98 | - { |
|
99 | - return '<p>' . __('You can change your business / organization information below. Be sure to keep this information updated as it is used in other areas of the site. Adjusting the country option here will update your currency settings. More options are available in the Countries tab.', |
|
100 | - 'event_espresso') . '</p>'; |
|
101 | - } |
|
97 | + protected function _contact_information_stop() |
|
98 | + { |
|
99 | + return '<p>' . __('You can change your business / organization information below. Be sure to keep this information updated as it is used in other areas of the site. Adjusting the country option here will update your currency settings. More options are available in the Countries tab.', |
|
100 | + 'event_espresso') . '</p>'; |
|
101 | + } |
|
102 | 102 | |
103 | - protected function _upload_image_stop() |
|
104 | - { |
|
105 | - return '<p>' . __('Add a logo. This can be used for invoices and tickets.', 'event_espresso') . '</p>'; |
|
106 | - } |
|
103 | + protected function _upload_image_stop() |
|
104 | + { |
|
105 | + return '<p>' . __('Add a logo. This can be used for invoices and tickets.', 'event_espresso') . '</p>'; |
|
106 | + } |
|
107 | 107 | |
108 | - protected function _organization_facebook_stop() |
|
109 | - { |
|
110 | - return '<p>' . __('Add links to various social media networks.', 'event_espresso') . '</p>'; |
|
111 | - } |
|
108 | + protected function _organization_facebook_stop() |
|
109 | + { |
|
110 | + return '<p>' . __('Add links to various social media networks.', 'event_espresso') . '</p>'; |
|
111 | + } |
|
112 | 112 | |
113 | - protected function _ueip_option_stop() |
|
114 | - { |
|
115 | - return '<p>' . __('Help us to help you! Sign up to the User eXperience Improvement Program and send us anonymous data that will help us improve Event Espresso.', |
|
116 | - 'event_espresso') . '</p>'; |
|
117 | - } |
|
113 | + protected function _ueip_option_stop() |
|
114 | + { |
|
115 | + return '<p>' . __('Help us to help you! Sign up to the User eXperience Improvement Program and send us anonymous data that will help us improve Event Espresso.', |
|
116 | + 'event_espresso') . '</p>'; |
|
117 | + } |
|
118 | 118 | |
119 | - protected function _end_tour_stop() |
|
120 | - { |
|
121 | - return '<p>' . __('You are almost done updating Your Organization information. Click on the Save button to save changes and then go to the Payment Methods screen so you can setup a payment gateway.', |
|
122 | - 'event_espresso') . '</p>'; |
|
123 | - } |
|
119 | + protected function _end_tour_stop() |
|
120 | + { |
|
121 | + return '<p>' . __('You are almost done updating Your Organization information. Click on the Save button to save changes and then go to the Payment Methods screen so you can setup a payment gateway.', |
|
122 | + 'event_espresso') . '</p>'; |
|
123 | + } |
|
124 | 124 | } |
125 | 125 | \ No newline at end of file |
@@ -81,44 +81,44 @@ |
||
81 | 81 | |
82 | 82 | protected function _start() |
83 | 83 | { |
84 | - $content = '<h3>' . __('Organization Settings', 'event_espresso') . '</h3>'; |
|
85 | - $content .= '<p>' . __('This tour of the Your Organization page will go over different areas of the screen to help you understand what they are used for.', |
|
86 | - 'event_espresso') . '</p>'; |
|
84 | + $content = '<h3>'.__('Organization Settings', 'event_espresso').'</h3>'; |
|
85 | + $content .= '<p>'.__('This tour of the Your Organization page will go over different areas of the screen to help you understand what they are used for.', |
|
86 | + 'event_espresso').'</p>'; |
|
87 | 87 | |
88 | 88 | return $content; |
89 | 89 | } |
90 | 90 | |
91 | 91 | protected function _site_license_key_stop() |
92 | 92 | { |
93 | - return '<p>' . __('Enter your support license key here to enable one-click updates.', |
|
94 | - 'event_espresso') . '</p>'; |
|
93 | + return '<p>'.__('Enter your support license key here to enable one-click updates.', |
|
94 | + 'event_espresso').'</p>'; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | protected function _contact_information_stop() |
98 | 98 | { |
99 | - return '<p>' . __('You can change your business / organization information below. Be sure to keep this information updated as it is used in other areas of the site. Adjusting the country option here will update your currency settings. More options are available in the Countries tab.', |
|
100 | - 'event_espresso') . '</p>'; |
|
99 | + return '<p>'.__('You can change your business / organization information below. Be sure to keep this information updated as it is used in other areas of the site. Adjusting the country option here will update your currency settings. More options are available in the Countries tab.', |
|
100 | + 'event_espresso').'</p>'; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | protected function _upload_image_stop() |
104 | 104 | { |
105 | - return '<p>' . __('Add a logo. This can be used for invoices and tickets.', 'event_espresso') . '</p>'; |
|
105 | + return '<p>'.__('Add a logo. This can be used for invoices and tickets.', 'event_espresso').'</p>'; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | protected function _organization_facebook_stop() |
109 | 109 | { |
110 | - return '<p>' . __('Add links to various social media networks.', 'event_espresso') . '</p>'; |
|
110 | + return '<p>'.__('Add links to various social media networks.', 'event_espresso').'</p>'; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | protected function _ueip_option_stop() |
114 | 114 | { |
115 | - return '<p>' . __('Help us to help you! Sign up to the User eXperience Improvement Program and send us anonymous data that will help us improve Event Espresso.', |
|
116 | - 'event_espresso') . '</p>'; |
|
115 | + return '<p>'.__('Help us to help you! Sign up to the User eXperience Improvement Program and send us anonymous data that will help us improve Event Espresso.', |
|
116 | + 'event_espresso').'</p>'; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | protected function _end_tour_stop() |
120 | 120 | { |
121 | - return '<p>' . __('You are almost done updating Your Organization information. Click on the Save button to save changes and then go to the Payment Methods screen so you can setup a payment gateway.', |
|
122 | - 'event_espresso') . '</p>'; |
|
121 | + return '<p>'.__('You are almost done updating Your Organization information. Click on the Save button to save changes and then go to the Payment Methods screen so you can setup a payment gateway.', |
|
122 | + 'event_espresso').'</p>'; |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | \ No newline at end of file |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
3 | - exit('NO direct script access allowed'); |
|
3 | + exit('NO direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -18,145 +18,145 @@ discard block |
||
18 | 18 | class Registration_Form_Question_Groups_Help_Tour extends EE_Help_Tour |
19 | 19 | { |
20 | 20 | |
21 | - protected function _set_tour_properties() |
|
22 | - { |
|
23 | - $this->_label = __('Question Groups Tour', 'event_espresso'); |
|
24 | - $this->_slug = $this->_is_caf ? 'question-groups-caf-overview-joyride' : 'question-groups-overview-joyride'; |
|
25 | - } |
|
21 | + protected function _set_tour_properties() |
|
22 | + { |
|
23 | + $this->_label = __('Question Groups Tour', 'event_espresso'); |
|
24 | + $this->_slug = $this->_is_caf ? 'question-groups-caf-overview-joyride' : 'question-groups-overview-joyride'; |
|
25 | + } |
|
26 | 26 | |
27 | 27 | |
28 | - protected function _set_tour_stops() |
|
29 | - { |
|
30 | - $this->_stops = array( |
|
31 | - 10 => array( |
|
32 | - 'content' => $this->_start(), |
|
33 | - ) |
|
34 | - ); |
|
28 | + protected function _set_tour_stops() |
|
29 | + { |
|
30 | + $this->_stops = array( |
|
31 | + 10 => array( |
|
32 | + 'content' => $this->_start(), |
|
33 | + ) |
|
34 | + ); |
|
35 | 35 | |
36 | - if ($this->_is_caf) { |
|
37 | - $this->_stops[15] = array( |
|
38 | - 'id' => 'id', |
|
39 | - 'content' => $this->_id_stop(), |
|
40 | - 'options' => array( |
|
41 | - 'tipLocation' => 'top', |
|
42 | - 'tipAdjustmentY' => -30, |
|
43 | - 'tipAdjustmentX' => -15 |
|
44 | - ) |
|
45 | - ); |
|
46 | - $this->_stops[20] = array( |
|
47 | - 'id' => 'name', |
|
48 | - 'content' => $this->_name_stop(), |
|
49 | - 'options' => array( |
|
50 | - 'tipLocation' => 'top', |
|
51 | - 'tipAdjustmentY' => -30, |
|
52 | - 'tipAdjustmentX' => 25 |
|
53 | - ) |
|
54 | - ); |
|
55 | - $this->_stops[30] = array( |
|
56 | - 'id' => 'description', |
|
57 | - 'content' => $this->_description_stop(), |
|
58 | - 'options' => array( |
|
59 | - 'tipLocation' => 'top', |
|
60 | - 'tipAdjustmentY' => -30, |
|
61 | - 'tipAdjustmentX' => 20 |
|
62 | - ) |
|
63 | - ); |
|
64 | - $this->_stops[40] = array( |
|
65 | - 'id' => 'show_group_name', |
|
66 | - 'content' => $this->_show_group_name_stop(), |
|
67 | - 'options' => array( |
|
68 | - 'tipLocation' => 'top', |
|
69 | - 'tipAdjustmentY' => -30, |
|
70 | - 'tipAdjustmentX' => 20 |
|
71 | - ) |
|
72 | - ); |
|
73 | - $this->_stops[50] = array( |
|
74 | - 'id' => 'show_group_desc', |
|
75 | - 'content' => $this->_show_group_description_stop(), |
|
76 | - 'options' => array( |
|
77 | - 'tipLocation' => 'top', |
|
78 | - 'tipAdjustmentY' => -30, |
|
79 | - 'tipAdjustmentX' => 20 |
|
80 | - ) |
|
81 | - ); |
|
82 | - $this->_stops[60] = array( |
|
83 | - 'class' => 'bulkactions', |
|
84 | - 'content' => $this->_bulk_actions_stop(), |
|
85 | - 'options' => array( |
|
86 | - 'tipLocation' => 'left', |
|
87 | - 'tipAdjustmentY' => -50, |
|
88 | - 'tipAdjustmentX' => -80 |
|
89 | - ) |
|
90 | - ); |
|
91 | - $this->_stops[70] = array( |
|
92 | - 'id' => 'add-new-question-group', |
|
93 | - 'content' => $this->_add_new_question_group_stop(), |
|
94 | - 'options' => array( |
|
95 | - 'tipLocation' => 'right', |
|
96 | - 'tipAdjustmentY' => -50, |
|
97 | - 'tipAdjustmentX' => 15 |
|
98 | - ) |
|
99 | - ); |
|
100 | - } |
|
101 | - } |
|
36 | + if ($this->_is_caf) { |
|
37 | + $this->_stops[15] = array( |
|
38 | + 'id' => 'id', |
|
39 | + 'content' => $this->_id_stop(), |
|
40 | + 'options' => array( |
|
41 | + 'tipLocation' => 'top', |
|
42 | + 'tipAdjustmentY' => -30, |
|
43 | + 'tipAdjustmentX' => -15 |
|
44 | + ) |
|
45 | + ); |
|
46 | + $this->_stops[20] = array( |
|
47 | + 'id' => 'name', |
|
48 | + 'content' => $this->_name_stop(), |
|
49 | + 'options' => array( |
|
50 | + 'tipLocation' => 'top', |
|
51 | + 'tipAdjustmentY' => -30, |
|
52 | + 'tipAdjustmentX' => 25 |
|
53 | + ) |
|
54 | + ); |
|
55 | + $this->_stops[30] = array( |
|
56 | + 'id' => 'description', |
|
57 | + 'content' => $this->_description_stop(), |
|
58 | + 'options' => array( |
|
59 | + 'tipLocation' => 'top', |
|
60 | + 'tipAdjustmentY' => -30, |
|
61 | + 'tipAdjustmentX' => 20 |
|
62 | + ) |
|
63 | + ); |
|
64 | + $this->_stops[40] = array( |
|
65 | + 'id' => 'show_group_name', |
|
66 | + 'content' => $this->_show_group_name_stop(), |
|
67 | + 'options' => array( |
|
68 | + 'tipLocation' => 'top', |
|
69 | + 'tipAdjustmentY' => -30, |
|
70 | + 'tipAdjustmentX' => 20 |
|
71 | + ) |
|
72 | + ); |
|
73 | + $this->_stops[50] = array( |
|
74 | + 'id' => 'show_group_desc', |
|
75 | + 'content' => $this->_show_group_description_stop(), |
|
76 | + 'options' => array( |
|
77 | + 'tipLocation' => 'top', |
|
78 | + 'tipAdjustmentY' => -30, |
|
79 | + 'tipAdjustmentX' => 20 |
|
80 | + ) |
|
81 | + ); |
|
82 | + $this->_stops[60] = array( |
|
83 | + 'class' => 'bulkactions', |
|
84 | + 'content' => $this->_bulk_actions_stop(), |
|
85 | + 'options' => array( |
|
86 | + 'tipLocation' => 'left', |
|
87 | + 'tipAdjustmentY' => -50, |
|
88 | + 'tipAdjustmentX' => -80 |
|
89 | + ) |
|
90 | + ); |
|
91 | + $this->_stops[70] = array( |
|
92 | + 'id' => 'add-new-question-group', |
|
93 | + 'content' => $this->_add_new_question_group_stop(), |
|
94 | + 'options' => array( |
|
95 | + 'tipLocation' => 'right', |
|
96 | + 'tipAdjustmentY' => -50, |
|
97 | + 'tipAdjustmentX' => 15 |
|
98 | + ) |
|
99 | + ); |
|
100 | + } |
|
101 | + } |
|
102 | 102 | |
103 | 103 | |
104 | - protected function _start() |
|
105 | - { |
|
106 | - $content = '<h3>' . __('Question Groups', 'event_espresso') . '</h3>'; |
|
107 | - if ($this->_is_caf) { |
|
108 | - $content .= '<p>' . __('This tour of the Question Groups page will go over different areas of the screen to help you understand what they are used for.', |
|
109 | - 'event_espresso') . '</p>'; |
|
110 | - } else { |
|
111 | - $content .= '<p>' . __('Sorry, Event Espresso Decaf does not have this feature. Please purchase a support license to get access to this feature.', |
|
112 | - 'event_espresso') . '</p>'; |
|
113 | - } |
|
104 | + protected function _start() |
|
105 | + { |
|
106 | + $content = '<h3>' . __('Question Groups', 'event_espresso') . '</h3>'; |
|
107 | + if ($this->_is_caf) { |
|
108 | + $content .= '<p>' . __('This tour of the Question Groups page will go over different areas of the screen to help you understand what they are used for.', |
|
109 | + 'event_espresso') . '</p>'; |
|
110 | + } else { |
|
111 | + $content .= '<p>' . __('Sorry, Event Espresso Decaf does not have this feature. Please purchase a support license to get access to this feature.', |
|
112 | + 'event_espresso') . '</p>'; |
|
113 | + } |
|
114 | 114 | |
115 | - return $content; |
|
116 | - } |
|
115 | + return $content; |
|
116 | + } |
|
117 | 117 | |
118 | - protected function _id_stop() |
|
119 | - { |
|
120 | - return '<p>' . __('View the ID of the question group. Can be sorted in ascending or descending order.', |
|
121 | - 'event_espresso') . '</p>'; |
|
122 | - } |
|
118 | + protected function _id_stop() |
|
119 | + { |
|
120 | + return '<p>' . __('View the ID of the question group. Can be sorted in ascending or descending order.', |
|
121 | + 'event_espresso') . '</p>'; |
|
122 | + } |
|
123 | 123 | |
124 | - protected function _name_stop() |
|
125 | - { |
|
126 | - return '<p>' . __('View available questions groups. You can reorder your questions by dragging and dropping them.', |
|
127 | - 'event_espresso') . '</p>'; |
|
128 | - } |
|
124 | + protected function _name_stop() |
|
125 | + { |
|
126 | + return '<p>' . __('View available questions groups. You can reorder your questions by dragging and dropping them.', |
|
127 | + 'event_espresso') . '</p>'; |
|
128 | + } |
|
129 | 129 | |
130 | - protected function _description_stop() |
|
131 | - { |
|
132 | - return '<p>' . __('View the question group description.', 'event_espresso') . '</p>'; |
|
133 | - } |
|
130 | + protected function _description_stop() |
|
131 | + { |
|
132 | + return '<p>' . __('View the question group description.', 'event_espresso') . '</p>'; |
|
133 | + } |
|
134 | 134 | |
135 | - protected function _show_group_name_stop() |
|
136 | - { |
|
137 | - return '<p>' . __('View if the name of the question group should be shown to customers.', |
|
138 | - 'event_espresso') . '</p>'; |
|
139 | - } |
|
135 | + protected function _show_group_name_stop() |
|
136 | + { |
|
137 | + return '<p>' . __('View if the name of the question group should be shown to customers.', |
|
138 | + 'event_espresso') . '</p>'; |
|
139 | + } |
|
140 | 140 | |
141 | - protected function _show_group_description_stop() |
|
142 | - { |
|
143 | - return '<p>' . __('View if the description of the question group should be shown to customers.', |
|
144 | - 'event_espresso') . '</p>'; |
|
145 | - } |
|
141 | + protected function _show_group_description_stop() |
|
142 | + { |
|
143 | + return '<p>' . __('View if the description of the question group should be shown to customers.', |
|
144 | + 'event_espresso') . '</p>'; |
|
145 | + } |
|
146 | 146 | |
147 | - protected function _bulk_actions_stop() |
|
148 | - { |
|
149 | - return '<p>' . __('Perform bulk actions to multiple question groups.', 'event_espresso') . '</p>'; |
|
150 | - } |
|
147 | + protected function _bulk_actions_stop() |
|
148 | + { |
|
149 | + return '<p>' . __('Perform bulk actions to multiple question groups.', 'event_espresso') . '</p>'; |
|
150 | + } |
|
151 | 151 | |
152 | - protected function _search_stop() |
|
153 | - { |
|
154 | - return '<p>' . __('Search through questions. The following sources will be searched: question group name and question group description.', |
|
155 | - 'event_espresso') . '</p>'; |
|
156 | - } |
|
152 | + protected function _search_stop() |
|
153 | + { |
|
154 | + return '<p>' . __('Search through questions. The following sources will be searched: question group name and question group description.', |
|
155 | + 'event_espresso') . '</p>'; |
|
156 | + } |
|
157 | 157 | |
158 | - protected function _add_new_question_group_stop() |
|
159 | - { |
|
160 | - return '<p>' . __('Click here to create a new question group.', 'event_espresso') . '</p>'; |
|
161 | - } |
|
158 | + protected function _add_new_question_group_stop() |
|
159 | + { |
|
160 | + return '<p>' . __('Click here to create a new question group.', 'event_espresso') . '</p>'; |
|
161 | + } |
|
162 | 162 | } |
163 | 163 | \ No newline at end of file |
@@ -103,13 +103,13 @@ discard block |
||
103 | 103 | |
104 | 104 | protected function _start() |
105 | 105 | { |
106 | - $content = '<h3>' . __('Question Groups', 'event_espresso') . '</h3>'; |
|
106 | + $content = '<h3>'.__('Question Groups', 'event_espresso').'</h3>'; |
|
107 | 107 | if ($this->_is_caf) { |
108 | - $content .= '<p>' . __('This tour of the Question Groups page will go over different areas of the screen to help you understand what they are used for.', |
|
109 | - 'event_espresso') . '</p>'; |
|
108 | + $content .= '<p>'.__('This tour of the Question Groups page will go over different areas of the screen to help you understand what they are used for.', |
|
109 | + 'event_espresso').'</p>'; |
|
110 | 110 | } else { |
111 | - $content .= '<p>' . __('Sorry, Event Espresso Decaf does not have this feature. Please purchase a support license to get access to this feature.', |
|
112 | - 'event_espresso') . '</p>'; |
|
111 | + $content .= '<p>'.__('Sorry, Event Espresso Decaf does not have this feature. Please purchase a support license to get access to this feature.', |
|
112 | + 'event_espresso').'</p>'; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | return $content; |
@@ -117,46 +117,46 @@ discard block |
||
117 | 117 | |
118 | 118 | protected function _id_stop() |
119 | 119 | { |
120 | - return '<p>' . __('View the ID of the question group. Can be sorted in ascending or descending order.', |
|
121 | - 'event_espresso') . '</p>'; |
|
120 | + return '<p>'.__('View the ID of the question group. Can be sorted in ascending or descending order.', |
|
121 | + 'event_espresso').'</p>'; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | protected function _name_stop() |
125 | 125 | { |
126 | - return '<p>' . __('View available questions groups. You can reorder your questions by dragging and dropping them.', |
|
127 | - 'event_espresso') . '</p>'; |
|
126 | + return '<p>'.__('View available questions groups. You can reorder your questions by dragging and dropping them.', |
|
127 | + 'event_espresso').'</p>'; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | protected function _description_stop() |
131 | 131 | { |
132 | - return '<p>' . __('View the question group description.', 'event_espresso') . '</p>'; |
|
132 | + return '<p>'.__('View the question group description.', 'event_espresso').'</p>'; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | protected function _show_group_name_stop() |
136 | 136 | { |
137 | - return '<p>' . __('View if the name of the question group should be shown to customers.', |
|
138 | - 'event_espresso') . '</p>'; |
|
137 | + return '<p>'.__('View if the name of the question group should be shown to customers.', |
|
138 | + 'event_espresso').'</p>'; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | protected function _show_group_description_stop() |
142 | 142 | { |
143 | - return '<p>' . __('View if the description of the question group should be shown to customers.', |
|
144 | - 'event_espresso') . '</p>'; |
|
143 | + return '<p>'.__('View if the description of the question group should be shown to customers.', |
|
144 | + 'event_espresso').'</p>'; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | protected function _bulk_actions_stop() |
148 | 148 | { |
149 | - return '<p>' . __('Perform bulk actions to multiple question groups.', 'event_espresso') . '</p>'; |
|
149 | + return '<p>'.__('Perform bulk actions to multiple question groups.', 'event_espresso').'</p>'; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | protected function _search_stop() |
153 | 153 | { |
154 | - return '<p>' . __('Search through questions. The following sources will be searched: question group name and question group description.', |
|
155 | - 'event_espresso') . '</p>'; |
|
154 | + return '<p>'.__('Search through questions. The following sources will be searched: question group name and question group description.', |
|
155 | + 'event_espresso').'</p>'; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | protected function _add_new_question_group_stop() |
159 | 159 | { |
160 | - return '<p>' . __('Click here to create a new question group.', 'event_espresso') . '</p>'; |
|
160 | + return '<p>'.__('Click here to create a new question group.', 'event_espresso').'</p>'; |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | \ No newline at end of file |