@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | */ |
37 | 37 | protected $_price_types = array(); |
38 | 38 | |
39 | - public function __construct( $admin_page ) { |
|
39 | + public function __construct($admin_page) { |
|
40 | 40 | parent::__construct($admin_page); |
41 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
41 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
42 | 42 | $this->_PRT = EEM_Price_Type::instance(); |
43 | 43 | $this->_price_types = $this->_PRT->get_all_deleted_and_undeleted(); |
44 | 44 | } |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | |
49 | 49 | protected function _setup_data() { |
50 | 50 | $trashed = $this->_admin_page->get_view() == 'trashed' ? true : false; |
51 | - $this->_data = $this->_admin_page->get_prices_overview_data( $this->_per_page, false, $trashed ); |
|
52 | - $this->_all_data_count = $this->_admin_page->get_prices_overview_data( $this->_per_page, true, false ); |
|
53 | - $this->_trashed_count = $this->_admin_page->get_prices_overview_data( $this->_per_page, true, true ); |
|
51 | + $this->_data = $this->_admin_page->get_prices_overview_data($this->_per_page, false, $trashed); |
|
52 | + $this->_all_data_count = $this->_admin_page->get_prices_overview_data($this->_per_page, true, false); |
|
53 | + $this->_trashed_count = $this->_admin_page->get_prices_overview_data($this->_per_page, true, true); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | |
75 | 75 | $this->_sortable_columns = array( |
76 | 76 | // true means its already sorted |
77 | - 'name' => array( 'name' => false ), |
|
78 | - 'type' => array( 'type' => false ), |
|
79 | - 'amount' => array( 'amount' => false ) |
|
77 | + 'name' => array('name' => false), |
|
78 | + 'type' => array('type' => false), |
|
79 | + 'amount' => array('amount' => false) |
|
80 | 80 | ); |
81 | 81 | |
82 | 82 | $this->_hidden_columns = array( |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | protected function _add_view_counts() { |
100 | 100 | $this->_views['all']['count'] = $this->_all_data_count; |
101 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price') ) { |
|
101 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) { |
|
102 | 102 | $this->_views['trashed']['count'] = $this->_trashed_count; |
103 | 103 | } |
104 | 104 | } |
@@ -112,16 +112,16 @@ discard block |
||
112 | 112 | * @param object $item the current item |
113 | 113 | * @return string |
114 | 114 | */ |
115 | - protected function _get_row_class( $item ) { |
|
115 | + protected function _get_row_class($item) { |
|
116 | 116 | static $row_class = ''; |
117 | - $row_class = ( $row_class == '' ? 'alternate' : '' ); |
|
117 | + $row_class = ($row_class == '' ? 'alternate' : ''); |
|
118 | 118 | |
119 | 119 | $new_row = $row_class; |
120 | 120 | |
121 | - if ( $item->type_obj()->base_type() !== 1 && $item->type_obj()->base_type() !== 4 ) |
|
121 | + if ($item->type_obj()->base_type() !== 1 && $item->type_obj()->base_type() !== 4) |
|
122 | 122 | $new_row .= ' rowsortable'; |
123 | 123 | |
124 | - return ' class="' . $new_row . '"'; |
|
124 | + return ' class="'.$new_row.'"'; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | |
132 | 132 | |
133 | 133 | function column_cb($item) { |
134 | - if ( $item->type_obj()->base_type() !== 1 ) |
|
135 | - return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', /* $1%s */ $item->ID() ); |
|
134 | + if ($item->type_obj()->base_type() !== 1) |
|
135 | + return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', /* $1%s */ $item->ID()); |
|
136 | 136 | return ''; |
137 | 137 | } |
138 | 138 | |
@@ -145,31 +145,31 @@ discard block |
||
145 | 145 | //Build row actions |
146 | 146 | $actions = array(); |
147 | 147 | // edit price link |
148 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_default_price', 'pricing_edit_price', $item->ID() ) ) { |
|
149 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_price', 'id'=>$item->ID() ), PRICING_ADMIN_URL ); |
|
150 | - $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Price', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>'; |
|
148 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_default_price', 'pricing_edit_price', $item->ID())) { |
|
149 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_price', 'id'=>$item->ID()), PRICING_ADMIN_URL); |
|
150 | + $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Price', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>'; |
|
151 | 151 | } |
152 | 152 | |
153 | - $name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_default_price', 'edit_price', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Price', 'event_espresso' ) . '">' . stripslashes( $item->name() ) . '</a>' : $item->name(); |
|
153 | + $name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_default_price', 'edit_price', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Price', 'event_espresso').'">'.stripslashes($item->name()).'</a>' : $item->name(); |
|
154 | 154 | |
155 | - if ( $item->type_obj()->base_type() !== 1 ) { |
|
155 | + if ($item->type_obj()->base_type() !== 1) { |
|
156 | 156 | if ($this->_view == 'all') { |
157 | 157 | // trash price link |
158 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_trash_price', $item->ID() ) ) { |
|
159 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_price', 'id'=>$item->ID(), 'noheader' => true ), PRICING_ADMIN_URL ); |
|
160 | - $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Move Price to Trash', 'event_espresso' ) . '">' . __( 'Move to Trash', 'event_espresso' ) . '</a>'; |
|
158 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_trash_price', $item->ID())) { |
|
159 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_price', 'id'=>$item->ID(), 'noheader' => true), PRICING_ADMIN_URL); |
|
160 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Move Price to Trash', 'event_espresso').'">'.__('Move to Trash', 'event_espresso').'</a>'; |
|
161 | 161 | } |
162 | 162 | } else { |
163 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_restore_price', $item->ID() ) ) { |
|
163 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_restore_price', $item->ID())) { |
|
164 | 164 | // restore price link |
165 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_price', 'id'=>$item->ID(), 'noheader' => true ), PRICING_ADMIN_URL ); |
|
166 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Price', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
165 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_price', 'id'=>$item->ID(), 'noheader' => true), PRICING_ADMIN_URL); |
|
166 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Price', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | // delete price link |
170 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_delete_price', $item->ID() ) ) { |
|
171 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_price', 'id'=>$item->ID(), 'noheader' => true ), PRICING_ADMIN_URL ); |
|
172 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Price Permanently', 'event_espresso' ) . '">' . __( 'Delete Permanently', 'event_espresso' ) . '</a>'; |
|
170 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_delete_price', $item->ID())) { |
|
171 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_price', 'id'=>$item->ID(), 'noheader' => true), PRICING_ADMIN_URL); |
|
172 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Price Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | return sprintf('%1$s <span style="color:silver">(id:%2$s)</span>%3$s', |
179 | 179 | /* $1%s */ $name_link, |
180 | 180 | /* $2%s */ $item->ID(), |
181 | - /* $3%s */ $this->row_actions( $actions ) |
|
181 | + /* $3%s */ $this->row_actions($actions) |
|
182 | 182 | ); |
183 | 183 | } |
184 | 184 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | |
196 | 196 | |
197 | 197 | function column_description($item) { |
198 | - return stripslashes( $item->desc() ); |
|
198 | + return stripslashes($item->desc()); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | |
205 | 205 | function column_amount($item) { |
206 | 206 | if ($this->_price_types[$item->type()]->is_percent()) { |
207 | - return '<div class="pad-amnt-rght">' . number_format($item->amount(), 1) . '%</div>'; |
|
207 | + return '<div class="pad-amnt-rght">'.number_format($item->amount(), 1).'%</div>'; |
|
208 | 208 | } else { |
209 | - return '<div class="pad-amnt-rght">' . EEH_Template::format_currency( $item->amount() ) . '</div>'; |
|
209 | + return '<div class="pad-amnt-rght">'.EEH_Template::format_currency($item->amount()).'</div>'; |
|
210 | 210 | } |
211 | 211 | } |
212 | 212 |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | * @param bool $routing |
32 | 32 | * @return Pricing_Admin_Page |
33 | 33 | */ |
34 | - public function __construct( $routing = TRUE ) { |
|
35 | - parent::__construct( $routing ); |
|
34 | + public function __construct($routing = TRUE) { |
|
35 | + parent::__construct($routing); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | protected function _ajax_hooks() { |
52 | - add_action('wp_ajax_espresso_update_prices_order', array( $this, 'update_price_order' )); |
|
52 | + add_action('wp_ajax_espresso_update_prices_order', array($this, 'update_price_order')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | protected function _set_page_routes() { |
85 | - $prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | - $prt_id = ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0; |
|
85 | + $prc_id = ! empty($this->_req_data['PRC_ID']) && ! is_array($this->_req_data['PRC_ID']) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | + $prt_id = ! empty($this->_req_data['PRT_ID']) && ! is_array($this->_req_data['PRT_ID']) ? $this->_req_data['PRT_ID'] : 0; |
|
87 | 87 | $this->_page_routes = array( |
88 | 88 | 'default' => array( |
89 | 89 | 'func' => '_price_overview_list_table', |
@@ -91,38 +91,38 @@ discard block |
||
91 | 91 | ), |
92 | 92 | 'add_new_price' => array( |
93 | 93 | 'func' => '_edit_price_details', |
94 | - 'args' => array( 'new_price' => TRUE ), |
|
94 | + 'args' => array('new_price' => TRUE), |
|
95 | 95 | 'capability' => 'ee_edit_default_prices' |
96 | 96 | ), |
97 | 97 | 'edit_price' => array( |
98 | 98 | 'func' => '_edit_price_details', |
99 | - 'args' => array( 'new_price' => FALSE ), |
|
99 | + 'args' => array('new_price' => FALSE), |
|
100 | 100 | 'capability' => 'ee_edit_default_price', |
101 | 101 | 'obj_id' => $prc_id |
102 | 102 | ), |
103 | 103 | 'insert_price' => array( |
104 | 104 | 'func' => '_insert_or_update_price', |
105 | - 'args' => array( 'new_price' => TRUE ), |
|
105 | + 'args' => array('new_price' => TRUE), |
|
106 | 106 | 'noheader' => TRUE, |
107 | 107 | 'capability' => 'ee_edit_default_prices', |
108 | 108 | ), |
109 | 109 | 'update_price' => array( |
110 | 110 | 'func' => '_insert_or_update_price', |
111 | - 'args' => array( 'new_price' => FALSE ), |
|
111 | + 'args' => array('new_price' => FALSE), |
|
112 | 112 | 'noheader' => TRUE, |
113 | 113 | 'capability' => 'ee_edit_default_price', |
114 | 114 | 'obj_id' => $prc_id |
115 | 115 | ), |
116 | 116 | 'trash_price' => array( |
117 | 117 | 'func' => '_trash_or_restore_price', |
118 | - 'args' => array( 'trash' => TRUE ), |
|
118 | + 'args' => array('trash' => TRUE), |
|
119 | 119 | 'noheader' => TRUE, |
120 | 120 | 'capability' => 'ee_delete_default_price', |
121 | 121 | 'obj_id' => $prc_id |
122 | 122 | ), |
123 | 123 | 'restore_price' => array( |
124 | 124 | 'func' => '_trash_or_restore_price', |
125 | - 'args' => array( 'trash' => FALSE ), |
|
125 | + 'args' => array('trash' => FALSE), |
|
126 | 126 | 'noheader' => TRUE, |
127 | 127 | 'capability' => 'ee_delete_default_price', |
128 | 128 | 'obj_id' => $prc_id |
@@ -154,27 +154,27 @@ discard block |
||
154 | 154 | ), |
155 | 155 | 'insert_price_type' => array( |
156 | 156 | 'func' => '_insert_or_update_price_type', |
157 | - 'args' => array( 'new_price_type' => TRUE ), |
|
157 | + 'args' => array('new_price_type' => TRUE), |
|
158 | 158 | 'noheader' => TRUE, |
159 | 159 | 'capability' => 'ee_edit_default_price_types' |
160 | 160 | ), |
161 | 161 | 'update_price_type' => array( |
162 | 162 | 'func' => '_insert_or_update_price_type', |
163 | - 'args' => array( 'new_price_type' => FALSE ), |
|
163 | + 'args' => array('new_price_type' => FALSE), |
|
164 | 164 | 'noheader' => TRUE, |
165 | 165 | 'capability' => 'ee_edit_default_price_type', |
166 | 166 | 'obj_id' => $prt_id |
167 | 167 | ), |
168 | 168 | 'trash_price_type' => array( |
169 | 169 | 'func' => '_trash_or_restore_price_type', |
170 | - 'args' => array( 'trash' => TRUE ), |
|
170 | + 'args' => array('trash' => TRUE), |
|
171 | 171 | 'noheader' => TRUE, |
172 | 172 | 'capability' => 'ee_delete_default_price_type', |
173 | 173 | 'obj_id' => $prt_id |
174 | 174 | ), |
175 | 175 | 'restore_price_type' => array( |
176 | 176 | 'func' => '_trash_or_restore_price_type', |
177 | - 'args' => array( 'trash' => FALSE ), |
|
177 | + 'args' => array('trash' => FALSE), |
|
178 | 178 | 'noheader' => TRUE, |
179 | 179 | 'capability' => 'ee_delete_default_price_type', |
180 | 180 | 'obj_id' => $prt_id |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | 'filename' => 'pricing_default_pricing_views_bulk_actions_search' |
215 | 215 | ) |
216 | 216 | ), |
217 | - 'help_tour' => array( 'Pricing_Default_Prices_Help_Tour'), |
|
217 | + 'help_tour' => array('Pricing_Default_Prices_Help_Tour'), |
|
218 | 218 | 'require_nonce' => FALSE |
219 | 219 | ), |
220 | 220 | 'add_new_price' => array( |
@@ -230,24 +230,24 @@ discard block |
||
230 | 230 | ) |
231 | 231 | ), |
232 | 232 | 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
233 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
233 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
234 | 234 | 'require_nonce' => FALSE |
235 | 235 | ), |
236 | 236 | 'edit_price' => array( |
237 | 237 | 'nav' => array( |
238 | 238 | 'label' => __('Edit Default Price', 'event_espresso'), |
239 | 239 | 'order' => 20, |
240 | - 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
240 | + 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
241 | 241 | 'persistent' => FALSE |
242 | 242 | ), |
243 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
243 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
244 | 244 | 'help_tabs' => array( |
245 | 245 | 'edit_default_price_help_tab' => array( |
246 | 246 | 'title' => __('Edit Default Price', 'event_espresso'), |
247 | 247 | 'filename' => 'pricing_edit_default_price' |
248 | 248 | ) |
249 | 249 | ), |
250 | - 'help_tour' => array( 'Pricing_Edit_Default_Price_Help_Tour' ), |
|
250 | + 'help_tour' => array('Pricing_Edit_Default_Price_Help_Tour'), |
|
251 | 251 | 'require_nonce' => FALSE |
252 | 252 | ), |
253 | 253 | 'price_types' => array( |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | 'filename' => 'pricing_price_types_views_bulk_actions_search' |
271 | 271 | ), |
272 | 272 | ), |
273 | - 'help_tour' => array( 'Pricing_Price_Types_Default_Help_Tour' ), |
|
273 | + 'help_tour' => array('Pricing_Price_Types_Default_Help_Tour'), |
|
274 | 274 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
275 | 275 | 'require_nonce' => FALSE |
276 | 276 | ), |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | 'filename' => 'pricing_add_new_price_type' |
287 | 287 | ) |
288 | 288 | ), |
289 | - 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
290 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
289 | + 'help_tour' => array('Pricing_Add_New_Price_Type_Help_Tour'), |
|
290 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
291 | 291 | 'require_nonce' => FALSE |
292 | 292 | ), |
293 | 293 | 'edit_price_type' => array( |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | 'filename' => 'pricing_edit_price_type' |
303 | 303 | ) |
304 | 304 | ), |
305 | - 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
306 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
305 | + 'help_tour' => array('Pricing_Edit_Price_Type_Help_Tour'), |
|
306 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
307 | 307 | |
308 | 308 | 'require_nonce' => FALSE |
309 | 309 | ) |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | public function load_scripts_styles() { |
341 | 341 | //styles |
342 | 342 | wp_enqueue_style('espresso-ui-theme'); |
343 | - wp_register_style( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
343 | + wp_register_style('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
344 | 344 | wp_enqueue_style('espresso_PRICING'); |
345 | 345 | |
346 | 346 | //scripts |
@@ -350,8 +350,8 @@ discard block |
||
350 | 350 | //wp_enqueue_script('jquery-ui-dialog'); |
351 | 351 | //wp_enqueue_script('jquery-ui-draggable'); |
352 | 352 | //wp_enqueue_script('jquery-ui-datepicker'); |
353 | - wp_register_script( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
354 | - wp_enqueue_script( 'espresso_PRICING' ); |
|
353 | + wp_register_script('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
354 | + wp_enqueue_script('espresso_PRICING'); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | |
360 | 360 | |
361 | 361 | public function load_scripts_styles_default() { |
362 | - wp_enqueue_script( 'espresso_ajax_table_sorting' ); |
|
362 | + wp_enqueue_script('espresso_ajax_table_sorting'); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | ) |
388 | 388 | ); |
389 | 389 | |
390 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price' ) ) { |
|
390 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) { |
|
391 | 391 | $this->_views['trashed'] = array( |
392 | 392 | 'slug' => 'trashed', |
393 | 393 | 'label' => __('Trash', 'event_espresso'), |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | ) |
418 | 418 | ); |
419 | 419 | |
420 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price_types', 'pricing_trash_price_type' ) ) { |
|
420 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price_types', 'pricing_trash_price_type')) { |
|
421 | 421 | $this->_views['trashed'] = array( |
422 | 422 | 'slug' => 'trashed', |
423 | 423 | 'label' => __('Trash', 'event_espresso'), |
@@ -456,18 +456,18 @@ discard block |
||
456 | 456 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
457 | 457 | * @return mixed (int|array) int = count || array of price objects |
458 | 458 | */ |
459 | - public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
459 | + public function get_prices_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
460 | 460 | |
461 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
461 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
462 | 462 | // start with an empty array |
463 | 463 | $event_pricing = array(); |
464 | 464 | |
465 | - require_once( PRICING_ADMIN . 'Prices_List_Table.class.php' ); |
|
466 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
465 | + require_once(PRICING_ADMIN.'Prices_List_Table.class.php'); |
|
466 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
467 | 467 | //$PRC = EEM_Price::instance(); |
468 | 468 | |
469 | 469 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
470 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
470 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
471 | 471 | |
472 | 472 | switch ($this->_req_data['orderby']) { |
473 | 473 | case 'name': |
@@ -480,27 +480,27 @@ discard block |
||
480 | 480 | $orderby = array('PRC_amount'=>$order); |
481 | 481 | break; |
482 | 482 | default: |
483 | - $orderby = array( 'PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
483 | + $orderby = array('PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
484 | 484 | } |
485 | 485 | |
486 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
487 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
486 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
487 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
488 | 488 | |
489 | 489 | $_where = array( |
490 | 490 | 'PRC_is_default' => 1, |
491 | 491 | 'PRC_deleted' => $trashed |
492 | 492 | ); |
493 | 493 | |
494 | - $offset = ($current_page-1)*$per_page; |
|
495 | - $limit = array( $offset, $per_page ); |
|
494 | + $offset = ($current_page - 1) * $per_page; |
|
495 | + $limit = array($offset, $per_page); |
|
496 | 496 | |
497 | - if ( isset( $this->_req_data['s'] ) ) { |
|
498 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
497 | + if (isset($this->_req_data['s'])) { |
|
498 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
499 | 499 | $_where['OR'] = array( |
500 | - 'PRC_name' => array('LIKE',$sstr ), |
|
501 | - 'PRC_desc' => array('LIKE',$sstr ), |
|
502 | - 'PRC_amount' => array( 'LIKE',$sstr ), |
|
503 | - 'Price_Type.PRT_name' => array( 'LIKE', $sstr ) |
|
500 | + 'PRC_name' => array('LIKE', $sstr), |
|
501 | + 'PRC_desc' => array('LIKE', $sstr), |
|
502 | + 'PRC_amount' => array('LIKE', $sstr), |
|
503 | + 'Price_Type.PRT_name' => array('LIKE', $sstr) |
|
504 | 504 | ); |
505 | 505 | } |
506 | 506 | |
@@ -511,9 +511,9 @@ discard block |
||
511 | 511 | 'group_by'=>'PRC_ID' |
512 | 512 | ); |
513 | 513 | |
514 | - if($count){ |
|
515 | - return $trashed ? EEM_Price::instance()->count( array( $_where ) ) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
516 | - }else{ |
|
514 | + if ($count) { |
|
515 | + return $trashed ? EEM_Price::instance()->count(array($_where)) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
516 | + } else { |
|
517 | 517 | return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params); |
518 | 518 | } |
519 | 519 | } |
@@ -529,40 +529,40 @@ discard block |
||
529 | 529 | * @return void |
530 | 530 | */ |
531 | 531 | protected function _edit_price_details() { |
532 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
532 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
533 | 533 | // grab price ID |
534 | - $PRC_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
534 | + $PRC_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
535 | 535 | // change page title based on request action |
536 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
536 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
537 | 537 | // add PRC_ID to title if editing |
538 | - $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title . ' # ' . $PRC_ID : $this->_admin_page_title; |
|
538 | + $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title.' # '.$PRC_ID : $this->_admin_page_title; |
|
539 | 539 | |
540 | 540 | // get prices |
541 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
541 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
542 | 542 | $PRC = EEM_Price::instance(); |
543 | 543 | |
544 | - if ( $PRC_ID ) { |
|
545 | - $price = $PRC->get_one_by_ID( $PRC_ID ); |
|
544 | + if ($PRC_ID) { |
|
545 | + $price = $PRC->get_one_by_ID($PRC_ID); |
|
546 | 546 | $additional_hidden_fields = array( |
547 | - 'PRC_ID' => array( 'type' => 'hidden', 'value' => $PRC_ID ) |
|
547 | + 'PRC_ID' => array('type' => 'hidden', 'value' => $PRC_ID) |
|
548 | 548 | ); |
549 | - $this->_set_add_edit_form_tags( 'update_price', $additional_hidden_fields ); |
|
549 | + $this->_set_add_edit_form_tags('update_price', $additional_hidden_fields); |
|
550 | 550 | } else { |
551 | 551 | $price = $PRC->get_new_price(); |
552 | - $this->_set_add_edit_form_tags( 'insert_price' ); |
|
552 | + $this->_set_add_edit_form_tags('insert_price'); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | $this->_template_args['PRC_ID'] = $PRC_ID; |
556 | 556 | $this->_template_args['price'] = $price; |
557 | 557 | |
558 | 558 | // get price types |
559 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
559 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
560 | 560 | $PRT = EEM_Price_Type::instance(); |
561 | - $price_types = $PRT->get_all( array( array('PBT_ID' => array('!=', 1 ) ) ) ); |
|
561 | + $price_types = $PRT->get_all(array(array('PBT_ID' => array('!=', 1)))); |
|
562 | 562 | $price_type_names = array(); |
563 | 563 | if (empty($price_types)) { |
564 | - $msg = __( 'You have no price types defined. Please add a price type before adding a price.', 'event_espresso' ); |
|
565 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
564 | + $msg = __('You have no price types defined. Please add a price type before adding a price.', 'event_espresso'); |
|
565 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
566 | 566 | exit(); |
567 | 567 | } else { |
568 | 568 | foreach ($price_types as $type) { |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | $this->_template_args['price_types'] = $price_type_names; |
576 | 576 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
577 | 577 | |
578 | - $this->_set_publish_post_box_vars( 'id', $PRC_ID ); |
|
578 | + $this->_set_publish_post_box_vars('id', $PRC_ID); |
|
579 | 579 | // the details template wrapper |
580 | 580 | $this->display_admin_page_with_sidebar(); |
581 | 581 | } |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | * @return void |
592 | 592 | */ |
593 | 593 | protected function _price_details_meta_boxes() { |
594 | - add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
594 | + add_meta_box('edit-price-details-mbox', __('Default Price Details', 'event_espresso'), array($this, '_edit_price_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
595 | 595 | } |
596 | 596 | |
597 | 597 | |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | * @return void |
606 | 606 | */ |
607 | 607 | public function _edit_price_details_meta_box() { |
608 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
608 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
609 | 609 | } |
610 | 610 | |
611 | 611 | |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | */ |
620 | 620 | protected function set_price_column_values() { |
621 | 621 | |
622 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
622 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
623 | 623 | |
624 | 624 | $set_column_values = array( |
625 | 625 | 'PRT_ID' => absint($this->_req_data['PRT_ID']), |
@@ -647,12 +647,12 @@ discard block |
||
647 | 647 | * @access protected |
648 | 648 | * @return void |
649 | 649 | */ |
650 | - protected function _insert_or_update_price( $insert = FALSE ) { |
|
650 | + protected function _insert_or_update_price($insert = FALSE) { |
|
651 | 651 | |
652 | 652 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
653 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
653 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
654 | 654 | |
655 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
655 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
656 | 656 | $PRC = EEM_Price::instance(); |
657 | 657 | |
658 | 658 | // why be so pessimistic ??? : ( |
@@ -660,14 +660,14 @@ discard block |
||
660 | 660 | |
661 | 661 | $set_column_values = $this->set_price_column_values(); |
662 | 662 | // is this a new Price ? |
663 | - if ( $insert ) { |
|
663 | + if ($insert) { |
|
664 | 664 | // run the insert |
665 | - if ( $PRC_ID = $PRC->insert( $set_column_values )) { |
|
665 | + if ($PRC_ID = $PRC->insert($set_column_values)) { |
|
666 | 666 | //make sure this new price modifier is attached to the ticket but ONLY if it is not a tax type |
667 | 667 | $PR = EEM_price::instance()->get_one_by_ID($PRC_ID); |
668 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
668 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
669 | 669 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
670 | - $ticket->_add_relation_to( $PR, 'Price' ); |
|
670 | + $ticket->_add_relation_to($PR, 'Price'); |
|
671 | 671 | $ticket->save(); |
672 | 672 | } |
673 | 673 | $success = 1; |
@@ -677,29 +677,29 @@ discard block |
||
677 | 677 | } |
678 | 678 | $action_desc = 'created'; |
679 | 679 | } else { |
680 | - $PRC_ID = absint( $this->_req_data['PRC_ID'] ); |
|
680 | + $PRC_ID = absint($this->_req_data['PRC_ID']); |
|
681 | 681 | // run the update |
682 | - $where_cols_n_values = array( 'PRC_ID' => $PRC_ID ); |
|
683 | - if ( $PRC->update( $set_column_values, array($where_cols_n_values))) { |
|
682 | + $where_cols_n_values = array('PRC_ID' => $PRC_ID); |
|
683 | + if ($PRC->update($set_column_values, array($where_cols_n_values))) { |
|
684 | 684 | $success = 1; |
685 | 685 | } |
686 | 686 | |
687 | 687 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
688 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
688 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
689 | 689 | |
690 | 690 | //if this is $PRC_ID == 1, then we need to update the default ticket attached to this price so the TKT_price value is updated. |
691 | - if ( $PRC_ID === 1 ) { |
|
691 | + if ($PRC_ID === 1) { |
|
692 | 692 | $ticket = $PR->get_first_related('Ticket'); |
693 | - if ( $ticket ) { |
|
694 | - $ticket->set('TKT_price', $PR->get('PRC_amount') ); |
|
695 | - $ticket->set('TKT_name', $PR->get('PRC_name') ); |
|
693 | + if ($ticket) { |
|
694 | + $ticket->set('TKT_price', $PR->get('PRC_amount')); |
|
695 | + $ticket->set('TKT_name', $PR->get('PRC_name')); |
|
696 | 696 | $ticket->set('TKT_description', $PR->get('PRC_desc')); |
697 | 697 | $ticket->save(); |
698 | 698 | } |
699 | 699 | } else { |
700 | 700 | //we make sure this price is attached to base ticket. but ONLY if its not a tax ticket type. |
701 | 701 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
702 | - $ticket->_add_relation_to( $PRC_ID, 'Price' ); |
|
702 | + $ticket->_add_relation_to($PRC_ID, 'Price'); |
|
703 | 703 | $ticket->save(); |
704 | 704 | } |
705 | 705 | } |
@@ -707,9 +707,9 @@ discard block |
||
707 | 707 | $action_desc = 'updated'; |
708 | 708 | } |
709 | 709 | |
710 | - $query_args = array( 'action' => 'edit_price', 'id' => $PRC_ID ); |
|
710 | + $query_args = array('action' => 'edit_price', 'id' => $PRC_ID); |
|
711 | 711 | |
712 | - $this->_redirect_after_action( $success, 'Prices', $action_desc, $query_args ); |
|
712 | + $this->_redirect_after_action($success, 'Prices', $action_desc, $query_args); |
|
713 | 713 | |
714 | 714 | } |
715 | 715 | |
@@ -723,12 +723,12 @@ discard block |
||
723 | 723 | * @access protected |
724 | 724 | * @return void |
725 | 725 | */ |
726 | - protected function _trash_or_restore_price( $trash = TRUE ) { |
|
726 | + protected function _trash_or_restore_price($trash = TRUE) { |
|
727 | 727 | |
728 | 728 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
729 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
729 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
730 | 730 | |
731 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
731 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
732 | 732 | $PRC = EEM_Price::instance(); |
733 | 733 | |
734 | 734 | $success = 1; |
@@ -737,18 +737,18 @@ discard block |
||
737 | 737 | //get base ticket for updating |
738 | 738 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
739 | 739 | //Checkboxes |
740 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
740 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
741 | 741 | // if array has more than one element than success message should be plural |
742 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
742 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
743 | 743 | // cycle thru checkboxes |
744 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
745 | - if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID) ) ) { |
|
744 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
745 | + if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) { |
|
746 | 746 | $success = 0; |
747 | 747 | } else { |
748 | 748 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
749 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
749 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
750 | 750 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
751 | - if ( $PRC_deleted ) { |
|
751 | + if ($PRC_deleted) { |
|
752 | 752 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
753 | 753 | } else { |
754 | 754 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -760,14 +760,14 @@ discard block |
||
760 | 760 | |
761 | 761 | } else { |
762 | 762 | // grab single id and delete |
763 | - $PRC_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
764 | - if ( empty( $PRC_ID ) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID) ) { |
|
763 | + $PRC_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
764 | + if (empty($PRC_ID) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID)) { |
|
765 | 765 | $success = 0; |
766 | 766 | } else { |
767 | 767 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
768 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
768 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
769 | 769 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
770 | - if ( $PRC_deleted ) { |
|
770 | + if ($PRC_deleted) { |
|
771 | 771 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
772 | 772 | } else { |
773 | 773 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -781,17 +781,17 @@ discard block |
||
781 | 781 | 'action' => 'default' |
782 | 782 | ); |
783 | 783 | |
784 | - if ( $success ) { |
|
785 | - if ( $trash ) { |
|
784 | + if ($success) { |
|
785 | + if ($trash) { |
|
786 | 786 | $msg = $success == 2 ? __('The Prices have been trashed.', 'event_espresso') : __('The Price has been trashed.', 'event_espresso'); |
787 | 787 | } else { |
788 | 788 | $msg = $success == 2 ? __('The Prices have been restored.', 'event_espresso') : __('The Price has been restored.', 'event_espresso'); |
789 | 789 | } |
790 | 790 | |
791 | - EE_Error::add_success( $msg ); |
|
791 | + EE_Error::add_success($msg); |
|
792 | 792 | } |
793 | 793 | |
794 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
794 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
795 | 795 | |
796 | 796 | } |
797 | 797 | |
@@ -808,19 +808,19 @@ discard block |
||
808 | 808 | protected function _delete_price() { |
809 | 809 | |
810 | 810 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
811 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
811 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
812 | 812 | |
813 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
813 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
814 | 814 | $PRC = EEM_Price::instance(); |
815 | 815 | |
816 | 816 | $success = 1; |
817 | 817 | //Checkboxes |
818 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
818 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
819 | 819 | // if array has more than one element than success message should be plural |
820 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
820 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
821 | 821 | // cycle thru bulk action checkboxes |
822 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
823 | - if (!$PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
822 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
823 | + if ( ! $PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
824 | 824 | $success = 0; |
825 | 825 | } |
826 | 826 | } |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | |
835 | 835 | } |
836 | 836 | |
837 | - $this->_redirect_after_action( $success, 'Prices', 'deleted', array() ); |
|
837 | + $this->_redirect_after_action($success, 'Prices', 'deleted', array()); |
|
838 | 838 | |
839 | 839 | } |
840 | 840 | |
@@ -842,16 +842,16 @@ discard block |
||
842 | 842 | |
843 | 843 | |
844 | 844 | public function update_price_order() { |
845 | - $success = __( 'Price order was updated successfully.', 'event_espresso' ); |
|
845 | + $success = __('Price order was updated successfully.', 'event_espresso'); |
|
846 | 846 | |
847 | 847 | // grab our row IDs |
848 | - $row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE; |
|
848 | + $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE; |
|
849 | 849 | |
850 | - if ( is_array( $row_ids )) { |
|
851 | - for ( $i = 0; $i < count( $row_ids ); $i++ ) { |
|
850 | + if (is_array($row_ids)) { |
|
851 | + for ($i = 0; $i < count($row_ids); $i++) { |
|
852 | 852 | //Update the prices when re-ordering |
853 | 853 | $id = absint($row_ids[$i]); |
854 | - if ( EEM_Price::instance()->update ( array( 'PRC_order' => $i+1 ), array(array( 'PRC_ID' => $id ) )) === FALSE ) { |
|
854 | + if (EEM_Price::instance()->update(array('PRC_order' => $i + 1), array(array('PRC_ID' => $id))) === FALSE) { |
|
855 | 855 | $success = FALSE; |
856 | 856 | } |
857 | 857 | } |
@@ -859,9 +859,9 @@ discard block |
||
859 | 859 | $success = FALSE; |
860 | 860 | } |
861 | 861 | |
862 | - $errors = ! $success ? __( 'An error occurred. The price order was not updated.', 'event_espresso' ) : FALSE; |
|
862 | + $errors = ! $success ? __('An error occurred. The price order was not updated.', 'event_espresso') : FALSE; |
|
863 | 863 | |
864 | - echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors )); |
|
864 | + echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors)); |
|
865 | 865 | die(); |
866 | 866 | } |
867 | 867 | |
@@ -904,46 +904,46 @@ discard block |
||
904 | 904 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
905 | 905 | * @return mixed (int|array) int = count || array of price objects |
906 | 906 | */ |
907 | - public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
907 | + public function get_price_types_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
908 | 908 | |
909 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
909 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
910 | 910 | // start with an empty array |
911 | 911 | |
912 | - require_once( PRICING_ADMIN . 'Price_Types_List_Table.class.php' ); |
|
913 | - require_once( EE_MODELS . 'EEM_Price_Type.model.php' ); |
|
912 | + require_once(PRICING_ADMIN.'Price_Types_List_Table.class.php'); |
|
913 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
914 | 914 | |
915 | 915 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
916 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
916 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
917 | 917 | switch ($this->_req_data['orderby']) { |
918 | 918 | case 'name': |
919 | - $orderby = array( 'PRT_name' => $order); |
|
919 | + $orderby = array('PRT_name' => $order); |
|
920 | 920 | break; |
921 | 921 | default: |
922 | - $orderby = array( 'PRT_order' => $order); |
|
922 | + $orderby = array('PRT_order' => $order); |
|
923 | 923 | } |
924 | 924 | |
925 | 925 | |
926 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
927 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
926 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
927 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
928 | 928 | |
929 | - $offset = ($current_page-1)*$per_page; |
|
930 | - $limit = array( $offset, $per_page ); |
|
929 | + $offset = ($current_page - 1) * $per_page; |
|
930 | + $limit = array($offset, $per_page); |
|
931 | 931 | |
932 | - $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1 ) ); |
|
932 | + $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1)); |
|
933 | 933 | |
934 | - if ( isset( $this->_req_data['s'] ) ) { |
|
935 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
934 | + if (isset($this->_req_data['s'])) { |
|
935 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
936 | 936 | $_where['OR'] = array( |
937 | - 'PRT_name' => array( 'LIKE', $sstr ) |
|
937 | + 'PRT_name' => array('LIKE', $sstr) |
|
938 | 938 | ); |
939 | 939 | } |
940 | 940 | $query_params = array( |
941 | 941 | $_where, |
942 | 942 | 'order_by'=>$orderby, |
943 | 943 | 'limit'=>$limit); |
944 | - if($count){ |
|
944 | + if ($count) { |
|
945 | 945 | return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params); |
946 | - }else{ |
|
946 | + } else { |
|
947 | 947 | return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params); |
948 | 948 | } |
949 | 949 | |
@@ -963,25 +963,25 @@ discard block |
||
963 | 963 | */ |
964 | 964 | protected function _edit_price_type_details() { |
965 | 965 | |
966 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
966 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
967 | 967 | |
968 | 968 | |
969 | 969 | // grab price type ID |
970 | - $PRT_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
970 | + $PRT_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
971 | 971 | // change page title based on request action |
972 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
972 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
973 | 973 | // add PRT_ID to title if editing |
974 | - $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title . ' # ' . $PRT_ID : $this->_admin_page_title; |
|
974 | + $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title.' # '.$PRT_ID : $this->_admin_page_title; |
|
975 | 975 | |
976 | 976 | // require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
977 | 977 | |
978 | - if ( $PRT_ID ) { |
|
979 | - $price_type = EEM_Price_Type::instance()->get_one_by_ID( $PRT_ID ); |
|
980 | - $additional_hidden_fields = array( 'PRT_ID' => array( 'type' => 'hidden', 'value' => $PRT_ID )); |
|
981 | - $this->_set_add_edit_form_tags( 'update_price_type', $additional_hidden_fields ); |
|
978 | + if ($PRT_ID) { |
|
979 | + $price_type = EEM_Price_Type::instance()->get_one_by_ID($PRT_ID); |
|
980 | + $additional_hidden_fields = array('PRT_ID' => array('type' => 'hidden', 'value' => $PRT_ID)); |
|
981 | + $this->_set_add_edit_form_tags('update_price_type', $additional_hidden_fields); |
|
982 | 982 | } else { |
983 | 983 | $price_type = EEM_Price_Type::instance()->get_new_price_type(); |
984 | - $this->_set_add_edit_form_tags( 'insert_price_type' ); |
|
984 | + $this->_set_add_edit_form_tags('insert_price_type'); |
|
985 | 985 | } |
986 | 986 | |
987 | 987 | $this->_template_args['PRT_ID'] = $PRT_ID; |
@@ -990,19 +990,19 @@ discard block |
||
990 | 990 | |
991 | 991 | $base_types = EEM_Price_Type::instance()->get_base_types(); |
992 | 992 | $select_values = array(); |
993 | - foreach ( $base_types as $ref => $text ) { |
|
994 | - if ( $ref == EEM_Price_Type::base_type_base_price ) { |
|
993 | + foreach ($base_types as $ref => $text) { |
|
994 | + if ($ref == EEM_Price_Type::base_type_base_price) { |
|
995 | 995 | //do not allow creation of base_type_base_prices because that's a system only base type. |
996 | 996 | continue; |
997 | 997 | } |
998 | - $values[] = array( 'id' => $ref, 'text' => $text ); |
|
998 | + $values[] = array('id' => $ref, 'text' => $text); |
|
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | |
1002 | 1002 | $this->_template_args['base_type_select'] = EEH_Form_Fields::select_input('base_type', $values, $price_type->base_type(), 'id="price-type-base-type-slct"'); |
1003 | 1003 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
1004 | - $redirect_URL = add_query_arg( array( 'action' => 'price_types'), $this->_admin_base_url ); |
|
1005 | - $this->_set_publish_post_box_vars( 'id', $PRT_ID, FALSE, $redirect_URL ); |
|
1004 | + $redirect_URL = add_query_arg(array('action' => 'price_types'), $this->_admin_base_url); |
|
1005 | + $this->_set_publish_post_box_vars('id', $PRT_ID, FALSE, $redirect_URL); |
|
1006 | 1006 | // the details template wrapper |
1007 | 1007 | $this->display_admin_page_with_sidebar(); |
1008 | 1008 | |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | * @return void |
1020 | 1020 | */ |
1021 | 1021 | protected function _price_type_details_meta_boxes() { |
1022 | - add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1022 | + add_meta_box('edit-price-details-mbox', __('Price Type Details', 'event_espresso'), array($this, '_edit_price_type_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1023 | 1023 | } |
1024 | 1024 | |
1025 | 1025 | |
@@ -1032,7 +1032,7 @@ discard block |
||
1032 | 1032 | * @return void |
1033 | 1033 | */ |
1034 | 1034 | public function _edit_price_type_details_meta_box() { |
1035 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
1035 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
1036 | 1036 | } |
1037 | 1037 | |
1038 | 1038 | |
@@ -1045,9 +1045,9 @@ discard block |
||
1045 | 1045 | */ |
1046 | 1046 | protected function set_price_type_column_values() { |
1047 | 1047 | |
1048 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1048 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1049 | 1049 | |
1050 | - $base_type = !empty( $this->_req_data['base_type'] ) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1050 | + $base_type = ! empty($this->_req_data['base_type']) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1051 | 1051 | |
1052 | 1052 | switch ($base_type) { |
1053 | 1053 | |
@@ -1094,12 +1094,12 @@ discard block |
||
1094 | 1094 | * @access protected |
1095 | 1095 | * @return void |
1096 | 1096 | */ |
1097 | - protected function _insert_or_update_price_type( $new_price_type = FALSE ) { |
|
1097 | + protected function _insert_or_update_price_type($new_price_type = FALSE) { |
|
1098 | 1098 | |
1099 | 1099 | // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1100 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1100 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1101 | 1101 | |
1102 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1102 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1103 | 1103 | $PRT = EEM_Price_Type::instance(); |
1104 | 1104 | |
1105 | 1105 | // why be so pessimistic ??? : ( |
@@ -1107,24 +1107,24 @@ discard block |
||
1107 | 1107 | |
1108 | 1108 | $set_column_values = $this->set_price_type_column_values(); |
1109 | 1109 | // is this a new Price ? |
1110 | - if ( $new_price_type ) { |
|
1110 | + if ($new_price_type) { |
|
1111 | 1111 | // run the insert |
1112 | - if ( $PRT_ID = $PRT->insert( $set_column_values )) { |
|
1112 | + if ($PRT_ID = $PRT->insert($set_column_values)) { |
|
1113 | 1113 | $success = 1; |
1114 | 1114 | } |
1115 | 1115 | $action_desc = 'created'; |
1116 | 1116 | } else { |
1117 | 1117 | $PRT_ID = absint($this->_req_data['PRT_ID']); |
1118 | 1118 | // run the update |
1119 | - $where_cols_n_values = array('PRT_ID' => $PRT_ID ); |
|
1120 | - if ( $PRT->update( $set_column_values, array( $where_cols_n_values ))) { |
|
1119 | + $where_cols_n_values = array('PRT_ID' => $PRT_ID); |
|
1120 | + if ($PRT->update($set_column_values, array($where_cols_n_values))) { |
|
1121 | 1121 | $success = 1; |
1122 | 1122 | } |
1123 | 1123 | $action_desc = 'updated'; |
1124 | 1124 | } |
1125 | 1125 | |
1126 | - $query_args = array( 'action'=> 'edit_price_type', 'id' => $PRT_ID ); |
|
1127 | - $this->_redirect_after_action( $success, 'Price Type', $action_desc, $query_args ); |
|
1126 | + $query_args = array('action'=> 'edit_price_type', 'id' => $PRT_ID); |
|
1127 | + $this->_redirect_after_action($success, 'Price Type', $action_desc, $query_args); |
|
1128 | 1128 | |
1129 | 1129 | } |
1130 | 1130 | |
@@ -1138,49 +1138,49 @@ discard block |
||
1138 | 1138 | * @access protected |
1139 | 1139 | * @return void |
1140 | 1140 | */ |
1141 | - protected function _trash_or_restore_price_type( $trash = TRUE ) { |
|
1141 | + protected function _trash_or_restore_price_type($trash = TRUE) { |
|
1142 | 1142 | |
1143 | 1143 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1144 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1144 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1145 | 1145 | |
1146 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1146 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1147 | 1147 | $PRT = EEM_Price_Type::instance(); |
1148 | 1148 | |
1149 | 1149 | $success = 1; |
1150 | 1150 | $PRT_deleted = $trash ? TRUE : FALSE; |
1151 | 1151 | //Checkboxes |
1152 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1152 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1153 | 1153 | // if array has more than one element than success message should be plural |
1154 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1155 | - $what = count( $this->_req_data['checkbox'] ) > 1 ? 'Price Types' : 'Price Type'; |
|
1154 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1155 | + $what = count($this->_req_data['checkbox']) > 1 ? 'Price Types' : 'Price Type'; |
|
1156 | 1156 | // cycle thru checkboxes |
1157 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1158 | - if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID ) ) { |
|
1157 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1158 | + if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1159 | 1159 | $success = 0; |
1160 | 1160 | } |
1161 | 1161 | } |
1162 | 1162 | |
1163 | 1163 | } else { |
1164 | 1164 | // grab single id and delete |
1165 | - $PRT_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
1166 | - if ( empty( $PRT_ID ) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID )) { |
|
1165 | + $PRT_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
1166 | + if (empty($PRT_ID) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1167 | 1167 | $success = 0; |
1168 | 1168 | } |
1169 | 1169 | $what = 'Price Type'; |
1170 | 1170 | |
1171 | 1171 | } |
1172 | 1172 | |
1173 | - $query_args = array( 'action' => 'price_types' ); |
|
1174 | - if ( $success ) { |
|
1175 | - if ( $trash ) { |
|
1173 | + $query_args = array('action' => 'price_types'); |
|
1174 | + if ($success) { |
|
1175 | + if ($trash) { |
|
1176 | 1176 | $msg = $success > 1 ? __('The Price Types have been trashed.', 'event_espresso') : __('The Price Type has been trashed.', 'event_espresso'); |
1177 | 1177 | } else { |
1178 | 1178 | $msg = $success > 1 ? __('The Price Types have been restored.', 'event_espresso') : __('The Price Type has been restored.', 'event_espresso'); |
1179 | 1179 | } |
1180 | - EE_Error::add_success( $msg ); |
|
1180 | + EE_Error::add_success($msg); |
|
1181 | 1181 | } |
1182 | 1182 | |
1183 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
1183 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
1184 | 1184 | |
1185 | 1185 | } |
1186 | 1186 | |
@@ -1197,19 +1197,19 @@ discard block |
||
1197 | 1197 | protected function _delete_price_type() { |
1198 | 1198 | |
1199 | 1199 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1200 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1200 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1201 | 1201 | |
1202 | 1202 | $PRT = EEM_Price_Type::instance(); |
1203 | 1203 | |
1204 | 1204 | $success = 1; |
1205 | 1205 | //Checkboxes |
1206 | - if (!empty($this->_req_data['checkbox'])) { |
|
1206 | + if ( ! empty($this->_req_data['checkbox'])) { |
|
1207 | 1207 | // if array has more than one element than success message should be plural |
1208 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1208 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1209 | 1209 | $what = $PRT->item_name($success); |
1210 | 1210 | // cycle thru bulk action checkboxes |
1211 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1212 | - if (!$PRT->delete_permanently_by_ID($PRT_ID) ) { |
|
1211 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1212 | + if ( ! $PRT->delete_permanently_by_ID($PRT_ID)) { |
|
1213 | 1213 | $success = 0; |
1214 | 1214 | } |
1215 | 1215 | } |
@@ -1217,8 +1217,8 @@ discard block |
||
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | |
1220 | - $query_args = array( 'action'=> 'price_types' ); |
|
1221 | - $this->_redirect_after_action( $success, $what, 'deleted', $query_args ); |
|
1220 | + $query_args = array('action'=> 'price_types'); |
|
1221 | + $this->_redirect_after_action($success, $what, 'deleted', $query_args); |
|
1222 | 1222 | |
1223 | 1223 | } |
1224 | 1224 | |
@@ -1234,7 +1234,7 @@ discard block |
||
1234 | 1234 | * @return string |
1235 | 1235 | */ |
1236 | 1236 | protected function _learn_more_about_pricing_link() { |
1237 | - return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>'; |
|
1237 | + return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how pricing works', 'event_espresso').'</a>'; |
|
1238 | 1238 | } |
1239 | 1239 | |
1240 | 1240 |
@@ -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']); |
@@ -296,13 +296,13 @@ discard block |
||
296 | 296 | * @param EEI_Payment $payment |
297 | 297 | * @return array cleaned |
298 | 298 | */ |
299 | - private function _log_clean_response($response,$payment){ |
|
299 | + private function _log_clean_response($response, $payment) { |
|
300 | 300 | unset($response['REQUESTDATA']['CREDITCARDTYPE']); |
301 | 301 | unset($response['REQUESTDATA']['ACCT']); |
302 | 302 | unset($response['REQUESTDATA']['EXPDATE']); |
303 | 303 | unset($response['REQUESTDATA']['CVV2']); |
304 | 304 | unset($response['RAWREQUEST']); |
305 | - $this->log(array('Paypal Response'=>$response),$payment); |
|
305 | + $this->log(array('Paypal Response'=>$response), $payment); |
|
306 | 306 | return $response; |
307 | 307 | } |
308 | 308 | |
@@ -327,32 +327,32 @@ discard block |
||
327 | 327 | // DP Fields |
328 | 328 | $DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array(); |
329 | 329 | foreach ($DPFields as $DPFieldsVar => $DPFieldsVal) |
330 | - $DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal); |
|
330 | + $DPFieldsNVP .= '&'.strtoupper($DPFieldsVar).'='.urlencode($DPFieldsVal); |
|
331 | 331 | |
332 | 332 | // CC Details Fields |
333 | 333 | $CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array(); |
334 | 334 | foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal) |
335 | - $CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal); |
|
335 | + $CCDetailsNVP .= '&'.strtoupper($CCDetailsVar).'='.urlencode($CCDetailsVal); |
|
336 | 336 | |
337 | 337 | // PayerInfo Type Fields |
338 | 338 | $PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array(); |
339 | 339 | foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal) |
340 | - $PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal); |
|
340 | + $PayerInfoNVP .= '&'.strtoupper($PayerInfoVar).'='.urlencode($PayerInfoVal); |
|
341 | 341 | |
342 | 342 | // Payer Name Fields |
343 | 343 | $PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array(); |
344 | 344 | foreach ($PayerName as $PayerNameVar => $PayerNameVal) |
345 | - $PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal); |
|
345 | + $PayerNameNVP .= '&'.strtoupper($PayerNameVar).'='.urlencode($PayerNameVal); |
|
346 | 346 | |
347 | 347 | // Address Fields (Billing) |
348 | 348 | $BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array(); |
349 | 349 | foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal) |
350 | - $BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal); |
|
350 | + $BillingAddressNVP .= '&'.strtoupper($BillingAddressVar).'='.urlencode($BillingAddressVal); |
|
351 | 351 | |
352 | 352 | // Payment Details Type Fields |
353 | 353 | $PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array(); |
354 | 354 | foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal) |
355 | - $PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal); |
|
355 | + $PaymentDetailsNVP .= '&'.strtoupper($PaymentDetailsVar).'='.urlencode($PaymentDetailsVal); |
|
356 | 356 | |
357 | 357 | // Payment Details Item Type Fields |
358 | 358 | $OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array(); |
@@ -360,22 +360,22 @@ discard block |
||
360 | 360 | foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) { |
361 | 361 | $CurrentItem = $OrderItems[$OrderItemsVar]; |
362 | 362 | foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal) |
363 | - $OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal); |
|
363 | + $OrderItemsNVP .= '&'.strtoupper($CurrentItemVar).$n.'='.urlencode($CurrentItemVal); |
|
364 | 364 | $n++; |
365 | 365 | } |
366 | 366 | |
367 | 367 | // Ship To Address Fields |
368 | 368 | $ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array(); |
369 | 369 | foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal) |
370 | - $ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal); |
|
370 | + $ShippingAddressNVP .= '&'.strtoupper($ShippingAddressVar).'='.urlencode($ShippingAddressVal); |
|
371 | 371 | |
372 | 372 | // 3D Secure Fields |
373 | 373 | $Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array(); |
374 | 374 | foreach ($Secure3D as $Secure3DVar => $Secure3DVal) |
375 | - $Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal); |
|
375 | + $Secure3DNVP .= '&'.strtoupper($Secure3DVar).'='.urlencode($Secure3DVal); |
|
376 | 376 | |
377 | 377 | // Now that we have each chunk we need to go ahead and append them all together for our entire NVP string |
378 | - $NVPRequest = 'USER=' . $this->_username . '&PWD=' . $this->_password . '&VERSION=64.0' . '&SIGNATURE=' . $this->_signature . $DPFieldsNVP . $CCDetailsNVP . $PayerInfoNVP . $PayerNameNVP . $BillingAddressNVP . $PaymentDetailsNVP . $OrderItemsNVP . $ShippingAddressNVP . $Secure3DNVP; |
|
378 | + $NVPRequest = 'USER='.$this->_username.'&PWD='.$this->_password.'&VERSION=64.0'.'&SIGNATURE='.$this->_signature.$DPFieldsNVP.$CCDetailsNVP.$PayerInfoNVP.$PayerNameNVP.$BillingAddressNVP.$PaymentDetailsNVP.$OrderItemsNVP.$ShippingAddressNVP.$Secure3DNVP; |
|
379 | 379 | $NVPResponse = $this->_CURLRequest($NVPRequest); |
380 | 380 | $NVPRequestArray = $this->_NVPToArray($NVPRequest); |
381 | 381 | $NVPResponseArray = $this->_NVPToArray($NVPResponse); |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | private function _CURLRequest($Request) { |
400 | 400 | $EndPointURL = $this->_debug_mode ? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp'; |
401 | 401 | $curl = curl_init(); |
402 | - curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE ) ); |
|
402 | + curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE)); |
|
403 | 403 | curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); |
404 | 404 | curl_setopt($curl, CURLOPT_TIMEOUT, 60); |
405 | 405 | curl_setopt($curl, CURLOPT_URL, $EndPointURL); |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | private function _APICallSuccessful($PayPalResult) { |
450 | 450 | $approved = false; |
451 | 451 | // check main response message from PayPal |
452 | - if (isset($PayPalResult['ACK']) && !empty($PayPalResult['ACK'])) { |
|
452 | + if (isset($PayPalResult['ACK']) && ! empty($PayPalResult['ACK'])) { |
|
453 | 453 | $ack = strtoupper($PayPalResult['ACK']); |
454 | - $approved = ( $ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS' ) ? true : false; |
|
454 | + $approved = ($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS') ? true : false; |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | return $approved; |
@@ -467,11 +467,11 @@ discard block |
||
467 | 467 | |
468 | 468 | $Errors = array(); |
469 | 469 | $n = 0; |
470 | - while (isset($DataArray['L_ERRORCODE' . $n . ''])) { |
|
471 | - $LErrorCode = isset($DataArray['L_ERRORCODE' . $n . '']) ? $DataArray['L_ERRORCODE' . $n . ''] : ''; |
|
472 | - $LShortMessage = isset($DataArray['L_SHORTMESSAGE' . $n . '']) ? $DataArray['L_SHORTMESSAGE' . $n . ''] : ''; |
|
473 | - $LLongMessage = isset($DataArray['L_LONGMESSAGE' . $n . '']) ? $DataArray['L_LONGMESSAGE' . $n . ''] : ''; |
|
474 | - $LSeverityCode = isset($DataArray['L_SEVERITYCODE' . $n . '']) ? $DataArray['L_SEVERITYCODE' . $n . ''] : ''; |
|
470 | + while (isset($DataArray['L_ERRORCODE'.$n.''])) { |
|
471 | + $LErrorCode = isset($DataArray['L_ERRORCODE'.$n.'']) ? $DataArray['L_ERRORCODE'.$n.''] : ''; |
|
472 | + $LShortMessage = isset($DataArray['L_SHORTMESSAGE'.$n.'']) ? $DataArray['L_SHORTMESSAGE'.$n.''] : ''; |
|
473 | + $LLongMessage = isset($DataArray['L_LONGMESSAGE'.$n.'']) ? $DataArray['L_LONGMESSAGE'.$n.''] : ''; |
|
474 | + $LSeverityCode = isset($DataArray['L_SEVERITYCODE'.$n.'']) ? $DataArray['L_SEVERITYCODE'.$n.''] : ''; |
|
475 | 475 | |
476 | 476 | $CurrentItem = array( |
477 | 477 | 'L_ERRORCODE' => $LErrorCode, |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | elseif ($CurrentErrorVar == 'L_SEVERITYCODE') |
512 | 512 | $CurrentVarName = 'Severity Code'; |
513 | 513 | |
514 | - $error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal; |
|
514 | + $error .= '<br />'.$CurrentVarName.': '.$CurrentErrorVal; |
|
515 | 515 | } |
516 | 516 | } |
517 | 517 | return $error; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @return EED_Event_Single |
41 | 41 | */ |
42 | 42 | public static function instance() { |
43 | - return parent::get_instance( __CLASS__ ); |
|
43 | + return parent::get_instance(__CLASS__); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @return void |
53 | 53 | */ |
54 | 54 | public static function set_hooks() { |
55 | - add_filter( 'FHEE_run_EE_wp', '__return_true' ); |
|
56 | - add_action( 'wp_loaded', array( 'EED_Event_Single', 'set_definitions' ), 2 ); |
|
57 | - EE_Config::register_route( __( 'event', 'event_espresso' ), 'Event_Single', 'run' ); |
|
55 | + add_filter('FHEE_run_EE_wp', '__return_true'); |
|
56 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
57 | + EE_Config::register_route(__('event', 'event_espresso'), 'Event_Single', 'run'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return void |
65 | 65 | */ |
66 | 66 | public static function set_hooks_admin() { |
67 | - add_action( 'wp_loaded', array( 'EED_Event_Single', 'set_definitions' ), 2 ); |
|
67 | + add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | * @return void |
79 | 79 | */ |
80 | 80 | public static function set_definitions() { |
81 | - define( 'EVENT_SINGLE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
82 | - define( 'EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path( __FILE__ ) . 'templates' . DS ); |
|
81 | + define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
82 | + define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @void |
91 | 91 | */ |
92 | - protected function set_config(){ |
|
93 | - $this->set_config_section( 'template_settings' ); |
|
94 | - $this->set_config_class( 'EE_Event_Single_Config' ); |
|
95 | - $this->set_config_name( 'EED_Event_Single' ); |
|
92 | + protected function set_config() { |
|
93 | + $this->set_config_section('template_settings'); |
|
94 | + $this->set_config_class('EE_Event_Single_Config'); |
|
95 | + $this->set_config_name('EED_Event_Single'); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -105,35 +105,35 @@ discard block |
||
105 | 105 | * @param \EE_Event_Single_Config $config |
106 | 106 | * @return \EE_Template_Part_Manager |
107 | 107 | */ |
108 | - public function initialize_template_parts( EE_Event_Single_Config $config = null ) { |
|
108 | + public function initialize_template_parts(EE_Event_Single_Config $config = null) { |
|
109 | 109 | $config = $config instanceof EE_Event_Single_Config ? $config : $this->config(); |
110 | 110 | EEH_Autoloader::instance()->register_template_part_autoloaders(); |
111 | 111 | $template_parts = new EE_Template_Part_Manager(); |
112 | 112 | $template_parts->add_template_part( |
113 | 113 | 'tickets', |
114 | - __( 'Ticket Selector', 'event_espresso' ), |
|
114 | + __('Ticket Selector', 'event_espresso'), |
|
115 | 115 | 'content-espresso_events-tickets.php', |
116 | 116 | $config->display_order_tickets |
117 | 117 | ); |
118 | 118 | $template_parts->add_template_part( |
119 | 119 | 'datetimes', |
120 | - __( 'Dates and Times', 'event_espresso' ), |
|
120 | + __('Dates and Times', 'event_espresso'), |
|
121 | 121 | 'content-espresso_events-datetimes.php', |
122 | 122 | $config->display_order_datetimes |
123 | 123 | ); |
124 | 124 | $template_parts->add_template_part( |
125 | 125 | 'event', |
126 | - __( 'Event Description', 'event_espresso' ), |
|
126 | + __('Event Description', 'event_espresso'), |
|
127 | 127 | 'content-espresso_events-details.php', |
128 | 128 | $config->display_order_event |
129 | 129 | ); |
130 | 130 | $template_parts->add_template_part( |
131 | 131 | 'venue', |
132 | - __( 'Venue Information', 'event_espresso' ), |
|
132 | + __('Venue Information', 'event_espresso'), |
|
133 | 133 | 'content-espresso_events-venues.php', |
134 | 134 | $config->display_order_venue |
135 | 135 | ); |
136 | - do_action( 'AHEE__EED_Event_Single__initialize_template_parts', $template_parts ); |
|
136 | + do_action('AHEE__EED_Event_Single__initialize_template_parts', $template_parts); |
|
137 | 137 | return $template_parts; |
138 | 138 | } |
139 | 139 | |
@@ -147,15 +147,15 @@ discard block |
||
147 | 147 | * @param WP $WP |
148 | 148 | * @return void |
149 | 149 | */ |
150 | - public function run( $WP ) { |
|
150 | + public function run($WP) { |
|
151 | 151 | // ensure valid EE_Events_Single_Config() object exists |
152 | 152 | $this->set_config(); |
153 | 153 | // check what template is loaded |
154 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
155 | - add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
154 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
155 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
156 | 156 | // load css |
157 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
158 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
157 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
158 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
@@ -167,26 +167,26 @@ discard block |
||
167 | 167 | * @param string $template |
168 | 168 | * @return string |
169 | 169 | */ |
170 | - public function template_include( $template ) { |
|
170 | + public function template_include($template) { |
|
171 | 171 | global $post; |
172 | 172 | /** @type EE_Event_Single_Config $config */ |
173 | 173 | $config = $this->config(); |
174 | - if ( $config->display_status_banner_single ) { |
|
175 | - add_filter( 'the_title', array( 'EED_Event_Single', 'the_title' ), 100, 2 ); |
|
174 | + if ($config->display_status_banner_single) { |
|
175 | + add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2); |
|
176 | 176 | } |
177 | 177 | // not a custom template? |
178 | 178 | if ( |
179 | 179 | EE_Front_Controller::instance()->get_selected_template() != 'single-espresso_events.php' |
180 | - && ! post_password_required( $post ) |
|
180 | + && ! post_password_required($post) |
|
181 | 181 | ) { |
182 | 182 | EEH_Template::load_espresso_theme_functions(); |
183 | 183 | // then add extra event data via hooks |
184 | - add_action( 'loop_start', array( 'EED_Event_Single', 'loop_start' )); |
|
185 | - add_filter( 'get_the_excerpt', array( 'EED_Event_Single', 'get_the_excerpt' ), 1, 1 ); |
|
186 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
187 | - add_action( 'loop_end', array( 'EED_Event_Single', 'loop_end' )); |
|
184 | + add_action('loop_start', array('EED_Event_Single', 'loop_start')); |
|
185 | + add_filter('get_the_excerpt', array('EED_Event_Single', 'get_the_excerpt'), 1, 1); |
|
186 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
187 | + add_action('loop_end', array('EED_Event_Single', 'loop_end')); |
|
188 | 188 | // don't display entry meta because the existing theme will take car of that |
189 | - add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
189 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
190 | 190 | } |
191 | 191 | return $template; |
192 | 192 | } |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | * @param array $wp_query_array an array containing the WP_Query object |
201 | 201 | * @return void |
202 | 202 | */ |
203 | - public static function loop_start( $wp_query_array ) { |
|
203 | + public static function loop_start($wp_query_array) { |
|
204 | 204 | global $post; |
205 | - do_action( 'AHEE_event_details_before_post', $post, $wp_query_array ); |
|
205 | + do_action('AHEE_event_details_before_post', $post, $wp_query_array); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | * @param int $id |
216 | 216 | * @return string |
217 | 217 | */ |
218 | - public static function the_title( $title = '', $id = 0 ) { |
|
218 | + public static function the_title($title = '', $id = 0) { |
|
219 | 219 | global $post; |
220 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
|
220 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | |
@@ -229,9 +229,9 @@ discard block |
||
229 | 229 | * @param string $excerpt |
230 | 230 | * @return string |
231 | 231 | */ |
232 | - public static function get_the_excerpt( $excerpt = '' ) { |
|
232 | + public static function get_the_excerpt($excerpt = '') { |
|
233 | 233 | EED_Event_Single::$using_get_the_excerpt = true; |
234 | - add_filter( 'wp_trim_excerpt', array( 'EED_Event_Single', 'end_get_the_excerpt' ), 999, 1 ); |
|
234 | + add_filter('wp_trim_excerpt', array('EED_Event_Single', 'end_get_the_excerpt'), 999, 1); |
|
235 | 235 | return $excerpt; |
236 | 236 | } |
237 | 237 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * @param string $text |
245 | 245 | * @return string |
246 | 246 | */ |
247 | - public static function end_get_the_excerpt( $text = '' ) { |
|
247 | + public static function end_get_the_excerpt($text = '') { |
|
248 | 248 | EED_Event_Single::$using_get_the_excerpt = false; |
249 | 249 | return $text; |
250 | 250 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * @param string $content |
259 | 259 | * @return string |
260 | 260 | */ |
261 | - public static function event_details( $content ) { |
|
261 | + public static function event_details($content) { |
|
262 | 262 | global $post; |
263 | 263 | static $current_post_ID = 0; |
264 | 264 | if ( |
@@ -273,15 +273,15 @@ discard block |
||
273 | 273 | // We want to allow those plugins to still do their thing and have access to our content, but depending on |
274 | 274 | // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
275 | 275 | // so the following allows this filter to be applied multiple times, but only once for real |
276 | - $current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0; |
|
277 | - if ( EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order ) { |
|
276 | + $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
277 | + if (EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order) { |
|
278 | 278 | // we need to first remove this callback from being applied to the_content() |
279 | 279 | // (otherwise it will recurse and blow up the interweb) |
280 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
280 | + remove_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
281 | 281 | EED_Event_Single::instance()->template_parts = EED_Event_Single::instance()->initialize_template_parts(); |
282 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
283 | - $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters( $content ); |
|
284 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
282 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
283 | + $content = EED_Event_Single::instance()->template_parts->apply_template_part_filters($content); |
|
284 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
285 | 285 | } else { |
286 | 286 | $content = EED_Event_Single::use_filterable_display_order(); |
287 | 287 | } |
@@ -302,19 +302,19 @@ discard block |
||
302 | 302 | // it uses the_content() for displaying the $post->post_content |
303 | 303 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
304 | 304 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
305 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
305 | + remove_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
306 | 306 | //now add additional content |
307 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110, 1 ); |
|
308 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120, 1 ); |
|
309 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_venues' ), 130, 1 ); |
|
310 | - do_action( 'AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters' ); |
|
307 | + add_filter('the_content', array('EED_Event_Single', 'event_datetimes'), 110, 1); |
|
308 | + add_filter('the_content', array('EED_Event_Single', 'event_tickets'), 120, 1); |
|
309 | + add_filter('the_content', array('EED_Event_Single', 'event_venues'), 130, 1); |
|
310 | + do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters'); |
|
311 | 311 | // now load our template |
312 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
312 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
313 | 313 | //now add our filter back in, plus some others |
314 | - add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 ); |
|
315 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110 ); |
|
316 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120 ); |
|
317 | - remove_filter( 'the_content', array( 'EED_Event_Single', 'event_venues' ), 130 ); |
|
314 | + add_filter('the_content', array('EED_Event_Single', 'event_details'), 100); |
|
315 | + remove_filter('the_content', array('EED_Event_Single', 'event_datetimes'), 110); |
|
316 | + remove_filter('the_content', array('EED_Event_Single', 'event_tickets'), 120); |
|
317 | + remove_filter('the_content', array('EED_Event_Single', 'event_venues'), 130); |
|
318 | 318 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
319 | 319 | return $content; |
320 | 320 | } |
@@ -328,8 +328,8 @@ discard block |
||
328 | 328 | * @param string $content |
329 | 329 | * @return string |
330 | 330 | */ |
331 | - public static function event_datetimes( $content ) { |
|
332 | - return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content; |
|
331 | + public static function event_datetimes($content) { |
|
332 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | * @param string $content |
342 | 342 | * @return string |
343 | 343 | */ |
344 | - public static function event_tickets( $content ) { |
|
345 | - return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content; |
|
344 | + public static function event_tickets($content) { |
|
345 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | * @param string $content |
355 | 355 | * @return string |
356 | 356 | */ |
357 | - public static function event_venue( $content ) { |
|
358 | - return EED_Event_Single::event_venues( $content ); |
|
357 | + public static function event_venue($content) { |
|
358 | + return EED_Event_Single::event_venues($content); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | |
@@ -367,8 +367,8 @@ discard block |
||
367 | 367 | * @param string $content |
368 | 368 | * @return string |
369 | 369 | */ |
370 | - public static function event_venues( $content ) { |
|
371 | - return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' ); |
|
370 | + public static function event_venues($content) { |
|
371 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | |
@@ -380,9 +380,9 @@ discard block |
||
380 | 380 | * @param array $wp_query_array an array containing the WP_Query object |
381 | 381 | * @return void |
382 | 382 | */ |
383 | - public static function loop_end( $wp_query_array ) { |
|
383 | + public static function loop_end($wp_query_array) { |
|
384 | 384 | global $post; |
385 | - do_action( 'AHEE_event_details_after_post', $post, $wp_query_array ); |
|
385 | + do_action('AHEE_event_details_after_post', $post, $wp_query_array); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -395,18 +395,18 @@ discard block |
||
395 | 395 | */ |
396 | 396 | public function wp_enqueue_scripts() { |
397 | 397 | // get some style |
398 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && apply_filters( 'FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE )) { |
|
399 | - EE_Registry::instance()->load_helper( 'File' ); |
|
398 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE)) { |
|
399 | + EE_Registry::instance()->load_helper('File'); |
|
400 | 400 | // first check uploads folder |
401 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
402 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
401 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
402 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
403 | 403 | } else { |
404 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
404 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
405 | 405 | } |
406 | - wp_enqueue_script( $this->theme ); |
|
407 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
408 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
409 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
406 | + wp_enqueue_script($this->theme); |
|
407 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
408 | + EE_Registry::instance()->load_helper('Maps'); |
|
409 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
410 | 410 | } |
411 | 411 | } |
412 | 412 | } |
@@ -425,12 +425,12 @@ discard block |
||
425 | 425 | * @return bool |
426 | 426 | */ |
427 | 427 | public static function display_venue() { |
428 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
428 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
429 | 429 | /** @type EE_Event_Single_Config $config */ |
430 | 430 | $config = EED_Event_Single::instance()->config(); |
431 | - $display_venue= isset( $config->display_venue ) ? $config->display_venue : TRUE; |
|
431 | + $display_venue = isset($config->display_venue) ? $config->display_venue : TRUE; |
|
432 | 432 | $venue_name = EEH_Venue_View::venue_name(); |
433 | - return $display_venue && ! empty( $venue_name ) ? TRUE : FALSE; |
|
433 | + return $display_venue && ! empty($venue_name) ? TRUE : FALSE; |
|
434 | 434 | } |
435 | 435 | |
436 | 436 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return EED_Events_Archive |
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 | |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | * @return void |
56 | 56 | */ |
57 | 57 | public static function set_hooks() { |
58 | - EE_Config::register_route( EE_Registry::instance()->CFG->core->event_cpt_slug, 'Events_Archive', 'run' ); |
|
59 | - EE_Config::register_route( 'event_list', 'Events_Archive', 'event_list' ); |
|
60 | - add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
|
58 | + EE_Config::register_route(EE_Registry::instance()->CFG->core->event_cpt_slug, 'Events_Archive', 'run'); |
|
59 | + EE_Config::register_route('event_list', 'Events_Archive', 'event_list'); |
|
60 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @return void |
68 | 68 | */ |
69 | 69 | public static function set_hooks_admin() { |
70 | - add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
|
70 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | public static function set_definitions() { |
83 | - define( 'EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
84 | - define( 'EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
83 | + define('EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
84 | + define('EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return \EE_Events_Archive_Config |
93 | 93 | */ |
94 | - protected function set_config(){ |
|
95 | - $this->set_config_section( 'template_settings' ); |
|
96 | - $this->set_config_class( 'EE_Events_Archive_Config' ); |
|
97 | - $this->set_config_name( 'EED_Events_Archive' ); |
|
94 | + protected function set_config() { |
|
95 | + $this->set_config_section('template_settings'); |
|
96 | + $this->set_config_class('EE_Events_Archive_Config'); |
|
97 | + $this->set_config_name('EED_Events_Archive'); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -106,35 +106,35 @@ discard block |
||
106 | 106 | * @param \EE_Events_Archive_Config $config |
107 | 107 | * @return \EE_Template_Part_Manager |
108 | 108 | */ |
109 | - public function initialize_template_parts( EE_Events_Archive_Config $config = null ) { |
|
109 | + public function initialize_template_parts(EE_Events_Archive_Config $config = null) { |
|
110 | 110 | $config = $config instanceof EE_Events_Archive_Config ? $config : $this->config(); |
111 | 111 | EEH_Autoloader::instance()->register_template_part_autoloaders(); |
112 | 112 | $template_parts = new EE_Template_Part_Manager(); |
113 | 113 | $template_parts->add_template_part( |
114 | 114 | 'tickets', |
115 | - __( 'Ticket Selector', 'event_espresso' ), |
|
115 | + __('Ticket Selector', 'event_espresso'), |
|
116 | 116 | 'content-espresso_events-tickets.php', |
117 | 117 | $config->display_order_tickets |
118 | 118 | ); |
119 | 119 | $template_parts->add_template_part( |
120 | 120 | 'datetimes', |
121 | - __( 'Dates and Times', 'event_espresso' ), |
|
121 | + __('Dates and Times', 'event_espresso'), |
|
122 | 122 | 'content-espresso_events-datetimes.php', |
123 | 123 | $config->display_order_datetimes |
124 | 124 | ); |
125 | 125 | $template_parts->add_template_part( |
126 | 126 | 'event', |
127 | - __( 'Event Description', 'event_espresso' ), |
|
127 | + __('Event Description', 'event_espresso'), |
|
128 | 128 | 'content-espresso_events-details.php', |
129 | 129 | $config->display_order_event |
130 | 130 | ); |
131 | 131 | $template_parts->add_template_part( |
132 | 132 | 'venue', |
133 | - __( 'Venue Information', 'event_espresso' ), |
|
133 | + __('Venue Information', 'event_espresso'), |
|
134 | 134 | 'content-espresso_events-venues.php', |
135 | 135 | $config->display_order_venue |
136 | 136 | ); |
137 | - do_action( 'AHEE__EED_Event_Archive__initialize_template_parts', $template_parts ); |
|
137 | + do_action('AHEE__EED_Event_Archive__initialize_template_parts', $template_parts); |
|
138 | 138 | return $template_parts; |
139 | 139 | } |
140 | 140 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @param WP $WP |
148 | 148 | * @return void |
149 | 149 | */ |
150 | - public function run( $WP ) { |
|
151 | - do_action( 'AHEE__EED_Events_Archive__before_run' ); |
|
150 | + public function run($WP) { |
|
151 | + do_action('AHEE__EED_Events_Archive__before_run'); |
|
152 | 152 | // ensure valid EE_Events_Archive_Config() object exists |
153 | 153 | $this->set_config(); |
154 | 154 | /** @type EE_Events_Archive_Config $config */ |
@@ -156,19 +156,19 @@ discard block |
||
156 | 156 | // load other required components |
157 | 157 | $this->load_event_list_assets(); |
158 | 158 | // filter the WP posts_join, posts_where, and posts_orderby SQL clauses |
159 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
159 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
160 | 160 | //add query filters |
161 | 161 | EEH_Event_Query::add_query_filters(); |
162 | 162 | // set params that will get used by the filters |
163 | 163 | EEH_Event_Query::set_query_params( |
164 | - '', // month |
|
165 | - '', // category |
|
166 | - $config->display_expired_events, // show_expired |
|
167 | - 'start_date', // orderby |
|
164 | + '', // month |
|
165 | + '', // category |
|
166 | + $config->display_expired_events, // show_expired |
|
167 | + 'start_date', // orderby |
|
168 | 168 | 'ASC' // sort |
169 | 169 | ); |
170 | 170 | // check what template is loaded |
171 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
171 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
@@ -200,30 +200,30 @@ discard block |
||
200 | 200 | * @param string $template |
201 | 201 | * @return string |
202 | 202 | */ |
203 | - public function template_include( $template = '' ) { |
|
203 | + public function template_include($template = '') { |
|
204 | 204 | // don't add content filter for dedicated EE child themes or private posts |
205 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
206 | - if ( ! EEH_Template::is_espresso_theme() ) { |
|
205 | + EE_Registry::instance()->load_helper('Template'); |
|
206 | + if ( ! EEH_Template::is_espresso_theme()) { |
|
207 | 207 | /** @type EE_Events_Archive_Config $config */ |
208 | 208 | $config = $this->config(); |
209 | 209 | // add status banner ? |
210 | - if ( $config->display_status_banner ) { |
|
211 | - add_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100, 2 ); |
|
210 | + if ($config->display_status_banner) { |
|
211 | + add_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2); |
|
212 | 212 | } |
213 | 213 | // if NOT a custom template |
214 | - if ( EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php' ) { |
|
214 | + if (EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php') { |
|
215 | 215 | // don't display entry meta because the existing theme will take care of that |
216 | - add_filter( 'FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true' ); |
|
216 | + add_filter('FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true'); |
|
217 | 217 | // load functions.php file for the theme (loaded by WP if using child theme) |
218 | 218 | EEH_Template::load_espresso_theme_functions(); |
219 | 219 | // because we don't know if the theme is using the_excerpt() |
220 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
220 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
221 | 221 | // or the_content |
222 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
222 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
223 | 223 | // and just in case they are running get_the_excerpt() which DESTROYS things |
224 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
224 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
225 | 225 | // don't display entry meta because the existing theme will take care of that |
226 | - add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
226 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | return $template; |
@@ -238,17 +238,17 @@ discard block |
||
238 | 238 | * @param string $excerpt |
239 | 239 | * @return string |
240 | 240 | */ |
241 | - public static function get_the_excerpt( $excerpt = '' ) { |
|
242 | - if ( post_password_required() ) { |
|
241 | + public static function get_the_excerpt($excerpt = '') { |
|
242 | + if (post_password_required()) { |
|
243 | 243 | return $excerpt; |
244 | 244 | } |
245 | - if ( apply_filters( 'FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false ) ) { |
|
246 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
247 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
248 | - $excerpt = EED_Events_Archive::event_details( $excerpt ); |
|
245 | + if (apply_filters('FHEE__EED_Events_Archive__get_the_excerpt__theme_uses_get_the_excerpt', false)) { |
|
246 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
247 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
248 | + $excerpt = EED_Events_Archive::event_details($excerpt); |
|
249 | 249 | } else { |
250 | 250 | EED_Events_Archive::$using_get_the_excerpt = true; |
251 | - add_filter( 'wp_trim_excerpt', array( 'EED_Events_Archive', 'end_get_the_excerpt' ), 999, 1 ); |
|
251 | + add_filter('wp_trim_excerpt', array('EED_Events_Archive', 'end_get_the_excerpt'), 999, 1); |
|
252 | 252 | } |
253 | 253 | return $excerpt; |
254 | 254 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @param string $text |
263 | 263 | * @return string |
264 | 264 | */ |
265 | - public static function end_get_the_excerpt( $text = '' ) { |
|
265 | + public static function end_get_the_excerpt($text = '') { |
|
266 | 266 | EED_Events_Archive::$using_get_the_excerpt = false; |
267 | 267 | return $text; |
268 | 268 | } |
@@ -277,10 +277,10 @@ discard block |
||
277 | 277 | * @param string $id |
278 | 278 | * @return string |
279 | 279 | */ |
280 | - public static function the_title( $title = '', $id = '' ) { |
|
280 | + public static function the_title($title = '', $id = '') { |
|
281 | 281 | global $post; |
282 | - if ( $post instanceof WP_Post ) { |
|
283 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
|
282 | + if ($post instanceof WP_Post) { |
|
283 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
284 | 284 | } |
285 | 285 | return $title; |
286 | 286 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * @param string $content |
295 | 295 | * @return string |
296 | 296 | */ |
297 | - public static function event_details( $content ) { |
|
297 | + public static function event_details($content) { |
|
298 | 298 | global $post; |
299 | 299 | static $current_post_ID = 0; |
300 | 300 | if ( |
@@ -303,8 +303,8 @@ discard block |
||
303 | 303 | && ! EED_Events_Archive::$using_get_the_excerpt |
304 | 304 | && ! post_password_required() |
305 | 305 | && ( |
306 | - apply_filters( 'FHEE__EES_Espresso_Events__process_shortcode__true', false ) |
|
307 | - || ! apply_filters( 'FHEE__content_espresso_events__template_loaded', false ) |
|
306 | + apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', false) |
|
307 | + || ! apply_filters('FHEE__content_espresso_events__template_loaded', false) |
|
308 | 308 | ) |
309 | 309 | ) { |
310 | 310 | // Set current post ID to prevent showing content twice, but only if headers have definitely been sent. |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | // We want to allow those plugins to still do their thing and have access to our content, but depending on |
314 | 314 | // how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice, |
315 | 315 | // so the following allows this filter to be applied multiple times, but only once for real |
316 | - $current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0; |
|
317 | - if ( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order ) { |
|
316 | + $current_post_ID = did_action('loop_start') ? $post->ID : 0; |
|
317 | + if (EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->use_sortable_display_order) { |
|
318 | 318 | $content = \EED_Events_Archive::use_sortable_display_order(); |
319 | 319 | } else { |
320 | 320 | $content = \EED_Events_Archive::use_filterable_display_order(); |
@@ -333,20 +333,20 @@ discard block |
||
333 | 333 | */ |
334 | 334 | protected static function use_sortable_display_order() { |
335 | 335 | // no further password checks required atm |
336 | - add_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' ); |
|
336 | + add_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true'); |
|
337 | 337 | // we need to first remove this callback from being applied to the_content() or the_excerpt() (otherwise it will recurse and blow up the interweb) |
338 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
339 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
340 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
|
338 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
339 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
340 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); |
|
341 | 341 | // now add additional content depending on whether event is using the_excerpt() or the_content() |
342 | 342 | EED_Events_Archive::instance()->template_parts = EED_Events_Archive::instance()->initialize_template_parts(); |
343 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
344 | - $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters( $content ); |
|
343 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
344 | + $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters($content); |
|
345 | 345 | // re-add our main filters (or else the next event won't have them) |
346 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
347 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
348 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
349 | - remove_filter( 'FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true' ); |
|
346 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
347 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
348 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
349 | + remove_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true'); |
|
350 | 350 | return $content; |
351 | 351 | } |
352 | 352 | |
@@ -361,22 +361,22 @@ discard block |
||
361 | 361 | protected static function use_filterable_display_order() { |
362 | 362 | // we need to first remove this callback from being applied to the_content() |
363 | 363 | // (otherwise it will recurse and blow up the interweb) |
364 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
365 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
366 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
|
364 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
365 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
366 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); |
|
367 | 367 | //now add additional content depending on whether event is using the_excerpt() or the_content() |
368 | 368 | EED_Events_Archive::_add_additional_excerpt_filters(); |
369 | 369 | EED_Events_Archive::_add_additional_content_filters(); |
370 | - do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters' ); |
|
370 | + do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters'); |
|
371 | 371 | // now load our template |
372 | - $content = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
372 | + $content = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
373 | 373 | // re-add our main filters (or else the next event won't have them) |
374 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
375 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
376 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
374 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
375 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
376 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
377 | 377 | // but remove the other filters so that they don't get applied to the next post |
378 | 378 | EED_Events_Archive::_remove_additional_events_archive_filters(); |
379 | - do_action( 'AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters' ); |
|
379 | + do_action('AHEE__EED_Events_Archive__use_filterable_display_order__after_remove_filters'); |
|
380 | 380 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
381 | 381 | //return ! empty( $template ) ? $template : $content; |
382 | 382 | return $content; |
@@ -391,11 +391,11 @@ discard block |
||
391 | 391 | * @param string $content |
392 | 392 | * @return string |
393 | 393 | */ |
394 | - public static function event_datetimes( $content ) { |
|
395 | - if ( post_password_required() ) { |
|
394 | + public static function event_datetimes($content) { |
|
395 | + if (post_password_required()) { |
|
396 | 396 | return $content; |
397 | 397 | } |
398 | - return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content; |
|
398 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | /** |
@@ -405,11 +405,11 @@ discard block |
||
405 | 405 | * @param string $content |
406 | 406 | * @return string |
407 | 407 | */ |
408 | - public static function event_tickets( $content ) { |
|
409 | - if ( post_password_required() ) { |
|
408 | + public static function event_tickets($content) { |
|
409 | + if (post_password_required()) { |
|
410 | 410 | return $content; |
411 | 411 | } |
412 | - return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content; |
|
412 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | |
@@ -421,8 +421,8 @@ discard block |
||
421 | 421 | * @param string $content |
422 | 422 | * @return string |
423 | 423 | */ |
424 | - public static function event_venue( $content ) { |
|
425 | - return EED_Events_Archive::event_venues( $content ); |
|
424 | + public static function event_venue($content) { |
|
425 | + return EED_Events_Archive::event_venues($content); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | /** |
@@ -432,11 +432,11 @@ discard block |
||
432 | 432 | * @param string $content |
433 | 433 | * @return string |
434 | 434 | */ |
435 | - public static function event_venues( $content ) { |
|
436 | - if ( post_password_required() ) { |
|
435 | + public static function event_venues($content) { |
|
436 | + if (post_password_required()) { |
|
437 | 437 | return $content; |
438 | 438 | } |
439 | - return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' ); |
|
439 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | |
@@ -448,9 +448,9 @@ discard block |
||
448 | 448 | * @return void |
449 | 449 | */ |
450 | 450 | private static function _add_additional_excerpt_filters() { |
451 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
452 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
453 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
451 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
452 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
453 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
454 | 454 | } |
455 | 455 | |
456 | 456 | |
@@ -462,9 +462,9 @@ discard block |
||
462 | 462 | * @return void |
463 | 463 | */ |
464 | 464 | private static function _add_additional_content_filters() { |
465 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
466 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
467 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
465 | + add_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
466 | + add_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
467 | + add_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | |
@@ -476,12 +476,12 @@ discard block |
||
476 | 476 | * @return void |
477 | 477 | */ |
478 | 478 | private static function _remove_additional_events_archive_filters() { |
479 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
480 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
481 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
482 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
483 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
484 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
479 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
480 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120); |
|
481 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130); |
|
482 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
483 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120); |
|
484 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | |
@@ -494,17 +494,17 @@ discard block |
||
494 | 494 | */ |
495 | 495 | public static function remove_all_events_archive_filters() { |
496 | 496 | //remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1 ); |
497 | - remove_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100 ); |
|
498 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
499 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
500 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
501 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
502 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100 ); |
|
503 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110 ); |
|
504 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120 ); |
|
505 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130 ); |
|
497 | + remove_filter('the_title', array('EED_Events_Archive', 'the_title'), 100); |
|
498 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); |
|
499 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
500 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120); |
|
501 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130); |
|
502 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); |
|
503 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110); |
|
504 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120); |
|
505 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130); |
|
506 | 506 | // don't display entry meta because the existing theme will take care of that |
507 | - remove_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
507 | + remove_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | |
@@ -519,15 +519,15 @@ discard block |
||
519 | 519 | * @return void |
520 | 520 | */ |
521 | 521 | public function load_event_list_assets() { |
522 | - do_action( 'AHEE__EED_Events_Archive__before_load_assets' ); |
|
523 | - add_filter( 'FHEE_load_EE_Session', '__return_true' ); |
|
524 | - add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
525 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
526 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
527 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
528 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
522 | + do_action('AHEE__EED_Events_Archive__before_load_assets'); |
|
523 | + add_filter('FHEE_load_EE_Session', '__return_true'); |
|
524 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
525 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
526 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
527 | + EE_Registry::instance()->load_helper('Maps'); |
|
528 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
529 | 529 | } |
530 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
530 | + EE_Registry::instance()->load_helper('Event_View'); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | |
@@ -543,14 +543,14 @@ discard block |
||
543 | 543 | */ |
544 | 544 | public function wp_enqueue_scripts() { |
545 | 545 | // get some style |
546 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', FALSE ) ) { |
|
546 | + if (apply_filters('FHEE_enable_default_espresso_css', FALSE)) { |
|
547 | 547 | // first check uploads folder |
548 | - EE_Registry::instance()->load_helper( 'File' ); |
|
549 | - if ( EEH_File::is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
550 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
548 | + EE_Registry::instance()->load_helper('File'); |
|
549 | + if (EEH_File::is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
550 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
551 | 551 | } else { |
552 | 552 | } |
553 | - wp_enqueue_style( $this->theme ); |
|
553 | + wp_enqueue_style($this->theme); |
|
554 | 554 | |
555 | 555 | } |
556 | 556 | } |
@@ -568,8 +568,8 @@ discard block |
||
568 | 568 | */ |
569 | 569 | public static function template_settings_form() { |
570 | 570 | $template_settings = EE_Registry::instance()->CFG->template_settings; |
571 | - $template_settings->EED_Events_Archive = isset( $template_settings->EED_Events_Archive ) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
572 | - $template_settings->EED_Events_Archive = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive ); |
|
571 | + $template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
572 | + $template_settings->EED_Events_Archive = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive); |
|
573 | 573 | $events_archive_settings = array( |
574 | 574 | 'display_status_banner' => 0, |
575 | 575 | 'display_description' => 1, |
@@ -578,8 +578,8 @@ discard block |
||
578 | 578 | 'display_venue' => 0, |
579 | 579 | 'display_expired_events' => 0 |
580 | 580 | ); |
581 | - $events_archive_settings = array_merge( $events_archive_settings, (array)$template_settings->EED_Events_Archive ); |
|
582 | - EEH_Template::display_template( EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $events_archive_settings ); |
|
581 | + $events_archive_settings = array_merge($events_archive_settings, (array) $template_settings->EED_Events_Archive); |
|
582 | + EEH_Template::display_template(EVENTS_ARCHIVE_TEMPLATES_PATH.'admin-event-list-settings.template.php', $events_archive_settings); |
|
583 | 583 | } |
584 | 584 | |
585 | 585 | |
@@ -595,16 +595,16 @@ discard block |
||
595 | 595 | * @param EE_Request_Handler $REQ |
596 | 596 | * @return EE_Template_Config |
597 | 597 | */ |
598 | - public static function update_template_settings( $CFG, $REQ ) { |
|
598 | + public static function update_template_settings($CFG, $REQ) { |
|
599 | 599 | $CFG->EED_Events_Archive = new EE_Events_Archive_Config(); |
600 | 600 | // unless we are resetting the config... |
601 | - if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) { |
|
602 | - $CFG->EED_Events_Archive->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0; |
|
603 | - $CFG->EED_Events_Archive->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1; |
|
604 | - $CFG->EED_Events_Archive->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0; |
|
605 | - $CFG->EED_Events_Archive->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1; |
|
606 | - $CFG->EED_Events_Archive->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0; |
|
607 | - $CFG->EED_Events_Archive->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; } |
|
601 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) { |
|
602 | + $CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
603 | + $CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
604 | + $CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
605 | + $CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1; |
|
606 | + $CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0; |
|
607 | + $CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; } |
|
608 | 608 | return $CFG; |
609 | 609 | } |
610 | 610 | |
@@ -617,10 +617,10 @@ discard block |
||
617 | 617 | * @param string $extra_class |
618 | 618 | * @return string |
619 | 619 | */ |
620 | - public static function event_list_css( $extra_class = '' ) { |
|
621 | - $event_list_css = ! empty( $extra_class ) ? array( $extra_class ) : array(); |
|
620 | + public static function event_list_css($extra_class = '') { |
|
621 | + $event_list_css = ! empty($extra_class) ? array($extra_class) : array(); |
|
622 | 622 | $event_list_css[] = 'espresso-event-list-event'; |
623 | - return implode( ' ', $event_list_css ); |
|
623 | + return implode(' ', $event_list_css); |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | |
@@ -647,9 +647,9 @@ discard block |
||
647 | 647 | * @param $value |
648 | 648 | * @return bool |
649 | 649 | */ |
650 | - public static function display_description( $value ) { |
|
650 | + public static function display_description($value) { |
|
651 | 651 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
652 | - $display_description= isset( $config->display_description ) ? $config->display_description : 1; |
|
652 | + $display_description = isset($config->display_description) ? $config->display_description : 1; |
|
653 | 653 | return $display_description === $value ? TRUE : FALSE; |
654 | 654 | } |
655 | 655 | |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | */ |
663 | 663 | public static function display_ticket_selector() { |
664 | 664 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
665 | - return isset( $config->display_ticket_selector ) && $config->display_ticket_selector ? TRUE : FALSE; |
|
665 | + return isset($config->display_ticket_selector) && $config->display_ticket_selector ? TRUE : FALSE; |
|
666 | 666 | } |
667 | 667 | |
668 | 668 | |
@@ -674,9 +674,9 @@ discard block |
||
674 | 674 | * @return bool |
675 | 675 | */ |
676 | 676 | public static function display_venue() { |
677 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
677 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
678 | 678 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
679 | - return isset( $config->display_venue ) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
679 | + return isset($config->display_venue) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
680 | 680 | } |
681 | 681 | |
682 | 682 | |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | */ |
689 | 689 | public static function display_datetimes() { |
690 | 690 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
691 | - return isset( $config->display_datetimes ) && $config->display_datetimes ? TRUE : FALSE; |
|
691 | + return isset($config->display_datetimes) && $config->display_datetimes ? TRUE : FALSE; |
|
692 | 692 | } |
693 | 693 | |
694 | 694 | |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | * @return string |
704 | 704 | */ |
705 | 705 | public static function event_list_title() { |
706 | - return apply_filters( 'FHEE__archive_espresso_events_template__upcoming_events_h1', __( 'Upcoming Events', 'event_espresso' )); |
|
706 | + return apply_filters('FHEE__archive_espresso_events_template__upcoming_events_h1', __('Upcoming Events', 'event_espresso')); |
|
707 | 707 | } |
708 | 708 | |
709 | 709 | |
@@ -712,11 +712,11 @@ discard block |
||
712 | 712 | /** |
713 | 713 | * @since 4.4.0 |
714 | 714 | */ |
715 | - public static function _doing_it_wrong_notice( $function = '' ) { |
|
715 | + public static function _doing_it_wrong_notice($function = '') { |
|
716 | 716 | EE_Error::doing_it_wrong( |
717 | 717 | __FUNCTION__, |
718 | 718 | sprintf( |
719 | - __( 'EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso' ), |
|
719 | + __('EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso'), |
|
720 | 720 | $function, |
721 | 721 | '<br />', |
722 | 722 | '4.6.0' |
@@ -732,107 +732,107 @@ discard block |
||
732 | 732 | * @since 4.4.0 |
733 | 733 | */ |
734 | 734 | public function get_post_data() { |
735 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
735 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
736 | 736 | EEH_Event_Query::set_query_params(); |
737 | 737 | } |
738 | 738 | /** |
739 | 739 | * @deprecated |
740 | 740 | * @since 4.4.0 |
741 | 741 | */ |
742 | - public function posts_fields( $SQL, WP_Query $wp_query ) { |
|
743 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
744 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
745 | - return EEH_Event_Query::posts_fields( $SQL, $wp_query ); |
|
742 | + public function posts_fields($SQL, WP_Query $wp_query) { |
|
743 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
744 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
745 | + return EEH_Event_Query::posts_fields($SQL, $wp_query); |
|
746 | 746 | } |
747 | 747 | /** |
748 | 748 | * @deprecated |
749 | 749 | * @since 4.4.0 |
750 | 750 | */ |
751 | - public static function posts_fields_sql_for_orderby( $orderby_params = array() ) { |
|
752 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
753 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
754 | - return EEH_Event_Query::posts_fields_sql_for_orderby( $orderby_params ); |
|
751 | + public static function posts_fields_sql_for_orderby($orderby_params = array()) { |
|
752 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
753 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
754 | + return EEH_Event_Query::posts_fields_sql_for_orderby($orderby_params); |
|
755 | 755 | } |
756 | 756 | /** |
757 | 757 | * @deprecated |
758 | 758 | * @since 4.4.0 |
759 | 759 | */ |
760 | - public function posts_join( $SQL, WP_Query $wp_query ) { |
|
761 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
762 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
763 | - return EEH_Event_Query::posts_join( $SQL, $wp_query ); |
|
760 | + public function posts_join($SQL, WP_Query $wp_query) { |
|
761 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
762 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
763 | + return EEH_Event_Query::posts_join($SQL, $wp_query); |
|
764 | 764 | } |
765 | 765 | /** |
766 | 766 | * @deprecated |
767 | 767 | * @since 4.4.0 |
768 | 768 | */ |
769 | - public static function posts_join_sql_for_terms( $join_terms = NULL ) { |
|
770 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
771 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
772 | - return EEH_Event_Query::posts_join_sql_for_terms( $join_terms ); |
|
769 | + public static function posts_join_sql_for_terms($join_terms = NULL) { |
|
770 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
771 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
772 | + return EEH_Event_Query::posts_join_sql_for_terms($join_terms); |
|
773 | 773 | } |
774 | 774 | /** |
775 | 775 | * @deprecated |
776 | 776 | * @since 4.4.0 |
777 | 777 | */ |
778 | - public static function posts_join_for_orderby( $orderby_params = array() ) { |
|
779 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
780 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
781 | - return EEH_Event_Query::posts_join_for_orderby( $orderby_params ); |
|
778 | + public static function posts_join_for_orderby($orderby_params = array()) { |
|
779 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
780 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
781 | + return EEH_Event_Query::posts_join_for_orderby($orderby_params); |
|
782 | 782 | } |
783 | 783 | /** |
784 | 784 | * @deprecated |
785 | 785 | * @since 4.4.0 |
786 | 786 | */ |
787 | - public function posts_where( $SQL, WP_Query $wp_query ) { |
|
788 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
789 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
790 | - return EEH_Event_Query::posts_where( $SQL, $wp_query ); |
|
787 | + public function posts_where($SQL, WP_Query $wp_query) { |
|
788 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
789 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
790 | + return EEH_Event_Query::posts_where($SQL, $wp_query); |
|
791 | 791 | } |
792 | 792 | /** |
793 | 793 | * @deprecated |
794 | 794 | * @since 4.4.0 |
795 | 795 | */ |
796 | - public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) { |
|
797 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
798 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
799 | - return EEH_Event_Query::posts_where_sql_for_show_expired( $show_expired ); |
|
796 | + public static function posts_where_sql_for_show_expired($show_expired = FALSE) { |
|
797 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
798 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
799 | + return EEH_Event_Query::posts_where_sql_for_show_expired($show_expired); |
|
800 | 800 | } |
801 | 801 | /** |
802 | 802 | * @deprecated |
803 | 803 | * @since 4.4.0 |
804 | 804 | */ |
805 | - public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) { |
|
806 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
807 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
808 | - return EEH_Event_Query::posts_where_sql_for_event_category_slug( $event_category_slug ); |
|
805 | + public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) { |
|
806 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
807 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
808 | + return EEH_Event_Query::posts_where_sql_for_event_category_slug($event_category_slug); |
|
809 | 809 | } |
810 | 810 | /** |
811 | 811 | * @deprecated |
812 | 812 | * @since 4.4.0 |
813 | 813 | */ |
814 | - public static function posts_where_sql_for_event_list_month( $month = NULL ) { |
|
815 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
816 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
817 | - return EEH_Event_Query::posts_where_sql_for_event_list_month( $month ); |
|
814 | + public static function posts_where_sql_for_event_list_month($month = NULL) { |
|
815 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
816 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
817 | + return EEH_Event_Query::posts_where_sql_for_event_list_month($month); |
|
818 | 818 | } |
819 | 819 | /** |
820 | 820 | * @deprecated |
821 | 821 | * @since 4.4.0 |
822 | 822 | */ |
823 | - public function posts_orderby( $SQL, WP_Query $wp_query ) { |
|
824 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
825 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
826 | - return EEH_Event_Query::posts_orderby( $SQL, $wp_query ); |
|
823 | + public function posts_orderby($SQL, WP_Query $wp_query) { |
|
824 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
825 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
826 | + return EEH_Event_Query::posts_orderby($SQL, $wp_query); |
|
827 | 827 | } |
828 | 828 | /** |
829 | 829 | * @deprecated |
830 | 830 | * @since 4.4.0 |
831 | 831 | */ |
832 | - public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) { |
|
833 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
834 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
835 | - return EEH_Event_Query::posts_orderby_sql( $orderby_params, $sort ); |
|
832 | + public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') { |
|
833 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
834 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
835 | + return EEH_Event_Query::posts_orderby_sql($orderby_params, $sort); |
|
836 | 836 | } |
837 | 837 | |
838 | 838 | |
@@ -863,8 +863,8 @@ discard block |
||
863 | 863 | * @param string $extra_class |
864 | 864 | * @return string |
865 | 865 | */ |
866 | -function espresso_event_list_css( $extra_class = '' ) { |
|
867 | - return EED_Events_Archive::event_list_css( $extra_class ); |
|
866 | +function espresso_event_list_css($extra_class = '') { |
|
867 | + return EED_Events_Archive::event_list_css($extra_class); |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | /** |
@@ -878,14 +878,14 @@ discard block |
||
878 | 878 | * @return bool |
879 | 879 | */ |
880 | 880 | function espresso_display_full_description_in_event_list() { |
881 | - return EED_Events_Archive::display_description( 2 ); |
|
881 | + return EED_Events_Archive::display_description(2); |
|
882 | 882 | } |
883 | 883 | |
884 | 884 | /** |
885 | 885 | * @return bool |
886 | 886 | */ |
887 | 887 | function espresso_display_excerpt_in_event_list() { |
888 | - return EED_Events_Archive::display_description( 1 ); |
|
888 | + return EED_Events_Archive::display_description(1); |
|
889 | 889 | } |
890 | 890 | |
891 | 891 | /** |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
2 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * |
@@ -21,60 +21,60 @@ discard block |
||
21 | 21 | * Please instead use the EEM_Attendee::system_question_* constants |
22 | 22 | * @deprecated |
23 | 23 | */ |
24 | - const fname_question_id=1; |
|
24 | + const fname_question_id = 1; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * @deprecated |
28 | 28 | */ |
29 | - const lname_question_id=2; |
|
29 | + const lname_question_id = 2; |
|
30 | 30 | |
31 | 31 | |
32 | 32 | /** |
33 | 33 | * @deprecated |
34 | 34 | */ |
35 | - const email_question_id=3; |
|
35 | + const email_question_id = 3; |
|
36 | 36 | |
37 | 37 | |
38 | 38 | /** |
39 | 39 | * @deprecated |
40 | 40 | */ |
41 | - const address_question_id=4; |
|
41 | + const address_question_id = 4; |
|
42 | 42 | |
43 | 43 | |
44 | 44 | /** |
45 | 45 | * @deprecated |
46 | 46 | */ |
47 | - const address2_question_id=5; |
|
47 | + const address2_question_id = 5; |
|
48 | 48 | |
49 | 49 | |
50 | 50 | /** |
51 | 51 | * @deprecated |
52 | 52 | */ |
53 | - const city_question_id=6; |
|
53 | + const city_question_id = 6; |
|
54 | 54 | |
55 | 55 | |
56 | 56 | /** |
57 | 57 | * @deprecated |
58 | 58 | */ |
59 | - const state_question_id=7; |
|
59 | + const state_question_id = 7; |
|
60 | 60 | |
61 | 61 | |
62 | 62 | /** |
63 | 63 | * @deprecated |
64 | 64 | */ |
65 | - const country_question_id=8; |
|
65 | + const country_question_id = 8; |
|
66 | 66 | |
67 | 67 | |
68 | 68 | /** |
69 | 69 | * @deprecated |
70 | 70 | */ |
71 | - const zip_question_id=9; |
|
71 | + const zip_question_id = 9; |
|
72 | 72 | |
73 | 73 | |
74 | 74 | /** |
75 | 75 | * @deprecated |
76 | 76 | */ |
77 | - const phone_question_id=10; |
|
77 | + const phone_question_id = 10; |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * When looking for questions that correspond to attendee fields, |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | * @access protected |
120 | 120 | * @param null $timezone |
121 | 121 | */ |
122 | - protected function __construct( $timezone = NULL ) { |
|
123 | - $this->singular_item = __('Attendee','event_espresso'); |
|
124 | - $this->plural_item = __('Attendees','event_espresso'); |
|
122 | + protected function __construct($timezone = NULL) { |
|
123 | + $this->singular_item = __('Attendee', 'event_espresso'); |
|
124 | + $this->plural_item = __('Attendees', 'event_espresso'); |
|
125 | 125 | $this->_tables = array( |
126 | 126 | 'Attendee_CPT'=> new EE_Primary_Table('posts', 'ID'), |
127 | 127 | 'Attendee_Meta'=>new EE_Secondary_Table('esp_attendee_meta', 'ATTM_ID', 'ATT_ID') |
@@ -135,37 +135,37 @@ discard block |
||
135 | 135 | 'ATT_created'=>new EE_Datetime_Field('post_date', __("Time Attendee Created", "event_espresso"), false, time()), |
136 | 136 | 'ATT_short_bio'=>new EE_Simple_HTML_Field('post_excerpt', __("Attendee Short Biography", "event_espresso"), true, __("No Biography Provided", "event_espresso")), |
137 | 137 | 'ATT_modified'=>new EE_Datetime_Field('post_modified', __("Time Attendee Last Modified", "event_espresso"), FALSE, time()), |
138 | - 'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false ), |
|
138 | + 'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false), |
|
139 | 139 | 'ATT_parent'=>new EE_DB_Only_Int_Field('post_parent', __("Parent Attendee (unused)", "event_espresso"), false, 0), |
140 | - 'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'),// EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'), |
|
140 | + 'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'), // EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'), |
|
141 | 141 | 'status' => new EE_WP_Post_Status_Field('post_status', __('Attendee Status', 'event_espresso'), false, 'publish') |
142 | 142 | ), |
143 | 143 | 'Attendee_Meta'=>array( |
144 | - 'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID','event_espresso'), false), |
|
144 | + 'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID', 'event_espresso'), false), |
|
145 | 145 | 'ATT_ID_fk'=>new EE_DB_Only_Int_Field('ATT_ID', __("Foreign Key to Attendee in Post Table", "event_espresso"), false), |
146 | - 'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name','event_espresso'), true, ''), |
|
147 | - 'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name','event_espresso'), true, ''), |
|
148 | - 'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1','event_espresso'), true, ''), |
|
149 | - 'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2','event_espresso'), true, ''), |
|
150 | - 'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City','event_espresso'), true, ''), |
|
151 | - 'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State','event_espresso'), true,0,'State'), |
|
152 | - 'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country','event_espresso'), true,'','Country'), |
|
153 | - 'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code','event_espresso'), true, ''), |
|
154 | - 'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address','event_espresso'), true, ''), |
|
155 | - 'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone','event_espresso'), true, '') |
|
146 | + 'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name', 'event_espresso'), true, ''), |
|
147 | + 'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name', 'event_espresso'), true, ''), |
|
148 | + 'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1', 'event_espresso'), true, ''), |
|
149 | + 'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2', 'event_espresso'), true, ''), |
|
150 | + 'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City', 'event_espresso'), true, ''), |
|
151 | + 'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State', 'event_espresso'), true, 0, 'State'), |
|
152 | + 'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country', 'event_espresso'), true, '', 'Country'), |
|
153 | + 'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code', 'event_espresso'), true, ''), |
|
154 | + 'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address', 'event_espresso'), true, ''), |
|
155 | + 'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone', 'event_espresso'), true, '') |
|
156 | 156 | )); |
157 | 157 | $this->_model_relations = array( |
158 | 158 | 'Registration'=>new EE_Has_Many_Relation(), |
159 | 159 | 'State'=>new EE_Belongs_To_Relation(), |
160 | 160 | 'Country'=>new EE_Belongs_To_Relation(), |
161 | - 'Event'=>new EE_HABTM_Relation('Registration', FALSE ), |
|
161 | + 'Event'=>new EE_HABTM_Relation('Registration', FALSE), |
|
162 | 162 | 'WP_User' => new EE_Belongs_To_Relation(), |
163 | - 'Message' => new EE_Has_Many_Any_Relation( false ) //allow deletion of attendees even if they have messages in the queue for them. |
|
163 | + 'Message' => new EE_Has_Many_Any_Relation(false) //allow deletion of attendees even if they have messages in the queue for them. |
|
164 | 164 | ); |
165 | 165 | require_once('strategies/EE_CPT_Where_Conditions.strategy.php'); |
166 | 166 | $this->_default_where_conditions_strategy = new EE_CPT_Where_Conditions('espresso_attendees', 'ATTM_ID'); |
167 | 167 | $this->_caps_slug = 'contacts'; |
168 | - parent::__construct( $timezone ); |
|
168 | + parent::__construct($timezone); |
|
169 | 169 | |
170 | 170 | } |
171 | 171 | |
@@ -175,8 +175,8 @@ discard block |
||
175 | 175 | * @param string $system_question_string |
176 | 176 | * @return string|null if not found |
177 | 177 | */ |
178 | - public function get_attendee_field_for_system_question( $system_question_string ) { |
|
179 | - return isset( $this->_system_question_to_attendee_field_name[ $system_question_string ] ) ? $this->_system_question_to_attendee_field_name[ $system_question_string ] : null; |
|
178 | + public function get_attendee_field_for_system_question($system_question_string) { |
|
179 | + return isset($this->_system_question_to_attendee_field_name[$system_question_string]) ? $this->_system_question_to_attendee_field_name[$system_question_string] : null; |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -187,8 +187,8 @@ discard block |
||
187 | 187 | * @param EE_Transaction/int $transaction_id_or_obj EE_Transaction or its ID |
188 | 188 | * @return EE_Attendee[] |
189 | 189 | */ |
190 | - public function get_attendees_for_transaction( $transaction_id_or_obj ){ |
|
191 | - return $this->get_all( array( array( |
|
190 | + public function get_attendees_for_transaction($transaction_id_or_obj) { |
|
191 | + return $this->get_all(array(array( |
|
192 | 192 | 'Registration.Transaction.TXN_ID' => $transaction_id_or_obj instanceof EE_Transaction ? $transaction_id_or_obj->ID() : $transaction_id_or_obj |
193 | 193 | ))); |
194 | 194 | } |
@@ -203,9 +203,9 @@ discard block |
||
203 | 203 | * @return mixed array on success, FALSE on fail |
204 | 204 | * @deprecated |
205 | 205 | */ |
206 | - public function get_attendee_by_ID( $ATT_ID = FALSE ) { |
|
206 | + public function get_attendee_by_ID($ATT_ID = FALSE) { |
|
207 | 207 | // retrieve a particular EE_Attendee |
208 | - return $this->get_one_by_ID( $ATT_ID ); |
|
208 | + return $this->get_one_by_ID($ATT_ID); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -218,14 +218,14 @@ discard block |
||
218 | 218 | * @param array $where_cols_n_values |
219 | 219 | * @return mixed array on success, FALSE on fail |
220 | 220 | */ |
221 | - public function get_attendee( $where_cols_n_values = array() ) { |
|
221 | + public function get_attendee($where_cols_n_values = array()) { |
|
222 | 222 | |
223 | - if ( empty( $where_cols_n_values )) { |
|
223 | + if (empty($where_cols_n_values)) { |
|
224 | 224 | return FALSE; |
225 | 225 | } |
226 | - $attendee = $this->get_all( array($where_cols_n_values )); |
|
227 | - if ( ! empty( $attendee )) { |
|
228 | - return array_shift( $attendee ); |
|
226 | + $attendee = $this->get_all(array($where_cols_n_values)); |
|
227 | + if ( ! empty($attendee)) { |
|
228 | + return array_shift($attendee); |
|
229 | 229 | } else { |
230 | 230 | return FALSE; |
231 | 231 | } |
@@ -241,20 +241,20 @@ discard block |
||
241 | 241 | * @param array $where_cols_n_values |
242 | 242 | * @return bool|mixed |
243 | 243 | */ |
244 | - public function find_existing_attendee( $where_cols_n_values = NULL ) { |
|
244 | + public function find_existing_attendee($where_cols_n_values = NULL) { |
|
245 | 245 | // search by combo of first and last names plus the email address |
246 | - $attendee_data_keys = array( 'ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email ); |
|
246 | + $attendee_data_keys = array('ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email); |
|
247 | 247 | // no search params means attendee object already exists. |
248 | - $where_cols_n_values = is_array( $where_cols_n_values ) && ! empty( $where_cols_n_values ) ? $where_cols_n_values : $attendee_data_keys; |
|
248 | + $where_cols_n_values = is_array($where_cols_n_values) && ! empty($where_cols_n_values) ? $where_cols_n_values : $attendee_data_keys; |
|
249 | 249 | $valid_data = TRUE; |
250 | 250 | // check for required values |
251 | - $valid_data = isset( $where_cols_n_values['ATT_fname'] ) && ! empty( $where_cols_n_values['ATT_fname'] ) ? $valid_data : FALSE; |
|
252 | - $valid_data = isset( $where_cols_n_values['ATT_lname'] ) && ! empty( $where_cols_n_values['ATT_lname'] ) ? $valid_data : FALSE; |
|
253 | - $valid_data = isset( $where_cols_n_values['ATT_email'] ) && ! empty( $where_cols_n_values['ATT_email'] ) ? $valid_data : FALSE; |
|
251 | + $valid_data = isset($where_cols_n_values['ATT_fname']) && ! empty($where_cols_n_values['ATT_fname']) ? $valid_data : FALSE; |
|
252 | + $valid_data = isset($where_cols_n_values['ATT_lname']) && ! empty($where_cols_n_values['ATT_lname']) ? $valid_data : FALSE; |
|
253 | + $valid_data = isset($where_cols_n_values['ATT_email']) && ! empty($where_cols_n_values['ATT_email']) ? $valid_data : FALSE; |
|
254 | 254 | |
255 | - if ( $valid_data ) { |
|
256 | - $attendee = $this->get_attendee( $where_cols_n_values ); |
|
257 | - if ( $attendee instanceof EE_Attendee ) { |
|
255 | + if ($valid_data) { |
|
256 | + $attendee = $this->get_attendee($where_cols_n_values); |
|
257 | + if ($attendee instanceof EE_Attendee) { |
|
258 | 258 | return $attendee; |
259 | 259 | } |
260 | 260 | } |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | * @param array $ids array of EE_Registration ids |
273 | 273 | * @return EE_Attendee[] |
274 | 274 | */ |
275 | - public function get_array_of_contacts_from_reg_ids( $ids ) { |
|
275 | + public function get_array_of_contacts_from_reg_ids($ids) { |
|
276 | 276 | $ids = (array) $ids; |
277 | 277 | $_where = array( |
278 | - 'Registration.REG_ID' => array( 'in', $ids ) |
|
278 | + 'Registration.REG_ID' => array('in', $ids) |
|
279 | 279 | ); |
280 | - return $this->get_all( array( $_where ) ); |
|
280 | + return $this->get_all(array($_where)); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
2 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
3 | 3 | /** |
4 | 4 | * |
5 | 5 | * Transaction Model |
@@ -68,36 +68,36 @@ discard block |
||
68 | 68 | * Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
69 | 69 | * @return EEM_Transaction |
70 | 70 | */ |
71 | - protected function __construct( $timezone ) { |
|
72 | - $this->singular_item = __('Transaction','event_espresso'); |
|
73 | - $this->plural_item = __('Transactions','event_espresso'); |
|
71 | + protected function __construct($timezone) { |
|
72 | + $this->singular_item = __('Transaction', 'event_espresso'); |
|
73 | + $this->plural_item = __('Transactions', 'event_espresso'); |
|
74 | 74 | |
75 | 75 | $this->_tables = array( |
76 | - 'Transaction'=>new EE_Primary_Table('esp_transaction','TXN_ID') |
|
76 | + 'Transaction'=>new EE_Primary_Table('esp_transaction', 'TXN_ID') |
|
77 | 77 | ); |
78 | 78 | $this->_fields = array( |
79 | 79 | 'Transaction'=>array( |
80 | - 'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso')), |
|
81 | - 'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created','event_espresso'), false, time(), $timezone ), |
|
82 | - 'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction','event_espresso'), false, 0), |
|
83 | - 'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date','event_espresso'), false, 0), |
|
84 | - 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'), |
|
85 | - 'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data','event_espresso'), true, ''), |
|
86 | - 'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt','event_espresso'), true, ''), |
|
80 | + 'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso')), |
|
81 | + 'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created', 'event_espresso'), false, time(), $timezone), |
|
82 | + 'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction', 'event_espresso'), false, 0), |
|
83 | + 'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date', 'event_espresso'), false, 0), |
|
84 | + 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'), |
|
85 | + 'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data', 'event_espresso'), true, ''), |
|
86 | + 'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt', 'event_espresso'), true, ''), |
|
87 | 87 | 'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __("Last Used Payment Method", 'event_espresso'), true, NULL, 'Payment_Method'), |
88 | - 'TXN_reg_steps' => new EE_Serialized_Text_Field( 'TXN_reg_steps', __( 'Registration Steps', 'event_espresso' ), FALSE, array() ), |
|
88 | + 'TXN_reg_steps' => new EE_Serialized_Text_Field('TXN_reg_steps', __('Registration Steps', 'event_espresso'), FALSE, array()), |
|
89 | 89 | ) |
90 | 90 | ); |
91 | 91 | $this->_model_relations = array( |
92 | 92 | 'Registration'=>new EE_Has_Many_Relation(), |
93 | 93 | 'Payment'=>new EE_Has_Many_Relation(), |
94 | 94 | 'Status'=>new EE_Belongs_To_Relation(), |
95 | - 'Line_Item'=>new EE_Has_Many_Relation(false),//you can delete a transaction without needing to delete its line items |
|
95 | + 'Line_Item'=>new EE_Has_Many_Relation(false), //you can delete a transaction without needing to delete its line items |
|
96 | 96 | 'Payment_Method'=>new EE_Belongs_To_Relation(), |
97 | 97 | 'Message' => new EE_Has_Many_Relation() |
98 | 98 | ); |
99 | 99 | $this->_model_chain_to_wp_user = 'Registration.Event'; |
100 | - parent::__construct( $timezone ); |
|
100 | + parent::__construct($timezone); |
|
101 | 101 | |
102 | 102 | } |
103 | 103 | |
@@ -108,19 +108,19 @@ discard block |
||
108 | 108 | * @param string $period |
109 | 109 | * @return \stdClass[] |
110 | 110 | */ |
111 | - public function get_revenue_per_day_report( $period = '-1 month' ) { |
|
111 | + public function get_revenue_per_day_report($period = '-1 month') { |
|
112 | 112 | |
113 | - $sql_date = $this->convert_datetime_for_query( 'TXN_timestamp', date("Y-m-d H:i:s", strtotime($period) ), 'Y-m-d H:i:s', 'UTC' ); |
|
113 | + $sql_date = $this->convert_datetime_for_query('TXN_timestamp', date("Y-m-d H:i:s", strtotime($period)), 'Y-m-d H:i:s', 'UTC'); |
|
114 | 114 | $results = $this->_get_all_wpdb_results( |
115 | 115 | array( |
116 | 116 | array( |
117 | 117 | 'TXN_timestamp' => array('>=', $sql_date)), |
118 | 118 | 'group_by' => 'txnDate', |
119 | - 'order_by' => array('TXN_timestamp' => 'DESC' ) |
|
119 | + 'order_by' => array('TXN_timestamp' => 'DESC') |
|
120 | 120 | ), |
121 | 121 | OBJECT, |
122 | 122 | array( |
123 | - 'txnDate' => array('DATE(Transaction.TXN_timestamp)','%s'), |
|
123 | + 'txnDate' => array('DATE(Transaction.TXN_timestamp)', '%s'), |
|
124 | 124 | 'revenue' => array('SUM(Transaction.TXN_paid)', '%d') |
125 | 125 | )); |
126 | 126 | return $results; |
@@ -136,22 +136,22 @@ discard block |
||
136 | 136 | * @throws \EE_Error |
137 | 137 | * @return mixed |
138 | 138 | */ |
139 | - public function get_revenue_per_event_report( $period = 'month' ) { |
|
139 | + public function get_revenue_per_event_report($period = 'month') { |
|
140 | 140 | /** @type WPDB $wpdb */ |
141 | 141 | global $wpdb; |
142 | - $date_mod = strtotime( '-1 ' . $period ); |
|
142 | + $date_mod = strtotime('-1 '.$period); |
|
143 | 143 | |
144 | 144 | $SQL = 'SELECT post_title as event_name, SUM(TXN_paid) AS revenue'; |
145 | - $SQL .= ' FROM ' . $this->_get_main_table()->get_table_name() . ' txn'; |
|
146 | - $SQL .= ' LEFT JOIN ' . $wpdb->prefix . 'esp_registration reg ON reg.TXN_ID = txn.TXN_ID'; |
|
147 | - $SQL .= ' LEFT JOIN ' . $wpdb->posts . ' evt ON evt.ID = reg.EVT_ID'; |
|
145 | + $SQL .= ' FROM '.$this->_get_main_table()->get_table_name().' txn'; |
|
146 | + $SQL .= ' LEFT JOIN '.$wpdb->prefix.'esp_registration reg ON reg.TXN_ID = txn.TXN_ID'; |
|
147 | + $SQL .= ' LEFT JOIN '.$wpdb->posts.' evt ON evt.ID = reg.EVT_ID'; |
|
148 | 148 | $SQL .= ' WHERE REG_count = 1'; |
149 | 149 | $SQL .= ' AND REG_date >= %d'; |
150 | 150 | $SQL .= ' GROUP BY event_name'; |
151 | 151 | $SQL .= ' ORDER BY event_name'; |
152 | 152 | $SQL .= ' LIMIT 0, 24'; |
153 | 153 | |
154 | - return $this->_do_wpdb_query( 'get_results', array( $wpdb->prepare( $SQL, $date_mod ) ) ); |
|
154 | + return $this->_do_wpdb_query('get_results', array($wpdb->prepare($SQL, $date_mod))); |
|
155 | 155 | |
156 | 156 | } |
157 | 157 | |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | * @param string $reg_url_link |
168 | 168 | * @return EE_Transaction |
169 | 169 | */ |
170 | - public function get_transaction_from_reg_url_link( $reg_url_link = '' ){ |
|
171 | - return $this->get_one( array( |
|
170 | + public function get_transaction_from_reg_url_link($reg_url_link = '') { |
|
171 | + return $this->get_one(array( |
|
172 | 172 | array( |
173 | - 'Registration.REG_url_link' => ! empty( $reg_url_link ) ? $reg_url_link : EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ) |
|
173 | + 'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get('e_reg_url_link', '') |
|
174 | 174 | ) |
175 | 175 | )); |
176 | 176 | } |
@@ -190,15 +190,15 @@ discard block |
||
190 | 190 | * @param boolean $save_txn whether or not to save the transaction during this function call |
191 | 191 | * @return boolean |
192 | 192 | */ |
193 | - public function update_based_on_payments( $transaction_obj_or_id, $save_txn = TRUE ){ |
|
193 | + public function update_based_on_payments($transaction_obj_or_id, $save_txn = TRUE) { |
|
194 | 194 | EE_Error::doing_it_wrong( |
195 | - __CLASS__ . '::' . __FUNCTION__, |
|
196 | - sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ), |
|
195 | + __CLASS__.'::'.__FUNCTION__, |
|
196 | + sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'), |
|
197 | 197 | '4.6.0' |
198 | 198 | ); |
199 | 199 | /** @type EE_Transaction_Processor $transaction_processor */ |
200 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
201 | - return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $this->ensure_is_obj( $transaction_obj_or_id )); |
|
200 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
201 | + return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($this->ensure_is_obj($transaction_obj_or_id)); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | array( |
230 | 230 | 0 => array( |
231 | 231 | 'STS_ID' => EEM_Transaction::failed_status_code, |
232 | - 'TXN_timestamp' => array( '<', time() - $time_to_leave_alone ) |
|
232 | + 'TXN_timestamp' => array('<', time() - $time_to_leave_alone) |
|
233 | 233 | ) |
234 | 234 | ), |
235 | 235 | $time_to_leave_alone |
@@ -242,26 +242,26 @@ discard block |
||
242 | 242 | */ |
243 | 243 | $txn_ids = apply_filters( |
244 | 244 | 'FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete', |
245 | - EEM_Transaction::instance()->get_col( $ids_query, 'TXN_ID' ), |
|
245 | + EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'), |
|
246 | 246 | $time_to_leave_alone |
247 | 247 | ); |
248 | 248 | |
249 | 249 | //now that we have the ids to delete, let's get deletin' |
250 | 250 | //Why no wpdb->prepare? Because the data is trusted. We got the ids from the original query to get them FROM |
251 | 251 | //the db (which is sanitized) so no need to prepare them again. |
252 | - if ( $txn_ids ) { |
|
253 | - $query = ' |
|
252 | + if ($txn_ids) { |
|
253 | + $query = ' |
|
254 | 254 | DELETE |
255 | - FROM ' . $this->table() . ' |
|
255 | + FROM ' . $this->table().' |
|
256 | 256 | WHERE |
257 | - TXN_ID IN ( ' . implode( ",", $txn_ids ) . ')'; |
|
258 | - $deleted = $wpdb->query( $query ); |
|
257 | + TXN_ID IN ( ' . implode(",", $txn_ids).')'; |
|
258 | + $deleted = $wpdb->query($query); |
|
259 | 259 | } |
260 | - if ( $deleted ) { |
|
260 | + if ($deleted) { |
|
261 | 261 | /** |
262 | 262 | * Allows code to do something after the transactions have been deleted. |
263 | 263 | */ |
264 | - do_action( 'AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids ); |
|
264 | + do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids); |
|
265 | 265 | } |
266 | 266 | return $deleted; |
267 | 267 | } |
@@ -3,18 +3,18 @@ |
||
3 | 3 | * Field to only allow tags that are normally allowed on post_content: |
4 | 4 | * address,a,abbr,acronym,area,article,aside,b,big,blockquote,br,button,caption,cite,code,col,del,dd,dfn,details,div,dl,dt,em,fieldset,figure,figcaption,font,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,img,ins,kbd,label,legend,li,map,mark,menu,nav,p,pre,q,s,samp,span,section,small,strike,strong,sub,summary,sup,table,tbody,td,textarea,tfoot,th,thead,title,tr,tt,u,ul,ol,var |
5 | 5 | */ |
6 | -class EE_Post_Content_Field extends EE_Full_HTML_Field{ |
|
6 | +class EE_Post_Content_Field extends EE_Full_HTML_Field { |
|
7 | 7 | /** |
8 | 8 | * removes all tags which a WP Post wouldn't allow in its content normally |
9 | 9 | * @param string $value_inputted_for_field_on_model_object |
10 | 10 | * @return string |
11 | 11 | */ |
12 | 12 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
13 | - $value_with_select_tags = wp_kses("$value_inputted_for_field_on_model_object",wp_kses_allowed_html( 'post' )); |
|
13 | + $value_with_select_tags = wp_kses("$value_inputted_for_field_on_model_object", wp_kses_allowed_html('post')); |
|
14 | 14 | return parent::prepare_for_set($value_with_select_tags); |
15 | 15 | } |
16 | 16 | |
17 | - function prepare_for_set_from_db($value_found_in_db_for_model_object){ |
|
17 | + function prepare_for_set_from_db($value_found_in_db_for_model_object) { |
|
18 | 18 | return $value_found_in_db_for_model_object; |
19 | 19 | } |
20 | 20 | } |
21 | 21 | \ No newline at end of file |
@@ -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 | /** |
@@ -42,25 +42,25 @@ discard block |
||
42 | 42 | $this->_shortcodes = array( |
43 | 43 | '[TXN_ID]' => __('The transaction id for the purchase.', 'event_espresso'), |
44 | 44 | '[PAYMENT_URL]' => __('This is a link to make a payment for the event', 'event_espresso'), |
45 | - '[PAYMENT_LINK_IF_NEEDED_*]' => __('This is a special dynamic shortcode that allows one to insert a payment link conditional on there being amount owing on the transaction. Three params are available on this shortcode:', 'event_espresso') . '<ul>' |
|
46 | - . '<li>' . sprintf( __('%class:%s This can be used to indicate css class is given to the containing css element (default is "callout").', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' |
|
47 | - . '<li>' . sprintf( __('%scustom_text:%s This should be a sprintf format text string (with %%s for where the hyperlink tags go) that is used for the generated link text (The default is "You can %%smake a payment here »%%s.)', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' |
|
48 | - . '<li>' . sprintf( __('%scontainer_tag:%s Use this to indicate what container tag you want surrounding the payment link (default is "p").', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' |
|
45 | + '[PAYMENT_LINK_IF_NEEDED_*]' => __('This is a special dynamic shortcode that allows one to insert a payment link conditional on there being amount owing on the transaction. Three params are available on this shortcode:', 'event_espresso').'<ul>' |
|
46 | + . '<li>'.sprintf(__('%class:%s This can be used to indicate css class is given to the containing css element (default is "callout").', 'event_espresso'), '<strong>', '</strong>').'</li>' |
|
47 | + . '<li>'.sprintf(__('%scustom_text:%s This should be a sprintf format text string (with %%s for where the hyperlink tags go) that is used for the generated link text (The default is "You can %%smake a payment here »%%s.)', 'event_espresso'), '<strong>', '</strong>').'</li>' |
|
48 | + . '<li>'.sprintf(__('%scontainer_tag:%s Use this to indicate what container tag you want surrounding the payment link (default is "p").', 'event_espresso'), '<strong>', '</strong>').'</li>' |
|
49 | 49 | . '</ul>', |
50 | - '[PAYMENT_DUE_DATE_*]' => __( 'This is a special dynamic shortcode that allows one to output a payment due date. It will only result in a date shown if there is money owing. Three parameters are available on this shortcode:', 'event_espresso' ) |
|
50 | + '[PAYMENT_DUE_DATE_*]' => __('This is a special dynamic shortcode that allows one to output a payment due date. It will only result in a date shown if there is money owing. Three parameters are available on this shortcode:', 'event_espresso') |
|
51 | 51 | . '<ul>' |
52 | - . '<li>' . sprintf( __( '%sformat:%s This is used to indicate what format the date is in. Default is whatever is set as date formats for your website.', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' |
|
53 | - . '<li>' . sprintf( __( '%days_until_due:%s This is the number of days form the transaction creation date that the payment is due. Defaults to 30.', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>' |
|
54 | - . '<li>' . sprintf( __( '%sprefix_text:%s You can use this to indicate what text will prefix the date string. Defaults to "Payment in full due by:"', 'event_espresso' ), '<strong>', '</strong>' ) . '</li>', |
|
52 | + . '<li>'.sprintf(__('%sformat:%s This is used to indicate what format the date is in. Default is whatever is set as date formats for your website.', 'event_espresso'), '<strong>', '</strong>').'</li>' |
|
53 | + . '<li>'.sprintf(__('%days_until_due:%s This is the number of days form the transaction creation date that the payment is due. Defaults to 30.', 'event_espresso'), '<strong>', '</strong>').'</li>' |
|
54 | + . '<li>'.sprintf(__('%sprefix_text:%s You can use this to indicate what text will prefix the date string. Defaults to "Payment in full due by:"', 'event_espresso'), '<strong>', '</strong>').'</li>', |
|
55 | 55 | '[INVOICE_LINK]' => __('This is a full html link to the invoice', 'event_espresso'), |
56 | 56 | '[INVOICE_URL]' => __('This is just the url for the invoice', 'event_espresso'), |
57 | 57 | '[INVOICE_LOGO_URL]' => __('This returns the url for the logo uploaded via the invoice settings page.', 'event_espresso'), |
58 | 58 | '[INVOICE_LOGO]' => __('This returns the logo uploaded via the invoice settings page wrapped in img_tags and with a "logo screen" classes. The image size is also set in the img tags automatically to match the uploaded logo.', 'event_espresso'), |
59 | 59 | '[INVOICE_PAYEE_NAME]' => __('This will parse to either: the value of the "Company Name" field in the invoice payment method settings; if that is blank, then the value of the Company Name in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'), |
60 | - '[INVOICE_PAYEE_ADDRESS]' => __('This will parse to either: the value of the "Company Address" field in the invoice payment method settings; if that is blank, then the value of the Company Address in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ), |
|
61 | - '[INVOICE_PAYMENT_INSTRUCTIONS]' => __('This will parse to the value of the "Payment Instructions" field found on the Invoice payment methods settings page', 'event_espresso' ), |
|
62 | - '[INVOICE_PAYEE_EMAIL]' => __('This will parse to either: the value of the "Company Email" field in the invoice payment method settings; if that is blank, then the value of the Company Email in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso' ), |
|
63 | - '[INVOICE_PAYEE_TAX_NUMBER_*]' => __('This will parse to either: the value of the "Company Tax Number" field in the invoice payment method settings; if that is blank, then the value of the Company Tax Number in the "Your Organization Settings", if that is blank then an empty string. Note this is also a special dynamic shortcode. You can use the "prefix" parameter to indicate what text you want to use as a prefix before this tax number. It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: <code>[INVOICE_PAYEE_TAX_NUMBER_* prefix="GST:"]</code> and that will ouptut: GST: 12345t56. If you have no tax number in your settings, then no prefix will be output either.', 'event_espresso' ), |
|
60 | + '[INVOICE_PAYEE_ADDRESS]' => __('This will parse to either: the value of the "Company Address" field in the invoice payment method settings; if that is blank, then the value of the Company Address in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'), |
|
61 | + '[INVOICE_PAYMENT_INSTRUCTIONS]' => __('This will parse to the value of the "Payment Instructions" field found on the Invoice payment methods settings page', 'event_espresso'), |
|
62 | + '[INVOICE_PAYEE_EMAIL]' => __('This will parse to either: the value of the "Company Email" field in the invoice payment method settings; if that is blank, then the value of the Company Email in the "Your Organization Settings", if that is blank then an empty string.', 'event_espresso'), |
|
63 | + '[INVOICE_PAYEE_TAX_NUMBER_*]' => __('This will parse to either: the value of the "Company Tax Number" field in the invoice payment method settings; if that is blank, then the value of the Company Tax Number in the "Your Organization Settings", if that is blank then an empty string. Note this is also a special dynamic shortcode. You can use the "prefix" parameter to indicate what text you want to use as a prefix before this tax number. It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: <code>[INVOICE_PAYEE_TAX_NUMBER_* prefix="GST:"]</code> and that will ouptut: GST: 12345t56. If you have no tax number in your settings, then no prefix will be output either.', 'event_espresso'), |
|
64 | 64 | '[TOTAL_COST]' => __('The total cost for the transaction', 'event_espresso'), |
65 | 65 | '[TXN_STATUS]' => __('The transaction status for the transaction.', 'event_espresso'), |
66 | 66 | '[TXN_STATUS_ID]' => __('The ID representing the transaction status as saved in the db. This tends to be useful for including with css classes for styling certain statuses differently from others.', 'event_espresso'), |
@@ -71,54 +71,54 @@ discard block |
||
71 | 71 | '[TOTAL_OWING]' => __('The total owing on a transaction with no attributes.', 'event_espresso'), |
72 | 72 | '[TXN_SUBTOTAL]' => __('The subtotal for all txn line items.', 'event_espresso'), |
73 | 73 | '[TXN_TAX_SUBTOTAL]' => __('The subtotal for all tax line items.', 'event_espresso'), |
74 | - '[OWING_STATUS_MESSAGE_*]' => __('A dynamic shortcode for adjusting how total oweing gets shown. The acceptable attributes on the shortcode are:', 'event_espresso') . '<p></ul>' . |
|
75 | - '<li><strong>still_owing</strong>:' . __('If the transaction is not paid in full, then whatever is set for this attribute is shown (otherwise its just the amount oweing). The default is:', 'event_espresso' ) . sprintf( __( '%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>' ) . '</li>' . |
|
76 | - '<li><strong>none_owing</strong>:' . __('If the transaction is paid in full, then you can indicate how this gets displayed. Note, that it defaults to just be the total oweing.', 'event_espresso') . '</li></ul></p>', |
|
74 | + '[OWING_STATUS_MESSAGE_*]' => __('A dynamic shortcode for adjusting how total oweing gets shown. The acceptable attributes on the shortcode are:', 'event_espresso').'<p></ul>'. |
|
75 | + '<li><strong>still_owing</strong>:'.__('If the transaction is not paid in full, then whatever is set for this attribute is shown (otherwise its just the amount oweing). The default is:', 'event_espresso').sprintf(__('%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>').'</li>'. |
|
76 | + '<li><strong>none_owing</strong>:'.__('If the transaction is paid in full, then you can indicate how this gets displayed. Note, that it defaults to just be the total oweing.', 'event_espresso').'</li></ul></p>', |
|
77 | 77 | '[TXN_TOTAL_TICKETS]' => __('The total number of all tickets purchased in a transaction', 'event_espresso'), |
78 | 78 | '[TKT_QTY_PURCHASED]' => __('The total number of all tickets purchased in a transaction. <strong>NOTE: This shortcode is good to use in the "[TICKET_LIST]" field but has been deprecated from all other contexts in favor of the more explicit [TXN_TOTAL_TICKETS] shortcode.</strong>', 'event_espresso'), |
79 | 79 | '[TRANSACTION_ADMIN_URL]' => __('The url to the admin page for this transaction', 'event_espresso'), |
80 | 80 | '[RECEIPT_URL]' => __('This parses to the generated url for retrieving the receipt for the transaction', 'event_espresso'), |
81 | - '[INVOICE_RECEIPT_SWITCHER_URL]' => __( 'This parses to the url that will switch to the receipt if an invoice is displayed, and switch to the invoice if receipt is displayed. If a message type OTHER than invoice or receipt is displayed then this will just return the url for the invoice. If the related message type is not active then will parse to an empty string.', 'event_espresso'), |
|
82 | - '[INVOICE_RECEIPT_SWITCHER_BUTTON]' => sprintf( __( 'The same as %1$s[INVOICE_RECEIPT_SWITCHER_URL]%2$s except this returns the html for a button linked to the invoice or receipt.', 'event_espresso' ), '<code>', '</code>' ) |
|
81 | + '[INVOICE_RECEIPT_SWITCHER_URL]' => __('This parses to the url that will switch to the receipt if an invoice is displayed, and switch to the invoice if receipt is displayed. If a message type OTHER than invoice or receipt is displayed then this will just return the url for the invoice. If the related message type is not active then will parse to an empty string.', 'event_espresso'), |
|
82 | + '[INVOICE_RECEIPT_SWITCHER_BUTTON]' => sprintf(__('The same as %1$s[INVOICE_RECEIPT_SWITCHER_URL]%2$s except this returns the html for a button linked to the invoice or receipt.', 'event_espresso'), '<code>', '</code>') |
|
83 | 83 | ); |
84 | 84 | } |
85 | 85 | |
86 | 86 | |
87 | - protected function _parser( $shortcode ) { |
|
87 | + protected function _parser($shortcode) { |
|
88 | 88 | |
89 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
89 | + EE_Registry::instance()->load_helper('Template'); |
|
90 | 90 | |
91 | 91 | //attempt to get the transaction. Since this is potentially used in more fields, we may have to look in the _extra_data for the transaction. |
92 | 92 | $transaction = $this->_data->txn instanceof EE_Transaction ? $this->_data->txn : null; |
93 | - $transaction = ! $transaction instanceof EE_Transaction && is_array( $this->_extra_data ) && isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->txn: $transaction; |
|
93 | + $transaction = ! $transaction instanceof EE_Transaction && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->txn : $transaction; |
|
94 | 94 | |
95 | 95 | //payment |
96 | 96 | $payment = $this->_data->payment instanceof EE_Payment ? $this->_data->payment : null; |
97 | - $payment = ! $payment instanceof EE_Payment && is_array( $this->_extra_data ) && isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->payment: $payment; |
|
97 | + $payment = ! $payment instanceof EE_Payment && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->payment : $payment; |
|
98 | 98 | |
99 | 99 | |
100 | - if ( ! $transaction instanceof EE_Transaction ) |
|
100 | + if ( ! $transaction instanceof EE_Transaction) |
|
101 | 101 | return ''; |
102 | 102 | |
103 | - switch ( $shortcode ) { |
|
103 | + switch ($shortcode) { |
|
104 | 104 | case '[TXN_ID]' : |
105 | 105 | return $transaction->ID(); |
106 | 106 | break; |
107 | 107 | |
108 | 108 | case '[PAYMENT_URL]' : |
109 | 109 | $payment_url = $transaction->payment_overview_url(); |
110 | - return empty( $payment_url ) ? __( 'http://dummypaymenturlforpreview.com', 'event_espresso') : $payment_url; |
|
110 | + return empty($payment_url) ? __('http://dummypaymenturlforpreview.com', 'event_espresso') : $payment_url; |
|
111 | 111 | break; |
112 | 112 | |
113 | 113 | case '[INVOICE_LINK]' : |
114 | 114 | $invoice_url = $transaction->invoice_url(); |
115 | - $invoice_url = empty( $invoice_url ) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url; |
|
116 | - return sprintf( __('%sClick here for Invoice%s', 'event_espresso'), '<a href="' . $invoice_url . '">', '</a>' ); |
|
115 | + $invoice_url = empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url; |
|
116 | + return sprintf(__('%sClick here for Invoice%s', 'event_espresso'), '<a href="'.$invoice_url.'">', '</a>'); |
|
117 | 117 | break; /**/ |
118 | 118 | |
119 | 119 | case '[INVOICE_URL]' : |
120 | 120 | $invoice_url = $transaction->invoice_url(); |
121 | - return empty( $invoice_url ) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url; |
|
121 | + return empty($invoice_url) ? 'http://dummyinvoicelinksforpreview.com' : $invoice_url; |
|
122 | 122 | break; |
123 | 123 | |
124 | 124 | case '[INVOICE_LOGO_URL]' : |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | break; |
127 | 127 | |
128 | 128 | case '[INVOICE_LOGO]' : |
129 | - return $this->_get_invoice_logo( TRUE ); |
|
129 | + return $this->_get_invoice_logo(TRUE); |
|
130 | 130 | break; |
131 | 131 | |
132 | 132 | case '[INVOICE_PAYEE_NAME]' : |
@@ -148,18 +148,18 @@ discard block |
||
148 | 148 | |
149 | 149 | case "[TOTAL_COST]" : |
150 | 150 | $total = $transaction->total(); |
151 | - return ! empty($total) ? EEH_Template::format_currency( $total ) : ''; |
|
151 | + return ! empty($total) ? EEH_Template::format_currency($total) : ''; |
|
152 | 152 | break; |
153 | 153 | |
154 | 154 | case "[PAYMENT_STATUS]" : |
155 | 155 | $status = $transaction->pretty_status(); |
156 | - return !empty($status) ? $status : __('Unknown', 'event_espresso'); |
|
156 | + return ! empty($status) ? $status : __('Unknown', 'event_espresso'); |
|
157 | 157 | break; /**/ |
158 | 158 | |
159 | 159 | // note the [payment_status] shortcode is kind of misleading because payment status might be different from txn status so I'm adding this here for clarity. |
160 | 160 | case "[TXN_STATUS]" : |
161 | 161 | $status = $transaction->pretty_status(); |
162 | - return !empty( $status ) ? $status : __('Unknown', 'event_espresso'); |
|
162 | + return ! empty($status) ? $status : __('Unknown', 'event_espresso'); |
|
163 | 163 | break; |
164 | 164 | |
165 | 165 | case "[TXN_STATUS_ID]" : |
@@ -167,21 +167,21 @@ discard block |
||
167 | 167 | break; |
168 | 168 | |
169 | 169 | case "[PAYMENT_GATEWAY]" : |
170 | - return $this->_get_payment_gateway( $transaction ); |
|
170 | + return $this->_get_payment_gateway($transaction); |
|
171 | 171 | break; |
172 | 172 | |
173 | 173 | case "[AMOUNT_PAID]" : |
174 | 174 | $amount = $payment instanceof EE_Payment ? $payment->amount() : 0; |
175 | - return EEH_Template::format_currency( $amount ); |
|
175 | + return EEH_Template::format_currency($amount); |
|
176 | 176 | break; |
177 | 177 | |
178 | 178 | case "[TOTAL_AMOUNT_PAID]" : |
179 | - return EEH_Template::format_currency( $transaction->paid() ); |
|
179 | + return EEH_Template::format_currency($transaction->paid()); |
|
180 | 180 | break; |
181 | 181 | |
182 | 182 | case "[TOTAL_OWING]" : |
183 | 183 | $total_owing = $transaction->remaining(); |
184 | - return EEH_Template::format_currency( $total_owing ); |
|
184 | + return EEH_Template::format_currency($total_owing); |
|
185 | 185 | break; |
186 | 186 | |
187 | 187 | case "[TXN_SUBTOTAL]" : |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | break; |
190 | 190 | |
191 | 191 | case "[TXN_TAX_SUBTOTAL]" : |
192 | - return EEH_Template::format_currency($this->_get_subtotal( TRUE )); |
|
192 | + return EEH_Template::format_currency($this->_get_subtotal(TRUE)); |
|
193 | 193 | break; |
194 | 194 | |
195 | 195 | case "[TKT_QTY_PURCHASED]" : |
@@ -198,9 +198,9 @@ discard block |
||
198 | 198 | break; |
199 | 199 | |
200 | 200 | case "[TRANSACTION_ADMIN_URL]" : |
201 | - require_once EE_CORE . 'admin/EE_Admin_Page.core.php'; |
|
202 | - $query_args = array( 'page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID() ); |
|
203 | - $url = EE_Admin_Page::add_query_args_and_nonce( $query_args, admin_url('admin.php') ); |
|
201 | + require_once EE_CORE.'admin/EE_Admin_Page.core.php'; |
|
202 | + $query_args = array('page' => 'espresso_transactions', 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID()); |
|
203 | + $url = EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php')); |
|
204 | 204 | return $url; |
205 | 205 | break; |
206 | 206 | |
@@ -208,14 +208,14 @@ discard block |
||
208 | 208 | //get primary_registration |
209 | 209 | $reg = $this->_data->primary_reg_obj; |
210 | 210 | |
211 | - if ( ! $reg instanceof EE_Registration ) { |
|
211 | + if ( ! $reg instanceof EE_Registration) { |
|
212 | 212 | return ''; |
213 | 213 | } |
214 | 214 | return $reg->receipt_url(); |
215 | 215 | break; |
216 | 216 | |
217 | 217 | case "[INVOICE_RECEIPT_SWITCHER_URL]" : |
218 | - return $this->_get_invoice_receipt_switcher( FALSE ); |
|
218 | + return $this->_get_invoice_receipt_switcher(FALSE); |
|
219 | 219 | break; |
220 | 220 | |
221 | 221 | case "[INVOICE_RECEIPT_SWITCHER_BUTTON]" : |
@@ -225,20 +225,20 @@ discard block |
||
225 | 225 | |
226 | 226 | } |
227 | 227 | |
228 | - if ( strpos( $shortcode, '[OWING_STATUS_MESSAGE_*' ) !== FALSE ) { |
|
229 | - return $this->_get_custom_total_oweing( $shortcode ); |
|
228 | + if (strpos($shortcode, '[OWING_STATUS_MESSAGE_*') !== FALSE) { |
|
229 | + return $this->_get_custom_total_oweing($shortcode); |
|
230 | 230 | } |
231 | 231 | |
232 | - if ( strpos( $shortcode, '[INVOICE_PAYEE_TAX_NUMBER_*' ) !== FALSE ) { |
|
233 | - return $this->_get_invoice_payee_tax_number( $shortcode ); |
|
232 | + if (strpos($shortcode, '[INVOICE_PAYEE_TAX_NUMBER_*') !== FALSE) { |
|
233 | + return $this->_get_invoice_payee_tax_number($shortcode); |
|
234 | 234 | } |
235 | 235 | |
236 | - if ( strpos( $shortcode, '[PAYMENT_LINK_IF_NEEDED_*' ) !== FALSE ) { |
|
237 | - return $this->_get_payment_link_if_needed( $shortcode ); |
|
236 | + if (strpos($shortcode, '[PAYMENT_LINK_IF_NEEDED_*') !== FALSE) { |
|
237 | + return $this->_get_payment_link_if_needed($shortcode); |
|
238 | 238 | } |
239 | 239 | |
240 | - if ( strpos( $shortcode, '[PAYMENT_DUE_DATE_*' ) !== false ) { |
|
241 | - return $this->_get_payment_due_date( $shortcode, $transaction ); |
|
240 | + if (strpos($shortcode, '[PAYMENT_DUE_DATE_*') !== false) { |
|
241 | + return $this->_get_payment_due_date($shortcode, $transaction); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | return ''; |
@@ -255,22 +255,22 @@ discard block |
||
255 | 255 | * |
256 | 256 | * @return string parsed. |
257 | 257 | */ |
258 | - private function _get_custom_total_oweing( $shortcode ) { |
|
259 | - $valid_shortcodes = array( 'transaction' ); |
|
260 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
258 | + private function _get_custom_total_oweing($shortcode) { |
|
259 | + $valid_shortcodes = array('transaction'); |
|
260 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
261 | 261 | |
262 | 262 | //ensure default is set. |
263 | 263 | $addressee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
264 | 264 | $total_owing = $addressee instanceof EE_Messages_Addressee && $addressee->txn instanceof EE_Transaction ? $addressee->txn->remaining() : 0; |
265 | 265 | |
266 | - if ( $total_owing > 0 ) { |
|
267 | - $owing_content = ! empty( $attrs['still_owing'] ) ? $attrs['still_owing'] : sprintf( __( '%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>' ); |
|
266 | + if ($total_owing > 0) { |
|
267 | + $owing_content = ! empty($attrs['still_owing']) ? $attrs['still_owing'] : sprintf(__('%sPlease make a payment.%s', 'event_espresso'), '<a href="[PAYMENT_URL]" class="noPrint">', '</a>'); |
|
268 | 268 | |
269 | 269 | //we need to re run this string through the parser to catch any shortcodes that are in it. |
270 | 270 | $this->_set_shortcode_helper(); |
271 | - $owing_content = $this->_shortcode_helper->parse_message_template( $owing_content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message ); |
|
271 | + $owing_content = $this->_shortcode_helper->parse_message_template($owing_content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message); |
|
272 | 272 | } else { |
273 | - $owing_content = !empty( $attrs['none_owing']) ? $attrs['none_owing'] : ''; |
|
273 | + $owing_content = ! empty($attrs['none_owing']) ? $attrs['none_owing'] : ''; |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | return $owing_content; |
@@ -278,8 +278,8 @@ discard block |
||
278 | 278 | |
279 | 279 | |
280 | 280 | |
281 | - private function _get_payment_gateway( $transaction ) { |
|
282 | - $pm = $this->_get_payment_method( $transaction ); |
|
281 | + private function _get_payment_gateway($transaction) { |
|
282 | + $pm = $this->_get_payment_method($transaction); |
|
283 | 283 | return $pm instanceof EE_Payment_Method ? $pm->name() : ''; |
284 | 284 | } |
285 | 285 | |
@@ -294,37 +294,37 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @return string url or html |
296 | 296 | */ |
297 | - private function _get_invoice_logo( $img_tags = FALSE ) { |
|
297 | + private function _get_invoice_logo($img_tags = FALSE) { |
|
298 | 298 | //try to get the invoice payment method's logo for this transaction image first |
299 | 299 | $pm = $this->_get_payment_method(); |
300 | - if ( $pm instanceof EE_Payment_Method ){ |
|
301 | - $invoice_logo_url = $pm->get_extra_meta( 'pdf_logo_image', TRUE ); |
|
302 | - }else{ |
|
300 | + if ($pm instanceof EE_Payment_Method) { |
|
301 | + $invoice_logo_url = $pm->get_extra_meta('pdf_logo_image', TRUE); |
|
302 | + } else { |
|
303 | 303 | $invoice_logo_url = NULL; |
304 | 304 | } |
305 | - if( empty( $invoice_logo_url ) ){ |
|
305 | + if (empty($invoice_logo_url)) { |
|
306 | 306 | $invoice_logo_url = EE_Registry::instance()->CFG->organization->logo_url; |
307 | 307 | } |
308 | 308 | |
309 | - if ( empty( $invoice_logo_url ) ) { |
|
309 | + if (empty($invoice_logo_url)) { |
|
310 | 310 | return ''; |
311 | 311 | } |
312 | 312 | |
313 | - if ( ! $img_tags ) { |
|
313 | + if ( ! $img_tags) { |
|
314 | 314 | return $invoice_logo_url; |
315 | 315 | } |
316 | 316 | |
317 | 317 | //image tags have been requested. |
318 | - $image_size = getimagesize( $invoice_logo_url ); |
|
318 | + $image_size = getimagesize($invoice_logo_url); |
|
319 | 319 | |
320 | 320 | //if image is wider than 200px, set the wideth to 200 |
321 | - if ( $image_size[0] > 300 ) { |
|
321 | + if ($image_size[0] > 300) { |
|
322 | 322 | $image_width = 300; |
323 | - }else{ |
|
323 | + } else { |
|
324 | 324 | $image_width = $image_size[0]; |
325 | 325 | } |
326 | 326 | |
327 | - return '<img class="logo screen" src="' . $invoice_logo_url . '" width="' . $image_width . '" alt="logo" />'; |
|
327 | + return '<img class="logo screen" src="'.$invoice_logo_url.'" width="'.$image_width.'" alt="logo" />'; |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | |
@@ -341,26 +341,26 @@ discard block |
||
341 | 341 | private function _get_invoice_payee_name() { |
342 | 342 | $payee_name = NULL; |
343 | 343 | $pm = $this->_get_payment_method(); |
344 | - if( $pm instanceof EE_Payment_Method ){ |
|
345 | - $payee_name = $pm->get_extra_meta( 'pdf_payee_name', TRUE ); |
|
344 | + if ($pm instanceof EE_Payment_Method) { |
|
345 | + $payee_name = $pm->get_extra_meta('pdf_payee_name', TRUE); |
|
346 | 346 | } |
347 | - $payee_name = empty( $payee_name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : $payee_name; |
|
347 | + $payee_name = empty($payee_name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : $payee_name; |
|
348 | 348 | return $payee_name; |
349 | 349 | } |
350 | 350 | |
351 | 351 | /** |
352 | 352 | * gets the payment method for this transaction. Otherwise gets a default one. |
353 | 353 | */ |
354 | - private function _get_payment_method( $transaction = null ){ |
|
355 | - if( $transaction instanceof EE_Transaction ) { |
|
354 | + private function _get_payment_method($transaction = null) { |
|
355 | + if ($transaction instanceof EE_Transaction) { |
|
356 | 356 | $payment_method = $transaction->payment_method(); |
357 | - if ( empty( $payment_method ) ) { |
|
358 | - return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice')); |
|
357 | + if (empty($payment_method)) { |
|
358 | + return apply_filters('FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice')); |
|
359 | 359 | } |
360 | 360 | return $payment_method; |
361 | - }else{ |
|
361 | + } else { |
|
362 | 362 | //get the first payment method we can find |
363 | - return apply_filters( 'FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice')); |
|
363 | + return apply_filters('FHEE__EE_Transaction_Shortcodes__get_payment_method__default', EEM_Payment_Method::instance()->get_one_of_type('Invoice')); |
|
364 | 364 | } |
365 | 365 | } |
366 | 366 | |
@@ -377,10 +377,10 @@ discard block |
||
377 | 377 | private function _get_invoice_payee_email() { |
378 | 378 | $payee_email = NULL; |
379 | 379 | $pm = $this->_get_payment_method(); |
380 | - if( $pm instanceof EE_Payment_Method ){ |
|
381 | - $payee_email = $pm->get_extra_meta( 'pdf_payee_email', TRUE ); |
|
380 | + if ($pm instanceof EE_Payment_Method) { |
|
381 | + $payee_email = $pm->get_extra_meta('pdf_payee_email', TRUE); |
|
382 | 382 | } |
383 | - $payee_email = empty( $payee_email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : $payee_email; |
|
383 | + $payee_email = empty($payee_email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : $payee_email; |
|
384 | 384 | return $payee_email; |
385 | 385 | } |
386 | 386 | |
@@ -396,24 +396,24 @@ discard block |
||
396 | 396 | * |
397 | 397 | * @return string |
398 | 398 | */ |
399 | - private function _get_invoice_payee_tax_number( $shortcode ) { |
|
399 | + private function _get_invoice_payee_tax_number($shortcode) { |
|
400 | 400 | $payee_tax_number = NULL; |
401 | 401 | $pm = $this->_get_payment_method(); |
402 | - if( $pm instanceof EE_Payment_Method ){ |
|
403 | - $payee_tax_number = $pm->get_extra_meta( 'pdf_payee_tax_number', TRUE ); |
|
402 | + if ($pm instanceof EE_Payment_Method) { |
|
403 | + $payee_tax_number = $pm->get_extra_meta('pdf_payee_tax_number', TRUE); |
|
404 | 404 | } |
405 | - $payee_tax_number = empty( $payee_tax_number ) ? EE_Registry::instance()->CFG->organization->vat : $payee_tax_number; |
|
405 | + $payee_tax_number = empty($payee_tax_number) ? EE_Registry::instance()->CFG->organization->vat : $payee_tax_number; |
|
406 | 406 | |
407 | - if ( empty( $payee_tax_number ) ) { |
|
407 | + if (empty($payee_tax_number)) { |
|
408 | 408 | return ''; |
409 | 409 | } |
410 | 410 | |
411 | 411 | //any attributes? |
412 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
412 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
413 | 413 | |
414 | 414 | //prefix? |
415 | - $prefix = isset( $attrs['prefix'] ) ? $attrs['prefix'] : __( 'VAT/Tax Number: ', 'event_espresso' ); |
|
416 | - return $prefix . $payee_tax_number; |
|
415 | + $prefix = isset($attrs['prefix']) ? $attrs['prefix'] : __('VAT/Tax Number: ', 'event_espresso'); |
|
416 | + return $prefix.$payee_tax_number; |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | |
@@ -430,22 +430,22 @@ discard block |
||
430 | 430 | private function _get_invoice_payee_address() { |
431 | 431 | $payee_address = NULL; |
432 | 432 | $pm = $this->_get_payment_method(); |
433 | - if( $pm instanceof EE_Payment_Method ){ |
|
434 | - $payee_address = $pm->get_extra_meta( 'pdf_payee_address', TRUE ); |
|
433 | + if ($pm instanceof EE_Payment_Method) { |
|
434 | + $payee_address = $pm->get_extra_meta('pdf_payee_address', TRUE); |
|
435 | 435 | } |
436 | - if ( empty( $payee_address ) ) { |
|
436 | + if (empty($payee_address)) { |
|
437 | 437 | $organization = EE_Registry::instance()->CFG->organization; |
438 | - $payee_address = $organization->get_pretty( 'address_1' ) . '<br>'; |
|
439 | - $payee_address .= !empty( $organization->address_2 ) ? $organization->get_pretty( 'address_2' ) . '<br>' : ''; |
|
440 | - $payee_address .= $organization->get_pretty( 'city' ) . '<br>'; |
|
438 | + $payee_address = $organization->get_pretty('address_1').'<br>'; |
|
439 | + $payee_address .= ! empty($organization->address_2) ? $organization->get_pretty('address_2').'<br>' : ''; |
|
440 | + $payee_address .= $organization->get_pretty('city').'<br>'; |
|
441 | 441 | |
442 | 442 | //state |
443 | - $state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $organization->STA_ID ); |
|
444 | - $payee_address .= $state instanceof EE_State ? $state->name() : ''; |
|
443 | + $state = EE_Registry::instance()->load_model('State')->get_one_by_ID($organization->STA_ID); |
|
444 | + $payee_address .= $state instanceof EE_State ? $state->name() : ''; |
|
445 | 445 | |
446 | 446 | //Country |
447 | - $payee_address .= ! empty( $organization->CNT_ISO ) ? ', ' . $organization->CNT_ISO . '<br>' : ''; |
|
448 | - $payee_address .= ! empty( $organization->zip ) ? $organization->zip : ''; |
|
447 | + $payee_address .= ! empty($organization->CNT_ISO) ? ', '.$organization->CNT_ISO.'<br>' : ''; |
|
448 | + $payee_address .= ! empty($organization->zip) ? $organization->zip : ''; |
|
449 | 449 | } |
450 | 450 | return $payee_address; |
451 | 451 | } |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | private function _get_invoice_payment_instructions() { |
464 | 464 | $instructions = NULL; |
465 | 465 | $pm = $this->_get_payment_method(); |
466 | - return ( $pm instanceof EE_Payment_Method ) ? $pm->get_extra_meta( 'pdf_instructions', TRUE) : ''; |
|
466 | + return ($pm instanceof EE_Payment_Method) ? $pm->get_extra_meta('pdf_instructions', TRUE) : ''; |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | |
@@ -477,27 +477,27 @@ discard block |
||
477 | 477 | * |
478 | 478 | * @return string |
479 | 479 | */ |
480 | - protected function _get_invoice_receipt_switcher( $button = TRUE ) { |
|
480 | + protected function _get_invoice_receipt_switcher($button = TRUE) { |
|
481 | 481 | $reg = $this->_data->primary_reg_obj; |
482 | - $message_type = isset( $this->_extra_data['message_type'] ) ? $this->_extra_data['message_type'] : ''; |
|
483 | - if ( ! $reg instanceof EE_Registration || empty( $message_type ) ) { |
|
482 | + $message_type = isset($this->_extra_data['message_type']) ? $this->_extra_data['message_type'] : ''; |
|
483 | + if ( ! $reg instanceof EE_Registration || empty($message_type)) { |
|
484 | 484 | return''; |
485 | 485 | } |
486 | 486 | |
487 | - $switch_to_invoice = ! $message_type instanceof EE_Invoice_message_type ? true : false; |
|
488 | - $switch_to_label = $switch_to_invoice && ! $message_type instanceof EE_Receipt_message_type ? __('View Invoice', 'event_espresso' ) : __( 'Switch to Invoice', 'event_espresso' ); |
|
489 | - $switch_to_label = ! $switch_to_invoice ? __( 'Switch to Receipt', 'event_espresso' ) : $switch_to_label; |
|
487 | + $switch_to_invoice = ! $message_type instanceof EE_Invoice_message_type ? true : false; |
|
488 | + $switch_to_label = $switch_to_invoice && ! $message_type instanceof EE_Receipt_message_type ? __('View Invoice', 'event_espresso') : __('Switch to Invoice', 'event_espresso'); |
|
489 | + $switch_to_label = ! $switch_to_invoice ? __('Switch to Receipt', 'event_espresso') : $switch_to_label; |
|
490 | 490 | $switch_to_url = $switch_to_invoice ? $reg->invoice_url() : $reg->receipt_url(); |
491 | 491 | |
492 | - if ( ! $button ) { |
|
492 | + if ( ! $button) { |
|
493 | 493 | return $switch_to_url; |
494 | 494 | } |
495 | 495 | |
496 | - if ( ! empty( $switch_to_url ) ) { |
|
496 | + if ( ! empty($switch_to_url)) { |
|
497 | 497 | |
498 | 498 | return ' |
499 | -<form method="post" action="' . $switch_to_url . '" > |
|
500 | - <input class="print_button" type="submit" value="' . $switch_to_label . '" /> |
|
499 | +<form method="post" action="' . $switch_to_url.'" > |
|
500 | + <input class="print_button" type="submit" value="' . $switch_to_label.'" /> |
|
501 | 501 | </form> |
502 | 502 | '; |
503 | 503 | } |
@@ -517,11 +517,11 @@ discard block |
||
517 | 517 | * |
518 | 518 | * @return string |
519 | 519 | */ |
520 | - private function _get_receipt_url( EE_Transaction $transaction ) { |
|
520 | + private function _get_receipt_url(EE_Transaction $transaction) { |
|
521 | 521 | //get primary_registration |
522 | 522 | $reg = $this->_data->primary_reg_obj; |
523 | 523 | |
524 | - if ( ! $reg instanceof EE_Registration ) { |
|
524 | + if ( ! $reg instanceof EE_Registration) { |
|
525 | 525 | return ''; |
526 | 526 | } |
527 | 527 | |
@@ -537,10 +537,10 @@ discard block |
||
537 | 537 | * |
538 | 538 | * @return int |
539 | 539 | */ |
540 | - private function _get_subtotal( $tax = FALSE ) { |
|
541 | - $grand_total = isset( $this->_data->grand_total_line_item ) ? $this->_data->grand_total_line_item : NULL; |
|
540 | + private function _get_subtotal($tax = FALSE) { |
|
541 | + $grand_total = isset($this->_data->grand_total_line_item) ? $this->_data->grand_total_line_item : NULL; |
|
542 | 542 | |
543 | - if ( ! $grand_total instanceof EE_Line_Item ) { |
|
543 | + if ( ! $grand_total instanceof EE_Line_Item) { |
|
544 | 544 | return 0; |
545 | 545 | } |
546 | 546 | |
@@ -559,27 +559,27 @@ discard block |
||
559 | 559 | * |
560 | 560 | * @return string parsed. |
561 | 561 | */ |
562 | - private function _get_payment_link_if_needed( $shortcode ) { |
|
563 | - $valid_shortcodes = array( 'transaction' ); |
|
564 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
562 | + private function _get_payment_link_if_needed($shortcode) { |
|
563 | + $valid_shortcodes = array('transaction'); |
|
564 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
565 | 565 | |
566 | 566 | //ensure default is set. |
567 | 567 | $addressee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
568 | 568 | $total_owing = $addressee instanceof EE_Messages_Addressee && $addressee->txn instanceof EE_Transaction ? $addressee->txn->remaining() : 0; |
569 | 569 | |
570 | - if ( $total_owing > 0 ) { |
|
571 | - $class = isset( $attrs['class'] ) ? $attrs['class'] : 'callout'; |
|
572 | - $custom_text = isset( $attrs['custom_text'] ) ? $attrs['custom_text'] : 'You can %smake a payment here »%s.'; |
|
573 | - $container_tag = isset( $attrs['container_tag'] ) ? $attrs['container_tag'] : 'p'; |
|
574 | - $opening_tag = ! empty( $container_tag ) ? '<' . $container_tag : ''; |
|
575 | - $opening_tag .= ! empty( $opening_tag ) && !empty( $class ) ? ' class="' . $class . '"' : $opening_tag; |
|
576 | - $opening_tag .= !empty( $opening_tag ) ? '>' : $opening_tag; |
|
577 | - $closing_tag = ! empty( $container_tag ) ? '</' . $container_tag .'>' : ''; |
|
578 | - $content = $opening_tag . sprintf( $custom_text, '<a href="[PAYMENT_URL]">', '</a>' ) . $closing_tag; |
|
570 | + if ($total_owing > 0) { |
|
571 | + $class = isset($attrs['class']) ? $attrs['class'] : 'callout'; |
|
572 | + $custom_text = isset($attrs['custom_text']) ? $attrs['custom_text'] : 'You can %smake a payment here »%s.'; |
|
573 | + $container_tag = isset($attrs['container_tag']) ? $attrs['container_tag'] : 'p'; |
|
574 | + $opening_tag = ! empty($container_tag) ? '<'.$container_tag : ''; |
|
575 | + $opening_tag .= ! empty($opening_tag) && ! empty($class) ? ' class="'.$class.'"' : $opening_tag; |
|
576 | + $opening_tag .= ! empty($opening_tag) ? '>' : $opening_tag; |
|
577 | + $closing_tag = ! empty($container_tag) ? '</'.$container_tag.'>' : ''; |
|
578 | + $content = $opening_tag.sprintf($custom_text, '<a href="[PAYMENT_URL]">', '</a>').$closing_tag; |
|
579 | 579 | |
580 | 580 | //we need to re run this string through the parser to catch any shortcodes that are in it. |
581 | 581 | $this->_set_shortcode_helper(); |
582 | - $owing_content = $this->_shortcode_helper->parse_message_template( $content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message ); |
|
582 | + $owing_content = $this->_shortcode_helper->parse_message_template($content, $addressee, $valid_shortcodes, $this->_message_type, $this->_messenger, $this->_message); |
|
583 | 583 | } else { |
584 | 584 | return ''; |
585 | 585 | } |
@@ -599,31 +599,31 @@ discard block |
||
599 | 599 | * @param EE_Transaction $transaction |
600 | 600 | * @return string |
601 | 601 | */ |
602 | - protected function _get_payment_due_date( $shortcode, EE_Transaction $transaction ) { |
|
602 | + protected function _get_payment_due_date($shortcode, EE_Transaction $transaction) { |
|
603 | 603 | //if transaction is paid in full then we can just return an empty string |
604 | - if ( $transaction->remaining() === 0 ) { |
|
604 | + if ($transaction->remaining() === 0) { |
|
605 | 605 | return ''; |
606 | 606 | } |
607 | 607 | |
608 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
609 | - $format = isset( $attrs['format'] ) ? $attrs['format'] : get_option( 'date_format' ); |
|
610 | - $days_until_due = isset( $attrs['days_until_due'] ) ? (int) $attrs['days_until_due'] : 30; |
|
611 | - $prefix_text = isset( $attrs['prefix_text'] ) ? $attrs['prefix_text'] : __( 'Payment in full due by: ', 'event_espresso' ); |
|
612 | - $transaction_created = $transaction->get_DateTime_object( 'TXN_timestamp' ); |
|
608 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
609 | + $format = isset($attrs['format']) ? $attrs['format'] : get_option('date_format'); |
|
610 | + $days_until_due = isset($attrs['days_until_due']) ? (int) $attrs['days_until_due'] : 30; |
|
611 | + $prefix_text = isset($attrs['prefix_text']) ? $attrs['prefix_text'] : __('Payment in full due by: ', 'event_espresso'); |
|
612 | + $transaction_created = $transaction->get_DateTime_object('TXN_timestamp'); |
|
613 | 613 | |
614 | 614 | //setup date due: |
615 | 615 | try { |
616 | - if ( $transaction_created instanceof DateTime ) { |
|
617 | - $date_due = $transaction_created->add( new DateInterval( 'P' . $days_until_due . 'D' ) )->format( $format ); |
|
616 | + if ($transaction_created instanceof DateTime) { |
|
617 | + $date_due = $transaction_created->add(new DateInterval('P'.$days_until_due.'D'))->format($format); |
|
618 | 618 | } else { |
619 | 619 | throw new Exception(); |
620 | 620 | } |
621 | - } catch( Exception $e ) { |
|
621 | + } catch (Exception $e) { |
|
622 | 622 | //format was likely invalid. |
623 | 623 | $date_due = 'Unable to calculate date due, likely the format string is invalid.'; |
624 | 624 | } |
625 | 625 | |
626 | - return $prefix_text . $date_due; |
|
626 | + return $prefix_text.$date_due; |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | } //end EE_Transaction Shortcodes library |