@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @return EED_Ical |
33 | 33 | */ |
34 | 34 | public static function instance() { |
35 | - return parent::get_instance( __CLASS__ ); |
|
35 | + return parent::get_instance(__CLASS__); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public static function set_hooks() { |
47 | 47 | // create download buttons |
48 | - add_filter( 'FHEE__espresso_list_of_event_dates__datetime_html', array( 'EED_Ical', 'generate_add_to_iCal_button' ), 10, 2 ); |
|
48 | + add_filter('FHEE__espresso_list_of_event_dates__datetime_html', array('EED_Ical', 'generate_add_to_iCal_button'), 10, 2); |
|
49 | 49 | // process ics download request |
50 | - EE_Config::register_route( 'download_ics_file', 'EED_Ical', 'download_ics_file' ); |
|
50 | + EE_Config::register_route('download_ics_file', 'EED_Ical', 'download_ics_file'); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param WP $WP |
71 | 71 | * @return void |
72 | 72 | */ |
73 | - public function run( $WP ) {} |
|
73 | + public function run($WP) {} |
|
74 | 74 | |
75 | 75 | |
76 | 76 | |
@@ -82,30 +82,30 @@ discard block |
||
82 | 82 | * @param $datetime |
83 | 83 | * @return string |
84 | 84 | */ |
85 | - public static function generate_add_to_iCal_button( $html, $datetime ) { |
|
85 | + public static function generate_add_to_iCal_button($html, $datetime) { |
|
86 | 86 | // first verify a proper datetime object has been received |
87 | - if ( $datetime instanceof EE_Datetime ) { |
|
87 | + if ($datetime instanceof EE_Datetime) { |
|
88 | 88 | // set whether a link or submit button is shown |
89 | - $iCal_type = apply_filters( 'FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type', 'submit' ); |
|
89 | + $iCal_type = apply_filters('FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type', 'submit'); |
|
90 | 90 | // generate a link to the route we registered in set_hooks() |
91 | - $URL = add_query_arg( array( 'ee' => 'download_ics_file', 'ics_id' => $datetime->ID() ), site_url() ); |
|
91 | + $URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $datetime->ID()), site_url()); |
|
92 | 92 | // what type ? |
93 | - switch ( $iCal_type ) { |
|
93 | + switch ($iCal_type) { |
|
94 | 94 | // submit buttons appear as buttons and are very compatible with a theme's style |
95 | 95 | case 'submit' : |
96 | - $html .= '<form id="download-iCal-frm-' . $datetime->ID() . '" class="download-iCal-frm" action="' . $URL . '" method="post" >'; |
|
97 | - $html .= '<input type="submit" class="ee-ical-sbmt" value="" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '"/>'; |
|
96 | + $html .= '<form id="download-iCal-frm-'.$datetime->ID().'" class="download-iCal-frm" action="'.$URL.'" method="post" >'; |
|
97 | + $html .= '<input type="submit" class="ee-ical-sbmt" value="" title="'.__('Add to iCal Calendar', 'event_espresso').'"/>'; |
|
98 | 98 | $html .= '</form>'; |
99 | 99 | break; |
100 | 100 | // buttons are just links that have been styled to appear as buttons, but may not be blend with a theme as well as submit buttons |
101 | 101 | case 'button' : |
102 | - $html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="' . $URL . '" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '">'; |
|
102 | + $html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="'.$URL.'" title="'.__('Add to iCal Calendar', 'event_espresso').'">'; |
|
103 | 103 | $html .= ' <span class="dashicons dashicons-calendar"></span>'; |
104 | 104 | $html .= '</a>'; |
105 | 105 | break; |
106 | 106 | // links are just links that use the calendar dashicon |
107 | 107 | case 'icon' : |
108 | - $html .= '<a class="ee-ical-lnk" href="' . $URL . '" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '">'; |
|
108 | + $html .= '<a class="ee-ical-lnk" href="'.$URL.'" title="'.__('Add to iCal Calendar', 'event_espresso').'">'; |
|
109 | 109 | $html .= ' <span class="dashicons dashicons-calendar"></span>'; |
110 | 110 | $html .= '</a>'; |
111 | 111 | break; |
@@ -123,73 +123,73 @@ discard block |
||
123 | 123 | * @return void |
124 | 124 | */ |
125 | 125 | public static function download_ics_file() { |
126 | - if ( EE_Registry::instance()->REQ->is_set( 'ics_id' )) { |
|
127 | - $DTT_ID = absint( EE_Registry::instance()->REQ->get( 'ics_id' )); |
|
128 | - $datetime = EE_Registry::instance()->load_model( 'Datetime' )->get_one_by_ID( $DTT_ID ); |
|
129 | - if ( $datetime instanceof EE_Datetime ) { |
|
126 | + if (EE_Registry::instance()->REQ->is_set('ics_id')) { |
|
127 | + $DTT_ID = absint(EE_Registry::instance()->REQ->get('ics_id')); |
|
128 | + $datetime = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($DTT_ID); |
|
129 | + if ($datetime instanceof EE_Datetime) { |
|
130 | 130 | // get related event, venues, and event categories |
131 | 131 | $event = $datetime->event(); |
132 | 132 | // get related category Term object and it's name |
133 | 133 | $category = $event->first_event_category(); |
134 | - if ( $category instanceof EE_Term ) { |
|
134 | + if ($category instanceof EE_Term) { |
|
135 | 135 | $category = $category->name(); |
136 | 136 | } |
137 | 137 | $location = ''; |
138 | 138 | // get first related venue and convert to CSV string |
139 | - $venue = $event->venues(array( 'limit'=>1 )); |
|
140 | - if ( is_array( $venue ) && ! empty( $venue )) { |
|
141 | - $venue = array_shift( $venue ); |
|
142 | - if ( $venue instanceof EE_Venue ) { |
|
143 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
144 | - $location = espresso_venue_raw_address( 'inline', $venue->ID(), FALSE ); |
|
139 | + $venue = $event->venues(array('limit'=>1)); |
|
140 | + if (is_array($venue) && ! empty($venue)) { |
|
141 | + $venue = array_shift($venue); |
|
142 | + if ($venue instanceof EE_Venue) { |
|
143 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
144 | + $location = espresso_venue_raw_address('inline', $venue->ID(), FALSE); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | // set variables, escape strings, convert timestamps to ics format, etc |
148 | - $filename = $event->slug() . '-' . $datetime->start_date( 'Y-m-d' ) . '.ics'; |
|
149 | - $organizer = EED_Ical::_escape_ICal_data( EE_Registry::instance()->CFG->organization->name ); |
|
150 | - $UID = EED_Ical::_escape_ICal_data( md5( $event->name() . $event->ID() . $datetime->ID() )); |
|
151 | - $org_email = EED_Ical::_escape_ICal_data( $datetime->ID() ); |
|
152 | - $timestamp = date( EED_Ical::iCal_datetime_format ); |
|
153 | - $location = EED_Ical::_escape_ICal_data( $location ); |
|
154 | - $summary = EED_Ical::_escape_ICal_data( $event->name() ); |
|
155 | - $description = EED_Ical::_escape_ICal_description( wp_strip_all_tags( $event->description() )); |
|
148 | + $filename = $event->slug().'-'.$datetime->start_date('Y-m-d').'.ics'; |
|
149 | + $organizer = EED_Ical::_escape_ICal_data(EE_Registry::instance()->CFG->organization->name); |
|
150 | + $UID = EED_Ical::_escape_ICal_data(md5($event->name().$event->ID().$datetime->ID())); |
|
151 | + $org_email = EED_Ical::_escape_ICal_data($datetime->ID()); |
|
152 | + $timestamp = date(EED_Ical::iCal_datetime_format); |
|
153 | + $location = EED_Ical::_escape_ICal_data($location); |
|
154 | + $summary = EED_Ical::_escape_ICal_data($event->name()); |
|
155 | + $description = EED_Ical::_escape_ICal_description(wp_strip_all_tags($event->description())); |
|
156 | 156 | $status = $datetime->get_active_status(); |
157 | 157 | $status = $status == EE_Datetime::cancelled ? 'Cancelled' : 'Confirmed'; |
158 | - $status = EED_Ical::_escape_ICal_data( $status ); |
|
159 | - $categories = EED_Ical::_escape_ICal_data( $category ); |
|
160 | - $url = EED_Ical::_escape_ICal_data( get_permalink( $event->ID() )); |
|
161 | - $dtt_start = EED_Ical::_escape_ICal_data( date( EED_Ical::iCal_datetime_format, $datetime->start() )); |
|
162 | - $dtt_end = EED_Ical::_escape_ICal_data( date( EED_Ical::iCal_datetime_format, $datetime->end() )); |
|
158 | + $status = EED_Ical::_escape_ICal_data($status); |
|
159 | + $categories = EED_Ical::_escape_ICal_data($category); |
|
160 | + $url = EED_Ical::_escape_ICal_data(get_permalink($event->ID())); |
|
161 | + $dtt_start = EED_Ical::_escape_ICal_data(date(EED_Ical::iCal_datetime_format, $datetime->start())); |
|
162 | + $dtt_end = EED_Ical::_escape_ICal_data(date(EED_Ical::iCal_datetime_format, $datetime->end())); |
|
163 | 163 | // set headers |
164 | - header( 'Content-type: text/calendar; charset=utf-8' ); |
|
165 | - header( 'Content-Disposition: attachment; filename="' . $filename . '"' ); |
|
166 | - header( 'Cache-Control: private, max-age=0, must-revalidate' ); |
|
167 | - header( 'Pragma: public' ); |
|
168 | - header( 'Content-Type: application/octet-stream' ); |
|
169 | - header( 'Content-Type: application/force-download' ); |
|
170 | - header( 'Cache-Control: no-cache, must-revalidate' ); |
|
171 | - header( 'Content-Transfer-Encoding: binary' ); |
|
172 | - header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); // past date |
|
173 | - ini_set( 'zlib.output_compression', '0' ); |
|
164 | + header('Content-type: text/calendar; charset=utf-8'); |
|
165 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
166 | + header('Cache-Control: private, max-age=0, must-revalidate'); |
|
167 | + header('Pragma: public'); |
|
168 | + header('Content-Type: application/octet-stream'); |
|
169 | + header('Content-Type: application/force-download'); |
|
170 | + header('Cache-Control: no-cache, must-revalidate'); |
|
171 | + header('Content-Transfer-Encoding: binary'); |
|
172 | + header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // past date |
|
173 | + ini_set('zlib.output_compression', '0'); |
|
174 | 174 | // echo the output |
175 | - echo "BEGIN:VCALENDAR" . PHP_EOL; |
|
176 | - echo "VERSION:2.0" . PHP_EOL; |
|
177 | - echo "PRODID:-//{$organizer}//NONSGML PDA Calendar Version 1.0//EN" . PHP_EOL; |
|
178 | - echo "CALSCALE:GREGORIAN" . PHP_EOL; |
|
179 | - echo "BEGIN:VEVENT" . PHP_EOL; |
|
180 | - echo "UID:{$UID}" . PHP_EOL; |
|
181 | - echo "ORGANIZER:MAILTO:{$org_email}" . PHP_EOL; |
|
182 | - echo "DTSTAMP:{$timestamp}" . PHP_EOL; |
|
183 | - echo "LOCATION:{$location}" . PHP_EOL; |
|
184 | - echo "SUMMARY:{$summary}" . PHP_EOL; |
|
185 | - echo "DESCRIPTION:{$description}" . PHP_EOL; |
|
186 | - echo "STATUS:{$status}" . PHP_EOL; |
|
187 | - echo "CATEGORIES:{$categories}" . PHP_EOL; |
|
188 | - echo "URL;VALUE=URI:{$url}" . PHP_EOL; |
|
189 | - echo "DTSTART:{$dtt_start}" . PHP_EOL; |
|
190 | - echo "DTEND:{$dtt_end}" . PHP_EOL; |
|
191 | - echo "END:VEVENT" . PHP_EOL; |
|
192 | - echo "END:VCALENDAR" . PHP_EOL; |
|
175 | + echo "BEGIN:VCALENDAR".PHP_EOL; |
|
176 | + echo "VERSION:2.0".PHP_EOL; |
|
177 | + echo "PRODID:-//{$organizer}//NONSGML PDA Calendar Version 1.0//EN".PHP_EOL; |
|
178 | + echo "CALSCALE:GREGORIAN".PHP_EOL; |
|
179 | + echo "BEGIN:VEVENT".PHP_EOL; |
|
180 | + echo "UID:{$UID}".PHP_EOL; |
|
181 | + echo "ORGANIZER:MAILTO:{$org_email}".PHP_EOL; |
|
182 | + echo "DTSTAMP:{$timestamp}".PHP_EOL; |
|
183 | + echo "LOCATION:{$location}".PHP_EOL; |
|
184 | + echo "SUMMARY:{$summary}".PHP_EOL; |
|
185 | + echo "DESCRIPTION:{$description}".PHP_EOL; |
|
186 | + echo "STATUS:{$status}".PHP_EOL; |
|
187 | + echo "CATEGORIES:{$categories}".PHP_EOL; |
|
188 | + echo "URL;VALUE=URI:{$url}".PHP_EOL; |
|
189 | + echo "DTSTART:{$dtt_start}".PHP_EOL; |
|
190 | + echo "DTEND:{$dtt_end}".PHP_EOL; |
|
191 | + echo "END:VEVENT".PHP_EOL; |
|
192 | + echo "END:VCALENDAR".PHP_EOL; |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 | die(); |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | * @param string $string |
205 | 205 | * @return string |
206 | 206 | */ |
207 | - private static function _escape_ICal_data( $string = '' ) { |
|
208 | - return preg_replace( '/([\,;])/', '\\\$1', $string ); |
|
207 | + private static function _escape_ICal_data($string = '') { |
|
208 | + return preg_replace('/([\,;])/', '\\\$1', $string); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -215,13 +215,13 @@ discard block |
||
215 | 215 | * @param string $description |
216 | 216 | * @return string |
217 | 217 | */ |
218 | - private static function _escape_ICal_description( $description = '' ) { |
|
218 | + private static function _escape_ICal_description($description = '') { |
|
219 | 219 | |
220 | 220 | //Escape spcial chars within the decription |
221 | - $description = EED_Ical::_escape_ICal_data( $description ); |
|
221 | + $description = EED_Ical::_escape_ICal_data($description); |
|
222 | 222 | |
223 | 223 | //Remove line breaks and output in iCal format |
224 | - $description = str_replace( array( "\r\n", "\n"), '\n', $description ); |
|
224 | + $description = str_replace(array("\r\n", "\n"), '\n', $description); |
|
225 | 225 | |
226 | 226 | return $description; |
227 | 227 | } |
@@ -220,8 +220,8 @@ |
||
220 | 220 | //Escape spcial chars within the decription |
221 | 221 | $description = EED_Ical::_escape_ICal_data( $description ); |
222 | 222 | |
223 | - //Remove line breaks and output in iCal format |
|
224 | - $description = str_replace( array( "\r\n", "\n"), '\n', $description ); |
|
223 | + //Remove line breaks and output in iCal format |
|
224 | + $description = str_replace( array( "\r\n", "\n"), '\n', $description ); |
|
225 | 225 | |
226 | 226 | return $description; |
227 | 227 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * process_registration_from_admin |
281 | 281 | * |
282 | 282 | * @access public |
283 | - * @return int |
|
283 | + * @return EE_Transaction |
|
284 | 284 | */ |
285 | 285 | public static function process_registration_from_admin() { |
286 | 286 | EED_Single_Page_Checkout::load_reg_steps(); |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | * _get_transaction_and_cart_for_previous_visit |
609 | 609 | * |
610 | 610 | * @access private |
611 | - * @return mixed EE_Transaction|NULL |
|
611 | + * @return EE_Transaction|null EE_Transaction|NULL |
|
612 | 612 | */ |
613 | 613 | private function _get_transaction_and_cart_for_previous_visit() { |
614 | 614 | /** @var $TXN_model EEM_Transaction */ |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | * generates a new EE_Transaction object and adds it to the $_transaction property. |
678 | 678 | * |
679 | 679 | * @access private |
680 | - * @return mixed EE_Transaction|NULL |
|
680 | + * @return EE_Transaction|null EE_Transaction|NULL |
|
681 | 681 | */ |
682 | 682 | private function _initialize_transaction() { |
683 | 683 | try { |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Single Page Checkout (SPCO) |
|
4 | - * |
|
5 | - * @package Event Espresso |
|
6 | - * @subpackage /modules/single_page_checkout/ |
|
7 | - * @author Brent Christensen |
|
8 | - * |
|
9 | - */ |
|
3 | + * Single Page Checkout (SPCO) |
|
4 | + * |
|
5 | + * @package Event Espresso |
|
6 | + * @subpackage /modules/single_page_checkout/ |
|
7 | + * @author Brent Christensen |
|
8 | + * |
|
9 | + */ |
|
10 | 10 | class EED_Single_Page_Checkout extends EED_Module { |
11 | 11 | |
12 | 12 |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | * @return EED_Single_Page_Checkout |
39 | 39 | */ |
40 | 40 | public static function instance() { |
41 | - add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' ); |
|
42 | - return parent::get_instance( __CLASS__ ); |
|
41 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
42 | + return parent::get_instance(__CLASS__); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -84,22 +84,22 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function set_hooks_admin() { |
86 | 86 | EED_Single_Page_Checkout::set_definitions(); |
87 | - if ( defined( 'DOING_AJAX' )) { |
|
87 | + if (defined('DOING_AJAX')) { |
|
88 | 88 | // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response |
89 | 89 | ob_start(); |
90 | 90 | EED_Single_Page_Checkout::load_request_handler(); |
91 | 91 | EED_Single_Page_Checkout::load_reg_steps(); |
92 | 92 | } else { |
93 | 93 | // hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called |
94 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
94 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
95 | 95 | } |
96 | 96 | // set ajax hooks |
97 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
98 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
99 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
100 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
101 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
102 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
97 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
98 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
99 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
100 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
101 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
102 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | * process ajax request |
109 | 109 | * @param string $ajax_action |
110 | 110 | */ |
111 | - public static function process_ajax_request( $ajax_action ) { |
|
112 | - EE_Registry::instance()->REQ->set( 'action', $ajax_action ); |
|
111 | + public static function process_ajax_request($ajax_action) { |
|
112 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
113 | 113 | EED_Single_Page_Checkout::instance()->_initialize(); |
114 | 114 | } |
115 | 115 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * ajax display registration step |
120 | 120 | */ |
121 | 121 | public static function display_reg_step() { |
122 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
122 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * ajax process registration step |
129 | 129 | */ |
130 | 130 | public static function process_reg_step() { |
131 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
131 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * ajax process registration step |
138 | 138 | */ |
139 | 139 | public static function update_reg_step() { |
140 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
140 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @return void |
150 | 150 | */ |
151 | 151 | public static function update_checkout() { |
152 | - EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' ); |
|
152 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public static function load_request_handler() { |
164 | 164 | // load core Request_Handler class |
165 | - if ( ! isset( EE_Registry::instance()->REQ )) { |
|
166 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
165 | + if ( ! isset(EE_Registry::instance()->REQ)) { |
|
166 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | * @return void |
177 | 177 | */ |
178 | 178 | public static function set_definitions() { |
179 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
180 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
181 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
182 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
183 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
184 | - define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS ); |
|
185 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
186 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
179 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
180 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
181 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
182 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
183 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
184 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
185 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
186 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public static function load_reg_steps() { |
200 | 200 | static $reg_steps_loaded = FALSE; |
201 | - if ( $reg_steps_loaded ) { |
|
201 | + if ($reg_steps_loaded) { |
|
202 | 202 | return; |
203 | 203 | } |
204 | 204 | // filter list of reg_steps |
@@ -207,24 +207,24 @@ discard block |
||
207 | 207 | EED_Single_Page_Checkout::get_reg_steps() |
208 | 208 | ); |
209 | 209 | // sort by key (order) |
210 | - ksort( $reg_steps_to_load ); |
|
210 | + ksort($reg_steps_to_load); |
|
211 | 211 | // loop through folders |
212 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
212 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
213 | 213 | // we need a |
214 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
214 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
215 | 215 | // copy over to the reg_steps_array |
216 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
216 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
217 | 217 | // register custom key route for each reg step |
218 | 218 | // ie: step=>"slug" - this is the entire reason we load the reg steps array now |
219 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
219 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
220 | 220 | // add AJAX or other hooks |
221 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
221 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
222 | 222 | // setup autoloaders if necessary |
223 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
224 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
223 | + if ( ! class_exists($reg_step['class_name'])) { |
|
224 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
225 | 225 | } |
226 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
227 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
226 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
227 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | } |
@@ -243,28 +243,28 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public static function get_reg_steps() { |
245 | 245 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
246 | - if ( empty( $reg_steps )) { |
|
246 | + if (empty($reg_steps)) { |
|
247 | 247 | $reg_steps = array( |
248 | 248 | 10 => array( |
249 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
249 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
250 | 250 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
251 | 251 | 'slug' => 'attendee_information', |
252 | 252 | 'has_hooks' => FALSE |
253 | 253 | ), |
254 | 254 | 20 => array( |
255 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
255 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
256 | 256 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
257 | 257 | 'slug' => 'registration_confirmation', |
258 | 258 | 'has_hooks' => FALSE |
259 | 259 | ), |
260 | 260 | 30 => array( |
261 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
261 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
262 | 262 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
263 | 263 | 'slug' => 'payment_options', |
264 | 264 | 'has_hooks' => TRUE |
265 | 265 | ), |
266 | 266 | 999 => array( |
267 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
267 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
268 | 268 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
269 | 269 | 'slug' => 'finalize_registration', |
270 | 270 | 'has_hooks' => FALSE |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public static function registration_checkout_for_admin() { |
286 | 286 | EED_Single_Page_Checkout::load_reg_steps(); |
287 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
288 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
289 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
287 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
288 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
289 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
290 | 290 | EED_Single_Page_Checkout::instance()->_initialize(); |
291 | 291 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
292 | 292 | return EE_Registry::instance()->REQ->get_output(); |
@@ -302,15 +302,15 @@ discard block |
||
302 | 302 | */ |
303 | 303 | public static function process_registration_from_admin() { |
304 | 304 | EED_Single_Page_Checkout::load_reg_steps(); |
305 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
306 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
307 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
305 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
306 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
307 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
308 | 308 | EED_Single_Page_Checkout::instance()->_initialize(); |
309 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
310 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
311 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
312 | - EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated( $final_reg_step ); |
|
313 | - if ( $final_reg_step->process_reg_step() ) { |
|
309 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
310 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
311 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
312 | + EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step); |
|
313 | + if ($final_reg_step->process_reg_step()) { |
|
314 | 314 | $final_reg_step->set_completed(); |
315 | 315 | EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array(); |
316 | 316 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
@@ -329,11 +329,11 @@ discard block |
||
329 | 329 | * @param WP_Query $WP_Query |
330 | 330 | * @return void |
331 | 331 | */ |
332 | - public function run( $WP_Query ) { |
|
332 | + public function run($WP_Query) { |
|
333 | 333 | if ( |
334 | 334 | $WP_Query instanceof WP_Query |
335 | 335 | && $WP_Query->is_main_query() |
336 | - && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true ) |
|
336 | + && apply_filters('FHEE__EED_Single_Page_Checkout__run', true) |
|
337 | 337 | ) { |
338 | 338 | $this->_initialize(); |
339 | 339 | } |
@@ -349,8 +349,8 @@ discard block |
||
349 | 349 | * @param WP_Query $WP_Query |
350 | 350 | * @return void |
351 | 351 | */ |
352 | - public static function init( $WP_Query ) { |
|
353 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
352 | + public static function init($WP_Query) { |
|
353 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | |
@@ -364,35 +364,35 @@ discard block |
||
364 | 364 | */ |
365 | 365 | private function _initialize() { |
366 | 366 | // ensure SPCO doesn't run twice |
367 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
367 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
368 | 368 | return; |
369 | 369 | } |
370 | 370 | // setup the EE_Checkout object |
371 | 371 | $this->checkout = $this->_initialize_checkout(); |
372 | 372 | // filter checkout |
373 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
373 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
374 | 374 | // get the $_GET |
375 | 375 | $this->_get_request_vars(); |
376 | 376 | // filter continue_reg |
377 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
377 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
378 | 378 | // load the reg steps array |
379 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
379 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
380 | 380 | EED_Single_Page_Checkout::$_initialized = true; |
381 | 381 | return; |
382 | 382 | } |
383 | 383 | // set the current step |
384 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
384 | + $this->checkout->set_current_step($this->checkout->step); |
|
385 | 385 | // and the next step |
386 | 386 | $this->checkout->set_next_step(); |
387 | 387 | // was there already a valid transaction in the checkout from the session ? |
388 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
388 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
389 | 389 | // get transaction from db or session |
390 | 390 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() |
391 | 391 | ? $this->_get_transaction_and_cart_for_previous_visit() |
392 | 392 | : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
393 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
393 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
394 | 394 | EE_Error::add_error( |
395 | - __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), |
|
395 | + __('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), |
|
396 | 396 | __FILE__, __FUNCTION__, __LINE__ |
397 | 397 | ); |
398 | 398 | // add some style and make it dance |
@@ -402,10 +402,10 @@ discard block |
||
402 | 402 | return; |
403 | 403 | } |
404 | 404 | // and the registrations for the transaction |
405 | - $this->_get_registrations( $this->checkout->transaction ); |
|
405 | + $this->_get_registrations($this->checkout->transaction); |
|
406 | 406 | } |
407 | 407 | // verify that everything has been setup correctly |
408 | - if ( ! $this->_final_verifications() ) { |
|
408 | + if ( ! $this->_final_verifications()) { |
|
409 | 409 | EED_Single_Page_Checkout::$_initialized = true; |
410 | 410 | return; |
411 | 411 | } |
@@ -430,9 +430,9 @@ discard block |
||
430 | 430 | // set no cache headers and constants |
431 | 431 | EE_System::do_not_cache(); |
432 | 432 | // add anchor |
433 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
433 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
434 | 434 | // remove transaction lock |
435 | - add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 ); |
|
435 | + add_action('shutdown', array($this, 'unlock_transaction'), 1); |
|
436 | 436 | } |
437 | 437 | |
438 | 438 | |
@@ -449,20 +449,20 @@ discard block |
||
449 | 449 | // look in session for existing checkout |
450 | 450 | $checkout = EE_Registry::instance()->SSN->checkout(); |
451 | 451 | // verify |
452 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
452 | + if ( ! $checkout instanceof EE_Checkout) { |
|
453 | 453 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
454 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
454 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
455 | 455 | // verify again |
456 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
457 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
456 | + if ( ! $checkout instanceof EE_Checkout) { |
|
457 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
458 | 458 | } |
459 | 459 | } else { |
460 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
461 | - wp_safe_redirect( $checkout->redirect_url ); |
|
460 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
461 | + wp_safe_redirect($checkout->redirect_url); |
|
462 | 462 | exit(); |
463 | 463 | } |
464 | 464 | } |
465 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
465 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
466 | 466 | // reset anything that needs a clean slate for each request |
467 | 467 | $checkout->reset_for_current_request(); |
468 | 468 | return $checkout; |
@@ -480,24 +480,24 @@ discard block |
||
480 | 480 | // load classes |
481 | 481 | EED_Single_Page_Checkout::load_request_handler(); |
482 | 482 | //make sure this request is marked as belonging to EE |
483 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
483 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
484 | 484 | // which step is being requested ? |
485 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
485 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
486 | 486 | // which step is being edited ? |
487 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
487 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
488 | 488 | // and what we're doing on the current step |
489 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
489 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
490 | 490 | // returning to edit ? |
491 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
491 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
492 | 492 | // or some other kind of revisit ? |
493 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
493 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
494 | 494 | // and whether or not to generate a reg form for this request |
495 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
495 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
496 | 496 | // and whether or not to process a reg form submission for this request |
497 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
497 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
498 | 498 | $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' |
499 | 499 | ? $this->checkout->process_form_submission |
500 | - : FALSE; // TRUE FALSE |
|
500 | + : FALSE; // TRUE FALSE |
|
501 | 501 | //$this->_display_request_vars(); |
502 | 502 | } |
503 | 503 | |
@@ -510,17 +510,17 @@ discard block |
||
510 | 510 | * @return void |
511 | 511 | */ |
512 | 512 | protected function _display_request_vars() { |
513 | - if ( ! WP_DEBUG ) { |
|
513 | + if ( ! WP_DEBUG) { |
|
514 | 514 | return; |
515 | 515 | } |
516 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
517 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
518 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
519 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
520 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
521 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
522 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
523 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
516 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
517 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
518 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
519 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
520 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
521 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
522 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
523 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
524 | 524 | } |
525 | 525 | |
526 | 526 | |
@@ -534,8 +534,8 @@ discard block |
||
534 | 534 | * @return array |
535 | 535 | */ |
536 | 536 | private function _get_first_step() { |
537 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
538 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
537 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
538 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | |
@@ -551,27 +551,27 @@ discard block |
||
551 | 551 | private function _load_and_instantiate_reg_steps() { |
552 | 552 | // have reg_steps already been instantiated ? |
553 | 553 | if ( |
554 | - empty( $this->checkout->reg_steps ) || |
|
555 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
554 | + empty($this->checkout->reg_steps) || |
|
555 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
556 | 556 | ) { |
557 | 557 | // if not, then loop through raw reg steps array |
558 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
559 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
558 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
559 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
560 | 560 | return false; |
561 | 561 | } |
562 | 562 | } |
563 | 563 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
564 | 564 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
565 | 565 | // skip the registration_confirmation page ? |
566 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
566 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
567 | 567 | // just remove it from the reg steps array |
568 | - $this->checkout->remove_reg_step( 'registration_confirmation', false ); |
|
568 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
569 | 569 | } else if ( |
570 | 570 | EE_Registry::instance()->CFG->registration->reg_confirmation_last |
571 | - && isset( $this->checkout->reg_steps['registration_confirmation'] ) |
|
571 | + && isset($this->checkout->reg_steps['registration_confirmation']) |
|
572 | 572 | ) { |
573 | 573 | // set the order to something big like 100 |
574 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
574 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
575 | 575 | } |
576 | 576 | // filter the array for good luck |
577 | 577 | $this->checkout->reg_steps = apply_filters( |
@@ -581,13 +581,13 @@ discard block |
||
581 | 581 | // finally re-sort based on the reg step class order properties |
582 | 582 | $this->checkout->sort_reg_steps(); |
583 | 583 | } else { |
584 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
584 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
585 | 585 | // set all current step stati to FALSE |
586 | - $reg_step->set_is_current_step( FALSE ); |
|
586 | + $reg_step->set_is_current_step(FALSE); |
|
587 | 587 | } |
588 | 588 | } |
589 | - if ( empty( $this->checkout->reg_steps )) { |
|
590 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
589 | + if (empty($this->checkout->reg_steps)) { |
|
590 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
591 | 591 | return false; |
592 | 592 | } |
593 | 593 | // make reg step details available to JS |
@@ -605,10 +605,10 @@ discard block |
||
605 | 605 | * @param int $order |
606 | 606 | * @return bool |
607 | 607 | */ |
608 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
608 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
609 | 609 | |
610 | 610 | // we need a file_path, class_name, and slug to add a reg step |
611 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
611 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
612 | 612 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
613 | 613 | if ( |
614 | 614 | $this->checkout->reg_url_link |
@@ -626,26 +626,26 @@ discard block |
||
626 | 626 | FALSE |
627 | 627 | ); |
628 | 628 | // did we gets the goods ? |
629 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
629 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
630 | 630 | // set reg step order based on config |
631 | - $reg_step_obj->set_order( $order ); |
|
631 | + $reg_step_obj->set_order($order); |
|
632 | 632 | // add instantiated reg step object to the master reg steps array |
633 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
633 | + $this->checkout->add_reg_step($reg_step_obj); |
|
634 | 634 | } else { |
635 | 635 | EE_Error::add_error( |
636 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
636 | + __('The current step could not be set.', 'event_espresso'), |
|
637 | 637 | __FILE__, __FUNCTION__, __LINE__ |
638 | 638 | ); |
639 | 639 | return false; |
640 | 640 | } |
641 | 641 | } else { |
642 | - if ( WP_DEBUG ) { |
|
642 | + if (WP_DEBUG) { |
|
643 | 643 | EE_Error::add_error( |
644 | 644 | sprintf( |
645 | - __( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ), |
|
646 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
647 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
648 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
645 | + __('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'), |
|
646 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
647 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
648 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
649 | 649 | '<ul>', |
650 | 650 | '<li>', |
651 | 651 | '</li>', |
@@ -669,16 +669,16 @@ discard block |
||
669 | 669 | */ |
670 | 670 | private function _get_transaction_and_cart_for_previous_visit() { |
671 | 671 | /** @var $TXN_model EEM_Transaction */ |
672 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
672 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
673 | 673 | // because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db |
674 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
674 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
675 | 675 | // verify transaction |
676 | - if ( $transaction instanceof EE_Transaction ) { |
|
676 | + if ($transaction instanceof EE_Transaction) { |
|
677 | 677 | // and get the cart that was used for that transaction |
678 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
678 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
679 | 679 | return $transaction; |
680 | 680 | } else { |
681 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
681 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
682 | 682 | return NULL; |
683 | 683 | } |
684 | 684 | } |
@@ -692,11 +692,11 @@ discard block |
||
692 | 692 | * @param EE_Transaction $transaction |
693 | 693 | * @return EE_Cart |
694 | 694 | */ |
695 | - private function _get_cart_for_transaction( $transaction ) { |
|
696 | - $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction ) : NULL; |
|
695 | + private function _get_cart_for_transaction($transaction) { |
|
696 | + $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction) : NULL; |
|
697 | 697 | // verify cart |
698 | - if ( ! $cart instanceof EE_Cart ) { |
|
699 | - $cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
698 | + if ( ! $cart instanceof EE_Cart) { |
|
699 | + $cart = EE_Registry::instance()->load_core('Cart'); |
|
700 | 700 | } |
701 | 701 | return $cart; |
702 | 702 | } |
@@ -711,8 +711,8 @@ discard block |
||
711 | 711 | * @param EE_Transaction $transaction |
712 | 712 | * @return EE_Cart |
713 | 713 | */ |
714 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
715 | - return EE_Cart::get_cart_from_txn( $transaction ); |
|
714 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
715 | + return EE_Cart::get_cart_from_txn($transaction); |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | |
@@ -727,17 +727,17 @@ discard block |
||
727 | 727 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
728 | 728 | // if there's no transaction, then this is the FIRST visit to SPCO |
729 | 729 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
730 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
730 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
731 | 731 | // and then create a new transaction |
732 | 732 | $transaction = $this->_initialize_transaction(); |
733 | 733 | // verify transaction |
734 | - if ( $transaction instanceof EE_Transaction ) { |
|
734 | + if ($transaction instanceof EE_Transaction) { |
|
735 | 735 | // save it so that we have an ID for other objects to use |
736 | 736 | $transaction->save(); |
737 | 737 | // and save TXN data to the cart |
738 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
738 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
739 | 739 | } else { |
740 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
740 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
741 | 741 | } |
742 | 742 | return $transaction; |
743 | 743 | } |
@@ -757,15 +757,15 @@ discard block |
||
757 | 757 | // grab the cart grand total |
758 | 758 | $cart_total = $this->checkout->cart->get_cart_grand_total(); |
759 | 759 | // create new TXN |
760 | - return EE_Transaction::new_instance( array( |
|
760 | + return EE_Transaction::new_instance(array( |
|
761 | 761 | 'TXN_timestamp' => time(), |
762 | 762 | 'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(), |
763 | 763 | 'TXN_total' => $cart_total > 0 ? $cart_total : 0, |
764 | 764 | 'TXN_paid' => 0, |
765 | 765 | 'STS_ID' => EEM_Transaction::failed_status_code, |
766 | 766 | )); |
767 | - } catch( Exception $e ) { |
|
768 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
767 | + } catch (Exception $e) { |
|
768 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
769 | 769 | } |
770 | 770 | return NULL; |
771 | 771 | } |
@@ -779,34 +779,34 @@ discard block |
||
779 | 779 | * @param EE_Transaction $transaction |
780 | 780 | * @return EE_Cart |
781 | 781 | */ |
782 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
782 | + private function _get_registrations(EE_Transaction $transaction) { |
|
783 | 783 | // first step: grab the registrants { : o |
784 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
784 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
785 | 785 | // verify registrations have been set |
786 | - if ( empty( $registrations )) { |
|
786 | + if (empty($registrations)) { |
|
787 | 787 | // if no cached registrations, then check the db |
788 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
788 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
789 | 789 | // still nothing ? well as long as this isn't a revisit |
790 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
790 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
791 | 791 | // generate new registrations from scratch |
792 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
792 | + $registrations = $this->_initialize_registrations($transaction); |
|
793 | 793 | } |
794 | 794 | } |
795 | 795 | // sort by their original registration order |
796 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
796 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
797 | 797 | // then loop thru the array |
798 | - foreach ( $registrations as $registration ) { |
|
798 | + foreach ($registrations as $registration) { |
|
799 | 799 | // verify each registration |
800 | - if ( $registration instanceof EE_Registration ) { |
|
800 | + if ($registration instanceof EE_Registration) { |
|
801 | 801 | // we display all attendee info for the primary registrant |
802 | - if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) { |
|
802 | + if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) { |
|
803 | 803 | $this->checkout->primary_revisit = TRUE; |
804 | 804 | break; |
805 | - } else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) { |
|
805 | + } else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) { |
|
806 | 806 | // but hide info if it doesn't belong to you |
807 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
807 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
808 | 808 | } |
809 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
809 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
810 | 810 | } |
811 | 811 | } |
812 | 812 | } |
@@ -820,17 +820,17 @@ discard block |
||
820 | 820 | * @param EE_Transaction $transaction |
821 | 821 | * @return array |
822 | 822 | */ |
823 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
823 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
824 | 824 | $att_nmbr = 0; |
825 | 825 | $registrations = array(); |
826 | - if ( $transaction instanceof EE_Transaction ) { |
|
826 | + if ($transaction instanceof EE_Transaction) { |
|
827 | 827 | /** @type EE_Registration_Processor $registration_processor */ |
828 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
828 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
829 | 829 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
830 | 830 | // now let's add the cart items to the $transaction |
831 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
831 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
832 | 832 | //do the following for each ticket of this type they selected |
833 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
833 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
834 | 834 | $att_nmbr++; |
835 | 835 | $registration = $registration_processor->generate_ONE_registration_from_line_item( |
836 | 836 | $line_item, |
@@ -838,12 +838,12 @@ discard block |
||
838 | 838 | $att_nmbr, |
839 | 839 | $this->checkout->total_ticket_count |
840 | 840 | ); |
841 | - if ( $registration instanceof EE_Registration ) { |
|
842 | - $registrations[ $registration->ID() ] = $registration; |
|
841 | + if ($registration instanceof EE_Registration) { |
|
842 | + $registrations[$registration->ID()] = $registration; |
|
843 | 843 | } |
844 | 844 | } |
845 | 845 | } |
846 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
846 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
847 | 847 | } |
848 | 848 | return $registrations; |
849 | 849 | } |
@@ -858,12 +858,12 @@ discard block |
||
858 | 858 | * @param EE_Registration $reg_B |
859 | 859 | * @return array() |
860 | 860 | */ |
861 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
861 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
862 | 862 | // this shouldn't ever happen within the same TXN, but oh well |
863 | - if ( $reg_A->count() == $reg_B->count() ) { |
|
863 | + if ($reg_A->count() == $reg_B->count()) { |
|
864 | 864 | return 0; |
865 | 865 | } |
866 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
866 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
867 | 867 | } |
868 | 868 | |
869 | 869 | |
@@ -878,35 +878,35 @@ discard block |
||
878 | 878 | */ |
879 | 879 | private function _final_verifications() { |
880 | 880 | // filter checkout |
881 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
881 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
882 | 882 | //verify that current step is still set correctly |
883 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
884 | - EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
883 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
884 | + EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
885 | 885 | return false; |
886 | 886 | } |
887 | 887 | // if returning to SPCO, then verify that primary registrant is set |
888 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
888 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
889 | 889 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
890 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
891 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
890 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
891 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
892 | 892 | return false; |
893 | 893 | } |
894 | 894 | $valid_registrant = null; |
895 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
896 | - if ( $registration instanceof EE_Registration ) { |
|
897 | - if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) { |
|
895 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
896 | + if ($registration instanceof EE_Registration) { |
|
897 | + if ($registration->reg_url_link() == $this->checkout->reg_url_link) { |
|
898 | 898 | $valid_registrant = $registration; |
899 | 899 | } |
900 | 900 | } |
901 | 901 | } |
902 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
903 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
902 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
903 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
904 | 904 | return false; |
905 | 905 | } |
906 | 906 | } |
907 | 907 | // now that things have been kinda sufficiently verified, |
908 | 908 | // let's add the checkout to the session so that's available other systems |
909 | - EE_Registry::instance()->SSN->set_checkout( $this->checkout ); |
|
909 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
910 | 910 | return true; |
911 | 911 | } |
912 | 912 | |
@@ -922,28 +922,28 @@ discard block |
||
922 | 922 | * @access private |
923 | 923 | * @param bool $reinitializing |
924 | 924 | */ |
925 | - private function _initialize_reg_steps( $reinitializing = false ) { |
|
926 | - $this->checkout->set_reg_step_initiated( $this->checkout->current_step ); |
|
925 | + private function _initialize_reg_steps($reinitializing = false) { |
|
926 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
927 | 927 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
928 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
929 | - if ( ! $reg_step->initialize_reg_step() ) { |
|
928 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
929 | + if ( ! $reg_step->initialize_reg_step()) { |
|
930 | 930 | // if not initialized then maybe this step is being removed... |
931 | - if ( $reg_step->is_current_step() && ! $reinitializing ) { |
|
931 | + if ($reg_step->is_current_step() && ! $reinitializing) { |
|
932 | 932 | // if it was the current step, then we need to start over here |
933 | - $this->_initialize_reg_steps( true ); |
|
933 | + $this->_initialize_reg_steps(true); |
|
934 | 934 | return; |
935 | 935 | } |
936 | 936 | continue; |
937 | 937 | } |
938 | 938 | // i18n |
939 | 939 | $reg_step->translate_js_strings(); |
940 | - if ( $reg_step->is_current_step() ) { |
|
940 | + if ($reg_step->is_current_step()) { |
|
941 | 941 | // the text that appears on the reg step form submit button |
942 | 942 | $reg_step->set_submit_button_text(); |
943 | 943 | } |
944 | 944 | } |
945 | 945 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
946 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
946 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
947 | 947 | } |
948 | 948 | |
949 | 949 | |
@@ -956,39 +956,39 @@ discard block |
||
956 | 956 | */ |
957 | 957 | private function _check_form_submission() { |
958 | 958 | //does this request require the reg form to be generated ? |
959 | - if ( $this->checkout->generate_reg_form ) { |
|
959 | + if ($this->checkout->generate_reg_form) { |
|
960 | 960 | // ever heard that song by Blue Rodeo ? |
961 | 961 | try { |
962 | 962 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
963 | 963 | // if not displaying a form, then check for form submission |
964 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
964 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
965 | 965 | // clear out any old data in case this step is being run again |
966 | - $this->checkout->current_step->set_valid_data( array() ); |
|
966 | + $this->checkout->current_step->set_valid_data(array()); |
|
967 | 967 | // capture submitted form data |
968 | 968 | $this->checkout->current_step->reg_form->receive_form_submission( |
969 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
969 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
970 | 970 | ); |
971 | 971 | // validate submitted form data |
972 | - if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) { |
|
972 | + if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) { |
|
973 | 973 | // thou shall not pass !!! |
974 | 974 | $this->checkout->continue_reg = FALSE; |
975 | 975 | // any form validation errors? |
976 | - if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) { |
|
976 | + if ($this->checkout->current_step->reg_form->submission_error_message() != '') { |
|
977 | 977 | $submission_error_messages = array(); |
978 | 978 | // bad, bad, bad registrant |
979 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
980 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
981 | - $submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() ); |
|
979 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
980 | + if ($validation_error instanceof EE_Validation_Error) { |
|
981 | + $submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage()); |
|
982 | 982 | } |
983 | 983 | } |
984 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
984 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
985 | 985 | } |
986 | 986 | // well not really... what will happen is we'll just get redirected back to redo the current step |
987 | 987 | $this->go_to_next_step(); |
988 | 988 | return; |
989 | 989 | } |
990 | 990 | } |
991 | - } catch( EE_Error $e ) { |
|
991 | + } catch (EE_Error $e) { |
|
992 | 992 | $e->get_error(); |
993 | 993 | } |
994 | 994 | } |
@@ -1004,38 +1004,38 @@ discard block |
||
1004 | 1004 | */ |
1005 | 1005 | private function _process_form_action() { |
1006 | 1006 | // what cha wanna do? |
1007 | - switch( $this->checkout->action ) { |
|
1007 | + switch ($this->checkout->action) { |
|
1008 | 1008 | // AJAX next step reg form |
1009 | 1009 | case 'display_spco_reg_step' : |
1010 | 1010 | $this->checkout->redirect = FALSE; |
1011 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1012 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
1011 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1012 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
1013 | 1013 | } |
1014 | 1014 | break; |
1015 | 1015 | |
1016 | 1016 | default : |
1017 | 1017 | // meh... do one of those other steps first |
1018 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
1018 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
1019 | 1019 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
1020 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1020 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1021 | 1021 | // call action on current step |
1022 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
1022 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
1023 | 1023 | // good registrant, you get to proceed |
1024 | - if ( $this->checkout->current_step->success_message() != '' ) { |
|
1025 | - if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) { |
|
1026 | - EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() ); |
|
1024 | + if ($this->checkout->current_step->success_message() != '') { |
|
1025 | + if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) { |
|
1026 | + EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions()); |
|
1027 | 1027 | } |
1028 | 1028 | } |
1029 | 1029 | // pack it up, pack it in... |
1030 | 1030 | $this->_setup_redirect(); |
1031 | 1031 | } |
1032 | 1032 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
1033 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1033 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1034 | 1034 | |
1035 | 1035 | } else { |
1036 | 1036 | EE_Error::add_error( |
1037 | 1037 | sprintf( |
1038 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1038 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1039 | 1039 | $this->checkout->action, |
1040 | 1040 | $this->checkout->current_step->name() |
1041 | 1041 | ), |
@@ -1061,10 +1061,10 @@ discard block |
||
1061 | 1061 | public function add_styles_and_scripts() { |
1062 | 1062 | // i18n |
1063 | 1063 | $this->translate_js_strings(); |
1064 | - if ( $this->checkout->admin_request ) { |
|
1065 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1064 | + if ($this->checkout->admin_request) { |
|
1065 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1066 | 1066 | } else { |
1067 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1067 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1068 | 1068 | } |
1069 | 1069 | } |
1070 | 1070 | |
@@ -1080,42 +1080,42 @@ discard block |
||
1080 | 1080 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1081 | 1081 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1082 | 1082 | EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
1083 | - EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1084 | - EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' ); |
|
1085 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1083 | + EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1084 | + EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso'); |
|
1085 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1086 | 1086 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1087 | 1087 | EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso'); |
1088 | - EE_Registry::$i18n_js_strings['process_registration'] = sprintf( __( 'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso' ), '<br/>', '<br/>' ); |
|
1089 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1088 | + EE_Registry::$i18n_js_strings['process_registration'] = sprintf(__('Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso'), '<br/>', '<br/>'); |
|
1089 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1090 | 1090 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1091 | 1091 | EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
1092 | 1092 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1093 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1094 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1095 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1096 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1097 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1098 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1099 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1100 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1101 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1102 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1103 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1104 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1105 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1106 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1093 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1094 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1095 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1096 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1097 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1098 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1099 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1100 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1101 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1102 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1103 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1104 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1105 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1106 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1107 | 1107 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1108 | - __( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ), |
|
1108 | + __('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'), |
|
1109 | 1109 | '<h4 class="important-notice">', |
1110 | 1110 | '</h4>', |
1111 | 1111 | '<br />', |
1112 | 1112 | '<p>', |
1113 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1113 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1114 | 1114 | '">', |
1115 | 1115 | '</a>', |
1116 | 1116 | '</p>' |
1117 | 1117 | ); |
1118 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1118 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1119 | 1119 | } |
1120 | 1120 | |
1121 | 1121 | |
@@ -1128,25 +1128,25 @@ discard block |
||
1128 | 1128 | */ |
1129 | 1129 | public function enqueue_styles_and_scripts() { |
1130 | 1130 | // load css |
1131 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1132 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1131 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1132 | + wp_enqueue_style('single_page_checkout'); |
|
1133 | 1133 | // load JS |
1134 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1135 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1136 | - wp_register_script( 'single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1137 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1134 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1135 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1136 | + wp_register_script('single_page_checkout', SPCO_JS_URL.'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1137 | + wp_enqueue_script('single_page_checkout'); |
|
1138 | 1138 | |
1139 | 1139 | /** |
1140 | 1140 | * global action hook for enqueueing styles and scripts with |
1141 | 1141 | * spco calls. |
1142 | 1142 | */ |
1143 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1143 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1144 | 1144 | |
1145 | 1145 | /** |
1146 | 1146 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1147 | 1147 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1148 | 1148 | */ |
1149 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1149 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1150 | 1150 | |
1151 | 1151 | // add css and JS for current step |
1152 | 1152 | $this->checkout->current_step->enqueue_styles_and_scripts(); |
@@ -1162,20 +1162,20 @@ discard block |
||
1162 | 1162 | */ |
1163 | 1163 | private function _display_spco_reg_form() { |
1164 | 1164 | // if registering via the admin, just display the reg form for the current step |
1165 | - if ( $this->checkout->admin_request ) { |
|
1166 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1165 | + if ($this->checkout->admin_request) { |
|
1166 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1167 | 1167 | } else { |
1168 | 1168 | // add powered by EE msg |
1169 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1169 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1170 | 1170 | |
1171 | - $empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false; |
|
1171 | + $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false; |
|
1172 | 1172 | $cookies_not_set_msg = ''; |
1173 | - if ( $empty_cart ) { |
|
1174 | - if ( ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) { |
|
1173 | + if ($empty_cart) { |
|
1174 | + if ( ! isset($_COOKIE['ee_cookie_test'])) { |
|
1175 | 1175 | $cookies_not_set_msg = apply_filters( |
1176 | 1176 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
1177 | 1177 | sprintf( |
1178 | - __( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ), |
|
1178 | + __('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'), |
|
1179 | 1179 | '<div class="ee-attention">', |
1180 | 1180 | '</div>', |
1181 | 1181 | '<h6 class="important-notice">', |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | 'layout_strategy' => |
1197 | 1197 | new EE_Template_Layout( |
1198 | 1198 | array( |
1199 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1199 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1200 | 1200 | 'template_args' => array( |
1201 | 1201 | 'empty_cart' => $empty_cart, |
1202 | 1202 | 'revisit' => $this->checkout->revisit, |
@@ -1205,8 +1205,8 @@ discard block |
||
1205 | 1205 | 'empty_msg' => apply_filters( |
1206 | 1206 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1207 | 1207 | sprintf( |
1208 | - __( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ), |
|
1209 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1208 | + __('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'), |
|
1209 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1210 | 1210 | '">', |
1211 | 1211 | '</a>' |
1212 | 1212 | ) |
@@ -1214,14 +1214,14 @@ discard block |
||
1214 | 1214 | 'cookies_not_set_msg' => $cookies_not_set_msg, |
1215 | 1215 | 'registration_time_limit' => $this->checkout->get_registration_time_limit(), |
1216 | 1216 | 'session_expiration' => |
1217 | - gmdate( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) |
|
1217 | + gmdate('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
1218 | 1218 | ) |
1219 | 1219 | ) |
1220 | 1220 | ) |
1221 | 1221 | ) |
1222 | 1222 | ); |
1223 | 1223 | // load template and add to output sent that gets filtered into the_content() |
1224 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1224 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1225 | 1225 | } |
1226 | 1226 | } |
1227 | 1227 | |
@@ -1235,8 +1235,8 @@ discard block |
||
1235 | 1235 | * @internal param string $label |
1236 | 1236 | * @return string |
1237 | 1237 | */ |
1238 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1239 | - if ( $next_step == 'finalize_registration' ) { |
|
1238 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1239 | + if ($next_step == 'finalize_registration') { |
|
1240 | 1240 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1241 | 1241 | } |
1242 | 1242 | } |
@@ -1250,18 +1250,18 @@ discard block |
||
1250 | 1250 | * @return string |
1251 | 1251 | */ |
1252 | 1252 | public static function display_registration_footer() { |
1253 | - if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) { |
|
1254 | - EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1255 | - $url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' ); |
|
1256 | - $url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1253 | + if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) { |
|
1254 | + EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1255 | + $url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/'); |
|
1256 | + $url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1257 | 1257 | echo apply_filters( |
1258 | 1258 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1259 | 1259 | sprintf( |
1260 | - __( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ), |
|
1261 | - '<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="', |
|
1260 | + __('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'), |
|
1261 | + '<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="', |
|
1262 | 1262 | '" target="_blank">', |
1263 | 1263 | '</a>', |
1264 | - '<a href="' . $url . '" title="', |
|
1264 | + '<a href="'.$url.'" title="', |
|
1265 | 1265 | '" target="_blank">', |
1266 | 1266 | '</a></div>' |
1267 | 1267 | ) |
@@ -1292,12 +1292,12 @@ discard block |
||
1292 | 1292 | * @return array |
1293 | 1293 | */ |
1294 | 1294 | private function _setup_redirect() { |
1295 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1295 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1296 | 1296 | $this->checkout->redirect = TRUE; |
1297 | - if ( empty( $this->checkout->redirect_url )) { |
|
1297 | + if (empty($this->checkout->redirect_url)) { |
|
1298 | 1298 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1299 | 1299 | } |
1300 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1300 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1301 | 1301 | } |
1302 | 1302 | } |
1303 | 1303 | |
@@ -1310,12 +1310,12 @@ discard block |
||
1310 | 1310 | * @return void |
1311 | 1311 | */ |
1312 | 1312 | public function go_to_next_step() { |
1313 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1313 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1314 | 1314 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1315 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1315 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1316 | 1316 | } |
1317 | 1317 | // just return for these conditions |
1318 | - if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout' ) { |
|
1318 | + if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout') { |
|
1319 | 1319 | return; |
1320 | 1320 | } |
1321 | 1321 | // AJAX response |
@@ -1336,7 +1336,7 @@ discard block |
||
1336 | 1336 | */ |
1337 | 1337 | protected function _handle_json_response() { |
1338 | 1338 | // if this is an ajax request |
1339 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1339 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1340 | 1340 | // DEBUG LOG |
1341 | 1341 | //$this->checkout->log( |
1342 | 1342 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1346,10 +1346,10 @@ discard block |
||
1346 | 1346 | // 'continue_reg' => $this->checkout->continue_reg, |
1347 | 1347 | // ) |
1348 | 1348 | //); |
1349 | - $this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() ); |
|
1350 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1349 | + $this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit()); |
|
1350 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1351 | 1351 | // just send the ajax ( |
1352 | - $json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response ); |
|
1352 | + $json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response); |
|
1353 | 1353 | $this->unlock_transaction(); |
1354 | 1354 | echo $json_response; |
1355 | 1355 | exit(); |
@@ -1366,9 +1366,9 @@ discard block |
||
1366 | 1366 | */ |
1367 | 1367 | protected function _handle_html_redirects() { |
1368 | 1368 | // going somewhere ? |
1369 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1369 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1370 | 1370 | // store notices in a transient |
1371 | - EE_Error::get_notices( false, true, true ); |
|
1371 | + EE_Error::get_notices(false, true, true); |
|
1372 | 1372 | $this->unlock_transaction(); |
1373 | 1373 | // DEBUG LOG |
1374 | 1374 | //$this->checkout->log( |
@@ -1379,7 +1379,7 @@ discard block |
||
1379 | 1379 | // 'headers_list' => headers_list(), |
1380 | 1380 | // ) |
1381 | 1381 | //); |
1382 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1382 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1383 | 1383 | exit(); |
1384 | 1384 | } |
1385 | 1385 | } |
@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | /** |
6 | 7 | * Event Espresso |
7 | 8 | * |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_PMT_Bank extends EE_PMT_Base{ |
|
28 | +class EE_PMT_Bank extends EE_PMT_Base { |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $this->_pretty_name = __("Bank", 'event_espresso'); |
39 | 39 | parent::__construct($pm_instance); |
40 | 40 | $this->_default_button_url = $this->file_url().'lib'.DS.'bank-logo.png'; |
41 | - $this->_default_description = __( 'Make payment using an electronic funds transfer from your bank.', 'event_espresso' ); |
|
41 | + $this->_default_description = __('Make payment using an electronic funds transfer from your bank.', 'event_espresso'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param \EE_Transaction $transaction |
49 | 49 | * @return NULL |
50 | 50 | */ |
51 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
51 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
52 | 52 | return NULL; |
53 | 53 | } |
54 | 54 | |
@@ -62,17 +62,17 @@ discard block |
||
62 | 62 | return new EE_Payment_Method_Form(array( |
63 | 63 | 'extra_meta_inputs'=>array( |
64 | 64 | 'page_title'=>new EE_Text_Input(array( |
65 | - 'html_label_text'=> sprintf(__("Title %s", "event_espresso"), $this->get_help_tab_link()), |
|
65 | + 'html_label_text'=> sprintf(__("Title %s", "event_espresso"), $this->get_help_tab_link()), |
|
66 | 66 | 'default'=> __("Electronic Funds Transfers", 'event_espresso') |
67 | 67 | )), |
68 | - 'payment_instructions'=>new EE_Text_Area_Input( array( |
|
69 | - 'html_label_text'=> sprintf(__("Payment Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
70 | - 'html_help_text' => __( 'Provide instructions on how registrants can send the bank draft payment. Eg, mention your account name, bank account number, bank name, bank routing code, and bank address, etc.', 'event_espresso' ), |
|
68 | + 'payment_instructions'=>new EE_Text_Area_Input(array( |
|
69 | + 'html_label_text'=> sprintf(__("Payment Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
70 | + 'html_help_text' => __('Provide instructions on how registrants can send the bank draft payment. Eg, mention your account name, bank account number, bank name, bank routing code, and bank address, etc.', 'event_espresso'), |
|
71 | 71 | 'default'=> sprintf( |
72 | 72 | __('Please initiate an electronic payment using the following bank information: %1$sAccount Owner: Luke Skywalker%1$sBank Account # 1234567890%1$sBank Name: Rebellion Bank%1$sRouting Number: 12345%1$sBank Address: 12345 Wookie Rd., Planet Corellian.%1$sPayment must be received within 48 hours of event date.', 'event_espresso'), |
73 | 73 | "\n" |
74 | 74 | ), |
75 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
75 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
76 | 76 | )), |
77 | 77 | ), |
78 | 78 | 'exclude'=>array('PMD_debug_mode') |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @see EE_PMT_Base::help_tabs_config() |
87 | 87 | * @return array |
88 | 88 | */ |
89 | - public function help_tabs_config(){ |
|
89 | + public function help_tabs_config() { |
|
90 | 90 | return array( |
91 | 91 | $this->get_help_tab_name() => array( |
92 | 92 | 'title' => __('Bank Draft Settings', 'event_espresso'), |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * Other gateways may want to override this, such as offline gateways. |
104 | 104 | * @return string |
105 | 105 | */ |
106 | - public function payment_overview_content(EE_Payment $payment){ |
|
106 | + public function payment_overview_content(EE_Payment $payment) { |
|
107 | 107 | EE_Registry::instance()->load_helper('Template'); |
108 | 108 | $extra_meta_for_payment_method = $this->_pm_instance->all_extra_meta_array(); |
109 | 109 | $template_vars = array_merge( |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | ), |
116 | 116 | $extra_meta_for_payment_method); |
117 | 117 | return EEH_Template::locate_template( |
118 | - 'payment_methods' . DS . 'Bank'. DS . 'templates' . DS . 'bank_payment_details_content.template.php', |
|
118 | + 'payment_methods'.DS.'Bank'.DS.'templates'.DS.'bank_payment_details_content.template.php', |
|
119 | 119 | $template_vars); |
120 | 120 | } |
121 | 121 |
@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | /** |
6 | 7 | * Event Espresso |
7 | 8 | * |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_PMT_Invoice extends EE_PMT_Base{ |
|
28 | +class EE_PMT_Invoice extends EE_PMT_Base { |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function __construct($pm_instance = NULL) { |
38 | 38 | $this->_pretty_name = __("Invoice", 'event_espresso'); |
39 | - $this->_default_description = __( 'After clicking "Finalize Registration", you will be given instructions on how to access your invoice and complete your payment.', 'event_espresso' ); |
|
39 | + $this->_default_description = __('After clicking "Finalize Registration", you will be given instructions on how to access your invoice and complete your payment.', 'event_espresso'); |
|
40 | 40 | parent::__construct($pm_instance); |
41 | 41 | $this->_default_button_url = $this->file_url().'lib'.DS.'invoice-logo.png'; |
42 | 42 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param \EE_Transaction $transaction |
49 | 49 | * @return NULL |
50 | 50 | */ |
51 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
51 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
52 | 52 | return NULL; |
53 | 53 | } |
54 | 54 | |
@@ -61,53 +61,53 @@ discard block |
||
61 | 61 | public function generate_new_settings_form() { |
62 | 62 | $pdf_payee_input_name = 'pdf_payee_name'; |
63 | 63 | $confirmation_text_input_name = 'page_confirmation_text'; |
64 | - $form = new EE_Payment_Method_Form(array( |
|
64 | + $form = new EE_Payment_Method_Form(array( |
|
65 | 65 | // 'payment_method_type' => $this, |
66 | 66 | 'extra_meta_inputs'=>array( |
67 | 67 | $pdf_payee_input_name => new EE_Text_Input(array( |
68 | - 'html_label_text' => sprintf( __( 'Payee Name %s', 'event_espresso' ), $this->get_help_tab_link()) |
|
68 | + 'html_label_text' => sprintf(__('Payee Name %s', 'event_espresso'), $this->get_help_tab_link()) |
|
69 | 69 | )), |
70 | 70 | 'pdf_payee_email' => new EE_Email_Input(array( |
71 | - 'html_label_text' => sprintf( __( 'Payee Email %s', 'event_espresso' ), $this->get_help_tab_link()), |
|
71 | + 'html_label_text' => sprintf(__('Payee Email %s', 'event_espresso'), $this->get_help_tab_link()), |
|
72 | 72 | )), |
73 | 73 | 'pdf_payee_tax_number' => new EE_Text_Input(array( |
74 | - 'html_label_text' => sprintf( __( 'Payee Tax Number %s', 'event_espresso' ), $this->get_help_tab_link()), |
|
74 | + 'html_label_text' => sprintf(__('Payee Tax Number %s', 'event_espresso'), $this->get_help_tab_link()), |
|
75 | 75 | )), |
76 | - 'pdf_payee_address' => new EE_Text_Area_Input( array( |
|
77 | - 'html_label_text' => sprintf( __( 'Payee Address %s', 'event_espresso' ), $this->get_help_tab_link() ), |
|
78 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
76 | + 'pdf_payee_address' => new EE_Text_Area_Input(array( |
|
77 | + 'html_label_text' => sprintf(__('Payee Address %s', 'event_espresso'), $this->get_help_tab_link()), |
|
78 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
79 | 79 | )), |
80 | 80 | 'pdf_instructions'=>new EE_Text_Area_Input(array( |
81 | - 'html_label_text'=> sprintf(__("Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
81 | + 'html_label_text'=> sprintf(__("Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
82 | 82 | 'default'=> __("Please send this invoice with payment attached to the address above, or use the payment link below. Payment must be received within 48 hours of event date.", 'event_espresso'), |
83 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
83 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
84 | 84 | )), |
85 | 85 | 'pdf_logo_image'=>new EE_Admin_File_Uploader_Input(array( |
86 | - 'html_label_text'=> sprintf(__("Logo Image %s", "event_espresso"), $this->get_help_tab_link()), |
|
86 | + 'html_label_text'=> sprintf(__("Logo Image %s", "event_espresso"), $this->get_help_tab_link()), |
|
87 | 87 | 'default'=> EE_Config::instance()->organization->logo_url, |
88 | 88 | 'html_help_text'=> __("(Logo for the top left of the invoice)", 'event_espresso'), |
89 | 89 | )), |
90 | 90 | $confirmation_text_input_name =>new EE_Text_Area_Input(array( |
91 | - 'html_label_text'=> sprintf(__("Confirmation Text %s", "event_espresso"), $this->get_help_tab_link()), |
|
91 | + 'html_label_text'=> sprintf(__("Confirmation Text %s", "event_espresso"), $this->get_help_tab_link()), |
|
92 | 92 | 'default'=> __("Payment must be received within 48 hours of event date. Details about where to send payment is included on the invoice.", 'event_espresso'), |
93 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
93 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
94 | 94 | )), |
95 | 95 | 'page_extra_info'=>new EE_Text_Area_Input(array( |
96 | - 'html_label_text'=> sprintf(__("Extra Info %s", "event_espresso"), $this->get_help_tab_link()), |
|
97 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
96 | + 'html_label_text'=> sprintf(__("Extra Info %s", "event_espresso"), $this->get_help_tab_link()), |
|
97 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
98 | 98 | )), |
99 | 99 | ), |
100 | 100 | 'include'=>array( |
101 | - 'PMD_ID', 'PMD_name','PMD_desc','PMD_admin_name','PMD_admin_desc', 'PMD_type','PMD_slug', 'PMD_open_by_default','PMD_button_url','PMD_scope','Currency','PMD_order', |
|
102 | - $pdf_payee_input_name, 'pdf_payee_email', 'pdf_payee_tax_number', 'pdf_payee_address', 'pdf_instructions','pdf_logo_image', |
|
101 | + 'PMD_ID', 'PMD_name', 'PMD_desc', 'PMD_admin_name', 'PMD_admin_desc', 'PMD_type', 'PMD_slug', 'PMD_open_by_default', 'PMD_button_url', 'PMD_scope', 'Currency', 'PMD_order', |
|
102 | + $pdf_payee_input_name, 'pdf_payee_email', 'pdf_payee_tax_number', 'pdf_payee_address', 'pdf_instructions', 'pdf_logo_image', |
|
103 | 103 | $confirmation_text_input_name, 'page_extra_info'), |
104 | 104 | )); |
105 | 105 | $form->add_subsections( |
106 | - array( 'header1' => new EE_Form_Section_HTML_From_Template( 'payment_methods/Invoice/templates/invoice_settings_header_display.template.php' )), |
|
106 | + array('header1' => new EE_Form_Section_HTML_From_Template('payment_methods/Invoice/templates/invoice_settings_header_display.template.php')), |
|
107 | 107 | $pdf_payee_input_name |
108 | 108 | ); |
109 | 109 | $form->add_subsections( |
110 | - array( 'header2'=>new EE_Form_Section_HTML_From_Template( 'payment_methods/Invoice/templates/invoice_settings_header_gateway.template.php' )), |
|
110 | + array('header2'=>new EE_Form_Section_HTML_From_Template('payment_methods/Invoice/templates/invoice_settings_header_gateway.template.php')), |
|
111 | 111 | $confirmation_text_input_name |
112 | 112 | ); |
113 | 113 | return $form; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @see EE_PMT_Base::help_tabs_config() |
121 | 121 | * @return array |
122 | 122 | */ |
123 | - public function help_tabs_config(){ |
|
123 | + public function help_tabs_config() { |
|
124 | 124 | return array( |
125 | 125 | $this->get_help_tab_name() => array( |
126 | 126 | 'title' => __('Invoice Settings', 'event_espresso'), |
@@ -138,17 +138,17 @@ discard block |
||
138 | 138 | * @param \EE_Payment $payment |
139 | 139 | * @return string |
140 | 140 | */ |
141 | - public function payment_overview_content( EE_Payment $payment ){ |
|
141 | + public function payment_overview_content(EE_Payment $payment) { |
|
142 | 142 | EE_Registry::instance()->load_helper('Template'); |
143 | 143 | return EEH_Template::locate_template( |
144 | - 'payment_methods' . DS . 'Invoice'. DS . 'templates'.DS.'invoice_payment_details_content.template.php', |
|
144 | + 'payment_methods'.DS.'Invoice'.DS.'templates'.DS.'invoice_payment_details_content.template.php', |
|
145 | 145 | array_merge( |
146 | 146 | array( |
147 | 147 | 'payment_method' => $this->_pm_instance, |
148 | 148 | 'payment' => $payment, |
149 | 149 | 'page_confirmation_text' => '', |
150 | 150 | 'page_extra_info' => '', |
151 | - 'invoice_url' => $payment->transaction()->primary_registration()->invoice_url( 'html' ) |
|
151 | + 'invoice_url' => $payment->transaction()->primary_registration()->invoice_url('html') |
|
152 | 152 | ), |
153 | 153 | $this->_pm_instance->all_extra_meta_array() |
154 | 154 | ) |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -51,17 +51,17 @@ discard block |
||
51 | 51 | * @param WP $WP |
52 | 52 | * @return void |
53 | 53 | */ |
54 | - public function run( WP $WP ) { |
|
55 | - if ( did_action( 'pre_get_posts' ) && did_action( 'send_headers' ) ) { |
|
54 | + public function run(WP $WP) { |
|
55 | + if (did_action('pre_get_posts') && did_action('send_headers')) { |
|
56 | 56 | global $wp_query; |
57 | 57 | EED_Single_Page_Checkout::load_reg_steps(); |
58 | - EED_Single_Page_Checkout::init( $wp_query ); |
|
58 | + EED_Single_Page_Checkout::init($wp_query); |
|
59 | 59 | } else { |
60 | 60 | // hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called |
61 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
61 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
62 | 62 | // this will trigger the EED_Single_Page_Checkout module's run() method during the pre_get_posts hook point, |
63 | 63 | // this allows us to initialize things, enqueue assets, etc, |
64 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'init' ), 10, 1 ); |
|
64 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'init'), 10, 1); |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param array $attributes |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - public function process_shortcode( $attributes = array() ) { |
|
77 | + public function process_shortcode($attributes = array()) { |
|
78 | 78 | return EE_Registry::instance()->REQ->get_output(); |
79 | 79 | } |
80 | 80 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @return void |
92 | 92 | */ |
93 | 93 | public static function set_hooks() { |
94 | - add_action( 'wp_loaded', array( 'EES_Espresso_Thank_You', 'set_definitions' ), 2 ); |
|
94 | + add_action('wp_loaded', array('EES_Espresso_Thank_You', 'set_definitions'), 2); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public static function set_hooks_admin() { |
104 | 104 | // AJAX for IPN monitoring |
105 | - add_filter( 'heartbeat_received', array( 'EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor' ), 10, 3 ); |
|
106 | - add_filter( 'heartbeat_nopriv_received', array( 'EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor' ), 10, 3 ); |
|
107 | - add_action( 'wp_ajax_espresso_resend_reg_confirmation_email', array( 'EES_Espresso_Thank_You', 'resend_reg_confirmation_email' ), 10, 2 ); |
|
108 | - add_action( 'wp_ajax_nopriv_espresso_resend_reg_confirmation_email', array( 'EES_Espresso_Thank_You', 'resend_reg_confirmation_email' ), 10, 2 ); |
|
105 | + add_filter('heartbeat_received', array('EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor'), 10, 3); |
|
106 | + add_filter('heartbeat_nopriv_received', array('EES_Espresso_Thank_You', 'thank_you_page_IPN_monitor'), 10, 3); |
|
107 | + add_action('wp_ajax_espresso_resend_reg_confirmation_email', array('EES_Espresso_Thank_You', 'resend_reg_confirmation_email'), 10, 2); |
|
108 | + add_action('wp_ajax_nopriv_espresso_resend_reg_confirmation_email', array('EES_Espresso_Thank_You', 'resend_reg_confirmation_email'), 10, 2); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | * @return void |
118 | 118 | */ |
119 | 119 | public static function set_definitions() { |
120 | - define( 'THANK_YOU_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
121 | - define( 'THANK_YOU_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
120 | + define('THANK_YOU_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
121 | + define('THANK_YOU_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | |
@@ -130,23 +130,23 @@ discard block |
||
130 | 130 | * @return EE_Transaction |
131 | 131 | */ |
132 | 132 | public function get_txn() { |
133 | - if ( $this->_current_txn instanceof EE_Transaction ) { |
|
133 | + if ($this->_current_txn instanceof EE_Transaction) { |
|
134 | 134 | return $this->_current_txn; |
135 | 135 | } |
136 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
137 | - if ( ! $TXN_model instanceof EEM_Transaction ) { |
|
136 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
137 | + if ( ! $TXN_model instanceof EEM_Transaction) { |
|
138 | 138 | EE_Error::add_error( |
139 | - __( 'The transaction model could not be established.', 'event_espresso' ), |
|
139 | + __('The transaction model could not be established.', 'event_espresso'), |
|
140 | 140 | __FILE__, __FUNCTION__, __LINE__ |
141 | 141 | ); |
142 | 142 | return NULL; |
143 | 143 | } |
144 | 144 | //get the transaction. yes, we may have just loaded it, but it may have been updated, or this may be via an ajax request |
145 | - $this->_current_txn = $TXN_model->get_transaction_from_reg_url_link( $this->_reg_url_link ); |
|
145 | + $this->_current_txn = $TXN_model->get_transaction_from_reg_url_link($this->_reg_url_link); |
|
146 | 146 | // verify TXN |
147 | - if ( WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction ) { |
|
147 | + if (WP_DEBUG && ! $this->_current_txn instanceof EE_Transaction) { |
|
148 | 148 | EE_Error::add_error( |
149 | - __( 'No transaction information could be retrieved or the transaction data is not of the correct type.', 'event_espresso' ), |
|
149 | + __('No transaction information could be retrieved or the transaction data is not of the correct type.', 'event_espresso'), |
|
150 | 150 | __FILE__, __FUNCTION__, __LINE__ |
151 | 151 | ); |
152 | 152 | return NULL; |
@@ -163,16 +163,16 @@ discard block |
||
163 | 163 | * @param int $since |
164 | 164 | * @return mixed array of EE_Payment || FALSE |
165 | 165 | */ |
166 | - public function get_txn_payments( $since = 0 ) { |
|
167 | - if ( ! $this->get_txn() ) { |
|
166 | + public function get_txn_payments($since = 0) { |
|
167 | + if ( ! $this->get_txn()) { |
|
168 | 168 | return FALSE; |
169 | 169 | } |
170 | - $args = array( 'order_by' => array( 'PAY_timestamp' => 'ASC' )); |
|
171 | - if ( $since > 0 ) { |
|
172 | - $args[0] = array( 'PAY_timestamp' => array( '>', $since )); |
|
170 | + $args = array('order_by' => array('PAY_timestamp' => 'ASC')); |
|
171 | + if ($since > 0) { |
|
172 | + $args[0] = array('PAY_timestamp' => array('>', $since)); |
|
173 | 173 | } |
174 | 174 | // get array of payments with most recent first |
175 | - $payments = $this->_current_txn->payments( $args ); |
|
175 | + $payments = $this->_current_txn->payments($args); |
|
176 | 176 | // global $wpdb; |
177 | 177 | // echo $wpdb->last_query; |
178 | 178 | // EEH_Debug_Tools::printr( $payments, '$payments <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
@@ -188,19 +188,19 @@ discard block |
||
188 | 188 | * @return void |
189 | 189 | */ |
190 | 190 | private function _get_reg_url_link() { |
191 | - if ( ! empty( $this->_reg_url_link )) { |
|
191 | + if ( ! empty($this->_reg_url_link)) { |
|
192 | 192 | return; |
193 | 193 | } |
194 | 194 | // only do thank you page stuff if we have a REG_url_link in the url |
195 | - if ( WP_DEBUG && ! EE_Registry::instance()->REQ->is_set( 'e_reg_url_link' )) { |
|
195 | + if (WP_DEBUG && ! EE_Registry::instance()->REQ->is_set('e_reg_url_link')) { |
|
196 | 196 | EE_Error::add_error( |
197 | - __( 'No transaction information could be retrieved because the registration URL link is missing or invalid.', 'event_espresso' ), |
|
197 | + __('No transaction information could be retrieved because the registration URL link is missing or invalid.', 'event_espresso'), |
|
198 | 198 | __FILE__, __FUNCTION__, __LINE__ |
199 | 199 | ); |
200 | 200 | return; |
201 | 201 | } |
202 | 202 | // check for reg_url_link |
203 | - $this->_reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link' ); |
|
203 | + $this->_reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link'); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | * @param string $reg_url_link |
213 | 213 | * @return string |
214 | 214 | */ |
215 | - public function set_reg_url_link( $reg_url_link = NULL ) { |
|
216 | - $this->_reg_url_link = ! empty( $reg_url_link ) ? $reg_url_link : $this->_reg_url_link; |
|
215 | + public function set_reg_url_link($reg_url_link = NULL) { |
|
216 | + $this->_reg_url_link = ! empty($reg_url_link) ? $reg_url_link : $this->_reg_url_link; |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | |
@@ -226,25 +226,25 @@ discard block |
||
226 | 226 | * @param WP $WP |
227 | 227 | * @return void |
228 | 228 | */ |
229 | - public function run( WP $WP ) { |
|
229 | + public function run(WP $WP) { |
|
230 | 230 | // remove site_url() from thank you page URL |
231 | - $thank_you_page_URL = substr( EE_Registry::instance()->CFG->core->thank_you_page_url(), strlen( home_url() ) ); |
|
231 | + $thank_you_page_URL = substr(EE_Registry::instance()->CFG->core->thank_you_page_url(), strlen(home_url())); |
|
232 | 232 | // remove other non-essential details from URL |
233 | - $thank_you_page_URL = trim( parse_url( $thank_you_page_URL, PHP_URL_PATH ), '/' ); |
|
233 | + $thank_you_page_URL = trim(parse_url($thank_you_page_URL, PHP_URL_PATH), '/'); |
|
234 | 234 | // ensure this shortcode doesn't trigger on anything BUT the thank you page |
235 | - if ( isset( $WP->request ) && trim( $WP->request, '/' ) != $thank_you_page_URL ) { |
|
235 | + if (isset($WP->request) && trim($WP->request, '/') != $thank_you_page_URL) { |
|
236 | 236 | return; |
237 | - } else if ( isset( $WP->query_vars['page_id'] ) && $WP->query_vars['page_id'] != EE_Registry::instance()->CFG->core->thank_you_page_id ) { |
|
237 | + } else if (isset($WP->query_vars['page_id']) && $WP->query_vars['page_id'] != EE_Registry::instance()->CFG->core->thank_you_page_id) { |
|
238 | 238 | return; |
239 | 239 | } |
240 | 240 | $this->_get_reg_url_link(); |
241 | 241 | // resend_reg_confirmation_email ? |
242 | - if ( EE_Registry::instance()->REQ->is_set( 'resend' )) { |
|
242 | + if (EE_Registry::instance()->REQ->is_set('resend')) { |
|
243 | 243 | EES_Espresso_Thank_You::resend_reg_confirmation_email(); |
244 | 244 | } |
245 | 245 | // load assets |
246 | - add_action( 'wp_enqueue_scripts', array( $this, 'load_js' ), 10 ); |
|
247 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
246 | + add_action('wp_enqueue_scripts', array($this, 'load_js'), 10); |
|
247 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
248 | 248 | $this->_translate_strings(); |
249 | 249 | } |
250 | 250 | |
@@ -257,18 +257,18 @@ discard block |
||
257 | 257 | * @return void |
258 | 258 | */ |
259 | 259 | protected function _translate_strings() { |
260 | - EE_Registry::$i18n_js_strings[ 'e_reg_url_link' ] = $this->_reg_url_link; |
|
261 | - EE_Registry::$i18n_js_strings[ 'initial_access' ] = time(); |
|
262 | - EE_Registry::$i18n_js_strings[ 'IPN_wait_time' ] = EES_Espresso_Thank_You::IPN_wait_time; |
|
263 | - EE_Registry::$i18n_js_strings[ 'TXN_complete' ] = EEM_Transaction::complete_status_code; |
|
264 | - EE_Registry::$i18n_js_strings[ 'TXN_incomplete' ] = EEM_Transaction::incomplete_status_code; |
|
265 | - EE_Registry::$i18n_js_strings[ 'checking_for_new_payments' ] = __( 'checking for new payments...', 'event_espresso' ); |
|
266 | - EE_Registry::$i18n_js_strings[ 'loading_payment_info' ] = __( 'loading payment information...', 'event_espresso' ); |
|
267 | - EE_Registry::$i18n_js_strings[ 'server_error' ] = __( 'An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again.', 'event_espresso' ); |
|
268 | - EE_Registry::$i18n_js_strings[ 'slow_IPN' ] = apply_filters( |
|
260 | + EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->_reg_url_link; |
|
261 | + EE_Registry::$i18n_js_strings['initial_access'] = time(); |
|
262 | + EE_Registry::$i18n_js_strings['IPN_wait_time'] = EES_Espresso_Thank_You::IPN_wait_time; |
|
263 | + EE_Registry::$i18n_js_strings['TXN_complete'] = EEM_Transaction::complete_status_code; |
|
264 | + EE_Registry::$i18n_js_strings['TXN_incomplete'] = EEM_Transaction::incomplete_status_code; |
|
265 | + EE_Registry::$i18n_js_strings['checking_for_new_payments'] = __('checking for new payments...', 'event_espresso'); |
|
266 | + EE_Registry::$i18n_js_strings['loading_payment_info'] = __('loading payment information...', 'event_espresso'); |
|
267 | + EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again.', 'event_espresso'); |
|
268 | + EE_Registry::$i18n_js_strings['slow_IPN'] = apply_filters( |
|
269 | 269 | 'EES_Espresso_Thank_You__load_js__slow_IPN', |
270 | 270 | sprintf( |
271 | - __( '%sThe Payment Notification appears to be taking longer than usual to arrive. Maybe check back later or just wait for your payment and registration confirmation results to be sent to you via email. We apologize for any inconvenience this may have caused.%s', 'event_espresso' ), |
|
271 | + __('%sThe Payment Notification appears to be taking longer than usual to arrive. Maybe check back later or just wait for your payment and registration confirmation results to be sent to you via email. We apologize for any inconvenience this may have caused.%s', 'event_espresso'), |
|
272 | 272 | '<div id="espresso-thank-you-page-slow-IPN-dv" class="ee-attention jst-left">', |
273 | 273 | '</div>' |
274 | 274 | ) |
@@ -285,8 +285,8 @@ discard block |
||
285 | 285 | * @return void |
286 | 286 | */ |
287 | 287 | public function load_js() { |
288 | - wp_register_script( 'thank_you_page', THANK_YOU_ASSETS_URL . 'thank_you_page.js', array( 'espresso_core', 'heartbeat' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
289 | - wp_enqueue_script( 'thank_you_page' ); |
|
288 | + wp_register_script('thank_you_page', THANK_YOU_ASSETS_URL.'thank_you_page.js', array('espresso_core', 'heartbeat'), EVENT_ESPRESSO_VERSION, TRUE); |
|
289 | + wp_enqueue_script('thank_you_page'); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | |
@@ -299,13 +299,13 @@ discard block |
||
299 | 299 | */ |
300 | 300 | public function init() { |
301 | 301 | $this->_get_reg_url_link(); |
302 | - if ( ! $this->get_txn() ) { |
|
303 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
302 | + if ( ! $this->get_txn()) { |
|
303 | + EE_Registry::instance()->load_helper('HTML'); |
|
304 | 304 | |
305 | 305 | echo EEH_HTML::div( |
306 | - EEH_HTML::h4( __( 'We\'re sorry...', 'event_espresso' ), '', '' ) . |
|
306 | + EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', ''). |
|
307 | 307 | sprintf( |
308 | - __( 'This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s', 'event_espresso' ), |
|
308 | + __('This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s', 'event_espresso'), |
|
309 | 309 | '<br/>' |
310 | 310 | ), |
311 | 311 | '', 'ee-attention' |
@@ -313,22 +313,22 @@ discard block |
||
313 | 313 | return NULL; |
314 | 314 | } |
315 | 315 | // if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete" |
316 | - if ( $this->_current_txn->status_ID() == EEM_Transaction::failed_status_code ) { |
|
317 | - $this->_current_txn->set_status( EEM_Transaction::incomplete_status_code ); |
|
316 | + if ($this->_current_txn->status_ID() == EEM_Transaction::failed_status_code) { |
|
317 | + $this->_current_txn->set_status(EEM_Transaction::incomplete_status_code); |
|
318 | 318 | $this->_current_txn->save(); |
319 | 319 | } |
320 | 320 | $this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration ? $this->_current_txn->primary_registration() : NULL; |
321 | 321 | $this->_is_primary = $this->_primary_registrant->reg_url_link() == $this->_reg_url_link ? TRUE : FALSE; |
322 | 322 | |
323 | - $show_try_pay_again_link_default = apply_filters( 'AFEE__EES_Espresso_Thank_You__init__show_try_pay_again_link_default', TRUE ); |
|
323 | + $show_try_pay_again_link_default = apply_filters('AFEE__EES_Espresso_Thank_You__init__show_try_pay_again_link_default', TRUE); |
|
324 | 324 | // txn status ? |
325 | - if( $this->_current_txn->is_completed() ){ |
|
325 | + if ($this->_current_txn->is_completed()) { |
|
326 | 326 | $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
327 | - } else if ( $this->_current_txn->is_incomplete() && ( $this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment() )){ |
|
327 | + } else if ($this->_current_txn->is_incomplete() && ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment())) { |
|
328 | 328 | $this->_show_try_pay_again_link = TRUE; |
329 | - } else if ( $this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment() ) { |
|
329 | + } else if ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) { |
|
330 | 330 | // its pending |
331 | - $this->_show_try_pay_again_link = isset( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) && EE_Registry::instance()->CFG->registration->show_pending_payment_options ? TRUE : $show_try_pay_again_link_default; |
|
331 | + $this->_show_try_pay_again_link = isset(EE_Registry::instance()->CFG->registration->show_pending_payment_options) && EE_Registry::instance()->CFG->registration->show_pending_payment_options ? TRUE : $show_try_pay_again_link_default; |
|
332 | 332 | } else { |
333 | 333 | $this->_show_try_pay_again_link = $show_try_pay_again_link_default; |
334 | 334 | } |
@@ -350,18 +350,18 @@ discard block |
||
350 | 350 | } |
351 | 351 | // link to SPCO |
352 | 352 | $revisit_spco_url = add_query_arg( |
353 | - array( 'ee'=>'_register', 'revisit'=>TRUE, 'e_reg_url_link'=>$this->_reg_url_link ), |
|
353 | + array('ee'=>'_register', 'revisit'=>TRUE, 'e_reg_url_link'=>$this->_reg_url_link), |
|
354 | 354 | EE_Registry::instance()->CFG->core->reg_page_url() |
355 | 355 | ); |
356 | 356 | // link to SPCO payment_options |
357 | - $this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration ? $this->_primary_registrant->payment_overview_url() : add_query_arg( array('step'=>'payment_options' ), $revisit_spco_url ); |
|
357 | + $this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration ? $this->_primary_registrant->payment_overview_url() : add_query_arg(array('step'=>'payment_options'), $revisit_spco_url); |
|
358 | 358 | // link to SPCO attendee_information |
359 | 359 | $this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration ? $this->_primary_registrant->edit_attendee_information_url() : FALSE; |
360 | 360 | |
361 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
362 | - EE_Registry::instance()->load_helper( 'Template_Validator' ); |
|
361 | + EE_Registry::instance()->load_helper('Template'); |
|
362 | + EE_Registry::instance()->load_helper('Template_Validator'); |
|
363 | 363 | |
364 | - do_action( 'AHEE__EES_Espresso_Thank_You__init_end', $this->_current_txn ); |
|
364 | + do_action('AHEE__EES_Espresso_Thank_You__init_end', $this->_current_txn); |
|
365 | 365 | // set no cache headers and constants |
366 | 366 | EE_System::do_not_cache(); |
367 | 367 | |
@@ -377,31 +377,31 @@ discard block |
||
377 | 377 | * @param array $attributes |
378 | 378 | * @return string |
379 | 379 | */ |
380 | - public function process_shortcode( $attributes = array() ) { |
|
380 | + public function process_shortcode($attributes = array()) { |
|
381 | 381 | |
382 | 382 | $this->init(); |
383 | 383 | |
384 | - if ( ! $this->_current_txn instanceof EE_Transaction ) { |
|
384 | + if ( ! $this->_current_txn instanceof EE_Transaction) { |
|
385 | 385 | return EE_Error::get_notices(); |
386 | 386 | } |
387 | 387 | //EE_Registry::instance()->load_helper( 'Debug_Tools' ); |
388 | 388 | //EEH_Debug_Tools::log( __CLASS__, __FUNCTION__, __LINE__, array( $this->_current_txn ), true, 'EE_Transaction: ' . $this->_current_txn->ID() ); |
389 | 389 | // link to receipt |
390 | - $template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url( 'html' ); |
|
391 | - if ( ! empty( $template_args['TXN_receipt_url'] )) { |
|
392 | - $template_args['order_conf_desc'] = __( '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.', 'event_espresso' ); |
|
390 | + $template_args['TXN_receipt_url'] = $this->_current_txn->receipt_url('html'); |
|
391 | + if ( ! empty($template_args['TXN_receipt_url'])) { |
|
392 | + $template_args['order_conf_desc'] = __('%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.', 'event_espresso'); |
|
393 | 393 | } else { |
394 | - $template_args['order_conf_desc'] = __( '%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation.', 'event_espresso' ); |
|
394 | + $template_args['order_conf_desc'] = __('%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation.', 'event_espresso'); |
|
395 | 395 | } |
396 | 396 | $template_args['transaction'] = $this->_current_txn; |
397 | - $template_args['revisit'] = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
397 | + $template_args['revisit'] = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
398 | 398 | |
399 | - add_action( 'AHEE__thank_you_page_overview_template__content', array( $this, 'get_registration_details' )); |
|
400 | - if ( $this->_is_primary && ! $this->_current_txn->is_free() ) { |
|
401 | - add_action( 'AHEE__thank_you_page_overview_template__content', array( $this, 'get_ajax_content' )); |
|
399 | + add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_registration_details')); |
|
400 | + if ($this->_is_primary && ! $this->_current_txn->is_free()) { |
|
401 | + add_action('AHEE__thank_you_page_overview_template__content', array($this, 'get_ajax_content')); |
|
402 | 402 | } |
403 | 403 | |
404 | - return EEH_Template::locate_template( THANK_YOU_TEMPLATES_PATH . 'thank-you-page-overview.template.php', $template_args, TRUE, TRUE ); |
|
404 | + return EEH_Template::locate_template(THANK_YOU_TEMPLATES_PATH.'thank-you-page-overview.template.php', $template_args, TRUE, TRUE); |
|
405 | 405 | |
406 | 406 | } |
407 | 407 | |
@@ -418,15 +418,15 @@ discard block |
||
418 | 418 | * @param array $data |
419 | 419 | * @return array |
420 | 420 | */ |
421 | - public static function thank_you_page_IPN_monitor( $response = array(), $data = array() ) { |
|
421 | + public static function thank_you_page_IPN_monitor($response = array(), $data = array()) { |
|
422 | 422 | // does this heartbeat contain our data ? |
423 | - if ( ! isset( $data['espresso_thank_you_page'] )) { |
|
423 | + if ( ! isset($data['espresso_thank_you_page'])) { |
|
424 | 424 | return $response; |
425 | 425 | } |
426 | 426 | // check for reg_url_link in the incoming heartbeat data |
427 | - if ( ! isset( $data['espresso_thank_you_page']['e_reg_url_link'] )) { |
|
428 | - $response['espresso_thank_you_page'] = array ( |
|
429 | - 'errors' => ! empty( $notices['errors'] ) ? $notices['errors'] : __( 'No transaction information could be retrieved because the registration URL link is missing or invalid.', 'event_espresso' ) |
|
427 | + if ( ! isset($data['espresso_thank_you_page']['e_reg_url_link'])) { |
|
428 | + $response['espresso_thank_you_page'] = array( |
|
429 | + 'errors' => ! empty($notices['errors']) ? $notices['errors'] : __('No transaction information could be retrieved because the registration URL link is missing or invalid.', 'event_espresso') |
|
430 | 430 | ); |
431 | 431 | return $response; |
432 | 432 | } |
@@ -436,24 +436,24 @@ discard block |
||
436 | 436 | EES_Espresso_Thank_You::set_definitions(); |
437 | 437 | /** @var $espresso_thank_you_page EES_Espresso_Thank_You */ |
438 | 438 | $espresso_thank_you_page = EES_Espresso_Thank_You::instance(); |
439 | - $espresso_thank_you_page->set_reg_url_link( $data['espresso_thank_you_page']['e_reg_url_link'] ); |
|
439 | + $espresso_thank_you_page->set_reg_url_link($data['espresso_thank_you_page']['e_reg_url_link']); |
|
440 | 440 | $espresso_thank_you_page->init(); |
441 | 441 | //get TXN |
442 | 442 | $TXN = $espresso_thank_you_page->get_txn(); |
443 | 443 | // no TXN? then get out |
444 | - if ( ! $TXN instanceof EE_Transaction ) { |
|
444 | + if ( ! $TXN instanceof EE_Transaction) { |
|
445 | 445 | $notices = EE_Error::get_notices(); |
446 | - $response['espresso_thank_you_page'] = array ( |
|
447 | - 'errors' => ! empty( $notices['errors'] ) ? $notices['errors'] : sprintf( __( 'The information for your transaction could not be retrieved from the server or the transaction data received was invalid because of a technical reason. (%s)', 'event_espresso' ), __LINE__ ) |
|
446 | + $response['espresso_thank_you_page'] = array( |
|
447 | + 'errors' => ! empty($notices['errors']) ? $notices['errors'] : sprintf(__('The information for your transaction could not be retrieved from the server or the transaction data received was invalid because of a technical reason. (%s)', 'event_espresso'), __LINE__) |
|
448 | 448 | ); |
449 | 449 | return $response; |
450 | 450 | } |
451 | 451 | // grab transient of TXN's status |
452 | - $txn_status = isset( $data['espresso_thank_you_page']['txn_status'] ) ? $data['espresso_thank_you_page']['txn_status'] : NULL; |
|
452 | + $txn_status = isset($data['espresso_thank_you_page']['txn_status']) ? $data['espresso_thank_you_page']['txn_status'] : NULL; |
|
453 | 453 | // has the TXN status changed since we last checked (or empty because this is the first time running through this code)? |
454 | - if ( $txn_status !== $TXN->status_ID() ) { |
|
454 | + if ($txn_status !== $TXN->status_ID()) { |
|
455 | 455 | // switch between two possible basic outcomes |
456 | - switch( $TXN->status_ID()) { |
|
456 | + switch ($TXN->status_ID()) { |
|
457 | 457 | // TXN has been updated in some way |
458 | 458 | case EEM_Transaction::overpaid_status_code: |
459 | 459 | case EEM_Transaction::complete_status_code: |
@@ -468,29 +468,29 @@ discard block |
||
468 | 468 | case EEM_Transaction::failed_status_code: |
469 | 469 | default: |
470 | 470 | // keep on waiting... |
471 | - return $espresso_thank_you_page->_update_server_wait_time( $data['espresso_thank_you_page'] ); |
|
471 | + return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']); |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | // or is the TXN still failed (never been updated) ??? |
475 | - } else if ( $TXN->failed() ) { |
|
475 | + } else if ($TXN->failed()) { |
|
476 | 476 | // keep on waiting... |
477 | - return $espresso_thank_you_page->_update_server_wait_time( $data['espresso_thank_you_page'] ); |
|
477 | + return $espresso_thank_you_page->_update_server_wait_time($data['espresso_thank_you_page']); |
|
478 | 478 | } |
479 | 479 | // TXN is happening so let's get the payments now |
480 | 480 | // if we've already gotten payments then the heartbeat data will contain the timestamp of the last time we checked |
481 | - $since = isset( $data['espresso_thank_you_page']['get_payments_since'] ) ? $data['espresso_thank_you_page']['get_payments_since'] : 0; |
|
481 | + $since = isset($data['espresso_thank_you_page']['get_payments_since']) ? $data['espresso_thank_you_page']['get_payments_since'] : 0; |
|
482 | 482 | // then check for payments |
483 | - $payments = $espresso_thank_you_page->get_txn_payments( $since ); |
|
483 | + $payments = $espresso_thank_you_page->get_txn_payments($since); |
|
484 | 484 | // has a payment been processed ? |
485 | - if ( ! empty( $payments ) || $espresso_thank_you_page->_is_offline_payment_method ) { |
|
486 | - if ( $since ) { |
|
485 | + if ( ! empty($payments) || $espresso_thank_you_page->_is_offline_payment_method) { |
|
486 | + if ($since) { |
|
487 | 487 | $response['espresso_thank_you_page'] = array( |
488 | - 'new_payments' => $espresso_thank_you_page->get_new_payments( $payments ), |
|
488 | + 'new_payments' => $espresso_thank_you_page->get_new_payments($payments), |
|
489 | 489 | 'transaction_details' => $espresso_thank_you_page->get_transaction_details(), |
490 | 490 | 'txn_status' => $TXN->status_ID() |
491 | 491 | ); |
492 | 492 | } else { |
493 | - $response['espresso_thank_you_page']['payment_details'] = $espresso_thank_you_page->get_payment_details( $payments ); |
|
493 | + $response['espresso_thank_you_page']['payment_details'] = $espresso_thank_you_page->get_payment_details($payments); |
|
494 | 494 | } |
495 | 495 | // reset time to check for payments |
496 | 496 | $response['espresso_thank_you_page']['get_payments_since'] = time(); |
@@ -510,9 +510,9 @@ discard block |
||
510 | 510 | * @param array $thank_you_page_data thank you page portion of the incoming JSON array from the WP heartbeat data |
511 | 511 | * @return array |
512 | 512 | */ |
513 | - private function _update_server_wait_time( $thank_you_page_data = array() ) { |
|
514 | - $response['espresso_thank_you_page'] = array ( |
|
515 | - 'still_waiting' => isset( $thank_you_page_data['initial_access'] ) ? time() - $thank_you_page_data['initial_access'] : 0, |
|
513 | + private function _update_server_wait_time($thank_you_page_data = array()) { |
|
514 | + $response['espresso_thank_you_page'] = array( |
|
515 | + 'still_waiting' => isset($thank_you_page_data['initial_access']) ? time() - $thank_you_page_data['initial_access'] : 0, |
|
516 | 516 | 'txn_status' => $this->_current_txn->status_ID() |
517 | 517 | ); |
518 | 518 | return $response; |
@@ -535,13 +535,13 @@ discard block |
||
535 | 535 | $template_args['SPCO_attendee_information_url'] = $this->_SPCO_attendee_information_url; |
536 | 536 | |
537 | 537 | $template_args['resend_reg_confirmation_url'] = add_query_arg( |
538 | - array( 'token'=>$this->_reg_url_link, 'resend_reg_confirmation' => 'true' ), |
|
538 | + array('token'=>$this->_reg_url_link, 'resend_reg_confirmation' => 'true'), |
|
539 | 539 | EE_Registry::instance()->CFG->core->thank_you_page_url() |
540 | 540 | ); |
541 | 541 | // verify template arguments |
542 | - EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' ); |
|
543 | - EEH_Template_Validator::verify_isnt_null( $template_args['SPCO_attendee_information_url'], '$SPCO_attendee_information_url'); |
|
544 | - echo EEH_Template::locate_template( THANK_YOU_TEMPLATES_PATH . 'thank-you-page-registration-details.template.php', $template_args, TRUE, TRUE ); |
|
542 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
543 | + EEH_Template_Validator::verify_isnt_null($template_args['SPCO_attendee_information_url'], '$SPCO_attendee_information_url'); |
|
544 | + echo EEH_Template::locate_template(THANK_YOU_TEMPLATES_PATH.'thank-you-page-registration-details.template.php', $template_args, TRUE, TRUE); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | |
@@ -550,38 +550,38 @@ discard block |
||
550 | 550 | * resend_reg_confirmation_email |
551 | 551 | */ |
552 | 552 | public static function resend_reg_confirmation_email() { |
553 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
554 | - $reg_url_link = EE_Registry::instance()->REQ->get( 'token' ); |
|
553 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
554 | + $reg_url_link = EE_Registry::instance()->REQ->get('token'); |
|
555 | 555 | |
556 | 556 | // was a REG_ID passed ? |
557 | - if ( $reg_url_link ) { |
|
558 | - $registration = EE_Registry::instance()->load_model( 'Registration' )->get_one( array( array( 'REG_url_link' => $reg_url_link ))); |
|
559 | - if ( $registration instanceof EE_Registration ) { |
|
557 | + if ($reg_url_link) { |
|
558 | + $registration = EE_Registry::instance()->load_model('Registration')->get_one(array(array('REG_url_link' => $reg_url_link))); |
|
559 | + if ($registration instanceof EE_Registration) { |
|
560 | 560 | // resend email |
561 | - EED_Messages::process_resend( array( '_REG_ID' => $registration->ID() )); |
|
561 | + EED_Messages::process_resend(array('_REG_ID' => $registration->ID())); |
|
562 | 562 | } else { |
563 | 563 | EE_Error::add_error( |
564 | - __( 'The Registration Confirmation email could not be sent because a valid Registration could not be retrieved from the database.', 'event_espresso' ), |
|
564 | + __('The Registration Confirmation email could not be sent because a valid Registration could not be retrieved from the database.', 'event_espresso'), |
|
565 | 565 | __FILE__, __FUNCTION__, __LINE__ |
566 | 566 | ); |
567 | 567 | } |
568 | 568 | } else { |
569 | 569 | EE_Error::add_error( |
570 | - __( 'The Registration Confirmation email could not be sent because a registration token is missing or invalid.', 'event_espresso' ), |
|
570 | + __('The Registration Confirmation email could not be sent because a registration token is missing or invalid.', 'event_espresso'), |
|
571 | 571 | __FILE__, __FUNCTION__, __LINE__ |
572 | 572 | ); |
573 | 573 | } |
574 | 574 | // request sent via AJAX ? |
575 | - if ( EE_FRONT_AJAX ) { |
|
576 | - echo json_encode( EE_Error::get_notices( FALSE )); |
|
575 | + if (EE_FRONT_AJAX) { |
|
576 | + echo json_encode(EE_Error::get_notices(FALSE)); |
|
577 | 577 | die(); |
578 | 578 | // or was JS disabled ? |
579 | 579 | } else { |
580 | 580 | // save errors so that they get picked up on the next request |
581 | - EE_Error::get_notices( TRUE, TRUE ); |
|
581 | + EE_Error::get_notices(TRUE, TRUE); |
|
582 | 582 | wp_safe_redirect( |
583 | 583 | add_query_arg( |
584 | - array( 'e_reg_url_link'=> $reg_url_link ), |
|
584 | + array('e_reg_url_link'=> $reg_url_link), |
|
585 | 585 | EE_Registry::instance()->CFG->core->thank_you_page_url() |
586 | 586 | ) |
587 | 587 | ); |
@@ -597,26 +597,26 @@ discard block |
||
597 | 597 | * @return void |
598 | 598 | */ |
599 | 599 | public function get_ajax_content() { |
600 | - if ( ! $this->get_txn() ) { |
|
600 | + if ( ! $this->get_txn()) { |
|
601 | 601 | return; |
602 | 602 | } |
603 | 603 | // first determine which event(s) require pre-approval or not |
604 | 604 | $events = array(); |
605 | 605 | $events_requiring_pre_approval = array(); |
606 | - foreach ( $this->_current_txn->registrations() as $registration ) { |
|
607 | - if ( $registration instanceof EE_Registration ) { |
|
606 | + foreach ($this->_current_txn->registrations() as $registration) { |
|
607 | + if ($registration instanceof EE_Registration) { |
|
608 | 608 | $event = $registration->event(); |
609 | - if ( $event instanceof EE_Event ) { |
|
610 | - if ( $registration->is_not_approved() && $registration->event() instanceof EE_Event ) { |
|
611 | - $events_requiring_pre_approval[ $event->ID() ] = $event; |
|
609 | + if ($event instanceof EE_Event) { |
|
610 | + if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) { |
|
611 | + $events_requiring_pre_approval[$event->ID()] = $event; |
|
612 | 612 | } else { |
613 | - $events[ $event->ID() ] = $event; |
|
613 | + $events[$event->ID()] = $event; |
|
614 | 614 | } |
615 | 615 | } |
616 | 616 | } |
617 | 617 | } |
618 | - $this->display_details_for_events_requiring_pre_approval( $events_requiring_pre_approval ); |
|
619 | - $this->display_details_for_events( $events ); |
|
618 | + $this->display_details_for_events_requiring_pre_approval($events_requiring_pre_approval); |
|
619 | + $this->display_details_for_events($events); |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | |
@@ -628,21 +628,21 @@ discard block |
||
628 | 628 | * @param EE_Event[] $events |
629 | 629 | * @return string |
630 | 630 | */ |
631 | - public function display_details_for_events( $events = array() ) { |
|
632 | - if ( ! empty( $events ) ) { |
|
631 | + public function display_details_for_events($events = array()) { |
|
632 | + if ( ! empty($events)) { |
|
633 | 633 | ?> |
634 | 634 | <div id="espresso-thank-you-page-ajax-content-dv"> |
635 | 635 | <div id="espresso-thank-you-page-ajax-transaction-dv"></div> |
636 | 636 | <div id="espresso-thank-you-page-ajax-payment-dv"></div> |
637 | 637 | <div id="espresso-thank-you-page-ajax-loading-dv"> |
638 | 638 | <div id="ee-ajax-loading-dv" class="left lt-blue-text"> |
639 | - <span class="dashicons dashicons-upload"></span><span id="ee-ajax-loading-msg-spn"><?php _e( 'loading transaction and payment information...', 'event_espresso' ); ?></span> |
|
639 | + <span class="dashicons dashicons-upload"></span><span id="ee-ajax-loading-msg-spn"><?php _e('loading transaction and payment information...', 'event_espresso'); ?></span> |
|
640 | 640 | </div> |
641 | - <?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed ) : ?> |
|
641 | + <?php if ( ! $this->_is_offline_payment_method && ! $this->_payments_closed) : ?> |
|
642 | 642 | <p id="ee-ajax-loading-pg" class="highlight-bg small-text clear"> |
643 | - <?php echo apply_filters( 'EES_Espresso_Thank_You__get_ajax_content__waiting_for_IPN_msg', __( 'Some payment gateways can take 15 minutes or more to return their payment notification, so please be patient if you require payment confirmation as soon as possible. Please note that as soon as everything is finalized, we will send your full payment and registration confirmation results to you via email.', 'event_espresso' ) ); ?> |
|
643 | + <?php echo apply_filters('EES_Espresso_Thank_You__get_ajax_content__waiting_for_IPN_msg', __('Some payment gateways can take 15 minutes or more to return their payment notification, so please be patient if you require payment confirmation as soon as possible. Please note that as soon as everything is finalized, we will send your full payment and registration confirmation results to you via email.', 'event_espresso')); ?> |
|
644 | 644 | <br/> |
645 | - <span class="jst-rght ee-block small-text lt-grey-text"><?php _e( 'current wait time ', 'event_espresso' ); ?> |
|
645 | + <span class="jst-rght ee-block small-text lt-grey-text"><?php _e('current wait time ', 'event_espresso'); ?> |
|
646 | 646 | <span id="espresso-thank-you-page-ajax-time-dv">00:00:00</span></span> |
647 | 647 | </p> |
648 | 648 | <?php endif; ?> |
@@ -662,20 +662,20 @@ discard block |
||
662 | 662 | * @param EE_Event[] $events |
663 | 663 | * @return string |
664 | 664 | */ |
665 | - public function display_details_for_events_requiring_pre_approval( $events = array() ) { |
|
666 | - if ( ! empty( $events ) ) { |
|
665 | + public function display_details_for_events_requiring_pre_approval($events = array()) { |
|
666 | + if ( ! empty($events)) { |
|
667 | 667 | ?> |
668 | 668 | <div id = "espresso-thank-you-page-not-approved-message-dv" > |
669 | - <h4 class="orange-text" ><?php _e( 'Important Notice:', 'event_espresso' );?></h4> |
|
669 | + <h4 class="orange-text" ><?php _e('Important Notice:', 'event_espresso'); ?></h4> |
|
670 | 670 | <p id="events-requiring-pre-approval-pg" class="small-text"> |
671 | 671 | <?php echo apply_filters( |
672 | 672 | 'AHEE__EES_Espresso_Thank_You__get_ajax_content__not_approved_message', |
673 | - __( 'The following Event(s) you have registered for do not require payment at this time and will not be billed for during this transaction. Billing will only occur after all attendees have been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso' ) |
|
673 | + __('The following Event(s) you have registered for do not require payment at this time and will not be billed for during this transaction. Billing will only occur after all attendees have been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso') |
|
674 | 674 | ); ?> |
675 | 675 | </p> |
676 | 676 | <ul class="events-requiring-pre-approval-ul"> |
677 | - <?php foreach ( $events as $event ) { |
|
678 | - if ( $event instanceof EE_Event ) { |
|
677 | + <?php foreach ($events as $event) { |
|
678 | + if ($event instanceof EE_Event) { |
|
679 | 679 | echo '<li><span class="dashicons dashicons-marker ee-icon-size-16 orange-text"></span>', $event->name(), '</li>'; |
680 | 680 | } |
681 | 681 | } ?> |
@@ -699,15 +699,15 @@ discard block |
||
699 | 699 | $template_args = array(); |
700 | 700 | $template_args['transaction'] = $this->_current_txn; |
701 | 701 | $template_args['reg_url_link'] = $this->_reg_url_link; |
702 | - $template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name( TRUE ); |
|
702 | + $template_args['primary_registrant_name'] = $this->_primary_registrant->attendee()->full_name(TRUE); |
|
703 | 703 | // link to SPCO payment_options |
704 | 704 | $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
705 | 705 | $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
706 | 706 | // verify template arguments |
707 | - EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' ); |
|
708 | - EEH_Template_Validator::verify_isnt_null( $template_args['show_try_pay_again_link'], '$show_try_pay_again_link' ); |
|
709 | - EEH_Template_Validator::verify_isnt_null( $template_args['SPCO_payment_options_url'], '$SPCO_payment_options_url' ); |
|
710 | - return EEH_Template::locate_template( THANK_YOU_TEMPLATES_PATH . 'thank-you-page-transaction-details.template.php', $template_args, TRUE, TRUE ); |
|
707 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
708 | + EEH_Template_Validator::verify_isnt_null($template_args['show_try_pay_again_link'], '$show_try_pay_again_link'); |
|
709 | + EEH_Template_Validator::verify_isnt_null($template_args['SPCO_payment_options_url'], '$SPCO_payment_options_url'); |
|
710 | + return EEH_Template::locate_template(THANK_YOU_TEMPLATES_PATH.'thank-you-page-transaction-details.template.php', $template_args, TRUE, TRUE); |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | |
@@ -719,9 +719,9 @@ discard block |
||
719 | 719 | * @param EE_Payment $payment |
720 | 720 | * @return string |
721 | 721 | */ |
722 | - public function get_payment_row_html( $payment = NULL ) { |
|
722 | + public function get_payment_row_html($payment = NULL) { |
|
723 | 723 | $html = ''; |
724 | - if ( $payment instanceof EE_Payment ) { |
|
724 | + if ($payment instanceof EE_Payment) { |
|
725 | 725 | if ( |
726 | 726 | $payment->payment_method() instanceof EE_Payment_Method |
727 | 727 | && $payment->payment_method()->is_off_site() |
@@ -730,25 +730,25 @@ discard block |
||
730 | 730 | // considering the registrant has made it to the Thank You page, |
731 | 731 | // any failed payments may actually be pending and the IPN is just slow |
732 | 732 | // so let's |
733 | - $payment->set_status( EEM_Payment::status_id_pending ); |
|
733 | + $payment->set_status(EEM_Payment::status_id_pending); |
|
734 | 734 | } |
735 | - $payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined ? '<br /><span class="small-text">' . $payment->gateway_response() . '</span>' : ''; |
|
735 | + $payment_declined_msg = $payment->STS_ID() === EEM_Payment::status_id_declined ? '<br /><span class="small-text">'.$payment->gateway_response().'</span>' : ''; |
|
736 | 736 | $html .= ' |
737 | 737 | <tr> |
738 | 738 | <td> |
739 | - ' . $payment->timestamp() . ' |
|
739 | + ' . $payment->timestamp().' |
|
740 | 740 | </td> |
741 | 741 | <td> |
742 | - ' . ( $payment->payment_method() instanceof EE_Payment_Method ? $payment->payment_method()->name() : __( 'Unknown', 'event_espresso' ) ) . ' |
|
742 | + ' . ($payment->payment_method() instanceof EE_Payment_Method ? $payment->payment_method()->name() : __('Unknown', 'event_espresso')).' |
|
743 | 743 | </td> |
744 | 744 | <td class="jst-rght"> |
745 | - ' . EEH_Template::format_currency( $payment->amount() ) . ' |
|
745 | + ' . EEH_Template::format_currency($payment->amount()).' |
|
746 | 746 | </td> |
747 | 747 | <td class="jst-rght" style="line-height:1;"> |
748 | - ' . $payment->pretty_status( TRUE ) . $payment_declined_msg . ' |
|
748 | + ' . $payment->pretty_status(TRUE).$payment_declined_msg.' |
|
749 | 749 | </td> |
750 | 750 | </tr>'; |
751 | - do_action( 'AHEE__thank_you_page_payment_details_template__after_each_payment', $payment ); |
|
751 | + do_action('AHEE__thank_you_page_payment_details_template__after_each_payment', $payment); |
|
752 | 752 | } |
753 | 753 | return $html; |
754 | 754 | } |
@@ -762,17 +762,17 @@ discard block |
||
762 | 762 | * @param array $payments |
763 | 763 | * @return string |
764 | 764 | */ |
765 | - public function get_payment_details( $payments = array() ) { |
|
765 | + public function get_payment_details($payments = array()) { |
|
766 | 766 | //prepare variables for displaying |
767 | 767 | $template_args = array(); |
768 | 768 | $template_args['transaction'] = $this->_current_txn; |
769 | 769 | $template_args['reg_url_link'] = $this->_reg_url_link; |
770 | 770 | $template_args['payments'] = array(); |
771 | - foreach ( $payments as $payment ) { |
|
772 | - $template_args['payments'][] = $this->get_payment_row_html( $payment ); |
|
771 | + foreach ($payments as $payment) { |
|
772 | + $template_args['payments'][] = $this->get_payment_row_html($payment); |
|
773 | 773 | } |
774 | 774 | //create a hacky payment object, but dont save it |
775 | - $payment = EE_Payment::new_instance( array( |
|
775 | + $payment = EE_Payment::new_instance(array( |
|
776 | 776 | 'TXN_ID'=>$this->_current_txn->ID(), |
777 | 777 | 'STS_ID'=>EEM_Payment::status_id_pending, |
778 | 778 | 'PAY_timestamp'=>time(), |
@@ -780,21 +780,21 @@ discard block |
||
780 | 780 | 'PMD_ID'=>$this->_current_txn->payment_method_ID() |
781 | 781 | )); |
782 | 782 | $payment_method = $this->_current_txn->payment_method(); |
783 | - if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
784 | - $template_args[ 'gateway_content' ] = $payment_method->type_obj()->payment_overview_content( $payment ); |
|
783 | + if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
784 | + $template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content($payment); |
|
785 | 785 | } else { |
786 | - $template_args[ 'gateway_content' ] = ''; |
|
786 | + $template_args['gateway_content'] = ''; |
|
787 | 787 | } |
788 | 788 | // link to SPCO payment_options |
789 | 789 | $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; |
790 | 790 | $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; |
791 | 791 | // verify template arguments |
792 | - EEH_Template_Validator::verify_instanceof( $template_args['transaction'], '$transaction', 'EE_Transaction' ); |
|
793 | - EEH_Template_Validator::verify_isnt_null( $template_args['payments'], '$payments' ); |
|
794 | - EEH_Template_Validator::verify_isnt_null( $template_args['show_try_pay_again_link'], '$show_try_pay_again_link' ); |
|
795 | - EEH_Template_Validator::verify_isnt_null( $template_args['gateway_content'], '$gateway_content'); |
|
796 | - EEH_Template_Validator::verify_isnt_null( $template_args['SPCO_payment_options_url'], '$SPCO_payment_options_url'); |
|
797 | - return EEH_Template::locate_template( THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php', $template_args, TRUE, TRUE ); |
|
792 | + EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); |
|
793 | + EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments'); |
|
794 | + EEH_Template_Validator::verify_isnt_null($template_args['show_try_pay_again_link'], '$show_try_pay_again_link'); |
|
795 | + EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content'); |
|
796 | + EEH_Template_Validator::verify_isnt_null($template_args['SPCO_payment_options_url'], '$SPCO_payment_options_url'); |
|
797 | + return EEH_Template::locate_template(THANK_YOU_TEMPLATES_PATH.'thank-you-page-payment-details.template.php', $template_args, TRUE, TRUE); |
|
798 | 798 | } |
799 | 799 | |
800 | 800 | |
@@ -806,11 +806,11 @@ discard block |
||
806 | 806 | * @param array $payments |
807 | 807 | * @return string |
808 | 808 | */ |
809 | - public function get_new_payments( $payments = array() ) { |
|
809 | + public function get_new_payments($payments = array()) { |
|
810 | 810 | $payments_html = ''; |
811 | 811 | //prepare variables for displaying |
812 | - foreach ( $payments as $payment ) { |
|
813 | - $payments_html .= $this->get_payment_row_html( $payment ); |
|
812 | + foreach ($payments as $payment) { |
|
813 | + $payments_html .= $this->get_payment_row_html($payment); |
|
814 | 814 | } |
815 | 815 | return $payments_html; |
816 | 816 | } |
@@ -6,11 +6,11 @@ |
||
6 | 6 | <li class="ticket-registration"> |
7 | 7 | <table class="registration-details"> |
8 | 8 | <tr class="odd"> |
9 | - <th><?php _e('Attendee', 'event_espresso');?></th> |
|
9 | + <th><?php _e('Attendee', 'event_espresso'); ?></th> |
|
10 | 10 | <td>[FNAME] [LNAME] ([ATTENDEE_EMAIL])</td> |
11 | 11 | </tr> |
12 | 12 | <tr> |
13 | - <th><?php _e("Registration Code:", "event_espresso");?></th> |
|
13 | + <th><?php _e("Registration Code:", "event_espresso"); ?></th> |
|
14 | 14 | <td>[REGISTRATION_CODE] - <span class="[REGISTRATION_STATUS_ID]">[REGISTRATION_STATUS_LABEL]</span></td> |
15 | 15 | </tr> |
16 | 16 | </table> |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | // (all other times it gets resurrected from a wordpress option) |
15 | 15 | $stages = glob(EE_CORE.'data_migration_scripts/4_7_0_stages/*'); |
16 | 16 | $class_to_filepath = array(); |
17 | -foreach($stages as $filepath){ |
|
17 | +foreach ($stages as $filepath) { |
|
18 | 18 | $matches = array(); |
19 | - preg_match('~4_7_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
19 | + preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
20 | 20 | $class_to_filepath[$matches[1]] = $filepath; |
21 | 21 | } |
22 | 22 | //give addons a chance to autoload their stages too |
23 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages',$class_to_filepath); |
|
23 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages', $class_to_filepath); |
|
24 | 24 | EEH_Autoloader::register_autoloader($class_to_filepath); |
25 | 25 | |
26 | 26 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @since 4.7.0 |
37 | 37 | * |
38 | 38 | */ |
39 | -class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base{ |
|
39 | +class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base { |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * return EE_DMS_Core_4_7_0 |
@@ -58,18 +58,18 @@ discard block |
||
58 | 58 | * @return bool |
59 | 59 | */ |
60 | 60 | public function can_migrate_from_version($version_array) { |
61 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
61 | + EE_Registry::instance()->load_helper('Activation'); |
|
62 | 62 | $version_string = $version_array['Core']; |
63 | 63 | if ( |
64 | - ( $version_string <= '4.7.0' && $version_string >= '4.6.0' ) |
|
64 | + ($version_string <= '4.7.0' && $version_string >= '4.6.0') |
|
65 | 65 | || |
66 | - ( $version_string >= '4.7.0' && |
|
67 | - ! EEH_Activation::table_exists( 'esp_registration_payment' ) && |
|
68 | - EEH_Activation::table_exists( 'esp_registration' ) ) ) { |
|
66 | + ($version_string >= '4.7.0' && |
|
67 | + ! EEH_Activation::table_exists('esp_registration_payment') && |
|
68 | + EEH_Activation::table_exists('esp_registration')) ) { |
|
69 | 69 | return true; |
70 | - } elseif ( ! $version_string ) { |
|
70 | + } elseif ( ! $version_string) { |
|
71 | 71 | //no version string provided... this must be pre 4.3 |
72 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
73 | 73 | } else { |
74 | 74 | return false; |
75 | 75 | } |
@@ -91,16 +91,16 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function schema_changes_before_migration() { |
93 | 93 | //relies on 4.1's EEH_Activation::create_table |
94 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
95 | - $table_name='esp_answer'; |
|
96 | - $sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
94 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
95 | + $table_name = 'esp_answer'; |
|
96 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
97 | 97 | REG_ID INT UNSIGNED NOT NULL, |
98 | 98 | QST_ID INT 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'); |
|
103 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
104 | 104 | |
105 | 105 | $table_name = 'esp_attendee_meta'; |
106 | 106 | $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | CNT_is_EU TINYINT(1) DEFAULT '0', |
141 | 141 | CNT_active TINYINT(1) DEFAULT '0', |
142 | 142 | PRIMARY KEY (CNT_ISO)"; |
143 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
143 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
144 | 144 | |
145 | 145 | $table_name = 'esp_currency'; |
146 | 146 | $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL, |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
151 | 151 | CUR_active TINYINT(1) DEFAULT '0', |
152 | 152 | PRIMARY KEY (CUR_code)"; |
153 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
153 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
154 | 154 | |
155 | 155 | |
156 | 156 | $table_name = 'esp_currency_payment_method'; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | KEY EVT_ID (EVT_ID), |
181 | 181 | KEY DTT_is_primary (DTT_is_primary)"; |
182 | 182 | |
183 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
183 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
184 | 184 | |
185 | 185 | $table_name = 'esp_event_meta'; |
186 | 186 | $sql = " |
@@ -199,44 +199,44 @@ discard block |
||
199 | 199 | EVT_donations TINYINT(1) NULL, |
200 | 200 | PRIMARY KEY (EVTM_ID), |
201 | 201 | KEY EVT_ID (EVT_ID)"; |
202 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
202 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
203 | 203 | |
204 | 204 | |
205 | 205 | |
206 | - $table_name='esp_event_question_group'; |
|
207 | - $sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
206 | + $table_name = 'esp_event_question_group'; |
|
207 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
208 | 208 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
209 | 209 | QSG_ID INT UNSIGNED NOT NULL, |
210 | 210 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
211 | 211 | PRIMARY KEY (EQG_ID), |
212 | 212 | KEY EVT_ID (EVT_ID), |
213 | 213 | KEY QSG_ID (QSG_ID)"; |
214 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
214 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
215 | 215 | |
216 | 216 | |
217 | 217 | |
218 | - $table_name='esp_event_venue'; |
|
219 | - $sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
218 | + $table_name = 'esp_event_venue'; |
|
219 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
220 | 220 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
221 | 221 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
222 | 222 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
223 | 223 | PRIMARY KEY (EVV_ID)"; |
224 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
224 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
225 | 225 | |
226 | 226 | |
227 | 227 | |
228 | - $table_name='esp_extra_meta'; |
|
229 | - $sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
228 | + $table_name = 'esp_extra_meta'; |
|
229 | + $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
230 | 230 | OBJ_ID INT(11) DEFAULT NULL, |
231 | 231 | EXM_type VARCHAR(45) DEFAULT NULL, |
232 | 232 | EXM_key VARCHAR(45) DEFAULT NULL, |
233 | 233 | EXM_value TEXT, |
234 | 234 | PRIMARY KEY (EXM_ID), |
235 | 235 | KEY EXM_type (EXM_type, OBJ_ID, EXM_key(45))"; |
236 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
236 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
237 | 237 | |
238 | - $table_name='esp_line_item'; |
|
239 | - $sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
238 | + $table_name = 'esp_line_item'; |
|
239 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
240 | 240 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
241 | 241 | TXN_ID INT(11) DEFAULT NULL, |
242 | 242 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | PRIMARY KEY (LIN_ID), |
255 | 255 | KEY LIN_code (LIN_code(191)), |
256 | 256 | KEY TXN_ID (TXN_ID)"; |
257 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' ); |
|
257 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
258 | 258 | |
259 | 259 | $table_name = 'esp_log'; |
260 | 260 | $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT, |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | MTP_is_active TINYINT(1) NOT NULL DEFAULT '1', |
295 | 295 | PRIMARY KEY (GRP_ID), |
296 | 296 | KEY MTP_user_id (MTP_user_id)"; |
297 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
297 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
298 | 298 | |
299 | 299 | $table_name = 'esp_event_message_template'; |
300 | 300 | $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | PRIMARY KEY (EMT_ID), |
304 | 304 | KEY EVT_ID (EVT_ID), |
305 | 305 | KEY GRP_ID (GRP_ID)"; |
306 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
306 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
307 | 307 | |
308 | 308 | |
309 | 309 | $table_name = 'esp_payment'; |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | PRIMARY KEY (TTM_ID)"; |
377 | 377 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
378 | 378 | |
379 | - $table_name='esp_question'; |
|
380 | - $sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
379 | + $table_name = 'esp_question'; |
|
380 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
381 | 381 | QST_display_text TEXT NOT NULL, |
382 | 382 | QST_admin_label VARCHAR(255) NOT NULL, |
383 | 383 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -390,22 +390,22 @@ discard block |
||
390 | 390 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
391 | 391 | PRIMARY KEY (QST_ID), |
392 | 392 | KEY QST_order (QST_order)'; |
393 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
393 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
394 | 394 | |
395 | - $table_name='esp_question_group_question'; |
|
396 | - $sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
395 | + $table_name = 'esp_question_group_question'; |
|
396 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
397 | 397 | QSG_ID INT UNSIGNED NOT NULL, |
398 | 398 | QST_ID INT UNSIGNED NOT NULL, |
399 | 399 | QGQ_order INT UNSIGNED NOT NULL DEFAULT 0, |
400 | 400 | PRIMARY KEY (QGQ_ID), |
401 | 401 | KEY QST_ID (QST_ID), |
402 | 402 | KEY QSG_ID_order (QSG_ID, QGQ_order)"; |
403 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
403 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
404 | 404 | |
405 | 405 | |
406 | 406 | |
407 | - $table_name='esp_question_option'; |
|
408 | - $sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
407 | + $table_name = 'esp_question_option'; |
|
408 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
409 | 409 | QSO_value VARCHAR(255) NOT NULL, |
410 | 410 | QSO_desc TEXT NOT NULL, |
411 | 411 | QST_ID INT UNSIGNED NOT NULL, |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | PRIMARY KEY (QSO_ID), |
415 | 415 | KEY QST_ID (QST_ID), |
416 | 416 | KEY QSO_order (QSO_order)"; |
417 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
417 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
418 | 418 | |
419 | 419 | |
420 | 420 | |
@@ -460,8 +460,8 @@ discard block |
||
460 | 460 | |
461 | 461 | |
462 | 462 | |
463 | - $table_name='esp_checkin'; |
|
464 | - $sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
463 | + $table_name = 'esp_checkin'; |
|
464 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
465 | 465 | REG_ID INT(10) UNSIGNED NOT NULL, |
466 | 466 | DTT_ID INT(10) UNSIGNED NOT NULL, |
467 | 467 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | PRC_parent INT(10) UNSIGNED DEFAULT 0, |
557 | 557 | PRIMARY KEY (PRC_ID), |
558 | 558 | KEY PRT_ID (PRT_ID)"; |
559 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
559 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
560 | 560 | |
561 | 561 | $table_name = "esp_price_type"; |
562 | 562 | $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -594,10 +594,10 @@ discard block |
||
594 | 594 | TKT_deleted TINYINT(1) NOT NULL DEFAULT '0', |
595 | 595 | PRIMARY KEY (TKT_ID), |
596 | 596 | KEY TKT_start_date (TKT_start_date)"; |
597 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
597 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
598 | 598 | |
599 | 599 | $table_name = 'esp_question_group'; |
600 | - $sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
600 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
601 | 601 | QSG_name VARCHAR(255) NOT NULL, |
602 | 602 | QSG_identifier VARCHAR(100) NOT NULL, |
603 | 603 | QSG_desc TEXT NULL, |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | PRIMARY KEY (QSG_ID), |
611 | 611 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC), |
612 | 612 | KEY QSG_order (QSG_order)'; |
613 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
613 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
614 | 614 | |
615 | 615 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
616 | 616 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | return true; |
643 | 643 | } |
644 | 644 | |
645 | - public function migration_page_hooks(){ |
|
645 | + public function migration_page_hooks() { |
|
646 | 646 | |
647 | 647 | } |
648 | 648 |
@@ -647,6 +647,7 @@ |
||
647 | 647 | * @access public |
648 | 648 | * @static |
649 | 649 | * @param string $table_name, without prefixed $wpdb->prefix |
650 | + * @param string $table_name |
|
650 | 651 | * @return array of database column names |
651 | 652 | */ |
652 | 653 | public static function get_fields_on_table( $table_name = NULL ) { |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -140,15 +142,15 @@ discard block |
||
140 | 142 | ); |
141 | 143 | if( $which_to_include === 'all' ) { |
142 | 144 | //leave as-is |
143 | - }elseif( $which_to_include === 'old' ) { |
|
145 | + } elseif( $which_to_include === 'old' ) { |
|
144 | 146 | $cron_tasks = array_filter( $cron_tasks, function ( $value ) { |
145 | 147 | return $value === EEH_Activation::cron_task_no_longer_in_use; |
146 | 148 | }); |
147 | - }elseif( $which_to_include === 'current' ) { |
|
149 | + } elseif( $which_to_include === 'current' ) { |
|
148 | 150 | $cron_tasks = array_filter( $cron_tasks ); |
149 | - }elseif( WP_DEBUG ) { |
|
151 | + } elseif( WP_DEBUG ) { |
|
150 | 152 | throw new EE_Error( sprintf( __( 'Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso' ), $which_to_include ) ); |
151 | - }else{ |
|
153 | + } else{ |
|
152 | 154 | //leave as-is |
153 | 155 | } |
154 | 156 | return $cron_tasks; |
@@ -401,7 +403,7 @@ discard block |
||
401 | 403 | $post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1"); |
402 | 404 | if($post_id){ |
403 | 405 | return get_post($post_id); |
404 | - }else{ |
|
406 | + } else{ |
|
405 | 407 | return NULL; |
406 | 408 | } |
407 | 409 | |
@@ -772,13 +774,13 @@ discard block |
||
772 | 774 | foreach( $current_data_migration_script->get_errors() as $error ){ |
773 | 775 | EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ ); |
774 | 776 | } |
775 | - }else{ |
|
777 | + } else{ |
|
776 | 778 | EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) ); |
777 | 779 | } |
778 | 780 | return false; |
779 | 781 | } |
780 | 782 | EE_Data_Migration_Manager::instance()->update_current_database_state_to(); |
781 | - }else{ |
|
783 | + } else{ |
|
782 | 784 | EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
783 | 785 | return false; |
784 | 786 | } |
@@ -1070,7 +1072,7 @@ discard block |
||
1070 | 1072 | if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){ |
1071 | 1073 | EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
1072 | 1074 | EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
1073 | - }else{ |
|
1075 | + } else{ |
|
1074 | 1076 | EEM_Payment_Method::instance()->verify_button_urls(); |
1075 | 1077 | } |
1076 | 1078 | } |
@@ -1226,7 +1228,9 @@ discard block |
||
1226 | 1228 | //do an initial loop to determine if we need to continue |
1227 | 1229 | $def_ms = array(); |
1228 | 1230 | foreach ( $default_messengers as $msgr ) { |
1229 | - if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue; |
|
1231 | + if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) { |
|
1232 | + continue; |
|
1233 | + } |
|
1230 | 1234 | $def_ms[] = $msgr; |
1231 | 1235 | } |
1232 | 1236 | |
@@ -1555,7 +1559,7 @@ discard block |
||
1555 | 1559 | if( ! delete_option( $option_name ) ){ |
1556 | 1560 | $undeleted_options[] = $option_name; |
1557 | 1561 | } |
1558 | - }else{ |
|
1562 | + } else{ |
|
1559 | 1563 | $option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" ); |
1560 | 1564 | foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){ |
1561 | 1565 | if( ! delete_option( $option_name_from_wildcard ) ){ |
@@ -1619,7 +1623,7 @@ discard block |
||
1619 | 1623 | $EZSQL_ERROR = $ezsql_error_cache; |
1620 | 1624 | if( empty( $new_error ) ){ |
1621 | 1625 | return TRUE; |
1622 | - }else{ |
|
1626 | + } else{ |
|
1623 | 1627 | return FALSE; |
1624 | 1628 | } |
1625 | 1629 | } |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | * @param $table_name |
58 | 58 | * @return string |
59 | 59 | */ |
60 | - public static function ensure_table_name_has_prefix( $table_name ) { |
|
60 | + public static function ensure_table_name_has_prefix($table_name) { |
|
61 | 61 | global $wpdb; |
62 | - return strpos( $table_name, $wpdb->prefix ) === 0 ? $table_name : $wpdb->prefix . $table_name; |
|
62 | + return strpos($table_name, $wpdb->prefix) === 0 ? $table_name : $wpdb->prefix.$table_name; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * be called on plugin activation and reactivation |
86 | 86 | * @return boolean success, whether the database and folders are setup properly |
87 | 87 | */ |
88 | - public static function initialize_db_and_folders(){ |
|
88 | + public static function initialize_db_and_folders() { |
|
89 | 89 | $good_filesystem = EEH_Activation::create_upload_directories(); |
90 | 90 | $good_db = EEH_Activation::create_database_tables(); |
91 | 91 | return $good_filesystem && $good_db; |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | * upon activation of a new plugin, reactivation, and at the end |
100 | 100 | * of running migration scripts |
101 | 101 | */ |
102 | - public static function initialize_db_content(){ |
|
102 | + public static function initialize_db_content() { |
|
103 | 103 | //let's avoid doing all this logic repeatedly, especially when addons are requesting it |
104 | - if( EEH_Activation::$_initialized_db_content_already_in_this_request ) { |
|
104 | + if (EEH_Activation::$_initialized_db_content_already_in_this_request) { |
|
105 | 105 | return; |
106 | 106 | } |
107 | 107 | EEH_Activation::$_initialized_db_content_already_in_this_request = true; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | EEH_Activation::remove_cron_tasks(); |
119 | 119 | EEH_Activation::create_cron_tasks(); |
120 | 120 | //also, check for CAF default db content |
121 | - do_action( 'AHEE__EEH_Activation__initialize_db_content' ); |
|
121 | + do_action('AHEE__EEH_Activation__initialize_db_content'); |
|
122 | 122 | //also: EEM_Gateways::load_all_gateways() outputs a lot of success messages |
123 | 123 | //which users really won't care about on initial activation |
124 | 124 | EE_Error::overwrite_success(); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @return array |
138 | 138 | * @throws \EE_Error |
139 | 139 | */ |
140 | - public static function get_cron_tasks( $which_to_include ) { |
|
140 | + public static function get_cron_tasks($which_to_include) { |
|
141 | 141 | $cron_tasks = apply_filters( |
142 | 142 | 'FHEE__EEH_Activation__get_cron_tasks', |
143 | 143 | array( |
@@ -146,17 +146,17 @@ discard block |
||
146 | 146 | 'AHEE__EE_Cron_Tasks__update_transaction_with_payment' => EEH_Activation::cron_task_no_longer_in_use, //there may have been a bug which prevented from these cron tasks from getting unscheduled, so we might want to remove these for a few updates |
147 | 147 | ) |
148 | 148 | ); |
149 | - if( $which_to_include === 'all' ) { |
|
149 | + if ($which_to_include === 'all') { |
|
150 | 150 | //leave as-is |
151 | - }elseif( $which_to_include === 'old' ) { |
|
152 | - $cron_tasks = array_filter( $cron_tasks, function ( $value ) { |
|
151 | + }elseif ($which_to_include === 'old') { |
|
152 | + $cron_tasks = array_filter($cron_tasks, function($value) { |
|
153 | 153 | return $value === EEH_Activation::cron_task_no_longer_in_use; |
154 | 154 | }); |
155 | - }elseif( $which_to_include === 'current' ) { |
|
156 | - $cron_tasks = array_filter( $cron_tasks ); |
|
157 | - }elseif( WP_DEBUG ) { |
|
158 | - throw new EE_Error( sprintf( __( 'Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso' ), $which_to_include ) ); |
|
159 | - }else{ |
|
155 | + }elseif ($which_to_include === 'current') { |
|
156 | + $cron_tasks = array_filter($cron_tasks); |
|
157 | + }elseif (WP_DEBUG) { |
|
158 | + throw new EE_Error(sprintf(__('Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso'), $which_to_include)); |
|
159 | + } else { |
|
160 | 160 | //leave as-is |
161 | 161 | } |
162 | 162 | return $cron_tasks; |
@@ -167,9 +167,9 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public static function create_cron_tasks() { |
169 | 169 | |
170 | - foreach( EEH_Activation::get_cron_tasks( 'current' ) as $hook_name => $frequency ) { |
|
171 | - if( ! wp_next_scheduled( $hook_name ) ) { |
|
172 | - wp_schedule_event( time(), $frequency, $hook_name ); |
|
170 | + foreach (EEH_Activation::get_cron_tasks('current') as $hook_name => $frequency) { |
|
171 | + if ( ! wp_next_scheduled($hook_name)) { |
|
172 | + wp_schedule_event(time(), $frequency, $hook_name); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | * Remove the currently-existing and now-removed cron tasks. |
180 | 180 | * @param boolean $remove_all whether to only remove the old ones, or remove absolutely ALL the EE ones |
181 | 181 | */ |
182 | - public static function remove_cron_tasks( $remove_all = true ) { |
|
182 | + public static function remove_cron_tasks($remove_all = true) { |
|
183 | 183 | $cron_tasks_to_remove = $remove_all ? 'all' : 'old'; |
184 | 184 | $crons = _get_cron_array(); |
185 | - $crons = is_array( $crons ) ? $crons : array(); |
|
185 | + $crons = is_array($crons) ? $crons : array(); |
|
186 | 186 | /* reminder that $crons looks like: top-level keys are timestamps, |
187 | 187 | * and their values are arrays. |
188 | 188 | * The 2nd level arrays have keys with each of the cron task hook names to run at that time |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | * ... |
201 | 201 | * ... |
202 | 202 | */ |
203 | - foreach( EEH_Activation::get_cron_tasks( $cron_tasks_to_remove ) as $hook_name => $frequency ) { |
|
204 | - foreach( $crons as $timestamp => $hooks_to_fire_at_time ) { |
|
205 | - if ( array_key_exists( $hook_name, $hooks_to_fire_at_time ) ) { |
|
206 | - unset( $crons[ $timestamp ][ $hook_name ] ); |
|
203 | + foreach (EEH_Activation::get_cron_tasks($cron_tasks_to_remove) as $hook_name => $frequency) { |
|
204 | + foreach ($crons as $timestamp => $hooks_to_fire_at_time) { |
|
205 | + if (array_key_exists($hook_name, $hooks_to_fire_at_time)) { |
|
206 | + unset($crons[$timestamp][$hook_name]); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | } |
210 | - _set_cron_array( $crons ); |
|
210 | + _set_cron_array($crons); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | */ |
223 | 223 | public static function CPT_initialization() { |
224 | 224 | // register Custom Post Types |
225 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
225 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
226 | 226 | flush_rewrite_rules(); |
227 | 227 | } |
228 | 228 | |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | * @return void |
241 | 241 | */ |
242 | 242 | public static function reset_and_update_config() { |
243 | - do_action( 'AHEE__EE_Config___load_core_config__start', array( 'EEH_Activation', 'load_calendar_config' ) ); |
|
244 | - add_filter( 'FHEE__EE_Config___load_core_config__config_settings', array( 'EEH_Activation', 'migrate_old_config_data' ), 10, 3 ); |
|
243 | + do_action('AHEE__EE_Config___load_core_config__start', array('EEH_Activation', 'load_calendar_config')); |
|
244 | + add_filter('FHEE__EE_Config___load_core_config__config_settings', array('EEH_Activation', 'migrate_old_config_data'), 10, 3); |
|
245 | 245 | //EE_Config::reset(); |
246 | 246 | } |
247 | 247 | |
@@ -254,23 +254,23 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public static function load_calendar_config() { |
256 | 256 | // grab array of all plugin folders and loop thru it |
257 | - $plugins = glob( WP_PLUGIN_DIR . DS . '*', GLOB_ONLYDIR ); |
|
258 | - if ( empty( $plugins ) ) { |
|
257 | + $plugins = glob(WP_PLUGIN_DIR.DS.'*', GLOB_ONLYDIR); |
|
258 | + if (empty($plugins)) { |
|
259 | 259 | return; |
260 | 260 | } |
261 | - foreach ( $plugins as $plugin_path ) { |
|
261 | + foreach ($plugins as $plugin_path) { |
|
262 | 262 | // grab plugin folder name from path |
263 | - $plugin = basename( $plugin_path ); |
|
263 | + $plugin = basename($plugin_path); |
|
264 | 264 | // drill down to Espresso plugins |
265 | - if ( strpos( $plugin, 'espresso' ) !== FALSE || strpos( $plugin, 'Espresso' ) !== FALSE || strpos( $plugin, 'ee4' ) !== FALSE || strpos( $plugin, 'EE4' ) !== FALSE ) { |
|
265 | + if (strpos($plugin, 'espresso') !== FALSE || strpos($plugin, 'Espresso') !== FALSE || strpos($plugin, 'ee4') !== FALSE || strpos($plugin, 'EE4') !== FALSE) { |
|
266 | 266 | // then to calendar related plugins |
267 | - if ( strpos( $plugin, 'calendar' ) !== FALSE ) { |
|
267 | + if (strpos($plugin, 'calendar') !== FALSE) { |
|
268 | 268 | // this is what we are looking for |
269 | - $calendar_config = $plugin_path . DS . 'EE_Calendar_Config.php'; |
|
269 | + $calendar_config = $plugin_path.DS.'EE_Calendar_Config.php'; |
|
270 | 270 | // does it exist in this folder ? |
271 | - if ( is_readable( $calendar_config )) { |
|
271 | + if (is_readable($calendar_config)) { |
|
272 | 272 | // YEAH! let's load it |
273 | - require_once( $calendar_config ); |
|
273 | + require_once($calendar_config); |
|
274 | 274 | } |
275 | 275 | } |
276 | 276 | } |
@@ -287,21 +287,21 @@ discard block |
||
287 | 287 | * @param \EE_Config $EE_Config |
288 | 288 | * @return \stdClass |
289 | 289 | */ |
290 | - public static function migrate_old_config_data( $settings = array(), $config = '', EE_Config $EE_Config ) { |
|
291 | - $convert_from_array = array( 'addons' ); |
|
290 | + public static function migrate_old_config_data($settings = array(), $config = '', EE_Config $EE_Config) { |
|
291 | + $convert_from_array = array('addons'); |
|
292 | 292 | // in case old settings were saved as an array |
293 | - if ( is_array( $settings ) && in_array( $config, $convert_from_array )) { |
|
293 | + if (is_array($settings) && in_array($config, $convert_from_array)) { |
|
294 | 294 | // convert existing settings to an object |
295 | 295 | $config_array = $settings; |
296 | 296 | $settings = new stdClass(); |
297 | - foreach ( $config_array as $key => $value ){ |
|
298 | - if ( $key == 'calendar' && class_exists( 'EE_Calendar_Config' )) { |
|
299 | - $EE_Config->set_config( 'addons', 'EE_Calendar', 'EE_Calendar_Config', $value ); |
|
297 | + foreach ($config_array as $key => $value) { |
|
298 | + if ($key == 'calendar' && class_exists('EE_Calendar_Config')) { |
|
299 | + $EE_Config->set_config('addons', 'EE_Calendar', 'EE_Calendar_Config', $value); |
|
300 | 300 | } else { |
301 | 301 | $settings->{$key} = $value; |
302 | 302 | } |
303 | 303 | } |
304 | - add_filter( 'FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true' ); |
|
304 | + add_filter('FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true'); |
|
305 | 305 | } |
306 | 306 | return $settings; |
307 | 307 | } |
@@ -317,8 +317,8 @@ discard block |
||
317 | 317 | */ |
318 | 318 | public static function deactivate_event_espresso() { |
319 | 319 | // check permissions |
320 | - if ( current_user_can( 'activate_plugins' )) { |
|
321 | - deactivate_plugins( EE_PLUGIN_BASENAME, TRUE ); |
|
320 | + if (current_user_can('activate_plugins')) { |
|
321 | + deactivate_plugins(EE_PLUGIN_BASENAME, TRUE); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
@@ -340,25 +340,25 @@ discard block |
||
340 | 340 | $critical_pages = array( |
341 | 341 | array( |
342 | 342 | 'id' =>'reg_page_id', |
343 | - 'name' => __( 'Registration Checkout', 'event_espresso' ), |
|
343 | + 'name' => __('Registration Checkout', 'event_espresso'), |
|
344 | 344 | 'post' => NULL, |
345 | 345 | 'code' => 'ESPRESSO_CHECKOUT' |
346 | 346 | ), |
347 | 347 | array( |
348 | 348 | 'id' => 'txn_page_id', |
349 | - 'name' => __( 'Transactions', 'event_espresso' ), |
|
349 | + 'name' => __('Transactions', 'event_espresso'), |
|
350 | 350 | 'post' => NULL, |
351 | 351 | 'code' => 'ESPRESSO_TXN_PAGE' |
352 | 352 | ), |
353 | 353 | array( |
354 | 354 | 'id' => 'thank_you_page_id', |
355 | - 'name' => __( 'Thank You', 'event_espresso' ), |
|
355 | + 'name' => __('Thank You', 'event_espresso'), |
|
356 | 356 | 'post' => NULL, |
357 | 357 | 'code' => 'ESPRESSO_THANK_YOU' |
358 | 358 | ), |
359 | 359 | array( |
360 | 360 | 'id' => 'cancel_page_id', |
361 | - 'name' => __( 'Registration Cancelled', 'event_espresso' ), |
|
361 | + 'name' => __('Registration Cancelled', 'event_espresso'), |
|
362 | 362 | 'post' => NULL, |
363 | 363 | 'code' => 'ESPRESSO_CANCELLED' |
364 | 364 | ), |
@@ -366,62 +366,62 @@ discard block |
||
366 | 366 | |
367 | 367 | $EE_Core_Config = EE_Registry::instance()->CFG->core; |
368 | 368 | |
369 | - foreach ( $critical_pages as $critical_page ) { |
|
369 | + foreach ($critical_pages as $critical_page) { |
|
370 | 370 | // is critical page ID set in config ? |
371 | - if ( $EE_Core_Config->{$critical_page[ 'id' ]} !== FALSE ) { |
|
371 | + if ($EE_Core_Config->{$critical_page['id']} !== FALSE) { |
|
372 | 372 | // attempt to find post by ID |
373 | - $critical_page['post'] = get_post( $EE_Core_Config->{$critical_page[ 'id' ]} ); |
|
373 | + $critical_page['post'] = get_post($EE_Core_Config->{$critical_page['id']} ); |
|
374 | 374 | } |
375 | 375 | // no dice? |
376 | - if ( $critical_page['post'] == NULL ) { |
|
376 | + if ($critical_page['post'] == NULL) { |
|
377 | 377 | // attempt to find post by title |
378 | - $critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] ); |
|
378 | + $critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']); |
|
379 | 379 | // still nothing? |
380 | - if ( $critical_page['post'] == NULL ) { |
|
381 | - $critical_page = EEH_Activation::create_critical_page( $critical_page ); |
|
380 | + if ($critical_page['post'] == NULL) { |
|
381 | + $critical_page = EEH_Activation::create_critical_page($critical_page); |
|
382 | 382 | // REALLY? Still nothing ??!?!? |
383 | - if ( $critical_page['post'] == NULL ) { |
|
384 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
385 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
383 | + if ($critical_page['post'] == NULL) { |
|
384 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
385 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
386 | 386 | break; |
387 | 387 | } |
388 | 388 | } |
389 | 389 | } |
390 | 390 | // track post_shortcodes |
391 | - if ( $critical_page['post'] ) { |
|
392 | - EEH_Activation::_track_critical_page_post_shortcodes( $critical_page ); |
|
391 | + if ($critical_page['post']) { |
|
392 | + EEH_Activation::_track_critical_page_post_shortcodes($critical_page); |
|
393 | 393 | } |
394 | 394 | // check that Post ID matches critical page ID in config |
395 | 395 | if ( |
396 | - isset( $critical_page['post']->ID ) |
|
397 | - && $critical_page['post']->ID != $EE_Core_Config->{$critical_page[ 'id' ]} |
|
396 | + isset($critical_page['post']->ID) |
|
397 | + && $critical_page['post']->ID != $EE_Core_Config->{$critical_page['id']} |
|
398 | 398 | ) { |
399 | 399 | //update Config with post ID |
400 | - $EE_Core_Config->{$critical_page[ 'id' ]} = $critical_page['post']->ID; |
|
401 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) { |
|
402 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
403 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
400 | + $EE_Core_Config->{$critical_page['id']} = $critical_page['post']->ID; |
|
401 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
402 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
403 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
404 | 404 | } |
405 | 405 | } |
406 | 406 | |
407 | 407 | $critical_page_problem = |
408 | - ! isset( $critical_page['post']->post_status ) |
|
408 | + ! isset($critical_page['post']->post_status) |
|
409 | 409 | || $critical_page['post']->post_status != 'publish' |
410 | - || strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE |
|
410 | + || strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE |
|
411 | 411 | ? TRUE |
412 | 412 | : $critical_page_problem; |
413 | 413 | |
414 | 414 | } |
415 | 415 | |
416 | - if ( $critical_page_problem ) { |
|
416 | + if ($critical_page_problem) { |
|
417 | 417 | $msg = sprintf( |
418 | - __('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso' ), |
|
419 | - '<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>' |
|
418 | + __('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso'), |
|
419 | + '<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>' |
|
420 | 420 | ); |
421 | - EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg ); |
|
421 | + EE_Error::add_persistent_admin_notice('critical_page_problem', $msg); |
|
422 | 422 | } |
423 | - if ( EE_Error::has_notices() ) { |
|
424 | - EE_Error::get_notices( FALSE, TRUE, TRUE ); |
|
423 | + if (EE_Error::has_notices()) { |
|
424 | + EE_Error::get_notices(FALSE, TRUE, TRUE); |
|
425 | 425 | } |
426 | 426 | } |
427 | 427 | |
@@ -433,13 +433,13 @@ discard block |
||
433 | 433 | * parameter to the shortcode |
434 | 434 | * @return WP_Post or NULl |
435 | 435 | */ |
436 | - public static function get_page_by_ee_shortcode($ee_shortcode){ |
|
436 | + public static function get_page_by_ee_shortcode($ee_shortcode) { |
|
437 | 437 | global $wpdb; |
438 | 438 | $shortcode_and_opening_bracket = '['.$ee_shortcode; |
439 | 439 | $post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1"); |
440 | - if($post_id){ |
|
440 | + if ($post_id) { |
|
441 | 441 | return get_post($post_id); |
442 | - }else{ |
|
442 | + } else { |
|
443 | 443 | return NULL; |
444 | 444 | } |
445 | 445 | |
@@ -456,32 +456,32 @@ discard block |
||
456 | 456 | * @param array $critical_page |
457 | 457 | * @return array |
458 | 458 | */ |
459 | - public static function create_critical_page( $critical_page ) { |
|
459 | + public static function create_critical_page($critical_page) { |
|
460 | 460 | |
461 | 461 | $post_args = array( |
462 | 462 | 'post_title' => $critical_page['name'], |
463 | 463 | 'post_status' => 'publish', |
464 | 464 | 'post_type' => 'page', |
465 | 465 | 'comment_status' => 'closed', |
466 | - 'post_content' => '[' . $critical_page['code'] . ']' |
|
466 | + 'post_content' => '['.$critical_page['code'].']' |
|
467 | 467 | ); |
468 | 468 | |
469 | - $post_id = wp_insert_post( $post_args ); |
|
470 | - if ( ! $post_id ) { |
|
469 | + $post_id = wp_insert_post($post_args); |
|
470 | + if ( ! $post_id) { |
|
471 | 471 | $msg = sprintf( |
472 | - __( 'The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso' ), |
|
472 | + __('The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso'), |
|
473 | 473 | $critical_page['name'] |
474 | 474 | ); |
475 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
475 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
476 | 476 | return $critical_page; |
477 | 477 | } |
478 | 478 | // get newly created post's details |
479 | - if ( ! $critical_page['post'] = get_post( $post_id )) { |
|
479 | + if ( ! $critical_page['post'] = get_post($post_id)) { |
|
480 | 480 | $msg = sprintf( |
481 | - __( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ), |
|
481 | + __('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'), |
|
482 | 482 | $critical_page['name'] |
483 | 483 | ); |
484 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
484 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | return $critical_page; |
@@ -500,35 +500,35 @@ discard block |
||
500 | 500 | * @param array $critical_page |
501 | 501 | * @return void |
502 | 502 | */ |
503 | - private static function _track_critical_page_post_shortcodes( $critical_page = array() ) { |
|
503 | + private static function _track_critical_page_post_shortcodes($critical_page = array()) { |
|
504 | 504 | // check the goods |
505 | - if ( ! $critical_page['post'] instanceof WP_Post ) { |
|
505 | + if ( ! $critical_page['post'] instanceof WP_Post) { |
|
506 | 506 | $msg = sprintf( |
507 | - __( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ), |
|
507 | + __('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'), |
|
508 | 508 | $critical_page['name'] |
509 | 509 | ); |
510 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
510 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
511 | 511 | return; |
512 | 512 | } |
513 | 513 | $EE_Core_Config = EE_Registry::instance()->CFG->core; |
514 | 514 | // map shortcode to post |
515 | - $EE_Core_Config->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID; |
|
515 | + $EE_Core_Config->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID; |
|
516 | 516 | // and make sure it's NOT added to the WP "Posts Page" |
517 | 517 | // name of the WP Posts Page |
518 | 518 | $posts_page = EE_Registry::instance()->CFG->get_page_for_posts(); |
519 | - if ( isset( $EE_Core_Config->post_shortcodes[ $posts_page ] )) { |
|
520 | - unset( $EE_Core_Config->post_shortcodes[ $posts_page ][ $critical_page['code'] ] ); |
|
519 | + if (isset($EE_Core_Config->post_shortcodes[$posts_page])) { |
|
520 | + unset($EE_Core_Config->post_shortcodes[$posts_page][$critical_page['code']]); |
|
521 | 521 | } |
522 | - if ( $posts_page != 'posts' && isset( $EE_Core_Config->post_shortcodes['posts'] )) { |
|
523 | - unset( $EE_Core_Config->post_shortcodes['posts'][ $critical_page['code'] ] ); |
|
522 | + if ($posts_page != 'posts' && isset($EE_Core_Config->post_shortcodes['posts'])) { |
|
523 | + unset($EE_Core_Config->post_shortcodes['posts'][$critical_page['code']]); |
|
524 | 524 | } |
525 | 525 | // update post_shortcode CFG |
526 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) { |
|
526 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
527 | 527 | $msg = sprintf( |
528 | - __( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ), |
|
528 | + __('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'), |
|
529 | 529 | $critical_page['name'] |
530 | 530 | ); |
531 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
531 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
532 | 532 | } |
533 | 533 | } |
534 | 534 | |
@@ -546,24 +546,24 @@ discard block |
||
546 | 546 | public static function get_default_creator_id() { |
547 | 547 | global $wpdb; |
548 | 548 | |
549 | - if ( ! empty( self::$_default_creator_id ) ) { |
|
549 | + if ( ! empty(self::$_default_creator_id)) { |
|
550 | 550 | return self::$_default_creator_id; |
551 | 551 | }/**/ |
552 | 552 | |
553 | - $role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' ); |
|
553 | + $role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator'); |
|
554 | 554 | |
555 | 555 | //let's allow pre_filtering for early exits by alternative methods for getting id. We check for truthy result and if so then exit early. |
556 | - $pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check ); |
|
557 | - if ( $pre_filtered_id !== false ) { |
|
556 | + $pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check); |
|
557 | + if ($pre_filtered_id !== false) { |
|
558 | 558 | return (int) $pre_filtered_id; |
559 | 559 | } |
560 | 560 | |
561 | - $capabilities_key = EEH_Activation::ensure_table_name_has_prefix( 'capabilities' ); |
|
562 | - $query = $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%' . $role_to_check . '%' ); |
|
563 | - $user_id = $wpdb->get_var( $query ); |
|
564 | - $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id ); |
|
565 | - if ( $user_id && intval( $user_id ) ) { |
|
566 | - self::$_default_creator_id = intval( $user_id ); |
|
561 | + $capabilities_key = EEH_Activation::ensure_table_name_has_prefix('capabilities'); |
|
562 | + $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%'.$role_to_check.'%'); |
|
563 | + $user_id = $wpdb->get_var($query); |
|
564 | + $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id); |
|
565 | + if ($user_id && intval($user_id)) { |
|
566 | + self::$_default_creator_id = intval($user_id); |
|
567 | 567 | return self::$_default_creator_id; |
568 | 568 | } else { |
569 | 569 | return NULL; |
@@ -590,29 +590,29 @@ discard block |
||
590 | 590 | * @return void |
591 | 591 | * @throws EE_Error if there are database errors |
592 | 592 | */ |
593 | - public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false ) { |
|
594 | - if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){ |
|
593 | + public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false) { |
|
594 | + if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) { |
|
595 | 595 | return; |
596 | 596 | } |
597 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
598 | - if ( ! function_exists( 'dbDelta' )) { |
|
599 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
597 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
598 | + if ( ! function_exists('dbDelta')) { |
|
599 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
600 | 600 | } |
601 | 601 | /** @var WPDB $wpdb */ |
602 | 602 | global $wpdb; |
603 | - $wp_table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
603 | + $wp_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
604 | 604 | // do we need to first delete an existing version of this table ? |
605 | - if ( $drop_pre_existing_table && EEH_Activation::table_exists( $wp_table_name ) ){ |
|
605 | + if ($drop_pre_existing_table && EEH_Activation::table_exists($wp_table_name)) { |
|
606 | 606 | // ok, delete the table... but ONLY if it's empty |
607 | - $deleted_safely = EEH_Activation::delete_db_table_if_empty( $wp_table_name ); |
|
607 | + $deleted_safely = EEH_Activation::delete_db_table_if_empty($wp_table_name); |
|
608 | 608 | // table is NOT empty, are you SURE you want to delete this table ??? |
609 | - if ( ! $deleted_safely && defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){ |
|
610 | - EEH_Activation::delete_unused_db_table( $wp_table_name ); |
|
611 | - } else if ( ! $deleted_safely ) { |
|
609 | + if ( ! $deleted_safely && defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) { |
|
610 | + EEH_Activation::delete_unused_db_table($wp_table_name); |
|
611 | + } else if ( ! $deleted_safely) { |
|
612 | 612 | // so we should be more cautious rather than just dropping tables so easily |
613 | 613 | EE_Error::add_persistent_admin_notice( |
614 | - 'bad_table_' . $wp_table_name . '_detected', |
|
615 | - sprintf( __( 'Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso' ), |
|
614 | + 'bad_table_'.$wp_table_name.'_detected', |
|
615 | + sprintf(__('Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso'), |
|
616 | 616 | $wp_table_name, |
617 | 617 | "<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>", |
618 | 618 | '<b>wp-config.php</b>', |
@@ -621,25 +621,25 @@ discard block |
||
621 | 621 | } |
622 | 622 | } |
623 | 623 | // does $sql contain valid column information? ( LPT: https://regex101.com/ is great for working out regex patterns ) |
624 | - if ( preg_match( '((((.*?))(,\s))+)', $sql, $valid_column_data ) ) { |
|
624 | + if (preg_match('((((.*?))(,\s))+)', $sql, $valid_column_data)) { |
|
625 | 625 | $SQL = "CREATE TABLE $wp_table_name ( $sql ) $engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"; |
626 | 626 | //get $wpdb to echo errors, but buffer them. This way at least WE know an error |
627 | 627 | //happened. And then we can choose to tell the end user |
628 | - $old_show_errors_policy = $wpdb->show_errors( TRUE ); |
|
629 | - $old_error_suppression_policy = $wpdb->suppress_errors( FALSE ); |
|
628 | + $old_show_errors_policy = $wpdb->show_errors(TRUE); |
|
629 | + $old_error_suppression_policy = $wpdb->suppress_errors(FALSE); |
|
630 | 630 | ob_start(); |
631 | - dbDelta( $SQL ); |
|
631 | + dbDelta($SQL); |
|
632 | 632 | $output = ob_get_contents(); |
633 | 633 | ob_end_clean(); |
634 | - $wpdb->show_errors( $old_show_errors_policy ); |
|
635 | - $wpdb->suppress_errors( $old_error_suppression_policy ); |
|
636 | - if( ! empty( $output ) ){ |
|
637 | - throw new EE_Error( $output ); |
|
634 | + $wpdb->show_errors($old_show_errors_policy); |
|
635 | + $wpdb->suppress_errors($old_error_suppression_policy); |
|
636 | + if ( ! empty($output)) { |
|
637 | + throw new EE_Error($output); |
|
638 | 638 | } |
639 | 639 | } else { |
640 | 640 | throw new EE_Error( |
641 | 641 | sprintf( |
642 | - __( 'The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso' ), |
|
642 | + __('The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso'), |
|
643 | 643 | '<br />', |
644 | 644 | $sql |
645 | 645 | ) |
@@ -661,15 +661,15 @@ discard block |
||
661 | 661 | * @param string $column_info if your SQL were 'ALTER TABLE table_name ADD price VARCHAR(10)', this would be 'VARCHAR(10)' |
662 | 662 | * @return bool|int |
663 | 663 | */ |
664 | - public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){ |
|
665 | - if( apply_filters( 'FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE ) ){ |
|
664 | + public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') { |
|
665 | + if (apply_filters('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE)) { |
|
666 | 666 | return FALSE; |
667 | 667 | } |
668 | 668 | global $wpdb; |
669 | - $full_table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
669 | + $full_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
670 | 670 | $fields = self::get_fields_on_table($table_name); |
671 | - if (!in_array($column_name, $fields)){ |
|
672 | - $alter_query="ALTER TABLE $full_table_name ADD $column_name $column_info"; |
|
671 | + if ( ! in_array($column_name, $fields)) { |
|
672 | + $alter_query = "ALTER TABLE $full_table_name ADD $column_name $column_info"; |
|
673 | 673 | //echo "alter query:$alter_query"; |
674 | 674 | return $wpdb->query($alter_query); |
675 | 675 | } |
@@ -688,15 +688,15 @@ discard block |
||
688 | 688 | * @param string $table_name, without prefixed $wpdb->prefix |
689 | 689 | * @return array of database column names |
690 | 690 | */ |
691 | - public static function get_fields_on_table( $table_name = NULL ) { |
|
691 | + public static function get_fields_on_table($table_name = NULL) { |
|
692 | 692 | global $wpdb; |
693 | - $table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
694 | - if ( ! empty( $table_name )) { |
|
693 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
694 | + if ( ! empty($table_name)) { |
|
695 | 695 | $columns = $wpdb->get_results("SHOW COLUMNS FROM $table_name "); |
696 | 696 | if ($columns !== FALSE) { |
697 | 697 | $field_array = array(); |
698 | - foreach($columns as $column ){ |
|
699 | - $field_array[] = $column->Field;; |
|
698 | + foreach ($columns as $column) { |
|
699 | + $field_array[] = $column->Field; ; |
|
700 | 700 | } |
701 | 701 | return $field_array; |
702 | 702 | } |
@@ -714,12 +714,12 @@ discard block |
||
714 | 714 | * @param string $table_name |
715 | 715 | * @return bool |
716 | 716 | */ |
717 | - public static function db_table_is_empty( $table_name ) { |
|
717 | + public static function db_table_is_empty($table_name) { |
|
718 | 718 | global $wpdb; |
719 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
720 | - if ( EEH_Activation::table_exists( $table_name ) ) { |
|
721 | - $count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name" ); |
|
722 | - return absint( $count ) === 0 ? true : false; |
|
719 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
720 | + if (EEH_Activation::table_exists($table_name)) { |
|
721 | + $count = $wpdb->get_var("SELECT COUNT(*) FROM $table_name"); |
|
722 | + return absint($count) === 0 ? true : false; |
|
723 | 723 | } |
724 | 724 | return false; |
725 | 725 | } |
@@ -734,9 +734,9 @@ discard block |
||
734 | 734 | * @param string $table_name |
735 | 735 | * @return bool | int |
736 | 736 | */ |
737 | - public static function delete_db_table_if_empty( $table_name ) { |
|
738 | - if ( EEH_Activation::db_table_is_empty( $table_name ) ) { |
|
739 | - return EEH_Activation::delete_unused_db_table( $table_name ); |
|
737 | + public static function delete_db_table_if_empty($table_name) { |
|
738 | + if (EEH_Activation::db_table_is_empty($table_name)) { |
|
739 | + return EEH_Activation::delete_unused_db_table($table_name); |
|
740 | 740 | } |
741 | 741 | return false; |
742 | 742 | } |
@@ -751,11 +751,11 @@ discard block |
||
751 | 751 | * @param string $table_name |
752 | 752 | * @return bool | int |
753 | 753 | */ |
754 | - public static function delete_unused_db_table( $table_name ) { |
|
754 | + public static function delete_unused_db_table($table_name) { |
|
755 | 755 | global $wpdb; |
756 | - if ( EEH_Activation::table_exists( $table_name ) ) { |
|
757 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
758 | - return $wpdb->query( "DROP TABLE IF EXISTS $table_name" ); |
|
756 | + if (EEH_Activation::table_exists($table_name)) { |
|
757 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
758 | + return $wpdb->query("DROP TABLE IF EXISTS $table_name"); |
|
759 | 759 | } |
760 | 760 | return false; |
761 | 761 | } |
@@ -771,18 +771,18 @@ discard block |
||
771 | 771 | * @param string $index_name |
772 | 772 | * @return bool | int |
773 | 773 | */ |
774 | - public static function drop_index( $table_name, $index_name ) { |
|
775 | - if( apply_filters( 'FHEE__EEH_Activation__drop_index__short_circuit', FALSE ) ){ |
|
774 | + public static function drop_index($table_name, $index_name) { |
|
775 | + if (apply_filters('FHEE__EEH_Activation__drop_index__short_circuit', FALSE)) { |
|
776 | 776 | return FALSE; |
777 | 777 | } |
778 | 778 | global $wpdb; |
779 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
779 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
780 | 780 | $index_exists_query = "SHOW INDEX FROM $table_name WHERE Key_name = '$index_name'"; |
781 | 781 | if ( |
782 | - $wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) == $table_name |
|
783 | - && $wpdb->get_var( $index_exists_query ) == $table_name //using get_var with the $index_exists_query returns the table's name |
|
782 | + $wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name |
|
783 | + && $wpdb->get_var($index_exists_query) == $table_name //using get_var with the $index_exists_query returns the table's name |
|
784 | 784 | ) { |
785 | - return $wpdb->query( "ALTER TABLE $table_name DROP INDEX $index_name" ); |
|
785 | + return $wpdb->query("ALTER TABLE $table_name DROP INDEX $index_name"); |
|
786 | 786 | } |
787 | 787 | return TRUE; |
788 | 788 | } |
@@ -798,27 +798,27 @@ discard block |
||
798 | 798 | * @return boolean success (whether database is setup properly or not) |
799 | 799 | */ |
800 | 800 | public static function create_database_tables() { |
801 | - EE_Registry::instance()->load_core( 'Data_Migration_Manager' ); |
|
801 | + EE_Registry::instance()->load_core('Data_Migration_Manager'); |
|
802 | 802 | //find the migration script that sets the database to be compatible with the code |
803 | 803 | $dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms(); |
804 | - if( $dms_name ){ |
|
805 | - $current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name ); |
|
806 | - $current_data_migration_script->set_migrating( false ); |
|
804 | + if ($dms_name) { |
|
805 | + $current_data_migration_script = EE_Registry::instance()->load_dms($dms_name); |
|
806 | + $current_data_migration_script->set_migrating(false); |
|
807 | 807 | $current_data_migration_script->schema_changes_before_migration(); |
808 | 808 | $current_data_migration_script->schema_changes_after_migration(); |
809 | - if( $current_data_migration_script->get_errors() ){ |
|
810 | - if( WP_DEBUG ){ |
|
811 | - foreach( $current_data_migration_script->get_errors() as $error ){ |
|
812 | - EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ ); |
|
809 | + if ($current_data_migration_script->get_errors()) { |
|
810 | + if (WP_DEBUG) { |
|
811 | + foreach ($current_data_migration_script->get_errors() as $error) { |
|
812 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
813 | 813 | } |
814 | - }else{ |
|
815 | - EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) ); |
|
814 | + } else { |
|
815 | + EE_Error::add_error(__('There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso')); |
|
816 | 816 | } |
817 | 817 | return false; |
818 | 818 | } |
819 | 819 | EE_Data_Migration_Manager::instance()->update_current_database_state_to(); |
820 | - }else{ |
|
821 | - EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
820 | + } else { |
|
821 | + EE_Error::add_error(__('Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
822 | 822 | return false; |
823 | 823 | } |
824 | 824 | return true; |
@@ -841,8 +841,8 @@ discard block |
||
841 | 841 | ); |
842 | 842 | $system_questions_generator->initializeSystemQuestionGroups(); |
843 | 843 | $system_questions_generator->initializeSystemQuestions(); |
844 | - } catch ( Exception $e ) { |
|
845 | - \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
844 | + } catch (Exception $e) { |
|
845 | + \EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
846 | 846 | } |
847 | 847 | } |
848 | 848 | |
@@ -852,11 +852,11 @@ discard block |
||
852 | 852 | * Makes sure the default payment method (Invoice) is active. |
853 | 853 | * This used to be done automatically as part of constructing the old gateways config |
854 | 854 | */ |
855 | - public static function insert_default_payment_methods(){ |
|
856 | - if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){ |
|
857 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
858 | - EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
|
859 | - }else{ |
|
855 | + public static function insert_default_payment_methods() { |
|
856 | + if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) { |
|
857 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
858 | + EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice'); |
|
859 | + } else { |
|
860 | 860 | EEM_Payment_Method::instance()->verify_button_urls(); |
861 | 861 | } |
862 | 862 | } |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | |
873 | 873 | global $wpdb; |
874 | 874 | |
875 | - if ( EEH_Activation::table_exists( EEM_Status::instance()->table() ) ) { |
|
875 | + if (EEH_Activation::table_exists(EEM_Status::instance()->table())) { |
|
876 | 876 | |
877 | 877 | $table_name = EEM_Status::instance()->table(); |
878 | 878 | |
@@ -938,38 +938,38 @@ discard block |
||
938 | 938 | * @return boolean success of verifying upload directories exist |
939 | 939 | */ |
940 | 940 | public static function create_upload_directories() { |
941 | - EE_Registry::instance()->load_helper( 'File' ); |
|
941 | + EE_Registry::instance()->load_helper('File'); |
|
942 | 942 | // Create the required folders |
943 | 943 | $folders = array( |
944 | 944 | EVENT_ESPRESSO_TEMPLATE_DIR, |
945 | 945 | EVENT_ESPRESSO_GATEWAY_DIR, |
946 | - EVENT_ESPRESSO_UPLOAD_DIR . 'logs/', |
|
947 | - EVENT_ESPRESSO_UPLOAD_DIR . 'css/', |
|
948 | - EVENT_ESPRESSO_UPLOAD_DIR . 'tickets/' |
|
946 | + EVENT_ESPRESSO_UPLOAD_DIR.'logs/', |
|
947 | + EVENT_ESPRESSO_UPLOAD_DIR.'css/', |
|
948 | + EVENT_ESPRESSO_UPLOAD_DIR.'tickets/' |
|
949 | 949 | ); |
950 | - foreach ( $folders as $folder ) { |
|
950 | + foreach ($folders as $folder) { |
|
951 | 951 | try { |
952 | - EEH_File::ensure_folder_exists_and_is_writable( $folder ); |
|
953 | - @ chmod( $folder, 0755 ); |
|
954 | - } catch( EE_Error $e ){ |
|
952 | + EEH_File::ensure_folder_exists_and_is_writable($folder); |
|
953 | + @ chmod($folder, 0755); |
|
954 | + } catch (EE_Error $e) { |
|
955 | 955 | EE_Error::add_error( |
956 | 956 | sprintf( |
957 | - __( 'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ), |
|
957 | + __('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'), |
|
958 | 958 | $folder, |
959 | - '<br />' . $e->getMessage() |
|
959 | + '<br />'.$e->getMessage() |
|
960 | 960 | ), |
961 | 961 | __FILE__, __FUNCTION__, __LINE__ |
962 | 962 | ); |
963 | 963 | //indicate we'll need to fix this later |
964 | - update_option( EEH_Activation::upload_directories_incomplete_option_name, true ); |
|
964 | + update_option(EEH_Activation::upload_directories_incomplete_option_name, true); |
|
965 | 965 | return FALSE; |
966 | 966 | } |
967 | 967 | } |
968 | 968 | //just add the .htaccess file to the logs directory to begin with. Even if logging |
969 | 969 | //is disabled, there might be activation errors recorded in there |
970 | - EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs/' ); |
|
970 | + EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs/'); |
|
971 | 971 | //remember EE's folders are all good |
972 | - delete_option( EEH_Activation::upload_directories_incomplete_option_name ); |
|
972 | + delete_option(EEH_Activation::upload_directories_incomplete_option_name); |
|
973 | 973 | return TRUE; |
974 | 974 | } |
975 | 975 | |
@@ -982,7 +982,7 @@ discard block |
||
982 | 982 | * @return boolean |
983 | 983 | */ |
984 | 984 | public static function upload_directories_incomplete() { |
985 | - return get_option( EEH_Activation::upload_directories_incomplete_option_name, false ); |
|
985 | + return get_option(EEH_Activation::upload_directories_incomplete_option_name, false); |
|
986 | 986 | } |
987 | 987 | |
988 | 988 | |
@@ -1001,16 +1001,16 @@ discard block |
||
1001 | 1001 | $installed_messengers = $default_messengers = array(); |
1002 | 1002 | |
1003 | 1003 | //include our helper |
1004 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
1004 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
1005 | 1005 | |
1006 | 1006 | //get all installed messenger objects |
1007 | 1007 | $installed = EEH_MSG_Template::get_installed_message_objects(); |
1008 | 1008 | |
1009 | 1009 | //let's setup the $installed messengers in an array AND the messengers that are set to be activated on install. |
1010 | - foreach ( $installed['messengers'] as $msgr ) { |
|
1011 | - if ( $msgr instanceof EE_messenger ) { |
|
1010 | + foreach ($installed['messengers'] as $msgr) { |
|
1011 | + if ($msgr instanceof EE_messenger) { |
|
1012 | 1012 | $installed_messengers[$msgr->name] = $msgr; |
1013 | - if ( $msgr->activate_on_install ) { |
|
1013 | + if ($msgr->activate_on_install) { |
|
1014 | 1014 | $default_messengers[] = $msgr->name; |
1015 | 1015 | } |
1016 | 1016 | } |
@@ -1020,36 +1020,36 @@ discard block |
||
1020 | 1020 | $active_messengers = EEH_MSG_Template::get_active_messengers_in_db(); |
1021 | 1021 | |
1022 | 1022 | //things that have already been activated before |
1023 | - $has_activated = get_option( 'ee_has_activated_messenger' ); |
|
1023 | + $has_activated = get_option('ee_has_activated_messenger'); |
|
1024 | 1024 | |
1025 | 1025 | //do an initial loop to determine if we need to continue |
1026 | 1026 | $def_ms = array(); |
1027 | - foreach ( $default_messengers as $msgr ) { |
|
1028 | - if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue; |
|
1027 | + foreach ($default_messengers as $msgr) { |
|
1028 | + if (isset($active_messengers[$msgr]) || isset($has_activated[$msgr])) continue; |
|
1029 | 1029 | $def_ms[] = $msgr; |
1030 | 1030 | } |
1031 | 1031 | |
1032 | 1032 | //setup the $installed_mts in an array |
1033 | - foreach ( $installed['message_types'] as $imt ) { |
|
1034 | - if ( $imt instanceof EE_message_type ) { |
|
1033 | + foreach ($installed['message_types'] as $imt) { |
|
1034 | + if ($imt instanceof EE_message_type) { |
|
1035 | 1035 | $installed_mts[$imt->name] = $imt; |
1036 | 1036 | } |
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | //loop through default array for default messengers (if present) |
1040 | - if ( ! empty( $def_ms ) ) { |
|
1041 | - foreach ( $def_ms as $messenger ) { |
|
1040 | + if ( ! empty($def_ms)) { |
|
1041 | + foreach ($def_ms as $messenger) { |
|
1042 | 1042 | //all is good so let's setup the default stuff. We need to use the given messenger object (if exists) to get the default message type for the messenger. |
1043 | - if ( ! isset( $installed_messengers[$messenger] )) { |
|
1043 | + if ( ! isset($installed_messengers[$messenger])) { |
|
1044 | 1044 | continue; |
1045 | 1045 | } |
1046 | 1046 | /** @var EE_messenger[] $installed_messengers */ |
1047 | 1047 | $default_mts = $installed_messengers[$messenger]->get_default_message_types(); |
1048 | 1048 | $active_messengers[$messenger]['obj'] = $installed_messengers[$messenger]; |
1049 | - foreach ( $default_mts as $index => $mt ) { |
|
1049 | + foreach ($default_mts as $index => $mt) { |
|
1050 | 1050 | //is there an installed_mt matching the default string? If not then nothing to do here. |
1051 | - if ( ! isset( $installed_mts[$mt] ) ) { |
|
1052 | - unset( $default_mts[$index] ); |
|
1051 | + if ( ! isset($installed_mts[$mt])) { |
|
1052 | + unset($default_mts[$index]); |
|
1053 | 1053 | continue; |
1054 | 1054 | } |
1055 | 1055 | |
@@ -1058,41 +1058,41 @@ discard block |
||
1058 | 1058 | /** @var EE_message_type[] $installed_mts */ |
1059 | 1059 | $settings_fields = $installed_mts[$mt]->get_admin_settings_fields(); |
1060 | 1060 | $settings = array(); |
1061 | - if ( is_array( $settings_fields ) ) { |
|
1062 | - foreach ( $settings_fields as $field => $values ) { |
|
1063 | - if ( isset( $values['default'] ) ) { |
|
1061 | + if (is_array($settings_fields)) { |
|
1062 | + foreach ($settings_fields as $field => $values) { |
|
1063 | + if (isset($values['default'])) { |
|
1064 | 1064 | $settings[$field] = $values['default']; |
1065 | 1065 | } |
1066 | 1066 | } |
1067 | 1067 | } |
1068 | 1068 | |
1069 | - $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings; |
|
1069 | + $active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings; |
|
1070 | 1070 | $has_activated[$messenger][] = $mt; |
1071 | 1071 | } |
1072 | 1072 | |
1073 | 1073 | //setup any initial settings for the messenger |
1074 | 1074 | $msgr_settings = $installed_messengers[$messenger]->get_admin_settings_fields(); |
1075 | 1075 | |
1076 | - if ( !empty( $msgr_settings ) ) { |
|
1077 | - foreach ( $msgr_settings as $field => $value ) { |
|
1076 | + if ( ! empty($msgr_settings)) { |
|
1077 | + foreach ($msgr_settings as $field => $value) { |
|
1078 | 1078 | $active_messengers[$messenger]['settings'][$field] = $value; |
1079 | 1079 | } |
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | //now let's save the settings for this messenger! Must do now because the validator checks the db for active messengers to validate. |
1083 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
1083 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
1084 | 1084 | |
1085 | 1085 | //let's generate all the templates but only if the messenger has default_mts (otherwise its just activated). |
1086 | - if ( !empty( $default_mts ) ) { |
|
1087 | - $success = EEH_MSG_Template::generate_new_templates( $messenger, $default_mts, '', TRUE ); |
|
1086 | + if ( ! empty($default_mts)) { |
|
1087 | + $success = EEH_MSG_Template::generate_new_templates($messenger, $default_mts, '', TRUE); |
|
1088 | 1088 | } |
1089 | 1089 | } |
1090 | 1090 | } //end check for empty( $def_ms ) |
1091 | 1091 | |
1092 | 1092 | //still need to see if there are any message types to activate for active messengers |
1093 | - foreach ( $active_messengers as $messenger => $settings ) { |
|
1093 | + foreach ($active_messengers as $messenger => $settings) { |
|
1094 | 1094 | $msg_obj = $settings['obj']; |
1095 | - if ( ! $msg_obj instanceof EE_messenger ) { |
|
1095 | + if ( ! $msg_obj instanceof EE_messenger) { |
|
1096 | 1096 | continue; |
1097 | 1097 | } |
1098 | 1098 | |
@@ -1100,45 +1100,45 @@ discard block |
||
1100 | 1100 | $new_default_mts = array(); |
1101 | 1101 | |
1102 | 1102 | //loop through each default mt reported by the messenger and make sure its set in its active db entry. |
1103 | - foreach( $all_default_mts as $index => $mt ) { |
|
1103 | + foreach ($all_default_mts as $index => $mt) { |
|
1104 | 1104 | //already active? already has generated templates? || has already been activated before (we dont' want to reactivate things users intentionally deactivated). |
1105 | - if ( ( isset( $has_activated[$messenger] ) && in_array($mt, $has_activated[$messenger]) ) || isset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) || EEH_MSG_Template::already_generated( $messenger, $mt, 0, FALSE ) ) { |
|
1105 | + if ((isset($has_activated[$messenger]) && in_array($mt, $has_activated[$messenger])) || isset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) || EEH_MSG_Template::already_generated($messenger, $mt, 0, FALSE)) { |
|
1106 | 1106 | continue; |
1107 | 1107 | } |
1108 | 1108 | |
1109 | 1109 | //is there an installed_mt matching the default string? If not then nothing to do here. |
1110 | - if ( ! isset( $installed_mts[$mt] ) ) { |
|
1111 | - unset( $all_default_mts[$mt] ); |
|
1110 | + if ( ! isset($installed_mts[$mt])) { |
|
1111 | + unset($all_default_mts[$mt]); |
|
1112 | 1112 | continue; |
1113 | 1113 | } |
1114 | 1114 | |
1115 | 1115 | $settings_fields = $installed_mts[$mt]->get_admin_settings_fields(); |
1116 | 1116 | $settings = array(); |
1117 | - if ( is_array( $settings_fields ) ) { |
|
1118 | - foreach ( $settings_fields as $field => $values ) { |
|
1119 | - if ( isset( $values['default'] ) ) { |
|
1117 | + if (is_array($settings_fields)) { |
|
1118 | + foreach ($settings_fields as $field => $values) { |
|
1119 | + if (isset($values['default'])) { |
|
1120 | 1120 | $settings[$field] = $values['default']; |
1121 | 1121 | } |
1122 | 1122 | } |
1123 | 1123 | } |
1124 | 1124 | |
1125 | - $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings; |
|
1125 | + $active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings; |
|
1126 | 1126 | $new_default_mts[] = $mt; |
1127 | 1127 | $has_activated[$messenger][] = $mt; |
1128 | 1128 | } |
1129 | 1129 | |
1130 | 1130 | |
1131 | - if ( ! empty( $new_default_mts ) ) { |
|
1132 | - $success = EEH_MSG_Template::generate_new_templates( $messenger, $new_default_mts, '', TRUE ); |
|
1131 | + if ( ! empty($new_default_mts)) { |
|
1132 | + $success = EEH_MSG_Template::generate_new_templates($messenger, $new_default_mts, '', TRUE); |
|
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | } |
1136 | 1136 | |
1137 | 1137 | //now let's save the settings for this messenger! |
1138 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
1138 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
1139 | 1139 | |
1140 | 1140 | //update $has_activated record |
1141 | - update_option( 'ee_has_activated_messenger', $has_activated ); |
|
1141 | + update_option('ee_has_activated_messenger', $has_activated); |
|
1142 | 1142 | |
1143 | 1143 | //that's it! |
1144 | 1144 | return $success; |
@@ -1158,47 +1158,47 @@ discard block |
||
1158 | 1158 | */ |
1159 | 1159 | public static function validate_messages_system() { |
1160 | 1160 | //include our helper |
1161 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
1161 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
1162 | 1162 | |
1163 | 1163 | //get active and installed messengers/message types. |
1164 | 1164 | $active_messengers = EEH_MSG_Template::get_active_messengers_in_db(); |
1165 | 1165 | $installed = EEH_MSG_Template::get_installed_message_objects(); |
1166 | 1166 | $installed_messengers = $installed_mts = array(); |
1167 | 1167 | //set up the arrays so they can be handled easier. |
1168 | - foreach( $installed['messengers'] as $im ) { |
|
1169 | - if ( $im instanceof EE_messenger ) { |
|
1168 | + foreach ($installed['messengers'] as $im) { |
|
1169 | + if ($im instanceof EE_messenger) { |
|
1170 | 1170 | $installed_messengers[$im->name] = $im; |
1171 | 1171 | } |
1172 | 1172 | } |
1173 | - foreach( $installed['message_types'] as $imt ) { |
|
1174 | - if ( $imt instanceof EE_message_type ) { |
|
1173 | + foreach ($installed['message_types'] as $imt) { |
|
1174 | + if ($imt instanceof EE_message_type) { |
|
1175 | 1175 | $installed_mts[$imt->name] = $imt; |
1176 | 1176 | } |
1177 | 1177 | } |
1178 | 1178 | |
1179 | 1179 | //now let's loop through the active array and validate |
1180 | - foreach( $active_messengers as $messenger => $active_details ) { |
|
1180 | + foreach ($active_messengers as $messenger => $active_details) { |
|
1181 | 1181 | //first let's see if this messenger is installed. |
1182 | - if ( ! isset( $installed_messengers[$messenger] ) ) { |
|
1182 | + if ( ! isset($installed_messengers[$messenger])) { |
|
1183 | 1183 | //not set so let's just remove from actives and make sure templates are inactive. |
1184 | - unset( $active_messengers[$messenger] ); |
|
1185 | - EEH_MSG_Template::update_to_inactive( $messenger ); |
|
1184 | + unset($active_messengers[$messenger]); |
|
1185 | + EEH_MSG_Template::update_to_inactive($messenger); |
|
1186 | 1186 | continue; |
1187 | 1187 | } |
1188 | 1188 | |
1189 | 1189 | //messenger is active, so let's just make sure that any active message types not installed are deactivated. |
1190 | - $mts = ! empty( $active_details['settings'][$messenger . '-message_types'] ) ? $active_details['settings'][$messenger . '-message_types'] : array(); |
|
1191 | - foreach ( $mts as $mt_name => $mt ) { |
|
1192 | - if ( ! isset( $installed_mts[$mt_name] ) ) { |
|
1193 | - unset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt_name] ); |
|
1194 | - EEH_MSG_Template::update_to_inactive( $messenger, $mt_name ); |
|
1190 | + $mts = ! empty($active_details['settings'][$messenger.'-message_types']) ? $active_details['settings'][$messenger.'-message_types'] : array(); |
|
1191 | + foreach ($mts as $mt_name => $mt) { |
|
1192 | + if ( ! isset($installed_mts[$mt_name])) { |
|
1193 | + unset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt_name]); |
|
1194 | + EEH_MSG_Template::update_to_inactive($messenger, $mt_name); |
|
1195 | 1195 | } |
1196 | 1196 | } |
1197 | 1197 | } |
1198 | 1198 | |
1199 | 1199 | //all done! let's update the active_messengers. |
1200 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
1201 | - do_action( 'AHEE__EEH_Activation__validate_messages_system' ); |
|
1200 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
1201 | + do_action('AHEE__EEH_Activation__validate_messages_system'); |
|
1202 | 1202 | return; |
1203 | 1203 | } |
1204 | 1204 | |
@@ -1212,12 +1212,12 @@ discard block |
||
1212 | 1212 | * @static |
1213 | 1213 | * @return void |
1214 | 1214 | */ |
1215 | - public static function create_no_ticket_prices_array(){ |
|
1215 | + public static function create_no_ticket_prices_array() { |
|
1216 | 1216 | // this creates an array for tracking events that have no active ticket prices created |
1217 | 1217 | // this allows us to warn admins of the situation so that it can be corrected |
1218 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE ); |
|
1219 | - if ( ! $espresso_no_ticket_prices ) { |
|
1220 | - add_option( 'ee_no_ticket_prices', array(), '', FALSE ); |
|
1218 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE); |
|
1219 | + if ( ! $espresso_no_ticket_prices) { |
|
1220 | + add_option('ee_no_ticket_prices', array(), '', FALSE); |
|
1221 | 1221 | } |
1222 | 1222 | } |
1223 | 1223 | |
@@ -1239,24 +1239,24 @@ discard block |
||
1239 | 1239 | * Finds all our EE4 custom post types, and deletes them and their associated data (like post meta or term relations)/ |
1240 | 1240 | * @global wpdb $wpdb |
1241 | 1241 | */ |
1242 | - public static function delete_all_espresso_cpt_data(){ |
|
1242 | + public static function delete_all_espresso_cpt_data() { |
|
1243 | 1243 | global $wpdb; |
1244 | 1244 | //get all the CPT post_types |
1245 | 1245 | $ee_post_types = array(); |
1246 | - foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){ |
|
1247 | - if ( method_exists( $model_name, 'instance' )) { |
|
1248 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
1249 | - if ( $model_obj instanceof EEM_CPT_Base ) { |
|
1250 | - $ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type()); |
|
1246 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
1247 | + if (method_exists($model_name, 'instance')) { |
|
1248 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
1249 | + if ($model_obj instanceof EEM_CPT_Base) { |
|
1250 | + $ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type()); |
|
1251 | 1251 | } |
1252 | 1252 | } |
1253 | 1253 | } |
1254 | 1254 | //get all our CPTs |
1255 | - $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")"; |
|
1255 | + $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")"; |
|
1256 | 1256 | $cpt_ids = $wpdb->get_col($query); |
1257 | 1257 | //delete each post meta and term relations too |
1258 | - foreach($cpt_ids as $post_id){ |
|
1259 | - wp_delete_post($post_id,true); |
|
1258 | + foreach ($cpt_ids as $post_id) { |
|
1259 | + wp_delete_post($post_id, true); |
|
1260 | 1260 | } |
1261 | 1261 | } |
1262 | 1262 | |
@@ -1270,18 +1270,18 @@ discard block |
||
1270 | 1270 | * @param bool $remove_all |
1271 | 1271 | * @return void |
1272 | 1272 | */ |
1273 | - public static function delete_all_espresso_tables_and_data( $remove_all = true ) { |
|
1273 | + public static function delete_all_espresso_tables_and_data($remove_all = true) { |
|
1274 | 1274 | global $wpdb; |
1275 | 1275 | $undeleted_tables = array(); |
1276 | 1276 | |
1277 | 1277 | // load registry |
1278 | - foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){ |
|
1279 | - if ( method_exists( $model_name, 'instance' )) { |
|
1280 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
1281 | - if ( $model_obj instanceof EEM_Base ) { |
|
1282 | - foreach ( $model_obj->get_tables() as $table ) { |
|
1283 | - if ( strpos( $table->get_table_name(), 'esp_' )) { |
|
1284 | - switch ( EEH_Activation::delete_unused_db_table( $table->get_table_name() )) { |
|
1278 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
1279 | + if (method_exists($model_name, 'instance')) { |
|
1280 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
1281 | + if ($model_obj instanceof EEM_Base) { |
|
1282 | + foreach ($model_obj->get_tables() as $table) { |
|
1283 | + if (strpos($table->get_table_name(), 'esp_')) { |
|
1284 | + switch (EEH_Activation::delete_unused_db_table($table->get_table_name())) { |
|
1285 | 1285 | case false : |
1286 | 1286 | $undeleted_tables[] = $table->get_table_name(); |
1287 | 1287 | break; |
@@ -1306,8 +1306,8 @@ discard block |
||
1306 | 1306 | 'esp_promotion_rule', |
1307 | 1307 | 'esp_rule' |
1308 | 1308 | ); |
1309 | - foreach( $tables_without_models as $table ){ |
|
1310 | - EEH_Activation::delete_db_table_if_empty( $table ); |
|
1309 | + foreach ($tables_without_models as $table) { |
|
1310 | + EEH_Activation::delete_db_table_if_empty($table); |
|
1311 | 1311 | } |
1312 | 1312 | |
1313 | 1313 | |
@@ -1345,58 +1345,58 @@ discard block |
||
1345 | 1345 | 'ee_job_parameters_' => false, |
1346 | 1346 | 'ee_upload_directories_incomplete' => true, |
1347 | 1347 | ); |
1348 | - if( is_main_site() ) { |
|
1349 | - $wp_options_to_delete[ 'ee_network_config' ] = true; |
|
1348 | + if (is_main_site()) { |
|
1349 | + $wp_options_to_delete['ee_network_config'] = true; |
|
1350 | 1350 | } |
1351 | 1351 | |
1352 | 1352 | $undeleted_options = array(); |
1353 | - foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) { |
|
1353 | + foreach ($wp_options_to_delete as $option_name => $no_wildcard) { |
|
1354 | 1354 | |
1355 | - if( $no_wildcard ){ |
|
1356 | - if( ! delete_option( $option_name ) ){ |
|
1355 | + if ($no_wildcard) { |
|
1356 | + if ( ! delete_option($option_name)) { |
|
1357 | 1357 | $undeleted_options[] = $option_name; |
1358 | 1358 | } |
1359 | - }else{ |
|
1360 | - $option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" ); |
|
1361 | - foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){ |
|
1362 | - if( ! delete_option( $option_name_from_wildcard ) ){ |
|
1359 | + } else { |
|
1360 | + $option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'"); |
|
1361 | + foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) { |
|
1362 | + if ( ! delete_option($option_name_from_wildcard)) { |
|
1363 | 1363 | $undeleted_options[] = $option_name_from_wildcard; |
1364 | 1364 | } |
1365 | 1365 | } |
1366 | 1366 | } |
1367 | 1367 | } |
1368 | 1368 | //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
1369 | - remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1369 | + remove_action('shutdown', array(EE_Config::instance(), 'shutdown'), 10); |
|
1370 | 1370 | |
1371 | - if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) { |
|
1371 | + if ($remove_all && $espresso_db_update = get_option('espresso_db_update')) { |
|
1372 | 1372 | $db_update_sans_ee4 = array(); |
1373 | - foreach($espresso_db_update as $version => $times_activated){ |
|
1374 | - if( $version[0] =='3'){//if its NON EE4 |
|
1373 | + foreach ($espresso_db_update as $version => $times_activated) { |
|
1374 | + if ($version[0] == '3') {//if its NON EE4 |
|
1375 | 1375 | $db_update_sans_ee4[$version] = $times_activated; |
1376 | 1376 | } |
1377 | 1377 | } |
1378 | - update_option( 'espresso_db_update', $db_update_sans_ee4 ); |
|
1378 | + update_option('espresso_db_update', $db_update_sans_ee4); |
|
1379 | 1379 | } |
1380 | 1380 | |
1381 | 1381 | $errors = ''; |
1382 | - if ( ! empty( $undeleted_tables )) { |
|
1382 | + if ( ! empty($undeleted_tables)) { |
|
1383 | 1383 | $errors .= sprintf( |
1384 | - __( 'The following tables could not be deleted: %s%s', 'event_espresso' ), |
|
1384 | + __('The following tables could not be deleted: %s%s', 'event_espresso'), |
|
1385 | 1385 | '<br/>', |
1386 | - implode( ',<br/>', $undeleted_tables ) |
|
1386 | + implode(',<br/>', $undeleted_tables) |
|
1387 | 1387 | ); |
1388 | 1388 | } |
1389 | - if ( ! empty( $undeleted_options )) { |
|
1390 | - $errors .= ! empty( $undeleted_tables ) ? '<br/>' : ''; |
|
1389 | + if ( ! empty($undeleted_options)) { |
|
1390 | + $errors .= ! empty($undeleted_tables) ? '<br/>' : ''; |
|
1391 | 1391 | $errors .= sprintf( |
1392 | - __( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ), |
|
1392 | + __('The following wp-options could not be deleted: %s%s', 'event_espresso'), |
|
1393 | 1393 | '<br/>', |
1394 | - implode( ',<br/>', $undeleted_options ) |
|
1394 | + implode(',<br/>', $undeleted_options) |
|
1395 | 1395 | ); |
1396 | 1396 | |
1397 | 1397 | } |
1398 | - if ( $errors != '' ) { |
|
1399 | - EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
1398 | + if ($errors != '') { |
|
1399 | + EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__); |
|
1400 | 1400 | } |
1401 | 1401 | } |
1402 | 1402 | |
@@ -1406,23 +1406,23 @@ discard block |
||
1406 | 1406 | * @param string $table_name with or without $wpdb->prefix |
1407 | 1407 | * @return boolean |
1408 | 1408 | */ |
1409 | - public static function table_exists( $table_name ){ |
|
1409 | + public static function table_exists($table_name) { |
|
1410 | 1410 | global $wpdb, $EZSQL_ERROR; |
1411 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
1411 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
1412 | 1412 | //ignore if this causes an sql error |
1413 | 1413 | $old_error = $wpdb->last_error; |
1414 | 1414 | $old_suppress_errors = $wpdb->suppress_errors(); |
1415 | - $old_show_errors_value = $wpdb->show_errors( FALSE ); |
|
1415 | + $old_show_errors_value = $wpdb->show_errors(FALSE); |
|
1416 | 1416 | $ezsql_error_cache = $EZSQL_ERROR; |
1417 | - $wpdb->get_results( "SELECT * from $table_name LIMIT 1"); |
|
1418 | - $wpdb->show_errors( $old_show_errors_value ); |
|
1419 | - $wpdb->suppress_errors( $old_suppress_errors ); |
|
1417 | + $wpdb->get_results("SELECT * from $table_name LIMIT 1"); |
|
1418 | + $wpdb->show_errors($old_show_errors_value); |
|
1419 | + $wpdb->suppress_errors($old_suppress_errors); |
|
1420 | 1420 | $new_error = $wpdb->last_error; |
1421 | 1421 | $wpdb->last_error = $old_error; |
1422 | 1422 | $EZSQL_ERROR = $ezsql_error_cache; |
1423 | - if( empty( $new_error ) ){ |
|
1423 | + if (empty($new_error)) { |
|
1424 | 1424 | return TRUE; |
1425 | - }else{ |
|
1425 | + } else { |
|
1426 | 1426 | return FALSE; |
1427 | 1427 | } |
1428 | 1428 | } |
@@ -1430,7 +1430,7 @@ discard block |
||
1430 | 1430 | /** |
1431 | 1431 | * Resets the cache on EEH_Activation |
1432 | 1432 | */ |
1433 | - public static function reset(){ |
|
1433 | + public static function reset() { |
|
1434 | 1434 | self::$_default_creator_id = NULL; |
1435 | 1435 | self::$_initialized_db_content_already_in_this_request = false; |
1436 | 1436 | } |
@@ -1365,8 +1365,8 @@ |
||
1365 | 1365 | } |
1366 | 1366 | } |
1367 | 1367 | } |
1368 | - //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
|
1369 | - remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1368 | + //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
|
1369 | + remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1370 | 1370 | |
1371 | 1371 | if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) { |
1372 | 1372 | $db_update_sans_ee4 = array(); |