@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * @param array $arguments |
40 | 40 | * @return \EE_CPT_Event_Strategy |
41 | 41 | */ |
42 | - public function __construct( $arguments = array() ) { |
|
43 | - $this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : NULL; |
|
44 | - $WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : NULL; |
|
42 | + public function __construct($arguments = array()) { |
|
43 | + $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : NULL; |
|
44 | + $WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : NULL; |
|
45 | 45 | |
46 | 46 | // !!!!!!!!!! IMPORTANT !!!!!!!!!!!! |
47 | 47 | // here's the list of available filters in the WP_Query object |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | // 'posts_fields' |
56 | 56 | // 'posts_join' |
57 | 57 | $this->_add_filters(); |
58 | - if ( $WP_Query instanceof WP_Query ) { |
|
59 | - $WP_Query->is_espresso_event_single = is_singular() && isset( $WP_Query->query->post_type ) && $WP_Query->query->post_type == 'espresso_events' ? TRUE : FALSE; |
|
58 | + if ($WP_Query instanceof WP_Query) { |
|
59 | + $WP_Query->is_espresso_event_single = is_singular() && isset($WP_Query->query->post_type) && $WP_Query->query->post_type == 'espresso_events' ? TRUE : FALSE; |
|
60 | 60 | $WP_Query->is_espresso_event_archive = is_post_type_archive('espresso_events') ? TRUE : FALSE; |
61 | - $WP_Query->is_espresso_event_taxonomy = is_tax( 'espresso_event_categories' ) ? TRUE : FALSE; |
|
61 | + $WP_Query->is_espresso_event_taxonomy = is_tax('espresso_event_categories') ? TRUE : FALSE; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | } |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | * (which will get removed in case the next call to get_posts ISN'T |
71 | 71 | * for event CPTs) |
72 | 72 | */ |
73 | - protected function _add_filters(){ |
|
74 | - add_filter( 'posts_fields', array( $this, 'posts_fields' ), 1, 2 ); |
|
75 | - add_filter( 'posts_join', array( $this, 'posts_join' ), 1, 2 ); |
|
76 | - add_filter( 'posts_where', array( $this, 'posts_where' ), 10, 2 ); |
|
77 | - add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 ); |
|
78 | - add_filter( 'posts_orderby', array( $this, 'posts_orderby' ), 1, 2 ); |
|
79 | - add_filter( 'posts_groupby', array( $this, 'posts_groupby' ), 1, 2 ); |
|
73 | + protected function _add_filters() { |
|
74 | + add_filter('posts_fields', array($this, 'posts_fields'), 1, 2); |
|
75 | + add_filter('posts_join', array($this, 'posts_join'), 1, 2); |
|
76 | + add_filter('posts_where', array($this, 'posts_where'), 10, 2); |
|
77 | + add_filter('the_posts', array($this, 'the_posts'), 1, 2); |
|
78 | + add_filter('posts_orderby', array($this, 'posts_orderby'), 1, 2); |
|
79 | + add_filter('posts_groupby', array($this, 'posts_groupby'), 1, 2); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | * This is to avoid applying this CPT strategy for other posts or CPTs (eg, |
87 | 87 | * we don't want to join to the datetime table when querying for venues, do we!?) |
88 | 88 | */ |
89 | - protected function _remove_filters(){ |
|
90 | - remove_filter( 'posts_fields', array( $this, 'posts_fields' ), 1 ); |
|
91 | - remove_filter( 'posts_join', array( $this, 'posts_join' ), 1 ); |
|
92 | - remove_filter( 'posts_where', array( $this, 'posts_where' ), 10 ); |
|
93 | - remove_filter( 'the_posts', array( $this, 'the_posts' ), 1 ); |
|
94 | - remove_filter( 'posts_orderby', array( $this, 'posts_orderby' ), 1 ); |
|
95 | - remove_filter( 'posts_groupby', array( $this, 'posts_groupby' ), 1 ); |
|
89 | + protected function _remove_filters() { |
|
90 | + remove_filter('posts_fields', array($this, 'posts_fields'), 1); |
|
91 | + remove_filter('posts_join', array($this, 'posts_join'), 1); |
|
92 | + remove_filter('posts_where', array($this, 'posts_where'), 10); |
|
93 | + remove_filter('the_posts', array($this, 'the_posts'), 1); |
|
94 | + remove_filter('posts_orderby', array($this, 'posts_orderby'), 1); |
|
95 | + remove_filter('posts_groupby', array($this, 'posts_groupby'), 1); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @param WP_Query $wp_query |
106 | 106 | * @return string |
107 | 107 | */ |
108 | - public function posts_fields( $SQL, WP_Query $wp_query ) { |
|
108 | + public function posts_fields($SQL, WP_Query $wp_query) { |
|
109 | 109 | if ( |
110 | 110 | $wp_query instanceof WP_Query |
111 | 111 | && |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | ) |
117 | 117 | ) { |
118 | 118 | // adds something like ", wp_esp_datetime.* " to WP Query SELECT statement |
119 | - $SQL .= ', ' . EEM_Datetime::instance()->table() . '.* ' ; |
|
120 | - if ( $wp_query->is_espresso_event_archive || $wp_query->is_espresso_event_taxonomy ) { |
|
119 | + $SQL .= ', '.EEM_Datetime::instance()->table().'.* '; |
|
120 | + if ($wp_query->is_espresso_event_archive || $wp_query->is_espresso_event_taxonomy) { |
|
121 | 121 | // because we only want to retrieve the next upcoming datetime for each event: |
122 | 122 | // add something like ", MIN( wp_esp_datetime.DTT_EVT_start ) as event_start_date " to WP Query SELECT statement |
123 | - $SQL .= ', MIN( ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start ) as event_start_date ' ; |
|
123 | + $SQL .= ', MIN( '.EEM_Datetime::instance()->table().'.DTT_EVT_start ) as event_start_date '; |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | return $SQL; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @internal param \WP_Query $WP_Query |
138 | 138 | * @return string |
139 | 139 | */ |
140 | - public function posts_join( $SQL, WP_Query $wp_query ) { |
|
140 | + public function posts_join($SQL, WP_Query $wp_query) { |
|
141 | 141 | if ( |
142 | 142 | $wp_query instanceof WP_Query |
143 | 143 | && |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | ) |
149 | 149 | ) { |
150 | 150 | // adds something like " LEFT JOIN wp_esp_datetime ON ( wp_esp_datetime.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement |
151 | - $SQL .= ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . EEM_Event::instance()->table() . '.ID = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name() . ' ) '; |
|
151 | + $SQL .= ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.EEM_Event::instance()->table().'.ID = '.EEM_Datetime::instance()->table().'.'.EEM_Event::instance()->primary_key_name().' ) '; |
|
152 | 152 | } |
153 | 153 | return $SQL; |
154 | 154 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @param WP_Query $wp_query |
164 | 164 | * @return string |
165 | 165 | */ |
166 | - public function posts_where( $SQL, WP_Query $wp_query ) { |
|
166 | + public function posts_where($SQL, WP_Query $wp_query) { |
|
167 | 167 | // global $wpdb; |
168 | 168 | if ( |
169 | 169 | $wp_query instanceof WP_Query |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | || $wp_query->is_espresso_event_taxonomy |
174 | 174 | ) |
175 | 175 | ) { |
176 | - if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive ) || ! isset( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events ) || ! EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events ) { |
|
177 | - $SQL .= ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end > "' . current_time( 'mysql', true ) . '" '; |
|
176 | + if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Events_Archive) || ! isset(EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events) || ! EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events) { |
|
177 | + $SQL .= ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end > "'.current_time('mysql', true).'" '; |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | return $SQL; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @param WP_Query $wp_query |
191 | 191 | * @return string |
192 | 192 | */ |
193 | - public function posts_orderby( $SQL, WP_Query $wp_query ) { |
|
193 | + public function posts_orderby($SQL, WP_Query $wp_query) { |
|
194 | 194 | if ( |
195 | 195 | $wp_query instanceof WP_Query |
196 | 196 | && |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @param WP_Query $wp_query |
215 | 215 | * @return string |
216 | 216 | */ |
217 | - public function posts_groupby( $SQL, WP_Query $wp_query ) { |
|
217 | + public function posts_groupby($SQL, WP_Query $wp_query) { |
|
218 | 218 | if ( |
219 | 219 | $wp_query instanceof WP_Query |
220 | 220 | && |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | // we're joining to the datetimes table, where there can be MANY datetimes for a single event, but we want to only show each event only once |
228 | 228 | // (whereas if we didn't group them by the post's ID, then we would end up with many repeats) |
229 | 229 | global $wpdb; |
230 | - $SQL = $wpdb->posts . '.ID '; |
|
230 | + $SQL = $wpdb->posts.'.ID '; |
|
231 | 231 | } |
232 | 232 | return $SQL; |
233 | 233 | } |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | * @param WP_Query $wp_query |
243 | 243 | * @return array |
244 | 244 | */ |
245 | - public function the_posts( $posts, WP_Query $wp_query ) { |
|
246 | - if ( $wp_query instanceof WP_Query && isset( $wp_query->query_vars['post_type'] ) && $wp_query->query_vars['post_type'] == 'espresso_events' ) { |
|
245 | + public function the_posts($posts, WP_Query $wp_query) { |
|
246 | + if ($wp_query instanceof WP_Query && isset($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == 'espresso_events') { |
|
247 | 247 | // automagically load the EEH_Event_View helper so that it's functions are available |
248 | 248 | EE_Registry::instance()->load_helper('Event_View'); |
249 | 249 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @param $single |
263 | 263 | * @return string |
264 | 264 | */ |
265 | - public function get_EE_post_type_metadata( $meta_value = NULL, $post_id, $meta_key, $single ) { |
|
265 | + public function get_EE_post_type_metadata($meta_value = NULL, $post_id, $meta_key, $single) { |
|
266 | 266 | return $meta_value; |
267 | 267 | } |
268 | 268 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | protected function _get_billing_values_from_form( $billing_form ){ |
443 | 443 | if($billing_form instanceof EE_Form_Section_Proper ){ |
444 | 444 | return $billing_form->input_pretty_values( true ); |
445 | - }else{ |
|
445 | + } else{ |
|
446 | 446 | return NULL; |
447 | 447 | } |
448 | 448 | } |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | public function supports_sending_refunds(){ |
551 | 551 | if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
552 | 552 | return $this->_gateway->supports_sending_refunds(); |
553 | - }else{ |
|
553 | + } else{ |
|
554 | 554 | return false; |
555 | 555 | } |
556 | 556 | } |
@@ -588,11 +588,11 @@ discard block |
||
588 | 588 | public function payment_occurs(){ |
589 | 589 | if( ! $this->_gateway){ |
590 | 590 | return EE_PMT_Base::offline; |
591 | - }elseif($this->_gateway instanceof EE_Onsite_Gateway){ |
|
591 | + } elseif($this->_gateway instanceof EE_Onsite_Gateway){ |
|
592 | 592 | return EE_PMT_Base::onsite; |
593 | - }elseif($this->_gateway instanceof EE_Offsite_Gateway){ |
|
593 | + } elseif($this->_gateway instanceof EE_Offsite_Gateway){ |
|
594 | 594 | return EE_PMT_Base::offsite; |
595 | - }else{ |
|
595 | + } else{ |
|
596 | 596 | throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"),get_class($this))); |
597 | 597 | } |
598 | 598 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * @since $VID:$ |
15 | 15 | * |
16 | 16 | */ |
17 | -abstract class EE_PMT_Base{ |
|
17 | +abstract class EE_PMT_Base { |
|
18 | 18 | |
19 | 19 | const onsite = 'on-site'; |
20 | 20 | const offsite = 'off-site'; |
@@ -95,34 +95,34 @@ discard block |
||
95 | 95 | * @return EE_PMT_Base |
96 | 96 | */ |
97 | 97 | function __construct($pm_instance = NULL) { |
98 | - if ( $pm_instance instanceof EE_Payment_Method ){ |
|
98 | + if ($pm_instance instanceof EE_Payment_Method) { |
|
99 | 99 | $this->set_instance($pm_instance); |
100 | 100 | } |
101 | - if($this->_gateway){ |
|
102 | - $this->_gateway->set_payment_model( EEM_Payment::instance() ); |
|
103 | - $this->_gateway->set_payment_log( EEM_Change_Log::instance() ); |
|
104 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
105 | - $this->_gateway->set_template_helper( new EEH_Template() ); |
|
106 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
107 | - $this->_gateway->set_line_item_helper( new EEH_Line_Item() ); |
|
108 | - EE_Registry::instance()->load_helper( 'Money' ); |
|
109 | - $this->_gateway->set_money_helper( new EEH_Money() ); |
|
101 | + if ($this->_gateway) { |
|
102 | + $this->_gateway->set_payment_model(EEM_Payment::instance()); |
|
103 | + $this->_gateway->set_payment_log(EEM_Change_Log::instance()); |
|
104 | + EE_Registry::instance()->load_helper('Template'); |
|
105 | + $this->_gateway->set_template_helper(new EEH_Template()); |
|
106 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
107 | + $this->_gateway->set_line_item_helper(new EEH_Line_Item()); |
|
108 | + EE_Registry::instance()->load_helper('Money'); |
|
109 | + $this->_gateway->set_money_helper(new EEH_Money()); |
|
110 | 110 | } |
111 | - if ( ! isset( $this->_has_billing_form ) ) { |
|
111 | + if ( ! isset($this->_has_billing_form)) { |
|
112 | 112 | // by default, On Site gateways have a billing form |
113 | - if ( $this->payment_occurs() == EE_PMT_Base::onsite ) { |
|
114 | - $this->set_has_billing_form( true ); |
|
113 | + if ($this->payment_occurs() == EE_PMT_Base::onsite) { |
|
114 | + $this->set_has_billing_form(true); |
|
115 | 115 | } else { |
116 | - $this->set_has_billing_form( false ); |
|
116 | + $this->set_has_billing_form(false); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | - if( ! $this->_pretty_name){ |
|
120 | + if ( ! $this->_pretty_name) { |
|
121 | 121 | throw new EE_Error(sprintf(__("You must set the pretty name for the Payment Method Type in the constructor (_pretty_name), and please make it internationalized", "event_espresso"))); |
122 | 122 | } |
123 | 123 | //if the child didn't specify a default button, use the credit card one |
124 | - if( $this->_default_button_url === NULL){ |
|
125 | - $this->_default_button_url = EE_PLUGIN_DIR_URL . 'payment_methods' . DS . 'pay-by-credit-card.png'; |
|
124 | + if ($this->_default_button_url === NULL) { |
|
125 | + $this->_default_button_url = EE_PLUGIN_DIR_URL.'payment_methods'.DS.'pay-by-credit-card.png'; |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | /** |
132 | 132 | * @param boolean $has_billing_form |
133 | 133 | */ |
134 | - public function set_has_billing_form( $has_billing_form ) { |
|
135 | - $this->_has_billing_form = filter_var( $has_billing_form, FILTER_VALIDATE_BOOLEAN ); |
|
134 | + public function set_has_billing_form($has_billing_form) { |
|
135 | + $this->_has_billing_form = filter_var($has_billing_form, FILTER_VALIDATE_BOOLEAN); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | /** |
141 | 141 | * sets the file_folder property |
142 | 142 | */ |
143 | - protected function _set_file_folder(){ |
|
143 | + protected function _set_file_folder() { |
|
144 | 144 | $reflector = new ReflectionClass(get_class($this)); |
145 | 145 | $fn = $reflector->getFileName(); |
146 | - $this->_file_folder = dirname($fn).DS; |
|
146 | + $this->_file_folder = dirname($fn).DS; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | /** |
152 | 152 | * sets the file URL with a trailing slash for this PMT |
153 | 153 | */ |
154 | - protected function _set_file_url(){ |
|
155 | - $plugins_dir_fixed = str_replace('\\',DS,WP_PLUGIN_DIR); |
|
156 | - $file_folder_fixed = str_replace('\\',DS,$this->file_folder()); |
|
157 | - $file_path = str_replace($plugins_dir_fixed,WP_PLUGIN_URL,$file_folder_fixed); |
|
154 | + protected function _set_file_url() { |
|
155 | + $plugins_dir_fixed = str_replace('\\', DS, WP_PLUGIN_DIR); |
|
156 | + $file_folder_fixed = str_replace('\\', DS, $this->file_folder()); |
|
157 | + $file_path = str_replace($plugins_dir_fixed, WP_PLUGIN_URL, $file_folder_fixed); |
|
158 | 158 | $this->_file_url = $file_path; |
159 | 159 | } |
160 | 160 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * Gets the default description on all payment methods of this type |
163 | 163 | * @return string |
164 | 164 | */ |
165 | - public function default_description(){ |
|
165 | + public function default_description() { |
|
166 | 166 | return $this->_default_description; |
167 | 167 | } |
168 | 168 | |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | * Returns the folder containing the PMT child class, with a trailing slash |
173 | 173 | * @return string |
174 | 174 | */ |
175 | - public function file_folder(){ |
|
176 | - if( ! $this->_file_folder ) { |
|
175 | + public function file_folder() { |
|
176 | + if ( ! $this->_file_folder) { |
|
177 | 177 | $this->_set_file_folder(); |
178 | 178 | } |
179 | 179 | return $this->_file_folder; |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | /** |
185 | 185 | * @return string |
186 | 186 | */ |
187 | - public function file_url(){ |
|
188 | - if( ! $this->_file_url ) { |
|
187 | + public function file_url() { |
|
188 | + if ( ! $this->_file_url) { |
|
189 | 189 | $this->_set_file_url(); |
190 | 190 | } |
191 | 191 | return $this->_file_url; |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | * Its important teh payment method instance is set before |
199 | 199 | * @param EE_Payment_Method $payment_method_instance |
200 | 200 | */ |
201 | - function set_instance($payment_method_instance){ |
|
201 | + function set_instance($payment_method_instance) { |
|
202 | 202 | $this->_pm_instance = $payment_method_instance; |
203 | 203 | //if they have already requested the settings form, make sure its |
204 | 204 | //data matches this model object |
205 | - if($this->_settings_form){ |
|
205 | + if ($this->_settings_form) { |
|
206 | 206 | $this->settings_form()->populate_model_obj($payment_method_instance); |
207 | 207 | } |
208 | - if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
|
208 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
209 | 209 | $this->_gateway->set_settings($payment_method_instance->settings_array()); |
210 | 210 | } |
211 | 211 | } |
@@ -216,14 +216,14 @@ discard block |
||
216 | 216 | * Gets teh form for displaying to admins where they setup the payment method |
217 | 217 | * @return EE_Payment_Method_Form |
218 | 218 | */ |
219 | - function settings_form(){ |
|
220 | - if( ! $this->_settings_form){ |
|
219 | + function settings_form() { |
|
220 | + if ( ! $this->_settings_form) { |
|
221 | 221 | $this->_settings_form = $this->generate_new_settings_form(); |
222 | - $this->_settings_form->set_payment_method_type( $this ); |
|
223 | - $this->_settings_form->_construct_finalize(NULL, NULL ); |
|
222 | + $this->_settings_form->set_payment_method_type($this); |
|
223 | + $this->_settings_form->_construct_finalize(NULL, NULL); |
|
224 | 224 | //if we have already assigned a model object to this pmt, make |
225 | 225 | //sure its reflected in teh form we just generated |
226 | - if($this->_pm_instance){ |
|
226 | + if ($this->_pm_instance) { |
|
227 | 227 | $this->_settings_form->populate_model_obj($this->_pm_instance); |
228 | 228 | } |
229 | 229 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * this payment method type's settings form later in the request |
250 | 250 | * @param EE_Payment_Method_Form $form |
251 | 251 | */ |
252 | - public function set_settings_form($form){ |
|
252 | + public function set_settings_form($form) { |
|
253 | 253 | $this->_settings_form = $form; |
254 | 254 | } |
255 | 255 | |
@@ -272,10 +272,10 @@ discard block |
||
272 | 272 | * @param array $extra_args |
273 | 273 | * @return \EE_Billing_Attendee_Info_Form|\EE_Billing_Info_Form|null |
274 | 274 | */ |
275 | - public function billing_form( EE_Transaction $transaction = NULL, $extra_args = array() ){ |
|
275 | + public function billing_form(EE_Transaction $transaction = NULL, $extra_args = array()) { |
|
276 | 276 | // has billing form already been regenerated ? or overwrite cache? |
277 | - if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form ){ |
|
278 | - $this->_billing_form = $this->generate_new_billing_form( $transaction, $extra_args ); |
|
277 | + if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form) { |
|
278 | + $this->_billing_form = $this->generate_new_billing_form($transaction, $extra_args); |
|
279 | 279 | } |
280 | 280 | //if we know who the attendee is, and this is a billing form |
281 | 281 | //that uses attendee info, populate it |
@@ -284,8 +284,8 @@ discard block |
||
284 | 284 | $transaction instanceof EE_Transaction && |
285 | 285 | $transaction->primary_registration() instanceof EE_Registration && |
286 | 286 | $transaction->primary_registration()->attendee() instanceof EE_Attendee |
287 | - ){ |
|
288 | - $this->_billing_form->populate_from_attendee( $transaction->primary_registration()->attendee() ); |
|
287 | + ) { |
|
288 | + $this->_billing_form->populate_from_attendee($transaction->primary_registration()->attendee()); |
|
289 | 289 | } |
290 | 290 | return $this->_billing_form; |
291 | 291 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * @param \EE_Transaction $transaction |
297 | 297 | * @return \EE_Billing_Info_Form |
298 | 298 | */ |
299 | - abstract function generate_new_billing_form( EE_Transaction $transaction = NULL ); |
|
299 | + abstract function generate_new_billing_form(EE_Transaction $transaction = NULL); |
|
300 | 300 | |
301 | 301 | |
302 | 302 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | * @param \EE_Billing_Info_Form $billing_form |
308 | 308 | * @return \EE_Billing_Info_Form |
309 | 309 | */ |
310 | - public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) { |
|
310 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) { |
|
311 | 311 | return $billing_form; |
312 | 312 | } |
313 | 313 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | * if you have form |
319 | 319 | * @param EE_Payment_Method $form |
320 | 320 | */ |
321 | - public function set_billing_form($form){ |
|
321 | + public function set_billing_form($form) { |
|
322 | 322 | $this->_billing_form = $form; |
323 | 323 | } |
324 | 324 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | * Returns whether or not this payment method requires HTTPS to be used |
329 | 329 | * @return boolean |
330 | 330 | */ |
331 | - function requires_https(){ |
|
331 | + function requires_https() { |
|
332 | 332 | return $this->_requires_https; |
333 | 333 | } |
334 | 334 | |
@@ -346,9 +346,9 @@ discard block |
||
346 | 346 | * @return EE_Payment |
347 | 347 | * @throws EE_Error |
348 | 348 | */ |
349 | - function process_payment( EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null,$fail_url = '', $method = 'CART', $by_admin = false ){ |
|
349 | + function process_payment(EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null, $fail_url = '', $method = 'CART', $by_admin = false) { |
|
350 | 350 | // @todo: add surcharge for the payment method, if any |
351 | - if ( $this->_gateway ) { |
|
351 | + if ($this->_gateway) { |
|
352 | 352 | //there is a gateway, so we're going to make a payment object |
353 | 353 | //but wait! do they already have a payment in progress that we thought was failed? |
354 | 354 | $duplicate_properties = array( |
@@ -359,10 +359,10 @@ discard block |
||
359 | 359 | 'PAY_amount' => $amount !== null ? $amount : $transaction->remaining(), |
360 | 360 | 'PAY_gateway_response' => null, |
361 | 361 | ); |
362 | - $payment = EEM_Payment::instance()->get_one( array( $duplicate_properties )); |
|
362 | + $payment = EEM_Payment::instance()->get_one(array($duplicate_properties)); |
|
363 | 363 | //if we didn't already have a payment in progress for the same thing, |
364 | 364 | //then we actually want to make a new payment |
365 | - if ( ! $payment instanceof EE_Payment ){ |
|
365 | + if ( ! $payment instanceof EE_Payment) { |
|
366 | 366 | $payment = EE_Payment::new_instance( |
367 | 367 | array_merge( |
368 | 368 | $duplicate_properties, |
@@ -378,10 +378,10 @@ discard block |
||
378 | 378 | } |
379 | 379 | //make sure the payment has been saved to show we started it, and so it has an ID should the gateway try to log it |
380 | 380 | $payment->save(); |
381 | - $billing_values = $this->_get_billing_values_from_form( $billing_info ); |
|
381 | + $billing_values = $this->_get_billing_values_from_form($billing_info); |
|
382 | 382 | |
383 | 383 | // Offsite Gateway |
384 | - if( $this->_gateway instanceof EE_Offsite_Gateway ){ |
|
384 | + if ($this->_gateway instanceof EE_Offsite_Gateway) { |
|
385 | 385 | |
386 | 386 | $payment = $this->_gateway->set_redirection_info( |
387 | 387 | $payment, |
@@ -397,17 +397,17 @@ discard block |
||
397 | 397 | ); |
398 | 398 | $payment->save(); |
399 | 399 | // Onsite Gateway |
400 | - } elseif ( $this->_gateway instanceof EE_Onsite_Gateway ) { |
|
400 | + } elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
|
401 | 401 | |
402 | - $payment = $this->_gateway->do_direct_payment($payment,$billing_values); |
|
402 | + $payment = $this->_gateway->do_direct_payment($payment, $billing_values); |
|
403 | 403 | $payment->save(); |
404 | 404 | |
405 | 405 | } else { |
406 | 406 | throw new EE_Error( |
407 | 407 | sprintf( |
408 | - __('Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)', 'event_espresso' ), |
|
408 | + __('Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)', 'event_espresso'), |
|
409 | 409 | get_class($this), |
410 | - gettype( $this->_gateway ) |
|
410 | + gettype($this->_gateway) |
|
411 | 411 | ) |
412 | 412 | ); |
413 | 413 | } |
@@ -429,8 +429,8 @@ discard block |
||
429 | 429 | } |
430 | 430 | |
431 | 431 | // if there is billing info, clean it and save it now |
432 | - if( $billing_info instanceof EE_Billing_Attendee_Info_Form ){ |
|
433 | - $this->_save_billing_info_to_attendee( $billing_info, $transaction ); |
|
432 | + if ($billing_info instanceof EE_Billing_Attendee_Info_Form) { |
|
433 | + $this->_save_billing_info_to_attendee($billing_info, $transaction); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | return $payment; |
@@ -443,10 +443,10 @@ discard block |
||
443 | 443 | * @param EE_Billing_Info_Form $billing_form |
444 | 444 | * @return array |
445 | 445 | */ |
446 | - protected function _get_billing_values_from_form( $billing_form ){ |
|
447 | - if($billing_form instanceof EE_Form_Section_Proper ){ |
|
448 | - return $billing_form->input_pretty_values( true ); |
|
449 | - }else{ |
|
446 | + protected function _get_billing_values_from_form($billing_form) { |
|
447 | + if ($billing_form instanceof EE_Form_Section_Proper) { |
|
448 | + return $billing_form->input_pretty_values(true); |
|
449 | + } else { |
|
450 | 450 | return NULL; |
451 | 451 | } |
452 | 452 | } |
@@ -460,13 +460,13 @@ discard block |
||
460 | 460 | * @return EE_Payment |
461 | 461 | * @throws EE_Error |
462 | 462 | */ |
463 | - public function handle_ipn($req_data,$transaction){ |
|
463 | + public function handle_ipn($req_data, $transaction) { |
|
464 | 464 | $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
465 | - if( ! $this->_gateway instanceof EE_Offsite_Gateway){ |
|
466 | - throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r( $this->_gateway, TRUE ))); |
|
465 | + if ( ! $this->_gateway instanceof EE_Offsite_Gateway) { |
|
466 | + throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r($this->_gateway, TRUE))); |
|
467 | 467 | |
468 | 468 | } |
469 | - $payment = $this->_gateway->handle_payment_update( $req_data, $transaction ); |
|
469 | + $payment = $this->_gateway->handle_payment_update($req_data, $transaction); |
|
470 | 470 | return $payment; |
471 | 471 | } |
472 | 472 | |
@@ -479,22 +479,22 @@ discard block |
||
479 | 479 | * @param EE_Transaction $transaction |
480 | 480 | * @return boolean success |
481 | 481 | */ |
482 | - protected function _save_billing_info_to_attendee($billing_form, $transaction){ |
|
483 | - if( ! $transaction || ! $transaction instanceof EE_Transaction){ |
|
482 | + protected function _save_billing_info_to_attendee($billing_form, $transaction) { |
|
483 | + if ( ! $transaction || ! $transaction instanceof EE_Transaction) { |
|
484 | 484 | EE_Error::add_error(__("Cannot save billing info because no transaction was specified", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
485 | 485 | return false; |
486 | 486 | } |
487 | 487 | $primary_reg = $transaction->primary_registration(); |
488 | - if( ! $primary_reg ){ |
|
488 | + if ( ! $primary_reg) { |
|
489 | 489 | EE_Error::add_error(__("Cannot save billing info because the transaction has no primary registration", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
490 | 490 | return false; |
491 | 491 | } |
492 | 492 | $attendee = $primary_reg->attendee(); |
493 | - if( ! $attendee ){ |
|
493 | + if ( ! $attendee) { |
|
494 | 494 | EE_Error::add_error(__("Cannot save billing info because the transaction's primary registration has no attendee!", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
495 | 495 | return false; |
496 | 496 | } |
497 | - return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method() ); |
|
497 | + return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method()); |
|
498 | 498 | |
499 | 499 | } |
500 | 500 | |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | * @param array $req_data |
508 | 508 | * @return EE_Payment |
509 | 509 | */ |
510 | - protected function find_payment_for_ipn( EE_Transaction $transaction, $req_data = array() ){ |
|
510 | + protected function find_payment_for_ipn(EE_Transaction $transaction, $req_data = array()) { |
|
511 | 511 | return $transaction->last_payment(); |
512 | 512 | } |
513 | 513 | |
@@ -524,8 +524,8 @@ discard block |
||
524 | 524 | * and identifies the IPN as being for this payment method (not just fo ra payment method of this type) |
525 | 525 | * @throws EE_Error |
526 | 526 | */ |
527 | - public function handle_unclaimed_ipn( $req_data = array() ){ |
|
528 | - throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this) )); |
|
527 | + public function handle_unclaimed_ipn($req_data = array()) { |
|
528 | + throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this))); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | * @param EE_Transaction $transaction |
542 | 542 | * @return EE_Payment |
543 | 543 | */ |
544 | - public function finalize_payment_for($transaction){ |
|
544 | + public function finalize_payment_for($transaction) { |
|
545 | 545 | return $transaction->last_payment(); |
546 | 546 | } |
547 | 547 | |
@@ -551,10 +551,10 @@ discard block |
||
551 | 551 | * Whether or not this payment method's gateway supports sending refund requests |
552 | 552 | * @return boolean |
553 | 553 | */ |
554 | - public function supports_sending_refunds(){ |
|
555 | - if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
|
554 | + public function supports_sending_refunds() { |
|
555 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
556 | 556 | return $this->_gateway->supports_sending_refunds(); |
557 | - }else{ |
|
557 | + } else { |
|
558 | 558 | return false; |
559 | 559 | } |
560 | 560 | } |
@@ -568,14 +568,14 @@ discard block |
||
568 | 568 | * @throws EE_Error |
569 | 569 | * @return EE_Payment |
570 | 570 | */ |
571 | - public function process_refund( EE_Payment $payment, $refund_info = array()){ |
|
572 | - if ( $this->_gateway && $this->_gateway instanceof EE_Gateway ) { |
|
573 | - return $this->_gateway->do_direct_refund( $payment, $refund_info ); |
|
571 | + public function process_refund(EE_Payment $payment, $refund_info = array()) { |
|
572 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
573 | + return $this->_gateway->do_direct_refund($payment, $refund_info); |
|
574 | 574 | } else { |
575 | 575 | throw new EE_Error( |
576 | 576 | sprintf( |
577 | - __( 'Payment Method Type "%s" does not support sending refund requests', 'event_espresso' ), |
|
578 | - get_class( $this ) |
|
577 | + __('Payment Method Type "%s" does not support sending refund requests', 'event_espresso'), |
|
578 | + get_class($this) |
|
579 | 579 | ) |
580 | 580 | ); |
581 | 581 | } |
@@ -589,15 +589,15 @@ discard block |
||
589 | 589 | * @return string |
590 | 590 | * @throws EE_Error |
591 | 591 | */ |
592 | - public function payment_occurs(){ |
|
593 | - if( ! $this->_gateway){ |
|
592 | + public function payment_occurs() { |
|
593 | + if ( ! $this->_gateway) { |
|
594 | 594 | return EE_PMT_Base::offline; |
595 | - }elseif($this->_gateway instanceof EE_Onsite_Gateway){ |
|
595 | + }elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
|
596 | 596 | return EE_PMT_Base::onsite; |
597 | - }elseif($this->_gateway instanceof EE_Offsite_Gateway){ |
|
597 | + }elseif ($this->_gateway instanceof EE_Offsite_Gateway) { |
|
598 | 598 | return EE_PMT_Base::offsite; |
599 | - }else{ |
|
600 | - throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"),get_class($this))); |
|
599 | + } else { |
|
600 | + throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"), get_class($this))); |
|
601 | 601 | } |
602 | 602 | } |
603 | 603 | |
@@ -610,9 +610,9 @@ discard block |
||
610 | 610 | * @param EE_Payment $payment |
611 | 611 | * @return string |
612 | 612 | */ |
613 | - public function payment_overview_content(EE_Payment $payment){ |
|
613 | + public function payment_overview_content(EE_Payment $payment) { |
|
614 | 614 | EE_Registry::instance()->load_helper('Template'); |
615 | - return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance,'payment'=>$payment) , true); |
|
615 | + return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance, 'payment'=>$payment), true); |
|
616 | 616 | } |
617 | 617 | |
618 | 618 | |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | * @type array $template_args any arguments you want passed to the template file while rendering. |
626 | 626 | * Keys will be variable names and values with be their values. |
627 | 627 | */ |
628 | - public function help_tabs_config(){ |
|
628 | + public function help_tabs_config() { |
|
629 | 629 | return array(); |
630 | 630 | } |
631 | 631 | |
@@ -636,9 +636,9 @@ discard block |
||
636 | 636 | * the payment method's table's PMT_type column) |
637 | 637 | * @return string |
638 | 638 | */ |
639 | - public function system_name(){ |
|
639 | + public function system_name() { |
|
640 | 640 | $classname = get_class($this); |
641 | - return str_replace("EE_PMT_",'',$classname); |
|
641 | + return str_replace("EE_PMT_", '', $classname); |
|
642 | 642 | } |
643 | 643 | |
644 | 644 | |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | * A pretty i18n version of the PMT name |
648 | 648 | * @return string |
649 | 649 | */ |
650 | - public function pretty_name(){ |
|
650 | + public function pretty_name() { |
|
651 | 651 | return $this->_pretty_name; |
652 | 652 | } |
653 | 653 | |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | * Gets the default absolute URL to the payment method type's button |
658 | 658 | * @return string |
659 | 659 | */ |
660 | - public function default_button_url(){ |
|
660 | + public function default_button_url() { |
|
661 | 661 | return $this->_default_button_url; |
662 | 662 | } |
663 | 663 | |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | * Gets the gateway used by this payment method (if any) |
668 | 668 | * @return EE_Gateway |
669 | 669 | */ |
670 | - public function get_gateway(){ |
|
670 | + public function get_gateway() { |
|
671 | 671 | return $this->_gateway; |
672 | 672 | } |
673 | 673 | |
@@ -676,9 +676,9 @@ discard block |
||
676 | 676 | /** |
677 | 677 | * @return string html for the link to a help tab |
678 | 678 | */ |
679 | - public function get_help_tab_link(){ |
|
680 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
681 | - return EEH_Template::get_help_tab_link( $this->get_help_tab_name() ); |
|
679 | + public function get_help_tab_link() { |
|
680 | + EE_Registry::instance()->load_helper('Template'); |
|
681 | + return EEH_Template::get_help_tab_link($this->get_help_tab_name()); |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | |
@@ -687,8 +687,8 @@ discard block |
||
687 | 687 | * Returns the name of the help tab for this PMT |
688 | 688 | * @return string |
689 | 689 | */ |
690 | - public function get_help_tab_name(){ |
|
691 | - return 'ee_' . strtolower( $this->system_name() ) . '_help_tab'; |
|
690 | + public function get_help_tab_name() { |
|
691 | + return 'ee_'.strtolower($this->system_name()).'_help_tab'; |
|
692 | 692 | } |
693 | 693 | |
694 | 694 | /** |
@@ -696,8 +696,8 @@ discard block |
||
696 | 696 | * this PMT by an admin |
697 | 697 | * @return string |
698 | 698 | */ |
699 | - public function cap_name(){ |
|
700 | - return 'ee_payment_method_' . strtolower( $this->system_name() ); |
|
699 | + public function cap_name() { |
|
700 | + return 'ee_payment_method_'.strtolower($this->system_name()); |
|
701 | 701 | } |
702 | 702 | |
703 | 703 | /** |
@@ -709,9 +709,9 @@ discard block |
||
709 | 709 | * @param EE_Payment $payment |
710 | 710 | * @return void |
711 | 711 | */ |
712 | - public function update_txn_based_on_payment( $payment ){ |
|
713 | - if( $this->_gateway instanceof EE_Gateway ){ |
|
714 | - $this->_gateway->update_txn_based_on_payment( $payment ); |
|
712 | + public function update_txn_based_on_payment($payment) { |
|
713 | + if ($this->_gateway instanceof EE_Gateway) { |
|
714 | + $this->_gateway->update_txn_based_on_payment($payment); |
|
715 | 715 | } |
716 | 716 | } |
717 | 717 |
@@ -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 | /** |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | * @param string $shortcode |
62 | 62 | * @return string |
63 | 63 | */ |
64 | - protected function _parser( $shortcode ) { |
|
64 | + protected function _parser($shortcode) { |
|
65 | 65 | |
66 | - if ( ! $this->_data instanceof EE_Datetime ) { |
|
66 | + if ( ! $this->_data instanceof EE_Datetime) { |
|
67 | 67 | return ''; //get out cause we can only parse with the datetime object. |
68 | 68 | } |
69 | 69 | |
70 | - switch ( $shortcode ) { |
|
70 | + switch ($shortcode) { |
|
71 | 71 | |
72 | 72 | case '[DATETIME_START]' : |
73 | 73 | return $this->_data->get_i18n_datetime('DTT_EVT_start'); |
@@ -81,27 +81,27 @@ discard block |
||
81 | 81 | return $this->_data->get_timezone(); |
82 | 82 | break; |
83 | 83 | case '[DATE_START]' : |
84 | - return $this->_data->get_i18n_datetime( 'DTT_EVT_start', get_option( 'date_format' ) ); |
|
84 | + return $this->_data->get_i18n_datetime('DTT_EVT_start', get_option('date_format')); |
|
85 | 85 | break; |
86 | 86 | case '[DATE_END]' : |
87 | - return $this->_data->get_i18n_datetime( 'DTT_EVT_end', get_option( 'date_format' ) ); |
|
87 | + return $this->_data->get_i18n_datetime('DTT_EVT_end', get_option('date_format')); |
|
88 | 88 | break; |
89 | 89 | case '[TIME_START]' : |
90 | - return $this->_data->get_i18n_datetime( 'DTT_EVT_start', get_option( 'time_format' ) ); |
|
90 | + return $this->_data->get_i18n_datetime('DTT_EVT_start', get_option('time_format')); |
|
91 | 91 | break; |
92 | 92 | case '[TIME_END]' : |
93 | - return $this->_data->get_i18n_datetime( 'DTT_EVT_end', get_option( 'time_format' ) ); |
|
93 | + return $this->_data->get_i18n_datetime('DTT_EVT_end', get_option('time_format')); |
|
94 | 94 | break; |
95 | 95 | } |
96 | 96 | |
97 | - if ( strpos( $shortcode, '[ICAL_LINK_*') !== FALSE ) { |
|
98 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
97 | + if (strpos($shortcode, '[ICAL_LINK_*') !== FALSE) { |
|
98 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
99 | 99 | |
100 | - $link_text = empty( $attrs['link_text'] ) ? __( 'Add to iCal Calendar', 'event_espresso' ) : $attrs['link_text']; |
|
100 | + $link_text = empty($attrs['link_text']) ? __('Add to iCal Calendar', 'event_espresso') : $attrs['link_text']; |
|
101 | 101 | |
102 | - $URL = add_query_arg( array( 'ee' => 'download_ics_file', 'ics_id' => $this->_data->ID() ), site_url() ); |
|
102 | + $URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $this->_data->ID()), site_url()); |
|
103 | 103 | |
104 | - return '<a class="ee-ical" href="' . $URL . '">' . $link_text . '</a>'; |
|
104 | + return '<a class="ee-ical" href="'.$URL.'">'.$link_text.'</a>'; |
|
105 | 105 | |
106 | 106 | } |
107 | 107 |
@@ -1,6 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | //namespace EventEspresso\core\libraries\templates; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | /** |
8 | 8 | * Class EE_Template_Part |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | * @param string $template |
48 | 48 | * @param int $priority |
49 | 49 | */ |
50 | - public function __construct( $name, $label, $template, $priority = 100 ) { |
|
51 | - $this->set_name( $name ); |
|
52 | - $this->set_label( $label ); |
|
53 | - $this->set_template( $template ); |
|
54 | - $this->set_priority( $priority ); |
|
50 | + public function __construct($name, $label, $template, $priority = 100) { |
|
51 | + $this->set_name($name); |
|
52 | + $this->set_label($label); |
|
53 | + $this->set_template($template); |
|
54 | + $this->set_priority($priority); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | /** |
69 | 69 | * @param mixed $name |
70 | 70 | */ |
71 | - public function set_name( $name ) { |
|
71 | + public function set_name($name) { |
|
72 | 72 | $this->name = $name; |
73 | 73 | } |
74 | 74 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | /** |
87 | 87 | * @param string $label |
88 | 88 | */ |
89 | - public function set_label( $label ) { |
|
89 | + public function set_label($label) { |
|
90 | 90 | $this->label = $label; |
91 | 91 | } |
92 | 92 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * @param string $template |
106 | 106 | */ |
107 | - public function set_template( $template ) { |
|
107 | + public function set_template($template) { |
|
108 | 108 | $this->template = $template; |
109 | 109 | } |
110 | 110 | |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | /** |
123 | 123 | * @param int $priority |
124 | 124 | */ |
125 | - public function set_priority( $priority ) { |
|
126 | - $this->priority = intval( $priority ); |
|
125 | + public function set_priority($priority) { |
|
126 | + $this->priority = intval($priority); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | //namespace EventEspresso\core\libraries\templates; |
3 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
4 | - exit( 'No direct script access allowed' ); |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | + exit('No direct script access allowed'); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | |
@@ -70,23 +70,23 @@ discard block |
||
70 | 70 | * @param string $template - name or path of template to be used by EEH_Template::locate_template() |
71 | 71 | * @param int $priority - order in which template parts should be applied |
72 | 72 | */ |
73 | - public function add_template_part( $name, $label, $template, $priority ) { |
|
73 | + public function add_template_part($name, $label, $template, $priority) { |
|
74 | 74 | // SplPriorityQueue doesn't play nice with multiple items having the same priority |
75 | 75 | // so if the incoming priority is already occupied, then let's increment it by one, |
76 | 76 | // and then pass everything back into this method and try again with the new priority |
77 | - if ( isset( $this->priorities[ $priority ] ) ) { |
|
77 | + if (isset($this->priorities[$priority])) { |
|
78 | 78 | $priority++; |
79 | - $this->add_template_part( $name, $label, $template, $priority ); |
|
79 | + $this->add_template_part($name, $label, $template, $priority); |
|
80 | 80 | return; |
81 | 81 | } |
82 | 82 | // kk now we can mark this priority as being occupied |
83 | - $this->priorities[ $priority ] = true; |
|
83 | + $this->priorities[$priority] = true; |
|
84 | 84 | // create the template part and add to the queue |
85 | 85 | $this->template_parts->insert( |
86 | - new EE_Template_Part( $name, $label, $template, $priority ), |
|
86 | + new EE_Template_Part($name, $label, $template, $priority), |
|
87 | 87 | $priority |
88 | 88 | ); |
89 | - if ( $name == 'event' ) { |
|
89 | + if ($name == 'event') { |
|
90 | 90 | $this->event_desc_priority = $priority; |
91 | 91 | } |
92 | 92 | } |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | * @param string $content |
104 | 104 | * @return string |
105 | 105 | */ |
106 | - public function apply_template_part_filters( $content = '' ) { |
|
106 | + public function apply_template_part_filters($content = '') { |
|
107 | 107 | $this->template_parts->rewind(); |
108 | 108 | // loop through template parts and position content |
109 | - while ( $this->template_parts->valid() ) { |
|
109 | + while ($this->template_parts->valid()) { |
|
110 | 110 | $this->_position_template_part( |
111 | 111 | $content, |
112 | 112 | $this->template_parts->current()->template(), |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $this->template_parts->next(); |
116 | 116 | } |
117 | 117 | // now simply add our three strings of content together |
118 | - return $this->before_event_content . $this->event_content . $this->after_event_content; |
|
118 | + return $this->before_event_content.$this->event_content.$this->after_event_content; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
@@ -136,16 +136,16 @@ discard block |
||
136 | 136 | * @param int $priority |
137 | 137 | * @return string |
138 | 138 | */ |
139 | - protected function _position_template_part( $content, $template, $priority ) { |
|
139 | + protected function _position_template_part($content, $template, $priority) { |
|
140 | 140 | // Event Description content is the actual incoming content itself |
141 | - if ( $priority === $this->event_desc_priority ) { |
|
141 | + if ($priority === $this->event_desc_priority) { |
|
142 | 142 | $this->event_content = $content; |
143 | - } else if ( $priority < $this->event_desc_priority ) { |
|
143 | + } else if ($priority < $this->event_desc_priority) { |
|
144 | 144 | // everything BEFORE the Event Description |
145 | - $this->before_event_content .= EEH_Template::locate_template( $template ); |
|
146 | - } else if ( $priority > $this->event_desc_priority ) { |
|
145 | + $this->before_event_content .= EEH_Template::locate_template($template); |
|
146 | + } else if ($priority > $this->event_desc_priority) { |
|
147 | 147 | // everything AFTER the Event Description |
148 | - $this->after_event_content .= EEH_Template::locate_template( $template ); |
|
148 | + $this->after_event_content .= EEH_Template::locate_template($template); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
@@ -170,16 +170,16 @@ discard block |
||
170 | 170 | $list_item_css_class = '', |
171 | 171 | $list_item_css_id_prefix = '' |
172 | 172 | ) { |
173 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
174 | - $event_archive_display_order = EEH_HTML::ul( $list_css_id, $list_css_class ); |
|
173 | + EE_Registry::instance()->load_helper('HTML'); |
|
174 | + $event_archive_display_order = EEH_HTML::ul($list_css_id, $list_css_class); |
|
175 | 175 | $this->template_parts->rewind(); |
176 | 176 | // loop through template parts and add template content |
177 | - while ( $this->template_parts->valid() ) { |
|
177 | + while ($this->template_parts->valid()) { |
|
178 | 178 | $event_archive_display_order .= EEH_HTML::li( |
179 | - EEH_HTML::span( '', '', 'dashicons dashicons-arrow-up-alt2' ) . |
|
180 | - EEH_HTML::span( '', '', 'dashicons dashicons-arrow-down-alt2' ) . |
|
179 | + EEH_HTML::span('', '', 'dashicons dashicons-arrow-up-alt2'). |
|
180 | + EEH_HTML::span('', '', 'dashicons dashicons-arrow-down-alt2'). |
|
181 | 181 | $this->template_parts->current()->label(), |
182 | - $list_item_css_id_prefix . $this->template_parts->current()->name(), |
|
182 | + $list_item_css_id_prefix.$this->template_parts->current()->name(), |
|
183 | 183 | $list_item_css_class |
184 | 184 | ); |
185 | 185 | $this->template_parts->next(); |
@@ -199,10 +199,10 @@ discard block |
||
199 | 199 | * @return string |
200 | 200 | */ |
201 | 201 | public function display_template_parts() { |
202 | - if ( WP_DEBUG ) { |
|
202 | + if (WP_DEBUG) { |
|
203 | 203 | $this->template_parts->rewind(); |
204 | - while ( $this->template_parts->valid() ) { |
|
205 | - EEH_Debug_Tools::printr( $this->template_parts->current(), 'template_part', __FILE__, __LINE__ ); |
|
204 | + while ($this->template_parts->valid()) { |
|
205 | + EEH_Debug_Tools::printr($this->template_parts->current(), 'template_part', __FILE__, __LINE__); |
|
206 | 206 | $this->template_parts->next(); |
207 | 207 | } |
208 | 208 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | //namespace EventEspresso\core\libraries\templates; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | /** |
8 | 8 | * Class EE_Template_Part_PriorityQueue |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | * @param int $priority |
32 | 32 | * @return bool |
33 | 33 | */ |
34 | - public function insert( $object, $priority = 100 ) { |
|
35 | - if ( $object instanceof EE_Template_Part ) { |
|
36 | - parent::insert( $object, $priority ); |
|
34 | + public function insert($object, $priority = 100) { |
|
35 | + if ($object instanceof EE_Template_Part) { |
|
36 | + parent::insert($object, $priority); |
|
37 | 37 | return true; |
38 | 38 | } else { |
39 | 39 | return false; |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | * @param int $priority2 |
53 | 53 | * @return bool |
54 | 54 | */ |
55 | - public function compare( $priority1, $priority2 ) { |
|
56 | - if ( $priority1 === $priority2 ) { |
|
55 | + public function compare($priority1, $priority2) { |
|
56 | + if ($priority1 === $priority2) { |
|
57 | 57 | return 0; |
58 | 58 | } |
59 | 59 | return $priority1 > $priority2 ? -1 : 1; |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | * @return EE_Request_Stack_Builder |
45 | 45 | */ |
46 | 46 | public function unshift( /*$class_name, $args*/ ) { |
47 | - if ( func_num_args() === 0 ) { |
|
48 | - throw new InvalidArgumentException( "Missing argument(s) when calling unshift" ); |
|
47 | + if (func_num_args() === 0) { |
|
48 | + throw new InvalidArgumentException("Missing argument(s) when calling unshift"); |
|
49 | 49 | } |
50 | 50 | $middleware = func_get_args(); |
51 | 51 | //$this->middleware_stack->unshift( $middleware ); |
52 | - array_unshift( $this->_middleware_stack, $middleware ); |
|
52 | + array_unshift($this->_middleware_stack, $middleware); |
|
53 | 53 | return $this; |
54 | 54 | } |
55 | 55 | |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | * @return EE_Request_Stack_Builder |
67 | 67 | */ |
68 | 68 | public function push( /*$class_name, $args...*/ ) { |
69 | - if ( func_num_args() === 0 ) { |
|
70 | - throw new InvalidArgumentException( "Missing argument(s) when calling push" ); |
|
69 | + if (func_num_args() === 0) { |
|
70 | + throw new InvalidArgumentException("Missing argument(s) when calling push"); |
|
71 | 71 | } |
72 | 72 | $middleware = func_get_args(); |
73 | 73 | //$this->middleware_stack->push( $middleware ); |
74 | - array_push( $this->_middleware_stack, $middleware ); |
|
74 | + array_push($this->_middleware_stack, $middleware); |
|
75 | 75 | return $this; |
76 | 76 | } |
77 | 77 | |
@@ -84,20 +84,20 @@ discard block |
||
84 | 84 | * @param EEI_Request_Decorator $application |
85 | 85 | * @return EE_Request_Stack |
86 | 86 | */ |
87 | - public function resolve( EEI_Request_Decorator $application ) { |
|
88 | - $middlewares = array( $application ); |
|
89 | - foreach ( $this->_middleware_stack as $middleware_args ) { |
|
90 | - $class_name = array_shift( $middleware_args ); |
|
91 | - if ( is_callable( $class_name ) ) { |
|
92 | - $application = $class_name( $application ); |
|
87 | + public function resolve(EEI_Request_Decorator $application) { |
|
88 | + $middlewares = array($application); |
|
89 | + foreach ($this->_middleware_stack as $middleware_args) { |
|
90 | + $class_name = array_shift($middleware_args); |
|
91 | + if (is_callable($class_name)) { |
|
92 | + $application = $class_name($application); |
|
93 | 93 | } else { |
94 | - array_unshift( $middleware_args, $application ); |
|
95 | - $reflection = new ReflectionClass( $class_name ); |
|
96 | - $application = $reflection->newInstanceArgs( $middleware_args ); |
|
94 | + array_unshift($middleware_args, $application); |
|
95 | + $reflection = new ReflectionClass($class_name); |
|
96 | + $application = $reflection->newInstanceArgs($middleware_args); |
|
97 | 97 | } |
98 | - array_unshift( $middlewares, $application ); |
|
98 | + array_unshift($middlewares, $application); |
|
99 | 99 | } |
100 | - return new EE_Request_Stack( $application, $middlewares ); |
|
100 | + return new EE_Request_Stack($application, $middlewares); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @return \EE_Response |
41 | 41 | */ |
42 | 42 | public function __construct() { |
43 | - $this->terminate_request( false ); |
|
43 | + $this->terminate_request(false); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | * @param $value |
54 | 54 | * @return void |
55 | 55 | */ |
56 | - public function set_notice( $key, $value ) { |
|
57 | - $this->_notice[ $key ] = $value; |
|
56 | + public function set_notice($key, $value) { |
|
57 | + $this->_notice[$key] = $value; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | * @param $key |
67 | 67 | * @return mixed |
68 | 68 | */ |
69 | - public function get_notice( $key ) { |
|
70 | - return isset( $this->_notice[ $key ] ) ? $this->_notice[ $key ] : NULL; |
|
69 | + public function get_notice($key) { |
|
70 | + return isset($this->_notice[$key]) ? $this->_notice[$key] : NULL; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | * @param $string |
92 | 92 | * @param bool $append |
93 | 93 | */ |
94 | - public function add_output( $string, $append = true ) { |
|
95 | - $this->_output = $append ? $this->_output . $string : $string . $this->_output; |
|
94 | + public function add_output($string, $append = true) { |
|
95 | + $this->_output = $append ? $this->_output.$string : $string.$this->_output; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | /** |
122 | 122 | * @param boolean $request_terminated |
123 | 123 | */ |
124 | - public function terminate_request( $request_terminated = true ) { |
|
125 | - $this->request_terminated = filter_var( $request_terminated, FILTER_VALIDATE_BOOLEAN ); |
|
124 | + public function terminate_request($request_terminated = true) { |
|
125 | + $this->request_terminated = filter_var($request_terminated, FILTER_VALIDATE_BOOLEAN); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * class EE_Response |
4 | 6 | * |
@@ -19,13 +19,13 @@ |
||
19 | 19 | <html> |
20 | 20 | <head> |
21 | 21 | <title><?php _e('Ticket Selector', 'event_espresso'); ?></title> |
22 | - <?php foreach ( $css as $url ) : ?> |
|
23 | - <link rel="stylesheet" type="text/css" href="<?php echo $url;?>"> |
|
22 | + <?php foreach ($css as $url) : ?> |
|
23 | + <link rel="stylesheet" type="text/css" href="<?php echo $url; ?>"> |
|
24 | 24 | <?php endforeach; ?> |
25 | 25 | <script type="text/javascript"> |
26 | 26 | <?php echo $eei18n; ?> |
27 | 27 | </script> |
28 | - <?php foreach ( $js as $jsurl ) : ?> |
|
28 | + <?php foreach ($js as $jsurl) : ?> |
|
29 | 29 | <script type="text/javascript" src="<?php echo $jsurl; ?>"></script> |
30 | 30 | <?php endforeach; ?> |
31 | 31 | </head> |