@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @access private |
137 | 137 | * @param string $period |
138 | - * @return int |
|
138 | + * @return string |
|
139 | 139 | */ |
140 | 140 | private function _revenue_per_day_report( $period = '-1 month' ) { |
141 | 141 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @access private |
195 | 195 | * @param string $period |
196 | - * @return int |
|
196 | + * @return string |
|
197 | 197 | */ |
198 | 198 | private function _revenue_per_event_report( $period = '-1 month' ) { |
199 | 199 |
@@ -105,10 +105,10 @@ |
||
105 | 105 | /** |
106 | 106 | * _transaction_reports |
107 | 107 | * generates Business Reports regarding Transactions |
108 | - * |
|
108 | + * |
|
109 | 109 | * @access protected |
110 | - * @return void |
|
111 | - */ |
|
110 | + * @return void |
|
111 | + */ |
|
112 | 112 | protected function _transaction_reports() { |
113 | 113 | |
114 | 114 | $page_args = array(); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | * @param bool $routing |
36 | 36 | * @return \Extend_Transactions_Admin_Page |
37 | 37 | */ |
38 | - public function __construct( $routing = TRUE ) { |
|
39 | - parent::__construct( $routing ); |
|
40 | - define( 'TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/templates/'); |
|
41 | - define( 'TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/assets/'); |
|
42 | - define( 'TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'transactions/assets/'); |
|
38 | + public function __construct($routing = TRUE) { |
|
39 | + parent::__construct($routing); |
|
40 | + define('TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'transactions/templates/'); |
|
41 | + define('TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'transactions/assets/'); |
|
42 | + define('TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'transactions/assets/'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @return void |
52 | 52 | */ |
53 | 53 | protected function _extend_page_config() { |
54 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'transactions'; |
|
54 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'transactions'; |
|
55 | 55 | |
56 | 56 | $new_page_routes = array( |
57 | 57 | 'reports' => array( |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | ) |
61 | 61 | ); |
62 | 62 | |
63 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
63 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
64 | 64 | |
65 | 65 | $new_page_config = array( |
66 | 66 | 'reports' => array( |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | 'filename' => 'transactions_reports' |
75 | 75 | ) |
76 | 76 | ), |
77 | - 'help_tour' => array( 'Transaction_Reports_Help_Tour' ), |
|
77 | + 'help_tour' => array('Transaction_Reports_Help_Tour'), |
|
78 | 78 | 'require_nonce' => FALSE |
79 | 79 | ) |
80 | 80 | ); |
81 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
81 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | wp_enqueue_style('jquery-jqplot-css'); |
95 | 95 | //scripts |
96 | 96 | global $is_IE; |
97 | - if ( $is_IE ) { |
|
98 | - wp_enqueue_script( 'excanvas' ); |
|
97 | + if ($is_IE) { |
|
98 | + wp_enqueue_script('excanvas'); |
|
99 | 99 | } |
100 | 100 | wp_enqueue_script('jqplot-all'); |
101 | 101 | } |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | |
114 | 114 | $page_args = array(); |
115 | 115 | |
116 | - $page_args['admin_reports'][] = $this->_revenue_per_day_report( '-1 month' ); // option: '-1 week', '-2 weeks' defaults to '-1 month' |
|
117 | - $page_args['admin_reports'][] = $this->_revenue_per_event_report( '-1 month' ); // option: '-1 week', '-2 weeks' defaults to '-1 month' |
|
116 | + $page_args['admin_reports'][] = $this->_revenue_per_day_report('-1 month'); // option: '-1 week', '-2 weeks' defaults to '-1 month' |
|
117 | + $page_args['admin_reports'][] = $this->_revenue_per_event_report('-1 month'); // option: '-1 week', '-2 weeks' defaults to '-1 month' |
|
118 | 118 | // $page_args['admin_reports'][] = 'chart1'; |
119 | 119 | |
120 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php'; |
|
120 | + $template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php'; |
|
121 | 121 | $this->_admin_page_title = __('Transactions', 'event_espresso'); |
122 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $page_args, TRUE ); |
|
122 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $page_args, TRUE); |
|
123 | 123 | |
124 | 124 | |
125 | 125 | // the final template wrapper |
@@ -137,37 +137,37 @@ discard block |
||
137 | 137 | * @param string $period |
138 | 138 | * @return int |
139 | 139 | */ |
140 | - private function _revenue_per_day_report( $period = '-1 month' ) { |
|
140 | + private function _revenue_per_day_report($period = '-1 month') { |
|
141 | 141 | |
142 | 142 | $report_ID = 'txn-admin-revenue-per-day-report-dv'; |
143 | 143 | $report_JS = 'espresso_txn_admin_revenue_per_day'; |
144 | 144 | |
145 | - wp_enqueue_script( $report_JS, TXN_CAF_ASSETS_URL . $report_JS . '_report.js', array('jqplot-all'), '1.0', TRUE); |
|
145 | + wp_enqueue_script($report_JS, TXN_CAF_ASSETS_URL.$report_JS.'_report.js', array('jqplot-all'), '1.0', TRUE); |
|
146 | 146 | |
147 | 147 | $TXN = EEM_Transaction::instance(); |
148 | 148 | |
149 | - $results = $TXN->get_revenue_per_day_report( $period ); |
|
149 | + $results = $TXN->get_revenue_per_day_report($period); |
|
150 | 150 | //EEH_Debug_Tools::printr( $results, '$registrations_per_day' ); |
151 | 151 | $revenue = array(); |
152 | - $xmin = date( 'Y-m-d', strtotime( '+1 year' )); |
|
152 | + $xmin = date('Y-m-d', strtotime('+1 year')); |
|
153 | 153 | $xmax = 0; |
154 | 154 | $ymax = 0; |
155 | 155 | |
156 | 156 | $results = (array) $results; |
157 | 157 | |
158 | - foreach ( $results as $result ) { |
|
159 | - $revenue[] = array( $result->txnDate, (float)$result->revenue ); |
|
160 | - $xmin = strtotime( $result->txnDate ) < strtotime( $xmin ) ? $result->txnDate : $xmin; |
|
161 | - $xmax = strtotime( $result->txnDate ) > strtotime( $xmax ) ? $result->txnDate : $xmax; |
|
158 | + foreach ($results as $result) { |
|
159 | + $revenue[] = array($result->txnDate, (float) $result->revenue); |
|
160 | + $xmin = strtotime($result->txnDate) < strtotime($xmin) ? $result->txnDate : $xmin; |
|
161 | + $xmax = strtotime($result->txnDate) > strtotime($xmax) ? $result->txnDate : $xmax; |
|
162 | 162 | $ymax = $result->revenue > $ymax ? $result->revenue : $ymax; |
163 | 163 | } |
164 | 164 | |
165 | - $xmin = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmin)) . ' -1 day' )); |
|
166 | - $xmax = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmax)) . ' +1 day' )); |
|
165 | + $xmin = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmin)).' -1 day')); |
|
166 | + $xmax = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmax)).' +1 day')); |
|
167 | 167 | // calculate # days between our min and max dates |
168 | - $span = floor( (strtotime($xmax) - strtotime($xmin)) / (60*60*24)) + 1; |
|
168 | + $span = floor((strtotime($xmax) - strtotime($xmin)) / (60 * 60 * 24)) + 1; |
|
169 | 169 | |
170 | - $report_title = __( 'Total Revenue per Day' ); |
|
170 | + $report_title = __('Total Revenue per Day'); |
|
171 | 171 | |
172 | 172 | $report_params = array( |
173 | 173 | 'title' => $report_title, |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | 'ymax' => ceil($ymax * 1.25), |
179 | 179 | 'span' => $span, |
180 | 180 | 'width' => ceil(900 / $span), |
181 | - 'noTxnMsg' => sprintf( __('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title ) |
|
181 | + 'noTxnMsg' => sprintf(__('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title) |
|
182 | 182 | ); |
183 | - wp_localize_script( $report_JS, 'txnRevPerDay', $report_params ); |
|
183 | + wp_localize_script($report_JS, 'txnRevPerDay', $report_params); |
|
184 | 184 | |
185 | 185 | return $report_ID; |
186 | 186 | } |
@@ -195,29 +195,29 @@ discard block |
||
195 | 195 | * @param string $period |
196 | 196 | * @return int |
197 | 197 | */ |
198 | - private function _revenue_per_event_report( $period = '-1 month' ) { |
|
198 | + private function _revenue_per_event_report($period = '-1 month') { |
|
199 | 199 | |
200 | 200 | $report_ID = 'txn-admin-revenue-per-event-report-dv'; |
201 | 201 | $report_JS = 'espresso_txn_admin_revenue_per_event'; |
202 | 202 | |
203 | - wp_enqueue_script( $report_JS, TXN_CAF_ASSETS_URL . $report_JS . '_report.js', array('jqplot-all'), '1.0', TRUE); |
|
203 | + wp_enqueue_script($report_JS, TXN_CAF_ASSETS_URL.$report_JS.'_report.js', array('jqplot-all'), '1.0', TRUE); |
|
204 | 204 | |
205 | 205 | $TXN = EEM_Transaction::instance(); |
206 | 206 | |
207 | - $results = $TXN->get_revenue_per_event_report( $period ); |
|
207 | + $results = $TXN->get_revenue_per_event_report($period); |
|
208 | 208 | |
209 | 209 | //EEH_Debug_Tools::printr( $results, '$registrations_per_event' ); |
210 | 210 | $revenue = array(); |
211 | 211 | $results = (array) $results; |
212 | - foreach ( $results as $result ) { |
|
213 | - $event_name = stripslashes( html_entity_decode( $result->event_name, ENT_QUOTES, 'UTF-8' )); |
|
214 | - $event_name = wp_trim_words( $event_name, 5, '...' ); |
|
215 | - $revenue[] = array( $event_name, (float)$result->revenue ); |
|
212 | + foreach ($results as $result) { |
|
213 | + $event_name = stripslashes(html_entity_decode($result->event_name, ENT_QUOTES, 'UTF-8')); |
|
214 | + $event_name = wp_trim_words($event_name, 5, '...'); |
|
215 | + $revenue[] = array($event_name, (float) $result->revenue); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | $span = $period == 'week' ? 9 : 33; |
219 | 219 | |
220 | - $report_title = __( 'Total Revenue per Event' ); |
|
220 | + $report_title = __('Total Revenue per Event'); |
|
221 | 221 | |
222 | 222 | $report_params = array( |
223 | 223 | 'title' => $report_title, |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | 'revenue' => $revenue, |
226 | 226 | 'span' => $span, |
227 | 227 | 'width' => ceil(900 / $span), |
228 | - 'noTxnMsg' => sprintf( __('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title ) |
|
228 | + 'noTxnMsg' => sprintf(__('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title) |
|
229 | 229 | ); |
230 | - wp_localize_script( $report_JS, 'revenuePerEvent', $report_params ); |
|
230 | + wp_localize_script($report_JS, 'revenuePerEvent', $report_params); |
|
231 | 231 | |
232 | 232 | return $report_ID; |
233 | 233 | } |
@@ -1,6 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -944,7 +944,7 @@ |
||
944 | 944 | * @access private |
945 | 945 | * @param int $VNU_ID |
946 | 946 | * @param string $venue_status |
947 | - * @return void |
|
947 | + * @return boolean |
|
948 | 948 | */ |
949 | 949 | private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) { |
950 | 950 | // grab venue id |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -893,8 +894,9 @@ discard block |
||
893 | 894 | } |
894 | 895 | $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
895 | 896 | |
896 | - if ( $redirect_after ) |
|
897 | - $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
|
897 | + if ( $redirect_after ) { |
|
898 | + $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
|
899 | + } |
|
898 | 900 | |
899 | 901 | } |
900 | 902 | |
@@ -1013,8 +1015,9 @@ discard block |
||
1013 | 1015 | $msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso'); |
1014 | 1016 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1015 | 1017 | } |
1016 | - if ( $redirect_after ) |
|
1017 | - $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
|
1018 | + if ( $redirect_after ) { |
|
1019 | + $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
|
1020 | + } |
|
1018 | 1021 | } |
1019 | 1022 | |
1020 | 1023 | |
@@ -1185,8 +1188,10 @@ discard block |
||
1185 | 1188 | * @return void |
1186 | 1189 | */ |
1187 | 1190 | private function _set_category_object() { |
1188 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
1189 | - return; //already have the category object so get out. |
|
1191 | + if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) { |
|
1192 | + return; |
|
1193 | + } |
|
1194 | + //already have the category object so get out. |
|
1190 | 1195 | |
1191 | 1196 | //set default category object |
1192 | 1197 | $this->_set_empty_category_object(); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | |
63 | 63 | |
64 | 64 | protected function _init_page_props() { |
65 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
65 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
66 | 66 | $this->page_slug = EE_VENUES_PG_SLUG; |
67 | 67 | $this->_admin_base_url = EE_VENUES_ADMIN_URL; |
68 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN . 'new/venues'; |
|
68 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN.'new/venues'; |
|
69 | 69 | $this->page_label = __('Event Venues', 'event_espresso'); |
70 | 70 | $this->_cpt_model_names = array( |
71 | 71 | 'create_new' => 'EEM_Venue', |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | 'edit' => __('Update Venue', 'event_espresso'), |
109 | 109 | 'add_category' => __('Save New Category', 'event_espresso'), |
110 | 110 | 'edit_category' => __('Update Category', 'event_espresso'), |
111 | - 'google_map_settings' => __( 'Update Settings', 'event_espresso' ) |
|
111 | + 'google_map_settings' => __('Update Settings', 'event_espresso') |
|
112 | 112 | ) |
113 | 113 | ); |
114 | 114 | } |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | protected function _set_page_routes() { |
121 | 121 | |
122 | 122 | //load formatter helper |
123 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
123 | + EE_Registry::instance()->load_helper('Formatter'); |
|
124 | 124 | //load field generator helper |
125 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
125 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
126 | 126 | |
127 | 127 | //is there a vnu_id in the request? |
128 | - $vnu_id = ! empty( $this->_req_data['VNU_ID'] ) && ! is_array( $this->_req_data['VNU_ID'] ) ? $this->_req_data['VNU_ID'] : 0; |
|
129 | - $vnu_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $vnu_id; |
|
128 | + $vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) ? $this->_req_data['VNU_ID'] : 0; |
|
129 | + $vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id; |
|
130 | 130 | |
131 | 131 | $this->_page_routes = array( |
132 | 132 | 'default' => array( |
@@ -144,27 +144,27 @@ discard block |
||
144 | 144 | ), |
145 | 145 | 'trash_venue' => array( |
146 | 146 | 'func' => '_trash_or_restore_venue', |
147 | - 'args' => array( 'venue_status' => 'trash' ), |
|
147 | + 'args' => array('venue_status' => 'trash'), |
|
148 | 148 | 'noheader' => TRUE, |
149 | 149 | 'capability' => 'ee_delete_venue', |
150 | 150 | 'obj_id' => $vnu_id |
151 | 151 | ), |
152 | 152 | 'trash_venues' => array( |
153 | 153 | 'func' => '_trash_or_restore_venues', |
154 | - 'args' => array( 'venue_status' => 'trash' ), |
|
154 | + 'args' => array('venue_status' => 'trash'), |
|
155 | 155 | 'noheader' => TRUE, |
156 | 156 | 'capability' => 'ee_delete_venues' |
157 | 157 | ), |
158 | 158 | 'restore_venue' => array( |
159 | 159 | 'func' => '_trash_or_restore_venue', |
160 | - 'args' => array( 'venue_status' => 'draft' ), |
|
160 | + 'args' => array('venue_status' => 'draft'), |
|
161 | 161 | 'noheader' => TRUE, |
162 | 162 | 'capability' => 'ee_delete_venue', |
163 | 163 | 'obj_id' => $vnu_id |
164 | 164 | ), |
165 | 165 | 'restore_venues' => array( |
166 | 166 | 'func' => '_trash_or_restore_venues', |
167 | - 'args' => array( 'venue_status' => 'draft' ), |
|
167 | + 'args' => array('venue_status' => 'draft'), |
|
168 | 168 | 'noheader' => TRUE, |
169 | 169 | 'capability' => 'ee_delete_venues' |
170 | 170 | ), |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | 'filename' => 'venues_overview_views_bulk_actions_search' |
267 | 267 | ) |
268 | 268 | ), |
269 | - 'help_tour' => array( 'Venues_Overview_Help_Tour' ), |
|
269 | + 'help_tour' => array('Venues_Overview_Help_Tour'), |
|
270 | 270 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
271 | 271 | 'require_nonce' => FALSE |
272 | 272 | ), |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | 'filename' => 'venues_editor_other' |
303 | 303 | ) |
304 | 304 | ), |
305 | - 'help_tour' => array( 'Venues_Add_Venue_Help_Tour' ), |
|
305 | + 'help_tour' => array('Venues_Add_Venue_Help_Tour'), |
|
306 | 306 | 'metaboxes' => array('_venue_editor_metaboxes'), |
307 | 307 | 'require_nonce' => FALSE |
308 | 308 | ), |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | 'label' => __('Edit Venue', 'event_espresso'), |
312 | 312 | 'order' => 5, |
313 | 313 | 'persistent' => FALSE, |
314 | - 'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
314 | + 'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post']), $this->_current_page_view_url) : $this->_admin_base_url |
|
315 | 315 | ), |
316 | 316 | 'help_tabs' => array( |
317 | 317 | 'venues_editor_help_tab' => array( |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | 'filename' => 'venues_editor_other' |
340 | 340 | ) |
341 | 341 | ), |
342 | - 'help_tour' => array( 'Venues_Edit_Venue_Help_Tour' ), |
|
342 | + 'help_tour' => array('Venues_Edit_Venue_Help_Tour'), |
|
343 | 343 | 'metaboxes' => array('_venue_editor_metaboxes'), |
344 | 344 | 'require_nonce' => FALSE |
345 | 345 | ), |
@@ -348,14 +348,14 @@ discard block |
||
348 | 348 | 'label' => __('Google Maps'), |
349 | 349 | 'order' => 40 |
350 | 350 | ), |
351 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
351 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
352 | 352 | 'help_tabs' => array( |
353 | 353 | 'general_settings_google_maps_help_tab' => array( |
354 | 354 | 'title' => __('Google Maps', 'event_espresso'), |
355 | 355 | 'filename' => 'general_settings_google_maps' |
356 | 356 | ) |
357 | 357 | ), |
358 | - 'help_tour' => array( 'Google_Maps_Help_Tour' ), |
|
358 | + 'help_tour' => array('Google_Maps_Help_Tour'), |
|
359 | 359 | 'require_nonce' => FALSE |
360 | 360 | ), |
361 | 361 | //venue category stuff |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | 'filename' => 'venues_add_category' |
372 | 372 | ) |
373 | 373 | ), |
374 | - 'help_tour' => array( 'Venues_Add_Category_Help_Tour' ), |
|
374 | + 'help_tour' => array('Venues_Add_Category_Help_Tour'), |
|
375 | 375 | 'require_nonce' => FALSE |
376 | 376 | ), |
377 | 377 | 'edit_category' => array( |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | 'label' => __('Edit Category', 'event_espresso'), |
380 | 380 | 'order' => 15, |
381 | 381 | 'persistent' => FALSE, |
382 | - 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
382 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
383 | 383 | ), |
384 | 384 | 'metaboxes' => array('_publish_post_box'), |
385 | 385 | 'help_tabs' => array( |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | 'filename' => 'venues_edit_category' |
389 | 389 | ) |
390 | 390 | ), |
391 | - 'help_tour' => array( 'Venues_Edit_Category_Help_Tour' ), |
|
391 | + 'help_tour' => array('Venues_Edit_Category_Help_Tour'), |
|
392 | 392 | 'require_nonce' => FALSE |
393 | 393 | ), |
394 | 394 | 'category_list' => array( |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | 'filename' => 'venues_categories_other' |
416 | 416 | ) |
417 | 417 | ), |
418 | - 'help_tour' => array( 'Venues_Categories_Help_Tour' ), |
|
418 | + 'help_tour' => array('Venues_Categories_Help_Tour'), |
|
419 | 419 | 'metaboxes' => $this->_default_espresso_metaboxes, |
420 | 420 | 'require_nonce' => FALSE |
421 | 421 | ) |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | |
473 | 473 | |
474 | 474 | public function load_scripts_styles() { |
475 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
475 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
476 | 476 | wp_enqueue_style('ee-cat-admin'); |
477 | 477 | } |
478 | 478 | |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | public function load_scripts_styles_edit() { |
496 | 496 | //styles |
497 | 497 | wp_enqueue_style('espresso-ui-theme'); |
498 | - wp_register_style( 'espresso_venues', EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
498 | + wp_register_style('espresso_venues', EE_VENUES_ASSETS_URL.'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
499 | 499 | wp_enqueue_style('espresso_venues'); |
500 | 500 | } |
501 | 501 | |
@@ -514,13 +514,13 @@ discard block |
||
514 | 514 | ) |
515 | 515 | ); |
516 | 516 | |
517 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venues', 'espresso_venues_trash_venues' ) ) { |
|
517 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) { |
|
518 | 518 | $this->_views['all']['bulk_action'] = array( |
519 | 519 | 'trash_venues' => __('Move to Trash', 'event_espresso') |
520 | 520 | ); |
521 | 521 | $this->_views['trash'] = array( |
522 | 522 | 'slug' => 'trash', |
523 | - 'label' => __( 'Trash', 'event_espresso' ), |
|
523 | + 'label' => __('Trash', 'event_espresso'), |
|
524 | 524 | 'count' => 0, |
525 | 525 | 'bulk_action' => array( |
526 | 526 | 'restore_venues' => __('Restore from Trash', 'event_espresso'), |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | |
554 | 554 | |
555 | 555 | protected function _overview_list_table() { |
556 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
556 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
557 | 557 | $this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
558 | 558 | $this->_search_btn_label = __('Venues', 'event_espresso'); |
559 | 559 | $this->display_admin_list_table_page_with_sidebar(); |
@@ -567,8 +567,8 @@ discard block |
||
567 | 567 | 'vnu_url' => $this->_cpt_model_obj->venue_url(), |
568 | 568 | 'vnu_phone' => $this->_cpt_model_obj->phone() |
569 | 569 | ); |
570 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
571 | - EEH_Template::display_template( $template, $extra_rows ); |
|
570 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php'; |
|
571 | + EEH_Template::display_template($template, $extra_rows); |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | |
@@ -583,115 +583,115 @@ discard block |
||
583 | 583 | $default_map_settings = new stdClass(); |
584 | 584 | $default_map_settings->use_google_maps = TRUE; |
585 | 585 | // for event details pages (reg page) |
586 | - $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
587 | - $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
588 | - $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
589 | - $default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
590 | - $default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
591 | - $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
592 | - $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
586 | + $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
587 | + $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
588 | + $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
589 | + $default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
590 | + $default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
591 | + $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
592 | + $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
593 | 593 | // for event list pages |
594 | - $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
595 | - $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
596 | - $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
597 | - $default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display |
|
598 | - $default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size |
|
599 | - $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
600 | - $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
594 | + $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
595 | + $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
596 | + $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
597 | + $default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display |
|
598 | + $default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size |
|
599 | + $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
600 | + $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
601 | 601 | |
602 | 602 | $this->_template_args['map_settings'] = |
603 | - isset( EE_Registry::instance()->CFG->map_settings ) && ! empty( EE_Registry::instance()->CFG->map_settings ) |
|
604 | - ? (object)array_merge( (array)$default_map_settings, (array)EE_Registry::instance()->CFG->map_settings ) |
|
603 | + isset(EE_Registry::instance()->CFG->map_settings) && ! empty(EE_Registry::instance()->CFG->map_settings) |
|
604 | + ? (object) array_merge((array) $default_map_settings, (array) EE_Registry::instance()->CFG->map_settings) |
|
605 | 605 | : $default_map_settings; |
606 | 606 | |
607 | - $this->_set_add_edit_form_tags( 'update_google_map_settings' ); |
|
608 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
609 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', $this->_template_args, TRUE ); |
|
607 | + $this->_set_add_edit_form_tags('update_google_map_settings'); |
|
608 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
609 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_VENUES_TEMPLATE_PATH.'google_map.template.php', $this->_template_args, TRUE); |
|
610 | 610 | $this->display_admin_page_with_sidebar(); |
611 | 611 | } |
612 | 612 | |
613 | 613 | protected function _update_google_map_settings() { |
614 | 614 | |
615 | 615 | EE_Registry::instance()->CFG->map_settings->use_google_maps = |
616 | - isset( $this->_req_data['use_google_maps'] ) |
|
617 | - ? absint( $this->_req_data['use_google_maps'] ) |
|
616 | + isset($this->_req_data['use_google_maps']) |
|
617 | + ? absint($this->_req_data['use_google_maps']) |
|
618 | 618 | : EE_Registry::instance()->CFG->map_settings->use_google_maps; |
619 | 619 | |
620 | 620 | EE_Registry::instance()->CFG->map_settings->event_details_map_width = |
621 | - isset( $this->_req_data['event_details_map_width'] ) |
|
622 | - ? absint( $this->_req_data['event_details_map_width'] ) |
|
621 | + isset($this->_req_data['event_details_map_width']) |
|
622 | + ? absint($this->_req_data['event_details_map_width']) |
|
623 | 623 | : EE_Registry::instance()->CFG->map_settings->event_details_map_width; |
624 | 624 | |
625 | 625 | EE_Registry::instance()->CFG->map_settings->event_details_map_height = |
626 | - isset( $this->_req_data['event_details_map_height'] ) |
|
627 | - ? absint( $this->_req_data['event_details_map_height'] ) |
|
626 | + isset($this->_req_data['event_details_map_height']) |
|
627 | + ? absint($this->_req_data['event_details_map_height']) |
|
628 | 628 | : EE_Registry::instance()->CFG->map_settings->event_details_map_height; |
629 | 629 | |
630 | 630 | EE_Registry::instance()->CFG->map_settings->event_details_map_zoom = |
631 | - isset( $this->_req_data['event_details_map_zoom'] ) |
|
632 | - ? absint( $this->_req_data['event_details_map_zoom'] ) |
|
631 | + isset($this->_req_data['event_details_map_zoom']) |
|
632 | + ? absint($this->_req_data['event_details_map_zoom']) |
|
633 | 633 | : EE_Registry::instance()->CFG->map_settings->event_details_map_zoom; |
634 | 634 | |
635 | 635 | EE_Registry::instance()->CFG->map_settings->event_details_display_nav = |
636 | - isset( $this->_req_data['event_details_display_nav'] ) |
|
637 | - ? absint( $this->_req_data['event_details_display_nav'] ) |
|
636 | + isset($this->_req_data['event_details_display_nav']) |
|
637 | + ? absint($this->_req_data['event_details_display_nav']) |
|
638 | 638 | : EE_Registry::instance()->CFG->map_settings->event_details_display_nav; |
639 | 639 | |
640 | 640 | EE_Registry::instance()->CFG->map_settings->event_details_nav_size = |
641 | - isset( $this->_req_data['event_details_nav_size'] ) |
|
642 | - ? absint( $this->_req_data['event_details_nav_size'] ) |
|
641 | + isset($this->_req_data['event_details_nav_size']) |
|
642 | + ? absint($this->_req_data['event_details_nav_size']) |
|
643 | 643 | : EE_Registry::instance()->CFG->map_settings->event_details_nav_size; |
644 | 644 | |
645 | 645 | EE_Registry::instance()->CFG->map_settings->event_details_control_type = |
646 | - isset( $this->_req_data['event_details_control_type'] ) |
|
647 | - ? sanitize_text_field( $this->_req_data['event_details_control_type'] ) |
|
646 | + isset($this->_req_data['event_details_control_type']) |
|
647 | + ? sanitize_text_field($this->_req_data['event_details_control_type']) |
|
648 | 648 | : EE_Registry::instance()->CFG->map_settings->event_details_control_type; |
649 | 649 | |
650 | 650 | EE_Registry::instance()->CFG->map_settings->event_details_map_align = |
651 | - isset( $this->_req_data['event_details_map_align'] ) |
|
652 | - ? sanitize_text_field( $this->_req_data['event_details_map_align'] ) |
|
651 | + isset($this->_req_data['event_details_map_align']) |
|
652 | + ? sanitize_text_field($this->_req_data['event_details_map_align']) |
|
653 | 653 | : EE_Registry::instance()->CFG->map_settings->event_details_map_align; |
654 | 654 | |
655 | 655 | EE_Registry::instance()->CFG->map_settings->event_list_map_width = |
656 | - isset( $this->_req_data['event_list_map_width'] ) |
|
657 | - ? absint( $this->_req_data['event_list_map_width'] ) |
|
656 | + isset($this->_req_data['event_list_map_width']) |
|
657 | + ? absint($this->_req_data['event_list_map_width']) |
|
658 | 658 | : EE_Registry::instance()->CFG->map_settings->event_list_map_width; |
659 | 659 | |
660 | 660 | EE_Registry::instance()->CFG->map_settings->event_list_map_height = |
661 | - isset( $this->_req_data['event_list_map_height'] ) |
|
662 | - ? absint( $this->_req_data['event_list_map_height'] ) |
|
661 | + isset($this->_req_data['event_list_map_height']) |
|
662 | + ? absint($this->_req_data['event_list_map_height']) |
|
663 | 663 | : EE_Registry::instance()->CFG->map_settings->event_list_map_height; |
664 | 664 | |
665 | 665 | EE_Registry::instance()->CFG->map_settings->event_list_map_zoom = |
666 | - isset( $this->_req_data['event_list_map_zoom'] ) |
|
667 | - ? absint( $this->_req_data['event_list_map_zoom'] ) |
|
666 | + isset($this->_req_data['event_list_map_zoom']) |
|
667 | + ? absint($this->_req_data['event_list_map_zoom']) |
|
668 | 668 | : EE_Registry::instance()->CFG->map_settings->event_list_map_zoom; |
669 | 669 | |
670 | 670 | EE_Registry::instance()->CFG->map_settings->event_list_display_nav = |
671 | - isset( $this->_req_data['event_list_display_nav'] ) |
|
672 | - ? absint( $this->_req_data['event_list_display_nav'] ) |
|
671 | + isset($this->_req_data['event_list_display_nav']) |
|
672 | + ? absint($this->_req_data['event_list_display_nav']) |
|
673 | 673 | : EE_Registry::instance()->CFG->map_settings->event_list_display_nav; |
674 | 674 | |
675 | 675 | EE_Registry::instance()->CFG->map_settings->event_list_nav_size = |
676 | - isset( $this->_req_data['event_list_nav_size'] ) |
|
677 | - ? absint( $this->_req_data['event_list_nav_size'] ) |
|
676 | + isset($this->_req_data['event_list_nav_size']) |
|
677 | + ? absint($this->_req_data['event_list_nav_size']) |
|
678 | 678 | : EE_Registry::instance()->CFG->map_settings->event_list_nav_size; |
679 | 679 | |
680 | 680 | EE_Registry::instance()->CFG->map_settings->event_list_control_type = |
681 | - isset( $this->_req_data['event_list_control_type'] ) |
|
682 | - ? sanitize_text_field( $this->_req_data['event_list_control_type'] ) |
|
681 | + isset($this->_req_data['event_list_control_type']) |
|
682 | + ? sanitize_text_field($this->_req_data['event_list_control_type']) |
|
683 | 683 | : EE_Registry::instance()->CFG->map_settings->event_list_control_type; |
684 | 684 | |
685 | 685 | EE_Registry::instance()->CFG->map_settings->event_list_map_align = |
686 | - isset( $this->_req_data['event_list_map_align'] ) |
|
687 | - ? sanitize_text_field( $this->_req_data['event_list_map_align'] ) |
|
686 | + isset($this->_req_data['event_list_map_align']) |
|
687 | + ? sanitize_text_field($this->_req_data['event_list_map_align']) |
|
688 | 688 | : EE_Registry::instance()->CFG->map_settings->event_list_map_align; |
689 | 689 | |
690 | - EE_Registry::instance()->CFG->map_settings = apply_filters( 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings ); |
|
690 | + EE_Registry::instance()->CFG->map_settings = apply_filters('FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings); |
|
691 | 691 | |
692 | 692 | $what = 'Google Map Settings'; |
693 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__ ); |
|
694 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'google_map_settings' ) ); |
|
693 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__); |
|
694 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings')); |
|
695 | 695 | |
696 | 696 | } |
697 | 697 | |
@@ -700,9 +700,9 @@ discard block |
||
700 | 700 | protected function _venue_editor_metaboxes() { |
701 | 701 | $this->verify_cpt_object(); |
702 | 702 | |
703 | - add_meta_box( 'espresso_venue_address_options', __('Physical Location', 'event_espresso'), array( $this, 'venue_address_metabox'), $this->page_slug, 'side', 'default' ); |
|
704 | - add_meta_box( 'espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array( $this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default' ); |
|
705 | - add_meta_box( 'espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array( $this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default' ); |
|
703 | + add_meta_box('espresso_venue_address_options', __('Physical Location', 'event_espresso'), array($this, 'venue_address_metabox'), $this->page_slug, 'side', 'default'); |
|
704 | + add_meta_box('espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array($this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default'); |
|
705 | + add_meta_box('espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array($this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default'); |
|
706 | 706 | |
707 | 707 | } |
708 | 708 | |
@@ -710,23 +710,23 @@ discard block |
||
710 | 710 | |
711 | 711 | public function venue_gmap_metabox() { |
712 | 712 | $template_args = array( |
713 | - 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap() ), |
|
713 | + 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap()), |
|
714 | 714 | 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
715 | 715 | ); |
716 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
717 | - EEH_Template::display_template( $template, $template_args ); |
|
716 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php'; |
|
717 | + EEH_Template::display_template($template, $template_args); |
|
718 | 718 | } |
719 | 719 | |
720 | 720 | |
721 | 721 | |
722 | 722 | public function venue_address_metabox() { |
723 | 723 | |
724 | - $template_args['_venue'] =$this->_cpt_model_obj; |
|
724 | + $template_args['_venue'] = $this->_cpt_model_obj; |
|
725 | 725 | |
726 | 726 | $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input( |
727 | 727 | $QFI = new EE_Question_Form_Input( |
728 | - EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )), |
|
729 | - EE_Answer::new_instance( array( 'ANS_value'=> $this->_cpt_model_obj->state_ID() )), |
|
728 | + EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')), |
|
729 | + EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->state_ID())), |
|
730 | 730 | array( |
731 | 731 | 'input_name' => 'sta_id', |
732 | 732 | 'input_id' => 'sta_id', |
@@ -738,8 +738,8 @@ discard block |
||
738 | 738 | ); |
739 | 739 | $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input( |
740 | 740 | $QFI = new EE_Question_Form_Input( |
741 | - EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )), |
|
742 | - EE_Answer::new_instance( array( 'ANS_value'=> $this->_cpt_model_obj->country_ID() )), |
|
741 | + EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')), |
|
742 | + EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->country_ID())), |
|
743 | 743 | array( |
744 | 744 | 'input_name' => 'cnt_iso', |
745 | 745 | 'input_id' => 'cnt_iso', |
@@ -750,8 +750,8 @@ discard block |
||
750 | 750 | ) |
751 | 751 | ); |
752 | 752 | |
753 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
754 | - EEH_Template::display_template( $template, $template_args ); |
|
753 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php'; |
|
754 | + EEH_Template::display_template($template, $template_args); |
|
755 | 755 | } |
756 | 756 | |
757 | 757 | |
@@ -763,8 +763,8 @@ discard block |
||
763 | 763 | $template_args = array( |
764 | 764 | '_venue' => $this->_cpt_model_obj |
765 | 765 | ); |
766 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
767 | - EEH_Template::display_template( $template, $template_args ); |
|
766 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php'; |
|
767 | + EEH_Template::display_template($template, $template_args); |
|
768 | 768 | } |
769 | 769 | |
770 | 770 | |
@@ -787,47 +787,47 @@ discard block |
||
787 | 787 | * @param object $post Post object (with "blessed" WP properties) |
788 | 788 | * @return void |
789 | 789 | */ |
790 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
791 | - $wheres = array( $this->_venue_model->primary_key_name() => $post_id ); |
|
790 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
791 | + $wheres = array($this->_venue_model->primary_key_name() => $post_id); |
|
792 | 792 | |
793 | 793 | $venue_values = array( |
794 | - 'VNU_address' => !empty( $this->_req_data['vnu_address'] ) ? $this->_req_data['vnu_address'] : NULL, |
|
795 | - 'VNU_address2' => !empty( $this->_req_data['vnu_address2'] ) ? $this->_req_data['vnu_address2'] : NULL, |
|
796 | - 'VNU_city' => !empty( $this->_req_data['vnu_city'] ) ? $this->_req_data['vnu_city'] : NULL, |
|
797 | - 'STA_ID' => !empty( $this->_req_data['sta_id'] ) ? $this->_req_data['sta_id'] : NULL, |
|
798 | - 'CNT_ISO' => !empty( $this->_req_data['cnt_iso'] ) ? $this->_req_data['cnt_iso'] : NULL, |
|
799 | - 'VNU_zip' => !empty( $this->_req_data['vnu_zip'] ) ? $this->_req_data['vnu_zip'] : NULL, |
|
800 | - 'VNU_phone' => !empty( $this->_req_data['vnu_phone'] ) ? $this->_req_data['vnu_phone'] : NULL, |
|
801 | - 'VNU_capacity' => !empty( $this->_req_data['vnu_capacity'] ) ? str_replace( ',', '', $this->_req_data['vnu_capacity'] ) : INF, |
|
802 | - 'VNU_url' => !empty( $this->_req_data['vnu_url'] ) ? $this->_req_data['vnu_url'] : NULL, |
|
803 | - 'VNU_virtual_phone' => !empty( $this->_req_data['vnu_virtual_phone'] ) ? $this->_req_data['vnu_virtual_phone'] : NULL, |
|
804 | - 'VNU_virtual_url' => !empty( $this->_req_data['vnu_virtual_url'] ) ? $this->_req_data['vnu_virtual_url'] : NULL, |
|
805 | - 'VNU_enable_for_gmap' => !empty( $this->_req_data['vnu_enable_for_gmap'] ) ? TRUE : FALSE, |
|
806 | - 'VNU_google_map_link' => !empty( $this->_req_data['vnu_google_map_link'] ) ? $this->_req_data['vnu_google_map_link'] : NULL |
|
794 | + 'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : NULL, |
|
795 | + 'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] : NULL, |
|
796 | + 'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : NULL, |
|
797 | + 'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : NULL, |
|
798 | + 'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : NULL, |
|
799 | + 'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : NULL, |
|
800 | + 'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : NULL, |
|
801 | + 'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace(',', '', $this->_req_data['vnu_capacity']) : INF, |
|
802 | + 'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : NULL, |
|
803 | + 'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) ? $this->_req_data['vnu_virtual_phone'] : NULL, |
|
804 | + 'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] : NULL, |
|
805 | + 'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? TRUE : FALSE, |
|
806 | + 'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) ? $this->_req_data['vnu_google_map_link'] : NULL |
|
807 | 807 | ); |
808 | 808 | |
809 | 809 | //update venue |
810 | - $success = $this->_venue_model->update( $venue_values, array( $wheres ) ); |
|
810 | + $success = $this->_venue_model->update($venue_values, array($wheres)); |
|
811 | 811 | |
812 | 812 | //get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
813 | - $get_one_where = array( $this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
814 | - $venue = $this->_venue_model->get_one( array( $get_one_where ) ); |
|
813 | + $get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
814 | + $venue = $this->_venue_model->get_one(array($get_one_where)); |
|
815 | 815 | |
816 | 816 | //notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use. So this is just here for addons to more easily hook into venue saves. |
817 | - $venue_update_callbacks = apply_filters( 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array() ); |
|
817 | + $venue_update_callbacks = apply_filters('FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array()); |
|
818 | 818 | |
819 | 819 | $att_success = TRUE; |
820 | 820 | |
821 | - foreach ( $venue_update_callbacks as $v_callback ) { |
|
822 | - $_succ = call_user_func_array( $v_callback, array( $venue, $this->_req_data ) ); |
|
823 | - $att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
821 | + foreach ($venue_update_callbacks as $v_callback) { |
|
822 | + $_succ = call_user_func_array($v_callback, array($venue, $this->_req_data)); |
|
823 | + $att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | //any errors? |
827 | - if ( $success && !$att_success ) { |
|
828 | - EE_Error::add_error( __('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
829 | - } else if ( $success === FALSE ) { |
|
830 | - EE_Error::add_error( __('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
827 | + if ($success && ! $att_success) { |
|
828 | + EE_Error::add_error(__('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
829 | + } else if ($success === FALSE) { |
|
830 | + EE_Error::add_error(__('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
831 | 831 | } |
832 | 832 | } |
833 | 833 | |
@@ -835,9 +835,9 @@ discard block |
||
835 | 835 | |
836 | 836 | |
837 | 837 | |
838 | - public function trash_cpt_item( $post_id ) { |
|
838 | + public function trash_cpt_item($post_id) { |
|
839 | 839 | $this->_req_data['VNU_ID'] = $post_id; |
840 | - $this->_trash_or_restore_venue( 'trash', FALSE ); |
|
840 | + $this->_trash_or_restore_venue('trash', FALSE); |
|
841 | 841 | } |
842 | 842 | |
843 | 843 | |
@@ -845,18 +845,18 @@ discard block |
||
845 | 845 | |
846 | 846 | |
847 | 847 | |
848 | - public function restore_cpt_item( $post_id ) { |
|
848 | + public function restore_cpt_item($post_id) { |
|
849 | 849 | $this->_req_data['VNU_ID'] = $post_id; |
850 | - $this->_trash_or_restore_venue( 'draft', FALSE ); |
|
850 | + $this->_trash_or_restore_venue('draft', FALSE); |
|
851 | 851 | } |
852 | 852 | |
853 | 853 | |
854 | 854 | |
855 | 855 | |
856 | 856 | |
857 | - public function delete_cpt_item( $post_id ) { |
|
857 | + public function delete_cpt_item($post_id) { |
|
858 | 858 | $this->_req_data['VNU_ID'] = $post_id; |
859 | - $this->_delete_venue( FALSE ); |
|
859 | + $this->_delete_venue(FALSE); |
|
860 | 860 | } |
861 | 861 | |
862 | 862 | |
@@ -871,15 +871,15 @@ discard block |
||
871 | 871 | |
872 | 872 | |
873 | 873 | |
874 | - protected function _trash_or_restore_venue( $venue_status = 'trash', $redirect_after = TRUE ) { |
|
875 | - $VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE; |
|
874 | + protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = TRUE) { |
|
875 | + $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : FALSE; |
|
876 | 876 | |
877 | 877 | //loop thru venues |
878 | - if ( $VNU_ID ) { |
|
878 | + if ($VNU_ID) { |
|
879 | 879 | //clean status |
880 | - $venue_status = sanitize_key( $venue_status ); |
|
880 | + $venue_status = sanitize_key($venue_status); |
|
881 | 881 | // grab status |
882 | - if (!empty($venue_status)) { |
|
882 | + if ( ! empty($venue_status)) { |
|
883 | 883 | $success = $this->_change_venue_status($VNU_ID, $venue_status); |
884 | 884 | } else { |
885 | 885 | $success = FALSE; |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | } |
894 | 894 | $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
895 | 895 | |
896 | - if ( $redirect_after ) |
|
896 | + if ($redirect_after) |
|
897 | 897 | $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
898 | 898 | |
899 | 899 | } |
@@ -902,11 +902,11 @@ discard block |
||
902 | 902 | |
903 | 903 | |
904 | 904 | |
905 | - protected function _trash_or_restore_venues( $venue_status = 'trash' ) { |
|
905 | + protected function _trash_or_restore_venues($venue_status = 'trash') { |
|
906 | 906 | // clean status |
907 | 907 | $venue_status = sanitize_key($venue_status); |
908 | 908 | // grab status |
909 | - if (!empty($venue_status)) { |
|
909 | + if ( ! empty($venue_status)) { |
|
910 | 910 | $success = TRUE; |
911 | 911 | //determine the event id and set to array. |
912 | 912 | $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
@@ -946,20 +946,20 @@ discard block |
||
946 | 946 | * @param string $venue_status |
947 | 947 | * @return void |
948 | 948 | */ |
949 | - private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) { |
|
949 | + private function _change_venue_status($VNU_ID = 0, $venue_status = '') { |
|
950 | 950 | // grab venue id |
951 | - if (! $VNU_ID) { |
|
951 | + if ( ! $VNU_ID) { |
|
952 | 952 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
953 | 953 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
954 | 954 | return FALSE; |
955 | 955 | } |
956 | 956 | |
957 | - $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID( $VNU_ID ); |
|
957 | + $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
958 | 958 | |
959 | 959 | // clean status |
960 | 960 | $venue_status = sanitize_key($venue_status); |
961 | 961 | // grab status |
962 | - if ( ! $venue_status ) { |
|
962 | + if ( ! $venue_status) { |
|
963 | 963 | $msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso'); |
964 | 964 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
965 | 965 | return FALSE; |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | $hook = FALSE; |
981 | 981 | } |
982 | 982 | //use class to change status |
983 | - $this->_cpt_model_obj->set_status( $venue_status ); |
|
983 | + $this->_cpt_model_obj->set_status($venue_status); |
|
984 | 984 | $success = $this->_cpt_model_obj->save(); |
985 | 985 | |
986 | 986 | if ($success === FALSE) { |
@@ -999,21 +999,21 @@ discard block |
||
999 | 999 | * @param bool $redirect_after |
1000 | 1000 | * @return void |
1001 | 1001 | */ |
1002 | - protected function _delete_venue( $redirect_after = true ) { |
|
1002 | + protected function _delete_venue($redirect_after = true) { |
|
1003 | 1003 | //determine the venue id and set to array. |
1004 | 1004 | $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : NULL; |
1005 | - $VNU_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $VNU_ID; |
|
1005 | + $VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID; |
|
1006 | 1006 | |
1007 | 1007 | |
1008 | 1008 | // loop thru venues |
1009 | 1009 | if ($VNU_ID) { |
1010 | - $success = $this->_delete_or_trash_venue( $VNU_ID ); |
|
1010 | + $success = $this->_delete_or_trash_venue($VNU_ID); |
|
1011 | 1011 | } else { |
1012 | 1012 | $success = FALSE; |
1013 | 1013 | $msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso'); |
1014 | 1014 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1015 | 1015 | } |
1016 | - if ( $redirect_after ) |
|
1016 | + if ($redirect_after) |
|
1017 | 1017 | $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
1018 | 1018 | } |
1019 | 1019 | |
@@ -1045,7 +1045,7 @@ discard block |
||
1045 | 1045 | //todo: put in parent |
1046 | 1046 | private function _delete_or_trash_venue($VNU_ID = FALSE) { |
1047 | 1047 | // grab event id |
1048 | - if (!$VNU_ID = absint($VNU_ID)) { |
|
1048 | + if ( ! $VNU_ID = absint($VNU_ID)) { |
|
1049 | 1049 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
1050 | 1050 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1051 | 1051 | return FALSE; |
@@ -1065,7 +1065,7 @@ discard block |
||
1065 | 1065 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1066 | 1066 | return FALSE; |
1067 | 1067 | } |
1068 | - do_action( 'AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted' ); |
|
1068 | + do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted'); |
|
1069 | 1069 | return TRUE; |
1070 | 1070 | } |
1071 | 1071 | |
@@ -1076,11 +1076,11 @@ discard block |
||
1076 | 1076 | /* QUERIES */ |
1077 | 1077 | |
1078 | 1078 | |
1079 | - public function get_venues( $per_page = 10, $count = FALSE ) { |
|
1079 | + public function get_venues($per_page = 10, $count = FALSE) { |
|
1080 | 1080 | |
1081 | - $_orderby = !empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : ''; |
|
1081 | + $_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
|
1082 | 1082 | |
1083 | - switch ( $_orderby ) { |
|
1083 | + switch ($_orderby) { |
|
1084 | 1084 | case 'id': |
1085 | 1085 | $orderby = 'VNU_ID'; |
1086 | 1086 | break; |
@@ -1098,64 +1098,64 @@ discard block |
||
1098 | 1098 | } |
1099 | 1099 | |
1100 | 1100 | |
1101 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
1101 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
1102 | 1102 | |
1103 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1104 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
1105 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1103 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1104 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
1105 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1106 | 1106 | |
1107 | 1107 | |
1108 | - $offset = ($current_page-1)*$per_page; |
|
1108 | + $offset = ($current_page - 1) * $per_page; |
|
1109 | 1109 | $limit = array($offset, $per_page); |
1110 | 1110 | |
1111 | - $category = isset( $this->_req_data['category'] ) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL; |
|
1111 | + $category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL; |
|
1112 | 1112 | |
1113 | 1113 | $where = array( |
1114 | - 'status' => isset( $this->_req_data['status'] ) && $this->_req_data['status'] != 'all' ? $this->_req_data['status'] : array('IN', array('publish', 'draft') ) |
|
1114 | + 'status' => isset($this->_req_data['status']) && $this->_req_data['status'] != 'all' ? $this->_req_data['status'] : array('IN', array('publish', 'draft')) |
|
1115 | 1115 | //todo add filter by category |
1116 | 1116 | ); |
1117 | 1117 | |
1118 | - if ( $category ) { |
|
1118 | + if ($category) { |
|
1119 | 1119 | $where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories'; |
1120 | 1120 | $where['Term_Taxonomy.term_id'] = $category; |
1121 | 1121 | } |
1122 | 1122 | |
1123 | 1123 | //cap checks |
1124 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_private_venues', 'get_venue' ) ) { |
|
1125 | - if ( ! empty( $where['status'][0] ) && $where['status'][0] == 'IN' ) { |
|
1124 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_private_venues', 'get_venue')) { |
|
1125 | + if ( ! empty($where['status'][0]) && $where['status'][0] == 'IN') { |
|
1126 | 1126 | $where['status'][1][] = 'private'; |
1127 | 1127 | } |
1128 | 1128 | } |
1129 | 1129 | |
1130 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) { |
|
1131 | - $where['VNU_wp_user'] = get_current_user_id(); |
|
1130 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1131 | + $where['VNU_wp_user'] = get_current_user_id(); |
|
1132 | 1132 | } |
1133 | 1133 | |
1134 | 1134 | |
1135 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1136 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1135 | + if (isset($this->_req_data['s'])) { |
|
1136 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1137 | 1137 | $where['OR'] = array( |
1138 | - 'VNU_name' => array('LIKE',$sstr ), |
|
1139 | - 'VNU_desc' => array('LIKE',$sstr ), |
|
1140 | - 'VNU_short_desc' => array( 'LIKE',$sstr ), |
|
1141 | - 'VNU_address' => array( 'LIKE', $sstr ), |
|
1142 | - 'VNU_address2' => array( 'LIKE', $sstr ), |
|
1143 | - 'VNU_city' => array( 'LIKE', $sstr ), |
|
1144 | - 'VNU_zip' => array( 'LIKE', $sstr ), |
|
1145 | - 'VNU_phone' => array( 'LIKE', $sstr ), |
|
1146 | - 'VNU_url' => array( 'LIKE', $sstr ), |
|
1147 | - 'VNU_virtual_phone' => array( 'LIKE', $sstr ), |
|
1148 | - 'VNU_virtual_url' => array( 'LIKE', $sstr ), |
|
1149 | - 'VNU_google_map_link' => array( 'LIKE', $sstr ), |
|
1150 | - 'Event.EVT_name' => array('LIKE', $sstr ), |
|
1151 | - 'Event.EVT_desc' => array('LIKE', $sstr ), |
|
1152 | - 'Event.EVT_phone' => array('LIKE', $sstr ), |
|
1153 | - 'Event.EVT_external_URL' => array('LIKE', $sstr ), |
|
1138 | + 'VNU_name' => array('LIKE', $sstr), |
|
1139 | + 'VNU_desc' => array('LIKE', $sstr), |
|
1140 | + 'VNU_short_desc' => array('LIKE', $sstr), |
|
1141 | + 'VNU_address' => array('LIKE', $sstr), |
|
1142 | + 'VNU_address2' => array('LIKE', $sstr), |
|
1143 | + 'VNU_city' => array('LIKE', $sstr), |
|
1144 | + 'VNU_zip' => array('LIKE', $sstr), |
|
1145 | + 'VNU_phone' => array('LIKE', $sstr), |
|
1146 | + 'VNU_url' => array('LIKE', $sstr), |
|
1147 | + 'VNU_virtual_phone' => array('LIKE', $sstr), |
|
1148 | + 'VNU_virtual_url' => array('LIKE', $sstr), |
|
1149 | + 'VNU_google_map_link' => array('LIKE', $sstr), |
|
1150 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1151 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1152 | + 'Event.EVT_phone' => array('LIKE', $sstr), |
|
1153 | + 'Event.EVT_external_URL' => array('LIKE', $sstr), |
|
1154 | 1154 | ); |
1155 | 1155 | } |
1156 | 1156 | |
1157 | 1157 | |
1158 | - $venues = $count ? $this->_venue_model->count( array($where), 'VNU_ID' ) : $this->_venue_model->get_all( array( $where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort ) ); |
|
1158 | + $venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort)); |
|
1159 | 1159 | |
1160 | 1160 | return $venues; |
1161 | 1161 | |
@@ -1173,22 +1173,22 @@ discard block |
||
1173 | 1173 | * @return void |
1174 | 1174 | */ |
1175 | 1175 | private function _set_category_object() { |
1176 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
1176 | + if (isset($this->_category->id) && ! empty($this->_category->id)) |
|
1177 | 1177 | return; //already have the category object so get out. |
1178 | 1178 | |
1179 | 1179 | //set default category object |
1180 | 1180 | $this->_set_empty_category_object(); |
1181 | 1181 | |
1182 | 1182 | //only set if we've got an id |
1183 | - if ( !isset($this->_req_data['VEN_CAT_ID'] ) ) { |
|
1183 | + if ( ! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1184 | 1184 | return; |
1185 | 1185 | } |
1186 | 1186 | |
1187 | 1187 | $category_id = absint($this->_req_data['VEN_CAT_ID']); |
1188 | - $term = get_term( $category_id, 'espresso_venue_categories' ); |
|
1188 | + $term = get_term($category_id, 'espresso_venue_categories'); |
|
1189 | 1189 | |
1190 | 1190 | |
1191 | - if ( !empty( $term ) ) { |
|
1191 | + if ( ! empty($term)) { |
|
1192 | 1192 | $this->_category->category_name = $term->name; |
1193 | 1193 | $this->_category->category_identifier = $term->slug; |
1194 | 1194 | $this->_category->category_desc = $term->description; |
@@ -1202,14 +1202,14 @@ discard block |
||
1202 | 1202 | |
1203 | 1203 | private function _set_empty_category_object() { |
1204 | 1204 | $this->_category = new stdClass(); |
1205 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1205 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1206 | 1206 | $this->_category->id = $this->_category->parent = 0; |
1207 | 1207 | } |
1208 | 1208 | |
1209 | 1209 | |
1210 | 1210 | |
1211 | 1211 | protected function _category_list_table() { |
1212 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1212 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1213 | 1213 | $this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2'); |
1214 | 1214 | $this->_search_btn_label = __('Venue Categories', 'event_espresso'); |
1215 | 1215 | $this->display_admin_list_table_page_with_sidebar(); |
@@ -1219,21 +1219,21 @@ discard block |
||
1219 | 1219 | protected function _category_details($view) { |
1220 | 1220 | |
1221 | 1221 | //load formatter helper |
1222 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
1222 | + EE_Registry::instance()->load_helper('Formatter'); |
|
1223 | 1223 | //load field generator helper |
1224 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
1224 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
1225 | 1225 | |
1226 | 1226 | $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
1227 | 1227 | $this->_set_add_edit_form_tags($route); |
1228 | 1228 | |
1229 | 1229 | $this->_set_category_object(); |
1230 | - $id = !empty($this->_category->id) ? $this->_category->id : ''; |
|
1230 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
1231 | 1231 | |
1232 | 1232 | $delete_action = 'delete_category'; |
1233 | 1233 | |
1234 | - $redirect = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'category_list' ), $this->_admin_base_url ); |
|
1234 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
1235 | 1235 | |
1236 | - $this->_set_publish_post_box_vars( 'VEN_CAT_ID', $id, $delete_action, $redirect ); |
|
1236 | + $this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect); |
|
1237 | 1237 | |
1238 | 1238 | //take care of contents |
1239 | 1239 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
@@ -1247,25 +1247,25 @@ discard block |
||
1247 | 1247 | 'type' => 'wp_editor', |
1248 | 1248 | 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
1249 | 1249 | 'class' => 'my_editor_custom', |
1250 | - 'wpeditor_args' => array( 'media_buttons' => FALSE ) |
|
1250 | + 'wpeditor_args' => array('media_buttons' => FALSE) |
|
1251 | 1251 | ); |
1252 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
1252 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
1253 | 1253 | |
1254 | - $all_terms = get_terms( array('espresso_venue_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) ); |
|
1254 | + $all_terms = get_terms(array('espresso_venue_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id))); |
|
1255 | 1255 | |
1256 | 1256 | //setup category select for term parents. |
1257 | 1257 | $category_select_values[] = array( |
1258 | 1258 | 'text' => __('No Parent', 'event_espresso'), |
1259 | 1259 | 'id' => 0 |
1260 | 1260 | ); |
1261 | - foreach ( $all_terms as $term ) { |
|
1261 | + foreach ($all_terms as $term) { |
|
1262 | 1262 | $category_select_values[] = array( |
1263 | 1263 | 'text' => $term->name, |
1264 | 1264 | 'id' => $term->term_id |
1265 | 1265 | ); |
1266 | 1266 | } |
1267 | 1267 | |
1268 | - $category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent ); |
|
1268 | + $category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent); |
|
1269 | 1269 | $template_args = array( |
1270 | 1270 | 'category' => $this->_category, |
1271 | 1271 | 'category_select' => $category_select, |
@@ -1274,15 +1274,15 @@ discard block |
||
1274 | 1274 | 'disable' => '', |
1275 | 1275 | 'disabled_message' =>FALSE |
1276 | 1276 | ); |
1277 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1278 | - return EEH_Template::display_template($template, $template_args, TRUE ); |
|
1277 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
1278 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1279 | 1279 | } |
1280 | 1280 | |
1281 | 1281 | |
1282 | 1282 | protected function _delete_categories() { |
1283 | - $cat_ids = isset( $this->_req_data['VEN_CAT_ID'] ) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
1283 | + $cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
1284 | 1284 | |
1285 | - foreach ( $cat_ids as $cat_id ) { |
|
1285 | + foreach ($cat_ids as $cat_id) { |
|
1286 | 1286 | $this->_delete_category($cat_id); |
1287 | 1287 | } |
1288 | 1288 | |
@@ -1290,7 +1290,7 @@ discard block |
||
1290 | 1290 | $query_args = array( |
1291 | 1291 | 'action' => 'category_list' |
1292 | 1292 | ); |
1293 | - $this->_redirect_after_action(0,'','',$query_args); |
|
1293 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
1294 | 1294 | |
1295 | 1295 | } |
1296 | 1296 | |
@@ -1299,58 +1299,58 @@ discard block |
||
1299 | 1299 | |
1300 | 1300 | |
1301 | 1301 | protected function _delete_category($cat_id) { |
1302 | - $cat_id = absint( $cat_id ); |
|
1303 | - wp_delete_term( $cat_id, 'espresso_venue_categories' ); |
|
1302 | + $cat_id = absint($cat_id); |
|
1303 | + wp_delete_term($cat_id, 'espresso_venue_categories'); |
|
1304 | 1304 | } |
1305 | 1305 | |
1306 | 1306 | |
1307 | 1307 | |
1308 | 1308 | protected function _insert_or_update_category($new_category) { |
1309 | 1309 | |
1310 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE ); |
|
1310 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE); |
|
1311 | 1311 | $success = 0; //we already have a success message so lets not send another. |
1312 | - if ( $cat_id ) { |
|
1312 | + if ($cat_id) { |
|
1313 | 1313 | $query_args = array( |
1314 | 1314 | 'action' => 'edit_category', |
1315 | 1315 | 'EVT_CAT_ID' => $cat_id |
1316 | 1316 | ); |
1317 | 1317 | } else { |
1318 | - $query_args = array( 'action' => 'add_category' ); |
|
1318 | + $query_args = array('action' => 'add_category'); |
|
1319 | 1319 | } |
1320 | - $this->_redirect_after_action( $success, '','', $query_args, TRUE ); |
|
1320 | + $this->_redirect_after_action($success, '', '', $query_args, TRUE); |
|
1321 | 1321 | |
1322 | 1322 | } |
1323 | 1323 | |
1324 | 1324 | |
1325 | 1325 | |
1326 | - private function _insert_category( $update = FALSE ) { |
|
1326 | + private function _insert_category($update = FALSE) { |
|
1327 | 1327 | $cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : ''; |
1328 | - $category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
1329 | - $category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
1330 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
1328 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
1329 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
1330 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
1331 | 1331 | |
1332 | - if ( empty( $category_name ) ) { |
|
1333 | - $msg = __( 'You must add a name for the category.', 'event_espresso' ); |
|
1334 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1332 | + if (empty($category_name)) { |
|
1333 | + $msg = __('You must add a name for the category.', 'event_espresso'); |
|
1334 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1335 | 1335 | return false; |
1336 | 1336 | } |
1337 | 1337 | |
1338 | 1338 | |
1339 | - $term_args=array( |
|
1339 | + $term_args = array( |
|
1340 | 1340 | 'name'=>$category_name, |
1341 | 1341 | 'description'=>$category_desc, |
1342 | 1342 | 'parent'=>$category_parent |
1343 | 1343 | ); |
1344 | 1344 | |
1345 | - $insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args ); |
|
1345 | + $insert_ids = $update ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) : wp_insert_term($category_name, 'espresso_venue_categories', $term_args); |
|
1346 | 1346 | |
1347 | - if ( !is_array( $insert_ids ) ) { |
|
1348 | - $msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' ); |
|
1349 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1347 | + if ( ! is_array($insert_ids)) { |
|
1348 | + $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
1349 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1350 | 1350 | } else { |
1351 | 1351 | $cat_id = $insert_ids['term_id']; |
1352 | - $msg = sprintf ( __('The category %s was successfuly created', 'event_espresso'), $category_name ); |
|
1353 | - EE_Error::add_success( $msg ); |
|
1352 | + $msg = sprintf(__('The category %s was successfuly created', 'event_espresso'), $category_name); |
|
1353 | + EE_Error::add_success($msg); |
|
1354 | 1354 | } |
1355 | 1355 | |
1356 | 1356 | return $cat_id; |
@@ -1370,12 +1370,12 @@ discard block |
||
1370 | 1370 | 'category_ids' => $this->_req_data['VEN_CAT_ID'] |
1371 | 1371 | ); |
1372 | 1372 | |
1373 | - $this->_req_data = array_merge( $this->_req_data, $new_request_args ); |
|
1373 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
1374 | 1374 | |
1375 | - EE_Registry::instance()->load_helper( 'File' ); |
|
1376 | - if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) { |
|
1377 | - require_once( EE_CLASSES . 'EE_Export.class.php'); |
|
1378 | - $EE_Export = EE_Export::instance( $this->_req_data ); |
|
1375 | + EE_Registry::instance()->load_helper('File'); |
|
1376 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
1377 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
1378 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
1379 | 1379 | $EE_Export->export(); |
1380 | 1380 | } |
1381 | 1381 | |
@@ -1387,7 +1387,7 @@ discard block |
||
1387 | 1387 | |
1388 | 1388 | protected function _import_categories() { |
1389 | 1389 | |
1390 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1390 | + require_once(EE_CLASSES.'EE_Import.class.php'); |
|
1391 | 1391 | EE_Import::instance()->import(); |
1392 | 1392 | |
1393 | 1393 | } |
@@ -1395,29 +1395,29 @@ discard block |
||
1395 | 1395 | |
1396 | 1396 | |
1397 | 1397 | |
1398 | - public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) { |
|
1398 | + public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) { |
|
1399 | 1399 | |
1400 | 1400 | //testing term stuff |
1401 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1402 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
1403 | - $limit = ($current_page-1)*$per_page; |
|
1404 | - $where = array( 'taxonomy' => 'espresso_venue_categories' ); |
|
1405 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1406 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1401 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1402 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
1403 | + $limit = ($current_page - 1) * $per_page; |
|
1404 | + $where = array('taxonomy' => 'espresso_venue_categories'); |
|
1405 | + if (isset($this->_req_data['s'])) { |
|
1406 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1407 | 1407 | $where['OR'] = array( |
1408 | - 'Term.name' => array( 'LIKE', $sstr), |
|
1409 | - 'description' => array( 'LIKE', $sstr ) |
|
1408 | + 'Term.name' => array('LIKE', $sstr), |
|
1409 | + 'description' => array('LIKE', $sstr) |
|
1410 | 1410 | ); |
1411 | 1411 | } |
1412 | 1412 | |
1413 | 1413 | $query_params = array( |
1414 | 1414 | $where, |
1415 | - 'order_by' => array( $orderby => $order ), |
|
1416 | - 'limit' => $limit . ',' . $per_page, |
|
1415 | + 'order_by' => array($orderby => $order), |
|
1416 | + 'limit' => $limit.','.$per_page, |
|
1417 | 1417 | 'force_join' => array('Term') |
1418 | 1418 | ); |
1419 | 1419 | |
1420 | - $categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
1420 | + $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
1421 | 1421 | |
1422 | 1422 | return $categories; |
1423 | 1423 | } |
@@ -56,7 +56,7 @@ |
||
56 | 56 | /** |
57 | 57 | * callback for the FHEE__EE_Registry__load_helper__helper_paths filter to add the caffeinated paths |
58 | 58 | * @param array $paths original helper paths array |
59 | - * @return array new array of paths |
|
59 | + * @return string[] new array of paths |
|
60 | 60 | */ |
61 | 61 | public function caf_helper_paths( $paths ) { |
62 | 62 | $paths[] = EE_CAF_CORE . 'helpers' . DS; |
@@ -25,30 +25,30 @@ discard block |
||
25 | 25 | * ------------------------------------------------------------------------ |
26 | 26 | */ |
27 | 27 | // defined some new constants related to caffeinated folder |
28 | -define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/' ); |
|
29 | -define('EE_CAF_CORE', EE_CAFF_PATH . 'core' . DS); |
|
30 | -define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries' . DS); |
|
31 | -define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods' . DS ); |
|
28 | +define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/'); |
|
29 | +define('EE_CAF_CORE', EE_CAFF_PATH.'core'.DS); |
|
30 | +define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries'.DS); |
|
31 | +define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods'.DS); |
|
32 | 32 | class EE_Brewing_Regular extends EE_Base { |
33 | 33 | |
34 | 34 | public function __construct() { |
35 | - if ( defined( 'EE_CAFF_PATH' )) { |
|
35 | + if (defined('EE_CAFF_PATH')) { |
|
36 | 36 | // activation |
37 | - add_action( 'AHEE__EEH_Activation__initialize_db_content', array( $this, 'initialize_caf_db_content' )); |
|
37 | + add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content')); |
|
38 | 38 | // load caff init |
39 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'caffeinated_init' )); |
|
39 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init')); |
|
40 | 40 | // make it so the PDF receipt doesn't show our shameless plug |
41 | - add_filter( 'FHEE_Invoice__send_invoice__shameless_plug', '__return_false' ); |
|
41 | + add_filter('FHEE_Invoice__send_invoice__shameless_plug', '__return_false'); |
|
42 | 42 | // add caffeinated modules |
43 | - add_filter( 'FHEE__EE_Config__register_modules__modules_to_register', array( $this, 'caffeinated_modules_to_register' )); |
|
43 | + add_filter('FHEE__EE_Config__register_modules__modules_to_register', array($this, 'caffeinated_modules_to_register')); |
|
44 | 44 | // load caff scripts |
45 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_caffeinated_scripts'), 10 ); |
|
45 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10); |
|
46 | 46 | |
47 | - add_filter( 'FHEE__EE_Registry__load_helper__helper_paths', array( $this, 'caf_helper_paths' ), 10 ); |
|
47 | + add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
|
48 | 48 | |
49 | - add_filter( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array( $this, 'caf_payment_methods' ) ); |
|
49 | + add_filter('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array($this, 'caf_payment_methods')); |
|
50 | 50 | // caffeinated constructed |
51 | - do_action( 'AHEE__EE_Brewing_Regular__construct__complete' ); |
|
51 | + do_action('AHEE__EE_Brewing_Regular__construct__complete'); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | * @param array $paths original helper paths array |
59 | 59 | * @return array new array of paths |
60 | 60 | */ |
61 | - public function caf_helper_paths( $paths ) { |
|
62 | - $paths[] = EE_CAF_CORE . 'helpers' . DS; |
|
61 | + public function caf_helper_paths($paths) { |
|
62 | + $paths[] = EE_CAF_CORE.'helpers'.DS; |
|
63 | 63 | return $paths; |
64 | 64 | } |
65 | 65 | |
@@ -75,22 +75,22 @@ discard block |
||
75 | 75 | * Right now, we ASSUME the only price types in the system are default ones |
76 | 76 | * @global type $wpdb |
77 | 77 | */ |
78 | - function initialize_caf_db_content(){ |
|
78 | + function initialize_caf_db_content() { |
|
79 | 79 | // echo "initialize caf db content!"; |
80 | 80 | global $wpdb; |
81 | 81 | |
82 | 82 | //use same method of getting creator id as the version introducing the change |
83 | - $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id',get_current_user_id()); |
|
83 | + $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
|
84 | 84 | |
85 | 85 | $price_type_table = $wpdb->prefix."esp_price_type"; |
86 | 86 | $price_table = $wpdb->prefix."esp_price"; |
87 | 87 | |
88 | 88 | if ($wpdb->get_var("SHOW TABLES LIKE '$price_type_table'") == $price_type_table) { |
89 | 89 | |
90 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';//include trashed price types |
|
91 | - $tax_price_type_count = $wpdb->get_var( $SQL ); |
|
90 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; //include trashed price types |
|
91 | + $tax_price_type_count = $wpdb->get_var($SQL); |
|
92 | 92 | |
93 | - if ( $tax_price_type_count <= 1) { |
|
93 | + if ($tax_price_type_count <= 1) { |
|
94 | 94 | $result = $wpdb->insert($price_type_table, |
95 | 95 | array( |
96 | 96 | 'PRT_name'=> __("Regional Tax", "event_espresso"), |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | 'PRT_wp_user' => $default_creator_id |
102 | 102 | ), |
103 | 103 | array( |
104 | - '%s',//PRT_name |
|
105 | - '%d',//PBT_id |
|
106 | - '%d',//PRT_is_percent |
|
107 | - '%d',//PRT_order |
|
108 | - '%d',//PRT_deleted |
|
104 | + '%s', //PRT_name |
|
105 | + '%d', //PBT_id |
|
106 | + '%d', //PRT_is_percent |
|
107 | + '%d', //PRT_order |
|
108 | + '%d', //PRT_deleted |
|
109 | 109 | '%d', //PRT_wp_user |
110 | 110 | )); |
111 | 111 | //federal tax |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | 'PRT_wp_user' => $default_creator_id, |
120 | 120 | ), |
121 | 121 | array( |
122 | - '%s',//PRT_name |
|
123 | - '%d',//PBT_id |
|
124 | - '%d',//PRT_is_percent |
|
125 | - '%d',//PRT_order |
|
126 | - '%d',//PRT_deleted |
|
122 | + '%s', //PRT_name |
|
123 | + '%d', //PBT_id |
|
124 | + '%d', //PRT_is_percent |
|
125 | + '%d', //PRT_order |
|
126 | + '%d', //PRT_deleted |
|
127 | 127 | '%d' //PRT_wp_user |
128 | 128 | )); |
129 | - if( $result){ |
|
129 | + if ($result) { |
|
130 | 130 | $wpdb->insert($price_table, |
131 | 131 | array( |
132 | 132 | 'PRT_ID'=>$wpdb->insert_id, |
@@ -141,15 +141,15 @@ discard block |
||
141 | 141 | 'PRC_wp_user' => $default_creator_id |
142 | 142 | ), |
143 | 143 | array( |
144 | - '%d',//PRT_id |
|
145 | - '%f',//PRC_amount |
|
146 | - '%s',//PRC_name |
|
147 | - '%s',//PRC_desc |
|
148 | - '%d',//PRC_is_default |
|
149 | - '%d',//PRC_overrides |
|
150 | - '%d',//PRC_deleted |
|
151 | - '%d',//PRC_order |
|
152 | - '%d',//PRC_parent |
|
144 | + '%d', //PRT_id |
|
145 | + '%f', //PRC_amount |
|
146 | + '%s', //PRC_name |
|
147 | + '%s', //PRC_desc |
|
148 | + '%d', //PRC_is_default |
|
149 | + '%d', //PRC_overrides |
|
150 | + '%d', //PRC_deleted |
|
151 | + '%d', //PRC_order |
|
152 | + '%d', //PRC_parent |
|
153 | 153 | '%d' //PRC_wp_user |
154 | 154 | )); |
155 | 155 | } |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | * @param array $modules_to_register |
170 | 170 | * @return array |
171 | 171 | */ |
172 | - public function caffeinated_modules_to_register( $modules_to_register = array() ){ |
|
173 | - if ( is_readable( EE_CAFF_PATH . 'modules' )) { |
|
174 | - $caffeinated_modules_to_register = glob( EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR ); |
|
175 | - if ( is_array( $caffeinated_modules_to_register ) && ! empty( $caffeinated_modules_to_register )) { |
|
176 | - $modules_to_register = array_merge( $modules_to_register, $caffeinated_modules_to_register ); |
|
172 | + public function caffeinated_modules_to_register($modules_to_register = array()) { |
|
173 | + if (is_readable(EE_CAFF_PATH.'modules')) { |
|
174 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules'.DS.'*', GLOB_ONLYDIR); |
|
175 | + if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
|
176 | + $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | return $modules_to_register; |
@@ -181,19 +181,19 @@ discard block |
||
181 | 181 | |
182 | 182 | |
183 | 183 | |
184 | - public function caffeinated_init(){ |
|
184 | + public function caffeinated_init() { |
|
185 | 185 | // EE_Register_CPTs hooks |
186 | - add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array( $this, 'filter_taxonomies' ), 10 ); |
|
187 | - add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array( $this, 'filter_cpts' ), 10 ); |
|
188 | - add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array( $this, 'nav_metabox_items' ), 10 ); |
|
189 | - EE_Registry::instance()->load_file( EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE ); |
|
186 | + add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array($this, 'filter_taxonomies'), 10); |
|
187 | + add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array($this, 'filter_cpts'), 10); |
|
188 | + add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array($this, 'nav_metabox_items'), 10); |
|
189 | + EE_Registry::instance()->load_file(EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE); |
|
190 | 190 | // caffeinated_init__complete hook |
191 | - do_action( 'AHEE__EE_Brewing_Regular__caffeinated_init__complete' ); |
|
191 | + do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | |
195 | 195 | |
196 | - public function enqueue_caffeinated_scripts(){ |
|
196 | + public function enqueue_caffeinated_scripts() { |
|
197 | 197 | // sound of crickets... |
198 | 198 | } |
199 | 199 | |
@@ -202,23 +202,23 @@ discard block |
||
202 | 202 | * callbacks below here |
203 | 203 | */ |
204 | 204 | |
205 | - public function filter_taxonomies( $taxonomy_array ) { |
|
205 | + public function filter_taxonomies($taxonomy_array) { |
|
206 | 206 | $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = TRUE; |
207 | 207 | return $taxonomy_array; |
208 | 208 | } |
209 | 209 | |
210 | 210 | |
211 | 211 | |
212 | - public function filter_cpts( $cpt_array ) { |
|
212 | + public function filter_cpts($cpt_array) { |
|
213 | 213 | $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = TRUE; |
214 | 214 | return $cpt_array; |
215 | 215 | } |
216 | 216 | |
217 | 217 | |
218 | - public function nav_metabox_items( $menuitems ) { |
|
218 | + public function nav_metabox_items($menuitems) { |
|
219 | 219 | $menuitems[] = array( |
220 | 220 | 'title' => __('Venue List', 'event_espresso'), |
221 | - 'url' => get_post_type_archive_link( 'espresso_venues' ), |
|
221 | + 'url' => get_post_type_archive_link('espresso_venues'), |
|
222 | 222 | 'description' => __('Archive page for all venues.', 'event_espresso') |
223 | 223 | ); |
224 | 224 | return $menuitems; |
@@ -229,9 +229,9 @@ discard block |
||
229 | 229 | * @param array $payment_method_paths |
230 | 230 | * @return array values are folder paths to payment method folders |
231 | 231 | */ |
232 | - public function caf_payment_methods( $payment_method_paths ) { |
|
233 | - $caf_payment_methods_paths = glob( EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR ); |
|
234 | - $payment_method_paths = array_merge( $payment_method_paths, $caf_payment_methods_paths ); |
|
232 | + public function caf_payment_methods($payment_method_paths) { |
|
233 | + $caf_payment_methods_paths = glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR); |
|
234 | + $payment_method_paths = array_merge($payment_method_paths, $caf_payment_methods_paths); |
|
235 | 235 | return $payment_method_paths; |
236 | 236 | } |
237 | 237 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * the purpose of this file is to simply contain any action/filter hook callbacks etc for specific aspects of EE related to caffeinated (regular) use. Before putting any code in here, First be certain that it isn't better to define and use the hook in a specific caffeinated/whatever class or file. |
4 | 6 | */ |
@@ -72,7 +72,7 @@ |
||
72 | 72 | /** |
73 | 73 | * This just allows us to add additional paths to the autoloader (EED_Messages::autoload_messages()) for the messages system. |
74 | 74 | * @param array $dir_ref original array of paths |
75 | - * @return array appended paths |
|
75 | + * @return string[] appended paths |
|
76 | 76 | */ |
77 | 77 | public function messages_autoload_paths( $dir_ref ) { |
78 | 78 | $dir_ref[] = EE_CAF_LIBRARIES . 'shortcodes/'; |
@@ -5,7 +5,9 @@ discard block |
||
5 | 5 | * @subpackage plugin api, messages |
6 | 6 | * @since 4.3.2 |
7 | 7 | */ |
8 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | + exit('No direct script access allowed'); |
|
10 | +} |
|
9 | 11 | |
10 | 12 | /** |
11 | 13 | * Used to initialize all EE messages caffeinated functionality. |
@@ -291,8 +293,9 @@ discard block |
||
291 | 293 | |
292 | 294 | public function additional_attendee_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
293 | 295 | |
294 | - if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) ) |
|
295 | - return $parsed; |
|
296 | + if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) ) { |
|
297 | + return $parsed; |
|
298 | + } |
|
296 | 299 | |
297 | 300 | //let's get the question from the code. |
298 | 301 | $shortcode = str_replace('[ANSWER_*', '', $shortcode); |
@@ -388,14 +391,16 @@ discard block |
||
388 | 391 | |
389 | 392 | public function additional_recipient_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
390 | 393 | |
391 | - if ( array($data) && ! isset( $data['data'] ) ) |
|
392 | - return $parsed; |
|
394 | + if ( array($data) && ! isset( $data['data'] ) ) { |
|
395 | + return $parsed; |
|
396 | + } |
|
393 | 397 | |
394 | 398 | $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL; |
395 | 399 | $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
396 | 400 | |
397 | - if ( ! $recipient instanceof EE_Messages_Addressee ) |
|
398 | - return $parsed; |
|
401 | + if ( ! $recipient instanceof EE_Messages_Addressee ) { |
|
402 | + return $parsed; |
|
403 | + } |
|
399 | 404 | |
400 | 405 | switch ( $shortcode ) { |
401 | 406 | case '[RECIPIENT_QUESTION_LIST]' : |
@@ -464,21 +469,24 @@ discard block |
||
464 | 469 | |
465 | 470 | |
466 | 471 | public function additional_primary_registration_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
467 | - if ( array($data) && ! isset( $data['data'] ) ) |
|
468 | - return $parsed; |
|
472 | + if ( array($data) && ! isset( $data['data'] ) ) { |
|
473 | + return $parsed; |
|
474 | + } |
|
469 | 475 | |
470 | 476 | $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL; |
471 | 477 | $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
472 | 478 | |
473 | - if ( ! $recipient instanceof EE_Messages_Addressee ) |
|
474 | - return $parsed; |
|
479 | + if ( ! $recipient instanceof EE_Messages_Addressee ) { |
|
480 | + return $parsed; |
|
481 | + } |
|
475 | 482 | |
476 | 483 | $send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data; |
477 | 484 | |
478 | 485 | switch ( $shortcode ) { |
479 | 486 | case '[RECIPIENT_QUESTION_LIST]' : |
480 | - if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration ) |
|
481 | - return ''; |
|
487 | + if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration ) { |
|
488 | + return ''; |
|
489 | + } |
|
482 | 490 | $registration = $recipient->primary_reg_obj; |
483 | 491 | $template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
484 | 492 | $valid_shortcodes = array('question'); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @since 4.3.2 |
16 | 16 | * @author Darren Ethier |
17 | 17 | */ |
18 | -class EE_Caf_Messages { |
|
18 | +class EE_Caf_Messages { |
|
19 | 19 | |
20 | 20 | |
21 | 21 | /** |
@@ -34,32 +34,32 @@ discard block |
||
34 | 34 | * @return void |
35 | 35 | */ |
36 | 36 | private function _caf_hooks() { |
37 | - add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array( $this, 'messages_autoload_paths'), 5 ); |
|
38 | - add_filter('FHEE__EE_Email_messenger__get_validator_config', array( $this, 'email_messenger_validator_config'), 5, 2 ); |
|
39 | - add_filter('FHEE__EE_Email_messenger__get_template_fields', array( $this, 'email_messenger_template_fields'), 5, 2 ); |
|
40 | - add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', array( $this, 'new_default_templates'), 5, 7 ); |
|
41 | - add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', array( $this, 'message_types_valid_shortcodes'), 5, 2 ); |
|
37 | + add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array($this, 'messages_autoload_paths'), 5); |
|
38 | + add_filter('FHEE__EE_Email_messenger__get_validator_config', array($this, 'email_messenger_validator_config'), 5, 2); |
|
39 | + add_filter('FHEE__EE_Email_messenger__get_template_fields', array($this, 'email_messenger_template_fields'), 5, 2); |
|
40 | + add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', array($this, 'new_default_templates'), 5, 7); |
|
41 | + add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', array($this, 'message_types_valid_shortcodes'), 5, 2); |
|
42 | 42 | |
43 | 43 | //shortcode parsers |
44 | - add_filter('FHEE__EE_Attendee_Shortcodes__shortcodes', array( $this, 'additional_attendee_shortcodes'), 5, 2 ); |
|
45 | - add_filter('FHEE__EE_Attendee_Shortcodes__parser_after', array( $this, 'additional_attendee_parser'), 5, 5 ); |
|
46 | - add_filter('FHEE__EE_Recipient_List_Shortcodes__shortcodes', array( $this, 'additional_recipient_details_shortcodes'), 5, 2 ); |
|
47 | - add_filter('FHEE__EE_Recipient_List_Shortcodes__parser_after', array( $this, 'additional_recipient_details_parser'), 5, 5 ); |
|
48 | - add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__shortcodes', array( $this, 'additional_primary_registration_details_shortcodes'), 5, 2 ); |
|
49 | - add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__parser_after', array( $this, 'additional_primary_registration_details_parser'), 5, 5 ); |
|
44 | + add_filter('FHEE__EE_Attendee_Shortcodes__shortcodes', array($this, 'additional_attendee_shortcodes'), 5, 2); |
|
45 | + add_filter('FHEE__EE_Attendee_Shortcodes__parser_after', array($this, 'additional_attendee_parser'), 5, 5); |
|
46 | + add_filter('FHEE__EE_Recipient_List_Shortcodes__shortcodes', array($this, 'additional_recipient_details_shortcodes'), 5, 2); |
|
47 | + add_filter('FHEE__EE_Recipient_List_Shortcodes__parser_after', array($this, 'additional_recipient_details_parser'), 5, 5); |
|
48 | + add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__shortcodes', array($this, 'additional_primary_registration_details_shortcodes'), 5, 2); |
|
49 | + add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__parser_after', array($this, 'additional_primary_registration_details_parser'), 5, 5); |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * @since 4.2.0 |
53 | 53 | */ |
54 | - add_filter( 'FHEE__EE_Datetime_Shortcodes__shortcodes', array( $this, 'additional_datetime_shortcodes'), 10, 2 ); |
|
55 | - add_filter( 'FHEE__EE_Datetime_Shortcodes__parser_after', array( $this, 'additional_datetime_parser'), 10, 5 ); |
|
54 | + add_filter('FHEE__EE_Datetime_Shortcodes__shortcodes', array($this, 'additional_datetime_shortcodes'), 10, 2); |
|
55 | + add_filter('FHEE__EE_Datetime_Shortcodes__parser_after', array($this, 'additional_datetime_parser'), 10, 5); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * @since 4.3.0 |
59 | 59 | */ |
60 | 60 | //eat our own dog food! |
61 | - add_action('EE_Brewing_Regular___messages_caf', array( $this, 'register_caf_message_types' ) ); |
|
62 | - add_action('EE_Brewing_Regular___messages_caf', array( $this, 'register_caf_shortcodes' ) ); |
|
61 | + add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_message_types')); |
|
62 | + add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_shortcodes')); |
|
63 | 63 | do_action('EE_Brewing_Regular___messages_caf'); |
64 | 64 | } |
65 | 65 | |
@@ -70,14 +70,14 @@ discard block |
||
70 | 70 | * @param array $dir_ref original array of paths |
71 | 71 | * @return array appended paths |
72 | 72 | */ |
73 | - public function messages_autoload_paths( $dir_ref ) { |
|
74 | - $dir_ref[] = EE_CAF_LIBRARIES . 'shortcodes/'; |
|
73 | + public function messages_autoload_paths($dir_ref) { |
|
74 | + $dir_ref[] = EE_CAF_LIBRARIES.'shortcodes/'; |
|
75 | 75 | return $dir_ref; |
76 | 76 | } |
77 | 77 | |
78 | 78 | |
79 | 79 | |
80 | - public function email_messenger_validator_config( $validator_config, EE_Email_messenger $messenger ) { |
|
80 | + public function email_messenger_validator_config($validator_config, EE_Email_messenger $messenger) { |
|
81 | 81 | $validator_config['attendee_list'] = array( |
82 | 82 | 'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'), |
83 | 83 | 'required' => array('[ATTENDEE_LIST]') |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | |
94 | 94 | |
95 | - public function email_messenger_template_fields( $template_fields, EE_Email_messenger $messenger ) { |
|
95 | + public function email_messenger_template_fields($template_fields, EE_Email_messenger $messenger) { |
|
96 | 96 | $template_fields['extra']['content']['question_list'] = array( |
97 | 97 | 'input' => 'textarea', |
98 | 98 | 'label' => '[QUESTION_LIST]', |
@@ -109,39 +109,39 @@ discard block |
||
109 | 109 | |
110 | 110 | |
111 | 111 | |
112 | - public function new_default_templates( $contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack ) { |
|
112 | + public function new_default_templates($contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack) { |
|
113 | 113 | |
114 | 114 | //we're only modifying templates for the default template pack |
115 | - if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default ) { |
|
115 | + if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default) { |
|
116 | 116 | return $contents; |
117 | 117 | } |
118 | 118 | |
119 | 119 | //the template file name we're replacing contents for. |
120 | - $template_file_prefix = $field . '_' . $context; |
|
121 | - $msg_prefix = $messenger->name . '_' . $message_type->name . '_' ; |
|
120 | + $template_file_prefix = $field.'_'.$context; |
|
121 | + $msg_prefix = $messenger->name.'_'.$message_type->name.'_'; |
|
122 | 122 | |
123 | - $base_path = EE_CAF_LIBRARIES . 'messages/defaults/default/'; |
|
123 | + $base_path = EE_CAF_LIBRARIES.'messages/defaults/default/'; |
|
124 | 124 | |
125 | - if ( $messenger->name == 'email' && $message_type->name == 'registration' ) { |
|
125 | + if ($messenger->name == 'email' && $message_type->name == 'registration') { |
|
126 | 126 | |
127 | - switch ( $template_file_prefix ) { |
|
127 | + switch ($template_file_prefix) { |
|
128 | 128 | |
129 | 129 | case 'question_list_admin' : |
130 | 130 | case 'question_list_attendee' : |
131 | 131 | case 'question_list_primary_attendee' : |
132 | - $path = $base_path . $msg_prefix . 'question_list.template.php'; |
|
133 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
132 | + $path = $base_path.$msg_prefix.'question_list.template.php'; |
|
133 | + $contents = EEH_Template::display_template($path, array(), true); |
|
134 | 134 | break; |
135 | 135 | |
136 | 136 | case 'attendee_list_primary_attendee' : |
137 | - $path = $base_path . $msg_prefix . 'attendee_list.template.php'; |
|
138 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
137 | + $path = $base_path.$msg_prefix.'attendee_list.template.php'; |
|
138 | + $contents = EEH_Template::display_template($path, array(), true); |
|
139 | 139 | break; |
140 | 140 | |
141 | 141 | case 'attendee_list_admin' : |
142 | - $path = $base_path . $msg_prefix . 'attendee_list_admin.template.php'; |
|
143 | - $contents = EEH_Template::display_template( $path, |
|
144 | - array(), true ); |
|
142 | + $path = $base_path.$msg_prefix.'attendee_list_admin.template.php'; |
|
143 | + $contents = EEH_Template::display_template($path, |
|
144 | + array(), true); |
|
145 | 145 | break; |
146 | 146 | |
147 | 147 | case 'attendee_list_attendee' : |
@@ -149,26 +149,26 @@ discard block |
||
149 | 149 | break; |
150 | 150 | |
151 | 151 | case 'event_list_attendee' : |
152 | - $path = $base_path . $msg_prefix . 'event_list_attendee.template.php'; |
|
153 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
152 | + $path = $base_path.$msg_prefix.'event_list_attendee.template.php'; |
|
153 | + $contents = EEH_Template::display_template($path, array(), true); |
|
154 | 154 | break; |
155 | 155 | } |
156 | - } elseif ( $messenger->name == 'email' && $message_type->name == 'newsletter' ) { |
|
157 | - switch( $template_file_prefix ) { |
|
156 | + } elseif ($messenger->name == 'email' && $message_type->name == 'newsletter') { |
|
157 | + switch ($template_file_prefix) { |
|
158 | 158 | |
159 | 159 | case 'content_attendee' : |
160 | - $path = $base_path . $msg_prefix . 'content.template.php'; |
|
161 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
160 | + $path = $base_path.$msg_prefix.'content.template.php'; |
|
161 | + $contents = EEH_Template::display_template($path, array(), true); |
|
162 | 162 | break; |
163 | 163 | |
164 | 164 | case 'newsletter_content_attendee' : |
165 | - $path = $base_path . $msg_prefix . 'newsletter_content.template.php'; |
|
166 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
165 | + $path = $base_path.$msg_prefix.'newsletter_content.template.php'; |
|
166 | + $contents = EEH_Template::display_template($path, array(), true); |
|
167 | 167 | break; |
168 | 168 | |
169 | 169 | case 'newsletter_subject_attendee' : |
170 | - $path = $base_path . $msg_prefix . 'subject.template.php'; |
|
171 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
170 | + $path = $base_path.$msg_prefix.'subject.template.php'; |
|
171 | + $contents = EEH_Template::display_template($path, array(), true); |
|
172 | 172 | break; |
173 | 173 | } |
174 | 174 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | |
181 | 181 | |
182 | - public function message_types_valid_shortcodes( $valid_shortcodes, EE_Messages_Base $msg ) { |
|
182 | + public function message_types_valid_shortcodes($valid_shortcodes, EE_Messages_Base $msg) { |
|
183 | 183 | //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. |
184 | 184 | $include_with = array( |
185 | 185 | 'registration', |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | 'pending_approval', |
195 | 195 | 'registration_summary' |
196 | 196 | ); |
197 | - if ( $msg instanceof EE_message_type && in_array( $msg->name, $include_with )) { |
|
197 | + if ($msg instanceof EE_message_type && in_array($msg->name, $include_with)) { |
|
198 | 198 | $contexts = array_keys($msg->get_contexts()); |
199 | - foreach ( $contexts as $context ) { |
|
199 | + foreach ($contexts as $context) { |
|
200 | 200 | $valid_shortcodes[$context][] = 'question_list'; |
201 | 201 | $valid_shortcodes[$context][] = 'question'; |
202 | 202 | } |
@@ -208,36 +208,36 @@ discard block |
||
208 | 208 | |
209 | 209 | |
210 | 210 | |
211 | - public function additional_attendee_shortcodes( $shortcodes, $shortcode_parser ) { |
|
211 | + public function additional_attendee_shortcodes($shortcodes, $shortcode_parser) { |
|
212 | 212 | $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.', 'event_espresso'); |
213 | 213 | return $shortcodes; |
214 | 214 | } |
215 | 215 | |
216 | 216 | |
217 | 217 | |
218 | - public function additional_attendee_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
|
218 | + public function additional_attendee_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) { |
|
219 | 219 | |
220 | - if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) ) |
|
220 | + if (strpos($shortcode, '[ANSWER_*') === FALSE || ! isset($extra_data['data']->questions) || ! isset($extra_data['data']->registrations)) |
|
221 | 221 | return $parsed; |
222 | 222 | |
223 | 223 | //let's get the question from the code. |
224 | 224 | $shortcode = str_replace('[ANSWER_*', '', $shortcode); |
225 | - $shortcode = trim( str_replace(']', '', $shortcode) ); |
|
225 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
226 | 226 | |
227 | 227 | $registration = $data instanceof EE_Registration ? $data : null; |
228 | - $registration = ! $registration instanceof EE_Registration && is_array( $extra_data ) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Registration ? $extra_data['data'] : $registration; |
|
228 | + $registration = ! $registration instanceof EE_Registration && is_array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Registration ? $extra_data['data'] : $registration; |
|
229 | 229 | |
230 | 230 | $aee = $data instanceof EE_Messages_Addressee ? $data : null; |
231 | - $aee = ! $aee instanceof EE_Messages_Addressee && is_array( $extra_data ) && isset( $extra_data['data'] ) ? $extra_data['data'] : $aee; |
|
231 | + $aee = ! $aee instanceof EE_Messages_Addressee && is_array($extra_data) && isset($extra_data['data']) ? $extra_data['data'] : $aee; |
|
232 | 232 | |
233 | - if ( ! $registration instanceof EE_Registration || ! $aee instanceof EE_Messages_Addressee ) { |
|
233 | + if ( ! $registration instanceof EE_Registration || ! $aee instanceof EE_Messages_Addressee) { |
|
234 | 234 | return $parsed; |
235 | 235 | } |
236 | 236 | |
237 | 237 | //now let's figure out which question has this text. |
238 | - foreach ( $aee->questions as $ansid => $question ) { |
|
239 | - if ( $question instanceof EE_Question && $question->display_text() == $shortcode && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid]) ) { |
|
240 | - return wp_strip_all_tags( $aee->registrations[$registration->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop') ); |
|
238 | + foreach ($aee->questions as $ansid => $question) { |
|
239 | + if ($question instanceof EE_Question && $question->display_text() == $shortcode && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid])) { |
|
240 | + return wp_strip_all_tags($aee->registrations[$registration->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop')); |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * @return array array of shortcodes and |
259 | 259 | * descriptions |
260 | 260 | */ |
261 | - public function additional_datetime_shortcodes( $shortcodes, $shortcode_parser ) { |
|
261 | + public function additional_datetime_shortcodes($shortcodes, $shortcode_parser) { |
|
262 | 262 | $shortcodes['[DTT_NAME]'] = __('This will be parsed to the Title given for a Datetime', 'event_espresso'); |
263 | 263 | $shortcodes['[DTT_DESCRIPTION]'] = __('This will be parsed to the description for a Datetime', 'event_espresso'); |
264 | 264 | $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.', 'event_espresso'); |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | * @param EE_Datetime_Shortcodes $shortcode_parser |
281 | 281 | * @return string The new parsed string. |
282 | 282 | */ |
283 | - public function additional_datetime_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
|
283 | + public function additional_datetime_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) { |
|
284 | 284 | |
285 | - if ( ! $data instanceof EE_Datetime ) { |
|
285 | + if ( ! $data instanceof EE_Datetime) { |
|
286 | 286 | return ''; //get out because we can only parse with the datetime object. |
287 | 287 | } |
288 | 288 | |
289 | - switch ( $shortcode ) { |
|
289 | + switch ($shortcode) { |
|
290 | 290 | case '[DTT_NAME]' : |
291 | 291 | return $data->name(); |
292 | 292 | break; |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | return $data->description(); |
295 | 295 | break; |
296 | 296 | case '[DTT_NAME_OR_DATES]' : |
297 | - return $data->get_dtt_display_name( TRUE ); |
|
297 | + return $data->get_dtt_display_name(TRUE); |
|
298 | 298 | break; |
299 | 299 | default : |
300 | 300 | return $parsed; |
@@ -306,40 +306,40 @@ discard block |
||
306 | 306 | |
307 | 307 | |
308 | 308 | |
309 | - public function additional_recipient_details_shortcodes( $shortcodes, $shortcode_parser ) { |
|
309 | + public function additional_recipient_details_shortcodes($shortcodes, $shortcode_parser) { |
|
310 | 310 | $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.', 'event_espresso'); |
311 | 311 | return $shortcodes; |
312 | 312 | } |
313 | 313 | |
314 | 314 | |
315 | - public function additional_recipient_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
|
315 | + public function additional_recipient_details_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) { |
|
316 | 316 | |
317 | - if ( array($data) && ! isset( $data['data'] ) ) |
|
317 | + if (array($data) && ! isset($data['data'])) |
|
318 | 318 | return $parsed; |
319 | 319 | |
320 | 320 | $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL; |
321 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
321 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
322 | 322 | |
323 | - if ( ! $recipient instanceof EE_Messages_Addressee ) |
|
323 | + if ( ! $recipient instanceof EE_Messages_Addressee) |
|
324 | 324 | return $parsed; |
325 | 325 | |
326 | - switch ( $shortcode ) { |
|
326 | + switch ($shortcode) { |
|
327 | 327 | case '[RECIPIENT_QUESTION_LIST]' : |
328 | 328 | $att = $recipient->att_obj; |
329 | 329 | $registrations_on_attendee = $att instanceof EE_Attendee ? $recipient->attendees[$att->ID()]['reg_objs'] : array(); |
330 | - $registrations_on_attendee = empty( $registrations_on_attendee ) && $recipient->reg_obj instanceof EE_Registration ? array( $recipient->reg_obj ) : $registrations_on_attendee; |
|
330 | + $registrations_on_attendee = empty($registrations_on_attendee) && $recipient->reg_obj instanceof EE_Registration ? array($recipient->reg_obj) : $registrations_on_attendee; |
|
331 | 331 | $answers = array(); |
332 | 332 | |
333 | - $template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
333 | + $template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
334 | 334 | $valid_shortcodes = array('question'); |
335 | 335 | |
336 | 336 | //if the context is main_content then get all answers for all registrations on this attendee |
337 | - if ( $data['data'] instanceof EE_Messages_Addressee ) { |
|
338 | - foreach ( $registrations_on_attendee as $reg ) { |
|
339 | - if ( $reg instanceof EE_Registration ) { |
|
340 | - $anss = !empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array(); |
|
341 | - foreach( $anss as $ans ) { |
|
342 | - if ( $ans instanceof EE_Answer ) { |
|
337 | + if ($data['data'] instanceof EE_Messages_Addressee) { |
|
338 | + foreach ($registrations_on_attendee as $reg) { |
|
339 | + if ($reg instanceof EE_Registration) { |
|
340 | + $anss = ! empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array(); |
|
341 | + foreach ($anss as $ans) { |
|
342 | + if ($ans instanceof EE_Answer) { |
|
343 | 343 | $answers[$ans->ID()] = $ans; |
344 | 344 | } |
345 | 345 | } |
@@ -348,13 +348,13 @@ discard block |
||
348 | 348 | } |
349 | 349 | |
350 | 350 | //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. |
351 | - if ( $data['data'] instanceof EE_Event ) { |
|
351 | + if ($data['data'] instanceof EE_Event) { |
|
352 | 352 | $event = $data['data']; |
353 | - foreach( $registrations_on_attendee as $reg ) { |
|
354 | - if ( $reg instanceof EE_Registration && $reg->event_ID() == $event->ID() ) { |
|
355 | - $anss = !empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array(); |
|
356 | - foreach( $anss as $ans ) { |
|
357 | - if ( $ans instanceof EE_Answer ) { |
|
353 | + foreach ($registrations_on_attendee as $reg) { |
|
354 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
355 | + $anss = ! empty($recipient->registrations[$reg->ID()]['ans_objs']) ? $recipient->registrations[$reg->ID()]['ans_objs'] : array(); |
|
356 | + foreach ($anss as $ans) { |
|
357 | + if ($ans instanceof EE_Answer) { |
|
358 | 358 | $answers[$ans->ID()] = $ans; |
359 | 359 | } |
360 | 360 | } |
@@ -364,13 +364,13 @@ discard block |
||
364 | 364 | |
365 | 365 | $question_list = ''; |
366 | 366 | $shortcode_helper = $shortcode_parser->get_shortcode_helper(); |
367 | - foreach ( $answers as $answer ) { |
|
368 | - if ( $answer instanceof EE_Answer ) { |
|
367 | + foreach ($answers as $answer) { |
|
368 | + if ($answer instanceof EE_Answer) { |
|
369 | 369 | $question = $answer->question(); |
370 | - if ( ! $question instanceof EE_Question || ( $question instanceof EE_Question && $question->admin_only() ) ) { |
|
370 | + if ( ! $question instanceof EE_Question || ($question instanceof EE_Question && $question->admin_only())) { |
|
371 | 371 | continue; |
372 | 372 | } |
373 | - $question_list .= $shortcode_helper->parse_question_list_template( $template, $answer, $valid_shortcodes, $extra_data); |
|
373 | + $question_list .= $shortcode_helper->parse_question_list_template($template, $answer, $valid_shortcodes, $extra_data); |
|
374 | 374 | } |
375 | 375 | } |
376 | 376 | return $question_list; |
@@ -383,41 +383,41 @@ discard block |
||
383 | 383 | } |
384 | 384 | |
385 | 385 | |
386 | - public function additional_primary_registration_details_shortcodes( $shortcodes, $shortcode_parser ) { |
|
386 | + public function additional_primary_registration_details_shortcodes($shortcodes, $shortcode_parser) { |
|
387 | 387 | $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', 'event_espresso'); |
388 | 388 | return $shortcodes; |
389 | 389 | } |
390 | 390 | |
391 | 391 | |
392 | - public function additional_primary_registration_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
|
393 | - if ( array($data) && ! isset( $data['data'] ) ) |
|
392 | + public function additional_primary_registration_details_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) { |
|
393 | + if (array($data) && ! isset($data['data'])) |
|
394 | 394 | return $parsed; |
395 | 395 | |
396 | 396 | $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL; |
397 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
397 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
398 | 398 | |
399 | - if ( ! $recipient instanceof EE_Messages_Addressee ) |
|
399 | + if ( ! $recipient instanceof EE_Messages_Addressee) |
|
400 | 400 | return $parsed; |
401 | 401 | |
402 | 402 | $send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data; |
403 | 403 | |
404 | - switch ( $shortcode ) { |
|
404 | + switch ($shortcode) { |
|
405 | 405 | case '[RECIPIENT_QUESTION_LIST]' : |
406 | - if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration ) |
|
406 | + if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration) |
|
407 | 407 | return ''; |
408 | 408 | $registration = $recipient->primary_reg_obj; |
409 | - $template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
409 | + $template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
410 | 410 | $valid_shortcodes = array('question'); |
411 | 411 | $shortcode_helper = $shortcode_parser->get_shortcode_helper(); |
412 | 412 | $answers = $recipient->registrations[$registration->ID()]['ans_objs']; |
413 | 413 | $question_list = ''; |
414 | - foreach ( $answers as $answer ) { |
|
415 | - if ( $answer instanceof EE_Answer ) { |
|
414 | + foreach ($answers as $answer) { |
|
415 | + if ($answer instanceof EE_Answer) { |
|
416 | 416 | $question = $answer->question(); |
417 | - if ( $question instanceof EE_Question and $question->admin_only() ) { |
|
417 | + if ($question instanceof EE_Question and $question->admin_only()) { |
|
418 | 418 | continue; |
419 | 419 | } |
420 | - $question_list .= $shortcode_helper->parse_question_list_template( $template, $answer, $valid_shortcodes, $send_data); |
|
420 | + $question_list .= $shortcode_helper->parse_question_list_template($template, $answer, $valid_shortcodes, $send_data); |
|
421 | 421 | } |
422 | 422 | } |
423 | 423 | return $question_list; |
@@ -443,67 +443,67 @@ discard block |
||
443 | 443 | $setup_args = array( |
444 | 444 | 'mtfilename' => 'EE_Newsletter_message_type.class.php', |
445 | 445 | 'autoloadpaths' => array( |
446 | - EE_CAF_LIBRARIES . 'messages/message_type/newsletter/' |
|
446 | + EE_CAF_LIBRARIES.'messages/message_type/newsletter/' |
|
447 | 447 | ), |
448 | - 'messengers_to_activate_with' => array( 'email' ), |
|
449 | - 'messengers_to_validate_with' => array( 'email' ) |
|
448 | + 'messengers_to_activate_with' => array('email'), |
|
449 | + 'messengers_to_validate_with' => array('email') |
|
450 | 450 | ); |
451 | - EE_Register_Message_Type::register( 'newsletter', $setup_args ); |
|
451 | + EE_Register_Message_Type::register('newsletter', $setup_args); |
|
452 | 452 | |
453 | 453 | //register payment reminder message type |
454 | 454 | $setup_args = array( |
455 | 455 | 'mtfilename' => 'EE_Payment_Reminder_message_type.class.php', |
456 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_reminder/' ), |
|
457 | - 'messengers_to_activate_with' => array( 'email' ), |
|
458 | - 'messengers_to_validate_with' => array( 'email' ) |
|
456 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_reminder/'), |
|
457 | + 'messengers_to_activate_with' => array('email'), |
|
458 | + 'messengers_to_validate_with' => array('email') |
|
459 | 459 | ); |
460 | - EE_Register_Message_Type::register( 'payment_reminder', $setup_args ); |
|
460 | + EE_Register_Message_Type::register('payment_reminder', $setup_args); |
|
461 | 461 | |
462 | 462 | //register payment declined message type |
463 | 463 | $setup_args = array( |
464 | 464 | 'mtfilename' => 'EE_Payment_Declined_message_type.class.php', |
465 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_declined/' ), |
|
466 | - 'messengers_to_activate_with' => array( 'email' ), |
|
467 | - 'messengers_to_validate_with' => array( 'email' ) |
|
465 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_declined/'), |
|
466 | + 'messengers_to_activate_with' => array('email'), |
|
467 | + 'messengers_to_validate_with' => array('email') |
|
468 | 468 | ); |
469 | - EE_Register_Message_Type::register( 'payment_declined', $setup_args ); |
|
469 | + EE_Register_Message_Type::register('payment_declined', $setup_args); |
|
470 | 470 | |
471 | 471 | //register registration declined message type |
472 | 472 | $setup_args = array( |
473 | 473 | 'mtfilename' => 'EE_Declined_Registration_message_type.class.php', |
474 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/declined_registration/' ), |
|
475 | - 'messengers_to_activate_with' => array( 'email' ), |
|
476 | - 'messengers_to_validate_with' => array( 'email' ) |
|
474 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/declined_registration/'), |
|
475 | + 'messengers_to_activate_with' => array('email'), |
|
476 | + 'messengers_to_validate_with' => array('email') |
|
477 | 477 | ); |
478 | - EE_Register_Message_Type::register( 'declined_registration', $setup_args ); |
|
478 | + EE_Register_Message_Type::register('declined_registration', $setup_args); |
|
479 | 479 | |
480 | 480 | //register registration cancelled message type |
481 | 481 | $setup_args = array( |
482 | 482 | 'mtfilename' => 'EE_Cancelled_Registration_message_type.class.php', |
483 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/cancelled_registration/' ), |
|
484 | - 'messengers_to_activate_with' => array( 'email' ), |
|
485 | - 'messengers_to_validate_with' => array( 'email' ) |
|
483 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/cancelled_registration/'), |
|
484 | + 'messengers_to_activate_with' => array('email'), |
|
485 | + 'messengers_to_validate_with' => array('email') |
|
486 | 486 | ); |
487 | - EE_Register_Message_Type::register( 'cancelled_registration', $setup_args ); |
|
487 | + EE_Register_Message_Type::register('cancelled_registration', $setup_args); |
|
488 | 488 | |
489 | 489 | |
490 | 490 | //register payment failed message type |
491 | 491 | $setup_args = array( |
492 | 492 | 'mtfilename' => 'EE_Payment_Failed_message_type.class.php', |
493 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_failed/' ), |
|
494 | - 'messengers_to_activate_with' => array( 'email' ), |
|
495 | - 'messengers_to_validate_with' => array( 'email' ) |
|
493 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_failed/'), |
|
494 | + 'messengers_to_activate_with' => array('email'), |
|
495 | + 'messengers_to_validate_with' => array('email') |
|
496 | 496 | ); |
497 | - EE_Register_Message_Type::register( 'payment_failed', $setup_args ); |
|
497 | + EE_Register_Message_Type::register('payment_failed', $setup_args); |
|
498 | 498 | |
499 | 499 | //register payment declined message type |
500 | 500 | $setup_args = array( |
501 | 501 | 'mtfilename' => 'EE_Payment_Cancelled_message_type.class.php', |
502 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_cancelled/' ), |
|
503 | - 'messengers_to_activate_with' => array( 'email' ), |
|
504 | - 'messengers_to_validate_with' => array( 'email' ) |
|
502 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_cancelled/'), |
|
503 | + 'messengers_to_activate_with' => array('email'), |
|
504 | + 'messengers_to_validate_with' => array('email') |
|
505 | 505 | ); |
506 | - EE_Register_Message_Type::register( 'payment_cancelled', $setup_args ); |
|
506 | + EE_Register_Message_Type::register('payment_cancelled', $setup_args); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | |
@@ -519,12 +519,12 @@ discard block |
||
519 | 519 | public function register_caf_shortcodes() { |
520 | 520 | $setup_args = array( |
521 | 521 | 'autoloadpaths' => array( |
522 | - EE_CAF_LIBRARIES . 'shortcodes/' |
|
522 | + EE_CAF_LIBRARIES.'shortcodes/' |
|
523 | 523 | ), |
524 | - 'msgr_validator_callback' => array( 'EE_Newsletter_Shortcodes', 'messenger_validator_config' ), |
|
525 | - 'msgr_template_fields_callback' => array( 'EE_Newsletter_Shortcodes', 'messenger_template_fields' ), |
|
526 | - 'list_type_shortcodes' => array( '[NEWSLETTER_CONTENT]' ) |
|
524 | + 'msgr_validator_callback' => array('EE_Newsletter_Shortcodes', 'messenger_validator_config'), |
|
525 | + 'msgr_template_fields_callback' => array('EE_Newsletter_Shortcodes', 'messenger_template_fields'), |
|
526 | + 'list_type_shortcodes' => array('[NEWSLETTER_CONTENT]') |
|
527 | 527 | ); |
528 | - EE_Register_Messages_Shortcode_Library::register( 'newsletter', $setup_args ); |
|
528 | + EE_Register_Messages_Shortcode_Library::register('newsletter', $setup_args); |
|
529 | 529 | } |
530 | 530 | } |
@@ -109,7 +109,7 @@ |
||
109 | 109 | * @access public |
110 | 110 | * @param EE_Events_Archive_Config $CFG |
111 | 111 | * @param EE_Request_Handler $REQ |
112 | - * @return void |
|
112 | + * @return EE_Events_Archive_Config |
|
113 | 113 | */ |
114 | 114 | public static function update_template_settings( $CFG, $REQ ) { |
115 | 115 | $CFG->EED_Events_Archive = new EE_Events_Archive_Config(); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @return EED_Events_Archive_Caff |
29 | 29 | */ |
30 | 30 | public static function instance() { |
31 | - return parent::get_instance( __CLASS__ ); |
|
31 | + return parent::get_instance(__CLASS__); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public static function set_hooks_admin() { |
52 | - define( 'EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
53 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Events_Archive_Caff', 'template_settings_form' ), 10 ); |
|
54 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Events_Archive_Caff', 'update_template_settings' ), 10, 2 ); |
|
52 | + define('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
53 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Events_Archive_Caff', 'template_settings_form'), 10); |
|
54 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Events_Archive_Caff', 'update_template_settings'), 10, 2); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @param WP $WP |
65 | 65 | * @return void |
66 | 66 | */ |
67 | - public function run( $WP ) { |
|
67 | + public function run($WP) { |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public static function template_settings_form() { |
81 | 81 | // grab general settings admin page and remove the existing hook callback |
82 | - $gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object( 'general_settings' ); |
|
83 | - if ( $gen_set_admin instanceof General_Settings_Admin_Page ) { |
|
84 | - remove_action( 'AHEE__template_settings__template__before_settings_form', array( $gen_set_admin, 'template_settings_caff_features' ), 100 ); |
|
82 | + $gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object('general_settings'); |
|
83 | + if ($gen_set_admin instanceof General_Settings_Admin_Page) { |
|
84 | + remove_action('AHEE__template_settings__template__before_settings_form', array($gen_set_admin, 'template_settings_caff_features'), 100); |
|
85 | 85 | } |
86 | 86 | $template_settings = EE_Registry::instance()->CFG->template_settings; |
87 | - $template_settings->EED_Events_Archive = isset( $template_settings->EED_Events_Archive ) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
88 | - $template_settings->EED_Events_Archive = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive ); |
|
87 | + $template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
88 | + $template_settings->EED_Events_Archive = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive); |
|
89 | 89 | $events_archive_settings = array( |
90 | 90 | 'display_status_banner' => 0, |
91 | 91 | 'display_description' => 1, |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | 'display_venue' => 0, |
95 | 95 | 'display_expired_events' => 0 |
96 | 96 | ); |
97 | - $events_archive_settings = array_merge( $events_archive_settings, (array)$template_settings->EED_Events_Archive ); |
|
98 | - EEH_Template::display_template( EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $events_archive_settings ); |
|
97 | + $events_archive_settings = array_merge($events_archive_settings, (array) $template_settings->EED_Events_Archive); |
|
98 | + EEH_Template::display_template(EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH.'admin-event-list-settings.template.php', $events_archive_settings); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -111,16 +111,16 @@ discard block |
||
111 | 111 | * @param EE_Request_Handler $REQ |
112 | 112 | * @return void |
113 | 113 | */ |
114 | - public static function update_template_settings( $CFG, $REQ ) { |
|
114 | + public static function update_template_settings($CFG, $REQ) { |
|
115 | 115 | $CFG->EED_Events_Archive = new EE_Events_Archive_Config(); |
116 | 116 | // unless we are resetting the config... |
117 | - if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) { |
|
118 | - $CFG->EED_Events_Archive->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0; |
|
119 | - $CFG->EED_Events_Archive->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1; |
|
120 | - $CFG->EED_Events_Archive->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0; |
|
121 | - $CFG->EED_Events_Archive->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1; |
|
122 | - $CFG->EED_Events_Archive->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0; |
|
123 | - $CFG->EED_Events_Archive->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; } |
|
117 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) { |
|
118 | + $CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
119 | + $CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
120 | + $CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
121 | + $CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1; |
|
122 | + $CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0; |
|
123 | + $CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; } |
|
124 | 124 | return $CFG; |
125 | 125 | } |
126 | 126 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * process_recaptcha |
288 | 288 | * |
289 | 289 | * @access private |
290 | - * @return boolean |
|
290 | + * @return boolean|null |
|
291 | 291 | */ |
292 | 292 | private static function _get_recaptcha_response() { |
293 | 293 | EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false ); |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | * |
575 | 575 | * @access public |
576 | 576 | * @param EE_Registration_Config $EE_Registration_Config |
577 | - * @return array |
|
577 | + * @return EE_Registration_Config |
|
578 | 578 | */ |
579 | 579 | public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) { |
580 | 580 | try { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return EED_Recaptcha |
44 | 44 | */ |
45 | 45 | public static function instance() { |
46 | - return parent::get_instance( __CLASS__ ); |
|
46 | + return parent::get_instance(__CLASS__); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -56,14 +56,14 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public static function set_hooks() { |
58 | 58 | // use_captcha ? |
59 | - if ( EE_Registry::instance()->CFG->registration->use_captcha ) { |
|
59 | + if (EE_Registry::instance()->CFG->registration->use_captcha) { |
|
60 | 60 | EED_Recaptcha::set_definitions(); |
61 | 61 | EED_Recaptcha::enqueue_styles_and_scripts(); |
62 | - add_action( 'wp', array( 'EED_Recaptcha', 'set_late_hooks' ), 1, 0 ); |
|
63 | - add_action( 'AHEE__before_spco_whats_next_buttons', array( 'EED_Recaptcha', 'display_recaptcha' ), 10, 0 ); |
|
64 | - add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
|
65 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
|
66 | - add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 ); |
|
62 | + add_action('wp', array('EED_Recaptcha', 'set_late_hooks'), 1, 0); |
|
63 | + add_action('AHEE__before_spco_whats_next_buttons', array('EED_Recaptcha', 'display_recaptcha'), 10, 0); |
|
64 | + add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
65 | + add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
66 | + add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
@@ -78,15 +78,15 @@ discard block |
||
78 | 78 | public static function set_hooks_admin() { |
79 | 79 | EED_Recaptcha::set_definitions(); |
80 | 80 | // use_captcha ? |
81 | - if ( EE_Registry::instance()->CFG->registration->use_captcha ) { |
|
81 | + if (EE_Registry::instance()->CFG->registration->use_captcha) { |
|
82 | 82 | EED_Recaptcha::enqueue_styles_and_scripts(); |
83 | - add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
|
84 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
|
85 | - add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 ); |
|
83 | + add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
84 | + add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
85 | + add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1); |
|
86 | 86 | } |
87 | 87 | // admin settings |
88 | - add_action( 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array( 'EED_Recaptcha', 'admin_settings' ), 10, 1 ); |
|
89 | - add_filter( 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array( 'EED_Recaptcha', 'update_admin_settings' ), 10, 1 ); |
|
88 | + add_action('AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array('EED_Recaptcha', 'admin_settings'), 10, 1); |
|
89 | + add_filter('FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array('EED_Recaptcha', 'update_admin_settings'), 10, 1); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | * @return void |
99 | 99 | */ |
100 | 100 | public static function set_definitions() { |
101 | - if ( is_user_logged_in() ) { |
|
101 | + if (is_user_logged_in()) { |
|
102 | 102 | EED_Recaptcha::$_not_a_robot = true; |
103 | 103 | } |
104 | - define( 'RECAPTCHA_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
105 | - define( 'RECAPTCHA_BASE_URL', plugin_dir_url( __FILE__ )); |
|
104 | + define('RECAPTCHA_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
105 | + define('RECAPTCHA_BASE_URL', plugin_dir_url(__FILE__)); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | public static function set_late_hooks() { |
117 | 117 | add_filter( |
118 | 118 | 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', |
119 | - array( 'EED_Recaptcha', 'not_a_robot' ) |
|
119 | + array('EED_Recaptcha', 'not_a_robot') |
|
120 | 120 | ); |
121 | 121 | } |
122 | 122 | |
@@ -129,11 +129,11 @@ discard block |
||
129 | 129 | * @return void |
130 | 130 | */ |
131 | 131 | public static function enqueue_styles_and_scripts() { |
132 | - wp_register_script( 'espresso_recaptcha', RECAPTCHA_BASE_URL . 'scripts' . DS . 'espresso_recaptcha.js', array( 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
133 | - wp_register_script( 'google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl=' . EE_Registry::instance()->CFG->registration->recaptcha_language, array( 'espresso_recaptcha' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
134 | - EE_Registry::$i18n_js_strings['no_SPCO_error'] = __( 'It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
135 | - EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __( 'There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso' ); |
|
136 | - EE_Registry::$i18n_js_strings['recaptcha_fail'] = __( 'Please complete the anti-spam test before proceeding.', 'event_espresso' ); |
|
132 | + wp_register_script('espresso_recaptcha', RECAPTCHA_BASE_URL.'scripts'.DS.'espresso_recaptcha.js', array('single_page_checkout'), EVENT_ESPRESSO_VERSION, TRUE); |
|
133 | + wp_register_script('google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl='.EE_Registry::instance()->CFG->registration->recaptcha_language, array('espresso_recaptcha'), EVENT_ESPRESSO_VERSION, TRUE); |
|
134 | + EE_Registry::$i18n_js_strings['no_SPCO_error'] = __('It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso'); |
|
135 | + EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __('There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso'); |
|
136 | + EE_Registry::$i18n_js_strings['recaptcha_fail'] = __('Please complete the anti-spam test before proceeding.', 'event_espresso'); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @access public |
145 | 145 | * @param \WP $WP |
146 | 146 | */ |
147 | - public function run( $WP ) { |
|
147 | + public function run($WP) { |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -154,8 +154,7 @@ discard block |
||
154 | 154 | * @return boolean |
155 | 155 | */ |
156 | 156 | public static function not_a_robot() { |
157 | - $not_a_robot = is_bool( EED_Recaptcha::$_not_a_robot ) ? EED_Recaptcha::$_not_a_robot : |
|
158 | - EED_Recaptcha::recaptcha_passed(); |
|
157 | + $not_a_robot = is_bool(EED_Recaptcha::$_not_a_robot) ? EED_Recaptcha::$_not_a_robot : EED_Recaptcha::recaptcha_passed(); |
|
159 | 158 | return $not_a_robot; |
160 | 159 | } |
161 | 160 | |
@@ -171,23 +170,23 @@ discard block |
||
171 | 170 | */ |
172 | 171 | public static function display_recaptcha() { |
173 | 172 | // logged in means you have already passed a turing test of sorts |
174 | - if ( is_user_logged_in() ) { |
|
173 | + if (is_user_logged_in()) { |
|
175 | 174 | return; |
176 | 175 | } |
177 | 176 | // don't display if not using recaptcha or user is logged in |
178 | - if ( EE_Registry::instance()->CFG->registration->use_captcha ) { |
|
177 | + if (EE_Registry::instance()->CFG->registration->use_captcha) { |
|
179 | 178 | // only display if they have NOT passed the test yet |
180 | - if ( ! EED_Recaptcha::$_not_a_robot ) { |
|
181 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
179 | + if ( ! EED_Recaptcha::$_not_a_robot) { |
|
180 | + EE_Registry::instance()->load_helper('Template'); |
|
182 | 181 | EEH_Template::display_template( |
183 | - RECAPTCHA_BASE_PATH . DS . 'templates' . DS . 'recaptcha.template.php', |
|
182 | + RECAPTCHA_BASE_PATH.DS.'templates'.DS.'recaptcha.template.php', |
|
184 | 183 | array( |
185 | 184 | 'recaptcha_publickey' => EE_Registry::instance()->CFG->registration->recaptcha_publickey, |
186 | 185 | 'recaptcha_theme' => EE_Registry::instance()->CFG->registration->recaptcha_theme, |
187 | 186 | 'recaptcha_type' => EE_Registry::instance()->CFG->registration->recaptcha_type |
188 | 187 | ) |
189 | 188 | ); |
190 | - wp_enqueue_script( 'google_recaptcha' ); |
|
189 | + wp_enqueue_script('google_recaptcha'); |
|
191 | 190 | } |
192 | 191 | } |
193 | 192 | } |
@@ -205,17 +204,17 @@ discard block |
||
205 | 204 | */ |
206 | 205 | public static function recaptcha_passed() { |
207 | 206 | // logged in means you have already passed a turing test of sorts |
208 | - if ( is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha() ) { |
|
207 | + if (is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha()) { |
|
209 | 208 | return TRUE; |
210 | 209 | } |
211 | 210 | // was test already passed? |
212 | - $recaptcha_passed = EE_Registry::instance()->SSN->get_session_data( 'recaptcha_passed' ); |
|
213 | - $recaptcha_passed = filter_var( $recaptcha_passed, FILTER_VALIDATE_BOOLEAN ); |
|
211 | + $recaptcha_passed = EE_Registry::instance()->SSN->get_session_data('recaptcha_passed'); |
|
212 | + $recaptcha_passed = filter_var($recaptcha_passed, FILTER_VALIDATE_BOOLEAN); |
|
214 | 213 | // verify recaptcha |
215 | 214 | EED_Recaptcha::_get_recaptcha_response(); |
216 | - if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response ) { |
|
215 | + if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response) { |
|
217 | 216 | $recaptcha_passed = EED_Recaptcha::_process_recaptcha_response(); |
218 | - EE_Registry::instance()->SSN->set_session_data( array( 'recaptcha_passed' => $recaptcha_passed )); |
|
217 | + EE_Registry::instance()->SSN->set_session_data(array('recaptcha_passed' => $recaptcha_passed)); |
|
219 | 218 | EE_Registry::instance()->SSN->update(); |
220 | 219 | } |
221 | 220 | EED_Recaptcha::$_not_a_robot = $recaptcha_passed; |
@@ -231,8 +230,8 @@ discard block |
||
231 | 230 | * @param array $recaptcha_response |
232 | 231 | * @return boolean |
233 | 232 | */ |
234 | - public static function recaptcha_response( $recaptcha_response = array() ) { |
|
235 | - if ( EED_Recaptcha::_bypass_recaptcha() ) { |
|
233 | + public static function recaptcha_response($recaptcha_response = array()) { |
|
234 | + if (EED_Recaptcha::_bypass_recaptcha()) { |
|
236 | 235 | $recaptcha_response['bypass_recaptcha'] = TRUE; |
237 | 236 | $recaptcha_response['recaptcha_passed'] = TRUE; |
238 | 237 | } else { |
@@ -252,16 +251,16 @@ discard block |
||
252 | 251 | */ |
253 | 252 | private static function _bypass_recaptcha() { |
254 | 253 | // an array of key value pairs that must match exactly with the incoming request, in order to bypass recaptcha for the current request ONLY |
255 | - $bypass_request_params_array = apply_filters( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array() ); |
|
254 | + $bypass_request_params_array = apply_filters('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array()); |
|
256 | 255 | // does $bypass_request_params_array have any values ? |
257 | - if ( empty( $bypass_request_params_array )) { |
|
256 | + if (empty($bypass_request_params_array)) { |
|
258 | 257 | return FALSE; |
259 | 258 | } |
260 | 259 | // initially set bypass to TRUE |
261 | 260 | $bypass_recaptcha = TRUE; |
262 | - foreach ( $bypass_request_params_array as $key => $value ) { |
|
261 | + foreach ($bypass_request_params_array as $key => $value) { |
|
263 | 262 | // if $key is not found or value doesn't match exactly, then toggle bypass to FALSE, otherwise carry over it's value. This way, one missed setting results in no bypass |
264 | - $bypass_recaptcha = isset( $_REQUEST[ $key ] ) && $_REQUEST[ $key ] === $value ? $bypass_recaptcha : FALSE; |
|
263 | + $bypass_recaptcha = isset($_REQUEST[$key]) && $_REQUEST[$key] === $value ? $bypass_recaptcha : FALSE; |
|
265 | 264 | } |
266 | 265 | return $bypass_recaptcha; |
267 | 266 | } |
@@ -276,7 +275,7 @@ discard block |
||
276 | 275 | * @return boolean |
277 | 276 | */ |
278 | 277 | private static function _get_recaptcha_response() { |
279 | - EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false ); |
|
278 | + EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get('g-recaptcha-response', false); |
|
280 | 279 | } |
281 | 280 | |
282 | 281 | |
@@ -290,22 +289,22 @@ discard block |
||
290 | 289 | */ |
291 | 290 | private static function _process_recaptcha_response() { |
292 | 291 | // verify library is loaded |
293 | - if ( ! class_exists( 'ReCaptcha' )) { |
|
294 | - require_once( RECAPTCHA_BASE_PATH . 'recaptchalib.php' ); |
|
292 | + if ( ! class_exists('ReCaptcha')) { |
|
293 | + require_once(RECAPTCHA_BASE_PATH.'recaptchalib.php'); |
|
295 | 294 | } |
296 | 295 | // The response from reCAPTCHA |
297 | 296 | EED_Recaptcha::_get_recaptcha_response(); |
298 | 297 | $recaptcha_response = EED_Recaptcha::$_recaptcha_response; |
299 | 298 | // Was there a reCAPTCHA response? |
300 | - if ( $recaptcha_response ) { |
|
301 | - $reCaptcha = new ReCaptcha( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ); |
|
299 | + if ($recaptcha_response) { |
|
300 | + $reCaptcha = new ReCaptcha(EE_Registry::instance()->CFG->registration->recaptcha_privatekey); |
|
302 | 301 | $recaptcha_response = $reCaptcha->verifyResponse( |
303 | 302 | $_SERVER['REMOTE_ADDR'], |
304 | 303 | EED_Recaptcha::$_recaptcha_response |
305 | 304 | ); |
306 | 305 | } |
307 | 306 | // sorry... it appears you can't read gibberish chicken scratches !!! |
308 | - if ( $recaptcha_response instanceof ReCaptchaResponse && $recaptcha_response->success ) { |
|
307 | + if ($recaptcha_response instanceof ReCaptchaResponse && $recaptcha_response->success) { |
|
309 | 308 | return TRUE; |
310 | 309 | } |
311 | 310 | return FALSE; |
@@ -339,8 +338,8 @@ discard block |
||
339 | 338 | */ |
340 | 339 | protected static function _recaptcha_settings_form() { |
341 | 340 | |
342 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
343 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
341 | + EE_Registry::instance()->load_helper('HTML'); |
|
342 | + EE_Registry::instance()->load_helper('Template'); |
|
344 | 343 | |
345 | 344 | return new EE_Form_Section_Proper( |
346 | 345 | array( |
@@ -350,12 +349,12 @@ discard block |
||
350 | 349 | 'subsections' => apply_filters( |
351 | 350 | 'FHEE__EED_Recaptcha___recaptcha_settings_form__form_subsections', |
352 | 351 | array( |
353 | - 'main_settings_hdr' => new EE_Form_Section_HTML( EEH_HTML::h3( __( 'reCAPTCHA Anti-spam Settings', 'event_espresso' ) . EEH_Template::get_help_tab_link( 'recaptcha_info' ))), |
|
352 | + 'main_settings_hdr' => new EE_Form_Section_HTML(EEH_HTML::h3(__('reCAPTCHA Anti-spam Settings', 'event_espresso').EEH_Template::get_help_tab_link('recaptcha_info'))), |
|
354 | 353 | 'main_settings' => EED_Recaptcha::_recaptcha_main_settings(), |
355 | - 'appearance_settings_hdr' => new EE_Form_Section_HTML( EEH_HTML::h3( __( 'reCAPTCHA Appearance', 'event_espresso' ) )), |
|
354 | + 'appearance_settings_hdr' => new EE_Form_Section_HTML(EEH_HTML::h3(__('reCAPTCHA Appearance', 'event_espresso'))), |
|
356 | 355 | 'appearance_settings' => EED_Recaptcha::_recaptcha_appearance_settings(), |
357 | 356 | // 'recaptcha_example' => new EE_Form_Section_HTML( EED_Recaptcha::display_recaptcha() ), |
358 | - 'required_fields_note' => new EE_Form_Section_HTML( EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' )) |
|
357 | + 'required_fields_note' => new EE_Form_Section_HTML(EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text')) |
|
359 | 358 | ) |
360 | 359 | ) |
361 | 360 | ) |
@@ -382,28 +381,28 @@ discard block |
||
382 | 381 | array( |
383 | 382 | 'use_captcha' => new EE_Yes_No_Input( |
384 | 383 | array( |
385 | - 'html_label_text' => __( 'Use reCAPTCHA', 'event_espresso' ), |
|
384 | + 'html_label_text' => __('Use reCAPTCHA', 'event_espresso'), |
|
386 | 385 | 'html_help_text' => sprintf( |
387 | - __( 'reCAPTCHA is a free service that protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso' ), |
|
386 | + __('reCAPTCHA is a free service that protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso'), |
|
388 | 387 | '<a href="https://www.google.com/recaptcha/intro/index.html">', |
389 | 388 | '</a>' |
390 | 389 | ), |
391 | - 'default' => isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE, |
|
390 | + 'default' => isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE, |
|
392 | 391 | 'display_html_label_text' => FALSE |
393 | 392 | ) |
394 | 393 | ), |
395 | 394 | 'recaptcha_publickey' => new EE_Text_Input( |
396 | 395 | array( |
397 | - 'html_label_text' => __( 'Site Key', 'event_espresso' ), |
|
398 | - 'html_help_text' => __( 'The site key is used to display the widget on your site.', 'event_espresso' ), |
|
399 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : '' |
|
396 | + 'html_label_text' => __('Site Key', 'event_espresso'), |
|
397 | + 'html_help_text' => __('The site key is used to display the widget on your site.', 'event_espresso'), |
|
398 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : '' |
|
400 | 399 | ) |
401 | 400 | ), |
402 | 401 | 'recaptcha_privatekey' => new EE_Text_Input( |
403 | 402 | array( |
404 | - 'html_label_text' => __( 'Secret Key', 'event_espresso' ), |
|
405 | - 'html_help_text' => __( 'The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso' ), |
|
406 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : '' |
|
403 | + 'html_label_text' => __('Secret Key', 'event_espresso'), |
|
404 | + 'html_help_text' => __('The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso'), |
|
405 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : '' |
|
407 | 406 | ) |
408 | 407 | ) |
409 | 408 | ) |
@@ -435,81 +434,81 @@ discard block |
||
435 | 434 | array( |
436 | 435 | 'recaptcha_theme' => new EE_Radio_Button_Input( |
437 | 436 | array( |
438 | - 'light' => __( 'Light', 'event_espresso' ), |
|
439 | - 'dark' => __( 'Dark', 'event_espresso' ) |
|
437 | + 'light' => __('Light', 'event_espresso'), |
|
438 | + 'dark' => __('Dark', 'event_espresso') |
|
440 | 439 | ), |
441 | 440 | array( |
442 | - 'html_label_text' => __( 'Theme', 'event_espresso' ), |
|
443 | - 'html_help_text' => __( 'The color theme of the widget.', 'event_espresso' ), |
|
444 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light', |
|
441 | + 'html_label_text' => __('Theme', 'event_espresso'), |
|
442 | + 'html_help_text' => __('The color theme of the widget.', 'event_espresso'), |
|
443 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light', |
|
445 | 444 | 'display_html_label_text' => FALSE |
446 | 445 | ) |
447 | 446 | ), |
448 | 447 | 'recaptcha_type' => new EE_Radio_Button_Input( |
449 | 448 | array( |
450 | - 'image' => __( 'Image', 'event_espresso' ), |
|
451 | - 'audio' => __( 'Audio', 'event_espresso' ) |
|
449 | + 'image' => __('Image', 'event_espresso'), |
|
450 | + 'audio' => __('Audio', 'event_espresso') |
|
452 | 451 | ), |
453 | 452 | array( |
454 | - 'html_label_text' => __( 'Type', 'event_espresso' ), |
|
455 | - 'html_help_text' => __( 'The type of CAPTCHA to serve.', 'event_espresso' ), |
|
456 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_type ) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image', |
|
453 | + 'html_label_text' => __('Type', 'event_espresso'), |
|
454 | + 'html_help_text' => __('The type of CAPTCHA to serve.', 'event_espresso'), |
|
455 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_type) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image', |
|
457 | 456 | 'display_html_label_text' =>FALSE |
458 | 457 | ) |
459 | 458 | ), |
460 | 459 | 'recaptcha_language' => new EE_Select_Input( |
461 | 460 | array( |
462 | - 'ar' => __( 'Arabic', 'event_espresso' ), |
|
463 | - 'bg' => __( 'Bulgarian', 'event_espresso' ), |
|
464 | - 'ca' => __( 'Catalan', 'event_espresso' ), |
|
465 | - 'zh-CN' => __( 'Chinese (Simplified)', 'event_espresso' ), |
|
466 | - 'zh-TW' => __( 'Chinese (Traditional) ', 'event_espresso' ), |
|
467 | - 'hr' => __( 'Croatian', 'event_espresso' ), |
|
468 | - 'cs' => __( 'Czech', 'event_espresso' ), |
|
469 | - 'da' => __( 'Danish', 'event_espresso' ), |
|
470 | - 'nl' => __( 'Dutch', 'event_espresso' ), |
|
471 | - 'en-GB' => __( 'English (UK)', 'event_espresso' ), |
|
472 | - 'en' => __( 'English (US)', 'event_espresso' ), |
|
473 | - 'fil' => __( 'Filipino', 'event_espresso' ), |
|
474 | - 'fi' => __( 'Finnish', 'event_espresso' ), |
|
475 | - 'fr' => __( 'French', 'event_espresso' ), |
|
476 | - 'fr-CA' => __( 'French (Canadian)', 'event_espresso' ), |
|
477 | - 'de' => __( 'German', 'event_espresso' ), |
|
478 | - 'de-AT' => __( 'German (Austria)', 'event_espresso' ), |
|
479 | - 'de-CH' => __( 'German (Switzerland)', 'event_espresso' ), |
|
480 | - 'el' => __( 'Greek', 'event_espresso' ), |
|
481 | - 'iw' => __( 'Hebrew', 'event_espresso' ), |
|
482 | - 'hi' => __( 'Hindi', 'event_espresso' ), |
|
483 | - 'hu' => __( 'Hungarian', 'event_espresso' ), |
|
484 | - 'id' => __( 'Indonesian', 'event_espresso' ), |
|
485 | - 'it' => __( 'Italian', 'event_espresso' ), |
|
486 | - 'ja' => __( 'Japanese', 'event_espresso' ), |
|
487 | - 'ko' => __( 'Korean', 'event_espresso' ), |
|
488 | - 'lv' => __( 'Latvian', 'event_espresso' ), |
|
489 | - 'lt' => __( 'Lithuanian', 'event_espresso' ), |
|
490 | - 'no' => __( 'Norwegian', 'event_espresso' ), |
|
491 | - 'fa' => __( 'Persian', 'event_espresso' ), |
|
492 | - 'pl' => __( 'Polish', 'event_espresso' ), |
|
493 | - 'pt' => __( 'Portuguese', 'event_espresso' ), |
|
494 | - 'pt-BR' => __( 'Portuguese (Brazil)', 'event_espresso' ), |
|
495 | - 'pt-PT' => __( 'Portuguese (Portugal)', 'event_espresso' ), |
|
496 | - 'ro' => __( 'Romanian', 'event_espresso' ), |
|
497 | - 'ru' => __( 'Russian', 'event_espresso' ), |
|
498 | - 'sr' => __( 'Serbian', 'event_espresso' ), |
|
499 | - 'sk' => __( 'Slovak', 'event_espresso' ), |
|
500 | - 'sl' => __( 'Slovenian', 'event_espresso' ), |
|
501 | - 'es' => __( 'Spanish', 'event_espresso' ), |
|
502 | - 'es-419' => __( 'Spanish (Latin America)', 'event_espresso' ), |
|
503 | - 'sv' => __( 'Swedish', 'event_espresso' ), |
|
504 | - 'th' => __( 'Thai', 'event_espresso' ), |
|
505 | - 'tr' => __( 'Turkish', 'event_espresso' ), |
|
506 | - 'uk' => __( 'Ukrainian', 'event_espresso' ), |
|
507 | - 'vi' => __( 'Vietnamese', 'event_espresso') |
|
461 | + 'ar' => __('Arabic', 'event_espresso'), |
|
462 | + 'bg' => __('Bulgarian', 'event_espresso'), |
|
463 | + 'ca' => __('Catalan', 'event_espresso'), |
|
464 | + 'zh-CN' => __('Chinese (Simplified)', 'event_espresso'), |
|
465 | + 'zh-TW' => __('Chinese (Traditional) ', 'event_espresso'), |
|
466 | + 'hr' => __('Croatian', 'event_espresso'), |
|
467 | + 'cs' => __('Czech', 'event_espresso'), |
|
468 | + 'da' => __('Danish', 'event_espresso'), |
|
469 | + 'nl' => __('Dutch', 'event_espresso'), |
|
470 | + 'en-GB' => __('English (UK)', 'event_espresso'), |
|
471 | + 'en' => __('English (US)', 'event_espresso'), |
|
472 | + 'fil' => __('Filipino', 'event_espresso'), |
|
473 | + 'fi' => __('Finnish', 'event_espresso'), |
|
474 | + 'fr' => __('French', 'event_espresso'), |
|
475 | + 'fr-CA' => __('French (Canadian)', 'event_espresso'), |
|
476 | + 'de' => __('German', 'event_espresso'), |
|
477 | + 'de-AT' => __('German (Austria)', 'event_espresso'), |
|
478 | + 'de-CH' => __('German (Switzerland)', 'event_espresso'), |
|
479 | + 'el' => __('Greek', 'event_espresso'), |
|
480 | + 'iw' => __('Hebrew', 'event_espresso'), |
|
481 | + 'hi' => __('Hindi', 'event_espresso'), |
|
482 | + 'hu' => __('Hungarian', 'event_espresso'), |
|
483 | + 'id' => __('Indonesian', 'event_espresso'), |
|
484 | + 'it' => __('Italian', 'event_espresso'), |
|
485 | + 'ja' => __('Japanese', 'event_espresso'), |
|
486 | + 'ko' => __('Korean', 'event_espresso'), |
|
487 | + 'lv' => __('Latvian', 'event_espresso'), |
|
488 | + 'lt' => __('Lithuanian', 'event_espresso'), |
|
489 | + 'no' => __('Norwegian', 'event_espresso'), |
|
490 | + 'fa' => __('Persian', 'event_espresso'), |
|
491 | + 'pl' => __('Polish', 'event_espresso'), |
|
492 | + 'pt' => __('Portuguese', 'event_espresso'), |
|
493 | + 'pt-BR' => __('Portuguese (Brazil)', 'event_espresso'), |
|
494 | + 'pt-PT' => __('Portuguese (Portugal)', 'event_espresso'), |
|
495 | + 'ro' => __('Romanian', 'event_espresso'), |
|
496 | + 'ru' => __('Russian', 'event_espresso'), |
|
497 | + 'sr' => __('Serbian', 'event_espresso'), |
|
498 | + 'sk' => __('Slovak', 'event_espresso'), |
|
499 | + 'sl' => __('Slovenian', 'event_espresso'), |
|
500 | + 'es' => __('Spanish', 'event_espresso'), |
|
501 | + 'es-419' => __('Spanish (Latin America)', 'event_espresso'), |
|
502 | + 'sv' => __('Swedish', 'event_espresso'), |
|
503 | + 'th' => __('Thai', 'event_espresso'), |
|
504 | + 'tr' => __('Turkish', 'event_espresso'), |
|
505 | + 'uk' => __('Ukrainian', 'event_espresso'), |
|
506 | + 'vi' => __('Vietnamese', 'event_espresso') |
|
508 | 507 | ), |
509 | 508 | array( |
510 | - 'html_label_text' => __( 'Language', 'event_espresso' ), |
|
511 | - 'html_help_text' => __( 'Forces the widget to render in a specific language.', 'event_espresso' ), |
|
512 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en' |
|
509 | + 'html_label_text' => __('Language', 'event_espresso'), |
|
510 | + 'html_help_text' => __('Forces the widget to render in a specific language.', 'event_espresso'), |
|
511 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en' |
|
513 | 512 | ) |
514 | 513 | ) |
515 | 514 | ) |
@@ -557,25 +556,25 @@ discard block |
||
557 | 556 | * @param EE_Registration_Config $EE_Registration_Config |
558 | 557 | * @return array |
559 | 558 | */ |
560 | - public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) { |
|
559 | + public static function update_admin_settings(EE_Registration_Config $EE_Registration_Config) { |
|
561 | 560 | try { |
562 | 561 | $recaptcha_settings_form = EED_Recaptcha::_recaptcha_settings_form(); |
563 | 562 | // if not displaying a form, then check for form submission |
564 | - if ( $recaptcha_settings_form->was_submitted() ) { |
|
563 | + if ($recaptcha_settings_form->was_submitted()) { |
|
565 | 564 | // capture form data |
566 | 565 | $recaptcha_settings_form->receive_form_submission(); |
567 | 566 | // validate form data |
568 | - if ( $recaptcha_settings_form->is_valid() ) { |
|
567 | + if ($recaptcha_settings_form->is_valid()) { |
|
569 | 568 | // grab validated data from form |
570 | 569 | $valid_data = $recaptcha_settings_form->valid_data(); |
571 | 570 | // user proofing recaptcha: If Use reCAPTCHA is set to yes but we dont' have site or secret keys then set Use reCAPTCHA to FALSE and give error message. |
572 | 571 | if ( |
573 | - apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config ) |
|
572 | + apply_filters('FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config) |
|
574 | 573 | && $valid_data['main_settings']['use_captcha'] |
575 | - && ( ! $EE_Registration_Config->use_captcha && ( empty( $valid_data['main_settings']['recaptcha_publickey'] ) || empty( $valid_data['main_settings']['recaptcha_privatekey'] ))) |
|
574 | + && ( ! $EE_Registration_Config->use_captcha && (empty($valid_data['main_settings']['recaptcha_publickey']) || empty($valid_data['main_settings']['recaptcha_privatekey']))) |
|
576 | 575 | ) { |
577 | 576 | $valid_data['main_settings']['use_captcha'] = FALSE; |
578 | - EE_Error::add_error( __('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
577 | + EE_Error::add_error(__('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
579 | 578 | } |
580 | 579 | $EE_Registration_Config->use_captcha = $valid_data['main_settings']['use_captcha']; |
581 | 580 | $EE_Registration_Config->recaptcha_publickey = $valid_data['main_settings']['recaptcha_publickey']; |
@@ -584,12 +583,12 @@ discard block |
||
584 | 583 | $EE_Registration_Config->recaptcha_theme = $valid_data['appearance_settings']['recaptcha_theme']; |
585 | 584 | $EE_Registration_Config->recaptcha_language = $valid_data['appearance_settings']['recaptcha_language']; |
586 | 585 | } else { |
587 | - if ( $recaptcha_settings_form->submission_error_message() != '' ) { |
|
588 | - EE_Error::add_error( $recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
586 | + if ($recaptcha_settings_form->submission_error_message() != '') { |
|
587 | + EE_Error::add_error($recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
589 | 588 | } |
590 | 589 | } |
591 | 590 | } |
592 | - } catch( EE_Error $e ) { |
|
591 | + } catch (EE_Error $e) { |
|
593 | 592 | $e->get_error(); |
594 | 593 | } |
595 | 594 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -150,7 +150,7 @@ |
||
150 | 150 | * @param EE_Template_Config $CFG |
151 | 151 | * @param array $REQ incoming request |
152 | 152 | * |
153 | - * @return void |
|
153 | + * @return EE_Template_Config |
|
154 | 154 | */ |
155 | 155 | public static function update_template_settings( EE_Template_Config $CFG, $REQ ) { |
156 | 156 | if ( ! isset( $CFG->EED_Ticket_Selector ) ) { |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @return EED_Ticket_Selector_Caff |
17 | 17 | */ |
18 | 18 | public static function instance() { |
19 | - return parent::get_instance( __CLASS__ ); |
|
19 | + return parent::get_instance(__CLASS__); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
@@ -37,24 +37,24 @@ discard block |
||
37 | 37 | * @return void |
38 | 38 | */ |
39 | 39 | public static function set_hooks_admin() { |
40 | - define( 'TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
41 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Ticket_Selector_Caff', 'template_settings_form' ), 10 ); |
|
42 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Ticket_Selector_Caff', 'update_template_settings' ), 10, 2 ); |
|
40 | + define('TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
41 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Ticket_Selector_Caff', 'template_settings_form'), 10); |
|
42 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Ticket_Selector_Caff', 'update_template_settings'), 10, 2); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
46 | 46 | //just required because of abstract declaration |
47 | - public function run( $WP ) { |
|
47 | + public function run($WP) { |
|
48 | 48 | $this->set_config(); |
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | 52 | |
53 | 53 | |
54 | - protected function set_config(){ |
|
55 | - $this->set_config_section( 'template_settings' ); |
|
56 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
57 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
54 | + protected function set_config() { |
|
55 | + $this->set_config_section('template_settings'); |
|
56 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
57 | + $this->set_config_name('EED_Ticket_Selector'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | 'subsections' => apply_filters( |
89 | 89 | 'FHEE__EED_Ticket_Selector_Caff___ticket_selector_settings_form__form_subsections', |
90 | 90 | array( |
91 | - 'appearance_settings_hdr' => new EE_Form_Section_HTML( EEH_HTML::h3( __( 'Ticket Selector Template Settings', 'event_espresso' ))), |
|
91 | + 'appearance_settings_hdr' => new EE_Form_Section_HTML(EEH_HTML::h3(__('Ticket Selector Template Settings', 'event_espresso'))), |
|
92 | 92 | 'appearance_settings' => EED_Ticket_Selector_Caff::_ticket_selector_appearance_settings() |
93 | 93 | ) |
94 | 94 | ) |
@@ -111,25 +111,25 @@ discard block |
||
111 | 111 | 'FHEE__EED_Ticket_Selector_Caff___ticket_selector_appearance_settings__form_subsections', array( |
112 | 112 | 'show_ticket_details' => new EE_Yes_No_Input( |
113 | 113 | array( |
114 | - 'html_label_text' => __('Show Ticket Details?', 'event_espresso' ), |
|
115 | - 'html_help_text' => __( 'This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'), |
|
116 | - 'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details : true, |
|
114 | + 'html_label_text' => __('Show Ticket Details?', 'event_espresso'), |
|
115 | + 'html_help_text' => __('This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'), |
|
116 | + 'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details : true, |
|
117 | 117 | 'display_html_label_text' => false |
118 | 118 | ) |
119 | 119 | ), |
120 | 120 | 'show_ticket_sale_columns' => new EE_Yes_No_Input( |
121 | 121 | array( |
122 | - 'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso' ), |
|
123 | - 'html_help_text' => __( 'This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'), |
|
124 | - 'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns : true, |
|
122 | + 'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso'), |
|
123 | + 'html_help_text' => __('This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'), |
|
124 | + 'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns : true, |
|
125 | 125 | 'display_html_label_text' => false |
126 | 126 | ) |
127 | 127 | ), |
128 | 128 | 'show_expired_tickets' => new EE_Yes_No_Input( |
129 | 129 | array( |
130 | - 'html_label_text' => __( 'Show Expired Tickets?', 'event_espresso' ), |
|
131 | - 'html_help_text' => __( 'Indicate whether to show expired tickets in the ticket selector', 'event_espresso' ), |
|
132 | - 'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets : true, |
|
130 | + 'html_label_text' => __('Show Expired Tickets?', 'event_espresso'), |
|
131 | + 'html_help_text' => __('Indicate whether to show expired tickets in the ticket selector', 'event_espresso'), |
|
132 | + 'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets : true, |
|
133 | 133 | 'display_html_label_text' => false |
134 | 134 | ) |
135 | 135 | ) |
@@ -152,21 +152,21 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return void |
154 | 154 | */ |
155 | - public static function update_template_settings( EE_Template_Config $CFG, $REQ ) { |
|
156 | - if ( ! isset( $CFG->EED_Ticket_Selector ) ) { |
|
155 | + public static function update_template_settings(EE_Template_Config $CFG, $REQ) { |
|
156 | + if ( ! isset($CFG->EED_Ticket_Selector)) { |
|
157 | 157 | $CFG->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
158 | 158 | } |
159 | 159 | try { |
160 | 160 | $ticket_selector_form = EED_Ticket_Selector_Caff::_ticket_selector_settings_form(); |
161 | 161 | |
162 | 162 | //check for form submission |
163 | - if ( $ticket_selector_form->was_submitted() ) { |
|
163 | + if ($ticket_selector_form->was_submitted()) { |
|
164 | 164 | |
165 | 165 | //capture form data |
166 | 166 | $ticket_selector_form->receive_form_submission(); |
167 | 167 | |
168 | 168 | //validate form data |
169 | - if ( $ticket_selector_form->is_valid() ) { |
|
169 | + if ($ticket_selector_form->is_valid()) { |
|
170 | 170 | |
171 | 171 | //grab validated data from form |
172 | 172 | $valid_data = $ticket_selector_form->valid_data(); |
@@ -176,13 +176,13 @@ discard block |
||
176 | 176 | $CFG->EED_Ticket_Selector->show_ticket_details = $valid_data['appearance_settings']['show_ticket_details']; |
177 | 177 | $CFG->EED_Ticket_Selector->show_expired_tickets = $valid_data['appearance_settings']['show_expired_tickets']; |
178 | 178 | } else { |
179 | - if ( $ticket_selector_form->submission_error_message() != '' ) { |
|
180 | - EE_Error::add_error( $ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
179 | + if ($ticket_selector_form->submission_error_message() != '') { |
|
180 | + EE_Error::add_error($ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | 184 | } |
185 | - } catch( EE_Error $e ) { |
|
185 | + } catch (EE_Error $e) { |
|
186 | 186 | $e->get_error(); |
187 | 187 | } |
188 | 188 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * |
4 | 6 | * EED_Ticket_Selector_Caff |
@@ -206,7 +206,8 @@ discard block |
||
206 | 206 | /** |
207 | 207 | * Posts the request to AuthorizeNet & returns response. |
208 | 208 | * |
209 | - * @return AuthorizeNetARB_Response The response. |
|
209 | + * @param EEI_Payment $payment |
|
210 | + * @return EE_AuthorizeNetAIM_Response The response. |
|
210 | 211 | */ |
211 | 212 | private function _sendRequest($payment) { |
212 | 213 | $this->_x_post_fields['login'] = $this->_login_id; |
@@ -353,9 +354,6 @@ discard block |
||
353 | 354 | * Constructor. Parses the AuthorizeNet response string. |
354 | 355 | * |
355 | 356 | * @param string $response The response from the AuthNet server. |
356 | - * @param string $delimiter The delimiter used (default is ",") |
|
357 | - * @param string $encap_char The encap_char used (default is "|") |
|
358 | - * @param array $custom_fields Any custom fields set in the request. |
|
359 | 357 | */ |
360 | 358 | |
361 | 359 | public function __construct($response) { |
@@ -135,7 +135,7 @@ |
||
135 | 135 | //in which case, we need to generate teh invoice num per request right here... |
136 | 136 | $this->setField('invoice_num', wp_generate_password(12,false));//$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']); |
137 | 137 | //tell AIM that any duplicates sent in the next 5 minutes are to be ignored |
138 | - $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS ); |
|
138 | + $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS ); |
|
139 | 139 | |
140 | 140 | |
141 | 141 | if ($this->_test_transactions) { |
@@ -1,7 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | |
6 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -107,7 +108,7 @@ discard block |
||
107 | 108 | foreach($total_line_item->tax_descendants() as $tax_line_item){ |
108 | 109 | $this->addLineItem($item_num++, $tax_line_item->name(), $tax_line_item->desc(), 1, $tax_line_item->total(), 'N'); |
109 | 110 | } |
110 | - }else{//partial payment |
|
111 | + } else{//partial payment |
|
111 | 112 | $order_description = sprintf(__("Payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code()); |
112 | 113 | } |
113 | 114 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EEG_Aim extends EE_Onsite_Gateway{ |
|
28 | +class EEG_Aim extends EE_Onsite_Gateway { |
|
29 | 29 | protected $_login_id; |
30 | 30 | protected $_transaction_key; |
31 | 31 | protected $_currencies_supported = array( |
@@ -98,17 +98,17 @@ discard block |
||
98 | 98 | $primary_registrant = $transaction->primary_registration(); |
99 | 99 | //if we're are charging for the full amount, show the normal line items |
100 | 100 | //and the itemized total adds up properly |
101 | - if( $this->_can_easily_itemize_transaction_for( $payment ) ){ |
|
101 | + if ($this->_can_easily_itemize_transaction_for($payment)) { |
|
102 | 102 | $total_line_item = $transaction->total_line_item(); |
103 | 103 | foreach ($total_line_item->get_items() as $line_item) { |
104 | 104 | $this->addLineItem($item_num++, $line_item->name(), $line_item->desc(), $line_item->quantity(), $line_item->unit_price(), 'N'); |
105 | 105 | $order_description .= $line_item->desc().', '; |
106 | 106 | } |
107 | - foreach($total_line_item->tax_descendants() as $tax_line_item){ |
|
107 | + foreach ($total_line_item->tax_descendants() as $tax_line_item) { |
|
108 | 108 | $this->addLineItem($item_num++, $tax_line_item->name(), $tax_line_item->desc(), 1, $tax_line_item->total(), 'N'); |
109 | 109 | } |
110 | - }else{//partial payment |
|
111 | - $order_description = sprintf(__("Payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code()); |
|
110 | + } else {//partial payment |
|
111 | + $order_description = sprintf(__("Payment of %s for %s", "event_espresso"), $payment->amount(), $primary_registrant->reg_code()); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | //start transaction |
118 | 118 | $this->setField('amount', $this->format_currency($payment->amount())); |
119 | - $this->setField('description',substr(rtrim($order_description, ', '), 0, 255)); |
|
119 | + $this->setField('description', substr(rtrim($order_description, ', '), 0, 255)); |
|
120 | 120 | $this->setField('card_num', $billing_info['credit_card']); |
121 | 121 | $this->setField('exp_date', $billing_info['exp_month'].$billing_info['exp_year']); |
122 | 122 | $this->setField('card_code', $billing_info['cvv']); |
@@ -125,17 +125,17 @@ discard block |
||
125 | 125 | $this->setField('email', $billing_info['email']); |
126 | 126 | $this->setField('address', $billing_info['address'].' '.$billing_info['address2']); |
127 | 127 | $this->setField('city', $billing_info['city']); |
128 | - $this->setField('state', $billing_info['state'] ); |
|
129 | - $this->setField('country', $billing_info['country'] ); |
|
128 | + $this->setField('state', $billing_info['state']); |
|
129 | + $this->setField('country', $billing_info['country']); |
|
130 | 130 | $this->setField('zip', $billing_info['zip']); |
131 | 131 | $this->setField('cust_id', $primary_registrant->ID()); |
132 | 132 | $this->setField('phone', $billing_info['phone']); |
133 | 133 | //invoice_num would be nice to have itbe unique per SPCO page-load, taht way if users |
134 | 134 | //press back, they don't submit a duplicate. However, we may be keepin gthe user on teh same spco page |
135 | 135 | //in which case, we need to generate teh invoice num per request right here... |
136 | - $this->setField('invoice_num', wp_generate_password(12,false));//$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']); |
|
136 | + $this->setField('invoice_num', wp_generate_password(12, false)); //$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']); |
|
137 | 137 | //tell AIM that any duplicates sent in the next 5 minutes are to be ignored |
138 | - $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS ); |
|
138 | + $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS); |
|
139 | 139 | |
140 | 140 | |
141 | 141 | if ($this->_test_transactions) { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | //Capture response |
146 | 146 | $this->type = "AUTH_CAPTURE"; |
147 | 147 | $response = $this->_sendRequest($payment); |
148 | - if (!empty($response)){ |
|
148 | + if ( ! empty($response)) { |
|
149 | 149 | if ($this->_debug_mode) { |
150 | 150 | $txn_id = $response->invoice_number; |
151 | 151 | } else { |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | $payment_status = $response->approved ? $this->_pay_model->approved_status() : $this->_pay_model->declined_status(); |
155 | 155 | $payment->set_status($payment_status); |
156 | 156 | //make sure we interpret the AMT as a float, not an international string (where periods are thousand seperators) |
157 | - $payment->set_amount( floatval( $response->amount ) ); |
|
158 | - $payment->set_gateway_response(sprintf("%s (code: %s)",$response->response_reason_text,$response->response_reason_code)); |
|
157 | + $payment->set_amount(floatval($response->amount)); |
|
158 | + $payment->set_gateway_response(sprintf("%s (code: %s)", $response->response_reason_text, $response->response_reason_code)); |
|
159 | 159 | $payment->set_extra_accntng($primary_registrant->reg_code()); |
160 | - $payment->set_details(print_r($response,true)); |
|
160 | + $payment->set_details(print_r($response, true)); |
|
161 | 161 | } else { |
162 | 162 | $payment->set_status($this->_pay_model->failed_status()); |
163 | 163 | $payment->set_gateway_response(__("There was no response from Authorize.net", 'event_espresso')); |
164 | - $payment->set_details(print_r($response,true)); |
|
164 | + $payment->set_details(print_r($response, true)); |
|
165 | 165 | } |
166 | 166 | return $payment; |
167 | 167 | } |
@@ -212,22 +212,22 @@ discard block |
||
212 | 212 | $this->_x_post_fields['tran_key'] = $this->_transaction_key; |
213 | 213 | $x_keys = array(); |
214 | 214 | foreach ($this->_x_post_fields as $key => $value) { |
215 | - $x_keys[] = "x_$key=" . urlencode($value); |
|
215 | + $x_keys[] = "x_$key=".urlencode($value); |
|
216 | 216 | } |
217 | 217 | // Add line items |
218 | 218 | foreach ($this->_additional_line_items as $key => $value) { |
219 | - $x_keys[] = "x_line_item=" . urlencode($value); |
|
219 | + $x_keys[] = "x_line_item=".urlencode($value); |
|
220 | 220 | } |
221 | 221 | $this->_log_clean_request($x_keys, $payment); |
222 | 222 | $post_url = ($this->_debug_mode ? self::SANDBOX_URL : self::LIVE_URL); |
223 | 223 | $curl_request = curl_init($post_url); |
224 | - curl_setopt($curl_request, CURLOPT_POSTFIELDS, implode("&",$x_keys)); |
|
224 | + curl_setopt($curl_request, CURLOPT_POSTFIELDS, implode("&", $x_keys)); |
|
225 | 225 | curl_setopt($curl_request, CURLOPT_HEADER, 0); |
226 | 226 | curl_setopt($curl_request, CURLOPT_TIMEOUT, 45); |
227 | 227 | curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1); |
228 | 228 | curl_setopt($curl_request, CURLOPT_SSL_VERIFYHOST, 2); |
229 | 229 | if ($this->VERIFY_PEER) { |
230 | - curl_setopt($curl_request, CURLOPT_CAINFO, dirname(dirname(__FILE__)) . '/ssl/cert.pem'); |
|
230 | + curl_setopt($curl_request, CURLOPT_CAINFO, dirname(dirname(__FILE__)).'/ssl/cert.pem'); |
|
231 | 231 | } else { |
232 | 232 | curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, false); |
233 | 233 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | $response = curl_exec($curl_request); |
240 | 240 | |
241 | 241 | curl_close($curl_request); |
242 | - $response_obj = new EE_AuthorizeNetAIM_Response($response); |
|
242 | + $response_obj = new EE_AuthorizeNetAIM_Response($response); |
|
243 | 243 | |
244 | 244 | return $this->_log_and_clean_response($response_obj, $payment); |
245 | 245 | } |
@@ -248,18 +248,18 @@ discard block |
||
248 | 248 | * @param array $request_array |
249 | 249 | * @param EEI_Payment $payment |
250 | 250 | */ |
251 | - private function _log_clean_request($request_array,$payment){ |
|
252 | - $keys_to_filter_out = array( 'x_card_num', 'x_card_code', 'x_exp_date' ); |
|
253 | - foreach($request_array as $index => $keyvaltogether ) { |
|
254 | - foreach( $keys_to_filter_out as $key ) { |
|
255 | - if( strpos( $keyvaltogether, $key ) === 0 ){ |
|
251 | + private function _log_clean_request($request_array, $payment) { |
|
252 | + $keys_to_filter_out = array('x_card_num', 'x_card_code', 'x_exp_date'); |
|
253 | + foreach ($request_array as $index => $keyvaltogether) { |
|
254 | + foreach ($keys_to_filter_out as $key) { |
|
255 | + if (strpos($keyvaltogether, $key) === 0) { |
|
256 | 256 | //found it at the first character |
257 | 257 | //so its one of them |
258 | - unset( $request_array[ $index ] ); |
|
258 | + unset($request_array[$index]); |
|
259 | 259 | } |
260 | 260 | } |
261 | 261 | } |
262 | - $this->log(array('AIM Request sent:'=>$request_array),$payment); |
|
262 | + $this->log(array('AIM Request sent:'=>$request_array), $payment); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
@@ -267,9 +267,9 @@ discard block |
||
267 | 267 | * @param EE_AuthorizeNetAIM_Response $response_obj |
268 | 268 | * @param EE_Payment $payment |
269 | 269 | */ |
270 | - private function _log_and_clean_response($response_obj,$payment){ |
|
270 | + private function _log_and_clean_response($response_obj, $payment) { |
|
271 | 271 | $response_obj->account_number = ''; |
272 | - $this->log(array('AIM Response received:'=>$response_obj),$payment); |
|
272 | + $this->log(array('AIM Response received:'=>$response_obj), $payment); |
|
273 | 273 | return $response_obj; |
274 | 274 | } |
275 | 275 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | // Split Array |
366 | 366 | $this->response = $response; |
367 | 367 | if ($encap_char) { |
368 | - $this->_response_array = explode($encap_char . $delimiter . $encap_char, substr($response, 1, -1)); |
|
368 | + $this->_response_array = explode($encap_char.$delimiter.$encap_char, substr($response, 1, -1)); |
|
369 | 369 | } else { |
370 | 370 | $this->_response_array = explode($delimiter, $response); |
371 | 371 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $this->held = ($this->response_code == self::HELD); |
436 | 436 | |
437 | 437 | if ($this->error || $this->declined || $this->held) { |
438 | - $this->error_message = '<p><strong class="credit_card_failure">Attention: your transaction was declined for the following reason(s):</strong><br />' . $this->response_reason_text . '<br /><span class="response_code">Response Code: ' . $this->response_code . '<br /></span><span class="response_subcode">Response Subcode: ' . $this->response_subcode . '</span></p><p>To try again, <a href="#payment_options">please click here</a>.</p> '; |
|
438 | + $this->error_message = '<p><strong class="credit_card_failure">Attention: your transaction was declined for the following reason(s):</strong><br />'.$this->response_reason_text.'<br /><span class="response_code">Response Code: '.$this->response_code.'<br /></span><span class="response_subcode">Response Subcode: '.$this->response_subcode.'</span></p><p>To try again, <a href="#payment_options">please click here</a>.</p> '; |
|
439 | 439 | |
440 | 440 | |
441 | 441 | /* $this->error_message = "AuthorizeNet Error: |
@@ -392,7 +392,7 @@ |
||
392 | 392 | |
393 | 393 | |
394 | 394 | /** |
395 | - * @param $Request |
|
395 | + * @param string $Request |
|
396 | 396 | * @return mixed |
397 | 397 | */ |
398 | 398 | private function _CURLRequest($Request) { |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EEG_Paypal_Pro extends EE_Onsite_Gateway{ |
|
28 | +class EEG_Paypal_Pro extends EE_Onsite_Gateway { |
|
29 | 29 | /** |
30 | 30 | * |
31 | 31 | * @var $_paypal_api_username string |
@@ -88,21 +88,21 @@ discard block |
||
88 | 88 | * } @see parent::do_direct_payment for more info |
89 | 89 | * @return \EE_Payment|\EEI_Payment |
90 | 90 | */ |
91 | - public function do_direct_payment($payment,$billing_info = null){ |
|
91 | + public function do_direct_payment($payment, $billing_info = null) { |
|
92 | 92 | $transaction = $payment->transaction(); |
93 | 93 | $primary_registrant = $transaction->primary_registration(); |
94 | - $order_description = sprintf(__("'Event Registrations from %s", "event_espresso"),get_bloginfo('name')); |
|
94 | + $order_description = sprintf(__("'Event Registrations from %s", "event_espresso"), get_bloginfo('name')); |
|
95 | 95 | //charge for the full amount. Show itemized list |
96 | - if( $this->_can_easily_itemize_transaction_for( $payment ) ){ |
|
96 | + if ($this->_can_easily_itemize_transaction_for($payment)) { |
|
97 | 97 | $item_num = 1; |
98 | 98 | $total_line_item = $transaction->total_line_item(); |
99 | 99 | $order_items = array(); |
100 | 100 | foreach ($total_line_item->get_items() as $line_item) { |
101 | 101 | $item = array( |
102 | 102 | // Item Name. 127 char max. |
103 | - 'l_name' => substr($line_item->name(),0,127), |
|
103 | + 'l_name' => substr($line_item->name(), 0, 127), |
|
104 | 104 | // Item description. 127 char max. |
105 | - 'l_desc' => substr($line_item->desc(),0,127), |
|
105 | + 'l_desc' => substr($line_item->desc(), 0, 127), |
|
106 | 106 | // Cost of individual item. |
107 | 107 | 'l_amt' => $line_item->unit_price(), |
108 | 108 | // Item Number. 127 char max. |
@@ -123,14 +123,14 @@ discard block |
||
123 | 123 | } |
124 | 124 | $item_amount = $total_line_item->get_items_total(); |
125 | 125 | $tax_amount = $total_line_item->get_total_tax(); |
126 | - }else{ |
|
126 | + } else { |
|
127 | 127 | $order_items = array(); |
128 | 128 | $item_amount = $payment->amount(); |
129 | - $single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code()); |
|
129 | + $single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"), $payment->amount(), $primary_registrant->reg_code()); |
|
130 | 130 | $tax_amount = 0; |
131 | - array_push($order_items,array( |
|
131 | + array_push($order_items, array( |
|
132 | 132 | // Item Name. 127 char max. |
133 | - 'l_name' => sprintf(__("Partial payment for registration: %s", 'event_espresso'),$primary_registrant->reg_code()), |
|
133 | + 'l_name' => sprintf(__("Partial payment for registration: %s", 'event_espresso'), $primary_registrant->reg_code()), |
|
134 | 134 | // Item description. 127 char max. |
135 | 135 | 'l_desc' => $single_item_desc, |
136 | 136 | // Cost of individual item. |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | // Payer's salutation. 20 char max. |
178 | 178 | 'salutation' => '', |
179 | 179 | // Payer's first name. 25 char max. |
180 | - 'firstname' => substr($billing_info['first_name'],0,25), |
|
180 | + 'firstname' => substr($billing_info['first_name'], 0, 25), |
|
181 | 181 | // Payer's middle name. 25 char max. |
182 | 182 | 'middlename' => '', |
183 | 183 | // Payer's last name. 25 char max. |
184 | - 'lastname' => substr($billing_info['last_name'],0,25), |
|
184 | + 'lastname' => substr($billing_info['last_name'], 0, 25), |
|
185 | 185 | // Payer's suffix. 12 char max. |
186 | 186 | 'suffix' => '' |
187 | 187 | ); |
@@ -194,13 +194,13 @@ discard block |
||
194 | 194 | // Required. Name of City. |
195 | 195 | 'city' => $billing_info['city'], |
196 | 196 | // Required. Name of State or Province. |
197 | - 'state' => substr( $billing_info['state'], 0, 40 ), |
|
197 | + 'state' => substr($billing_info['state'], 0, 40), |
|
198 | 198 | // Required. Country code. |
199 | 199 | 'countrycode' => $billing_info['country'], |
200 | 200 | // Required. Postal code of payer. |
201 | 201 | 'zip' => $billing_info['zip'], |
202 | 202 | // Phone Number of payer. 20 char max. |
203 | - 'shiptophonenum' => substr($billing_info['phone'],0,20) |
|
203 | + 'shiptophonenum' => substr($billing_info['phone'], 0, 20) |
|
204 | 204 | ); |
205 | 205 | |
206 | 206 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | // Required. Three-letter currency code. Default is USD. |
211 | 211 | 'currencycode' => $payment->currency_code(), |
212 | 212 | // Required if you include itemized cart details. (L_AMTn, etc.) Subtotal of items not including S&H, or tax. |
213 | - 'itemamt' => $this->format_currency($item_amount),// |
|
213 | + 'itemamt' => $this->format_currency($item_amount), // |
|
214 | 214 | // Total shipping costs for the order. If you specify shippingamt, you must also specify itemamt. |
215 | 215 | 'shippingamt' => '', |
216 | 216 | // Total handling costs for the order. If you specify handlingamt, you must also specify itemamt. |
@@ -222,10 +222,10 @@ discard block |
||
222 | 222 | // Free-form field for your own use. 256 char max. |
223 | 223 | 'custom' => $primary_registrant ? $primary_registrant->ID() : '', |
224 | 224 | // Your own invoice or tracking number |
225 | - 'invnum' => wp_generate_password(12,false),//$transaction->ID(), |
|
225 | + 'invnum' => wp_generate_password(12, false), //$transaction->ID(), |
|
226 | 226 | // URL for receiving Instant Payment Notifications. This overrides what your profile is set to use. |
227 | 227 | 'notifyurl' => '', |
228 | - 'buttonsource' => 'EventEspresso_SP',//EE will blow up if you change this |
|
228 | + 'buttonsource' => 'EventEspresso_SP', //EE will blow up if you change this |
|
229 | 229 | ); |
230 | 230 | // Wrap all data arrays into a single, "master" array which will be passed into the class function. |
231 | 231 | $PayPalRequestData = array( |
@@ -238,32 +238,32 @@ discard block |
||
238 | 238 | 'OrderItems' => $order_items, |
239 | 239 | ); |
240 | 240 | $this->_log_clean_request($PayPalRequestData, $payment); |
241 | - try{ |
|
241 | + try { |
|
242 | 242 | $PayPalResult = $this->prep_and_curl_request($PayPalRequestData); |
243 | 243 | //remove PCI-sensitive data so it doesn't get stored |
244 | - $PayPalResult = $this->_log_clean_response($PayPalResult,$payment); |
|
244 | + $PayPalResult = $this->_log_clean_response($PayPalResult, $payment); |
|
245 | 245 | |
246 | 246 | $message = isset($PayPalResult['L_LONGMESSAGE0']) ? $PayPalResult['L_LONGMESSAGE0'] : $PayPalResult['ACK']; |
247 | - if( empty($PayPalResult[ 'RAWRESPONSE' ] ) ) { |
|
248 | - $payment->set_status( $this->_pay_model->failed_status() ) ; |
|
249 | - $payment->set_gateway_response( __( 'No response received from Paypal Pro', 'event_espresso' ) ); |
|
247 | + if (empty($PayPalResult['RAWRESPONSE'])) { |
|
248 | + $payment->set_status($this->_pay_model->failed_status()); |
|
249 | + $payment->set_gateway_response(__('No response received from Paypal Pro', 'event_espresso')); |
|
250 | 250 | $payment->set_details($PayPalResult); |
251 | - }else{ |
|
252 | - if($this->_APICallSuccessful($PayPalResult)){ |
|
251 | + } else { |
|
252 | + if ($this->_APICallSuccessful($PayPalResult)) { |
|
253 | 253 | $payment->set_status($this->_pay_model->approved_status()); |
254 | - }else{ |
|
254 | + } else { |
|
255 | 255 | $payment->set_status($this->_pay_model->declined_status()); |
256 | 256 | } |
257 | 257 | //make sure we interpret the AMT as a float, not an international string (where periods are thousand separators) |
258 | - $payment->set_amount(isset($PayPalResult['AMT']) ? floatval( $PayPalResult['AMT'] ) : 0); |
|
258 | + $payment->set_amount(isset($PayPalResult['AMT']) ? floatval($PayPalResult['AMT']) : 0); |
|
259 | 259 | $payment->set_gateway_response($message); |
260 | - $payment->set_txn_id_chq_nmbr(isset( $PayPalResult['TRANSACTIONID'] )? $PayPalResult['TRANSACTIONID'] : null); |
|
260 | + $payment->set_txn_id_chq_nmbr(isset($PayPalResult['TRANSACTIONID']) ? $PayPalResult['TRANSACTIONID'] : null); |
|
261 | 261 | |
262 | 262 | $primary_registration_code = $primary_registrant instanceof EE_Registration ? $primary_registrant->reg_code() : ''; |
263 | 263 | $payment->set_extra_accntng($primary_registration_code); |
264 | 264 | $payment->set_details($PayPalResult); |
265 | 265 | } |
266 | - }catch(Exception $e){ |
|
266 | + } catch (Exception $e) { |
|
267 | 267 | $payment->set_status($this->_pay_model->failed_status()); |
268 | 268 | $payment->set_gateway_response($e->getMessage()); |
269 | 269 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * @param EEI_Payment $payment |
281 | 281 | * @return array |
282 | 282 | */ |
283 | - private function _log_clean_request($request,$payment){ |
|
283 | + private function _log_clean_request($request, $payment) { |
|
284 | 284 | $cleaned_request_data = $request; |
285 | 285 | unset($cleaned_request_data['CCDetails']['acct']); |
286 | 286 | unset($cleaned_request_data['CCDetails']['cvv2']); |
@@ -295,13 +295,13 @@ discard block |
||
295 | 295 | * @param EEI_Payment $payment |
296 | 296 | * @return array cleaned |
297 | 297 | */ |
298 | - private function _log_clean_response($response,$payment){ |
|
298 | + private function _log_clean_response($response, $payment) { |
|
299 | 299 | unset($response['REQUESTDATA']['CREDITCARDTYPE']); |
300 | 300 | unset($response['REQUESTDATA']['ACCT']); |
301 | 301 | unset($response['REQUESTDATA']['EXPDATE']); |
302 | 302 | unset($response['REQUESTDATA']['CVV2']); |
303 | 303 | unset($response['RAWREQUEST']); |
304 | - $this->log(array('Paypal Response'=>$response),$payment); |
|
304 | + $this->log(array('Paypal Response'=>$response), $payment); |
|
305 | 305 | return $response; |
306 | 306 | } |
307 | 307 | |
@@ -326,32 +326,32 @@ discard block |
||
326 | 326 | // DP Fields |
327 | 327 | $DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array(); |
328 | 328 | foreach ($DPFields as $DPFieldsVar => $DPFieldsVal) |
329 | - $DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal); |
|
329 | + $DPFieldsNVP .= '&'.strtoupper($DPFieldsVar).'='.urlencode($DPFieldsVal); |
|
330 | 330 | |
331 | 331 | // CC Details Fields |
332 | 332 | $CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array(); |
333 | 333 | foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal) |
334 | - $CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal); |
|
334 | + $CCDetailsNVP .= '&'.strtoupper($CCDetailsVar).'='.urlencode($CCDetailsVal); |
|
335 | 335 | |
336 | 336 | // PayerInfo Type Fields |
337 | 337 | $PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array(); |
338 | 338 | foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal) |
339 | - $PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal); |
|
339 | + $PayerInfoNVP .= '&'.strtoupper($PayerInfoVar).'='.urlencode($PayerInfoVal); |
|
340 | 340 | |
341 | 341 | // Payer Name Fields |
342 | 342 | $PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array(); |
343 | 343 | foreach ($PayerName as $PayerNameVar => $PayerNameVal) |
344 | - $PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal); |
|
344 | + $PayerNameNVP .= '&'.strtoupper($PayerNameVar).'='.urlencode($PayerNameVal); |
|
345 | 345 | |
346 | 346 | // Address Fields (Billing) |
347 | 347 | $BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array(); |
348 | 348 | foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal) |
349 | - $BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal); |
|
349 | + $BillingAddressNVP .= '&'.strtoupper($BillingAddressVar).'='.urlencode($BillingAddressVal); |
|
350 | 350 | |
351 | 351 | // Payment Details Type Fields |
352 | 352 | $PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array(); |
353 | 353 | foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal) |
354 | - $PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal); |
|
354 | + $PaymentDetailsNVP .= '&'.strtoupper($PaymentDetailsVar).'='.urlencode($PaymentDetailsVal); |
|
355 | 355 | |
356 | 356 | // Payment Details Item Type Fields |
357 | 357 | $OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array(); |
@@ -359,22 +359,22 @@ discard block |
||
359 | 359 | foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) { |
360 | 360 | $CurrentItem = $OrderItems[$OrderItemsVar]; |
361 | 361 | foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal) |
362 | - $OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal); |
|
362 | + $OrderItemsNVP .= '&'.strtoupper($CurrentItemVar).$n.'='.urlencode($CurrentItemVal); |
|
363 | 363 | $n++; |
364 | 364 | } |
365 | 365 | |
366 | 366 | // Ship To Address Fields |
367 | 367 | $ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array(); |
368 | 368 | foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal) |
369 | - $ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal); |
|
369 | + $ShippingAddressNVP .= '&'.strtoupper($ShippingAddressVar).'='.urlencode($ShippingAddressVal); |
|
370 | 370 | |
371 | 371 | // 3D Secure Fields |
372 | 372 | $Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array(); |
373 | 373 | foreach ($Secure3D as $Secure3DVar => $Secure3DVal) |
374 | - $Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal); |
|
374 | + $Secure3DNVP .= '&'.strtoupper($Secure3DVar).'='.urlencode($Secure3DVal); |
|
375 | 375 | |
376 | 376 | // Now that we have each chunk we need to go ahead and append them all together for our entire NVP string |
377 | - $NVPRequest = 'USER=' . $this->_username . '&PWD=' . $this->_password . '&VERSION=64.0' . '&SIGNATURE=' . $this->_signature . $DPFieldsNVP . $CCDetailsNVP . $PayerInfoNVP . $PayerNameNVP . $BillingAddressNVP . $PaymentDetailsNVP . $OrderItemsNVP . $ShippingAddressNVP . $Secure3DNVP; |
|
377 | + $NVPRequest = 'USER='.$this->_username.'&PWD='.$this->_password.'&VERSION=64.0'.'&SIGNATURE='.$this->_signature.$DPFieldsNVP.$CCDetailsNVP.$PayerInfoNVP.$PayerNameNVP.$BillingAddressNVP.$PaymentDetailsNVP.$OrderItemsNVP.$ShippingAddressNVP.$Secure3DNVP; |
|
378 | 378 | $NVPResponse = $this->_CURLRequest($NVPRequest); |
379 | 379 | $NVPRequestArray = $this->_NVPToArray($NVPRequest); |
380 | 380 | $NVPResponseArray = $this->_NVPToArray($NVPResponse); |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | private function _CURLRequest($Request) { |
399 | 399 | $EndPointURL = $this->_debug_mode ? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp'; |
400 | 400 | $curl = curl_init(); |
401 | - curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE ) ); |
|
401 | + curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE)); |
|
402 | 402 | curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); |
403 | 403 | curl_setopt($curl, CURLOPT_TIMEOUT, 60); |
404 | 404 | curl_setopt($curl, CURLOPT_URL, $EndPointURL); |
@@ -447,9 +447,9 @@ discard block |
||
447 | 447 | private function _APICallSuccessful($PayPalResult) { |
448 | 448 | $approved = false; |
449 | 449 | // check main response message from PayPal |
450 | - if (isset($PayPalResult['ACK']) && !empty($PayPalResult['ACK'])) { |
|
450 | + if (isset($PayPalResult['ACK']) && ! empty($PayPalResult['ACK'])) { |
|
451 | 451 | $ack = strtoupper($PayPalResult['ACK']); |
452 | - $approved = ( $ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS' ) ? true : false; |
|
452 | + $approved = ($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS') ? true : false; |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | return $approved; |
@@ -465,11 +465,11 @@ discard block |
||
465 | 465 | |
466 | 466 | $Errors = array(); |
467 | 467 | $n = 0; |
468 | - while (isset($DataArray['L_ERRORCODE' . $n . ''])) { |
|
469 | - $LErrorCode = isset($DataArray['L_ERRORCODE' . $n . '']) ? $DataArray['L_ERRORCODE' . $n . ''] : ''; |
|
470 | - $LShortMessage = isset($DataArray['L_SHORTMESSAGE' . $n . '']) ? $DataArray['L_SHORTMESSAGE' . $n . ''] : ''; |
|
471 | - $LLongMessage = isset($DataArray['L_LONGMESSAGE' . $n . '']) ? $DataArray['L_LONGMESSAGE' . $n . ''] : ''; |
|
472 | - $LSeverityCode = isset($DataArray['L_SEVERITYCODE' . $n . '']) ? $DataArray['L_SEVERITYCODE' . $n . ''] : ''; |
|
468 | + while (isset($DataArray['L_ERRORCODE'.$n.''])) { |
|
469 | + $LErrorCode = isset($DataArray['L_ERRORCODE'.$n.'']) ? $DataArray['L_ERRORCODE'.$n.''] : ''; |
|
470 | + $LShortMessage = isset($DataArray['L_SHORTMESSAGE'.$n.'']) ? $DataArray['L_SHORTMESSAGE'.$n.''] : ''; |
|
471 | + $LLongMessage = isset($DataArray['L_LONGMESSAGE'.$n.'']) ? $DataArray['L_LONGMESSAGE'.$n.''] : ''; |
|
472 | + $LSeverityCode = isset($DataArray['L_SEVERITYCODE'.$n.'']) ? $DataArray['L_SEVERITYCODE'.$n.''] : ''; |
|
473 | 473 | |
474 | 474 | $CurrentItem = array( |
475 | 475 | 'L_ERRORCODE' => $LErrorCode, |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | elseif ($CurrentErrorVar == 'L_SEVERITYCODE') |
510 | 510 | $CurrentVarName = 'Severity Code'; |
511 | 511 | |
512 | - $error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal; |
|
512 | + $error .= '<br />'.$CurrentVarName.': '.$CurrentErrorVal; |
|
513 | 513 | } |
514 | 514 | } |
515 | 515 | return $error; |
@@ -1,7 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | |
6 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -123,7 +124,7 @@ discard block |
||
123 | 124 | } |
124 | 125 | $item_amount = $total_line_item->get_items_total(); |
125 | 126 | $tax_amount = $total_line_item->get_total_tax(); |
126 | - }else{ |
|
127 | + } else{ |
|
127 | 128 | $order_items = array(); |
128 | 129 | $item_amount = $payment->amount(); |
129 | 130 | $single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code()); |
@@ -248,10 +249,10 @@ discard block |
||
248 | 249 | $payment->set_status( $this->_pay_model->failed_status() ) ; |
249 | 250 | $payment->set_gateway_response( __( 'No response received from Paypal Pro', 'event_espresso' ) ); |
250 | 251 | $payment->set_details($PayPalResult); |
251 | - }else{ |
|
252 | + } else{ |
|
252 | 253 | if($this->_APICallSuccessful($PayPalResult)){ |
253 | 254 | $payment->set_status($this->_pay_model->approved_status()); |
254 | - }else{ |
|
255 | + } else{ |
|
255 | 256 | $payment->set_status($this->_pay_model->declined_status()); |
256 | 257 | } |
257 | 258 | //make sure we interpret the AMT as a float, not an international string (where periods are thousand separators) |
@@ -263,7 +264,7 @@ discard block |
||
263 | 264 | $payment->set_extra_accntng($primary_registration_code); |
264 | 265 | $payment->set_details($PayPalResult); |
265 | 266 | } |
266 | - }catch(Exception $e){ |
|
267 | + } catch(Exception $e){ |
|
267 | 268 | $payment->set_status($this->_pay_model->failed_status()); |
268 | 269 | $payment->set_gateway_response($e->getMessage()); |
269 | 270 | } |
@@ -325,53 +326,62 @@ discard block |
||
325 | 326 | |
326 | 327 | // DP Fields |
327 | 328 | $DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array(); |
328 | - foreach ($DPFields as $DPFieldsVar => $DPFieldsVal) |
|
329 | - $DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal); |
|
329 | + foreach ($DPFields as $DPFieldsVar => $DPFieldsVal) { |
|
330 | + $DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal); |
|
331 | + } |
|
330 | 332 | |
331 | 333 | // CC Details Fields |
332 | 334 | $CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array(); |
333 | - foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal) |
|
334 | - $CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal); |
|
335 | + foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal) { |
|
336 | + $CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal); |
|
337 | + } |
|
335 | 338 | |
336 | 339 | // PayerInfo Type Fields |
337 | 340 | $PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array(); |
338 | - foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal) |
|
339 | - $PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal); |
|
341 | + foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal) { |
|
342 | + $PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal); |
|
343 | + } |
|
340 | 344 | |
341 | 345 | // Payer Name Fields |
342 | 346 | $PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array(); |
343 | - foreach ($PayerName as $PayerNameVar => $PayerNameVal) |
|
344 | - $PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal); |
|
347 | + foreach ($PayerName as $PayerNameVar => $PayerNameVal) { |
|
348 | + $PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal); |
|
349 | + } |
|
345 | 350 | |
346 | 351 | // Address Fields (Billing) |
347 | 352 | $BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array(); |
348 | - foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal) |
|
349 | - $BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal); |
|
353 | + foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal) { |
|
354 | + $BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal); |
|
355 | + } |
|
350 | 356 | |
351 | 357 | // Payment Details Type Fields |
352 | 358 | $PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array(); |
353 | - foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal) |
|
354 | - $PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal); |
|
359 | + foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal) { |
|
360 | + $PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal); |
|
361 | + } |
|
355 | 362 | |
356 | 363 | // Payment Details Item Type Fields |
357 | 364 | $OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array(); |
358 | 365 | $n = 0; |
359 | 366 | foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) { |
360 | 367 | $CurrentItem = $OrderItems[$OrderItemsVar]; |
361 | - foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal) |
|
362 | - $OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal); |
|
368 | + foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal) { |
|
369 | + $OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal); |
|
370 | + } |
|
363 | 371 | $n++; |
364 | 372 | } |
365 | 373 | |
366 | 374 | // Ship To Address Fields |
367 | 375 | $ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array(); |
368 | - foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal) |
|
369 | - $ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal); |
|
376 | + foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal) { |
|
377 | + $ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal); |
|
378 | + } |
|
370 | 379 | |
371 | 380 | // 3D Secure Fields |
372 | 381 | $Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array(); |
373 | - foreach ($Secure3D as $Secure3DVar => $Secure3DVal) |
|
374 | - $Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal); |
|
382 | + foreach ($Secure3D as $Secure3DVar => $Secure3DVal) { |
|
383 | + $Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal); |
|
384 | + } |
|
375 | 385 | |
376 | 386 | // Now that we have each chunk we need to go ahead and append them all together for our entire NVP string |
377 | 387 | $NVPRequest = 'USER=' . $this->_username . '&PWD=' . $this->_password . '&VERSION=64.0' . '&SIGNATURE=' . $this->_signature . $DPFieldsNVP . $CCDetailsNVP . $PayerInfoNVP . $PayerNameNVP . $BillingAddressNVP . $PaymentDetailsNVP . $OrderItemsNVP . $ShippingAddressNVP . $Secure3DNVP; |
@@ -500,14 +510,15 @@ discard block |
||
500 | 510 | $CurrentError = $Errors[$ErrorVar]; |
501 | 511 | foreach ($CurrentError as $CurrentErrorVar => $CurrentErrorVal) { |
502 | 512 | $CurrentVarName = ''; |
503 | - if ($CurrentErrorVar == 'L_ERRORCODE') |
|
504 | - $CurrentVarName = 'Error Code'; |
|
505 | - elseif ($CurrentErrorVar == 'L_SHORTMESSAGE') |
|
506 | - $CurrentVarName = 'Short Message'; |
|
507 | - elseif ($CurrentErrorVar == 'L_LONGMESSAGE') |
|
508 | - $CurrentVarName = 'Long Message'; |
|
509 | - elseif ($CurrentErrorVar == 'L_SEVERITYCODE') |
|
510 | - $CurrentVarName = 'Severity Code'; |
|
513 | + if ($CurrentErrorVar == 'L_ERRORCODE') { |
|
514 | + $CurrentVarName = 'Error Code'; |
|
515 | + } elseif ($CurrentErrorVar == 'L_SHORTMESSAGE') { |
|
516 | + $CurrentVarName = 'Short Message'; |
|
517 | + } elseif ($CurrentErrorVar == 'L_LONGMESSAGE') { |
|
518 | + $CurrentVarName = 'Long Message'; |
|
519 | + } elseif ($CurrentErrorVar == 'L_SEVERITYCODE') { |
|
520 | + $CurrentVarName = 'Severity Code'; |
|
521 | + } |
|
511 | 522 | |
512 | 523 | $error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal; |
513 | 524 | } |