@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function venue_location($content) |
172 | 172 | { |
173 | - return $content . EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
173 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
@@ -185,16 +185,16 @@ discard block |
||
185 | 185 | // get some style |
186 | 186 | if (apply_filters('FHEE_enable_default_espresso_css', true) && is_archive()) { |
187 | 187 | // first check theme folder |
188 | - if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) { |
|
188 | + if (is_readable(get_stylesheet_directory().$this->theme.'/style.css')) { |
|
189 | 189 | wp_register_style( |
190 | 190 | $this->theme, |
191 | - get_stylesheet_directory_uri() . $this->theme . '/style.css', |
|
191 | + get_stylesheet_directory_uri().$this->theme.'/style.css', |
|
192 | 192 | array('dashicons', 'espresso_default') |
193 | 193 | ); |
194 | - } elseif (is_readable(EE_TEMPLATES . $this->theme . '/style.css')) { |
|
194 | + } elseif (is_readable(EE_TEMPLATES.$this->theme.'/style.css')) { |
|
195 | 195 | wp_register_style( |
196 | 196 | $this->theme, |
197 | - EE_TEMPLATES_URL . $this->theme . '/style.css', |
|
197 | + EE_TEMPLATES_URL.$this->theme.'/style.css', |
|
198 | 198 | array('dashicons', 'espresso_default') |
199 | 199 | ); |
200 | 200 | } |
@@ -29,178 +29,178 @@ |
||
29 | 29 | class EED_Venues_Archive extends EED_Module |
30 | 30 | { |
31 | 31 | |
32 | - /** |
|
33 | - * @return EED_Venues_Archive |
|
34 | - */ |
|
35 | - public static function instance() |
|
36 | - { |
|
37 | - return parent::get_instance(__CLASS__); |
|
38 | - } |
|
39 | - |
|
40 | - |
|
41 | - /** |
|
42 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
43 | - * |
|
44 | - * @return void |
|
45 | - * @throws InvalidArgumentException |
|
46 | - * @throws InvalidDataTypeException |
|
47 | - * @throws InvalidInterfaceException |
|
48 | - */ |
|
49 | - public static function set_hooks() |
|
50 | - { |
|
51 | - /** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_type_definitions */ |
|
52 | - $custom_post_type_definitions = LoaderFactory::getLoader()->getShared( |
|
53 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' |
|
54 | - ); |
|
55 | - $custom_post_types = $custom_post_type_definitions->getDefinitions(); |
|
56 | - EE_Config::register_route( |
|
57 | - $custom_post_types['espresso_venues']['plural_slug'], |
|
58 | - 'Venues_Archive', |
|
59 | - 'run' |
|
60 | - ); |
|
61 | - } |
|
62 | - |
|
63 | - /** |
|
64 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
65 | - * |
|
66 | - * @access public |
|
67 | - * @return void |
|
68 | - */ |
|
69 | - public static function set_hooks_admin() |
|
70 | - { |
|
71 | - } |
|
72 | - |
|
73 | - |
|
74 | - /** |
|
75 | - * run - initial module setup |
|
76 | - * |
|
77 | - * @access public |
|
78 | - * @param \WP $WP |
|
79 | - */ |
|
80 | - public function run($WP) |
|
81 | - { |
|
82 | - // check what template is loaded |
|
83 | - add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
84 | - add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
85 | - } |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * template_include |
|
90 | - * |
|
91 | - * @access public |
|
92 | - * @param string $template |
|
93 | - * @return string |
|
94 | - */ |
|
95 | - public function template_include($template) |
|
96 | - { |
|
97 | - // not a custom template? |
|
98 | - if ( |
|
99 | - EE_Registry::instance()->load_core('Front_Controller', array(), false, true) |
|
100 | - ->get_selected_template() != 'archive-espresso_venues.php' |
|
101 | - ) { |
|
102 | - EEH_Template::load_espresso_theme_functions(); |
|
103 | - // then add extra event data via hooks |
|
104 | - add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
105 | - // don't know if theme uses the_excerpt |
|
106 | - add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
107 | - // or the_content |
|
108 | - add_filter('the_content', array($this, 'venue_details'), 100); |
|
109 | - // don't display entry meta because the existing theme will take care of that |
|
110 | - add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
111 | - } |
|
112 | - return $template; |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - /** |
|
117 | - * the_title |
|
118 | - * |
|
119 | - * @access public |
|
120 | - * @param string $title |
|
121 | - * @return string |
|
122 | - */ |
|
123 | - public function the_title($title = '') |
|
124 | - { |
|
125 | - return $title; |
|
126 | - } |
|
127 | - |
|
128 | - |
|
129 | - /** |
|
130 | - * venue_details |
|
131 | - * |
|
132 | - * @access public |
|
133 | - * @param string $content |
|
134 | - * @return string |
|
135 | - */ |
|
136 | - public function venue_details($content) |
|
137 | - { |
|
138 | - global $post; |
|
139 | - if ( |
|
140 | - $post->post_type == 'espresso_venues' |
|
141 | - && ! post_password_required() |
|
142 | - ) { |
|
143 | - // since the 'content-espresso_venues-details.php' template might be used directly from within a theme, |
|
144 | - // it uses the_content() for displaying the $post->post_content |
|
145 | - // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
|
146 | - // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
|
147 | - remove_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
148 | - remove_filter('the_content', array($this, 'venue_details'), 100); |
|
149 | - // add filters we want |
|
150 | - add_filter('the_content', array($this, 'venue_location'), 110); |
|
151 | - add_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
152 | - // now load our template |
|
153 | - $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
154 | - // now add our filter back in, plus some others |
|
155 | - add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
156 | - add_filter('the_content', array($this, 'venue_details'), 100); |
|
157 | - // remove other filters we added so they won't get applied to the next post |
|
158 | - remove_filter('the_content', array($this, 'venue_location'), 110); |
|
159 | - remove_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
160 | - // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
|
161 | - } |
|
162 | - return ! empty($template) ? $template : $content; |
|
163 | - } |
|
164 | - |
|
165 | - |
|
166 | - /** |
|
167 | - * venue_location |
|
168 | - * |
|
169 | - * @access public |
|
170 | - * @param string $content |
|
171 | - * @return string |
|
172 | - */ |
|
173 | - public function venue_location($content) |
|
174 | - { |
|
175 | - return $content . EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
176 | - } |
|
177 | - |
|
178 | - |
|
179 | - /** |
|
180 | - * wp_enqueue_scripts |
|
181 | - * |
|
182 | - * @access public |
|
183 | - * @return void |
|
184 | - */ |
|
185 | - public function wp_enqueue_scripts() |
|
186 | - { |
|
187 | - // get some style |
|
188 | - if (apply_filters('FHEE_enable_default_espresso_css', true) && is_archive()) { |
|
189 | - // first check theme folder |
|
190 | - if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) { |
|
191 | - wp_register_style( |
|
192 | - $this->theme, |
|
193 | - get_stylesheet_directory_uri() . $this->theme . '/style.css', |
|
194 | - array('dashicons', 'espresso_default') |
|
195 | - ); |
|
196 | - } elseif (is_readable(EE_TEMPLATES . $this->theme . '/style.css')) { |
|
197 | - wp_register_style( |
|
198 | - $this->theme, |
|
199 | - EE_TEMPLATES_URL . $this->theme . '/style.css', |
|
200 | - array('dashicons', 'espresso_default') |
|
201 | - ); |
|
202 | - } |
|
203 | - wp_enqueue_style($this->theme); |
|
204 | - } |
|
205 | - } |
|
32 | + /** |
|
33 | + * @return EED_Venues_Archive |
|
34 | + */ |
|
35 | + public static function instance() |
|
36 | + { |
|
37 | + return parent::get_instance(__CLASS__); |
|
38 | + } |
|
39 | + |
|
40 | + |
|
41 | + /** |
|
42 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
43 | + * |
|
44 | + * @return void |
|
45 | + * @throws InvalidArgumentException |
|
46 | + * @throws InvalidDataTypeException |
|
47 | + * @throws InvalidInterfaceException |
|
48 | + */ |
|
49 | + public static function set_hooks() |
|
50 | + { |
|
51 | + /** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_type_definitions */ |
|
52 | + $custom_post_type_definitions = LoaderFactory::getLoader()->getShared( |
|
53 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' |
|
54 | + ); |
|
55 | + $custom_post_types = $custom_post_type_definitions->getDefinitions(); |
|
56 | + EE_Config::register_route( |
|
57 | + $custom_post_types['espresso_venues']['plural_slug'], |
|
58 | + 'Venues_Archive', |
|
59 | + 'run' |
|
60 | + ); |
|
61 | + } |
|
62 | + |
|
63 | + /** |
|
64 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
65 | + * |
|
66 | + * @access public |
|
67 | + * @return void |
|
68 | + */ |
|
69 | + public static function set_hooks_admin() |
|
70 | + { |
|
71 | + } |
|
72 | + |
|
73 | + |
|
74 | + /** |
|
75 | + * run - initial module setup |
|
76 | + * |
|
77 | + * @access public |
|
78 | + * @param \WP $WP |
|
79 | + */ |
|
80 | + public function run($WP) |
|
81 | + { |
|
82 | + // check what template is loaded |
|
83 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
84 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
85 | + } |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * template_include |
|
90 | + * |
|
91 | + * @access public |
|
92 | + * @param string $template |
|
93 | + * @return string |
|
94 | + */ |
|
95 | + public function template_include($template) |
|
96 | + { |
|
97 | + // not a custom template? |
|
98 | + if ( |
|
99 | + EE_Registry::instance()->load_core('Front_Controller', array(), false, true) |
|
100 | + ->get_selected_template() != 'archive-espresso_venues.php' |
|
101 | + ) { |
|
102 | + EEH_Template::load_espresso_theme_functions(); |
|
103 | + // then add extra event data via hooks |
|
104 | + add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
105 | + // don't know if theme uses the_excerpt |
|
106 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
107 | + // or the_content |
|
108 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
109 | + // don't display entry meta because the existing theme will take care of that |
|
110 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
111 | + } |
|
112 | + return $template; |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + /** |
|
117 | + * the_title |
|
118 | + * |
|
119 | + * @access public |
|
120 | + * @param string $title |
|
121 | + * @return string |
|
122 | + */ |
|
123 | + public function the_title($title = '') |
|
124 | + { |
|
125 | + return $title; |
|
126 | + } |
|
127 | + |
|
128 | + |
|
129 | + /** |
|
130 | + * venue_details |
|
131 | + * |
|
132 | + * @access public |
|
133 | + * @param string $content |
|
134 | + * @return string |
|
135 | + */ |
|
136 | + public function venue_details($content) |
|
137 | + { |
|
138 | + global $post; |
|
139 | + if ( |
|
140 | + $post->post_type == 'espresso_venues' |
|
141 | + && ! post_password_required() |
|
142 | + ) { |
|
143 | + // since the 'content-espresso_venues-details.php' template might be used directly from within a theme, |
|
144 | + // it uses the_content() for displaying the $post->post_content |
|
145 | + // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
|
146 | + // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
|
147 | + remove_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
148 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
149 | + // add filters we want |
|
150 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
151 | + add_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
152 | + // now load our template |
|
153 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
154 | + // now add our filter back in, plus some others |
|
155 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
156 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
157 | + // remove other filters we added so they won't get applied to the next post |
|
158 | + remove_filter('the_content', array($this, 'venue_location'), 110); |
|
159 | + remove_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
160 | + // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
|
161 | + } |
|
162 | + return ! empty($template) ? $template : $content; |
|
163 | + } |
|
164 | + |
|
165 | + |
|
166 | + /** |
|
167 | + * venue_location |
|
168 | + * |
|
169 | + * @access public |
|
170 | + * @param string $content |
|
171 | + * @return string |
|
172 | + */ |
|
173 | + public function venue_location($content) |
|
174 | + { |
|
175 | + return $content . EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
176 | + } |
|
177 | + |
|
178 | + |
|
179 | + /** |
|
180 | + * wp_enqueue_scripts |
|
181 | + * |
|
182 | + * @access public |
|
183 | + * @return void |
|
184 | + */ |
|
185 | + public function wp_enqueue_scripts() |
|
186 | + { |
|
187 | + // get some style |
|
188 | + if (apply_filters('FHEE_enable_default_espresso_css', true) && is_archive()) { |
|
189 | + // first check theme folder |
|
190 | + if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) { |
|
191 | + wp_register_style( |
|
192 | + $this->theme, |
|
193 | + get_stylesheet_directory_uri() . $this->theme . '/style.css', |
|
194 | + array('dashicons', 'espresso_default') |
|
195 | + ); |
|
196 | + } elseif (is_readable(EE_TEMPLATES . $this->theme . '/style.css')) { |
|
197 | + wp_register_style( |
|
198 | + $this->theme, |
|
199 | + EE_TEMPLATES_URL . $this->theme . '/style.css', |
|
200 | + array('dashicons', 'espresso_default') |
|
201 | + ); |
|
202 | + } |
|
203 | + wp_enqueue_style($this->theme); |
|
204 | + } |
|
205 | + } |
|
206 | 206 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $this->_gateway->set_unsupported_character_remover(new AsciiOnly()); |
118 | 118 | do_action('AHEE__EE_PMT_Base___construct__done_initializing_gateway_class', $this, $this->_gateway); |
119 | 119 | } |
120 | - if (! isset($this->_has_billing_form)) { |
|
120 | + if ( ! isset($this->_has_billing_form)) { |
|
121 | 121 | // by default, On Site gateways have a billing form |
122 | 122 | if ($this->payment_occurs() == EE_PMT_Base::onsite) { |
123 | 123 | $this->set_has_billing_form(true); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | - if (! $this->_pretty_name) { |
|
129 | + if ( ! $this->_pretty_name) { |
|
130 | 130 | throw new EE_Error( |
131 | 131 | sprintf( |
132 | 132 | __( |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | } |
139 | 139 | // if the child didn't specify a default button, use the credit card one |
140 | 140 | if ($this->_default_button_url === null) { |
141 | - $this->_default_button_url = EE_PLUGIN_DIR_URL . 'payment_methods/pay-by-credit-card.png'; |
|
141 | + $this->_default_button_url = EE_PLUGIN_DIR_URL.'payment_methods/pay-by-credit-card.png'; |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | { |
160 | 160 | $reflector = new ReflectionClass(get_class($this)); |
161 | 161 | $fn = $reflector->getFileName(); |
162 | - $this->_file_folder = dirname($fn) . '/'; |
|
162 | + $this->_file_folder = dirname($fn).'/'; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | */ |
193 | 193 | public function file_folder() |
194 | 194 | { |
195 | - if (! $this->_file_folder) { |
|
195 | + if ( ! $this->_file_folder) { |
|
196 | 196 | $this->_set_file_folder(); |
197 | 197 | } |
198 | 198 | return $this->_file_folder; |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function file_url() |
206 | 206 | { |
207 | - if (! $this->_file_url) { |
|
207 | + if ( ! $this->_file_url) { |
|
208 | 208 | $this->_set_file_url(); |
209 | 209 | } |
210 | 210 | return $this->_file_url; |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public function settings_form() |
240 | 240 | { |
241 | - if (! $this->_settings_form) { |
|
241 | + if ( ! $this->_settings_form) { |
|
242 | 242 | $this->_settings_form = $this->generate_new_settings_form(); |
243 | 243 | $this->_settings_form->set_payment_method_type($this); |
244 | 244 | // if we have already assigned a model object to this pmt, make |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | public function billing_form(EE_Transaction $transaction = null, $extra_args = array()) |
293 | 293 | { |
294 | 294 | // has billing form already been regenerated ? or overwrite cache? |
295 | - if (! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form) { |
|
295 | + if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form) { |
|
296 | 296 | $this->_billing_form = $this->generate_new_billing_form($transaction, $extra_args); |
297 | 297 | } |
298 | 298 | // if we know who the attendee is, and this is a billing form |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | $payment = EEM_Payment::instance()->get_one(array($duplicate_properties)); |
395 | 395 | // if we didn't already have a payment in progress for the same thing, |
396 | 396 | // then we actually want to make a new payment |
397 | - if (! $payment instanceof EE_Payment) { |
|
397 | + if ( ! $payment instanceof EE_Payment) { |
|
398 | 398 | $payment = EE_Payment::new_instance( |
399 | 399 | array_merge( |
400 | 400 | $duplicate_properties, |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | public function handle_ipn($req_data, $transaction) |
496 | 496 | { |
497 | 497 | $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
498 | - if (! $this->_gateway instanceof EE_Offsite_Gateway) { |
|
498 | + if ( ! $this->_gateway instanceof EE_Offsite_Gateway) { |
|
499 | 499 | throw new EE_Error( |
500 | 500 | sprintf( |
501 | 501 | __("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | */ |
519 | 519 | protected function _save_billing_info_to_attendee($billing_form, $transaction) |
520 | 520 | { |
521 | - if (! $transaction || ! $transaction instanceof EE_Transaction) { |
|
521 | + if ( ! $transaction || ! $transaction instanceof EE_Transaction) { |
|
522 | 522 | EE_Error::add_error( |
523 | 523 | __("Cannot save billing info because no transaction was specified", "event_espresso"), |
524 | 524 | __FILE__, |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | return false; |
529 | 529 | } |
530 | 530 | $primary_reg = $transaction->primary_registration(); |
531 | - if (! $primary_reg) { |
|
531 | + if ( ! $primary_reg) { |
|
532 | 532 | EE_Error::add_error( |
533 | 533 | __("Cannot save billing info because the transaction has no primary registration", "event_espresso"), |
534 | 534 | __FILE__, |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | return false; |
539 | 539 | } |
540 | 540 | $attendee = $primary_reg->attendee(); |
541 | - if (! $attendee) { |
|
541 | + if ( ! $attendee) { |
|
542 | 542 | EE_Error::add_error( |
543 | 543 | __( |
544 | 544 | "Cannot save billing info because the transaction's primary registration has no attendee!", |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | */ |
652 | 652 | public function payment_occurs() |
653 | 653 | { |
654 | - if (! $this->_gateway) { |
|
654 | + if ( ! $this->_gateway) { |
|
655 | 655 | return EE_PMT_Base::offline; |
656 | 656 | } elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
657 | 657 | return EE_PMT_Base::onsite; |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | public function payment_overview_content(EE_Payment $payment) |
683 | 683 | { |
684 | 684 | return EEH_Template::display_template( |
685 | - EE_LIBRARIES . 'payment_methods/templates/payment_details_content.template.php', |
|
685 | + EE_LIBRARIES.'payment_methods/templates/payment_details_content.template.php', |
|
686 | 686 | array('payment_method' => $this->_pm_instance, 'payment' => $payment), |
687 | 687 | true |
688 | 688 | ); |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | */ |
781 | 781 | public function get_help_tab_name() |
782 | 782 | { |
783 | - return 'ee_' . strtolower($this->system_name()) . '_help_tab'; |
|
783 | + return 'ee_'.strtolower($this->system_name()).'_help_tab'; |
|
784 | 784 | } |
785 | 785 | |
786 | 786 | /** |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | */ |
792 | 792 | public function cap_name() |
793 | 793 | { |
794 | - return 'ee_payment_method_' . strtolower($this->system_name()); |
|
794 | + return 'ee_payment_method_'.strtolower($this->system_name()); |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | /** |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | public function introductory_html() |
826 | 826 | { |
827 | 827 | return EEH_Template::locate_template( |
828 | - $this->file_folder() . 'templates/' . strtolower($this->system_name()) . '_intro.template.php', |
|
828 | + $this->file_folder().'templates/'.strtolower($this->system_name()).'_intro.template.php', |
|
829 | 829 | array('pmt_obj' => $this, 'pm_instance' => $this->_pm_instance) |
830 | 830 | ); |
831 | 831 | } |
@@ -22,814 +22,814 @@ |
||
22 | 22 | abstract class EE_PMT_Base |
23 | 23 | { |
24 | 24 | |
25 | - const onsite = 'on-site'; |
|
26 | - const offsite = 'off-site'; |
|
27 | - const offline = 'off-line'; |
|
28 | - |
|
29 | - /** |
|
30 | - * @var EE_Payment_Method |
|
31 | - */ |
|
32 | - protected $_pm_instance = null; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var boolean |
|
36 | - */ |
|
37 | - protected $_requires_https = false; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var boolean |
|
41 | - */ |
|
42 | - protected $_has_billing_form; |
|
43 | - |
|
44 | - /** |
|
45 | - * @var EE_Gateway |
|
46 | - */ |
|
47 | - protected $_gateway = null; |
|
48 | - |
|
49 | - /** |
|
50 | - * @var EE_Payment_Method_Form |
|
51 | - */ |
|
52 | - protected $_settings_form = null; |
|
53 | - |
|
54 | - /** |
|
55 | - * @var EE_Form_Section_Proper |
|
56 | - */ |
|
57 | - protected $_billing_form = null; |
|
58 | - |
|
59 | - /** |
|
60 | - * @var boolean |
|
61 | - */ |
|
62 | - protected $_cache_billing_form = true; |
|
63 | - |
|
64 | - /** |
|
65 | - * String of the absolute path to the folder containing this file, with a trailing slash. |
|
66 | - * eg '/public_html/wp-site/wp-content/plugins/event-espresso/payment_methods/Invoice/' |
|
67 | - * |
|
68 | - * @var string |
|
69 | - */ |
|
70 | - protected $_file_folder = null; |
|
71 | - |
|
72 | - /** |
|
73 | - * String to the absolute URL to this file (useful for getting its web-accessible resources |
|
74 | - * like images, js, or css) |
|
75 | - * |
|
76 | - * @var string |
|
77 | - */ |
|
78 | - protected $_file_url = null; |
|
79 | - |
|
80 | - /** |
|
81 | - * Pretty name for the payment method |
|
82 | - * |
|
83 | - * @var string |
|
84 | - */ |
|
85 | - protected $_pretty_name = null; |
|
86 | - |
|
87 | - /** |
|
88 | - * |
|
89 | - * @var string |
|
90 | - */ |
|
91 | - protected $_default_button_url = null; |
|
92 | - |
|
93 | - /** |
|
94 | - * |
|
95 | - * @var string |
|
96 | - */ |
|
97 | - protected $_default_description = null; |
|
98 | - |
|
99 | - |
|
100 | - /** |
|
101 | - * |
|
102 | - * @param EE_Payment_Method $pm_instance |
|
103 | - * @throws EE_Error |
|
104 | - * @return EE_PMT_Base |
|
105 | - */ |
|
106 | - public function __construct($pm_instance = null) |
|
107 | - { |
|
108 | - if ($pm_instance instanceof EE_Payment_Method) { |
|
109 | - $this->set_instance($pm_instance); |
|
110 | - } |
|
111 | - if ($this->_gateway) { |
|
112 | - $this->_gateway->set_payment_model(EEM_Payment::instance()); |
|
113 | - $this->_gateway->set_payment_log(EEM_Change_Log::instance()); |
|
114 | - $this->_gateway->set_template_helper(new EEH_Template()); |
|
115 | - $this->_gateway->set_line_item_helper(new EEH_Line_Item()); |
|
116 | - $this->_gateway->set_money_helper(new EEH_Money()); |
|
117 | - $this->_gateway->set_gateway_data_formatter(new GatewayDataFormatter()); |
|
118 | - $this->_gateway->set_unsupported_character_remover(new AsciiOnly()); |
|
119 | - do_action('AHEE__EE_PMT_Base___construct__done_initializing_gateway_class', $this, $this->_gateway); |
|
120 | - } |
|
121 | - if (! isset($this->_has_billing_form)) { |
|
122 | - // by default, On Site gateways have a billing form |
|
123 | - if ($this->payment_occurs() == EE_PMT_Base::onsite) { |
|
124 | - $this->set_has_billing_form(true); |
|
125 | - } else { |
|
126 | - $this->set_has_billing_form(false); |
|
127 | - } |
|
128 | - } |
|
129 | - |
|
130 | - if (! $this->_pretty_name) { |
|
131 | - throw new EE_Error( |
|
132 | - sprintf( |
|
133 | - __( |
|
134 | - "You must set the pretty name for the Payment Method Type in the constructor (_pretty_name), and please make it internationalized", |
|
135 | - "event_espresso" |
|
136 | - ) |
|
137 | - ) |
|
138 | - ); |
|
139 | - } |
|
140 | - // if the child didn't specify a default button, use the credit card one |
|
141 | - if ($this->_default_button_url === null) { |
|
142 | - $this->_default_button_url = EE_PLUGIN_DIR_URL . 'payment_methods/pay-by-credit-card.png'; |
|
143 | - } |
|
144 | - } |
|
145 | - |
|
146 | - |
|
147 | - /** |
|
148 | - * @param boolean $has_billing_form |
|
149 | - */ |
|
150 | - public function set_has_billing_form($has_billing_form) |
|
151 | - { |
|
152 | - $this->_has_billing_form = filter_var($has_billing_form, FILTER_VALIDATE_BOOLEAN); |
|
153 | - } |
|
154 | - |
|
155 | - |
|
156 | - /** |
|
157 | - * sets the file_folder property |
|
158 | - */ |
|
159 | - protected function _set_file_folder() |
|
160 | - { |
|
161 | - $reflector = new ReflectionClass(get_class($this)); |
|
162 | - $fn = $reflector->getFileName(); |
|
163 | - $this->_file_folder = dirname($fn) . '/'; |
|
164 | - } |
|
165 | - |
|
166 | - |
|
167 | - /** |
|
168 | - * sets the file URL with a trailing slash for this PMT |
|
169 | - */ |
|
170 | - protected function _set_file_url() |
|
171 | - { |
|
172 | - $plugins_dir_fixed = str_replace('\\', '/', WP_PLUGIN_DIR); |
|
173 | - $file_folder_fixed = str_replace('\\', '/', $this->file_folder()); |
|
174 | - $file_path = str_replace($plugins_dir_fixed, WP_PLUGIN_URL, $file_folder_fixed); |
|
175 | - $this->_file_url = set_url_scheme($file_path); |
|
176 | - } |
|
177 | - |
|
178 | - /** |
|
179 | - * Gets the default description on all payment methods of this type |
|
180 | - * |
|
181 | - * @return string |
|
182 | - */ |
|
183 | - public function default_description() |
|
184 | - { |
|
185 | - return $this->_default_description; |
|
186 | - } |
|
187 | - |
|
188 | - |
|
189 | - /** |
|
190 | - * Returns the folder containing the PMT child class, with a trailing slash |
|
191 | - * |
|
192 | - * @return string |
|
193 | - */ |
|
194 | - public function file_folder() |
|
195 | - { |
|
196 | - if (! $this->_file_folder) { |
|
197 | - $this->_set_file_folder(); |
|
198 | - } |
|
199 | - return $this->_file_folder; |
|
200 | - } |
|
201 | - |
|
202 | - |
|
203 | - /** |
|
204 | - * @return string |
|
205 | - */ |
|
206 | - public function file_url() |
|
207 | - { |
|
208 | - if (! $this->_file_url) { |
|
209 | - $this->_set_file_url(); |
|
210 | - } |
|
211 | - return $this->_file_url; |
|
212 | - } |
|
213 | - |
|
214 | - |
|
215 | - /** |
|
216 | - * Sets the payment method instance this payment method type is for. |
|
217 | - * Its important teh payment method instance is set before |
|
218 | - * |
|
219 | - * @param EE_Payment_Method $payment_method_instance |
|
220 | - */ |
|
221 | - public function set_instance($payment_method_instance) |
|
222 | - { |
|
223 | - $this->_pm_instance = $payment_method_instance; |
|
224 | - // if they have already requested the settings form, make sure its |
|
225 | - // data matches this model object |
|
226 | - if ($this->_settings_form) { |
|
227 | - $this->settings_form()->populate_model_obj($payment_method_instance); |
|
228 | - } |
|
229 | - if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
230 | - $this->_gateway->set_settings($payment_method_instance->settings_array()); |
|
231 | - } |
|
232 | - } |
|
233 | - |
|
234 | - |
|
235 | - /** |
|
236 | - * Gets teh form for displaying to admins where they setup the payment method |
|
237 | - * |
|
238 | - * @return EE_Payment_Method_Form |
|
239 | - */ |
|
240 | - public function settings_form() |
|
241 | - { |
|
242 | - if (! $this->_settings_form) { |
|
243 | - $this->_settings_form = $this->generate_new_settings_form(); |
|
244 | - $this->_settings_form->set_payment_method_type($this); |
|
245 | - // if we have already assigned a model object to this pmt, make |
|
246 | - // sure its reflected in teh form we just generated |
|
247 | - if ($this->_pm_instance) { |
|
248 | - $this->_settings_form->populate_model_obj($this->_pm_instance); |
|
249 | - } |
|
250 | - } |
|
251 | - return $this->_settings_form; |
|
252 | - } |
|
253 | - |
|
254 | - |
|
255 | - /** |
|
256 | - * Gets the form for all the settings related to this payment method type |
|
257 | - * |
|
258 | - * @return EE_Payment_Method_Form |
|
259 | - */ |
|
260 | - abstract public function generate_new_settings_form(); |
|
261 | - |
|
262 | - |
|
263 | - /** |
|
264 | - * Sets the form for settings. This may be useful if we have already received |
|
265 | - * a form submission and have form data it in, and want to use it anytime we're showing |
|
266 | - * this payment method type's settings form later in the request |
|
267 | - * |
|
268 | - * @param EE_Payment_Method_Form $form |
|
269 | - */ |
|
270 | - public function set_settings_form($form) |
|
271 | - { |
|
272 | - $this->_settings_form = $form; |
|
273 | - } |
|
274 | - |
|
275 | - |
|
276 | - /** |
|
277 | - * @return boolean |
|
278 | - */ |
|
279 | - public function has_billing_form() |
|
280 | - { |
|
281 | - return $this->_has_billing_form; |
|
282 | - } |
|
283 | - |
|
284 | - |
|
285 | - /** |
|
286 | - * Gets the form for displaying to attendees where they can enter their billing info |
|
287 | - * which will be sent to teh gateway (can be null) |
|
288 | - * |
|
289 | - * @param \EE_Transaction $transaction |
|
290 | - * @param array $extra_args |
|
291 | - * @return \EE_Billing_Attendee_Info_Form|\EE_Billing_Info_Form|null |
|
292 | - */ |
|
293 | - public function billing_form(EE_Transaction $transaction = null, $extra_args = array()) |
|
294 | - { |
|
295 | - // has billing form already been regenerated ? or overwrite cache? |
|
296 | - if (! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form) { |
|
297 | - $this->_billing_form = $this->generate_new_billing_form($transaction, $extra_args); |
|
298 | - } |
|
299 | - // if we know who the attendee is, and this is a billing form |
|
300 | - // that uses attendee info, populate it |
|
301 | - if ( |
|
302 | - apply_filters( |
|
303 | - 'FHEE__populate_billing_form_fields_from_attendee', |
|
304 | - ($this->_billing_form instanceof EE_Billing_Attendee_Info_Form |
|
305 | - && $transaction instanceof EE_Transaction |
|
306 | - && $transaction->primary_registration() instanceof EE_Registration |
|
307 | - && $transaction->primary_registration()->attendee() instanceof EE_Attendee |
|
308 | - ), |
|
309 | - $this->_billing_form, |
|
310 | - $transaction |
|
311 | - ) |
|
312 | - ) { |
|
313 | - $this->_billing_form->populate_from_attendee($transaction->primary_registration()->attendee()); |
|
314 | - } |
|
315 | - return $this->_billing_form; |
|
316 | - } |
|
317 | - |
|
318 | - |
|
319 | - /** |
|
320 | - * Creates the billing form for this payment method type |
|
321 | - * |
|
322 | - * @param \EE_Transaction $transaction |
|
323 | - * @return \EE_Billing_Info_Form |
|
324 | - */ |
|
325 | - abstract public function generate_new_billing_form(EE_Transaction $transaction = null); |
|
326 | - |
|
327 | - |
|
328 | - /** |
|
329 | - * apply_billing_form_debug_settings |
|
330 | - * applies debug data to the form |
|
331 | - * |
|
332 | - * @param \EE_Billing_Info_Form $billing_form |
|
333 | - * @return \EE_Billing_Info_Form |
|
334 | - */ |
|
335 | - public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) |
|
336 | - { |
|
337 | - return $billing_form; |
|
338 | - } |
|
339 | - |
|
340 | - |
|
341 | - /** |
|
342 | - * Sets the billing form for this payment method type. You may want to use this |
|
343 | - * if you have form |
|
344 | - * |
|
345 | - * @param EE_Payment_Method $form |
|
346 | - */ |
|
347 | - public function set_billing_form($form) |
|
348 | - { |
|
349 | - $this->_billing_form = $form; |
|
350 | - } |
|
351 | - |
|
352 | - |
|
353 | - /** |
|
354 | - * Returns whether or not this payment method requires HTTPS to be used |
|
355 | - * |
|
356 | - * @return boolean |
|
357 | - */ |
|
358 | - public function requires_https() |
|
359 | - { |
|
360 | - return $this->_requires_https; |
|
361 | - } |
|
362 | - |
|
363 | - |
|
364 | - /** |
|
365 | - * |
|
366 | - * @param EE_Transaction $transaction |
|
367 | - * @param float $amount |
|
368 | - * @param EE_Billing_Info_Form $billing_info |
|
369 | - * @param string $return_url |
|
370 | - * @param string $fail_url |
|
371 | - * @param string $method |
|
372 | - * @param bool $by_admin |
|
373 | - * @return EE_Payment |
|
374 | - * @throws EE_Error |
|
375 | - */ |
|
376 | - public function process_payment( |
|
377 | - EE_Transaction $transaction, |
|
378 | - $amount = null, |
|
379 | - $billing_info = null, |
|
380 | - $return_url = null, |
|
381 | - $fail_url = '', |
|
382 | - $method = 'CART', |
|
383 | - $by_admin = false |
|
384 | - ) { |
|
385 | - // @todo: add surcharge for the payment method, if any |
|
386 | - if ($this->_gateway) { |
|
387 | - // there is a gateway, so we're going to make a payment object |
|
388 | - // but wait! do they already have a payment in progress that we thought was failed? |
|
389 | - $duplicate_properties = array( |
|
390 | - 'STS_ID' => EEM_Payment::status_id_failed, |
|
391 | - 'TXN_ID' => $transaction->ID(), |
|
392 | - 'PMD_ID' => $this->_pm_instance->ID(), |
|
393 | - 'PAY_source' => $method, |
|
394 | - 'PAY_amount' => $amount !== null ? $amount : $transaction->remaining(), |
|
395 | - 'PAY_gateway_response' => null, |
|
396 | - ); |
|
397 | - $payment = EEM_Payment::instance()->get_one(array($duplicate_properties)); |
|
398 | - // if we didn't already have a payment in progress for the same thing, |
|
399 | - // then we actually want to make a new payment |
|
400 | - if (! $payment instanceof EE_Payment) { |
|
401 | - $payment = EE_Payment::new_instance( |
|
402 | - array_merge( |
|
403 | - $duplicate_properties, |
|
404 | - array( |
|
405 | - 'PAY_timestamp' => time(), |
|
406 | - 'PAY_txn_id_chq_nmbr' => null, |
|
407 | - 'PAY_po_number' => null, |
|
408 | - 'PAY_extra_accntng' => null, |
|
409 | - 'PAY_details' => null, |
|
410 | - ) |
|
411 | - ) |
|
412 | - ); |
|
413 | - } |
|
414 | - // 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 |
|
415 | - $payment->save(); |
|
416 | - $billing_values = $this->_get_billing_values_from_form($billing_info); |
|
417 | - |
|
418 | - // Offsite Gateway |
|
419 | - if ($this->_gateway instanceof EE_Offsite_Gateway) { |
|
420 | - $payment = $this->_gateway->set_redirection_info( |
|
421 | - $payment, |
|
422 | - $billing_values, |
|
423 | - $return_url, |
|
424 | - EE_Config::instance()->core->txn_page_url( |
|
425 | - array( |
|
426 | - 'e_reg_url_link' => $transaction->primary_registration()->reg_url_link(), |
|
427 | - 'ee_payment_method' => $this->_pm_instance->slug(), |
|
428 | - ) |
|
429 | - ), |
|
430 | - $fail_url |
|
431 | - ); |
|
432 | - $payment->save(); |
|
433 | - // Onsite Gateway |
|
434 | - } elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
|
435 | - $payment = $this->_gateway->do_direct_payment($payment, $billing_values); |
|
436 | - $payment->save(); |
|
437 | - } else { |
|
438 | - throw new EE_Error( |
|
439 | - sprintf( |
|
440 | - __( |
|
441 | - '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)', |
|
442 | - 'event_espresso' |
|
443 | - ), |
|
444 | - get_class($this), |
|
445 | - gettype($this->_gateway) |
|
446 | - ) |
|
447 | - ); |
|
448 | - } |
|
449 | - } else { |
|
450 | - // no gateway provided |
|
451 | - // there is no payment. Must be an offline gateway |
|
452 | - // create a payment object anyways, but dont save it |
|
453 | - $payment = EE_Payment::new_instance( |
|
454 | - array( |
|
455 | - 'STS_ID' => EEM_Payment::status_id_pending, |
|
456 | - 'TXN_ID' => $transaction->ID(), |
|
457 | - 'PMD_ID' => $transaction->payment_method_ID(), |
|
458 | - 'PAY_amount' => 0.00, |
|
459 | - 'PAY_timestamp' => time(), |
|
460 | - ) |
|
461 | - ); |
|
462 | - } |
|
463 | - |
|
464 | - // if there is billing info, clean it and save it now |
|
465 | - if ($billing_info instanceof EE_Billing_Attendee_Info_Form) { |
|
466 | - $this->_save_billing_info_to_attendee($billing_info, $transaction); |
|
467 | - } |
|
468 | - |
|
469 | - return $payment; |
|
470 | - } |
|
471 | - |
|
472 | - /** |
|
473 | - * Gets the values we want to pass onto the gateway. Normally these |
|
474 | - * are just the 'pretty' values, but there may be times the data may need |
|
475 | - * a little massaging. Proper subsections will become arrays of inputs |
|
476 | - * |
|
477 | - * @param EE_Billing_Info_Form $billing_form |
|
478 | - * @return array |
|
479 | - */ |
|
480 | - protected function _get_billing_values_from_form($billing_form) |
|
481 | - { |
|
482 | - if ($billing_form instanceof EE_Form_Section_Proper) { |
|
483 | - return $billing_form->input_pretty_values(true); |
|
484 | - } else { |
|
485 | - return null; |
|
486 | - } |
|
487 | - } |
|
488 | - |
|
489 | - |
|
490 | - /** |
|
491 | - * Handles an instant payment notification when the transaction is known (by default). |
|
492 | - * |
|
493 | - * @param array $req_data |
|
494 | - * @param EE_Transaction $transaction |
|
495 | - * @return EE_Payment |
|
496 | - * @throws EE_Error |
|
497 | - */ |
|
498 | - public function handle_ipn($req_data, $transaction) |
|
499 | - { |
|
500 | - $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
501 | - if (! $this->_gateway instanceof EE_Offsite_Gateway) { |
|
502 | - throw new EE_Error( |
|
503 | - sprintf( |
|
504 | - __("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), |
|
505 | - print_r($this->_gateway, true) |
|
506 | - ) |
|
507 | - ); |
|
508 | - } |
|
509 | - $payment = $this->_gateway->handle_payment_update($req_data, $transaction); |
|
510 | - return $payment; |
|
511 | - } |
|
512 | - |
|
513 | - |
|
514 | - /** |
|
515 | - * Saves the billing info onto the attendee of the primary registrant on this transaction, and |
|
516 | - * cleans it first. |
|
517 | - * |
|
518 | - * @param EE_Billing_Attendee_Info_Form $billing_form |
|
519 | - * @param EE_Transaction $transaction |
|
520 | - * @return boolean success |
|
521 | - */ |
|
522 | - protected function _save_billing_info_to_attendee($billing_form, $transaction) |
|
523 | - { |
|
524 | - if (! $transaction || ! $transaction instanceof EE_Transaction) { |
|
525 | - EE_Error::add_error( |
|
526 | - __("Cannot save billing info because no transaction was specified", "event_espresso"), |
|
527 | - __FILE__, |
|
528 | - __FUNCTION__, |
|
529 | - __LINE__ |
|
530 | - ); |
|
531 | - return false; |
|
532 | - } |
|
533 | - $primary_reg = $transaction->primary_registration(); |
|
534 | - if (! $primary_reg) { |
|
535 | - EE_Error::add_error( |
|
536 | - __("Cannot save billing info because the transaction has no primary registration", "event_espresso"), |
|
537 | - __FILE__, |
|
538 | - __FUNCTION__, |
|
539 | - __LINE__ |
|
540 | - ); |
|
541 | - return false; |
|
542 | - } |
|
543 | - $attendee = $primary_reg->attendee(); |
|
544 | - if (! $attendee) { |
|
545 | - EE_Error::add_error( |
|
546 | - __( |
|
547 | - "Cannot save billing info because the transaction's primary registration has no attendee!", |
|
548 | - "event_espresso" |
|
549 | - ), |
|
550 | - __FILE__, |
|
551 | - __FUNCTION__, |
|
552 | - __LINE__ |
|
553 | - ); |
|
554 | - return false; |
|
555 | - } |
|
556 | - return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method()); |
|
557 | - } |
|
558 | - |
|
559 | - |
|
560 | - /** |
|
561 | - * Gets the payment this IPN is for. Children may often want to |
|
562 | - * override this to inspect the request |
|
563 | - * |
|
564 | - * @param EE_Transaction $transaction |
|
565 | - * @param array $req_data |
|
566 | - * @return EE_Payment |
|
567 | - */ |
|
568 | - protected function find_payment_for_ipn(EE_Transaction $transaction, $req_data = array()) |
|
569 | - { |
|
570 | - return $transaction->last_payment(); |
|
571 | - } |
|
572 | - |
|
573 | - |
|
574 | - /** |
|
575 | - * In case generic code cannot provide the payment processor with a specific payment method |
|
576 | - * and transaction, it will try calling this method on each activate payment method. |
|
577 | - * If the payment method is able to identify the request as being for it, it should fetch |
|
578 | - * the payment its for and return it. If not, it should throw an EE_Error to indicate it cannot |
|
579 | - * handle the IPN |
|
580 | - * |
|
581 | - * @param array $req_data |
|
582 | - * @return EE_Payment only if this payment method can find the info its needs from $req_data |
|
583 | - * and identifies the IPN as being for this payment method (not just fo ra payment method of this type) |
|
584 | - * @throws EE_Error |
|
585 | - */ |
|
586 | - public function handle_unclaimed_ipn($req_data = array()) |
|
587 | - { |
|
588 | - throw new EE_Error( |
|
589 | - sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this)) |
|
590 | - ); |
|
591 | - } |
|
592 | - |
|
593 | - |
|
594 | - /** |
|
595 | - * Logic to be accomplished when the payment attempt is complete. |
|
596 | - * Most payment methods don't need to do anything at this point; but some, like Mijireh, do. |
|
597 | - * (Mijireh is an offsite gateway which doesn't send an IPN. So when the user returns to EE from |
|
598 | - * mijireh, this method needs to be called so the Mijireh PM can ping Mijireh to know the status |
|
599 | - * of the payment). Fed a transaction because it's always assumed to be the last payment that |
|
600 | - * we're dealing with. Returns that last payment (if there is one) |
|
601 | - * |
|
602 | - * @param EE_Transaction $transaction |
|
603 | - * @return EE_Payment |
|
604 | - */ |
|
605 | - public function finalize_payment_for($transaction) |
|
606 | - { |
|
607 | - return $transaction->last_payment(); |
|
608 | - } |
|
609 | - |
|
610 | - |
|
611 | - /** |
|
612 | - * Whether or not this payment method's gateway supports sending refund requests |
|
613 | - * |
|
614 | - * @return boolean |
|
615 | - */ |
|
616 | - public function supports_sending_refunds() |
|
617 | - { |
|
618 | - if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
619 | - return $this->_gateway->supports_sending_refunds(); |
|
620 | - } else { |
|
621 | - return false; |
|
622 | - } |
|
623 | - } |
|
624 | - |
|
625 | - |
|
626 | - /** |
|
627 | - * |
|
628 | - * @param EE_Payment $payment |
|
629 | - * @param array $refund_info |
|
630 | - * @throws EE_Error |
|
631 | - * @return EE_Payment |
|
632 | - */ |
|
633 | - public function process_refund(EE_Payment $payment, $refund_info = array()) |
|
634 | - { |
|
635 | - if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
636 | - return $this->_gateway->do_direct_refund($payment, $refund_info); |
|
637 | - } else { |
|
638 | - throw new EE_Error( |
|
639 | - sprintf( |
|
640 | - __('Payment Method Type "%s" does not support sending refund requests', 'event_espresso'), |
|
641 | - get_class($this) |
|
642 | - ) |
|
643 | - ); |
|
644 | - } |
|
645 | - } |
|
646 | - |
|
647 | - |
|
648 | - /** |
|
649 | - * Returns one the class's constants onsite,offsite, or offline, depending on this |
|
650 | - * payment method's gateway. |
|
651 | - * |
|
652 | - * @return string |
|
653 | - * @throws EE_Error |
|
654 | - */ |
|
655 | - public function payment_occurs() |
|
656 | - { |
|
657 | - if (! $this->_gateway) { |
|
658 | - return EE_PMT_Base::offline; |
|
659 | - } elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
|
660 | - return EE_PMT_Base::onsite; |
|
661 | - } elseif ($this->_gateway instanceof EE_Offsite_Gateway) { |
|
662 | - return EE_PMT_Base::offsite; |
|
663 | - } else { |
|
664 | - throw new EE_Error( |
|
665 | - sprintf( |
|
666 | - __( |
|
667 | - "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", |
|
668 | - "event_espresso" |
|
669 | - ), |
|
670 | - get_class($this) |
|
671 | - ) |
|
672 | - ); |
|
673 | - } |
|
674 | - } |
|
675 | - |
|
676 | - |
|
677 | - /** |
|
678 | - * For adding any html output ab ove the payment overview. |
|
679 | - * Many gateways won't want ot display anything, so this function just returns an empty string. |
|
680 | - * Other gateways may want to override this, such as offline gateways. |
|
681 | - * |
|
682 | - * @param EE_Payment $payment |
|
683 | - * @return string |
|
684 | - */ |
|
685 | - public function payment_overview_content(EE_Payment $payment) |
|
686 | - { |
|
687 | - return EEH_Template::display_template( |
|
688 | - EE_LIBRARIES . 'payment_methods/templates/payment_details_content.template.php', |
|
689 | - array('payment_method' => $this->_pm_instance, 'payment' => $payment), |
|
690 | - true |
|
691 | - ); |
|
692 | - } |
|
693 | - |
|
694 | - |
|
695 | - /** |
|
696 | - * @return array where keys are the help tab name, |
|
697 | - * values are: array { |
|
698 | - * @type string $title i18n name for the help tab |
|
699 | - * @type string $filename name of the file located in ./help_tabs/ (ie, in a folder next to this file) |
|
700 | - * @type array $template_args any arguments you want passed to the template file while rendering. |
|
701 | - * Keys will be variable names and values with be their values. |
|
702 | - */ |
|
703 | - public function help_tabs_config() |
|
704 | - { |
|
705 | - return array(); |
|
706 | - } |
|
707 | - |
|
708 | - |
|
709 | - /** |
|
710 | - * The system name for this PMT (eg AIM, Paypal_Pro, Invoice... what gets put into |
|
711 | - * the payment method's table's PMT_type column) |
|
712 | - * |
|
713 | - * @return string |
|
714 | - */ |
|
715 | - public function system_name() |
|
716 | - { |
|
717 | - $classname = get_class($this); |
|
718 | - return str_replace("EE_PMT_", '', $classname); |
|
719 | - } |
|
720 | - |
|
721 | - |
|
722 | - /** |
|
723 | - * A pretty i18n version of the PMT name. Often the same as the "pretty_name", but you can change it by overriding |
|
724 | - * this method. |
|
725 | - * @return string |
|
726 | - */ |
|
727 | - public function defaultFrontendName() |
|
728 | - { |
|
729 | - return $this->pretty_name(); |
|
730 | - } |
|
731 | - |
|
732 | - |
|
733 | - /** |
|
734 | - * A pretty i18n version of the PMT name |
|
735 | - * |
|
736 | - * @return string |
|
737 | - */ |
|
738 | - public function pretty_name() |
|
739 | - { |
|
740 | - return $this->_pretty_name; |
|
741 | - } |
|
742 | - |
|
743 | - |
|
744 | - /** |
|
745 | - * Gets the default absolute URL to the payment method type's button |
|
746 | - * |
|
747 | - * @return string |
|
748 | - */ |
|
749 | - public function default_button_url() |
|
750 | - { |
|
751 | - return $this->_default_button_url; |
|
752 | - } |
|
753 | - |
|
754 | - |
|
755 | - /** |
|
756 | - * Gets the gateway used by this payment method (if any) |
|
757 | - * |
|
758 | - * @return EE_Gateway |
|
759 | - */ |
|
760 | - public function get_gateway() |
|
761 | - { |
|
762 | - return $this->_gateway; |
|
763 | - } |
|
764 | - |
|
765 | - |
|
766 | - /** |
|
767 | - * @return string html for the link to a help tab |
|
768 | - */ |
|
769 | - public function get_help_tab_link() |
|
770 | - { |
|
771 | - return EEH_Template::get_help_tab_link( |
|
772 | - $this->get_help_tab_name(), |
|
773 | - 'espresso_payment_settings', |
|
774 | - 'default' |
|
775 | - ); |
|
776 | - } |
|
777 | - |
|
778 | - |
|
779 | - /** |
|
780 | - * Returns the name of the help tab for this PMT |
|
781 | - * |
|
782 | - * @return string |
|
783 | - */ |
|
784 | - public function get_help_tab_name() |
|
785 | - { |
|
786 | - return 'ee_' . strtolower($this->system_name()) . '_help_tab'; |
|
787 | - } |
|
788 | - |
|
789 | - /** |
|
790 | - * The name of the wp capability that should be associated with the usage of |
|
791 | - * this PMT by an admin |
|
792 | - * |
|
793 | - * @return string |
|
794 | - */ |
|
795 | - public function cap_name() |
|
796 | - { |
|
797 | - return 'ee_payment_method_' . strtolower($this->system_name()); |
|
798 | - } |
|
799 | - |
|
800 | - /** |
|
801 | - * Called by client code to tell the gateway that if it wants to change |
|
802 | - * the transaction or line items or registrations related to teh payment it already |
|
803 | - * processed (we think, but possibly not) that now's the time to do it. |
|
804 | - * It is expected that gateways will store any info they need for this on the PAY_details, |
|
805 | - * or maybe an extra meta value |
|
806 | - * |
|
807 | - * @param EE_Payment $payment |
|
808 | - * @return void |
|
809 | - */ |
|
810 | - public function update_txn_based_on_payment($payment) |
|
811 | - { |
|
812 | - if ($this->_gateway instanceof EE_Gateway) { |
|
813 | - $this->_gateway->update_txn_based_on_payment($payment); |
|
814 | - } |
|
815 | - } |
|
816 | - |
|
817 | - /** |
|
818 | - * Returns a string of HTML describing this payment method type for an admin, |
|
819 | - * primarily intended for them to read before activating it. |
|
820 | - * The easiest way to set this is to create a folder 'templates' alongside |
|
821 | - * your EE_PMT_{System_Name} file, and in it create a file named "{system_name}_intro.template.php". |
|
822 | - * Eg, if your payment method file is named "EE_PMT_Foo_Bar.pm.php", |
|
823 | - * then you'd create a file named "templates" in the same folder as it, and name the file |
|
824 | - * "foo_bar_intro.template.php", and its content will be returned by this method |
|
825 | - * |
|
826 | - * @return string |
|
827 | - */ |
|
828 | - public function introductory_html() |
|
829 | - { |
|
830 | - return EEH_Template::locate_template( |
|
831 | - $this->file_folder() . 'templates/' . strtolower($this->system_name()) . '_intro.template.php', |
|
832 | - array('pmt_obj' => $this, 'pm_instance' => $this->_pm_instance) |
|
833 | - ); |
|
834 | - } |
|
25 | + const onsite = 'on-site'; |
|
26 | + const offsite = 'off-site'; |
|
27 | + const offline = 'off-line'; |
|
28 | + |
|
29 | + /** |
|
30 | + * @var EE_Payment_Method |
|
31 | + */ |
|
32 | + protected $_pm_instance = null; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var boolean |
|
36 | + */ |
|
37 | + protected $_requires_https = false; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var boolean |
|
41 | + */ |
|
42 | + protected $_has_billing_form; |
|
43 | + |
|
44 | + /** |
|
45 | + * @var EE_Gateway |
|
46 | + */ |
|
47 | + protected $_gateway = null; |
|
48 | + |
|
49 | + /** |
|
50 | + * @var EE_Payment_Method_Form |
|
51 | + */ |
|
52 | + protected $_settings_form = null; |
|
53 | + |
|
54 | + /** |
|
55 | + * @var EE_Form_Section_Proper |
|
56 | + */ |
|
57 | + protected $_billing_form = null; |
|
58 | + |
|
59 | + /** |
|
60 | + * @var boolean |
|
61 | + */ |
|
62 | + protected $_cache_billing_form = true; |
|
63 | + |
|
64 | + /** |
|
65 | + * String of the absolute path to the folder containing this file, with a trailing slash. |
|
66 | + * eg '/public_html/wp-site/wp-content/plugins/event-espresso/payment_methods/Invoice/' |
|
67 | + * |
|
68 | + * @var string |
|
69 | + */ |
|
70 | + protected $_file_folder = null; |
|
71 | + |
|
72 | + /** |
|
73 | + * String to the absolute URL to this file (useful for getting its web-accessible resources |
|
74 | + * like images, js, or css) |
|
75 | + * |
|
76 | + * @var string |
|
77 | + */ |
|
78 | + protected $_file_url = null; |
|
79 | + |
|
80 | + /** |
|
81 | + * Pretty name for the payment method |
|
82 | + * |
|
83 | + * @var string |
|
84 | + */ |
|
85 | + protected $_pretty_name = null; |
|
86 | + |
|
87 | + /** |
|
88 | + * |
|
89 | + * @var string |
|
90 | + */ |
|
91 | + protected $_default_button_url = null; |
|
92 | + |
|
93 | + /** |
|
94 | + * |
|
95 | + * @var string |
|
96 | + */ |
|
97 | + protected $_default_description = null; |
|
98 | + |
|
99 | + |
|
100 | + /** |
|
101 | + * |
|
102 | + * @param EE_Payment_Method $pm_instance |
|
103 | + * @throws EE_Error |
|
104 | + * @return EE_PMT_Base |
|
105 | + */ |
|
106 | + public function __construct($pm_instance = null) |
|
107 | + { |
|
108 | + if ($pm_instance instanceof EE_Payment_Method) { |
|
109 | + $this->set_instance($pm_instance); |
|
110 | + } |
|
111 | + if ($this->_gateway) { |
|
112 | + $this->_gateway->set_payment_model(EEM_Payment::instance()); |
|
113 | + $this->_gateway->set_payment_log(EEM_Change_Log::instance()); |
|
114 | + $this->_gateway->set_template_helper(new EEH_Template()); |
|
115 | + $this->_gateway->set_line_item_helper(new EEH_Line_Item()); |
|
116 | + $this->_gateway->set_money_helper(new EEH_Money()); |
|
117 | + $this->_gateway->set_gateway_data_formatter(new GatewayDataFormatter()); |
|
118 | + $this->_gateway->set_unsupported_character_remover(new AsciiOnly()); |
|
119 | + do_action('AHEE__EE_PMT_Base___construct__done_initializing_gateway_class', $this, $this->_gateway); |
|
120 | + } |
|
121 | + if (! isset($this->_has_billing_form)) { |
|
122 | + // by default, On Site gateways have a billing form |
|
123 | + if ($this->payment_occurs() == EE_PMT_Base::onsite) { |
|
124 | + $this->set_has_billing_form(true); |
|
125 | + } else { |
|
126 | + $this->set_has_billing_form(false); |
|
127 | + } |
|
128 | + } |
|
129 | + |
|
130 | + if (! $this->_pretty_name) { |
|
131 | + throw new EE_Error( |
|
132 | + sprintf( |
|
133 | + __( |
|
134 | + "You must set the pretty name for the Payment Method Type in the constructor (_pretty_name), and please make it internationalized", |
|
135 | + "event_espresso" |
|
136 | + ) |
|
137 | + ) |
|
138 | + ); |
|
139 | + } |
|
140 | + // if the child didn't specify a default button, use the credit card one |
|
141 | + if ($this->_default_button_url === null) { |
|
142 | + $this->_default_button_url = EE_PLUGIN_DIR_URL . 'payment_methods/pay-by-credit-card.png'; |
|
143 | + } |
|
144 | + } |
|
145 | + |
|
146 | + |
|
147 | + /** |
|
148 | + * @param boolean $has_billing_form |
|
149 | + */ |
|
150 | + public function set_has_billing_form($has_billing_form) |
|
151 | + { |
|
152 | + $this->_has_billing_form = filter_var($has_billing_form, FILTER_VALIDATE_BOOLEAN); |
|
153 | + } |
|
154 | + |
|
155 | + |
|
156 | + /** |
|
157 | + * sets the file_folder property |
|
158 | + */ |
|
159 | + protected function _set_file_folder() |
|
160 | + { |
|
161 | + $reflector = new ReflectionClass(get_class($this)); |
|
162 | + $fn = $reflector->getFileName(); |
|
163 | + $this->_file_folder = dirname($fn) . '/'; |
|
164 | + } |
|
165 | + |
|
166 | + |
|
167 | + /** |
|
168 | + * sets the file URL with a trailing slash for this PMT |
|
169 | + */ |
|
170 | + protected function _set_file_url() |
|
171 | + { |
|
172 | + $plugins_dir_fixed = str_replace('\\', '/', WP_PLUGIN_DIR); |
|
173 | + $file_folder_fixed = str_replace('\\', '/', $this->file_folder()); |
|
174 | + $file_path = str_replace($plugins_dir_fixed, WP_PLUGIN_URL, $file_folder_fixed); |
|
175 | + $this->_file_url = set_url_scheme($file_path); |
|
176 | + } |
|
177 | + |
|
178 | + /** |
|
179 | + * Gets the default description on all payment methods of this type |
|
180 | + * |
|
181 | + * @return string |
|
182 | + */ |
|
183 | + public function default_description() |
|
184 | + { |
|
185 | + return $this->_default_description; |
|
186 | + } |
|
187 | + |
|
188 | + |
|
189 | + /** |
|
190 | + * Returns the folder containing the PMT child class, with a trailing slash |
|
191 | + * |
|
192 | + * @return string |
|
193 | + */ |
|
194 | + public function file_folder() |
|
195 | + { |
|
196 | + if (! $this->_file_folder) { |
|
197 | + $this->_set_file_folder(); |
|
198 | + } |
|
199 | + return $this->_file_folder; |
|
200 | + } |
|
201 | + |
|
202 | + |
|
203 | + /** |
|
204 | + * @return string |
|
205 | + */ |
|
206 | + public function file_url() |
|
207 | + { |
|
208 | + if (! $this->_file_url) { |
|
209 | + $this->_set_file_url(); |
|
210 | + } |
|
211 | + return $this->_file_url; |
|
212 | + } |
|
213 | + |
|
214 | + |
|
215 | + /** |
|
216 | + * Sets the payment method instance this payment method type is for. |
|
217 | + * Its important teh payment method instance is set before |
|
218 | + * |
|
219 | + * @param EE_Payment_Method $payment_method_instance |
|
220 | + */ |
|
221 | + public function set_instance($payment_method_instance) |
|
222 | + { |
|
223 | + $this->_pm_instance = $payment_method_instance; |
|
224 | + // if they have already requested the settings form, make sure its |
|
225 | + // data matches this model object |
|
226 | + if ($this->_settings_form) { |
|
227 | + $this->settings_form()->populate_model_obj($payment_method_instance); |
|
228 | + } |
|
229 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
230 | + $this->_gateway->set_settings($payment_method_instance->settings_array()); |
|
231 | + } |
|
232 | + } |
|
233 | + |
|
234 | + |
|
235 | + /** |
|
236 | + * Gets teh form for displaying to admins where they setup the payment method |
|
237 | + * |
|
238 | + * @return EE_Payment_Method_Form |
|
239 | + */ |
|
240 | + public function settings_form() |
|
241 | + { |
|
242 | + if (! $this->_settings_form) { |
|
243 | + $this->_settings_form = $this->generate_new_settings_form(); |
|
244 | + $this->_settings_form->set_payment_method_type($this); |
|
245 | + // if we have already assigned a model object to this pmt, make |
|
246 | + // sure its reflected in teh form we just generated |
|
247 | + if ($this->_pm_instance) { |
|
248 | + $this->_settings_form->populate_model_obj($this->_pm_instance); |
|
249 | + } |
|
250 | + } |
|
251 | + return $this->_settings_form; |
|
252 | + } |
|
253 | + |
|
254 | + |
|
255 | + /** |
|
256 | + * Gets the form for all the settings related to this payment method type |
|
257 | + * |
|
258 | + * @return EE_Payment_Method_Form |
|
259 | + */ |
|
260 | + abstract public function generate_new_settings_form(); |
|
261 | + |
|
262 | + |
|
263 | + /** |
|
264 | + * Sets the form for settings. This may be useful if we have already received |
|
265 | + * a form submission and have form data it in, and want to use it anytime we're showing |
|
266 | + * this payment method type's settings form later in the request |
|
267 | + * |
|
268 | + * @param EE_Payment_Method_Form $form |
|
269 | + */ |
|
270 | + public function set_settings_form($form) |
|
271 | + { |
|
272 | + $this->_settings_form = $form; |
|
273 | + } |
|
274 | + |
|
275 | + |
|
276 | + /** |
|
277 | + * @return boolean |
|
278 | + */ |
|
279 | + public function has_billing_form() |
|
280 | + { |
|
281 | + return $this->_has_billing_form; |
|
282 | + } |
|
283 | + |
|
284 | + |
|
285 | + /** |
|
286 | + * Gets the form for displaying to attendees where they can enter their billing info |
|
287 | + * which will be sent to teh gateway (can be null) |
|
288 | + * |
|
289 | + * @param \EE_Transaction $transaction |
|
290 | + * @param array $extra_args |
|
291 | + * @return \EE_Billing_Attendee_Info_Form|\EE_Billing_Info_Form|null |
|
292 | + */ |
|
293 | + public function billing_form(EE_Transaction $transaction = null, $extra_args = array()) |
|
294 | + { |
|
295 | + // has billing form already been regenerated ? or overwrite cache? |
|
296 | + if (! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form) { |
|
297 | + $this->_billing_form = $this->generate_new_billing_form($transaction, $extra_args); |
|
298 | + } |
|
299 | + // if we know who the attendee is, and this is a billing form |
|
300 | + // that uses attendee info, populate it |
|
301 | + if ( |
|
302 | + apply_filters( |
|
303 | + 'FHEE__populate_billing_form_fields_from_attendee', |
|
304 | + ($this->_billing_form instanceof EE_Billing_Attendee_Info_Form |
|
305 | + && $transaction instanceof EE_Transaction |
|
306 | + && $transaction->primary_registration() instanceof EE_Registration |
|
307 | + && $transaction->primary_registration()->attendee() instanceof EE_Attendee |
|
308 | + ), |
|
309 | + $this->_billing_form, |
|
310 | + $transaction |
|
311 | + ) |
|
312 | + ) { |
|
313 | + $this->_billing_form->populate_from_attendee($transaction->primary_registration()->attendee()); |
|
314 | + } |
|
315 | + return $this->_billing_form; |
|
316 | + } |
|
317 | + |
|
318 | + |
|
319 | + /** |
|
320 | + * Creates the billing form for this payment method type |
|
321 | + * |
|
322 | + * @param \EE_Transaction $transaction |
|
323 | + * @return \EE_Billing_Info_Form |
|
324 | + */ |
|
325 | + abstract public function generate_new_billing_form(EE_Transaction $transaction = null); |
|
326 | + |
|
327 | + |
|
328 | + /** |
|
329 | + * apply_billing_form_debug_settings |
|
330 | + * applies debug data to the form |
|
331 | + * |
|
332 | + * @param \EE_Billing_Info_Form $billing_form |
|
333 | + * @return \EE_Billing_Info_Form |
|
334 | + */ |
|
335 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) |
|
336 | + { |
|
337 | + return $billing_form; |
|
338 | + } |
|
339 | + |
|
340 | + |
|
341 | + /** |
|
342 | + * Sets the billing form for this payment method type. You may want to use this |
|
343 | + * if you have form |
|
344 | + * |
|
345 | + * @param EE_Payment_Method $form |
|
346 | + */ |
|
347 | + public function set_billing_form($form) |
|
348 | + { |
|
349 | + $this->_billing_form = $form; |
|
350 | + } |
|
351 | + |
|
352 | + |
|
353 | + /** |
|
354 | + * Returns whether or not this payment method requires HTTPS to be used |
|
355 | + * |
|
356 | + * @return boolean |
|
357 | + */ |
|
358 | + public function requires_https() |
|
359 | + { |
|
360 | + return $this->_requires_https; |
|
361 | + } |
|
362 | + |
|
363 | + |
|
364 | + /** |
|
365 | + * |
|
366 | + * @param EE_Transaction $transaction |
|
367 | + * @param float $amount |
|
368 | + * @param EE_Billing_Info_Form $billing_info |
|
369 | + * @param string $return_url |
|
370 | + * @param string $fail_url |
|
371 | + * @param string $method |
|
372 | + * @param bool $by_admin |
|
373 | + * @return EE_Payment |
|
374 | + * @throws EE_Error |
|
375 | + */ |
|
376 | + public function process_payment( |
|
377 | + EE_Transaction $transaction, |
|
378 | + $amount = null, |
|
379 | + $billing_info = null, |
|
380 | + $return_url = null, |
|
381 | + $fail_url = '', |
|
382 | + $method = 'CART', |
|
383 | + $by_admin = false |
|
384 | + ) { |
|
385 | + // @todo: add surcharge for the payment method, if any |
|
386 | + if ($this->_gateway) { |
|
387 | + // there is a gateway, so we're going to make a payment object |
|
388 | + // but wait! do they already have a payment in progress that we thought was failed? |
|
389 | + $duplicate_properties = array( |
|
390 | + 'STS_ID' => EEM_Payment::status_id_failed, |
|
391 | + 'TXN_ID' => $transaction->ID(), |
|
392 | + 'PMD_ID' => $this->_pm_instance->ID(), |
|
393 | + 'PAY_source' => $method, |
|
394 | + 'PAY_amount' => $amount !== null ? $amount : $transaction->remaining(), |
|
395 | + 'PAY_gateway_response' => null, |
|
396 | + ); |
|
397 | + $payment = EEM_Payment::instance()->get_one(array($duplicate_properties)); |
|
398 | + // if we didn't already have a payment in progress for the same thing, |
|
399 | + // then we actually want to make a new payment |
|
400 | + if (! $payment instanceof EE_Payment) { |
|
401 | + $payment = EE_Payment::new_instance( |
|
402 | + array_merge( |
|
403 | + $duplicate_properties, |
|
404 | + array( |
|
405 | + 'PAY_timestamp' => time(), |
|
406 | + 'PAY_txn_id_chq_nmbr' => null, |
|
407 | + 'PAY_po_number' => null, |
|
408 | + 'PAY_extra_accntng' => null, |
|
409 | + 'PAY_details' => null, |
|
410 | + ) |
|
411 | + ) |
|
412 | + ); |
|
413 | + } |
|
414 | + // 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 |
|
415 | + $payment->save(); |
|
416 | + $billing_values = $this->_get_billing_values_from_form($billing_info); |
|
417 | + |
|
418 | + // Offsite Gateway |
|
419 | + if ($this->_gateway instanceof EE_Offsite_Gateway) { |
|
420 | + $payment = $this->_gateway->set_redirection_info( |
|
421 | + $payment, |
|
422 | + $billing_values, |
|
423 | + $return_url, |
|
424 | + EE_Config::instance()->core->txn_page_url( |
|
425 | + array( |
|
426 | + 'e_reg_url_link' => $transaction->primary_registration()->reg_url_link(), |
|
427 | + 'ee_payment_method' => $this->_pm_instance->slug(), |
|
428 | + ) |
|
429 | + ), |
|
430 | + $fail_url |
|
431 | + ); |
|
432 | + $payment->save(); |
|
433 | + // Onsite Gateway |
|
434 | + } elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
|
435 | + $payment = $this->_gateway->do_direct_payment($payment, $billing_values); |
|
436 | + $payment->save(); |
|
437 | + } else { |
|
438 | + throw new EE_Error( |
|
439 | + sprintf( |
|
440 | + __( |
|
441 | + '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)', |
|
442 | + 'event_espresso' |
|
443 | + ), |
|
444 | + get_class($this), |
|
445 | + gettype($this->_gateway) |
|
446 | + ) |
|
447 | + ); |
|
448 | + } |
|
449 | + } else { |
|
450 | + // no gateway provided |
|
451 | + // there is no payment. Must be an offline gateway |
|
452 | + // create a payment object anyways, but dont save it |
|
453 | + $payment = EE_Payment::new_instance( |
|
454 | + array( |
|
455 | + 'STS_ID' => EEM_Payment::status_id_pending, |
|
456 | + 'TXN_ID' => $transaction->ID(), |
|
457 | + 'PMD_ID' => $transaction->payment_method_ID(), |
|
458 | + 'PAY_amount' => 0.00, |
|
459 | + 'PAY_timestamp' => time(), |
|
460 | + ) |
|
461 | + ); |
|
462 | + } |
|
463 | + |
|
464 | + // if there is billing info, clean it and save it now |
|
465 | + if ($billing_info instanceof EE_Billing_Attendee_Info_Form) { |
|
466 | + $this->_save_billing_info_to_attendee($billing_info, $transaction); |
|
467 | + } |
|
468 | + |
|
469 | + return $payment; |
|
470 | + } |
|
471 | + |
|
472 | + /** |
|
473 | + * Gets the values we want to pass onto the gateway. Normally these |
|
474 | + * are just the 'pretty' values, but there may be times the data may need |
|
475 | + * a little massaging. Proper subsections will become arrays of inputs |
|
476 | + * |
|
477 | + * @param EE_Billing_Info_Form $billing_form |
|
478 | + * @return array |
|
479 | + */ |
|
480 | + protected function _get_billing_values_from_form($billing_form) |
|
481 | + { |
|
482 | + if ($billing_form instanceof EE_Form_Section_Proper) { |
|
483 | + return $billing_form->input_pretty_values(true); |
|
484 | + } else { |
|
485 | + return null; |
|
486 | + } |
|
487 | + } |
|
488 | + |
|
489 | + |
|
490 | + /** |
|
491 | + * Handles an instant payment notification when the transaction is known (by default). |
|
492 | + * |
|
493 | + * @param array $req_data |
|
494 | + * @param EE_Transaction $transaction |
|
495 | + * @return EE_Payment |
|
496 | + * @throws EE_Error |
|
497 | + */ |
|
498 | + public function handle_ipn($req_data, $transaction) |
|
499 | + { |
|
500 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
501 | + if (! $this->_gateway instanceof EE_Offsite_Gateway) { |
|
502 | + throw new EE_Error( |
|
503 | + sprintf( |
|
504 | + __("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), |
|
505 | + print_r($this->_gateway, true) |
|
506 | + ) |
|
507 | + ); |
|
508 | + } |
|
509 | + $payment = $this->_gateway->handle_payment_update($req_data, $transaction); |
|
510 | + return $payment; |
|
511 | + } |
|
512 | + |
|
513 | + |
|
514 | + /** |
|
515 | + * Saves the billing info onto the attendee of the primary registrant on this transaction, and |
|
516 | + * cleans it first. |
|
517 | + * |
|
518 | + * @param EE_Billing_Attendee_Info_Form $billing_form |
|
519 | + * @param EE_Transaction $transaction |
|
520 | + * @return boolean success |
|
521 | + */ |
|
522 | + protected function _save_billing_info_to_attendee($billing_form, $transaction) |
|
523 | + { |
|
524 | + if (! $transaction || ! $transaction instanceof EE_Transaction) { |
|
525 | + EE_Error::add_error( |
|
526 | + __("Cannot save billing info because no transaction was specified", "event_espresso"), |
|
527 | + __FILE__, |
|
528 | + __FUNCTION__, |
|
529 | + __LINE__ |
|
530 | + ); |
|
531 | + return false; |
|
532 | + } |
|
533 | + $primary_reg = $transaction->primary_registration(); |
|
534 | + if (! $primary_reg) { |
|
535 | + EE_Error::add_error( |
|
536 | + __("Cannot save billing info because the transaction has no primary registration", "event_espresso"), |
|
537 | + __FILE__, |
|
538 | + __FUNCTION__, |
|
539 | + __LINE__ |
|
540 | + ); |
|
541 | + return false; |
|
542 | + } |
|
543 | + $attendee = $primary_reg->attendee(); |
|
544 | + if (! $attendee) { |
|
545 | + EE_Error::add_error( |
|
546 | + __( |
|
547 | + "Cannot save billing info because the transaction's primary registration has no attendee!", |
|
548 | + "event_espresso" |
|
549 | + ), |
|
550 | + __FILE__, |
|
551 | + __FUNCTION__, |
|
552 | + __LINE__ |
|
553 | + ); |
|
554 | + return false; |
|
555 | + } |
|
556 | + return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method()); |
|
557 | + } |
|
558 | + |
|
559 | + |
|
560 | + /** |
|
561 | + * Gets the payment this IPN is for. Children may often want to |
|
562 | + * override this to inspect the request |
|
563 | + * |
|
564 | + * @param EE_Transaction $transaction |
|
565 | + * @param array $req_data |
|
566 | + * @return EE_Payment |
|
567 | + */ |
|
568 | + protected function find_payment_for_ipn(EE_Transaction $transaction, $req_data = array()) |
|
569 | + { |
|
570 | + return $transaction->last_payment(); |
|
571 | + } |
|
572 | + |
|
573 | + |
|
574 | + /** |
|
575 | + * In case generic code cannot provide the payment processor with a specific payment method |
|
576 | + * and transaction, it will try calling this method on each activate payment method. |
|
577 | + * If the payment method is able to identify the request as being for it, it should fetch |
|
578 | + * the payment its for and return it. If not, it should throw an EE_Error to indicate it cannot |
|
579 | + * handle the IPN |
|
580 | + * |
|
581 | + * @param array $req_data |
|
582 | + * @return EE_Payment only if this payment method can find the info its needs from $req_data |
|
583 | + * and identifies the IPN as being for this payment method (not just fo ra payment method of this type) |
|
584 | + * @throws EE_Error |
|
585 | + */ |
|
586 | + public function handle_unclaimed_ipn($req_data = array()) |
|
587 | + { |
|
588 | + throw new EE_Error( |
|
589 | + sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this)) |
|
590 | + ); |
|
591 | + } |
|
592 | + |
|
593 | + |
|
594 | + /** |
|
595 | + * Logic to be accomplished when the payment attempt is complete. |
|
596 | + * Most payment methods don't need to do anything at this point; but some, like Mijireh, do. |
|
597 | + * (Mijireh is an offsite gateway which doesn't send an IPN. So when the user returns to EE from |
|
598 | + * mijireh, this method needs to be called so the Mijireh PM can ping Mijireh to know the status |
|
599 | + * of the payment). Fed a transaction because it's always assumed to be the last payment that |
|
600 | + * we're dealing with. Returns that last payment (if there is one) |
|
601 | + * |
|
602 | + * @param EE_Transaction $transaction |
|
603 | + * @return EE_Payment |
|
604 | + */ |
|
605 | + public function finalize_payment_for($transaction) |
|
606 | + { |
|
607 | + return $transaction->last_payment(); |
|
608 | + } |
|
609 | + |
|
610 | + |
|
611 | + /** |
|
612 | + * Whether or not this payment method's gateway supports sending refund requests |
|
613 | + * |
|
614 | + * @return boolean |
|
615 | + */ |
|
616 | + public function supports_sending_refunds() |
|
617 | + { |
|
618 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
619 | + return $this->_gateway->supports_sending_refunds(); |
|
620 | + } else { |
|
621 | + return false; |
|
622 | + } |
|
623 | + } |
|
624 | + |
|
625 | + |
|
626 | + /** |
|
627 | + * |
|
628 | + * @param EE_Payment $payment |
|
629 | + * @param array $refund_info |
|
630 | + * @throws EE_Error |
|
631 | + * @return EE_Payment |
|
632 | + */ |
|
633 | + public function process_refund(EE_Payment $payment, $refund_info = array()) |
|
634 | + { |
|
635 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
636 | + return $this->_gateway->do_direct_refund($payment, $refund_info); |
|
637 | + } else { |
|
638 | + throw new EE_Error( |
|
639 | + sprintf( |
|
640 | + __('Payment Method Type "%s" does not support sending refund requests', 'event_espresso'), |
|
641 | + get_class($this) |
|
642 | + ) |
|
643 | + ); |
|
644 | + } |
|
645 | + } |
|
646 | + |
|
647 | + |
|
648 | + /** |
|
649 | + * Returns one the class's constants onsite,offsite, or offline, depending on this |
|
650 | + * payment method's gateway. |
|
651 | + * |
|
652 | + * @return string |
|
653 | + * @throws EE_Error |
|
654 | + */ |
|
655 | + public function payment_occurs() |
|
656 | + { |
|
657 | + if (! $this->_gateway) { |
|
658 | + return EE_PMT_Base::offline; |
|
659 | + } elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
|
660 | + return EE_PMT_Base::onsite; |
|
661 | + } elseif ($this->_gateway instanceof EE_Offsite_Gateway) { |
|
662 | + return EE_PMT_Base::offsite; |
|
663 | + } else { |
|
664 | + throw new EE_Error( |
|
665 | + sprintf( |
|
666 | + __( |
|
667 | + "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", |
|
668 | + "event_espresso" |
|
669 | + ), |
|
670 | + get_class($this) |
|
671 | + ) |
|
672 | + ); |
|
673 | + } |
|
674 | + } |
|
675 | + |
|
676 | + |
|
677 | + /** |
|
678 | + * For adding any html output ab ove the payment overview. |
|
679 | + * Many gateways won't want ot display anything, so this function just returns an empty string. |
|
680 | + * Other gateways may want to override this, such as offline gateways. |
|
681 | + * |
|
682 | + * @param EE_Payment $payment |
|
683 | + * @return string |
|
684 | + */ |
|
685 | + public function payment_overview_content(EE_Payment $payment) |
|
686 | + { |
|
687 | + return EEH_Template::display_template( |
|
688 | + EE_LIBRARIES . 'payment_methods/templates/payment_details_content.template.php', |
|
689 | + array('payment_method' => $this->_pm_instance, 'payment' => $payment), |
|
690 | + true |
|
691 | + ); |
|
692 | + } |
|
693 | + |
|
694 | + |
|
695 | + /** |
|
696 | + * @return array where keys are the help tab name, |
|
697 | + * values are: array { |
|
698 | + * @type string $title i18n name for the help tab |
|
699 | + * @type string $filename name of the file located in ./help_tabs/ (ie, in a folder next to this file) |
|
700 | + * @type array $template_args any arguments you want passed to the template file while rendering. |
|
701 | + * Keys will be variable names and values with be their values. |
|
702 | + */ |
|
703 | + public function help_tabs_config() |
|
704 | + { |
|
705 | + return array(); |
|
706 | + } |
|
707 | + |
|
708 | + |
|
709 | + /** |
|
710 | + * The system name for this PMT (eg AIM, Paypal_Pro, Invoice... what gets put into |
|
711 | + * the payment method's table's PMT_type column) |
|
712 | + * |
|
713 | + * @return string |
|
714 | + */ |
|
715 | + public function system_name() |
|
716 | + { |
|
717 | + $classname = get_class($this); |
|
718 | + return str_replace("EE_PMT_", '', $classname); |
|
719 | + } |
|
720 | + |
|
721 | + |
|
722 | + /** |
|
723 | + * A pretty i18n version of the PMT name. Often the same as the "pretty_name", but you can change it by overriding |
|
724 | + * this method. |
|
725 | + * @return string |
|
726 | + */ |
|
727 | + public function defaultFrontendName() |
|
728 | + { |
|
729 | + return $this->pretty_name(); |
|
730 | + } |
|
731 | + |
|
732 | + |
|
733 | + /** |
|
734 | + * A pretty i18n version of the PMT name |
|
735 | + * |
|
736 | + * @return string |
|
737 | + */ |
|
738 | + public function pretty_name() |
|
739 | + { |
|
740 | + return $this->_pretty_name; |
|
741 | + } |
|
742 | + |
|
743 | + |
|
744 | + /** |
|
745 | + * Gets the default absolute URL to the payment method type's button |
|
746 | + * |
|
747 | + * @return string |
|
748 | + */ |
|
749 | + public function default_button_url() |
|
750 | + { |
|
751 | + return $this->_default_button_url; |
|
752 | + } |
|
753 | + |
|
754 | + |
|
755 | + /** |
|
756 | + * Gets the gateway used by this payment method (if any) |
|
757 | + * |
|
758 | + * @return EE_Gateway |
|
759 | + */ |
|
760 | + public function get_gateway() |
|
761 | + { |
|
762 | + return $this->_gateway; |
|
763 | + } |
|
764 | + |
|
765 | + |
|
766 | + /** |
|
767 | + * @return string html for the link to a help tab |
|
768 | + */ |
|
769 | + public function get_help_tab_link() |
|
770 | + { |
|
771 | + return EEH_Template::get_help_tab_link( |
|
772 | + $this->get_help_tab_name(), |
|
773 | + 'espresso_payment_settings', |
|
774 | + 'default' |
|
775 | + ); |
|
776 | + } |
|
777 | + |
|
778 | + |
|
779 | + /** |
|
780 | + * Returns the name of the help tab for this PMT |
|
781 | + * |
|
782 | + * @return string |
|
783 | + */ |
|
784 | + public function get_help_tab_name() |
|
785 | + { |
|
786 | + return 'ee_' . strtolower($this->system_name()) . '_help_tab'; |
|
787 | + } |
|
788 | + |
|
789 | + /** |
|
790 | + * The name of the wp capability that should be associated with the usage of |
|
791 | + * this PMT by an admin |
|
792 | + * |
|
793 | + * @return string |
|
794 | + */ |
|
795 | + public function cap_name() |
|
796 | + { |
|
797 | + return 'ee_payment_method_' . strtolower($this->system_name()); |
|
798 | + } |
|
799 | + |
|
800 | + /** |
|
801 | + * Called by client code to tell the gateway that if it wants to change |
|
802 | + * the transaction or line items or registrations related to teh payment it already |
|
803 | + * processed (we think, but possibly not) that now's the time to do it. |
|
804 | + * It is expected that gateways will store any info they need for this on the PAY_details, |
|
805 | + * or maybe an extra meta value |
|
806 | + * |
|
807 | + * @param EE_Payment $payment |
|
808 | + * @return void |
|
809 | + */ |
|
810 | + public function update_txn_based_on_payment($payment) |
|
811 | + { |
|
812 | + if ($this->_gateway instanceof EE_Gateway) { |
|
813 | + $this->_gateway->update_txn_based_on_payment($payment); |
|
814 | + } |
|
815 | + } |
|
816 | + |
|
817 | + /** |
|
818 | + * Returns a string of HTML describing this payment method type for an admin, |
|
819 | + * primarily intended for them to read before activating it. |
|
820 | + * The easiest way to set this is to create a folder 'templates' alongside |
|
821 | + * your EE_PMT_{System_Name} file, and in it create a file named "{system_name}_intro.template.php". |
|
822 | + * Eg, if your payment method file is named "EE_PMT_Foo_Bar.pm.php", |
|
823 | + * then you'd create a file named "templates" in the same folder as it, and name the file |
|
824 | + * "foo_bar_intro.template.php", and its content will be returned by this method |
|
825 | + * |
|
826 | + * @return string |
|
827 | + */ |
|
828 | + public function introductory_html() |
|
829 | + { |
|
830 | + return EEH_Template::locate_template( |
|
831 | + $this->file_folder() . 'templates/' . strtolower($this->system_name()) . '_intro.template.php', |
|
832 | + array('pmt_obj' => $this, 'pm_instance' => $this->_pm_instance) |
|
833 | + ); |
|
834 | + } |
|
835 | 835 | } |
@@ -129,12 +129,12 @@ |
||
129 | 129 | <?php |
130 | 130 | function esp_gravatar_profile($email) |
131 | 131 | { |
132 | - echo 'https://www.gravatar.com/' . md5($email); |
|
132 | + echo 'https://www.gravatar.com/'.md5($email); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | function esp_gravatar_image($email, $name) |
136 | 136 | { |
137 | - echo '<img src="https://0.gravatar.com/avatar/' . md5($email) . '?s=60" class="gravatar" alt="' . $name . '"/>'; |
|
137 | + echo '<img src="https://0.gravatar.com/avatar/'.md5($email).'?s=60" class="gravatar" alt="'.$name.'"/>'; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | ?> |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <p class="about-description"> |
2 | 2 | <?php esc_html_e( |
3 | - 'Event Espresso is created by an international team of passionate individuals with a drive to empower your events!', |
|
4 | - 'event_espresso' |
|
5 | - ); ?></p> |
|
3 | + 'Event Espresso is created by an international team of passionate individuals with a drive to empower your events!', |
|
4 | + 'event_espresso' |
|
5 | + ); ?></p> |
|
6 | 6 | <h3 class="wp-people-group"><?php esc_html_e('Founders', 'event_espresso'); ?></h3> |
7 | 7 | <ul class="wp-people-group" id="ee-people-group-owners"> |
8 | 8 | <li class="wp-person" id="ee-person-sshoultes"> |
@@ -85,15 +85,15 @@ discard block |
||
85 | 85 | <h3 class="wp-people-group"><?php esc_html_e('Contributor Recognition', 'event_espresso'); ?></h3> |
86 | 86 | <p class="description"> |
87 | 87 | <?php |
88 | - printf( |
|
89 | - esc_html__( |
|
90 | - 'For every major release we want to recognize the people who contributed to the release via a GitHub pull request. Want to see your name listed here? %sWhen you submit a pull request that gets included in a major release%s, we\'ll add your name here linked to your GitHub profile.', |
|
91 | - 'event_espresso' |
|
92 | - ), |
|
93 | - '<a href="https://github.com/eventespresso/event-espresso-core" title="Contribute to Event Espresso by making a pull request via GitHub">', |
|
94 | - '</a>' |
|
95 | - ); |
|
96 | - ?> |
|
88 | + printf( |
|
89 | + esc_html__( |
|
90 | + 'For every major release we want to recognize the people who contributed to the release via a GitHub pull request. Want to see your name listed here? %sWhen you submit a pull request that gets included in a major release%s, we\'ll add your name here linked to your GitHub profile.', |
|
91 | + 'event_espresso' |
|
92 | + ), |
|
93 | + '<a href="https://github.com/eventespresso/event-espresso-core" title="Contribute to Event Espresso by making a pull request via GitHub">', |
|
94 | + '</a>' |
|
95 | + ); |
|
96 | + ?> |
|
97 | 97 | </p> |
98 | 98 | <p class="wp-credits-list"> |
99 | 99 | <ul> |
@@ -108,15 +108,15 @@ discard block |
||
108 | 108 | <h3 class="wp-people-group"><?php esc_html_e('External Libraries', 'event_espresso'); ?></h3> |
109 | 109 | <p class="description"> |
110 | 110 | <?php |
111 | - printf( |
|
112 | - esc_html__( |
|
113 | - 'Along with the libraries %sincluded with WordPress%s, Event Espresso utilizes the following third party libraries:', |
|
114 | - 'event_espresso' |
|
115 | - ), |
|
116 | - '<a href="credits.php">', |
|
117 | - '</a>' |
|
118 | - ); |
|
119 | - ?> |
|
111 | + printf( |
|
112 | + esc_html__( |
|
113 | + 'Along with the libraries %sincluded with WordPress%s, Event Espresso utilizes the following third party libraries:', |
|
114 | + 'event_espresso' |
|
115 | + ), |
|
116 | + '<a href="credits.php">', |
|
117 | + '</a>' |
|
118 | + ); |
|
119 | + ?> |
|
120 | 120 | </p> |
121 | 121 | <p class="wp-credits-list"> |
122 | 122 | <a href="https://openexchangerates.github.io/accounting.js/">accounting.js</a>, |
@@ -133,12 +133,12 @@ discard block |
||
133 | 133 | <?php |
134 | 134 | function esp_gravatar_profile($email) |
135 | 135 | { |
136 | - echo 'https://www.gravatar.com/' . md5($email); |
|
136 | + echo 'https://www.gravatar.com/' . md5($email); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | function esp_gravatar_image($email, $name) |
140 | 140 | { |
141 | - echo '<img src="https://0.gravatar.com/avatar/' . md5($email) . '?s=60" class="gravatar" alt="' . $name . '"/>'; |
|
141 | + echo '<img src="https://0.gravatar.com/avatar/' . md5($email) . '?s=60" class="gravatar" alt="' . $name . '"/>'; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | ?> |
@@ -1,225 +1,225 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_Default_Line_Item_Display_Strategy |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_Default_Line_Item_Display_Strategy |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | class EE_Default_Line_Item_Display_Strategy implements EEI_Line_Item_Display |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * total amount of tax to apply |
|
20 | - * @type float $_tax_rate |
|
21 | - */ |
|
22 | - private $_tax_rate = 0; |
|
23 | - |
|
24 | - /** |
|
25 | - * total amount including tax we can bill for at this time |
|
26 | - * @type float $_grand_total |
|
27 | - */ |
|
28 | - private $_grand_total = 0.00; |
|
29 | - |
|
30 | - /** |
|
31 | - * total number of items being billed for |
|
32 | - * @type int $_total_items |
|
33 | - */ |
|
34 | - private $_total_items = 0; |
|
35 | - |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * @return float |
|
40 | - */ |
|
41 | - public function grand_total() |
|
42 | - { |
|
43 | - return $this->_grand_total; |
|
44 | - } |
|
45 | - |
|
46 | - |
|
47 | - |
|
48 | - /** |
|
49 | - * @return int |
|
50 | - */ |
|
51 | - public function total_items() |
|
52 | - { |
|
53 | - return $this->_total_items; |
|
54 | - } |
|
55 | - |
|
56 | - |
|
57 | - |
|
58 | - /** |
|
59 | - * @param EE_Line_Item $line_item |
|
60 | - * @param array $options |
|
61 | - * @return mixed |
|
62 | - */ |
|
63 | - public function display_line_item(EE_Line_Item $line_item, $options = array()) |
|
64 | - { |
|
65 | - |
|
66 | - $html = ''; |
|
67 | - // set some default options and merge with incoming |
|
68 | - $default_options = array( |
|
69 | - 'show_desc' => true, // TRUE FALSE |
|
70 | - 'odd' => false |
|
71 | - ); |
|
72 | - $options = array_merge($default_options, (array) $options); |
|
73 | - |
|
74 | - switch ($line_item->type()) { |
|
75 | - case EEM_Line_Item::type_line_item: |
|
76 | - // item row |
|
77 | - $html .= $this->_item_row($line_item, $options); |
|
78 | - // got any kids? |
|
79 | - foreach ($line_item->children() as $child_line_item) { |
|
80 | - $this->display_line_item($child_line_item, $options); |
|
81 | - } |
|
82 | - break; |
|
83 | - |
|
84 | - case EEM_Line_Item::type_sub_line_item: |
|
85 | - $html .= $this->_sub_item_row($line_item, $options); |
|
86 | - break; |
|
87 | - |
|
88 | - case EEM_Line_Item::type_sub_total: |
|
89 | - break; |
|
90 | - |
|
91 | - case EEM_Line_Item::type_tax: |
|
92 | - $this->_tax_rate += $line_item->percent(); |
|
93 | - break; |
|
94 | - |
|
95 | - case EEM_Line_Item::type_tax_sub_total: |
|
96 | - foreach ($line_item->children() as $child_line_item) { |
|
97 | - if ($child_line_item->type() == EEM_Line_Item::type_tax) { |
|
98 | - // recursively feed children back into this method |
|
99 | - $this->display_line_item($child_line_item, $options); |
|
100 | - } |
|
101 | - } |
|
102 | - break; |
|
103 | - |
|
104 | - case EEM_Line_Item::type_total: |
|
105 | - // get all child line items |
|
106 | - $children = $line_item->children(); |
|
107 | - if ($options['set_tax_rate'] === true) { |
|
108 | - // loop thru tax child line items just to determine tax rate |
|
109 | - foreach ($children as $child_line_item) { |
|
110 | - if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) { |
|
111 | - // recursively feed children back into this method |
|
112 | - $this->display_line_item($child_line_item, $options); |
|
113 | - } |
|
114 | - } |
|
115 | - } else { |
|
116 | - // now loop thru all non-tax child line items |
|
117 | - foreach ($children as $child_line_item) { |
|
118 | - if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) { |
|
119 | - // recursively feed children back into this method |
|
120 | - $html .= $this->display_line_item($child_line_item, $options); |
|
121 | - } |
|
122 | - } |
|
123 | - } |
|
124 | - break; |
|
125 | - } |
|
126 | - |
|
127 | - return $html; |
|
128 | - } |
|
129 | - |
|
130 | - |
|
131 | - |
|
132 | - /** |
|
133 | - * _total_row |
|
134 | - * |
|
135 | - * @param EE_Line_Item $line_item |
|
136 | - * @param array $options |
|
137 | - * @return mixed |
|
138 | - */ |
|
139 | - private function _item_row(EE_Line_Item $line_item, $options = array()) |
|
140 | - { |
|
141 | - // start of row |
|
142 | - $row_class = $options['odd'] ? 'item odd' : 'item'; |
|
143 | - $html = EEH_HTML::tr('', '', $row_class); |
|
144 | - // name && desc |
|
145 | - $name_and_desc = apply_filters( |
|
146 | - 'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__name', |
|
147 | - $line_item->name(), |
|
148 | - $line_item |
|
149 | - ); |
|
150 | - $name_and_desc .= apply_filters( |
|
151 | - 'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__desc', |
|
152 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
153 | - $line_item, |
|
154 | - $options |
|
155 | - ); |
|
156 | - if ($line_item->is_taxable()) { |
|
157 | - $ticket_price_includes_taxes = EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
|
158 | - ? esc_html__('* price includes taxes', 'event_espresso') |
|
159 | - : esc_html__('* price does not include taxes', 'event_espresso'); |
|
160 | - $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' |
|
161 | - . $ticket_price_includes_taxes |
|
162 | - . '</span>'; |
|
163 | - } |
|
164 | - |
|
165 | - // name td |
|
166 | - $html .= EEH_HTML::td($name_and_desc, '', 'item_l'); |
|
167 | - // quantity td |
|
168 | - $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
169 | - $tax_rate = $line_item->is_taxable() |
|
170 | - && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
|
171 | - ? 1 + ( $this->_tax_rate / 100 ) |
|
172 | - : 1; |
|
173 | - // price td |
|
174 | - $unit_price = apply_filters( |
|
175 | - 'FHEE__EE_Default_Line_Item_Display_Strategy___item_row__unit_price', |
|
176 | - EEH_Template::format_currency($line_item->unit_price() * $tax_rate, false, false), |
|
177 | - $line_item, |
|
178 | - $tax_rate |
|
179 | - ); |
|
180 | - $html .= EEH_HTML::td($unit_price, '', 'item_c jst-rght'); |
|
181 | - // total td |
|
182 | - $total = apply_filters( |
|
183 | - 'FHEE__EE_Default_Line_Item_Display_Strategy___item_row__total', |
|
184 | - EEH_Template::format_currency($line_item->unit_price() * $line_item->quantity() * $tax_rate, false, false), |
|
185 | - $line_item, |
|
186 | - $tax_rate |
|
187 | - ); |
|
188 | - $html .= EEH_HTML::td($total, '', 'item_r jst-rght'); |
|
189 | - // end of row |
|
190 | - $html .= EEH_HTML::trx(); |
|
191 | - |
|
192 | - return $html; |
|
193 | - } |
|
194 | - |
|
195 | - |
|
196 | - |
|
197 | - /** |
|
198 | - * _sub_item_row |
|
199 | - * |
|
200 | - * @param EE_Line_Item $line_item |
|
201 | - * @param array $options |
|
202 | - * @return mixed |
|
203 | - */ |
|
204 | - private function _sub_item_row(EE_Line_Item $line_item, $options = array()) |
|
205 | - { |
|
206 | - // start of row |
|
207 | - $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
208 | - // name && desc |
|
209 | - $name_and_desc = $line_item->name(); |
|
210 | - $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : ''; |
|
211 | - // name td |
|
212 | - $html .= EEH_HTML::td(/*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item'); |
|
213 | - // discount/surcharge td |
|
214 | - if ($line_item->is_percent()) { |
|
215 | - $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c'); |
|
216 | - } else { |
|
217 | - $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
218 | - } |
|
219 | - // total td |
|
220 | - $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); |
|
221 | - // end of row |
|
222 | - $html .= EEH_HTML::trx(); |
|
223 | - return $html; |
|
224 | - } |
|
18 | + /** |
|
19 | + * total amount of tax to apply |
|
20 | + * @type float $_tax_rate |
|
21 | + */ |
|
22 | + private $_tax_rate = 0; |
|
23 | + |
|
24 | + /** |
|
25 | + * total amount including tax we can bill for at this time |
|
26 | + * @type float $_grand_total |
|
27 | + */ |
|
28 | + private $_grand_total = 0.00; |
|
29 | + |
|
30 | + /** |
|
31 | + * total number of items being billed for |
|
32 | + * @type int $_total_items |
|
33 | + */ |
|
34 | + private $_total_items = 0; |
|
35 | + |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * @return float |
|
40 | + */ |
|
41 | + public function grand_total() |
|
42 | + { |
|
43 | + return $this->_grand_total; |
|
44 | + } |
|
45 | + |
|
46 | + |
|
47 | + |
|
48 | + /** |
|
49 | + * @return int |
|
50 | + */ |
|
51 | + public function total_items() |
|
52 | + { |
|
53 | + return $this->_total_items; |
|
54 | + } |
|
55 | + |
|
56 | + |
|
57 | + |
|
58 | + /** |
|
59 | + * @param EE_Line_Item $line_item |
|
60 | + * @param array $options |
|
61 | + * @return mixed |
|
62 | + */ |
|
63 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) |
|
64 | + { |
|
65 | + |
|
66 | + $html = ''; |
|
67 | + // set some default options and merge with incoming |
|
68 | + $default_options = array( |
|
69 | + 'show_desc' => true, // TRUE FALSE |
|
70 | + 'odd' => false |
|
71 | + ); |
|
72 | + $options = array_merge($default_options, (array) $options); |
|
73 | + |
|
74 | + switch ($line_item->type()) { |
|
75 | + case EEM_Line_Item::type_line_item: |
|
76 | + // item row |
|
77 | + $html .= $this->_item_row($line_item, $options); |
|
78 | + // got any kids? |
|
79 | + foreach ($line_item->children() as $child_line_item) { |
|
80 | + $this->display_line_item($child_line_item, $options); |
|
81 | + } |
|
82 | + break; |
|
83 | + |
|
84 | + case EEM_Line_Item::type_sub_line_item: |
|
85 | + $html .= $this->_sub_item_row($line_item, $options); |
|
86 | + break; |
|
87 | + |
|
88 | + case EEM_Line_Item::type_sub_total: |
|
89 | + break; |
|
90 | + |
|
91 | + case EEM_Line_Item::type_tax: |
|
92 | + $this->_tax_rate += $line_item->percent(); |
|
93 | + break; |
|
94 | + |
|
95 | + case EEM_Line_Item::type_tax_sub_total: |
|
96 | + foreach ($line_item->children() as $child_line_item) { |
|
97 | + if ($child_line_item->type() == EEM_Line_Item::type_tax) { |
|
98 | + // recursively feed children back into this method |
|
99 | + $this->display_line_item($child_line_item, $options); |
|
100 | + } |
|
101 | + } |
|
102 | + break; |
|
103 | + |
|
104 | + case EEM_Line_Item::type_total: |
|
105 | + // get all child line items |
|
106 | + $children = $line_item->children(); |
|
107 | + if ($options['set_tax_rate'] === true) { |
|
108 | + // loop thru tax child line items just to determine tax rate |
|
109 | + foreach ($children as $child_line_item) { |
|
110 | + if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) { |
|
111 | + // recursively feed children back into this method |
|
112 | + $this->display_line_item($child_line_item, $options); |
|
113 | + } |
|
114 | + } |
|
115 | + } else { |
|
116 | + // now loop thru all non-tax child line items |
|
117 | + foreach ($children as $child_line_item) { |
|
118 | + if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) { |
|
119 | + // recursively feed children back into this method |
|
120 | + $html .= $this->display_line_item($child_line_item, $options); |
|
121 | + } |
|
122 | + } |
|
123 | + } |
|
124 | + break; |
|
125 | + } |
|
126 | + |
|
127 | + return $html; |
|
128 | + } |
|
129 | + |
|
130 | + |
|
131 | + |
|
132 | + /** |
|
133 | + * _total_row |
|
134 | + * |
|
135 | + * @param EE_Line_Item $line_item |
|
136 | + * @param array $options |
|
137 | + * @return mixed |
|
138 | + */ |
|
139 | + private function _item_row(EE_Line_Item $line_item, $options = array()) |
|
140 | + { |
|
141 | + // start of row |
|
142 | + $row_class = $options['odd'] ? 'item odd' : 'item'; |
|
143 | + $html = EEH_HTML::tr('', '', $row_class); |
|
144 | + // name && desc |
|
145 | + $name_and_desc = apply_filters( |
|
146 | + 'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__name', |
|
147 | + $line_item->name(), |
|
148 | + $line_item |
|
149 | + ); |
|
150 | + $name_and_desc .= apply_filters( |
|
151 | + 'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__desc', |
|
152 | + ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
153 | + $line_item, |
|
154 | + $options |
|
155 | + ); |
|
156 | + if ($line_item->is_taxable()) { |
|
157 | + $ticket_price_includes_taxes = EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
|
158 | + ? esc_html__('* price includes taxes', 'event_espresso') |
|
159 | + : esc_html__('* price does not include taxes', 'event_espresso'); |
|
160 | + $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' |
|
161 | + . $ticket_price_includes_taxes |
|
162 | + . '</span>'; |
|
163 | + } |
|
164 | + |
|
165 | + // name td |
|
166 | + $html .= EEH_HTML::td($name_and_desc, '', 'item_l'); |
|
167 | + // quantity td |
|
168 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
169 | + $tax_rate = $line_item->is_taxable() |
|
170 | + && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
|
171 | + ? 1 + ( $this->_tax_rate / 100 ) |
|
172 | + : 1; |
|
173 | + // price td |
|
174 | + $unit_price = apply_filters( |
|
175 | + 'FHEE__EE_Default_Line_Item_Display_Strategy___item_row__unit_price', |
|
176 | + EEH_Template::format_currency($line_item->unit_price() * $tax_rate, false, false), |
|
177 | + $line_item, |
|
178 | + $tax_rate |
|
179 | + ); |
|
180 | + $html .= EEH_HTML::td($unit_price, '', 'item_c jst-rght'); |
|
181 | + // total td |
|
182 | + $total = apply_filters( |
|
183 | + 'FHEE__EE_Default_Line_Item_Display_Strategy___item_row__total', |
|
184 | + EEH_Template::format_currency($line_item->unit_price() * $line_item->quantity() * $tax_rate, false, false), |
|
185 | + $line_item, |
|
186 | + $tax_rate |
|
187 | + ); |
|
188 | + $html .= EEH_HTML::td($total, '', 'item_r jst-rght'); |
|
189 | + // end of row |
|
190 | + $html .= EEH_HTML::trx(); |
|
191 | + |
|
192 | + return $html; |
|
193 | + } |
|
194 | + |
|
195 | + |
|
196 | + |
|
197 | + /** |
|
198 | + * _sub_item_row |
|
199 | + * |
|
200 | + * @param EE_Line_Item $line_item |
|
201 | + * @param array $options |
|
202 | + * @return mixed |
|
203 | + */ |
|
204 | + private function _sub_item_row(EE_Line_Item $line_item, $options = array()) |
|
205 | + { |
|
206 | + // start of row |
|
207 | + $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
208 | + // name && desc |
|
209 | + $name_and_desc = $line_item->name(); |
|
210 | + $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : ''; |
|
211 | + // name td |
|
212 | + $html .= EEH_HTML::td(/*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item'); |
|
213 | + // discount/surcharge td |
|
214 | + if ($line_item->is_percent()) { |
|
215 | + $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c'); |
|
216 | + } else { |
|
217 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
218 | + } |
|
219 | + // total td |
|
220 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); |
|
221 | + // end of row |
|
222 | + $html .= EEH_HTML::trx(); |
|
223 | + return $html; |
|
224 | + } |
|
225 | 225 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $html = ''; |
67 | 67 | // set some default options and merge with incoming |
68 | 68 | $default_options = array( |
69 | - 'show_desc' => true, // TRUE FALSE |
|
69 | + 'show_desc' => true, // TRUE FALSE |
|
70 | 70 | 'odd' => false |
71 | 71 | ); |
72 | 72 | $options = array_merge($default_options, (array) $options); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | ); |
150 | 150 | $name_and_desc .= apply_filters( |
151 | 151 | 'FHEE__EE_Default_Line_Item_Display_Strategy__item_row__desc', |
152 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
152 | + ($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''), |
|
153 | 153 | $line_item, |
154 | 154 | $options |
155 | 155 | ); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
169 | 169 | $tax_rate = $line_item->is_taxable() |
170 | 170 | && EE_Registry::instance()->CFG->tax_settings->prices_displayed_including_taxes |
171 | - ? 1 + ( $this->_tax_rate / 100 ) |
|
171 | + ? 1 + ($this->_tax_rate / 100) |
|
172 | 172 | : 1; |
173 | 173 | // price td |
174 | 174 | $unit_price = apply_filters( |
@@ -207,12 +207,12 @@ discard block |
||
207 | 207 | $html = EEH_HTML::tr('', 'item sub-item-row'); |
208 | 208 | // name && desc |
209 | 209 | $name_and_desc = $line_item->name(); |
210 | - $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : ''; |
|
210 | + $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''; |
|
211 | 211 | // name td |
212 | 212 | $html .= EEH_HTML::td(/*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item'); |
213 | 213 | // discount/surcharge td |
214 | 214 | if ($line_item->is_percent()) { |
215 | - $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c'); |
|
215 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c'); |
|
216 | 216 | } else { |
217 | 217 | $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
218 | 218 | } |
@@ -16,314 +16,314 @@ |
||
16 | 16 | class StatsGatherer |
17 | 17 | { |
18 | 18 | |
19 | - const COUNT_ALL_EVENTS = 'event'; |
|
20 | - const COUNT_ACTIVE_EVENTS = 'active_event'; |
|
21 | - const COUNT_DATETIMES = 'datetime'; |
|
22 | - const COUNT_TICKETS = 'ticket'; |
|
23 | - const COUNT_DATETIMES_SOLD = 'datetime_sold'; |
|
24 | - const COUNT_TICKETS_FREE = 'free_ticket'; |
|
25 | - const COUNT_TICKETS_PAID = 'paid_ticket'; |
|
26 | - const COUNT_TICKETS_SOLD = 'ticket_sold'; |
|
27 | - const COUNT_REGISTRATIONS_APPROVED = 'registrations_approved'; |
|
28 | - const COUNT_REGISTRATIONS_NOT_APPROVED = 'registrations_not_approved'; |
|
29 | - const COUNT_REGISTRATIONS_PENDING = 'registrations_pending'; |
|
30 | - const COUNT_REGISTRATIONS_INCOMPLETE = 'registrations_incomplete'; |
|
31 | - const COUNT_REGISTRATIONS_ALL = 'registrations_all'; |
|
32 | - const COUNT_REGISTRATIONS_CANCELLED = 'registrations_cancelled'; |
|
33 | - const COUNT_REGISTRATIONS_DECLINED = 'registrations_declined'; |
|
34 | - const SUM_TRANSACTIONS_COMPLETE_TOTAL = 'transactions_complete_total_sum'; |
|
35 | - const SUM_TRANSACTIONS_ALL_PAID = 'transactions_all_paid'; |
|
36 | - const INFO_SITE_CURRENCY = 'site_currency'; |
|
19 | + const COUNT_ALL_EVENTS = 'event'; |
|
20 | + const COUNT_ACTIVE_EVENTS = 'active_event'; |
|
21 | + const COUNT_DATETIMES = 'datetime'; |
|
22 | + const COUNT_TICKETS = 'ticket'; |
|
23 | + const COUNT_DATETIMES_SOLD = 'datetime_sold'; |
|
24 | + const COUNT_TICKETS_FREE = 'free_ticket'; |
|
25 | + const COUNT_TICKETS_PAID = 'paid_ticket'; |
|
26 | + const COUNT_TICKETS_SOLD = 'ticket_sold'; |
|
27 | + const COUNT_REGISTRATIONS_APPROVED = 'registrations_approved'; |
|
28 | + const COUNT_REGISTRATIONS_NOT_APPROVED = 'registrations_not_approved'; |
|
29 | + const COUNT_REGISTRATIONS_PENDING = 'registrations_pending'; |
|
30 | + const COUNT_REGISTRATIONS_INCOMPLETE = 'registrations_incomplete'; |
|
31 | + const COUNT_REGISTRATIONS_ALL = 'registrations_all'; |
|
32 | + const COUNT_REGISTRATIONS_CANCELLED = 'registrations_cancelled'; |
|
33 | + const COUNT_REGISTRATIONS_DECLINED = 'registrations_declined'; |
|
34 | + const SUM_TRANSACTIONS_COMPLETE_TOTAL = 'transactions_complete_total_sum'; |
|
35 | + const SUM_TRANSACTIONS_ALL_PAID = 'transactions_all_paid'; |
|
36 | + const INFO_SITE_CURRENCY = 'site_currency'; |
|
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * @var EEM_Payment_Method |
|
41 | - */ |
|
42 | - private $payment_method_model; |
|
39 | + /** |
|
40 | + * @var EEM_Payment_Method |
|
41 | + */ |
|
42 | + private $payment_method_model; |
|
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * @var EEM_Event |
|
47 | - */ |
|
48 | - private $event_model; |
|
45 | + /** |
|
46 | + * @var EEM_Event |
|
47 | + */ |
|
48 | + private $event_model; |
|
49 | 49 | |
50 | - /** |
|
51 | - * @var EEM_Datetime |
|
52 | - */ |
|
53 | - private $datetime_model; |
|
50 | + /** |
|
51 | + * @var EEM_Datetime |
|
52 | + */ |
|
53 | + private $datetime_model; |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * @var EEM_Ticket |
|
58 | - */ |
|
59 | - private $ticket_model; |
|
56 | + /** |
|
57 | + * @var EEM_Ticket |
|
58 | + */ |
|
59 | + private $ticket_model; |
|
60 | 60 | |
61 | 61 | |
62 | - /** |
|
63 | - * @var EEM_Registration |
|
64 | - */ |
|
65 | - private $registration_model; |
|
62 | + /** |
|
63 | + * @var EEM_Registration |
|
64 | + */ |
|
65 | + private $registration_model; |
|
66 | 66 | |
67 | 67 | |
68 | - /** |
|
69 | - * @var EEM_Transaction |
|
70 | - */ |
|
71 | - private $transaction_model; |
|
68 | + /** |
|
69 | + * @var EEM_Transaction |
|
70 | + */ |
|
71 | + private $transaction_model; |
|
72 | 72 | |
73 | 73 | |
74 | - /** |
|
75 | - * @var EE_Config |
|
76 | - */ |
|
77 | - private $config; |
|
74 | + /** |
|
75 | + * @var EE_Config |
|
76 | + */ |
|
77 | + private $config; |
|
78 | 78 | |
79 | 79 | |
80 | - /** |
|
81 | - * StatsGatherer constructor. |
|
82 | - * |
|
83 | - * @param EEM_Payment_Method $payment_method_model |
|
84 | - * @param EEM_Event $event_model |
|
85 | - * @param EEM_Datetime $datetime_model |
|
86 | - * @param EEM_Ticket $ticket_model |
|
87 | - * @param EEM_Registration $registration_model |
|
88 | - * @param EEM_Transaction $transaction_model |
|
89 | - * @param EE_Config $config |
|
90 | - */ |
|
91 | - public function __construct( |
|
92 | - EEM_Payment_Method $payment_method_model, |
|
93 | - EEM_Event $event_model, |
|
94 | - EEM_Datetime $datetime_model, |
|
95 | - EEM_Ticket $ticket_model, |
|
96 | - EEM_Registration $registration_model, |
|
97 | - EEM_Transaction $transaction_model, |
|
98 | - EE_Config $config |
|
99 | - ) { |
|
100 | - $this->payment_method_model = $payment_method_model; |
|
101 | - $this->event_model = $event_model; |
|
102 | - $this->datetime_model = $datetime_model; |
|
103 | - $this->ticket_model = $ticket_model; |
|
104 | - $this->registration_model = $registration_model; |
|
105 | - $this->transaction_model = $transaction_model; |
|
106 | - $this->config = $config; |
|
107 | - } |
|
80 | + /** |
|
81 | + * StatsGatherer constructor. |
|
82 | + * |
|
83 | + * @param EEM_Payment_Method $payment_method_model |
|
84 | + * @param EEM_Event $event_model |
|
85 | + * @param EEM_Datetime $datetime_model |
|
86 | + * @param EEM_Ticket $ticket_model |
|
87 | + * @param EEM_Registration $registration_model |
|
88 | + * @param EEM_Transaction $transaction_model |
|
89 | + * @param EE_Config $config |
|
90 | + */ |
|
91 | + public function __construct( |
|
92 | + EEM_Payment_Method $payment_method_model, |
|
93 | + EEM_Event $event_model, |
|
94 | + EEM_Datetime $datetime_model, |
|
95 | + EEM_Ticket $ticket_model, |
|
96 | + EEM_Registration $registration_model, |
|
97 | + EEM_Transaction $transaction_model, |
|
98 | + EE_Config $config |
|
99 | + ) { |
|
100 | + $this->payment_method_model = $payment_method_model; |
|
101 | + $this->event_model = $event_model; |
|
102 | + $this->datetime_model = $datetime_model; |
|
103 | + $this->ticket_model = $ticket_model; |
|
104 | + $this->registration_model = $registration_model; |
|
105 | + $this->transaction_model = $transaction_model; |
|
106 | + $this->config = $config; |
|
107 | + } |
|
108 | 108 | |
109 | 109 | |
110 | - /** |
|
111 | - * Return the stats array for PUE UXIP stats. |
|
112 | - * |
|
113 | - * @return array |
|
114 | - */ |
|
115 | - public function stats() |
|
116 | - { |
|
117 | - global $wp_version; |
|
118 | - $stats = $this->paymentMethodStats(); |
|
119 | - // a-ok so let's setup our stats. |
|
120 | - $stats = array_merge($stats, array( |
|
121 | - 'is_multisite' => is_multisite() && is_main_site(), |
|
122 | - 'active_theme' => $this->getActiveThemeStat(), |
|
123 | - 'ee4_all_events_count' => $this->getCountFor(self::COUNT_ALL_EVENTS), |
|
124 | - 'ee4_active_events_count' => $this->getCountFor(self::COUNT_ACTIVE_EVENTS), |
|
125 | - 'all_dtts_count' => $this->getCountFor(self::COUNT_DATETIMES), |
|
126 | - 'dtt_sold' => $this->getCountFor(self::COUNT_DATETIMES_SOLD), |
|
127 | - 'all_tkt_count' => $this->getCountFor(self::COUNT_TICKETS), |
|
128 | - 'free_tkt_count' => $this->getCountFor(self::COUNT_TICKETS_FREE), |
|
129 | - 'paid_tkt_count' => $this->getCountFor(self::COUNT_TICKETS_PAID), |
|
130 | - 'tkt_sold' => $this->getCountFor(self::COUNT_TICKETS_SOLD), |
|
131 | - 'approve_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_APPROVED), |
|
132 | - 'pending_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_PENDING), |
|
133 | - 'not_approved_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_NOT_APPROVED), |
|
134 | - 'incomplete_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_INCOMPLETE), |
|
135 | - 'cancelled_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_CANCELLED), |
|
136 | - 'declined_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_DECLINED), |
|
137 | - 'all_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_ALL), |
|
138 | - 'completed_transaction_total_sum' => $this->getCountFor(self::SUM_TRANSACTIONS_COMPLETE_TOTAL), |
|
139 | - 'all_transaction_paid_sum' => $this->getCountFor(self::SUM_TRANSACTIONS_ALL_PAID), |
|
140 | - self::INFO_SITE_CURRENCY => $this->config->currency instanceof EE_Currency_Config |
|
141 | - ? $this->config->currency->code |
|
142 | - : 'unknown', |
|
143 | - 'phpversion' => implode( |
|
144 | - '.', |
|
145 | - array(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION) |
|
146 | - ), |
|
147 | - 'wpversion' => $wp_version, |
|
148 | - 'active_addons' => $this->getActiveAddons(), |
|
149 | - )); |
|
150 | - // remove any values that equal null. This ensures any stats that weren't retrieved successfully are excluded. |
|
151 | - return array_filter($stats, function ($value) { |
|
152 | - return $value !== null; |
|
153 | - }); |
|
154 | - } |
|
110 | + /** |
|
111 | + * Return the stats array for PUE UXIP stats. |
|
112 | + * |
|
113 | + * @return array |
|
114 | + */ |
|
115 | + public function stats() |
|
116 | + { |
|
117 | + global $wp_version; |
|
118 | + $stats = $this->paymentMethodStats(); |
|
119 | + // a-ok so let's setup our stats. |
|
120 | + $stats = array_merge($stats, array( |
|
121 | + 'is_multisite' => is_multisite() && is_main_site(), |
|
122 | + 'active_theme' => $this->getActiveThemeStat(), |
|
123 | + 'ee4_all_events_count' => $this->getCountFor(self::COUNT_ALL_EVENTS), |
|
124 | + 'ee4_active_events_count' => $this->getCountFor(self::COUNT_ACTIVE_EVENTS), |
|
125 | + 'all_dtts_count' => $this->getCountFor(self::COUNT_DATETIMES), |
|
126 | + 'dtt_sold' => $this->getCountFor(self::COUNT_DATETIMES_SOLD), |
|
127 | + 'all_tkt_count' => $this->getCountFor(self::COUNT_TICKETS), |
|
128 | + 'free_tkt_count' => $this->getCountFor(self::COUNT_TICKETS_FREE), |
|
129 | + 'paid_tkt_count' => $this->getCountFor(self::COUNT_TICKETS_PAID), |
|
130 | + 'tkt_sold' => $this->getCountFor(self::COUNT_TICKETS_SOLD), |
|
131 | + 'approve_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_APPROVED), |
|
132 | + 'pending_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_PENDING), |
|
133 | + 'not_approved_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_NOT_APPROVED), |
|
134 | + 'incomplete_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_INCOMPLETE), |
|
135 | + 'cancelled_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_CANCELLED), |
|
136 | + 'declined_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_DECLINED), |
|
137 | + 'all_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_ALL), |
|
138 | + 'completed_transaction_total_sum' => $this->getCountFor(self::SUM_TRANSACTIONS_COMPLETE_TOTAL), |
|
139 | + 'all_transaction_paid_sum' => $this->getCountFor(self::SUM_TRANSACTIONS_ALL_PAID), |
|
140 | + self::INFO_SITE_CURRENCY => $this->config->currency instanceof EE_Currency_Config |
|
141 | + ? $this->config->currency->code |
|
142 | + : 'unknown', |
|
143 | + 'phpversion' => implode( |
|
144 | + '.', |
|
145 | + array(PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION) |
|
146 | + ), |
|
147 | + 'wpversion' => $wp_version, |
|
148 | + 'active_addons' => $this->getActiveAddons(), |
|
149 | + )); |
|
150 | + // remove any values that equal null. This ensures any stats that weren't retrieved successfully are excluded. |
|
151 | + return array_filter($stats, function ($value) { |
|
152 | + return $value !== null; |
|
153 | + }); |
|
154 | + } |
|
155 | 155 | |
156 | - /** |
|
157 | - * @param string $which enum (@see constants prefixed with COUNT) |
|
158 | - * @return int|null |
|
159 | - */ |
|
160 | - private function getCountFor($which) |
|
161 | - { |
|
162 | - try { |
|
163 | - switch ($which) { |
|
164 | - case self::COUNT_ALL_EVENTS: |
|
165 | - $count = $this->event_model->count(); |
|
166 | - break; |
|
167 | - case self::COUNT_TICKETS: |
|
168 | - $count = $this->ticket_model->count(); |
|
169 | - break; |
|
170 | - case self::COUNT_DATETIMES: |
|
171 | - $count = $this->datetime_model->count(); |
|
172 | - break; |
|
173 | - case self::COUNT_ACTIVE_EVENTS: |
|
174 | - $count = $this->event_model->get_active_events(array(), true); |
|
175 | - break; |
|
176 | - case self::COUNT_DATETIMES_SOLD: |
|
177 | - $count = $this->datetime_model->sum(array(), 'DTT_sold'); |
|
178 | - break; |
|
179 | - case self::COUNT_TICKETS_FREE: |
|
180 | - $count = $this->ticket_model->count(array( |
|
181 | - array( |
|
182 | - 'TKT_price' => 0, |
|
183 | - ), |
|
184 | - )); |
|
185 | - break; |
|
186 | - case self::COUNT_TICKETS_PAID: |
|
187 | - $count = $this->ticket_model->count(array( |
|
188 | - array( |
|
189 | - 'TKT_price' => array('>', 0), |
|
190 | - ), |
|
191 | - )); |
|
192 | - break; |
|
193 | - case self::COUNT_TICKETS_SOLD: |
|
194 | - $count = $this->ticket_model->sum(array(), 'TKT_sold'); |
|
195 | - break; |
|
196 | - case self::COUNT_REGISTRATIONS_ALL: |
|
197 | - $count = $this->registration_model->count(); |
|
198 | - break; |
|
199 | - case self::COUNT_REGISTRATIONS_CANCELLED: |
|
200 | - $count = $this->registration_model->count( |
|
201 | - array( |
|
202 | - array( |
|
203 | - 'STS_ID' => EEM_Registration::status_id_cancelled, |
|
204 | - ), |
|
205 | - ) |
|
206 | - ); |
|
207 | - break; |
|
208 | - case self::COUNT_REGISTRATIONS_INCOMPLETE: |
|
209 | - $count = $this->registration_model->count( |
|
210 | - array( |
|
211 | - array( |
|
212 | - 'STS_ID' => EEM_Registration::status_id_incomplete, |
|
213 | - ), |
|
214 | - ) |
|
215 | - ); |
|
216 | - break; |
|
217 | - case self::COUNT_REGISTRATIONS_NOT_APPROVED: |
|
218 | - $count = $this->registration_model->count( |
|
219 | - array( |
|
220 | - array( |
|
221 | - 'STS_ID' => EEM_Registration::status_id_not_approved, |
|
222 | - ), |
|
223 | - ) |
|
224 | - ); |
|
225 | - break; |
|
226 | - case self::COUNT_REGISTRATIONS_DECLINED: |
|
227 | - $count = $this->registration_model->count( |
|
228 | - array( |
|
229 | - array( |
|
230 | - 'STS_ID' => EEM_Registration::status_id_declined, |
|
231 | - ), |
|
232 | - ) |
|
233 | - ); |
|
234 | - break; |
|
235 | - case self::COUNT_REGISTRATIONS_PENDING: |
|
236 | - $count = $this->registration_model->count( |
|
237 | - array( |
|
238 | - array( |
|
239 | - 'STS_ID' => EEM_Registration::status_id_pending_payment, |
|
240 | - ), |
|
241 | - ) |
|
242 | - ); |
|
243 | - break; |
|
244 | - case self::COUNT_REGISTRATIONS_APPROVED: |
|
245 | - $count = $this->registration_model->count( |
|
246 | - array( |
|
247 | - array( |
|
248 | - 'STS_ID' => EEM_Registration::status_id_approved, |
|
249 | - ), |
|
250 | - ) |
|
251 | - ); |
|
252 | - break; |
|
253 | - case self::SUM_TRANSACTIONS_COMPLETE_TOTAL: |
|
254 | - $count = $this->transaction_model->sum( |
|
255 | - array( |
|
256 | - array( |
|
257 | - 'STS_ID' => EEM_Transaction::complete_status_code, |
|
258 | - ), |
|
259 | - ), |
|
260 | - 'TXN_total' |
|
261 | - ); |
|
262 | - break; |
|
263 | - case self::SUM_TRANSACTIONS_ALL_PAID: |
|
264 | - $count = $this->transaction_model->sum( |
|
265 | - array(), |
|
266 | - 'TXN_paid' |
|
267 | - ); |
|
268 | - break; |
|
269 | - default: |
|
270 | - $count = null; |
|
271 | - break; |
|
272 | - } |
|
273 | - } catch (Exception $e) { |
|
274 | - $count = null; |
|
275 | - } |
|
276 | - return $count; |
|
277 | - } |
|
156 | + /** |
|
157 | + * @param string $which enum (@see constants prefixed with COUNT) |
|
158 | + * @return int|null |
|
159 | + */ |
|
160 | + private function getCountFor($which) |
|
161 | + { |
|
162 | + try { |
|
163 | + switch ($which) { |
|
164 | + case self::COUNT_ALL_EVENTS: |
|
165 | + $count = $this->event_model->count(); |
|
166 | + break; |
|
167 | + case self::COUNT_TICKETS: |
|
168 | + $count = $this->ticket_model->count(); |
|
169 | + break; |
|
170 | + case self::COUNT_DATETIMES: |
|
171 | + $count = $this->datetime_model->count(); |
|
172 | + break; |
|
173 | + case self::COUNT_ACTIVE_EVENTS: |
|
174 | + $count = $this->event_model->get_active_events(array(), true); |
|
175 | + break; |
|
176 | + case self::COUNT_DATETIMES_SOLD: |
|
177 | + $count = $this->datetime_model->sum(array(), 'DTT_sold'); |
|
178 | + break; |
|
179 | + case self::COUNT_TICKETS_FREE: |
|
180 | + $count = $this->ticket_model->count(array( |
|
181 | + array( |
|
182 | + 'TKT_price' => 0, |
|
183 | + ), |
|
184 | + )); |
|
185 | + break; |
|
186 | + case self::COUNT_TICKETS_PAID: |
|
187 | + $count = $this->ticket_model->count(array( |
|
188 | + array( |
|
189 | + 'TKT_price' => array('>', 0), |
|
190 | + ), |
|
191 | + )); |
|
192 | + break; |
|
193 | + case self::COUNT_TICKETS_SOLD: |
|
194 | + $count = $this->ticket_model->sum(array(), 'TKT_sold'); |
|
195 | + break; |
|
196 | + case self::COUNT_REGISTRATIONS_ALL: |
|
197 | + $count = $this->registration_model->count(); |
|
198 | + break; |
|
199 | + case self::COUNT_REGISTRATIONS_CANCELLED: |
|
200 | + $count = $this->registration_model->count( |
|
201 | + array( |
|
202 | + array( |
|
203 | + 'STS_ID' => EEM_Registration::status_id_cancelled, |
|
204 | + ), |
|
205 | + ) |
|
206 | + ); |
|
207 | + break; |
|
208 | + case self::COUNT_REGISTRATIONS_INCOMPLETE: |
|
209 | + $count = $this->registration_model->count( |
|
210 | + array( |
|
211 | + array( |
|
212 | + 'STS_ID' => EEM_Registration::status_id_incomplete, |
|
213 | + ), |
|
214 | + ) |
|
215 | + ); |
|
216 | + break; |
|
217 | + case self::COUNT_REGISTRATIONS_NOT_APPROVED: |
|
218 | + $count = $this->registration_model->count( |
|
219 | + array( |
|
220 | + array( |
|
221 | + 'STS_ID' => EEM_Registration::status_id_not_approved, |
|
222 | + ), |
|
223 | + ) |
|
224 | + ); |
|
225 | + break; |
|
226 | + case self::COUNT_REGISTRATIONS_DECLINED: |
|
227 | + $count = $this->registration_model->count( |
|
228 | + array( |
|
229 | + array( |
|
230 | + 'STS_ID' => EEM_Registration::status_id_declined, |
|
231 | + ), |
|
232 | + ) |
|
233 | + ); |
|
234 | + break; |
|
235 | + case self::COUNT_REGISTRATIONS_PENDING: |
|
236 | + $count = $this->registration_model->count( |
|
237 | + array( |
|
238 | + array( |
|
239 | + 'STS_ID' => EEM_Registration::status_id_pending_payment, |
|
240 | + ), |
|
241 | + ) |
|
242 | + ); |
|
243 | + break; |
|
244 | + case self::COUNT_REGISTRATIONS_APPROVED: |
|
245 | + $count = $this->registration_model->count( |
|
246 | + array( |
|
247 | + array( |
|
248 | + 'STS_ID' => EEM_Registration::status_id_approved, |
|
249 | + ), |
|
250 | + ) |
|
251 | + ); |
|
252 | + break; |
|
253 | + case self::SUM_TRANSACTIONS_COMPLETE_TOTAL: |
|
254 | + $count = $this->transaction_model->sum( |
|
255 | + array( |
|
256 | + array( |
|
257 | + 'STS_ID' => EEM_Transaction::complete_status_code, |
|
258 | + ), |
|
259 | + ), |
|
260 | + 'TXN_total' |
|
261 | + ); |
|
262 | + break; |
|
263 | + case self::SUM_TRANSACTIONS_ALL_PAID: |
|
264 | + $count = $this->transaction_model->sum( |
|
265 | + array(), |
|
266 | + 'TXN_paid' |
|
267 | + ); |
|
268 | + break; |
|
269 | + default: |
|
270 | + $count = null; |
|
271 | + break; |
|
272 | + } |
|
273 | + } catch (Exception $e) { |
|
274 | + $count = null; |
|
275 | + } |
|
276 | + return $count; |
|
277 | + } |
|
278 | 278 | |
279 | - /** |
|
280 | - * Return the active theme. |
|
281 | - * |
|
282 | - * @return false|string |
|
283 | - */ |
|
284 | - private function getActiveThemeStat() |
|
285 | - { |
|
286 | - $theme = wp_get_theme(); |
|
287 | - return $theme->get('Name'); |
|
288 | - } |
|
279 | + /** |
|
280 | + * Return the active theme. |
|
281 | + * |
|
282 | + * @return false|string |
|
283 | + */ |
|
284 | + private function getActiveThemeStat() |
|
285 | + { |
|
286 | + $theme = wp_get_theme(); |
|
287 | + return $theme->get('Name'); |
|
288 | + } |
|
289 | 289 | |
290 | - /** |
|
291 | - * @return array |
|
292 | - */ |
|
293 | - private function paymentMethodStats() |
|
294 | - { |
|
295 | - $payment_method_stats = array(); |
|
296 | - try { |
|
297 | - $active_payment_methods = $this->payment_method_model->get_all_active( |
|
298 | - null, |
|
299 | - array('group_by' => 'PMD_type') |
|
300 | - ); |
|
301 | - if ($active_payment_methods) { |
|
302 | - foreach ($active_payment_methods as $payment_method) { |
|
303 | - $payment_method_stats[ $payment_method->name() . '_active_payment_method' ] = 1; |
|
304 | - } |
|
305 | - } |
|
306 | - } catch (Exception $e) { |
|
307 | - // do nothing just prevents fatals. |
|
308 | - } |
|
309 | - return $payment_method_stats; |
|
310 | - } |
|
290 | + /** |
|
291 | + * @return array |
|
292 | + */ |
|
293 | + private function paymentMethodStats() |
|
294 | + { |
|
295 | + $payment_method_stats = array(); |
|
296 | + try { |
|
297 | + $active_payment_methods = $this->payment_method_model->get_all_active( |
|
298 | + null, |
|
299 | + array('group_by' => 'PMD_type') |
|
300 | + ); |
|
301 | + if ($active_payment_methods) { |
|
302 | + foreach ($active_payment_methods as $payment_method) { |
|
303 | + $payment_method_stats[ $payment_method->name() . '_active_payment_method' ] = 1; |
|
304 | + } |
|
305 | + } |
|
306 | + } catch (Exception $e) { |
|
307 | + // do nothing just prevents fatals. |
|
308 | + } |
|
309 | + return $payment_method_stats; |
|
310 | + } |
|
311 | 311 | |
312 | 312 | |
313 | - /** |
|
314 | - * Return a list of active EE add-ons and their versions. |
|
315 | - * |
|
316 | - * @return string |
|
317 | - */ |
|
318 | - private function getActiveAddons() |
|
319 | - { |
|
320 | - $activeAddons = []; |
|
321 | - $addOns = EE_Registry::instance()->addons; |
|
322 | - if (! empty($addOns)) { |
|
323 | - foreach ($addOns as $addon) { |
|
324 | - $activeAddons[] = $addon->name() . '@' . $addon->version(); |
|
325 | - } |
|
326 | - } |
|
327 | - return implode(',', $activeAddons); |
|
328 | - } |
|
313 | + /** |
|
314 | + * Return a list of active EE add-ons and their versions. |
|
315 | + * |
|
316 | + * @return string |
|
317 | + */ |
|
318 | + private function getActiveAddons() |
|
319 | + { |
|
320 | + $activeAddons = []; |
|
321 | + $addOns = EE_Registry::instance()->addons; |
|
322 | + if (! empty($addOns)) { |
|
323 | + foreach ($addOns as $addon) { |
|
324 | + $activeAddons[] = $addon->name() . '@' . $addon->version(); |
|
325 | + } |
|
326 | + } |
|
327 | + return implode(',', $activeAddons); |
|
328 | + } |
|
329 | 329 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | 'active_addons' => $this->getActiveAddons(), |
149 | 149 | )); |
150 | 150 | // remove any values that equal null. This ensures any stats that weren't retrieved successfully are excluded. |
151 | - return array_filter($stats, function ($value) { |
|
151 | + return array_filter($stats, function($value) { |
|
152 | 152 | return $value !== null; |
153 | 153 | }); |
154 | 154 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | ); |
301 | 301 | if ($active_payment_methods) { |
302 | 302 | foreach ($active_payment_methods as $payment_method) { |
303 | - $payment_method_stats[ $payment_method->name() . '_active_payment_method' ] = 1; |
|
303 | + $payment_method_stats[$payment_method->name().'_active_payment_method'] = 1; |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 | } catch (Exception $e) { |
@@ -319,9 +319,9 @@ discard block |
||
319 | 319 | { |
320 | 320 | $activeAddons = []; |
321 | 321 | $addOns = EE_Registry::instance()->addons; |
322 | - if (! empty($addOns)) { |
|
322 | + if ( ! empty($addOns)) { |
|
323 | 323 | foreach ($addOns as $addon) { |
324 | - $activeAddons[] = $addon->name() . '@' . $addon->version(); |
|
324 | + $activeAddons[] = $addon->name().'@'.$addon->version(); |
|
325 | 325 | } |
326 | 326 | } |
327 | 327 | return implode(',', $activeAddons); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public static function instance() |
47 | 47 | { |
48 | - if (! self::$_instance instanceof EE_Log) { |
|
48 | + if ( ! self::$_instance instanceof EE_Log) { |
|
49 | 49 | self::$_instance = new self(); |
50 | 50 | } |
51 | 51 | return self::$_instance; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | private function __construct() |
59 | 59 | { |
60 | 60 | |
61 | - if (! EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
61 | + if ( ! EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
62 | 62 | return; |
63 | 63 | } |
64 | 64 | |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | */ |
103 | 103 | private function _format_message($file = '', $function = '', $message = '', $type = '') |
104 | 104 | { |
105 | - $msg = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
106 | - $msg .= '[' . current_time('mysql') . '] '; |
|
105 | + $msg = '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
106 | + $msg .= '['.current_time('mysql').'] '; |
|
107 | 107 | $msg .= ! empty($file) ? basename($file) : ''; |
108 | 108 | $msg .= ! empty($file) && ! empty($function) ? ' -> ' : ''; |
109 | - $msg .= ! empty($function) ? $function . '()' : ''; |
|
109 | + $msg .= ! empty($function) ? $function.'()' : ''; |
|
110 | 110 | $msg .= PHP_EOL; |
111 | 111 | $type = ! empty($type) ? $type : 'log message'; |
112 | - $msg .= ! empty($message) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : ''; |
|
112 | + $msg .= ! empty($message) ? "\t".'['.$type.'] '.$message.PHP_EOL : ''; |
|
113 | 113 | return $msg; |
114 | 114 | } |
115 | 115 | |
@@ -159,19 +159,19 @@ discard block |
||
159 | 159 | return; |
160 | 160 | } |
161 | 161 | |
162 | - $data = 'domain=' . $_SERVER['HTTP_HOST']; |
|
163 | - $data .= '&ip=' . $_SERVER['SERVER_ADDR']; |
|
164 | - $data .= '&server_type=' . $_SERVER['SERVER_SOFTWARE']; |
|
165 | - $data .= '&time=' . time(); |
|
166 | - $data .= '&remote_log=' . $this->_log; |
|
167 | - $data .= '&request_array=' . json_encode($_REQUEST); |
|
162 | + $data = 'domain='.$_SERVER['HTTP_HOST']; |
|
163 | + $data .= '&ip='.$_SERVER['SERVER_ADDR']; |
|
164 | + $data .= '&server_type='.$_SERVER['SERVER_SOFTWARE']; |
|
165 | + $data .= '&time='.time(); |
|
166 | + $data .= '&remote_log='.$this->_log; |
|
167 | + $data .= '&request_array='.json_encode($_REQUEST); |
|
168 | 168 | $data .= '&action=save'; |
169 | 169 | |
170 | 170 | if (defined('EELOGGING_PASS')) { |
171 | - $data .= '&pass=' . EELOGGING_PASS; |
|
171 | + $data .= '&pass='.EELOGGING_PASS; |
|
172 | 172 | } |
173 | 173 | if (defined('EELOGGING_KEY')) { |
174 | - $data .= '&key=' . EELOGGING_KEY; |
|
174 | + $data .= '&key='.EELOGGING_KEY; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | $c = curl_init($this->_remote_logging_url); |
@@ -17,196 +17,196 @@ |
||
17 | 17 | class EE_Log |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @var string |
|
22 | - */ |
|
23 | - private $_log = ''; |
|
24 | - |
|
25 | - /** |
|
26 | - * Used for remote logging |
|
27 | - * |
|
28 | - * @var string |
|
29 | - */ |
|
30 | - private $_remote_logging_url = ''; |
|
31 | - |
|
32 | - /** |
|
33 | - * @var string |
|
34 | - */ |
|
35 | - private $_remote_log = ''; |
|
36 | - |
|
37 | - /** |
|
38 | - * @var EE_Log |
|
39 | - */ |
|
40 | - private static $_instance; |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * @return EE_Log |
|
45 | - */ |
|
46 | - public static function instance() |
|
47 | - { |
|
48 | - if (! self::$_instance instanceof EE_Log) { |
|
49 | - self::$_instance = new self(); |
|
50 | - } |
|
51 | - return self::$_instance; |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * @access private |
|
56 | - * @return EE_Log |
|
57 | - */ |
|
58 | - private function __construct() |
|
59 | - { |
|
60 | - |
|
61 | - if (! EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
62 | - return; |
|
63 | - } |
|
64 | - |
|
65 | - $this->_remote_logging_url = EE_Registry::instance()->CFG->admin->remote_logging_url; |
|
66 | - $this->_remote_log = ''; |
|
67 | - |
|
68 | - if (EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
69 | - add_action('shutdown', array($this, 'send_log'), 9999); |
|
70 | - } |
|
71 | - } |
|
72 | - |
|
73 | - |
|
74 | - /** |
|
75 | - * verify_filesystem |
|
76 | - * tests that the required files and folders exist and are writable |
|
77 | - * |
|
78 | - */ |
|
79 | - public function verify_filesystem() |
|
80 | - { |
|
81 | - $msg = esc_html__( |
|
82 | - 'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.', |
|
83 | - 'event_espresso' |
|
84 | - ); |
|
85 | - EE_Error::doing_it_wrong( |
|
86 | - __METHOD__, |
|
87 | - $msg, |
|
88 | - '4.10.1.p' |
|
89 | - ); |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * _format_message |
|
95 | - * makes yer log entries look all purdy |
|
96 | - * |
|
97 | - * @param string $file |
|
98 | - * @param string $function |
|
99 | - * @param string $message |
|
100 | - * @param string $type |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - private function _format_message($file = '', $function = '', $message = '', $type = '') |
|
104 | - { |
|
105 | - $msg = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
106 | - $msg .= '[' . current_time('mysql') . '] '; |
|
107 | - $msg .= ! empty($file) ? basename($file) : ''; |
|
108 | - $msg .= ! empty($file) && ! empty($function) ? ' -> ' : ''; |
|
109 | - $msg .= ! empty($function) ? $function . '()' : ''; |
|
110 | - $msg .= PHP_EOL; |
|
111 | - $type = ! empty($type) ? $type : 'log message'; |
|
112 | - $msg .= ! empty($message) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : ''; |
|
113 | - return $msg; |
|
114 | - } |
|
115 | - |
|
116 | - |
|
117 | - /** |
|
118 | - * log |
|
119 | - * adds content to the EE_Log->_log property which gets written to file during the WP 'shutdown' hookpoint via the |
|
120 | - * EE_Log::write_log() callback |
|
121 | - * |
|
122 | - * @param string $file |
|
123 | - * @param string $function |
|
124 | - * @param string $message |
|
125 | - * @param string $type |
|
126 | - */ |
|
127 | - public function log($file = '', $function = '', $message = '', $type = '') |
|
128 | - { |
|
129 | - $this->_log .= $this->_format_message($file, $function, $message, $type); |
|
130 | - } |
|
131 | - |
|
132 | - |
|
133 | - /** |
|
134 | - * write_log |
|
135 | - * appends the results of the 'AHEE_log' filter to the espresso log file |
|
136 | - */ |
|
137 | - public function write_log() |
|
138 | - { |
|
139 | - $msg = esc_html__( |
|
140 | - 'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.', |
|
141 | - 'event_espresso' |
|
142 | - ); |
|
143 | - EE_Error::doing_it_wrong( |
|
144 | - __METHOD__, |
|
145 | - $msg, |
|
146 | - '4.10.1.p' |
|
147 | - ); |
|
148 | - } |
|
149 | - |
|
150 | - |
|
151 | - /** |
|
152 | - * send_log |
|
153 | - * sends the espresso log to a remote URL via a PHP cURL request |
|
154 | - */ |
|
155 | - public function send_log() |
|
156 | - { |
|
157 | - |
|
158 | - if (empty($this->_remote_logging_url)) { |
|
159 | - return; |
|
160 | - } |
|
161 | - |
|
162 | - $data = 'domain=' . $_SERVER['HTTP_HOST']; |
|
163 | - $data .= '&ip=' . $_SERVER['SERVER_ADDR']; |
|
164 | - $data .= '&server_type=' . $_SERVER['SERVER_SOFTWARE']; |
|
165 | - $data .= '&time=' . time(); |
|
166 | - $data .= '&remote_log=' . $this->_log; |
|
167 | - $data .= '&request_array=' . json_encode($_REQUEST); |
|
168 | - $data .= '&action=save'; |
|
169 | - |
|
170 | - if (defined('EELOGGING_PASS')) { |
|
171 | - $data .= '&pass=' . EELOGGING_PASS; |
|
172 | - } |
|
173 | - if (defined('EELOGGING_KEY')) { |
|
174 | - $data .= '&key=' . EELOGGING_KEY; |
|
175 | - } |
|
176 | - |
|
177 | - $c = curl_init($this->_remote_logging_url); |
|
178 | - curl_setopt($c, CURLOPT_POST, true); |
|
179 | - curl_setopt($c, CURLOPT_POSTFIELDS, $data); |
|
180 | - curl_setopt($c, CURLOPT_RETURNTRANSFER, true); |
|
181 | - curl_exec($c); |
|
182 | - curl_close($c); |
|
183 | - } |
|
184 | - |
|
185 | - |
|
186 | - /** |
|
187 | - * write_debug |
|
188 | - * writes the contents of the current request's $_GET and $_POST arrays to a log file. |
|
189 | - * previous entries are overwritten |
|
190 | - */ |
|
191 | - public function write_debug() |
|
192 | - { |
|
193 | - $msg = esc_html__( |
|
194 | - 'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.', |
|
195 | - 'event_espresso' |
|
196 | - ); |
|
197 | - EE_Error::doing_it_wrong( |
|
198 | - __METHOD__, |
|
199 | - $msg, |
|
200 | - '4.10.1.p' |
|
201 | - ); |
|
202 | - } |
|
203 | - |
|
204 | - |
|
205 | - /** |
|
206 | - * __clone |
|
207 | - */ |
|
208 | - public function __clone() |
|
209 | - { |
|
210 | - trigger_error(__('Clone is not allowed.', 'event_espresso'), E_USER_ERROR); |
|
211 | - } |
|
20 | + /** |
|
21 | + * @var string |
|
22 | + */ |
|
23 | + private $_log = ''; |
|
24 | + |
|
25 | + /** |
|
26 | + * Used for remote logging |
|
27 | + * |
|
28 | + * @var string |
|
29 | + */ |
|
30 | + private $_remote_logging_url = ''; |
|
31 | + |
|
32 | + /** |
|
33 | + * @var string |
|
34 | + */ |
|
35 | + private $_remote_log = ''; |
|
36 | + |
|
37 | + /** |
|
38 | + * @var EE_Log |
|
39 | + */ |
|
40 | + private static $_instance; |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * @return EE_Log |
|
45 | + */ |
|
46 | + public static function instance() |
|
47 | + { |
|
48 | + if (! self::$_instance instanceof EE_Log) { |
|
49 | + self::$_instance = new self(); |
|
50 | + } |
|
51 | + return self::$_instance; |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * @access private |
|
56 | + * @return EE_Log |
|
57 | + */ |
|
58 | + private function __construct() |
|
59 | + { |
|
60 | + |
|
61 | + if (! EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
62 | + return; |
|
63 | + } |
|
64 | + |
|
65 | + $this->_remote_logging_url = EE_Registry::instance()->CFG->admin->remote_logging_url; |
|
66 | + $this->_remote_log = ''; |
|
67 | + |
|
68 | + if (EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
69 | + add_action('shutdown', array($this, 'send_log'), 9999); |
|
70 | + } |
|
71 | + } |
|
72 | + |
|
73 | + |
|
74 | + /** |
|
75 | + * verify_filesystem |
|
76 | + * tests that the required files and folders exist and are writable |
|
77 | + * |
|
78 | + */ |
|
79 | + public function verify_filesystem() |
|
80 | + { |
|
81 | + $msg = esc_html__( |
|
82 | + 'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.', |
|
83 | + 'event_espresso' |
|
84 | + ); |
|
85 | + EE_Error::doing_it_wrong( |
|
86 | + __METHOD__, |
|
87 | + $msg, |
|
88 | + '4.10.1.p' |
|
89 | + ); |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * _format_message |
|
95 | + * makes yer log entries look all purdy |
|
96 | + * |
|
97 | + * @param string $file |
|
98 | + * @param string $function |
|
99 | + * @param string $message |
|
100 | + * @param string $type |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + private function _format_message($file = '', $function = '', $message = '', $type = '') |
|
104 | + { |
|
105 | + $msg = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
106 | + $msg .= '[' . current_time('mysql') . '] '; |
|
107 | + $msg .= ! empty($file) ? basename($file) : ''; |
|
108 | + $msg .= ! empty($file) && ! empty($function) ? ' -> ' : ''; |
|
109 | + $msg .= ! empty($function) ? $function . '()' : ''; |
|
110 | + $msg .= PHP_EOL; |
|
111 | + $type = ! empty($type) ? $type : 'log message'; |
|
112 | + $msg .= ! empty($message) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : ''; |
|
113 | + return $msg; |
|
114 | + } |
|
115 | + |
|
116 | + |
|
117 | + /** |
|
118 | + * log |
|
119 | + * adds content to the EE_Log->_log property which gets written to file during the WP 'shutdown' hookpoint via the |
|
120 | + * EE_Log::write_log() callback |
|
121 | + * |
|
122 | + * @param string $file |
|
123 | + * @param string $function |
|
124 | + * @param string $message |
|
125 | + * @param string $type |
|
126 | + */ |
|
127 | + public function log($file = '', $function = '', $message = '', $type = '') |
|
128 | + { |
|
129 | + $this->_log .= $this->_format_message($file, $function, $message, $type); |
|
130 | + } |
|
131 | + |
|
132 | + |
|
133 | + /** |
|
134 | + * write_log |
|
135 | + * appends the results of the 'AHEE_log' filter to the espresso log file |
|
136 | + */ |
|
137 | + public function write_log() |
|
138 | + { |
|
139 | + $msg = esc_html__( |
|
140 | + 'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.', |
|
141 | + 'event_espresso' |
|
142 | + ); |
|
143 | + EE_Error::doing_it_wrong( |
|
144 | + __METHOD__, |
|
145 | + $msg, |
|
146 | + '4.10.1.p' |
|
147 | + ); |
|
148 | + } |
|
149 | + |
|
150 | + |
|
151 | + /** |
|
152 | + * send_log |
|
153 | + * sends the espresso log to a remote URL via a PHP cURL request |
|
154 | + */ |
|
155 | + public function send_log() |
|
156 | + { |
|
157 | + |
|
158 | + if (empty($this->_remote_logging_url)) { |
|
159 | + return; |
|
160 | + } |
|
161 | + |
|
162 | + $data = 'domain=' . $_SERVER['HTTP_HOST']; |
|
163 | + $data .= '&ip=' . $_SERVER['SERVER_ADDR']; |
|
164 | + $data .= '&server_type=' . $_SERVER['SERVER_SOFTWARE']; |
|
165 | + $data .= '&time=' . time(); |
|
166 | + $data .= '&remote_log=' . $this->_log; |
|
167 | + $data .= '&request_array=' . json_encode($_REQUEST); |
|
168 | + $data .= '&action=save'; |
|
169 | + |
|
170 | + if (defined('EELOGGING_PASS')) { |
|
171 | + $data .= '&pass=' . EELOGGING_PASS; |
|
172 | + } |
|
173 | + if (defined('EELOGGING_KEY')) { |
|
174 | + $data .= '&key=' . EELOGGING_KEY; |
|
175 | + } |
|
176 | + |
|
177 | + $c = curl_init($this->_remote_logging_url); |
|
178 | + curl_setopt($c, CURLOPT_POST, true); |
|
179 | + curl_setopt($c, CURLOPT_POSTFIELDS, $data); |
|
180 | + curl_setopt($c, CURLOPT_RETURNTRANSFER, true); |
|
181 | + curl_exec($c); |
|
182 | + curl_close($c); |
|
183 | + } |
|
184 | + |
|
185 | + |
|
186 | + /** |
|
187 | + * write_debug |
|
188 | + * writes the contents of the current request's $_GET and $_POST arrays to a log file. |
|
189 | + * previous entries are overwritten |
|
190 | + */ |
|
191 | + public function write_debug() |
|
192 | + { |
|
193 | + $msg = esc_html__( |
|
194 | + 'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.', |
|
195 | + 'event_espresso' |
|
196 | + ); |
|
197 | + EE_Error::doing_it_wrong( |
|
198 | + __METHOD__, |
|
199 | + $msg, |
|
200 | + '4.10.1.p' |
|
201 | + ); |
|
202 | + } |
|
203 | + |
|
204 | + |
|
205 | + /** |
|
206 | + * __clone |
|
207 | + */ |
|
208 | + public function __clone() |
|
209 | + { |
|
210 | + trigger_error(__('Clone is not allowed.', 'event_espresso'), E_USER_ERROR); |
|
211 | + } |
|
212 | 212 | } |
@@ -15,81 +15,81 @@ |
||
15 | 15 | class Admin_Options_Help_Tour extends EE_Help_Tour |
16 | 16 | { |
17 | 17 | |
18 | - protected function _set_tour_properties() |
|
19 | - { |
|
20 | - $this->_label = __('Admin Options Tour', 'event_espresso'); |
|
21 | - $this->_slug = 'admin-options-joyride'; |
|
22 | - } |
|
18 | + protected function _set_tour_properties() |
|
19 | + { |
|
20 | + $this->_label = __('Admin Options Tour', 'event_espresso'); |
|
21 | + $this->_slug = 'admin-options-joyride'; |
|
22 | + } |
|
23 | 23 | |
24 | - protected function _set_tour_stops() |
|
25 | - { |
|
26 | - $this->_stops = array( |
|
27 | - 10 => array( |
|
28 | - 'content' => $this->_start(), |
|
29 | - ), |
|
30 | - 30 => array( |
|
31 | - 'id' => 'use_remote_logging', |
|
32 | - 'content' => $this->_use_remote_logging_stop(), |
|
33 | - 'options' => array( |
|
34 | - 'tipLocation' => 'right', |
|
35 | - 'tipAdjustmentY' => -50, |
|
36 | - 'tipAdjustmentX' => 15, |
|
37 | - ), |
|
38 | - ), |
|
39 | - 40 => array( |
|
40 | - 'id' => 'affiliate_info', |
|
41 | - 'content' => $this->_show_reg_footer_stop(), |
|
42 | - 'options' => array( |
|
43 | - 'tipLocation' => 'right', |
|
44 | - 'tipAdjustmentY' => -50, |
|
45 | - 'tipAdjustmentX' => 15, |
|
46 | - ), |
|
47 | - ), |
|
24 | + protected function _set_tour_stops() |
|
25 | + { |
|
26 | + $this->_stops = array( |
|
27 | + 10 => array( |
|
28 | + 'content' => $this->_start(), |
|
29 | + ), |
|
30 | + 30 => array( |
|
31 | + 'id' => 'use_remote_logging', |
|
32 | + 'content' => $this->_use_remote_logging_stop(), |
|
33 | + 'options' => array( |
|
34 | + 'tipLocation' => 'right', |
|
35 | + 'tipAdjustmentY' => -50, |
|
36 | + 'tipAdjustmentX' => 15, |
|
37 | + ), |
|
38 | + ), |
|
39 | + 40 => array( |
|
40 | + 'id' => 'affiliate_info', |
|
41 | + 'content' => $this->_show_reg_footer_stop(), |
|
42 | + 'options' => array( |
|
43 | + 'tipLocation' => 'right', |
|
44 | + 'tipAdjustmentY' => -50, |
|
45 | + 'tipAdjustmentX' => 15, |
|
46 | + ), |
|
47 | + ), |
|
48 | 48 | |
49 | - 60 => array( |
|
50 | - 'id' => 'help_tour_activation', |
|
51 | - 'content' => $this->_help_tour_activation_stop(), |
|
52 | - 'options' => array( |
|
53 | - 'tipLocation' => 'right', |
|
54 | - 'tipAdjustmentY' => -50, |
|
55 | - 'tipAdjustmentX' => 15, |
|
56 | - ), |
|
57 | - ), |
|
58 | - ); |
|
59 | - } |
|
49 | + 60 => array( |
|
50 | + 'id' => 'help_tour_activation', |
|
51 | + 'content' => $this->_help_tour_activation_stop(), |
|
52 | + 'options' => array( |
|
53 | + 'tipLocation' => 'right', |
|
54 | + 'tipAdjustmentY' => -50, |
|
55 | + 'tipAdjustmentX' => 15, |
|
56 | + ), |
|
57 | + ), |
|
58 | + ); |
|
59 | + } |
|
60 | 60 | |
61 | 61 | |
62 | - protected function _start() |
|
63 | - { |
|
64 | - $content = '<h3>' . __('Admin Options', 'event_espresso') . '</h3>'; |
|
65 | - $content .= '<p>' |
|
66 | - . __( |
|
67 | - 'This tour of the Admin Options page will go over different areas of the screen to help you understand what they are used for.', |
|
68 | - 'event_espresso' |
|
69 | - ) . '</p>'; |
|
70 | - return $content; |
|
71 | - } |
|
62 | + protected function _start() |
|
63 | + { |
|
64 | + $content = '<h3>' . __('Admin Options', 'event_espresso') . '</h3>'; |
|
65 | + $content .= '<p>' |
|
66 | + . __( |
|
67 | + 'This tour of the Admin Options page will go over different areas of the screen to help you understand what they are used for.', |
|
68 | + 'event_espresso' |
|
69 | + ) . '</p>'; |
|
70 | + return $content; |
|
71 | + } |
|
72 | 72 | |
73 | - protected function _use_remote_logging_stop() |
|
74 | - { |
|
75 | - return '<p>' |
|
76 | - . __( |
|
77 | - ' This option sends all Event Espresso debugging data and get / post variables to the specified URL below.', |
|
78 | - 'event_espresso' |
|
79 | - ) . '</p>'; |
|
80 | - } |
|
73 | + protected function _use_remote_logging_stop() |
|
74 | + { |
|
75 | + return '<p>' |
|
76 | + . __( |
|
77 | + ' This option sends all Event Espresso debugging data and get / post variables to the specified URL below.', |
|
78 | + 'event_espresso' |
|
79 | + ) . '</p>'; |
|
80 | + } |
|
81 | 81 | |
82 | - protected function _show_reg_footer_stop() |
|
83 | - { |
|
84 | - return '<p>' |
|
85 | - . __( |
|
86 | - 'Support us by adding a small link to Event Espresso in your event pages. You can even earn money for yourself by adding your affiliate link there!', |
|
87 | - 'event_espresso' |
|
88 | - ) . '</p>'; |
|
89 | - } |
|
82 | + protected function _show_reg_footer_stop() |
|
83 | + { |
|
84 | + return '<p>' |
|
85 | + . __( |
|
86 | + 'Support us by adding a small link to Event Espresso in your event pages. You can even earn money for yourself by adding your affiliate link there!', |
|
87 | + 'event_espresso' |
|
88 | + ) . '</p>'; |
|
89 | + } |
|
90 | 90 | |
91 | - protected function _help_tour_activation_stop() |
|
92 | - { |
|
93 | - return '<p>' . __('Turn these help tours on / off for Event Espresso pages.', 'event_espresso') . '</p>'; |
|
94 | - } |
|
91 | + protected function _help_tour_activation_stop() |
|
92 | + { |
|
93 | + return '<p>' . __('Turn these help tours on / off for Event Espresso pages.', 'event_espresso') . '</p>'; |
|
94 | + } |
|
95 | 95 | } |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | |
62 | 62 | protected function _start() |
63 | 63 | { |
64 | - $content = '<h3>' . __('Admin Options', 'event_espresso') . '</h3>'; |
|
64 | + $content = '<h3>'.__('Admin Options', 'event_espresso').'</h3>'; |
|
65 | 65 | $content .= '<p>' |
66 | 66 | . __( |
67 | 67 | 'This tour of the Admin Options page will go over different areas of the screen to help you understand what they are used for.', |
68 | 68 | 'event_espresso' |
69 | - ) . '</p>'; |
|
69 | + ).'</p>'; |
|
70 | 70 | return $content; |
71 | 71 | } |
72 | 72 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | . __( |
77 | 77 | ' This option sends all Event Espresso debugging data and get / post variables to the specified URL below.', |
78 | 78 | 'event_espresso' |
79 | - ) . '</p>'; |
|
79 | + ).'</p>'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | protected function _show_reg_footer_stop() |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | . __( |
86 | 86 | 'Support us by adding a small link to Event Espresso in your event pages. You can even earn money for yourself by adding your affiliate link there!', |
87 | 87 | 'event_espresso' |
88 | - ) . '</p>'; |
|
88 | + ).'</p>'; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | protected function _help_tour_activation_stop() |
92 | 92 | { |
93 | - return '<p>' . __('Turn these help tours on / off for Event Espresso pages.', 'event_espresso') . '</p>'; |
|
93 | + return '<p>'.__('Turn these help tours on / off for Event Espresso pages.', 'event_espresso').'</p>'; |
|
94 | 94 | } |
95 | 95 | } |
@@ -32,12 +32,12 @@ |
||
32 | 32 | <li> |
33 | 33 | <strong><?php esc_html_e('Event Espresso Affiliate ID', 'event_espresso'); ?></strong><br /> |
34 | 34 | <?php printf( |
35 | - esc_html__( |
|
36 | - 'You can also monetize this link by signing up to our %1$saffiliate program%2$s and adding in your affiliate ID here.', |
|
37 | - 'event_espresso' |
|
38 | - ), |
|
39 | - '<a href="https://eventespresso.com/affiliates/">', |
|
40 | - '</a>' |
|
35 | + esc_html__( |
|
36 | + 'You can also monetize this link by signing up to our %1$saffiliate program%2$s and adding in your affiliate ID here.', |
|
37 | + 'event_espresso' |
|
38 | + ), |
|
39 | + '<a href="https://eventespresso.com/affiliates/">', |
|
40 | + '</a>' |
|
41 | 41 | ); ?> |
42 | 42 | </li> |
43 | 43 | </ul> |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | $stages = glob(EE_CORE . 'data_migration_scripts/4_8_0_stages/*'); |
18 | 18 | $class_to_filepath = array(); |
19 | 19 | foreach ($stages as $filepath) { |
20 | - $matches = array(); |
|
21 | - preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
22 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
20 | + $matches = array(); |
|
21 | + preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
22 | + $class_to_filepath[ $matches[1] ] = $filepath; |
|
23 | 23 | } |
24 | 24 | // give addons a chance to autoload their stages too |
25 | 25 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath); |
@@ -38,71 +38,71 @@ discard block |
||
38 | 38 | class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base |
39 | 39 | { |
40 | 40 | |
41 | - /** |
|
42 | - * return EE_DMS_Core_4_8_0 |
|
43 | - * |
|
44 | - * @param TableManager $table_manager |
|
45 | - * @param TableAnalysis $table_analysis |
|
46 | - */ |
|
47 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
48 | - { |
|
49 | - $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.8.0", "event_espresso"); |
|
50 | - $this->_priority = 10; |
|
51 | - $this->_migration_stages = array( |
|
52 | - new EE_DMS_4_8_0_pretax_totals(), |
|
53 | - new EE_DMS_4_8_0_event_subtotals(), |
|
54 | - ); |
|
55 | - parent::__construct($table_manager, $table_analysis); |
|
56 | - } |
|
41 | + /** |
|
42 | + * return EE_DMS_Core_4_8_0 |
|
43 | + * |
|
44 | + * @param TableManager $table_manager |
|
45 | + * @param TableAnalysis $table_analysis |
|
46 | + */ |
|
47 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
48 | + { |
|
49 | + $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.8.0", "event_espresso"); |
|
50 | + $this->_priority = 10; |
|
51 | + $this->_migration_stages = array( |
|
52 | + new EE_DMS_4_8_0_pretax_totals(), |
|
53 | + new EE_DMS_4_8_0_event_subtotals(), |
|
54 | + ); |
|
55 | + parent::__construct($table_manager, $table_analysis); |
|
56 | + } |
|
57 | 57 | |
58 | 58 | |
59 | 59 | |
60 | - /** |
|
61 | - * Because this is being done at basically the same time as the MER-ready branch |
|
62 | - * of core, it's possible people might have installed MEr-ready branch first, |
|
63 | - * and then this one, in which case we still want to perform this migration, |
|
64 | - * even though the version might not have increased |
|
65 | - * |
|
66 | - * @param array $version_array |
|
67 | - * @return bool |
|
68 | - */ |
|
69 | - public function can_migrate_from_version($version_array) |
|
70 | - { |
|
71 | - $version_string = $version_array['Core']; |
|
72 | - if (version_compare($version_string, '4.8.0.decaf', '<') && version_compare($version_string, '4.7.0.decaf', '>=')) { |
|
60 | + /** |
|
61 | + * Because this is being done at basically the same time as the MER-ready branch |
|
62 | + * of core, it's possible people might have installed MEr-ready branch first, |
|
63 | + * and then this one, in which case we still want to perform this migration, |
|
64 | + * even though the version might not have increased |
|
65 | + * |
|
66 | + * @param array $version_array |
|
67 | + * @return bool |
|
68 | + */ |
|
69 | + public function can_migrate_from_version($version_array) |
|
70 | + { |
|
71 | + $version_string = $version_array['Core']; |
|
72 | + if (version_compare($version_string, '4.8.0.decaf', '<') && version_compare($version_string, '4.7.0.decaf', '>=')) { |
|
73 | 73 | // echo "$version_string can be migrated from"; |
74 | - return true; |
|
75 | - } elseif (! $version_string) { |
|
74 | + return true; |
|
75 | + } elseif (! $version_string) { |
|
76 | 76 | // echo "no version string provided: $version_string"; |
77 | - // no version string provided... this must be pre 4.3 |
|
78 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
79 | - } else { |
|
77 | + // no version string provided... this must be pre 4.3 |
|
78 | + return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
79 | + } else { |
|
80 | 80 | // echo "$version_string doesnt apply"; |
81 | - return false; |
|
82 | - } |
|
83 | - } |
|
81 | + return false; |
|
82 | + } |
|
83 | + } |
|
84 | 84 | |
85 | 85 | |
86 | 86 | |
87 | - /** |
|
88 | - * @return bool |
|
89 | - */ |
|
90 | - public function schema_changes_before_migration() |
|
91 | - { |
|
92 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
93 | - $now_in_mysql = current_time('mysql', true); |
|
94 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
95 | - $table_name = 'esp_answer'; |
|
96 | - $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
87 | + /** |
|
88 | + * @return bool |
|
89 | + */ |
|
90 | + public function schema_changes_before_migration() |
|
91 | + { |
|
92 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
93 | + $now_in_mysql = current_time('mysql', true); |
|
94 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
95 | + $table_name = 'esp_answer'; |
|
96 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
97 | 97 | REG_ID int(10) unsigned NOT NULL, |
98 | 98 | QST_ID int(10) unsigned NOT NULL, |
99 | 99 | ANS_value text NOT NULL, |
100 | 100 | PRIMARY KEY (ANS_ID), |
101 | 101 | KEY REG_ID (REG_ID), |
102 | 102 | KEY QST_ID (QST_ID)"; |
103 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
104 | - $table_name = 'esp_attendee_meta'; |
|
105 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
103 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
104 | + $table_name = 'esp_attendee_meta'; |
|
105 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
106 | 106 | ATT_ID bigint(20) unsigned NOT NULL, |
107 | 107 | ATT_fname varchar(45) NOT NULL, |
108 | 108 | ATT_lname varchar(45) NOT NULL, |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | PRIMARY KEY (ATTM_ID), |
118 | 118 | KEY ATT_ID (ATT_ID), |
119 | 119 | KEY ATT_email (ATT_email(191))"; |
120 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
121 | - $table_name = 'esp_country'; |
|
122 | - $sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
|
120 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
121 | + $table_name = 'esp_country'; |
|
122 | + $sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
|
123 | 123 | CNT_ISO3 varchar(3) collate utf8_bin NOT NULL, |
124 | 124 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
125 | 125 | CNT_name varchar(45) collate utf8_bin NOT NULL, |
@@ -135,25 +135,25 @@ discard block |
||
135 | 135 | CNT_is_EU tinyint(1) DEFAULT '0', |
136 | 136 | CNT_active tinyint(1) DEFAULT '0', |
137 | 137 | PRIMARY KEY (CNT_ISO)"; |
138 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
139 | - $table_name = 'esp_currency'; |
|
140 | - $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
|
138 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
139 | + $table_name = 'esp_currency'; |
|
140 | + $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
|
141 | 141 | CUR_single varchar(45) collate utf8_bin DEFAULT 'dollar', |
142 | 142 | CUR_plural varchar(45) collate utf8_bin DEFAULT 'dollars', |
143 | 143 | CUR_sign varchar(45) collate utf8_bin DEFAULT '$', |
144 | 144 | CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2', |
145 | 145 | CUR_active tinyint(1) DEFAULT '0', |
146 | 146 | PRIMARY KEY (CUR_code)"; |
147 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
148 | - $table_name = 'esp_currency_payment_method'; |
|
149 | - $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
147 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
148 | + $table_name = 'esp_currency_payment_method'; |
|
149 | + $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
150 | 150 | CUR_code varchar(6) collate utf8_bin NOT NULL, |
151 | 151 | PMD_ID int(11) NOT NULL, |
152 | 152 | PRIMARY KEY (CPM_ID), |
153 | 153 | KEY PMD_ID (PMD_ID)"; |
154 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
155 | - $table_name = 'esp_datetime'; |
|
156 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
154 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
155 | + $table_name = 'esp_datetime'; |
|
156 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
157 | 157 | EVT_ID bigint(20) unsigned NOT NULL, |
158 | 158 | DTT_name varchar(255) NOT NULL DEFAULT '', |
159 | 159 | DTT_description text NOT NULL, |
@@ -169,9 +169,9 @@ discard block |
||
169 | 169 | KEY DTT_EVT_start (DTT_EVT_start), |
170 | 170 | KEY EVT_ID (EVT_ID), |
171 | 171 | KEY DTT_is_primary (DTT_is_primary)"; |
172 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
173 | - $table_name = 'esp_event_meta'; |
|
174 | - $sql = " |
|
172 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
173 | + $table_name = 'esp_event_meta'; |
|
174 | + $sql = " |
|
175 | 175 | EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
176 | 176 | EVT_ID bigint(20) unsigned NOT NULL, |
177 | 177 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -187,34 +187,34 @@ discard block |
||
187 | 187 | EVT_donations tinyint(1) NULL, |
188 | 188 | PRIMARY KEY (EVTM_ID), |
189 | 189 | KEY EVT_ID (EVT_ID)"; |
190 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
191 | - $table_name = 'esp_event_question_group'; |
|
192 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
190 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
191 | + $table_name = 'esp_event_question_group'; |
|
192 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
193 | 193 | EVT_ID bigint(20) unsigned NOT NULL, |
194 | 194 | QSG_ID int(10) unsigned NOT NULL, |
195 | 195 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
196 | 196 | PRIMARY KEY (EQG_ID), |
197 | 197 | KEY EVT_ID (EVT_ID), |
198 | 198 | KEY QSG_ID (QSG_ID)"; |
199 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
200 | - $table_name = 'esp_event_venue'; |
|
201 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
199 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
200 | + $table_name = 'esp_event_venue'; |
|
201 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
202 | 202 | EVT_ID bigint(20) unsigned NOT NULL, |
203 | 203 | VNU_ID bigint(20) unsigned NOT NULL, |
204 | 204 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
205 | 205 | PRIMARY KEY (EVV_ID)"; |
206 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
207 | - $table_name = 'esp_extra_meta'; |
|
208 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
206 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
207 | + $table_name = 'esp_extra_meta'; |
|
208 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
209 | 209 | OBJ_ID int(11) DEFAULT NULL, |
210 | 210 | EXM_type varchar(45) DEFAULT NULL, |
211 | 211 | EXM_key varchar(45) DEFAULT NULL, |
212 | 212 | EXM_value text, |
213 | 213 | PRIMARY KEY (EXM_ID), |
214 | 214 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
215 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
216 | - $table_name = 'esp_extra_join'; |
|
217 | - $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
215 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
216 | + $table_name = 'esp_extra_join'; |
|
217 | + $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
|
218 | 218 | EXJ_first_model_id varchar(6) NOT NULL, |
219 | 219 | EXJ_first_model_name varchar(20) NOT NULL, |
220 | 220 | EXJ_second_model_id varchar(6) NOT NULL, |
@@ -222,9 +222,9 @@ discard block |
||
222 | 222 | PRIMARY KEY (EXJ_ID), |
223 | 223 | KEY first_model (EXJ_first_model_name,EXJ_first_model_id), |
224 | 224 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
225 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
226 | - $table_name = 'esp_line_item'; |
|
227 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
225 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
226 | + $table_name = 'esp_line_item'; |
|
227 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
228 | 228 | LIN_code varchar(245) NOT NULL DEFAULT '', |
229 | 229 | TXN_ID int(11) DEFAULT NULL, |
230 | 230 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -243,9 +243,9 @@ discard block |
||
243 | 243 | PRIMARY KEY (LIN_ID), |
244 | 244 | KEY LIN_code (LIN_code(191)), |
245 | 245 | KEY TXN_ID (TXN_ID)"; |
246 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
247 | - $table_name = 'esp_log'; |
|
248 | - $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
246 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
247 | + $table_name = 'esp_log'; |
|
248 | + $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
249 | 249 | LOG_time datetime DEFAULT NULL, |
250 | 250 | OBJ_ID varchar(45) DEFAULT NULL, |
251 | 251 | OBJ_type varchar(45) DEFAULT NULL, |
@@ -256,18 +256,18 @@ discard block |
||
256 | 256 | KEY LOG_time (LOG_time), |
257 | 257 | KEY OBJ (OBJ_type,OBJ_ID), |
258 | 258 | KEY LOG_type (LOG_type)"; |
259 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
260 | - $table_name = 'esp_message_template'; |
|
261 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
259 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
260 | + $table_name = 'esp_message_template'; |
|
261 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
262 | 262 | GRP_ID int(10) unsigned NOT NULL, |
263 | 263 | MTP_context varchar(50) NOT NULL, |
264 | 264 | MTP_template_field varchar(30) NOT NULL, |
265 | 265 | MTP_content text NOT NULL, |
266 | 266 | PRIMARY KEY (MTP_ID), |
267 | 267 | KEY GRP_ID (GRP_ID)"; |
268 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
269 | - $table_name = 'esp_message_template_group'; |
|
270 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
268 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
269 | + $table_name = 'esp_message_template_group'; |
|
270 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
271 | 271 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
272 | 272 | MTP_name varchar(245) NOT NULL DEFAULT '', |
273 | 273 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -279,17 +279,17 @@ discard block |
||
279 | 279 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
280 | 280 | PRIMARY KEY (GRP_ID), |
281 | 281 | KEY MTP_user_id (MTP_user_id)"; |
282 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
283 | - $table_name = 'esp_event_message_template'; |
|
284 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
282 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
283 | + $table_name = 'esp_event_message_template'; |
|
284 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
285 | 285 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
286 | 286 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
287 | 287 | PRIMARY KEY (EMT_ID), |
288 | 288 | KEY EVT_ID (EVT_ID), |
289 | 289 | KEY GRP_ID (GRP_ID)"; |
290 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
291 | - $table_name = 'esp_payment'; |
|
292 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
290 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
291 | + $table_name = 'esp_payment'; |
|
292 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
293 | 293 | TXN_ID int(10) unsigned DEFAULT NULL, |
294 | 294 | STS_ID varchar(3) collate utf8_bin DEFAULT NULL, |
295 | 295 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -306,9 +306,9 @@ discard block |
||
306 | 306 | PRIMARY KEY (PAY_ID), |
307 | 307 | KEY PAY_timestamp (PAY_timestamp), |
308 | 308 | KEY TXN_ID (TXN_ID)"; |
309 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
310 | - $table_name = 'esp_payment_method'; |
|
311 | - $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
309 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
310 | + $table_name = 'esp_payment_method'; |
|
311 | + $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
312 | 312 | PMD_type varchar(124) DEFAULT NULL, |
313 | 313 | PMD_name varchar(255) DEFAULT NULL, |
314 | 314 | PMD_desc text, |
@@ -324,32 +324,32 @@ discard block |
||
324 | 324 | PRIMARY KEY (PMD_ID), |
325 | 325 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug), |
326 | 326 | KEY PMD_type (PMD_type)"; |
327 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
328 | - $table_name = "esp_ticket_price"; |
|
329 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
327 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
328 | + $table_name = "esp_ticket_price"; |
|
329 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
330 | 330 | TKT_ID int(10) unsigned NOT NULL, |
331 | 331 | PRC_ID int(10) unsigned NOT NULL, |
332 | 332 | PRIMARY KEY (TKP_ID), |
333 | 333 | KEY TKT_ID (TKT_ID), |
334 | 334 | KEY PRC_ID (PRC_ID)"; |
335 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
336 | - $table_name = "esp_datetime_ticket"; |
|
337 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
335 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
336 | + $table_name = "esp_datetime_ticket"; |
|
337 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
338 | 338 | DTT_ID int(10) unsigned NOT NULL, |
339 | 339 | TKT_ID int(10) unsigned NOT NULL, |
340 | 340 | PRIMARY KEY (DTK_ID), |
341 | 341 | KEY DTT_ID (DTT_ID), |
342 | 342 | KEY TKT_ID (TKT_ID)"; |
343 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
344 | - $table_name = "esp_ticket_template"; |
|
345 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
343 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
344 | + $table_name = "esp_ticket_template"; |
|
345 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
346 | 346 | TTM_name varchar(45) NOT NULL, |
347 | 347 | TTM_description text, |
348 | 348 | TTM_file varchar(45), |
349 | 349 | PRIMARY KEY (TTM_ID)"; |
350 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
351 | - $table_name = 'esp_question'; |
|
352 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
350 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
351 | + $table_name = 'esp_question'; |
|
352 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
353 | 353 | QST_display_text text NOT NULL, |
354 | 354 | QST_admin_label varchar(255) NOT NULL, |
355 | 355 | QST_system varchar(25) NOT NULL DEFAULT "", |
@@ -363,18 +363,18 @@ discard block |
||
363 | 363 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
364 | 364 | PRIMARY KEY (QST_ID), |
365 | 365 | KEY QST_order (QST_order)'; |
366 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
367 | - $table_name = 'esp_question_group_question'; |
|
368 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
366 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
367 | + $table_name = 'esp_question_group_question'; |
|
368 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
369 | 369 | QSG_ID int(10) unsigned NOT NULL, |
370 | 370 | QST_ID int(10) unsigned NOT NULL, |
371 | 371 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
372 | 372 | PRIMARY KEY (QGQ_ID), |
373 | 373 | KEY QST_ID (QST_ID), |
374 | 374 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
375 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
376 | - $table_name = 'esp_question_option'; |
|
377 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
375 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
376 | + $table_name = 'esp_question_option'; |
|
377 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
378 | 378 | QSO_value varchar(255) NOT NULL, |
379 | 379 | QSO_desc text NOT NULL, |
380 | 380 | QST_ID int(10) unsigned NOT NULL, |
@@ -384,9 +384,9 @@ discard block |
||
384 | 384 | PRIMARY KEY (QSO_ID), |
385 | 385 | KEY QST_ID (QST_ID), |
386 | 386 | KEY QSO_order (QSO_order)"; |
387 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
388 | - $table_name = 'esp_registration'; |
|
389 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
387 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
388 | + $table_name = 'esp_registration'; |
|
389 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
390 | 390 | EVT_ID bigint(20) unsigned NOT NULL, |
391 | 391 | ATT_ID bigint(20) unsigned NOT NULL, |
392 | 392 | TXN_ID int(10) unsigned NOT NULL, |
@@ -410,18 +410,18 @@ discard block |
||
410 | 410 | KEY TKT_ID (TKT_ID), |
411 | 411 | KEY EVT_ID (EVT_ID), |
412 | 412 | KEY STS_ID (STS_ID)"; |
413 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
414 | - $table_name = 'esp_registration_payment'; |
|
415 | - $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
413 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
414 | + $table_name = 'esp_registration_payment'; |
|
415 | + $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
416 | 416 | REG_ID int(10) unsigned NOT NULL, |
417 | 417 | PAY_ID int(10) unsigned NULL, |
418 | 418 | RPY_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
419 | 419 | PRIMARY KEY (RPY_ID), |
420 | 420 | KEY REG_ID (REG_ID), |
421 | 421 | KEY PAY_ID (PAY_ID)"; |
422 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
423 | - $table_name = 'esp_checkin'; |
|
424 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
422 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
423 | + $table_name = 'esp_checkin'; |
|
424 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
425 | 425 | REG_ID int(10) unsigned NOT NULL, |
426 | 426 | DTT_ID int(10) unsigned NOT NULL, |
427 | 427 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -429,9 +429,9 @@ discard block |
||
429 | 429 | PRIMARY KEY (CHK_ID), |
430 | 430 | KEY REG_ID (REG_ID), |
431 | 431 | KEY DTT_ID (DTT_ID)"; |
432 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
433 | - $table_name = 'esp_state'; |
|
434 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
432 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
433 | + $table_name = 'esp_state'; |
|
434 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
435 | 435 | CNT_ISO varchar(2) collate utf8_bin NOT NULL, |
436 | 436 | STA_abbrev varchar(24) collate utf8_bin NOT NULL, |
437 | 437 | STA_name varchar(100) collate utf8_bin NOT NULL, |
@@ -439,9 +439,9 @@ discard block |
||
439 | 439 | PRIMARY KEY (STA_ID), |
440 | 440 | KEY STA_abbrev (STA_abbrev), |
441 | 441 | KEY CNT_ISO (CNT_ISO)"; |
442 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
443 | - $table_name = 'esp_status'; |
|
444 | - $sql = "STS_ID varchar(3) NOT NULL, |
|
442 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
443 | + $table_name = 'esp_status'; |
|
444 | + $sql = "STS_ID varchar(3) NOT NULL, |
|
445 | 445 | STS_code varchar(45) NOT NULL, |
446 | 446 | STS_type varchar(45) NOT NULL, |
447 | 447 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
450 | 450 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
451 | 451 | KEY STS_type (STS_type)"; |
452 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
453 | - $table_name = 'esp_transaction'; |
|
454 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
452 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
453 | + $table_name = 'esp_transaction'; |
|
454 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
455 | 455 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
456 | 456 | TXN_total decimal(10,3) DEFAULT '0.00', |
457 | 457 | TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00', |
@@ -463,9 +463,9 @@ discard block |
||
463 | 463 | PRIMARY KEY (TXN_ID), |
464 | 464 | KEY TXN_timestamp (TXN_timestamp), |
465 | 465 | KEY STS_ID (STS_ID)"; |
466 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
467 | - $table_name = 'esp_venue_meta'; |
|
468 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
466 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
467 | + $table_name = 'esp_venue_meta'; |
|
468 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
469 | 469 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
470 | 470 | VNU_address varchar(255) DEFAULT NULL, |
471 | 471 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -484,10 +484,10 @@ discard block |
||
484 | 484 | KEY VNU_ID (VNU_ID), |
485 | 485 | KEY STA_ID (STA_ID), |
486 | 486 | KEY CNT_ISO (CNT_ISO)"; |
487 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
488 | - // modified tables |
|
489 | - $table_name = "esp_price"; |
|
490 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
487 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
488 | + // modified tables |
|
489 | + $table_name = "esp_price"; |
|
490 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
491 | 491 | PRT_ID tinyint(3) unsigned NOT NULL, |
492 | 492 | PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
493 | 493 | PRC_name varchar(245) NOT NULL, |
@@ -500,9 +500,9 @@ discard block |
||
500 | 500 | PRC_parent int(10) unsigned DEFAULT 0, |
501 | 501 | PRIMARY KEY (PRC_ID), |
502 | 502 | KEY PRT_ID (PRT_ID)"; |
503 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
504 | - $table_name = "esp_price_type"; |
|
505 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
503 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
504 | + $table_name = "esp_price_type"; |
|
505 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
506 | 506 | PRT_name varchar(45) NOT NULL, |
507 | 507 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
508 | 508 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -511,9 +511,9 @@ discard block |
||
511 | 511 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
512 | 512 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
513 | 513 | PRIMARY KEY (PRT_ID)"; |
514 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
515 | - $table_name = "esp_ticket"; |
|
516 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
514 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
515 | + $table_name = "esp_ticket"; |
|
516 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
517 | 517 | TTM_ID int(10) unsigned NOT NULL, |
518 | 518 | TKT_name varchar(245) NOT NULL DEFAULT '', |
519 | 519 | TKT_description text NOT NULL, |
@@ -535,9 +535,9 @@ discard block |
||
535 | 535 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
536 | 536 | PRIMARY KEY (TKT_ID), |
537 | 537 | KEY TKT_start_date (TKT_start_date)"; |
538 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
539 | - $table_name = 'esp_question_group'; |
|
540 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
538 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
539 | + $table_name = 'esp_question_group'; |
|
540 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
541 | 541 | QSG_name varchar(255) NOT NULL, |
542 | 542 | QSG_identifier varchar(100) NOT NULL, |
543 | 543 | QSG_desc text NULL, |
@@ -550,223 +550,223 @@ discard block |
||
550 | 550 | PRIMARY KEY (QSG_ID), |
551 | 551 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
552 | 552 | KEY QSG_order (QSG_order)'; |
553 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
554 | - /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
555 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
556 | - // (because many need to convert old string states to foreign keys into the states table) |
|
557 | - $script_4_1_defaults->insert_default_states(); |
|
558 | - $script_4_1_defaults->insert_default_countries(); |
|
559 | - /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
560 | - $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
561 | - $script_4_5_defaults->insert_default_price_types(); |
|
562 | - $script_4_5_defaults->insert_default_prices(); |
|
563 | - $script_4_5_defaults->insert_default_tickets(); |
|
564 | - /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
565 | - $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
566 | - $script_4_6_defaults->add_default_admin_only_payments(); |
|
567 | - $script_4_6_defaults->insert_default_currencies(); |
|
568 | - $this->verify_new_countries(); |
|
569 | - $this->verify_new_currencies(); |
|
570 | - return true; |
|
571 | - } |
|
553 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
554 | + /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
555 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
556 | + // (because many need to convert old string states to foreign keys into the states table) |
|
557 | + $script_4_1_defaults->insert_default_states(); |
|
558 | + $script_4_1_defaults->insert_default_countries(); |
|
559 | + /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
560 | + $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
561 | + $script_4_5_defaults->insert_default_price_types(); |
|
562 | + $script_4_5_defaults->insert_default_prices(); |
|
563 | + $script_4_5_defaults->insert_default_tickets(); |
|
564 | + /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
565 | + $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
566 | + $script_4_6_defaults->add_default_admin_only_payments(); |
|
567 | + $script_4_6_defaults->insert_default_currencies(); |
|
568 | + $this->verify_new_countries(); |
|
569 | + $this->verify_new_currencies(); |
|
570 | + return true; |
|
571 | + } |
|
572 | 572 | |
573 | 573 | |
574 | 574 | |
575 | - /** |
|
576 | - * @return boolean |
|
577 | - */ |
|
578 | - public function schema_changes_after_migration() |
|
579 | - { |
|
580 | - $this->fix_non_default_taxes(); |
|
581 | - // this is actually the same as the last DMS |
|
582 | - /** @var EE_DMS_Core_4_7_0 $script_4_7_defaults */ |
|
583 | - $script_4_7_defaults = EE_Registry::instance()->load_dms('Core_4_7_0'); |
|
584 | - return $script_4_7_defaults->schema_changes_after_migration(); |
|
585 | - } |
|
575 | + /** |
|
576 | + * @return boolean |
|
577 | + */ |
|
578 | + public function schema_changes_after_migration() |
|
579 | + { |
|
580 | + $this->fix_non_default_taxes(); |
|
581 | + // this is actually the same as the last DMS |
|
582 | + /** @var EE_DMS_Core_4_7_0 $script_4_7_defaults */ |
|
583 | + $script_4_7_defaults = EE_Registry::instance()->load_dms('Core_4_7_0'); |
|
584 | + return $script_4_7_defaults->schema_changes_after_migration(); |
|
585 | + } |
|
586 | 586 | |
587 | 587 | |
588 | 588 | |
589 | - public function migration_page_hooks() |
|
590 | - { |
|
591 | - } |
|
589 | + public function migration_page_hooks() |
|
590 | + { |
|
591 | + } |
|
592 | 592 | |
593 | 593 | |
594 | 594 | |
595 | - /** |
|
596 | - * verifies each of the new countries exists that somehow we missed in 4.1 |
|
597 | - */ |
|
598 | - public function verify_new_countries() |
|
599 | - { |
|
600 | - // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
601 | - // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
602 | - // currency symbols: http://www.xe.com/symbols.php |
|
603 | - // CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active |
|
604 | - // ('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
|
605 | - $newer_countries = array( |
|
606 | - array('AX', 'ALA', 0, 'Åland Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
607 | - array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
608 | - array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
609 | - array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
610 | - array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
611 | - array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
612 | - array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
613 | - array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
614 | - array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0), |
|
615 | - array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
616 | - array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
617 | - array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0), |
|
618 | - array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
619 | - array( |
|
620 | - 'BQ', |
|
621 | - 'BES', |
|
622 | - 0, |
|
623 | - 'Bonaire, Saint Eustatius and Saba', |
|
624 | - 'USD', |
|
625 | - 'Dollar', |
|
626 | - 'Dollars', |
|
627 | - '$', |
|
628 | - 1, |
|
629 | - 2, |
|
630 | - '+599', |
|
631 | - 0, |
|
632 | - 0, |
|
633 | - ), |
|
634 | - array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0), |
|
635 | - array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0), |
|
636 | - array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0), |
|
637 | - array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0), |
|
638 | - array( |
|
639 | - 'HM', |
|
640 | - 'HMD', |
|
641 | - 0, |
|
642 | - 'Heard Island and McDonald Islands', |
|
643 | - 'AUD', |
|
644 | - 'Dollar', |
|
645 | - 'Dollars', |
|
646 | - '$', |
|
647 | - 1, |
|
648 | - 2, |
|
649 | - '+891', |
|
650 | - 0, |
|
651 | - 0, |
|
652 | - ), |
|
653 | - array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0), |
|
654 | - array( |
|
655 | - 'GS', |
|
656 | - 'SGS', |
|
657 | - 0, |
|
658 | - 'South Georgia and the South Sandwich Islands', |
|
659 | - 'GBP', |
|
660 | - 'Pound', |
|
661 | - 'Pounds', |
|
662 | - '£', |
|
663 | - 1, |
|
664 | - 2, |
|
665 | - '+500', |
|
666 | - 0, |
|
667 | - 0, |
|
668 | - ), |
|
669 | - array('TL', 'TLS', 0, 'Timor-Leste', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+670', 0, 0), |
|
670 | - array('TF', 'ATF', 0, 'French Southern Territories', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+262', 0, 0), |
|
671 | - array( |
|
672 | - 'UM', |
|
673 | - 'UMI', |
|
674 | - 0, |
|
675 | - 'United States Minor Outlying Islands', |
|
676 | - 'USD', |
|
677 | - 'Dollar', |
|
678 | - 'Dollars', |
|
679 | - '$', |
|
680 | - 1, |
|
681 | - 2, |
|
682 | - '+1', |
|
683 | - 0, |
|
684 | - 0, |
|
685 | - ), |
|
686 | - ); |
|
687 | - global $wpdb; |
|
688 | - $country_table = $wpdb->prefix . "esp_country"; |
|
689 | - $country_format = array( |
|
690 | - "CNT_ISO" => '%s', |
|
691 | - "CNT_ISO3" => '%s', |
|
692 | - "RGN_ID" => '%d', |
|
693 | - "CNT_name" => '%s', |
|
694 | - "CNT_cur_code" => '%s', |
|
695 | - "CNT_cur_single" => '%s', |
|
696 | - "CNT_cur_plural" => '%s', |
|
697 | - "CNT_cur_sign" => '%s', |
|
698 | - "CNT_cur_sign_b4" => '%d', |
|
699 | - "CNT_cur_dec_plc" => '%d', |
|
700 | - "CNT_tel_code" => '%s', |
|
701 | - "CNT_is_EU" => '%d', |
|
702 | - "CNT_active" => '%d', |
|
703 | - ); |
|
704 | - if ($this->_get_table_analysis()->tableExists($country_table)) { |
|
705 | - foreach ($newer_countries as $country) { |
|
706 | - $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
707 | - $countries = $wpdb->get_var($SQL); |
|
708 | - if (! $countries) { |
|
709 | - $wpdb->insert( |
|
710 | - $country_table, |
|
711 | - array_combine(array_keys($country_format), $country), |
|
712 | - $country_format |
|
713 | - ); |
|
714 | - } |
|
715 | - } |
|
716 | - } |
|
717 | - } |
|
595 | + /** |
|
596 | + * verifies each of the new countries exists that somehow we missed in 4.1 |
|
597 | + */ |
|
598 | + public function verify_new_countries() |
|
599 | + { |
|
600 | + // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
601 | + // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
602 | + // currency symbols: http://www.xe.com/symbols.php |
|
603 | + // CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active |
|
604 | + // ('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
|
605 | + $newer_countries = array( |
|
606 | + array('AX', 'ALA', 0, 'Åland Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
607 | + array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
608 | + array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
609 | + array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
610 | + array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
611 | + array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
612 | + array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
613 | + array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
614 | + array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0), |
|
615 | + array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
616 | + array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
617 | + array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0), |
|
618 | + array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
619 | + array( |
|
620 | + 'BQ', |
|
621 | + 'BES', |
|
622 | + 0, |
|
623 | + 'Bonaire, Saint Eustatius and Saba', |
|
624 | + 'USD', |
|
625 | + 'Dollar', |
|
626 | + 'Dollars', |
|
627 | + '$', |
|
628 | + 1, |
|
629 | + 2, |
|
630 | + '+599', |
|
631 | + 0, |
|
632 | + 0, |
|
633 | + ), |
|
634 | + array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0), |
|
635 | + array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0), |
|
636 | + array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0), |
|
637 | + array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0), |
|
638 | + array( |
|
639 | + 'HM', |
|
640 | + 'HMD', |
|
641 | + 0, |
|
642 | + 'Heard Island and McDonald Islands', |
|
643 | + 'AUD', |
|
644 | + 'Dollar', |
|
645 | + 'Dollars', |
|
646 | + '$', |
|
647 | + 1, |
|
648 | + 2, |
|
649 | + '+891', |
|
650 | + 0, |
|
651 | + 0, |
|
652 | + ), |
|
653 | + array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0), |
|
654 | + array( |
|
655 | + 'GS', |
|
656 | + 'SGS', |
|
657 | + 0, |
|
658 | + 'South Georgia and the South Sandwich Islands', |
|
659 | + 'GBP', |
|
660 | + 'Pound', |
|
661 | + 'Pounds', |
|
662 | + '£', |
|
663 | + 1, |
|
664 | + 2, |
|
665 | + '+500', |
|
666 | + 0, |
|
667 | + 0, |
|
668 | + ), |
|
669 | + array('TL', 'TLS', 0, 'Timor-Leste', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+670', 0, 0), |
|
670 | + array('TF', 'ATF', 0, 'French Southern Territories', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+262', 0, 0), |
|
671 | + array( |
|
672 | + 'UM', |
|
673 | + 'UMI', |
|
674 | + 0, |
|
675 | + 'United States Minor Outlying Islands', |
|
676 | + 'USD', |
|
677 | + 'Dollar', |
|
678 | + 'Dollars', |
|
679 | + '$', |
|
680 | + 1, |
|
681 | + 2, |
|
682 | + '+1', |
|
683 | + 0, |
|
684 | + 0, |
|
685 | + ), |
|
686 | + ); |
|
687 | + global $wpdb; |
|
688 | + $country_table = $wpdb->prefix . "esp_country"; |
|
689 | + $country_format = array( |
|
690 | + "CNT_ISO" => '%s', |
|
691 | + "CNT_ISO3" => '%s', |
|
692 | + "RGN_ID" => '%d', |
|
693 | + "CNT_name" => '%s', |
|
694 | + "CNT_cur_code" => '%s', |
|
695 | + "CNT_cur_single" => '%s', |
|
696 | + "CNT_cur_plural" => '%s', |
|
697 | + "CNT_cur_sign" => '%s', |
|
698 | + "CNT_cur_sign_b4" => '%d', |
|
699 | + "CNT_cur_dec_plc" => '%d', |
|
700 | + "CNT_tel_code" => '%s', |
|
701 | + "CNT_is_EU" => '%d', |
|
702 | + "CNT_active" => '%d', |
|
703 | + ); |
|
704 | + if ($this->_get_table_analysis()->tableExists($country_table)) { |
|
705 | + foreach ($newer_countries as $country) { |
|
706 | + $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
707 | + $countries = $wpdb->get_var($SQL); |
|
708 | + if (! $countries) { |
|
709 | + $wpdb->insert( |
|
710 | + $country_table, |
|
711 | + array_combine(array_keys($country_format), $country), |
|
712 | + $country_format |
|
713 | + ); |
|
714 | + } |
|
715 | + } |
|
716 | + } |
|
717 | + } |
|
718 | 718 | |
719 | 719 | |
720 | 720 | |
721 | - /** |
|
722 | - * verifies each of the new currencies exists that somehow we missed in 4.6 |
|
723 | - */ |
|
724 | - public function verify_new_currencies() |
|
725 | - { |
|
726 | - // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
727 | - // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
728 | - // currency symbols: http://www.xe.com/symbols.php |
|
729 | - // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
|
730 | - // ( 'EUR', 'Euro', 'Euros', '€', 2,1), |
|
731 | - $newer_currencies = array( |
|
732 | - array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
733 | - ); |
|
734 | - global $wpdb; |
|
735 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
736 | - $currency_format = array( |
|
737 | - "CUR_code" => '%s', |
|
738 | - "CUR_single" => '%s', |
|
739 | - "CUR_plural" => '%s', |
|
740 | - "CUR_sign" => '%s', |
|
741 | - "CUR_dec_plc" => '%d', |
|
742 | - "CUR_active" => '%d', |
|
743 | - ); |
|
744 | - if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
745 | - foreach ($newer_currencies as $currency) { |
|
746 | - $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
747 | - $countries = $wpdb->get_var($SQL); |
|
748 | - if (! $countries) { |
|
749 | - $wpdb->insert( |
|
750 | - $currency_table, |
|
751 | - array_combine(array_keys($currency_format), $currency), |
|
752 | - $currency_format |
|
753 | - ); |
|
754 | - } |
|
755 | - } |
|
756 | - } |
|
757 | - } |
|
721 | + /** |
|
722 | + * verifies each of the new currencies exists that somehow we missed in 4.6 |
|
723 | + */ |
|
724 | + public function verify_new_currencies() |
|
725 | + { |
|
726 | + // a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028 |
|
727 | + // how many decimal places? https://en.wikipedia.org/wiki/ISO_4217 |
|
728 | + // currency symbols: http://www.xe.com/symbols.php |
|
729 | + // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
|
730 | + // ( 'EUR', 'Euro', 'Euros', '€', 2,1), |
|
731 | + $newer_currencies = array( |
|
732 | + array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
733 | + ); |
|
734 | + global $wpdb; |
|
735 | + $currency_table = $wpdb->prefix . "esp_currency"; |
|
736 | + $currency_format = array( |
|
737 | + "CUR_code" => '%s', |
|
738 | + "CUR_single" => '%s', |
|
739 | + "CUR_plural" => '%s', |
|
740 | + "CUR_sign" => '%s', |
|
741 | + "CUR_dec_plc" => '%d', |
|
742 | + "CUR_active" => '%d', |
|
743 | + ); |
|
744 | + if ($this->_get_table_analysis()->tableExists($currency_table)) { |
|
745 | + foreach ($newer_currencies as $currency) { |
|
746 | + $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
747 | + $countries = $wpdb->get_var($SQL); |
|
748 | + if (! $countries) { |
|
749 | + $wpdb->insert( |
|
750 | + $currency_table, |
|
751 | + array_combine(array_keys($currency_format), $currency), |
|
752 | + $currency_format |
|
753 | + ); |
|
754 | + } |
|
755 | + } |
|
756 | + } |
|
757 | + } |
|
758 | 758 | |
759 | 759 | |
760 | 760 | |
761 | - /** |
|
762 | - * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731 |
|
763 | - * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
|
764 | - * we should be able to stop doing this in 4.9 |
|
765 | - */ |
|
766 | - public function fix_non_default_taxes() |
|
767 | - { |
|
768 | - global $wpdb; |
|
769 | - $query = $wpdb->prepare("UPDATE |
|
761 | + /** |
|
762 | + * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731 |
|
763 | + * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
|
764 | + * we should be able to stop doing this in 4.9 |
|
765 | + */ |
|
766 | + public function fix_non_default_taxes() |
|
767 | + { |
|
768 | + global $wpdb; |
|
769 | + $query = $wpdb->prepare("UPDATE |
|
770 | 770 | {$wpdb->prefix}esp_price p INNER JOIN |
771 | 771 | {$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID |
772 | 772 | SET |
@@ -775,6 +775,6 @@ discard block |
||
775 | 775 | p.PRC_is_default = 0 AND |
776 | 776 | pt.PBT_ID = %d |
777 | 777 | ", EEM_Price_Type::base_type_tax); |
778 | - $wpdb->query($query); |
|
779 | - } |
|
778 | + $wpdb->query($query); |
|
779 | + } |
|
780 | 780 | } |
@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | // unfortunately, this needs to be done upon INCLUSION of this file, |
15 | 15 | // instead of construction, because it only gets constructed on first page load |
16 | 16 | // (all other times it gets resurrected from a wordpress option) |
17 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_8_0_stages/*'); |
|
17 | +$stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*'); |
|
18 | 18 | $class_to_filepath = array(); |
19 | 19 | foreach ($stages as $filepath) { |
20 | 20 | $matches = array(); |
21 | 21 | preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
22 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
22 | + $class_to_filepath[$matches[1]] = $filepath; |
|
23 | 23 | } |
24 | 24 | // give addons a chance to autoload their stages too |
25 | 25 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath); |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | if (version_compare($version_string, '4.8.0.decaf', '<') && version_compare($version_string, '4.7.0.decaf', '>=')) { |
73 | 73 | // echo "$version_string can be migrated from"; |
74 | 74 | return true; |
75 | - } elseif (! $version_string) { |
|
75 | + } elseif ( ! $version_string) { |
|
76 | 76 | // echo "no version string provided: $version_string"; |
77 | 77 | // no version string provided... this must be pre 4.3 |
78 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
78 | + return false; // changed mind. dont want people thinking they should migrate yet because they cant |
|
79 | 79 | } else { |
80 | 80 | // echo "$version_string doesnt apply"; |
81 | 81 | return false; |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function schema_changes_before_migration() |
91 | 91 | { |
92 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
92 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
93 | 93 | $now_in_mysql = current_time('mysql', true); |
94 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
94 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
95 | 95 | $table_name = 'esp_answer'; |
96 | 96 | $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
97 | 97 | REG_ID int(10) unsigned NOT NULL, |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | ), |
686 | 686 | ); |
687 | 687 | global $wpdb; |
688 | - $country_table = $wpdb->prefix . "esp_country"; |
|
688 | + $country_table = $wpdb->prefix."esp_country"; |
|
689 | 689 | $country_format = array( |
690 | 690 | "CNT_ISO" => '%s', |
691 | 691 | "CNT_ISO3" => '%s', |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | foreach ($newer_countries as $country) { |
706 | 706 | $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
707 | 707 | $countries = $wpdb->get_var($SQL); |
708 | - if (! $countries) { |
|
708 | + if ( ! $countries) { |
|
709 | 709 | $wpdb->insert( |
710 | 710 | $country_table, |
711 | 711 | array_combine(array_keys($country_format), $country), |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
733 | 733 | ); |
734 | 734 | global $wpdb; |
735 | - $currency_table = $wpdb->prefix . "esp_currency"; |
|
735 | + $currency_table = $wpdb->prefix."esp_currency"; |
|
736 | 736 | $currency_format = array( |
737 | 737 | "CUR_code" => '%s', |
738 | 738 | "CUR_single" => '%s', |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | foreach ($newer_currencies as $currency) { |
746 | 746 | $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
747 | 747 | $countries = $wpdb->get_var($SQL); |
748 | - if (! $countries) { |
|
748 | + if ( ! $countries) { |
|
749 | 749 | $wpdb->insert( |
750 | 750 | $currency_table, |
751 | 751 | array_combine(array_keys($currency_format), $currency), |