@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return EED_Feeds |
30 | 30 | */ |
31 | 31 | public static function instance() { |
32 | - return parent::get_instance( __CLASS__ ); |
|
32 | + return parent::get_instance(__CLASS__); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | * @return void |
42 | 42 | */ |
43 | 43 | public static function set_hooks() { |
44 | - add_action( 'parse_request', array( 'EED_Feeds', 'parse_request' ), 10 ); |
|
45 | - add_filter( 'default_feed', array( 'EED_Feeds', 'default_feed' ), 10, 1 ); |
|
46 | - add_filter( 'comment_feed_join', array( 'EED_Feeds', 'comment_feed_join' ), 10, 2 ); |
|
47 | - add_filter( 'comment_feed_where', array( 'EED_Feeds', 'comment_feed_where' ), 10, 2 ); |
|
44 | + add_action('parse_request', array('EED_Feeds', 'parse_request'), 10); |
|
45 | + add_filter('default_feed', array('EED_Feeds', 'default_feed'), 10, 1); |
|
46 | + add_filter('comment_feed_join', array('EED_Feeds', 'comment_feed_join'), 10, 2); |
|
47 | + add_filter('comment_feed_where', array('EED_Feeds', 'comment_feed_where'), 10, 2); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @access public |
65 | 65 | * @return void |
66 | 66 | */ |
67 | - public function run( $WP ) { |
|
67 | + public function run($WP) { |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param type rss2, atom, rss, rdf, rssjs |
77 | 77 | * @return string |
78 | 78 | */ |
79 | - public static function default_feed( $type = 'rss2' ) { |
|
79 | + public static function default_feed($type = 'rss2') { |
|
80 | 80 | //rss2, atom, rss, rdf, rssjs |
81 | 81 | $type = 'rss2'; |
82 | 82 | return $type; |
@@ -92,24 +92,24 @@ discard block |
||
92 | 92 | * @return void |
93 | 93 | */ |
94 | 94 | public static function parse_request() { |
95 | - if ( EE_Registry::instance()->REQ->is_set( 'post_type' )) { |
|
95 | + if (EE_Registry::instance()->REQ->is_set('post_type')) { |
|
96 | 96 | // define path to templates |
97 | - define( 'RSS_FEEDS_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
97 | + define('RSS_FEEDS_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
98 | 98 | // what kinda post_type are we dealing with ? |
99 | - switch( EE_Registry::instance()->REQ->get( 'post_type' )) { |
|
99 | + switch (EE_Registry::instance()->REQ->get('post_type')) { |
|
100 | 100 | case 'espresso_events' : |
101 | 101 | // for rss2, atom, rss, rdf |
102 | - add_filter( 'the_excerpt_rss', array( 'EED_Feeds', 'the_event_feed' ), 10, 1 ); |
|
103 | - add_filter( 'the_content_feed', array( 'EED_Feeds', 'the_event_feed' ), 10, 1 ); |
|
102 | + add_filter('the_excerpt_rss', array('EED_Feeds', 'the_event_feed'), 10, 1); |
|
103 | + add_filter('the_content_feed', array('EED_Feeds', 'the_event_feed'), 10, 1); |
|
104 | 104 | // for json ( also uses the above filter ) |
105 | - add_filter( 'rssjs_feed_item', array( 'EED_Feeds', 'the_event_rssjs_feed' ), 10, 1 ); |
|
105 | + add_filter('rssjs_feed_item', array('EED_Feeds', 'the_event_rssjs_feed'), 10, 1); |
|
106 | 106 | break; |
107 | 107 | case 'espresso_venues' : |
108 | 108 | // for rss2, atom, rss, rdf |
109 | - add_filter( 'the_excerpt_rss', array( 'EED_Feeds', 'the_venue_feed' ), 10, 1 ); |
|
110 | - add_filter( 'the_content_feed', array( 'EED_Feeds', 'the_venue_feed' ), 10, 1 ); |
|
109 | + add_filter('the_excerpt_rss', array('EED_Feeds', 'the_venue_feed'), 10, 1); |
|
110 | + add_filter('the_content_feed', array('EED_Feeds', 'the_venue_feed'), 10, 1); |
|
111 | 111 | // for json ( also uses the above filter ) |
112 | - add_filter( 'rssjs_feed_item', array( 'EED_Feeds', 'the_venue_rssjs_feed' ), 10, 1 ); |
|
112 | + add_filter('rssjs_feed_item', array('EED_Feeds', 'the_venue_rssjs_feed'), 10, 1); |
|
113 | 113 | break; |
114 | 114 | } |
115 | 115 | } |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | * @param string $SQL the JOIN clause for the comment feed query |
128 | 128 | * @return void |
129 | 129 | */ |
130 | - public static function comment_feed_join( $SQL ) { |
|
130 | + public static function comment_feed_join($SQL) { |
|
131 | 131 | global $wpdb; |
132 | 132 | // check for wp_posts table in JOIN clause |
133 | - if ( strpos( $SQL, $wpdb->posts ) !== FALSE ) { |
|
134 | - add_filter( 'EED_Feeds__comment_feed_where__espresso_attendees', '__return_true' ); |
|
133 | + if (strpos($SQL, $wpdb->posts) !== FALSE) { |
|
134 | + add_filter('EED_Feeds__comment_feed_where__espresso_attendees', '__return_true'); |
|
135 | 135 | } |
136 | 136 | return $SQL; |
137 | 137 | } |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | * @param string $SQL the WHERE clause for the comment feed query |
149 | 149 | * @return void |
150 | 150 | */ |
151 | - public static function comment_feed_where( $SQL ) { |
|
151 | + public static function comment_feed_where($SQL) { |
|
152 | 152 | global $wp_query, $wpdb; |
153 | - if ( $wp_query->is_comment_feed && apply_filters( 'EED_Feeds__comment_feed_where__espresso_attendees', FALSE )) { |
|
153 | + if ($wp_query->is_comment_feed && apply_filters('EED_Feeds__comment_feed_where__espresso_attendees', FALSE)) { |
|
154 | 154 | $SQL .= " AND $wpdb->posts.post_type != 'espresso_attendees'"; |
155 | 155 | } |
156 | 156 | return $SQL; |
@@ -166,14 +166,14 @@ discard block |
||
166 | 166 | * @param string $content |
167 | 167 | * @return void |
168 | 168 | */ |
169 | - public static function the_event_feed( $content ) { |
|
170 | - if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php' )) { |
|
169 | + public static function the_event_feed($content) { |
|
170 | + if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH.'espresso_events_feed.template.php')) { |
|
171 | 171 | global $post; |
172 | 172 | $template_args = array( |
173 | 173 | 'EVT_ID' => $post->ID, |
174 | 174 | 'event_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content |
175 | 175 | ); |
176 | - $content = EEH_Template::display_template( RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php', $template_args, TRUE ); |
|
176 | + $content = EEH_Template::display_template(RSS_FEEDS_TEMPLATES_PATH.'espresso_events_feed.template.php', $template_args, TRUE); |
|
177 | 177 | } |
178 | 178 | return $content; |
179 | 179 | } |
@@ -188,9 +188,9 @@ discard block |
||
188 | 188 | * @param object $item |
189 | 189 | * @return void |
190 | 190 | */ |
191 | - public static function the_event_rssjs_feed( $item ) { |
|
192 | - if ( is_feed() && isset( $item->description )) { |
|
193 | - $item->description = EED_Feeds::the_event_feed( $item->description ); |
|
191 | + public static function the_event_rssjs_feed($item) { |
|
192 | + if (is_feed() && isset($item->description)) { |
|
193 | + $item->description = EED_Feeds::the_event_feed($item->description); |
|
194 | 194 | } |
195 | 195 | return $item; |
196 | 196 | } |
@@ -205,14 +205,14 @@ discard block |
||
205 | 205 | * @param string $content |
206 | 206 | * @return void |
207 | 207 | */ |
208 | - public static function the_venue_feed( $content ) { |
|
209 | - if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php' )) { |
|
208 | + public static function the_venue_feed($content) { |
|
209 | + if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH.'espresso_venues_feed.template.php')) { |
|
210 | 210 | global $post; |
211 | 211 | $template_args = array( |
212 | 212 | 'VNU_ID' => $post->ID, |
213 | 213 | 'venue_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content |
214 | 214 | ); |
215 | - $content = EEH_Template::display_template( RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php', $template_args, TRUE ); |
|
215 | + $content = EEH_Template::display_template(RSS_FEEDS_TEMPLATES_PATH.'espresso_venues_feed.template.php', $template_args, TRUE); |
|
216 | 216 | } |
217 | 217 | return $content; |
218 | 218 | } |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | * @param object $item |
228 | 228 | * @return void |
229 | 229 | */ |
230 | - public static function the_venue_rssjs_feed( $item ) { |
|
231 | - if ( is_feed() && isset( $item->description )) { |
|
232 | - $item->description = EED_Feeds::the_venue_feed( $item->description ); |
|
230 | + public static function the_venue_rssjs_feed($item) { |
|
231 | + if (is_feed() && isset($item->description)) { |
|
232 | + $item->description = EED_Feeds::the_venue_feed($item->description); |
|
233 | 233 | } |
234 | 234 | return $item; |
235 | 235 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @return EED_Bot_Trap |
19 | 19 | */ |
20 | 20 | public static function instance() { |
21 | - return parent::get_instance( __CLASS__ ); |
|
21 | + return parent::get_instance(__CLASS__); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
@@ -31,22 +31,22 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public static function set_hooks() { |
33 | 33 | if ( |
34 | - apply_filters( 'FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true ) && |
|
34 | + apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true) && |
|
35 | 35 | EE_Registry::instance()->CFG->registration->use_bot_trap |
36 | 36 | ) { |
37 | - define( 'EE_BOT_TRAP_BASE_URL', plugin_dir_url( __FILE__ ) . DS ); |
|
37 | + define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__).DS); |
|
38 | 38 | add_action( |
39 | 39 | 'AHEE__ticket_selector_chart__template__after_ticket_selector', |
40 | - array( 'EED_Bot_Trap', 'generate_bot_trap' ), |
|
40 | + array('EED_Bot_Trap', 'generate_bot_trap'), |
|
41 | 41 | 10, 2 |
42 | 42 | ); |
43 | 43 | add_action( |
44 | 44 | 'EED_Ticket_Selector__process_ticket_selections__before', |
45 | - array( 'EED_Bot_Trap', 'process_bot_trap' ), |
|
45 | + array('EED_Bot_Trap', 'process_bot_trap'), |
|
46 | 46 | 1, 2 |
47 | 47 | ); |
48 | 48 | // redirect bots to bogus success page |
49 | - EE_Config::register_route( 'ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success' ); |
|
49 | + EE_Config::register_route('ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success'); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | public static function set_hooks_admin() { |
62 | 62 | add_action( |
63 | 63 | 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', |
64 | - array( 'EED_Bot_Trap', 'bot_trap_settings_form' ), |
|
64 | + array('EED_Bot_Trap', 'bot_trap_settings_form'), |
|
65 | 65 | 10 |
66 | 66 | ); |
67 | 67 | add_filter( |
68 | 68 | 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', |
69 | - array( 'EED_Bot_Trap', 'update_bot_trap_settings_form' ), |
|
69 | + array('EED_Bot_Trap', 'update_bot_trap_settings_form'), |
|
70 | 70 | 10, 1 |
71 | 71 | ); |
72 | 72 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @param WP $WP |
81 | 81 | * @return void |
82 | 82 | */ |
83 | - public function run( $WP ) {} |
|
83 | + public function run($WP) {} |
|
84 | 84 | |
85 | 85 | |
86 | 86 | |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | * @return void |
92 | 92 | */ |
93 | 93 | public static function generate_bot_trap() { |
94 | - $do_not_enter = __( 'please do not enter anything in this input', 'event_espresso' ); |
|
94 | + $do_not_enter = __('please do not enter anything in this input', 'event_espresso'); |
|
95 | 95 | $html = '<div id="tkt-slctr-request-processor-dv" style="float:left; margin-left:-999em;">'; |
96 | - $html .= '<label for="tkt-slctr-request-processor-email">' . $do_not_enter . '</label>'; |
|
96 | + $html .= '<label for="tkt-slctr-request-processor-email">'.$do_not_enter.'</label>'; |
|
97 | 97 | $html .= '<input type="email" name="tkt-slctr-request-processor-email" value=""/>'; |
98 | 98 | $html .= '<input type="hidden" name="tkt-slctr-request-processor-token" value="'; |
99 | - if ( EE_Registry::instance()->CFG->registration->use_encryption ) { |
|
100 | - EE_Registry::instance()->load_core( 'EE_Encryption' ); |
|
101 | - $html .= EE_Encryption::instance()->encrypt( time() ); |
|
99 | + if (EE_Registry::instance()->CFG->registration->use_encryption) { |
|
100 | + EE_Registry::instance()->load_core('EE_Encryption'); |
|
101 | + $html .= EE_Encryption::instance()->encrypt(time()); |
|
102 | 102 | } else { |
103 | 103 | $html .= time(); |
104 | 104 | } |
@@ -117,35 +117,35 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public static function process_bot_trap() { |
119 | 119 | // what's your email address Mr. Bot ? |
120 | - $empty_trap = isset( $_REQUEST[ 'tkt-slctr-request-processor-email' ] ) && $_REQUEST[ 'tkt-slctr-request-processor-email' ] == '' ? true : false; |
|
120 | + $empty_trap = isset($_REQUEST['tkt-slctr-request-processor-email']) && $_REQUEST['tkt-slctr-request-processor-email'] == '' ? true : false; |
|
121 | 121 | // get encrypted timestamp for when the form was originally displayed |
122 | - $bot_trap_timestamp = isset( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) ? sanitize_text_field( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) : ''; |
|
122 | + $bot_trap_timestamp = isset($_REQUEST['tkt-slctr-request-processor-token']) ? sanitize_text_field($_REQUEST['tkt-slctr-request-processor-token']) : ''; |
|
123 | 123 | // decrypt and convert to absolute integer |
124 | - if ( EE_Registry::instance()->CFG->registration->use_encryption ) { |
|
125 | - EE_Registry::instance()->load_core( 'EE_Encryption' ); |
|
126 | - $bot_trap_timestamp = absint( EE_Encryption::instance()->decrypt( $bot_trap_timestamp ) ); |
|
124 | + if (EE_Registry::instance()->CFG->registration->use_encryption) { |
|
125 | + EE_Registry::instance()->load_core('EE_Encryption'); |
|
126 | + $bot_trap_timestamp = absint(EE_Encryption::instance()->decrypt($bot_trap_timestamp)); |
|
127 | 127 | } else { |
128 | - $bot_trap_timestamp = absint( $bot_trap_timestamp ); |
|
128 | + $bot_trap_timestamp = absint($bot_trap_timestamp); |
|
129 | 129 | } |
130 | 130 | // ticket form submitted too impossibly fast ( after now ) or more than an hour later ??? |
131 | - $suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < ( time() - HOUR_IN_SECONDS ) ? true : false; |
|
131 | + $suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < (time() - HOUR_IN_SECONDS) ? true : false; |
|
132 | 132 | // are we human ? |
133 | - if ( $empty_trap && ! $suspicious_timing ) { |
|
133 | + if ($empty_trap && ! $suspicious_timing) { |
|
134 | 134 | return; |
135 | 135 | } |
136 | 136 | // UH OH... |
137 | 137 | $redirect_url = add_query_arg( |
138 | - array( 'ee' => 'ticket_selection_received' ), |
|
138 | + array('ee' => 'ticket_selection_received'), |
|
139 | 139 | EE_Registry::instance()->CFG->core->reg_page_url() |
140 | 140 | ); |
141 | - if ( $suspicious_timing ) { |
|
141 | + if ($suspicious_timing) { |
|
142 | 142 | $redirect_url = add_query_arg( |
143 | - array( 'ee-notice' => urlencode( __( 'We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.', 'event_espresso' ) ) ), |
|
143 | + array('ee-notice' => urlencode(__('We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.', 'event_espresso'))), |
|
144 | 144 | $redirect_url |
145 | 145 | ); |
146 | 146 | } |
147 | 147 | wp_safe_redirect( |
148 | - apply_filters( 'FHEE__EED_Bot_Trap__process_bot_trap__redirect_url', $redirect_url ) |
|
148 | + apply_filters('FHEE__EED_Bot_Trap__process_bot_trap__redirect_url', $redirect_url) |
|
149 | 149 | ); |
150 | 150 | exit(); |
151 | 151 | } |
@@ -160,10 +160,10 @@ discard block |
||
160 | 160 | * @return void |
161 | 161 | */ |
162 | 162 | public static function display_bot_trap_success() { |
163 | - add_filter( 'FHEE__EED_Single_Page_Checkout__run', '__return_false' ); |
|
164 | - $bot_notice = __( 'Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso' ); |
|
165 | - $bot_notice = isset( $_REQUEST[ 'ee-notice' ] ) && $_REQUEST[ 'ee-notice' ] !== '' ? sanitize_text_field( stripslashes( $_REQUEST[ 'ee-notice' ] ) ) : $bot_notice; |
|
166 | - EE_Registry::instance()->REQ->add_output( EEH_HTML::div( $bot_notice, '', 'ee-attention' ) ); |
|
163 | + add_filter('FHEE__EED_Single_Page_Checkout__run', '__return_false'); |
|
164 | + $bot_notice = __('Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso'); |
|
165 | + $bot_notice = isset($_REQUEST['ee-notice']) && $_REQUEST['ee-notice'] !== '' ? sanitize_text_field(stripslashes($_REQUEST['ee-notice'])) : $bot_notice; |
|
166 | + EE_Registry::instance()->REQ->add_output(EEH_HTML::div($bot_notice, '', 'ee-attention')); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | |
@@ -197,20 +197,20 @@ discard block |
||
197 | 197 | 'html_id' => 'bot_trap_settings', |
198 | 198 | 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
199 | 199 | 'subsections' => array( |
200 | - 'bot_trap_hdr' => new EE_Form_Section_HTML( EEH_HTML::h2( __( 'Bot Trap Settings', 'event_espresso' ) ) ), |
|
200 | + 'bot_trap_hdr' => new EE_Form_Section_HTML(EEH_HTML::h2(__('Bot Trap Settings', 'event_espresso'))), |
|
201 | 201 | 'use_bot_trap' => new EE_Yes_No_Input( |
202 | 202 | array( |
203 | - 'html_label_text' => __( 'Enable Bot Trap', 'event_espresso' ), |
|
204 | - 'html_help_text' => __( 'The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.', 'event_espresso' ), |
|
205 | - 'default' => isset( EE_Registry::instance()->CFG->registration->use_bot_trap ) ? EE_Registry::instance()->CFG->registration->use_bot_trap : true, |
|
203 | + 'html_label_text' => __('Enable Bot Trap', 'event_espresso'), |
|
204 | + 'html_help_text' => __('The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.', 'event_espresso'), |
|
205 | + 'default' => isset(EE_Registry::instance()->CFG->registration->use_bot_trap) ? EE_Registry::instance()->CFG->registration->use_bot_trap : true, |
|
206 | 206 | 'required' => false |
207 | 207 | ) |
208 | 208 | ), |
209 | 209 | 'use_encryption' => new EE_Yes_No_Input( |
210 | 210 | array( |
211 | - 'html_label_text' => __( 'Encrypt Bot Trap Data', 'event_espresso' ), |
|
212 | - 'html_help_text' => __( 'One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.', 'event_espresso' ), |
|
213 | - 'default' => isset( EE_Registry::instance()->CFG->registration->use_encryption ) ? EE_Registry::instance()->CFG->registration->use_encryption : true, |
|
211 | + 'html_label_text' => __('Encrypt Bot Trap Data', 'event_espresso'), |
|
212 | + 'html_help_text' => __('One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.', 'event_espresso'), |
|
213 | + 'default' => isset(EE_Registry::instance()->CFG->registration->use_encryption) ? EE_Registry::instance()->CFG->registration->use_encryption : true, |
|
214 | 214 | 'required' => false |
215 | 215 | ) |
216 | 216 | ), |
@@ -228,30 +228,30 @@ discard block |
||
228 | 228 | * @param \EE_Registration_Config $EE_Registration_Config |
229 | 229 | * @return \EE_Registration_Config |
230 | 230 | */ |
231 | - public static function update_bot_trap_settings_form( EE_Registration_Config $EE_Registration_Config ) { |
|
231 | + public static function update_bot_trap_settings_form(EE_Registration_Config $EE_Registration_Config) { |
|
232 | 232 | try { |
233 | 233 | $bot_trap_settings_form = EED_Bot_Trap::_bot_trap_settings_form(); |
234 | 234 | // if not displaying a form, then check for form submission |
235 | - if ( $bot_trap_settings_form->was_submitted() ) { |
|
235 | + if ($bot_trap_settings_form->was_submitted()) { |
|
236 | 236 | // capture form data |
237 | 237 | $bot_trap_settings_form->receive_form_submission(); |
238 | 238 | // validate form data |
239 | - if ( $bot_trap_settings_form->is_valid() ) { |
|
239 | + if ($bot_trap_settings_form->is_valid()) { |
|
240 | 240 | // grab validated data from form |
241 | 241 | $valid_data = $bot_trap_settings_form->valid_data(); |
242 | - if ( isset( $valid_data[ 'use_bot_trap' ], $valid_data[ 'use_encryption' ] ) ) { |
|
243 | - $EE_Registration_Config->use_bot_trap = $valid_data[ 'use_bot_trap' ]; |
|
244 | - $EE_Registration_Config->use_encryption = $valid_data[ 'use_encryption' ]; |
|
242 | + if (isset($valid_data['use_bot_trap'], $valid_data['use_encryption'])) { |
|
243 | + $EE_Registration_Config->use_bot_trap = $valid_data['use_bot_trap']; |
|
244 | + $EE_Registration_Config->use_encryption = $valid_data['use_encryption']; |
|
245 | 245 | } else { |
246 | - EE_Error::add_error( __( 'Invalid or missing Bot Trap settings. Please refresh the form and try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
246 | + EE_Error::add_error(__('Invalid or missing Bot Trap settings. Please refresh the form and try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
247 | 247 | } |
248 | 248 | } else { |
249 | - if ( $bot_trap_settings_form->submission_error_message() != '' ) { |
|
250 | - EE_Error::add_error( $bot_trap_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
249 | + if ($bot_trap_settings_form->submission_error_message() != '') { |
|
250 | + EE_Error::add_error($bot_trap_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 | } |
254 | - } catch ( EE_Error $e ) { |
|
254 | + } catch (EE_Error $e) { |
|
255 | 255 | $e->get_error(); |
256 | 256 | } |
257 | 257 | return $EE_Registration_Config; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | class Maintenance_Admin_Page extends EE_Admin_Page { |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( $routing = TRUE ) { |
|
34 | - parent::__construct( $routing ); |
|
33 | + public function __construct($routing = TRUE) { |
|
34 | + parent::__construct($routing); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | |
47 | 47 | |
48 | 48 | protected function _ajax_hooks() { |
49 | - add_action('wp_ajax_migration_step',array($this,'migration_step')); |
|
50 | - add_action('wp_ajax_add_error_to_migrations_ran',array($this,'add_error_to_migrations_ran')); |
|
49 | + add_action('wp_ajax_migration_step', array($this, 'migration_step')); |
|
50 | + add_action('wp_ajax_add_error_to_migrations_ran', array($this, 'add_error_to_migrations_ran')); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $this->_admin_page_title = EE_MAINTENANCE_LABEL; |
57 | 57 | $this->_labels = array( |
58 | 58 | 'buttons' => array( |
59 | - 'reset_capabilities' => __( 'Reset Event Espresso Capabilities', 'event_espresso' ) |
|
59 | + 'reset_capabilities' => __('Reset Event Espresso Capabilities', 'event_espresso') |
|
60 | 60 | ) |
61 | 61 | ); |
62 | 62 | } |
@@ -155,23 +155,23 @@ discard block |
||
155 | 155 | * default maintenance page. If we're in maintenance mode level 2, then we need to show |
156 | 156 | * the migration scripts and all that UI. |
157 | 157 | */ |
158 | - public function _maintenance(){ |
|
158 | + public function _maintenance() { |
|
159 | 159 | //it all depends if we're in maintenance model level 1 (frontend-only) or |
160 | 160 | //level 2 (everything except maintenance page) |
161 | - try{ |
|
161 | + try { |
|
162 | 162 | //get the current maintenance level and check if |
163 | 163 | //we are removed |
164 | 164 | $mm = EE_Maintenance_Mode::instance()->level(); |
165 | 165 | $placed_in_mm = EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
166 | - if( $mm == EE_Maintenance_Mode::level_2_complete_maintenance && ! $placed_in_mm){ |
|
166 | + if ($mm == EE_Maintenance_Mode::level_2_complete_maintenance && ! $placed_in_mm) { |
|
167 | 167 | //we just took the site out of maintenance mode, so notify the user. |
168 | 168 | //unfortunately this message appears to be echoed on the NEXT page load... |
169 | 169 | //oh well, we should really be checking for this on addon deactivation anyways |
170 | - EE_Error::add_attention( __( 'Site taken out of maintenance mode because no data migration scripts are required', 'event_espresso' ) ); |
|
171 | - $this->_process_notices( array( 'page' => 'espresso_maintenance_settings'), false ); |
|
170 | + EE_Error::add_attention(__('Site taken out of maintenance mode because no data migration scripts are required', 'event_espresso')); |
|
171 | + $this->_process_notices(array('page' => 'espresso_maintenance_settings'), false); |
|
172 | 172 | } |
173 | 173 | //in case an exception is thrown while trying to handle migrations |
174 | - switch(EE_Maintenance_Mode::instance()->level()){ |
|
174 | + switch (EE_Maintenance_Mode::instance()->level()) { |
|
175 | 175 | case EE_Maintenance_Mode::level_0_not_in_maintenance: |
176 | 176 | case EE_Maintenance_Mode::level_1_frontend_only_maintenance: |
177 | 177 | $show_maintenance_switch = true; |
@@ -183,18 +183,18 @@ discard block |
||
183 | 183 | case EE_Maintenance_Mode::level_2_complete_maintenance: |
184 | 184 | $show_maintenance_switch = false; |
185 | 185 | $show_migration_progress = true; |
186 | - if(isset($this->_req_data['continue_migration'])){ |
|
186 | + if (isset($this->_req_data['continue_migration'])) { |
|
187 | 187 | $show_backup_db_text = false; |
188 | - }else{ |
|
188 | + } else { |
|
189 | 189 | $show_backup_db_text = true; |
190 | 190 | } |
191 | 191 | $scripts_needing_to_run = EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts(); |
192 | 192 | $addons_should_be_upgraded_first = EE_Data_Migration_Manager::instance()->addons_need_updating(); |
193 | 193 | $script_names = array(); |
194 | 194 | $current_script = NULL; |
195 | - foreach($scripts_needing_to_run as $script){ |
|
196 | - if($script instanceof EE_Data_Migration_Script_Base){ |
|
197 | - if( ! $current_script){ |
|
195 | + foreach ($scripts_needing_to_run as $script) { |
|
196 | + if ($script instanceof EE_Data_Migration_Script_Base) { |
|
197 | + if ( ! $current_script) { |
|
198 | 198 | $current_script = $script; |
199 | 199 | $current_script->migration_page_hooks(); |
200 | 200 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | } |
206 | 206 | $most_recent_migration = EE_Data_Migration_Manager::instance()->get_last_ran_script(true); |
207 | 207 | $exception_thrown = false; |
208 | - }catch(EE_Error $e){ |
|
208 | + } catch (EE_Error $e) { |
|
209 | 209 | |
210 | 210 | EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($e->getMessage()); |
211 | 211 | //now, just so we can display the page correctly, make a error migration script stage object |
@@ -215,53 +215,53 @@ discard block |
||
215 | 215 | $exception_thrown = true; |
216 | 216 | } |
217 | 217 | $current_db_state = EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set(); |
218 | - if($exception_thrown || |
|
219 | - ( $most_recent_migration && |
|
218 | + if ($exception_thrown || |
|
219 | + ($most_recent_migration && |
|
220 | 220 | $most_recent_migration instanceof EE_Data_Migration_Script_Base && |
221 | 221 | $most_recent_migration->is_broken() |
222 | - )){ |
|
223 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_was_borked_page.template.php'; |
|
224 | - $this->_template_args[ 'support_url' ] = 'http://eventespresso.com/support/forums/'; |
|
225 | - $this->_template_args[ 'next_url' ] = EEH_URL::add_query_args_and_nonce(array( 'action' => 'confirm_migration_crash_report_sent', 'success' => '0' ), EE_MAINTENANCE_ADMIN_URL ); |
|
226 | - }elseif($addons_should_be_upgraded_first){ |
|
227 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_upgrade_addons_before_migrating.template.php'; |
|
228 | - }else{ |
|
229 | - if($most_recent_migration && |
|
230 | - $most_recent_migration instanceof EE_Data_Migration_Script_Base && |
|
231 | - $most_recent_migration->can_continue()){ |
|
222 | + )) { |
|
223 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_migration_was_borked_page.template.php'; |
|
224 | + $this->_template_args['support_url'] = 'http://eventespresso.com/support/forums/'; |
|
225 | + $this->_template_args['next_url'] = EEH_URL::add_query_args_and_nonce(array('action' => 'confirm_migration_crash_report_sent', 'success' => '0'), EE_MAINTENANCE_ADMIN_URL); |
|
226 | + }elseif ($addons_should_be_upgraded_first) { |
|
227 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_upgrade_addons_before_migrating.template.php'; |
|
228 | + } else { |
|
229 | + if ($most_recent_migration && |
|
230 | + $most_recent_migration instanceof EE_Data_Migration_Script_Base && |
|
231 | + $most_recent_migration->can_continue()) { |
|
232 | 232 | $show_backup_db_text = false; |
233 | 233 | $show_continue_current_migration_script = true; |
234 | 234 | $show_most_recent_migration = true; |
235 | - }elseif(isset($this->_req_data['continue_migration'])){ |
|
235 | + }elseif (isset($this->_req_data['continue_migration'])) { |
|
236 | 236 | $show_most_recent_migration = true; |
237 | 237 | $show_continue_current_migration_script = false; |
238 | - }else{ |
|
238 | + } else { |
|
239 | 239 | $show_most_recent_migration = false; |
240 | 240 | $show_continue_current_migration_script = false; |
241 | 241 | } |
242 | 242 | |
243 | - if(isset($current_script)){ |
|
243 | + if (isset($current_script)) { |
|
244 | 244 | $migrates_to = $current_script->migrates_to_version(); |
245 | - $plugin_slug = $migrates_to[ 'slug' ]; |
|
246 | - $new_version = $migrates_to[ 'version' ]; |
|
247 | - $this->_template_args = array_merge($this->_template_args,array( |
|
248 | - 'current_db_state'=> sprintf(__("EE%s (%s)", "event_espresso"), isset($current_db_state[$plugin_slug]) ? $current_db_state[$plugin_slug] : 3,$plugin_slug), |
|
249 | - 'next_db_state'=>isset($current_script) ? sprintf(__("EE%s (%s)", 'event_espresso'),$new_version,$plugin_slug) : NULL)); |
|
245 | + $plugin_slug = $migrates_to['slug']; |
|
246 | + $new_version = $migrates_to['version']; |
|
247 | + $this->_template_args = array_merge($this->_template_args, array( |
|
248 | + 'current_db_state'=> sprintf(__("EE%s (%s)", "event_espresso"), isset($current_db_state[$plugin_slug]) ? $current_db_state[$plugin_slug] : 3, $plugin_slug), |
|
249 | + 'next_db_state'=>isset($current_script) ? sprintf(__("EE%s (%s)", 'event_espresso'), $new_version, $plugin_slug) : NULL)); |
|
250 | 250 | } |
251 | 251 | |
252 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_page.template.php'; |
|
252 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_migration_page.template.php'; |
|
253 | 253 | $this->_template_args = array_merge( |
254 | 254 | $this->_template_args, |
255 | 255 | array( |
256 | - 'show_most_recent_migration' => $show_most_recent_migration,//flag for showing the most recent migration's status and/or errors |
|
257 | - 'show_migration_progress' => $show_migration_progress,//flag for showing the option to run migrations and see their progress |
|
258 | - 'show_backup_db_text' => $show_backup_db_text,//flag for showing text telling the user to backup their DB |
|
259 | - 'show_maintenance_switch'=> $show_maintenance_switch,//flag for showing the option to change maintenance mode between levels 0 and 1 |
|
260 | - 'script_names'=>$script_names,//array of names of scripts that have run |
|
261 | - 'show_continue_current_migration_script'=>$show_continue_current_migration_script,//flag to change wording to indicating that we're only CONTINUING a migration script (somehow it got interrupted0 |
|
256 | + 'show_most_recent_migration' => $show_most_recent_migration, //flag for showing the most recent migration's status and/or errors |
|
257 | + 'show_migration_progress' => $show_migration_progress, //flag for showing the option to run migrations and see their progress |
|
258 | + 'show_backup_db_text' => $show_backup_db_text, //flag for showing text telling the user to backup their DB |
|
259 | + 'show_maintenance_switch'=> $show_maintenance_switch, //flag for showing the option to change maintenance mode between levels 0 and 1 |
|
260 | + 'script_names'=>$script_names, //array of names of scripts that have run |
|
261 | + 'show_continue_current_migration_script'=>$show_continue_current_migration_script, //flag to change wording to indicating that we're only CONTINUING a migration script (somehow it got interrupted0 |
|
262 | 262 | 'reset_db_page_link' => EE_Admin_Page::add_query_args_and_nonce(array('action'=>'reset_db'), EE_MAINTENANCE_ADMIN_URL), |
263 | - 'update_migration_script_page_link' => EE_Admin_Page::add_query_args_and_nonce(array('action'=>'change_maintenance_level'),EE_MAINTENANCE_ADMIN_URL), |
|
264 | - 'ultimate_db_state'=> sprintf(__("EE%s", 'event_espresso'),espresso_version()), |
|
263 | + 'update_migration_script_page_link' => EE_Admin_Page::add_query_args_and_nonce(array('action'=>'change_maintenance_level'), EE_MAINTENANCE_ADMIN_URL), |
|
264 | + 'ultimate_db_state'=> sprintf(__("EE%s", 'event_espresso'), espresso_version()), |
|
265 | 265 | ) |
266 | 266 | ); |
267 | 267 | //make sure we have the form fields helper available. It usually is, but sometimes it isn't |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | 'status_fatal_error'=> EE_Data_Migration_Manager::status_fatal_error, |
276 | 276 | 'status_completed'=> EE_Data_Migration_Manager::status_completed)); |
277 | 277 | } |
278 | - $this->_template_args['most_recent_migration'] = $most_recent_migration;//the actual most recently ran migration |
|
278 | + $this->_template_args['most_recent_migration'] = $most_recent_migration; //the actual most recently ran migration |
|
279 | 279 | $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE); |
280 | 280 | $this->display_admin_page_with_sidebar(); |
281 | 281 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | /** |
286 | 286 | * returns JSON and executes another step of the currently-executing data migration (called via ajax) |
287 | 287 | */ |
288 | - public function migration_step(){ |
|
288 | + public function migration_step() { |
|
289 | 289 | $this->_template_args['data'] = EE_Data_Migration_Manager::instance()->response_to_migration_ajax_request(); |
290 | 290 | $this->_return_json(); |
291 | 291 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * Can be used by js when it notices a response with HTML in it in order |
297 | 297 | * to log the malformed response |
298 | 298 | */ |
299 | - public function add_error_to_migrations_ran(){ |
|
299 | + public function add_error_to_migrations_ran() { |
|
300 | 300 | EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($this->_req_data['message']); |
301 | 301 | $this->_template_args['data'] = array('ok'=>true); |
302 | 302 | $this->_return_json(); |
@@ -307,14 +307,14 @@ discard block |
||
307 | 307 | /** |
308 | 308 | * changes the maintenance level, provided there are still no migration scripts that shoudl run |
309 | 309 | */ |
310 | - public function _change_maintenance_level(){ |
|
310 | + public function _change_maintenance_level() { |
|
311 | 311 | $new_level = intval($this->_req_data['maintenance_mode_level']); |
312 | - if( ! EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()){ |
|
312 | + if ( ! EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) { |
|
313 | 313 | EE_Maintenance_Mode::instance()->set_maintenance_level($new_level); |
314 | 314 | $success = true; |
315 | - }else{ |
|
315 | + } else { |
|
316 | 316 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
317 | - $success= false; |
|
317 | + $success = false; |
|
318 | 318 | } |
319 | 319 | $this->_redirect_after_action($success, 'Maintenance Mode', __("Updated", "event_espresso")); |
320 | 320 | } |
@@ -324,9 +324,9 @@ discard block |
||
324 | 324 | /** |
325 | 325 | * a tab with options for reseting and/or deleting EE data |
326 | 326 | */ |
327 | - public function _data_reset_and_delete(){ |
|
328 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_data_reset_and_delete.template.php'; |
|
329 | - $this->_template_args['reset_capabilities_button'] = $this->get_action_link_or_button( 'reset_capabilities', 'reset_capabilities', array(), 'button button-primary' ); |
|
327 | + public function _data_reset_and_delete() { |
|
328 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_data_reset_and_delete.template.php'; |
|
329 | + $this->_template_args['reset_capabilities_button'] = $this->get_action_link_or_button('reset_capabilities', 'reset_capabilities', array(), 'button button-primary'); |
|
330 | 330 | $this->_template_args['delete_db_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_db'), EE_MAINTENANCE_ADMIN_URL); |
331 | 331 | $this->_template_args['reset_db_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'reset_db'), EE_MAINTENANCE_ADMIN_URL); |
332 | 332 | $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE); |
@@ -336,9 +336,9 @@ discard block |
||
336 | 336 | |
337 | 337 | |
338 | 338 | protected function _reset_capabilities() { |
339 | - EE_Registry::instance()->CAP->init_caps( true ); |
|
340 | - EE_Error::add_success( __('Default Event Espresso capabilities have been restored for all current roles.', 'event_espresso' ) ); |
|
341 | - $this->_redirect_after_action( FALSE, '', '', array( 'action' => 'data_reset' ), TRUE ); |
|
339 | + EE_Registry::instance()->CAP->init_caps(true); |
|
340 | + EE_Error::add_success(__('Default Event Espresso capabilities have been restored for all current roles.', 'event_espresso')); |
|
341 | + $this->_redirect_after_action(FALSE, '', '', array('action' => 'data_reset'), TRUE); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | /** |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | */ |
349 | 349 | protected function _reattempt_migration() { |
350 | 350 | EE_Data_Migration_Manager::instance()->reattempt(); |
351 | - $this->_redirect_after_action( FALSE, '', '', array( 'action' => 'default' ), TRUE ); |
|
351 | + $this->_redirect_after_action(FALSE, '', '', array('action' => 'default'), TRUE); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | |
@@ -357,8 +357,8 @@ discard block |
||
357 | 357 | /** |
358 | 358 | * shows the big ol' System Information page |
359 | 359 | */ |
360 | - public function _system_status(){ |
|
361 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_system_stati_page.template.php'; |
|
360 | + public function _system_status() { |
|
361 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_system_stati_page.template.php'; |
|
362 | 362 | $this->_template_args['system_stati'] = EEM_System_Status::instance()->get_system_stati(); |
363 | 363 | $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE); |
364 | 364 | $this->display_admin_page_with_sidebar(); |
@@ -366,30 +366,30 @@ discard block |
||
366 | 366 | |
367 | 367 | |
368 | 368 | |
369 | - public function _send_migration_crash_report(){ |
|
369 | + public function _send_migration_crash_report() { |
|
370 | 370 | $from = $this->_req_data['from']; |
371 | 371 | $from_name = $this->_req_data['from_name']; |
372 | 372 | $body = $this->_req_data['body']; |
373 | - try{ |
|
373 | + try { |
|
374 | 374 | $success = wp_mail(EE_SUPPORT_EMAIL, |
375 | 375 | 'Migration Crash Report', |
376 | - $body."/r/n<br>". print_r(EEM_System_Status::instance()->get_system_stati(),true), |
|
376 | + $body."/r/n<br>".print_r(EEM_System_Status::instance()->get_system_stati(), true), |
|
377 | 377 | array( |
378 | 378 | "from:$from_name<$from>", |
379 | 379 | // 'content-type:text/html charset=UTF-8' |
380 | 380 | )); |
381 | - }catch( Exception $e ){ |
|
381 | + } catch (Exception $e) { |
|
382 | 382 | $success = FALSE; |
383 | 383 | } |
384 | - $this->_redirect_after_action($success, __("Migration Crash Report", "event_espresso"), __("sent", "event_espresso"),array('success'=>$success,'action'=>'confirm_migration_crash_report_sent')); |
|
384 | + $this->_redirect_after_action($success, __("Migration Crash Report", "event_espresso"), __("sent", "event_espresso"), array('success'=>$success, 'action'=>'confirm_migration_crash_report_sent')); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | |
388 | 388 | |
389 | - public function _confirm_migration_crash_report_sent(){ |
|
390 | - try{ |
|
389 | + public function _confirm_migration_crash_report_sent() { |
|
390 | + try { |
|
391 | 391 | $most_recent_migration = EE_Data_Migration_Manager::instance()->get_last_ran_script(true); |
392 | - }catch(EE_Error $e){ |
|
392 | + } catch (EE_Error $e) { |
|
393 | 393 | |
394 | 394 | EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($e->getMessage()); |
395 | 395 | //now, just so we can display the page correctly, make a error migration script stage object |
@@ -397,14 +397,14 @@ discard block |
||
397 | 397 | $most_recent_migration = new EE_DMS_Unknown_1_0_0(); |
398 | 398 | $most_recent_migration->add_error($e->getMessage()); |
399 | 399 | } |
400 | - $success = $this->_req_data['success']=='1' ? true : false; |
|
400 | + $success = $this->_req_data['success'] == '1' ? true : false; |
|
401 | 401 | $this->_template_args['success'] = $success; |
402 | - $this->_template_args[ 'most_recent_migration' ] = $most_recent_migration; |
|
402 | + $this->_template_args['most_recent_migration'] = $most_recent_migration; |
|
403 | 403 | $this->_template_args['reset_db_action_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'reset_db'), EE_MAINTENANCE_ADMIN_URL); |
404 | - $this->_template_args[ 'reset_db_page_url' ] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'data_reset'), EE_MAINTENANCE_ADMIN_URL); |
|
405 | - $this->_template_args[ 'reattempt_action_url' ] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'reattempt_migration'), EE_MAINTENANCE_ADMIN_URL ); |
|
406 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_confirm_migration_crash_report_sent.template.php'; |
|
407 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path,$this->_template_args,TRUE); |
|
404 | + $this->_template_args['reset_db_page_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'data_reset'), EE_MAINTENANCE_ADMIN_URL); |
|
405 | + $this->_template_args['reattempt_action_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'reattempt_migration'), EE_MAINTENANCE_ADMIN_URL); |
|
406 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_confirm_migration_crash_report_sent.template.php'; |
|
407 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE); |
|
408 | 408 | $this->display_admin_page_with_sidebar(); |
409 | 409 | } |
410 | 410 | |
@@ -417,18 +417,18 @@ discard block |
||
417 | 417 | * @param boolean $nuke_old_ee4_data controls whether or not we |
418 | 418 | * destroy the old ee4 data, or just try initializing ee4 default data |
419 | 419 | */ |
420 | - public function _reset_db( $nuke_old_ee4_data = TRUE ){ |
|
420 | + public function _reset_db($nuke_old_ee4_data = TRUE) { |
|
421 | 421 | EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance); |
422 | 422 | |
423 | - if( $nuke_old_ee4_data ){ |
|
423 | + if ($nuke_old_ee4_data) { |
|
424 | 424 | EEH_Activation::delete_all_espresso_cpt_data(); |
425 | - EEH_Activation::delete_all_espresso_tables_and_data( FALSE ); |
|
425 | + EEH_Activation::delete_all_espresso_tables_and_data(FALSE); |
|
426 | 426 | EEH_Activation::remove_cron_tasks(); |
427 | 427 | } |
428 | 428 | //make sure when we reset the registry's config that it |
429 | 429 | //switches to using the new singleton |
430 | - EE_Registry::instance()->CFG = EE_Registry::instance()->CFG->reset( TRUE ); |
|
431 | - EE_System::instance()->initialize_db_if_no_migrations_required( TRUE ); |
|
430 | + EE_Registry::instance()->CFG = EE_Registry::instance()->CFG->reset(TRUE); |
|
431 | + EE_System::instance()->initialize_db_if_no_migrations_required(TRUE); |
|
432 | 432 | EE_System::instance()->redirect_to_about_ee(); |
433 | 433 | } |
434 | 434 | |
@@ -437,20 +437,20 @@ discard block |
||
437 | 437 | /** |
438 | 438 | * Deletes ALL EE tables, Records, and Options from the database. |
439 | 439 | */ |
440 | - public function _delete_db(){ |
|
440 | + public function _delete_db() { |
|
441 | 441 | EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance); |
442 | 442 | EEH_Activation::delete_all_espresso_cpt_data(); |
443 | 443 | EEH_Activation::delete_all_espresso_tables_and_data(); |
444 | 444 | EEH_Activation::remove_cron_tasks(); |
445 | 445 | EEH_Activation::deactivate_event_espresso(); |
446 | - wp_safe_redirect( admin_url( 'plugins.php' )); |
|
446 | + wp_safe_redirect(admin_url('plugins.php')); |
|
447 | 447 | exit; |
448 | 448 | } |
449 | 449 | |
450 | 450 | /** |
451 | 451 | * sets up EE4 to rerun the migrations from ee3 to ee4 |
452 | 452 | */ |
453 | - public function _rerun_migration_from_ee3(){ |
|
453 | + public function _rerun_migration_from_ee3() { |
|
454 | 454 | EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance); |
455 | 455 | EEH_Activation::delete_all_espresso_cpt_data(); |
456 | 456 | EEH_Activation::delete_all_espresso_tables_and_data(false); |
@@ -477,9 +477,9 @@ discard block |
||
477 | 477 | wp_enqueue_script('ee_admin_js'); |
478 | 478 | // wp_enqueue_media(); |
479 | 479 | // wp_enqueue_script('media-upload'); |
480 | - wp_enqueue_script('ee-maintenance',EE_MAINTENANCE_ASSETS_URL.'/ee-maintenance.js',array('jquery'),EVENT_ESPRESSO_VERSION,true); |
|
480 | + wp_enqueue_script('ee-maintenance', EE_MAINTENANCE_ASSETS_URL.'/ee-maintenance.js', array('jquery'), EVENT_ESPRESSO_VERSION, true); |
|
481 | 481 | |
482 | - wp_register_style( 'espresso_maintenance', EE_MAINTENANCE_ASSETS_URL . 'ee-maintenance.css', array(), EVENT_ESPRESSO_VERSION ); |
|
482 | + wp_register_style('espresso_maintenance', EE_MAINTENANCE_ASSETS_URL.'ee-maintenance.css', array(), EVENT_ESPRESSO_VERSION); |
|
483 | 483 | wp_enqueue_style('espresso_maintenance'); |
484 | 484 | } |
485 | 485 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
45 | 45 | * @return \Payments_Admin_Page |
46 | 46 | */ |
47 | - public function __construct( $routing = TRUE ) { |
|
48 | - parent::__construct( $routing ); |
|
47 | + public function __construct($routing = TRUE) { |
|
48 | + parent::__construct($routing); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -130,19 +130,19 @@ discard block |
||
130 | 130 | protected function _set_page_config() { |
131 | 131 | $payment_method_list_config = array( |
132 | 132 | 'nav' => array( |
133 | - 'label' => __( 'Payment Methods', 'event_espresso' ), |
|
133 | + 'label' => __('Payment Methods', 'event_espresso'), |
|
134 | 134 | 'order' => 10 |
135 | 135 | ), |
136 | 136 | 'metaboxes' => $this->_default_espresso_metaboxes, |
137 | 137 | 'help_tabs' => array_merge( |
138 | 138 | array( |
139 | 139 | 'payment_methods_overview_help_tab' => array( |
140 | - 'title' => __( 'Payment Methods Overview', 'event_espresso' ), |
|
140 | + 'title' => __('Payment Methods Overview', 'event_espresso'), |
|
141 | 141 | 'filename' => 'payment_methods_overview' |
142 | 142 | ) |
143 | 143 | ), |
144 | 144 | $this->_add_payment_method_help_tabs() ), |
145 | - 'help_tour' => array( 'Payment_Methods_Selection_Help_Tour' ), |
|
145 | + 'help_tour' => array('Payment_Methods_Selection_Help_Tour'), |
|
146 | 146 | 'require_nonce' => false |
147 | 147 | ); |
148 | 148 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | ) |
161 | 161 | ), |
162 | 162 | //'help_tour' => array( 'Payment_Methods_Settings_Help_Tour' ), |
163 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
163 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
164 | 164 | 'require_nonce' => FALSE |
165 | 165 | ), |
166 | 166 | 'payment_log'=>array( |
@@ -179,17 +179,17 @@ discard block |
||
179 | 179 | /** |
180 | 180 | * @return array |
181 | 181 | */ |
182 | - protected function _add_payment_method_help_tabs(){ |
|
182 | + protected function _add_payment_method_help_tabs() { |
|
183 | 183 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
184 | 184 | $payment_method_types = EE_Payment_Method_Manager::instance()->payment_method_types(); |
185 | 185 | $all_pmt_help_tabs_config = array(); |
186 | - foreach( $payment_method_types as $payment_method_type ){ |
|
187 | - if ( ! EE_Registry::instance()->CAP->current_user_can( $payment_method_type->cap_name(), 'specific_payment_method_type_access' ) ) { |
|
186 | + foreach ($payment_method_types as $payment_method_type) { |
|
187 | + if ( ! EE_Registry::instance()->CAP->current_user_can($payment_method_type->cap_name(), 'specific_payment_method_type_access')) { |
|
188 | 188 | continue; |
189 | 189 | } |
190 | - foreach( $payment_method_type->help_tabs_config() as $help_tab_name => $config ){ |
|
191 | - $template_args = isset( $config[ 'template_args' ] ) ? $config[ 'template_args' ] : array(); |
|
192 | - $template_args[ 'admin_page_obj' ] = $this; |
|
190 | + foreach ($payment_method_type->help_tabs_config() as $help_tab_name => $config) { |
|
191 | + $template_args = isset($config['template_args']) ? $config['template_args'] : array(); |
|
192 | + $template_args['admin_page_obj'] = $this; |
|
193 | 193 | $all_pmt_help_tabs_config[$help_tab_name] = array( |
194 | 194 | 'title'=>$config['title'], |
195 | 195 | 'content'=>EEH_Template::display_template( |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | |
217 | 217 | |
218 | 218 | public function load_scripts_styles() { |
219 | - wp_enqueue_script( 'ee_admin_js' ); |
|
220 | - wp_enqueue_script( 'ee-text-links' ); |
|
221 | - wp_enqueue_script( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'espresso_payments_admin.js', array( 'espresso-ui-theme', 'ee-datepicker' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
219 | + wp_enqueue_script('ee_admin_js'); |
|
220 | + wp_enqueue_script('ee-text-links'); |
|
221 | + wp_enqueue_script('espresso_payments', EE_PAYMENTS_ASSETS_URL.'espresso_payments_admin.js', array('espresso-ui-theme', 'ee-datepicker'), EVENT_ESPRESSO_VERSION, TRUE); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | |
228 | 228 | public function load_scripts_styles_default() { |
229 | 229 | //styles |
230 | - wp_register_style( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'ee-payments.css', array(), EVENT_ESPRESSO_VERSION ); |
|
231 | - wp_enqueue_style( 'espresso_payments' ); |
|
232 | - wp_enqueue_style( 'ee-text-links' ); |
|
230 | + wp_register_style('espresso_payments', EE_PAYMENTS_ASSETS_URL.'ee-payments.css', array(), EVENT_ESPRESSO_VERSION); |
|
231 | + wp_enqueue_style('espresso_payments'); |
|
232 | + wp_enqueue_style('ee-text-links'); |
|
233 | 233 | //scripts |
234 | 234 | } |
235 | 235 | |
@@ -243,44 +243,44 @@ discard block |
||
243 | 243 | * to the loading process. However, people MUST setup the details for the payment method so its safe to do a |
244 | 244 | * recheck here. |
245 | 245 | */ |
246 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
246 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
247 | 247 | EEM_Payment_Method::instance()->verify_button_urls(); |
248 | 248 | //setup tabs, one for each payment method type |
249 | 249 | $tabs = array(); |
250 | 250 | $payment_methods = array(); |
251 | - foreach( EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj ) { |
|
251 | + foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) { |
|
252 | 252 | // we don't want to show admin-only PMTs for now |
253 | - if ( $pmt_obj instanceof EE_PMT_Admin_Only ) { |
|
253 | + if ($pmt_obj instanceof EE_PMT_Admin_Only) { |
|
254 | 254 | continue; |
255 | 255 | } |
256 | 256 | //check access |
257 | - if ( ! EE_Registry::instance()->CAP->current_user_can( $pmt_obj->cap_name(), 'specific_payment_method_type_access' ) ) { |
|
257 | + if ( ! EE_Registry::instance()->CAP->current_user_can($pmt_obj->cap_name(), 'specific_payment_method_type_access')) { |
|
258 | 258 | continue; |
259 | 259 | } |
260 | 260 | //check for any active pms of that type |
261 | - $payment_method = EEM_Payment_Method::instance()->get_one_of_type( $pmt_obj->system_name() ); |
|
262 | - if ( ! $payment_method instanceof EE_Payment_Method ) { |
|
261 | + $payment_method = EEM_Payment_Method::instance()->get_one_of_type($pmt_obj->system_name()); |
|
262 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
263 | 263 | $payment_method = EE_Payment_Method::new_instance( |
264 | 264 | array( |
265 | - 'PMD_slug' =>sanitize_key( $pmt_obj->system_name() ), |
|
265 | + 'PMD_slug' =>sanitize_key($pmt_obj->system_name()), |
|
266 | 266 | 'PMD_type' =>$pmt_obj->system_name(), |
267 | 267 | 'PMD_name' =>$pmt_obj->pretty_name(), |
268 | 268 | 'PMD_admin_name' =>$pmt_obj->pretty_name() |
269 | 269 | ) |
270 | 270 | ); |
271 | 271 | } |
272 | - $payment_methods[ $payment_method->slug() ] = $payment_method; |
|
272 | + $payment_methods[$payment_method->slug()] = $payment_method; |
|
273 | 273 | } |
274 | - $payment_methods = apply_filters( 'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods ); |
|
275 | - foreach( $payment_methods as $payment_method ) { |
|
276 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
274 | + $payment_methods = apply_filters('FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods); |
|
275 | + foreach ($payment_methods as $payment_method) { |
|
276 | + if ($payment_method instanceof EE_Payment_Method) { |
|
277 | 277 | add_meta_box( |
278 | 278 | //html id |
279 | - 'espresso_' . $payment_method->slug() . '_payment_settings', |
|
279 | + 'espresso_'.$payment_method->slug().'_payment_settings', |
|
280 | 280 | //title |
281 | - sprintf( __( '%s Settings', 'event_espresso' ), $payment_method->admin_name() ), |
|
281 | + sprintf(__('%s Settings', 'event_espresso'), $payment_method->admin_name()), |
|
282 | 282 | //callback |
283 | - array( $this, 'payment_method_settings_meta_box' ), |
|
283 | + array($this, 'payment_method_settings_meta_box'), |
|
284 | 284 | //post type |
285 | 285 | null, |
286 | 286 | //context |
@@ -288,19 +288,19 @@ discard block |
||
288 | 288 | //priority |
289 | 289 | 'default', |
290 | 290 | //callback args |
291 | - array( 'payment_method' => $payment_method ) |
|
291 | + array('payment_method' => $payment_method) |
|
292 | 292 | ); |
293 | 293 | //setup for tabbed content |
294 | - $tabs[ $payment_method->slug() ] = array( |
|
294 | + $tabs[$payment_method->slug()] = array( |
|
295 | 295 | 'label' => $payment_method->admin_name(), |
296 | 296 | 'class' => $payment_method->active() ? 'gateway-active' : '', |
297 | - 'href' => 'espresso_' . $payment_method->slug() . '_payment_settings', |
|
298 | - 'title' => __( 'Modify this Payment Method', 'event_espresso' ), |
|
297 | + 'href' => 'espresso_'.$payment_method->slug().'_payment_settings', |
|
298 | + 'title' => __('Modify this Payment Method', 'event_espresso'), |
|
299 | 299 | 'slug' => $payment_method->slug() |
300 | 300 | ); |
301 | 301 | } |
302 | 302 | } |
303 | - $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug() ); |
|
303 | + $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug()); |
|
304 | 304 | $this->display_admin_page_with_sidebar(); |
305 | 305 | |
306 | 306 | } |
@@ -311,20 +311,20 @@ discard block |
||
311 | 311 | * _get_active_payment_method_slug |
312 | 312 | * @return string |
313 | 313 | */ |
314 | - protected function _get_active_payment_method_slug(){ |
|
314 | + protected function _get_active_payment_method_slug() { |
|
315 | 315 | $payment_method_slug = FALSE; |
316 | 316 | //decide which payment method tab to open first, as dictated by the request's 'payment_method' |
317 | - if ( isset( $this->_req_data['payment_method'] )) { |
|
317 | + if (isset($this->_req_data['payment_method'])) { |
|
318 | 318 | // if they provided the current payment method, use it |
319 | - $payment_method_slug = sanitize_key( $this->_req_data['payment_method'] ); |
|
319 | + $payment_method_slug = sanitize_key($this->_req_data['payment_method']); |
|
320 | 320 | } |
321 | - $payment_method = EEM_Payment_Method::instance()->get_one( array( array( 'PMD_slug' => $payment_method_slug ))); |
|
321 | + $payment_method = EEM_Payment_Method::instance()->get_one(array(array('PMD_slug' => $payment_method_slug))); |
|
322 | 322 | // if that didn't work or wasn't provided, find another way to select the current pm |
323 | - if ( ! $this->_verify_payment_method( $payment_method )) { |
|
323 | + if ( ! $this->_verify_payment_method($payment_method)) { |
|
324 | 324 | // like, looking for an active one |
325 | - $payment_method = EEM_Payment_Method::instance()->get_one_active( 'CART' ); |
|
325 | + $payment_method = EEM_Payment_Method::instance()->get_one_active('CART'); |
|
326 | 326 | // test that one as well |
327 | - if ( $this->_verify_payment_method( $payment_method )) { |
|
327 | + if ($this->_verify_payment_method($payment_method)) { |
|
328 | 328 | $payment_method_slug = $payment_method->slug(); |
329 | 329 | } else { |
330 | 330 | $payment_method_slug = 'paypal_standard'; |
@@ -342,11 +342,11 @@ discard block |
||
342 | 342 | * @param \EE_Payment_Method $payment_method |
343 | 343 | * @return boolean |
344 | 344 | */ |
345 | - protected function _verify_payment_method( $payment_method ){ |
|
345 | + protected function _verify_payment_method($payment_method) { |
|
346 | 346 | if ( |
347 | 347 | $payment_method instanceof EE_Payment_Method && |
348 | 348 | $payment_method->type_obj() instanceof EE_PMT_Base && |
349 | - EE_Registry::instance()->CAP->current_user_can( $payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access' ) |
|
349 | + EE_Registry::instance()->CAP->current_user_can($payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access') |
|
350 | 350 | ) { |
351 | 351 | return TRUE; |
352 | 352 | } |
@@ -363,21 +363,21 @@ discard block |
||
363 | 363 | * @return string |
364 | 364 | * @throws EE_Error |
365 | 365 | */ |
366 | - public function payment_method_settings_meta_box( $post_obj_which_is_null, $metabox ){ |
|
367 | - $payment_method = isset( $metabox['args'], $metabox['args']['payment_method'] ) ? $metabox['args']['payment_method'] : NULL; |
|
368 | - if ( ! $payment_method instanceof EE_Payment_Method ){ |
|
369 | - throw new EE_Error( sprintf( __( 'Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso' ))); |
|
366 | + public function payment_method_settings_meta_box($post_obj_which_is_null, $metabox) { |
|
367 | + $payment_method = isset($metabox['args'], $metabox['args']['payment_method']) ? $metabox['args']['payment_method'] : NULL; |
|
368 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
369 | + throw new EE_Error(sprintf(__('Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso'))); |
|
370 | 370 | } |
371 | 371 | $payment_method_scopes = $payment_method->active(); |
372 | 372 | // if the payment method really exists show its form, otherwise the activation template |
373 | - if ( $payment_method->ID() && ! empty( $payment_method_scopes )) { |
|
374 | - $form = $this->_generate_payment_method_settings_form( $payment_method ); |
|
375 | - if ( $form->form_data_present_in( $this->_req_data )) { |
|
376 | - $form->receive_form_submission( $this->_req_data ); |
|
373 | + if ($payment_method->ID() && ! empty($payment_method_scopes)) { |
|
374 | + $form = $this->_generate_payment_method_settings_form($payment_method); |
|
375 | + if ($form->form_data_present_in($this->_req_data)) { |
|
376 | + $form->receive_form_submission($this->_req_data); |
|
377 | 377 | } |
378 | - echo $form->form_open() . $form->get_html_and_js() . $form->form_close(); |
|
378 | + echo $form->form_open().$form->get_html_and_js().$form->form_close(); |
|
379 | 379 | } else { |
380 | - echo $this->_activate_payment_method_button( $payment_method )->get_html_and_js(); |
|
380 | + echo $this->_activate_payment_method_button($payment_method)->get_html_and_js(); |
|
381 | 381 | } |
382 | 382 | } |
383 | 383 | |
@@ -390,14 +390,14 @@ discard block |
||
390 | 390 | * @param \EE_Payment_Method $payment_method |
391 | 391 | * @return \EE_Form_Section_Proper |
392 | 392 | */ |
393 | - protected function _generate_payment_method_settings_form( EE_Payment_Method $payment_method ) { |
|
394 | - if ( ! $payment_method instanceof EE_Payment_Method ){ |
|
393 | + protected function _generate_payment_method_settings_form(EE_Payment_Method $payment_method) { |
|
394 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
395 | 395 | return new EE_Form_Section_Proper(); |
396 | 396 | } |
397 | 397 | return new EE_Form_Section_Proper( |
398 | 398 | array( |
399 | - 'name' => $payment_method->slug() . '_settings_form', |
|
400 | - 'html_id' => $payment_method->slug() . '_settings_form', |
|
399 | + 'name' => $payment_method->slug().'_settings_form', |
|
400 | + 'html_id' => $payment_method->slug().'_settings_form', |
|
401 | 401 | 'action' => EE_Admin_Page::add_query_args_and_nonce( |
402 | 402 | array( |
403 | 403 | 'action' => 'update_payment_method', |
@@ -409,12 +409,12 @@ discard block |
||
409 | 409 | 'subsections' => apply_filters( |
410 | 410 | 'FHEE__Payments_Admin_Page___generate_payment_method_settings_form__form_subsections', |
411 | 411 | array( |
412 | - 'pci_dss_compliance_' . $payment_method->slug() => $this->_pci_dss_compliance( $payment_method ), |
|
413 | - 'currency_support_' . $payment_method->slug() => $this->_currency_support( $payment_method ), |
|
414 | - 'payment_method_settings_' . $payment_method->slug() => $this->_payment_method_settings( $payment_method ), |
|
415 | - 'update_' . $payment_method->slug() => $this->_update_payment_method_button( $payment_method ), |
|
416 | - 'deactivate_' . $payment_method->slug() => $this->_deactivate_payment_method_button( $payment_method ), |
|
417 | - 'fine_print_' . $payment_method->slug() => $this->_fine_print() |
|
412 | + 'pci_dss_compliance_'.$payment_method->slug() => $this->_pci_dss_compliance($payment_method), |
|
413 | + 'currency_support_'.$payment_method->slug() => $this->_currency_support($payment_method), |
|
414 | + 'payment_method_settings_'.$payment_method->slug() => $this->_payment_method_settings($payment_method), |
|
415 | + 'update_'.$payment_method->slug() => $this->_update_payment_method_button($payment_method), |
|
416 | + 'deactivate_'.$payment_method->slug() => $this->_deactivate_payment_method_button($payment_method), |
|
417 | + 'fine_print_'.$payment_method->slug() => $this->_fine_print() |
|
418 | 418 | ), |
419 | 419 | $payment_method |
420 | 420 | ) |
@@ -431,19 +431,19 @@ discard block |
||
431 | 431 | * @param \EE_Payment_Method $payment_method |
432 | 432 | * @return \EE_Form_Section_Proper |
433 | 433 | */ |
434 | - protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) { |
|
435 | - if ( $payment_method->type_obj()->requires_https() ) { |
|
434 | + protected function _pci_dss_compliance(EE_Payment_Method $payment_method) { |
|
435 | + if ($payment_method->type_obj()->requires_https()) { |
|
436 | 436 | return new EE_Form_Section_HTML( |
437 | 437 | EEH_HTML::tr( |
438 | 438 | EEH_HTML::th( |
439 | 439 | EEH_HTML::label( |
440 | - EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' ) |
|
440 | + EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice') |
|
441 | 441 | ) |
442 | - ) . |
|
442 | + ). |
|
443 | 443 | EEH_HTML::td( |
444 | - EEH_HTML::strong( __( 'You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso' )) . |
|
445 | - EEH_HTML::br() . |
|
446 | - __( 'Learn more about ', 'event_espresso' ) . EEH_HTML::link( 'https://www.pcisecuritystandards.org/merchants/index.php', __( 'PCI DSS compliance', 'event_espresso' )) |
|
444 | + EEH_HTML::strong(__('You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso')). |
|
445 | + EEH_HTML::br(). |
|
446 | + __('Learn more about ', 'event_espresso').EEH_HTML::link('https://www.pcisecuritystandards.org/merchants/index.php', __('PCI DSS compliance', 'event_espresso')) |
|
447 | 447 | ) |
448 | 448 | ) |
449 | 449 | ); |
@@ -461,19 +461,19 @@ discard block |
||
461 | 461 | * @param \EE_Payment_Method $payment_method |
462 | 462 | * @return \EE_Form_Section_Proper |
463 | 463 | */ |
464 | - protected function _currency_support( EE_Payment_Method $payment_method ) { |
|
465 | - if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) { |
|
464 | + protected function _currency_support(EE_Payment_Method $payment_method) { |
|
465 | + if ( ! $payment_method->usable_for_currency(EE_Config::instance()->currency->code)) { |
|
466 | 466 | return new EE_Form_Section_HTML( |
467 | 467 | EEH_HTML::tr( |
468 | 468 | EEH_HTML::th( |
469 | 469 | EEH_HTML::label( |
470 | - EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' ) |
|
470 | + EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice') |
|
471 | 471 | ) |
472 | - ) . |
|
472 | + ). |
|
473 | 473 | EEH_HTML::td( |
474 | 474 | EEH_HTML::strong( |
475 | 475 | sprintf( |
476 | - __( 'This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'), |
|
476 | + __('This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'), |
|
477 | 477 | EE_Config::instance()->currency->code |
478 | 478 | ) |
479 | 479 | ) |
@@ -493,9 +493,9 @@ discard block |
||
493 | 493 | * @param \EE_Payment_Method $payment_method |
494 | 494 | * @return \EE_Form_Section_HTML |
495 | 495 | */ |
496 | - protected function _payment_method_settings( EE_Payment_Method $payment_method ) { |
|
496 | + protected function _payment_method_settings(EE_Payment_Method $payment_method) { |
|
497 | 497 | //modify the form so we only have/show fields that will be implemented for this version |
498 | - return $this->_simplify_form( $payment_method->type_obj()->settings_form(), $payment_method->name() ); |
|
498 | + return $this->_simplify_form($payment_method->type_obj()->settings_form(), $payment_method->name()); |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | |
@@ -508,8 +508,8 @@ discard block |
||
508 | 508 | * @return \EE_Payment_Method_Form |
509 | 509 | * @throws \EE_Error |
510 | 510 | */ |
511 | - protected function _simplify_form( $form_section, $payment_method_name = '' ){ |
|
512 | - if ( $form_section instanceof EE_Payment_Method_Form ) { |
|
511 | + protected function _simplify_form($form_section, $payment_method_name = '') { |
|
512 | + if ($form_section instanceof EE_Payment_Method_Form) { |
|
513 | 513 | $form_section->exclude( |
514 | 514 | array( |
515 | 515 | 'PMD_type', //dont want them changing the type |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | ); |
521 | 521 | return $form_section; |
522 | 522 | } else { |
523 | - throw new EE_Error( sprintf( __( 'The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso' ), $payment_method_name )); |
|
523 | + throw new EE_Error(sprintf(__('The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso'), $payment_method_name)); |
|
524 | 524 | } |
525 | 525 | } |
526 | 526 | |
@@ -533,18 +533,18 @@ discard block |
||
533 | 533 | * @param \EE_Payment_Method $payment_method |
534 | 534 | * @return \EE_Form_Section_HTML |
535 | 535 | */ |
536 | - protected function _update_payment_method_button( EE_Payment_Method $payment_method ) { |
|
536 | + protected function _update_payment_method_button(EE_Payment_Method $payment_method) { |
|
537 | 537 | $update_button = new EE_Submit_Input( |
538 | 538 | array( |
539 | - 'html_id' => 'save_' . $payment_method->slug() . '_settings', |
|
540 | - 'default' => sprintf( __( 'Update %s Payment Settings', 'event_espresso' ), $payment_method->admin_name() ), |
|
539 | + 'html_id' => 'save_'.$payment_method->slug().'_settings', |
|
540 | + 'default' => sprintf(__('Update %s Payment Settings', 'event_espresso'), $payment_method->admin_name()), |
|
541 | 541 | 'html_label' => EEH_HTML::nbsp() |
542 | 542 | ) |
543 | 543 | ); |
544 | 544 | return new EE_Form_Section_HTML( |
545 | - EEH_HTML::no_row( EEH_HTML::br(2) ) . |
|
545 | + EEH_HTML::no_row(EEH_HTML::br(2)). |
|
546 | 546 | EEH_HTML::tr( |
547 | - EEH_HTML::th( __( 'Update Settings', 'event_espresso') ) . |
|
547 | + EEH_HTML::th(__('Update Settings', 'event_espresso')). |
|
548 | 548 | EEH_HTML::td( |
549 | 549 | $update_button->get_html_for_input() |
550 | 550 | ) |
@@ -561,11 +561,11 @@ discard block |
||
561 | 561 | * @param \EE_Payment_Method $payment_method |
562 | 562 | * @return \EE_Form_Section_Proper |
563 | 563 | */ |
564 | - protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) { |
|
565 | - $link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() ); |
|
564 | + protected function _deactivate_payment_method_button(EE_Payment_Method $payment_method) { |
|
565 | + $link_text_and_title = sprintf(__('Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name()); |
|
566 | 566 | return new EE_Form_Section_HTML( |
567 | 567 | EEH_HTML::tr( |
568 | - EEH_HTML::th( __( 'Deactivate Payment Method', 'event_espresso') ) . |
|
568 | + EEH_HTML::th(__('Deactivate Payment Method', 'event_espresso')). |
|
569 | 569 | EEH_HTML::td( |
570 | 570 | EEH_HTML::link( |
571 | 571 | EE_Admin_Page::add_query_args_and_nonce( |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | ), |
578 | 578 | $link_text_and_title, |
579 | 579 | $link_text_and_title, |
580 | - 'deactivate_' . $payment_method->slug(), |
|
580 | + 'deactivate_'.$payment_method->slug(), |
|
581 | 581 | 'espresso-button button-secondary' |
582 | 582 | ) |
583 | 583 | ) |
@@ -593,12 +593,12 @@ discard block |
||
593 | 593 | * @param \EE_Payment_Method $payment_method |
594 | 594 | * @return \EE_Form_Section_Proper |
595 | 595 | */ |
596 | - protected function _activate_payment_method_button( EE_Payment_Method $payment_method ) { |
|
597 | - $link_text_and_title = sprintf( __( 'Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name() ); |
|
596 | + protected function _activate_payment_method_button(EE_Payment_Method $payment_method) { |
|
597 | + $link_text_and_title = sprintf(__('Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name()); |
|
598 | 598 | return new EE_Form_Section_Proper( |
599 | 599 | array( |
600 | - 'name' => 'activate_' . $payment_method->slug() . '_settings_form', |
|
601 | - 'html_id' => 'activate_' . $payment_method->slug() . '_settings_form', |
|
600 | + 'name' => 'activate_'.$payment_method->slug().'_settings_form', |
|
601 | + 'html_id' => 'activate_'.$payment_method->slug().'_settings_form', |
|
602 | 602 | 'action' => '#', |
603 | 603 | 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
604 | 604 | 'subsections' => apply_filters( |
@@ -607,8 +607,8 @@ discard block |
||
607 | 607 | new EE_Form_Section_HTML( |
608 | 608 | EEH_HTML::tr( |
609 | 609 | EEH_HTML::th( |
610 | - EEH_HTML::label( __( 'Click to Activate ', 'event_espresso' )) |
|
611 | - ) . |
|
610 | + EEH_HTML::label(__('Click to Activate ', 'event_espresso')) |
|
611 | + ). |
|
612 | 612 | EEH_HTML::td( |
613 | 613 | EEH_HTML::link( |
614 | 614 | EE_Admin_Page::add_query_args_and_nonce( |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | ), |
621 | 621 | $link_text_and_title, |
622 | 622 | $link_text_and_title, |
623 | - 'activate_' . $payment_method->slug(), |
|
623 | + 'activate_'.$payment_method->slug(), |
|
624 | 624 | 'espresso-button-green button-primary' |
625 | 625 | ) |
626 | 626 | ) |
@@ -642,9 +642,9 @@ discard block |
||
642 | 642 | protected function _fine_print() { |
643 | 643 | return new EE_Form_Section_HTML( |
644 | 644 | EEH_HTML::tr( |
645 | - EEH_HTML::th() . |
|
645 | + EEH_HTML::th(). |
|
646 | 646 | EEH_HTML::td( |
647 | - EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' ) |
|
647 | + EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text') |
|
648 | 648 | ) |
649 | 649 | ) |
650 | 650 | ); |
@@ -656,15 +656,15 @@ discard block |
||
656 | 656 | * Activates a payment method of that type. Mostly assuming there is only 1 of that type (or none so far) |
657 | 657 | * @global WP_User $current_user |
658 | 658 | */ |
659 | - protected function _activate_payment_method(){ |
|
660 | - if(isset($this->_req_data['payment_method_type'])){ |
|
659 | + protected function _activate_payment_method() { |
|
660 | + if (isset($this->_req_data['payment_method_type'])) { |
|
661 | 661 | $payment_method_type = sanitize_text_field($this->_req_data['payment_method_type']); |
662 | 662 | //see if one exists |
663 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
664 | - $payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type ); |
|
663 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
664 | + $payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type($payment_method_type); |
|
665 | 665 | |
666 | - $this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug())); |
|
667 | - }else{ |
|
666 | + $this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default', 'payment_method'=>$payment_method->slug())); |
|
667 | + } else { |
|
668 | 668 | $this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default')); |
669 | 669 | } |
670 | 670 | } |
@@ -672,14 +672,14 @@ discard block |
||
672 | 672 | /** |
673 | 673 | * Deactivates the payment method with the specified slug, and redirects. |
674 | 674 | */ |
675 | - protected function _deactivate_payment_method(){ |
|
676 | - if(isset($this->_req_data['payment_method'])){ |
|
675 | + protected function _deactivate_payment_method() { |
|
676 | + if (isset($this->_req_data['payment_method'])) { |
|
677 | 677 | $payment_method_slug = sanitize_key($this->_req_data['payment_method']); |
678 | 678 | //deactivate it |
679 | 679 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
680 | - $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug ); |
|
681 | - $this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug)); |
|
682 | - }else{ |
|
680 | + $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method($payment_method_slug); |
|
681 | + $this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default', 'payment_method'=>$payment_method_slug)); |
|
682 | + } else { |
|
683 | 683 | $this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default')); |
684 | 684 | } |
685 | 685 | } |
@@ -693,39 +693,39 @@ discard block |
||
693 | 693 | * subsequently called 'headers_sent_func' which is _payment_methods_list) |
694 | 694 | * @return void |
695 | 695 | */ |
696 | - protected function _update_payment_method(){ |
|
697 | - if( $_SERVER['REQUEST_METHOD'] == 'POST'){ |
|
696 | + protected function _update_payment_method() { |
|
697 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
698 | 698 | //ok let's find which gateway form to use based on the form input |
699 | 699 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
700 | 700 | /** @var $correct_pmt_form_to_use EE_Payment_Method_Form */ |
701 | 701 | $correct_pmt_form_to_use = NULL; |
702 | 702 | $pmt_obj = NULL; |
703 | - foreach(EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj){ |
|
703 | + foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) { |
|
704 | 704 | /** @var $pmt_obj EE_PMT_Base */ |
705 | 705 | //get the form and simplify it, like what we do when we display it |
706 | 706 | $pmt_form = $pmt_obj->settings_form(); |
707 | 707 | $this->_simplify_form($pmt_form); |
708 | - if($pmt_form->form_data_present_in($this->_req_data)){ |
|
708 | + if ($pmt_form->form_data_present_in($this->_req_data)) { |
|
709 | 709 | $correct_pmt_form_to_use = $pmt_form; |
710 | 710 | break; |
711 | 711 | } |
712 | 712 | } |
713 | 713 | //if we couldn't find the correct payment method type... |
714 | - if( ! $correct_pmt_form_to_use ){ |
|
714 | + if ( ! $correct_pmt_form_to_use) { |
|
715 | 715 | EE_Error::add_error(__("We could not find which payment method type your form submission related to. Please contact support", 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
716 | 716 | $this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default')); |
717 | 717 | } |
718 | 718 | $correct_pmt_form_to_use->receive_form_submission($this->_req_data); |
719 | - if($correct_pmt_form_to_use->is_valid()){ |
|
719 | + if ($correct_pmt_form_to_use->is_valid()) { |
|
720 | 720 | $correct_pmt_form_to_use->save(); |
721 | 721 | $pm = $correct_pmt_form_to_use->get_model_object(); |
722 | 722 | /** @var $pm EE_Payment_Method */ |
723 | - $this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$pm->slug())); |
|
724 | - }else{ |
|
723 | + $this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default', 'payment_method'=>$pm->slug())); |
|
724 | + } else { |
|
725 | 725 | EE_Error::add_error( |
726 | 726 | sprintf( |
727 | 727 | __('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'), |
728 | - $pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __( '"(unknown)"', 'event_espresso' ) |
|
728 | + $pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __('"(unknown)"', 'event_espresso') |
|
729 | 729 | ), |
730 | 730 | __FILE__, |
731 | 731 | __FUNCTION__, |
@@ -742,11 +742,11 @@ discard block |
||
742 | 742 | protected function _payment_settings() { |
743 | 743 | |
744 | 744 | $this->_template_args['values'] = $this->_yes_no_values; |
745 | - $this->_template_args['show_pending_payment_options'] = isset( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) ? absint( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) : FALSE; |
|
745 | + $this->_template_args['show_pending_payment_options'] = isset(EE_Registry::instance()->CFG->registration->show_pending_payment_options) ? absint(EE_Registry::instance()->CFG->registration->show_pending_payment_options) : FALSE; |
|
746 | 746 | |
747 | - $this->_set_add_edit_form_tags( 'update_payment_settings' ); |
|
748 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
749 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_PAYMENTS_TEMPLATE_PATH . 'payment_settings.template.php', $this->_template_args, TRUE ); |
|
747 | + $this->_set_add_edit_form_tags('update_payment_settings'); |
|
748 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
749 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_PAYMENTS_TEMPLATE_PATH.'payment_settings.template.php', $this->_template_args, TRUE); |
|
750 | 750 | $this->display_admin_page_with_sidebar(); |
751 | 751 | |
752 | 752 | } |
@@ -760,13 +760,13 @@ discard block |
||
760 | 760 | * @return array |
761 | 761 | */ |
762 | 762 | protected function _update_payment_settings() { |
763 | - EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset( $this->_req_data['show_pending_payment_options'] ) ? $this->_req_data['show_pending_payment_options'] : FALSE; |
|
764 | - EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG ); |
|
763 | + EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset($this->_req_data['show_pending_payment_options']) ? $this->_req_data['show_pending_payment_options'] : FALSE; |
|
764 | + EE_Registry::instance()->CFG = apply_filters('FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG); |
|
765 | 765 | |
766 | 766 | |
767 | - $what = __('Payment Settings','event_espresso'); |
|
768 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ ); |
|
769 | - $this->_redirect_after_action( $success, $what, __('updated','event_espresso'), array( 'action' => 'payment_settings' ) ); |
|
767 | + $what = __('Payment Settings', 'event_espresso'); |
|
768 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__); |
|
769 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), array('action' => 'payment_settings')); |
|
770 | 770 | |
771 | 771 | } |
772 | 772 | protected function _payment_log_overview_list_table() { |
@@ -792,18 +792,18 @@ discard block |
||
792 | 792 | * @param bool $count |
793 | 793 | * @return array |
794 | 794 | */ |
795 | - public function get_payment_logs($per_page = 50, $current_page = 0, $count = false){ |
|
796 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
795 | + public function get_payment_logs($per_page = 50, $current_page = 0, $count = false) { |
|
796 | + EE_Registry::instance()->load_model('Change_Log'); |
|
797 | 797 | //we may need to do multiple queries (joining differently), so we actually wan tan array of query params |
798 | - $query_params = array(array('LOG_type'=> EEM_Change_Log::type_gateway)); |
|
798 | + $query_params = array(array('LOG_type'=> EEM_Change_Log::type_gateway)); |
|
799 | 799 | //check if they've selected a specific payment method |
800 | - if( isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all'){ |
|
800 | + if (isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all') { |
|
801 | 801 | $query_params[0]['OR*pm_or_pay_pm'] = array('Payment.Payment_Method.PMD_ID'=>$this->_req_data['_payment_method'], |
802 | 802 | 'Payment_Method.PMD_ID'=>$this->_req_data['_payment_method']); |
803 | 803 | } |
804 | 804 | //take into account search |
805 | - if(isset($this->_req_data['s']) && $this->_req_data['s']){ |
|
806 | - $similarity_string = array('LIKE','%'.str_replace("","%",$this->_req_data['s']) .'%'); |
|
805 | + if (isset($this->_req_data['s']) && $this->_req_data['s']) { |
|
806 | + $similarity_string = array('LIKE', '%'.str_replace("", "%", $this->_req_data['s']).'%'); |
|
807 | 807 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_fname'] = $similarity_string; |
808 | 808 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_lname'] = $similarity_string; |
809 | 809 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_email'] = $similarity_string; |
@@ -818,48 +818,48 @@ discard block |
||
818 | 818 | $query_params[0]['OR*s']['LOG_message'] = $similarity_string; |
819 | 819 | |
820 | 820 | } |
821 | - if(isset( $this->_req_data['payment-filter-start-date'] ) && isset( $this->_req_data['payment-filter-end-date'] )){ |
|
821 | + if (isset($this->_req_data['payment-filter-start-date']) && isset($this->_req_data['payment-filter-end-date'])) { |
|
822 | 822 | //add date |
823 | - $start_date =wp_strip_all_tags( $this->_req_data['payment-filter-start-date'] ); |
|
824 | - $end_date = wp_strip_all_tags( $this->_req_data['payment-filter-end-date'] ); |
|
823 | + $start_date = wp_strip_all_tags($this->_req_data['payment-filter-start-date']); |
|
824 | + $end_date = wp_strip_all_tags($this->_req_data['payment-filter-end-date']); |
|
825 | 825 | //make sure our timestamps start and end right at the boundaries for each day |
826 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
827 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
826 | + $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00'; |
|
827 | + $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59'; |
|
828 | 828 | |
829 | 829 | //convert to timestamps |
830 | - $start_date = strtotime( $start_date ); |
|
831 | - $end_date = strtotime( $end_date ); |
|
830 | + $start_date = strtotime($start_date); |
|
831 | + $end_date = strtotime($end_date); |
|
832 | 832 | |
833 | 833 | //makes sure start date is the lowest value and vice versa |
834 | - $start_date = min( $start_date, $end_date ); |
|
835 | - $end_date = max( $start_date, $end_date ); |
|
834 | + $start_date = min($start_date, $end_date); |
|
835 | + $end_date = max($start_date, $end_date); |
|
836 | 836 | |
837 | 837 | //convert for query |
838 | - $start_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' ); |
|
839 | - $end_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' ); |
|
838 | + $start_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s'); |
|
839 | + $end_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s'); |
|
840 | 840 | |
841 | - $query_params[0]['LOG_time'] = array('BETWEEN',array($start_date,$end_date)); |
|
841 | + $query_params[0]['LOG_time'] = array('BETWEEN', array($start_date, $end_date)); |
|
842 | 842 | |
843 | 843 | } |
844 | - if($count){ |
|
844 | + if ($count) { |
|
845 | 845 | return EEM_Change_Log::instance()->count($query_params); |
846 | 846 | } |
847 | - if(isset($this->_req_data['order'])){ |
|
848 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
847 | + if (isset($this->_req_data['order'])) { |
|
848 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
849 | 849 | $query_params['order_by'] = array('LOG_time' => $sort); |
850 | - }else{ |
|
850 | + } else { |
|
851 | 851 | $query_params['order_by'] = array('LOG_time' => 'DESC'); |
852 | 852 | } |
853 | - $offset = ($current_page-1)*$per_page; |
|
853 | + $offset = ($current_page - 1) * $per_page; |
|
854 | 854 | |
855 | - if( ! isset($this->_req_data['download_results'])){ |
|
856 | - $query_params['limit'] = array( $offset, $per_page ); |
|
855 | + if ( ! isset($this->_req_data['download_results'])) { |
|
856 | + $query_params['limit'] = array($offset, $per_page); |
|
857 | 857 | } |
858 | 858 | |
859 | 859 | |
860 | 860 | |
861 | 861 | //now they've requested to instead just download the file instead of viewing it. |
862 | - if(isset($this->_req_data['download_results'])){ |
|
862 | + if (isset($this->_req_data['download_results'])) { |
|
863 | 863 | $wpdb_results = EEM_Change_Log::instance()->get_all_efficiently($query_params); |
864 | 864 | header('Content-Disposition: attachment'); |
865 | 865 | header("Content-Disposition: attachment; filename=ee_payment_logs_for_".sanitize_key(site_url())); |
@@ -881,36 +881,36 @@ discard block |
||
881 | 881 | * @param EE_Change_Log $logB |
882 | 882 | * @return int |
883 | 883 | */ |
884 | - protected function _sort_logs_again($logA,$logB){ |
|
884 | + protected function _sort_logs_again($logA, $logB) { |
|
885 | 885 | $timeA = $logA->get_raw('LOG_time'); |
886 | 886 | $timeB = $logB->get_raw('LOG_time'); |
887 | - if($timeA == $timeB){ |
|
887 | + if ($timeA == $timeB) { |
|
888 | 888 | return 0; |
889 | 889 | } |
890 | 890 | $comparison = $timeA < $timeB ? -1 : 1; |
891 | - if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){ |
|
891 | + if (strtoupper($this->_sort_logs_again_direction) == 'DESC') { |
|
892 | 892 | return $comparison * -1; |
893 | - }else{ |
|
893 | + } else { |
|
894 | 894 | return $comparison; |
895 | 895 | } |
896 | 896 | } |
897 | 897 | |
898 | 898 | protected function _payment_log_details() { |
899 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
899 | + EE_Registry::instance()->load_model('Change_Log'); |
|
900 | 900 | /** @var $payment_log EE_Change_Log */ |
901 | 901 | $payment_log = EEM_Change_Log::instance()->get_one_by_ID($this->_req_data['ID']); |
902 | 902 | $payment_method = NULL; |
903 | 903 | $transaction = NULL; |
904 | - if( $payment_log instanceof EE_Change_Log ){ |
|
905 | - if( $payment_log->object() instanceof EE_Payment ){ |
|
904 | + if ($payment_log instanceof EE_Change_Log) { |
|
905 | + if ($payment_log->object() instanceof EE_Payment) { |
|
906 | 906 | $payment_method = $payment_log->object()->payment_method(); |
907 | 907 | $transaction = $payment_log->object()->transaction(); |
908 | - }elseif($payment_log->object() instanceof EE_Payment_Method){ |
|
908 | + }elseif ($payment_log->object() instanceof EE_Payment_Method) { |
|
909 | 909 | $payment_method = $payment_log->object(); |
910 | 910 | } |
911 | 911 | } |
912 | 912 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
913 | - EE_PAYMENTS_TEMPLATE_PATH . 'payment_log_details.template.php', |
|
913 | + EE_PAYMENTS_TEMPLATE_PATH.'payment_log_details.template.php', |
|
914 | 914 | array( |
915 | 915 | 'payment_log'=>$payment_log, |
916 | 916 | 'payment_method'=>$payment_method, |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @param \EE_Admin_Page $admin_page |
36 | 36 | * @return Payment_Log_Admin_List_Table |
37 | 37 | */ |
38 | - public function __construct( $admin_page ) { |
|
38 | + public function __construct($admin_page) { |
|
39 | 39 | parent::__construct($admin_page); |
40 | 40 | } |
41 | 41 | |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | // }else{ |
53 | 53 | // $this->_data = $this->_admin_page->get_questions( $this->_per_page,$this->_current_page, FALSE ); |
54 | 54 | // } |
55 | - $this->_all_data_count = $this->_admin_page->get_payment_logs( $this->_per_page,$this->_current_page, TRUE ); |
|
56 | - add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons',array($this,'add_download_logs_checkbox')); |
|
55 | + $this->_all_data_count = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page, TRUE); |
|
56 | + add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array($this, 'add_download_logs_checkbox')); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * adds a checkbox to the bottom of the list table, instead of at the top with the rest of the filters |
64 | 64 | * @return void |
65 | 65 | */ |
66 | - public function add_download_logs_checkbox(){ |
|
67 | - echo "<input type='submit' class='button-primary' id='download_results' name='download_results' value='". __( 'Download Results', 'event_espresso' )."'>"; |
|
66 | + public function add_download_logs_checkbox() { |
|
67 | + echo "<input type='submit' class='button-primary' id='download_results' name='download_results' value='".__('Download Results', 'event_espresso')."'>"; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | */ |
76 | 76 | protected function _set_properties() { |
77 | 77 | $this->_wp_list_args = array( |
78 | - 'singular' => __('payment log', 'event_espresso' ), |
|
79 | - 'plural' => __('payment logs', 'event_espresso' ), |
|
78 | + 'singular' => __('payment log', 'event_espresso'), |
|
79 | + 'plural' => __('payment logs', 'event_espresso'), |
|
80 | 80 | 'ajax' => TRUE, //for now, |
81 | 81 | 'screen' => $this->_admin_page->get_current_screen()->id |
82 | 82 | ); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | ); |
91 | 91 | |
92 | 92 | $this->_sortable_columns = array( |
93 | - 'LOG_time' => array( 'LOG_time' => TRUE ), |
|
93 | + 'LOG_time' => array('LOG_time' => TRUE), |
|
94 | 94 | ); |
95 | 95 | |
96 | 96 | $this->_hidden_columns = array( |
@@ -108,18 +108,18 @@ discard block |
||
108 | 108 | $filters = array(); |
109 | 109 | //todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods. |
110 | 110 | $payment_methods = EEM_Payment_Method::instance()->get_all(); |
111 | - $payment_method_names = array(array('id'=>'all','text'=> __("All", 'event_espresso')),array('id'=>'0','text'=> __("Unknown Payment Method", 'event_espresso'))); |
|
112 | - foreach($payment_methods as $payment_method){ |
|
113 | - $payment_method_names[] = array('id'=>$payment_method->ID(),'text'=>$payment_method->admin_name()); |
|
111 | + $payment_method_names = array(array('id'=>'all', 'text'=> __("All", 'event_espresso')), array('id'=>'0', 'text'=> __("Unknown Payment Method", 'event_espresso'))); |
|
112 | + foreach ($payment_methods as $payment_method) { |
|
113 | + $payment_method_names[] = array('id'=>$payment_method->ID(), 'text'=>$payment_method->admin_name()); |
|
114 | 114 | } |
115 | 115 | $filters[] = EEH_Form_Fields::select_input('_payment_method', $payment_method_names, isset($this->_req_data['_payment_method']) ? $this->_req_data['_payment_method'] : 'all'); |
116 | - $start_date = isset( $this->_req_data['payment-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['payment-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-6 months' )); |
|
117 | - $end_date = isset( $this->_req_data['payment-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['payment-filter-end-date'] ) : date( 'm/d/Y' ); |
|
116 | + $start_date = isset($this->_req_data['payment-filter-start-date']) ? wp_strip_all_tags($this->_req_data['payment-filter-start-date']) : date('m/d/Y', strtotime('-6 months')); |
|
117 | + $end_date = isset($this->_req_data['payment-filter-end-date']) ? wp_strip_all_tags($this->_req_data['payment-filter-end-date']) : date('m/d/Y'); |
|
118 | 118 | ob_start(); |
119 | 119 | ?> |
120 | - <label for="txn-filter-start-date"><?php _e( 'Display Transactions from ', 'event_espresso' ); ?></label> |
|
120 | + <label for="txn-filter-start-date"><?php _e('Display Transactions from ', 'event_espresso'); ?></label> |
|
121 | 121 | <input id="payment-filter-start-date" class="datepicker" type="text" value="<?php echo $start_date; ?>" name="payment-filter-start-date" size="15"/> |
122 | - <label for="txn-filter-end-date"><?php _e( ' until ', 'event_espresso' ); ?></label> |
|
122 | + <label for="txn-filter-end-date"><?php _e(' until ', 'event_espresso'); ?></label> |
|
123 | 123 | <input id="payment-filter-end-date" class="datepicker" type="text" value="<?php echo $end_date; ?>" name="payment-filter-end-date" size="15"/> |
124 | 124 | <?php |
125 | 125 | $filters[] = ob_get_clean(); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @return void |
134 | 134 | */ |
135 | 135 | protected function _add_view_counts() { |
136 | - $this->_views['all']['count'] = $this->_admin_page->get_payment_logs( $this->_per_page,$this->_current_page, TRUE ); |
|
136 | + $this->_views['all']['count'] = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page, TRUE); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @return string |
145 | 145 | */ |
146 | 146 | public function column_cb($item) { |
147 | - return sprintf( '<input type="checkbox" class="option_id" name="checkbox[%1$d]" value="%1$d" />', $item->ID() ); |
|
147 | + return sprintf('<input type="checkbox" class="option_id" name="checkbox[%1$d]" value="%1$d" />', $item->ID()); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param \EE_Change_Log $item |
171 | 171 | * @return string |
172 | 172 | */ |
173 | - public function column_LOG_time(EE_Change_Log $item){ |
|
173 | + public function column_LOG_time(EE_Change_Log $item) { |
|
174 | 174 | return $item->get_datetime('LOG_time'); |
175 | 175 | } |
176 | 176 | |
@@ -181,12 +181,12 @@ discard block |
||
181 | 181 | * @param \EE_Change_Log $item |
182 | 182 | * @return string |
183 | 183 | */ |
184 | - public function column_PMD_ID(EE_Change_Log $item){ |
|
185 | - if($item->object() instanceof EE_Payment_Method){ |
|
184 | + public function column_PMD_ID(EE_Change_Log $item) { |
|
185 | + if ($item->object() instanceof EE_Payment_Method) { |
|
186 | 186 | return $item->object()->admin_name(); |
187 | - }elseif($item->object() instanceof EE_Payment && $item->object()->payment_method()){ |
|
187 | + }elseif ($item->object() instanceof EE_Payment && $item->object()->payment_method()) { |
|
188 | 188 | return $item->object()->payment_method()->admin_name(); |
189 | - }else{ |
|
189 | + } else { |
|
190 | 190 | return __("No longer exists", 'event_espresso'); |
191 | 191 | } |
192 | 192 | } |
@@ -198,11 +198,11 @@ discard block |
||
198 | 198 | * @param \EE_Change_Log $item |
199 | 199 | * @return string |
200 | 200 | */ |
201 | - public function column_TXN_ID(EE_Change_Log $item){ |
|
202 | - if($item->object() instanceof EE_Payment){ |
|
203 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->object()->TXN_ID() )) { |
|
204 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->object()->TXN_ID() ), TXN_ADMIN_URL ); |
|
205 | - return '<a href="'.$view_txn_lnk_url.'" title="' . sprintf( esc_attr__( 'click to view transaction #%s', 'event_espresso' ), $item->object()->TXN_ID() ) . '">' . sprintf( __( 'view txn %s', 'event_espresso' ), $item->object()->TXN_ID() ) . '</a>'; |
|
201 | + public function column_TXN_ID(EE_Change_Log $item) { |
|
202 | + if ($item->object() instanceof EE_Payment) { |
|
203 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->object()->TXN_ID())) { |
|
204 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->object()->TXN_ID()), TXN_ADMIN_URL); |
|
205 | + return '<a href="'.$view_txn_lnk_url.'" title="'.sprintf(esc_attr__('click to view transaction #%s', 'event_espresso'), $item->object()->TXN_ID()).'">'.sprintf(__('view txn %s', 'event_espresso'), $item->object()->TXN_ID()).'</a>'; |
|
206 | 206 | } |
207 | 207 | } else { |
208 | 208 | return __("Unable to find transaction", 'event_espresso'); |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\address\formatters; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @param string $CNT_ISO |
29 | 29 | * @return string |
30 | 30 | */ |
31 | - public function format( $address, $address2, $city, $state, $zip, $country, $CNT_ISO ) { |
|
31 | + public function format($address, $address2, $city, $state, $zip, $country, $CNT_ISO) { |
|
32 | 32 | $address_formats = apply_filters( |
33 | 33 | 'FHEE__EE_Inline_Address_Formatter__address_formats', |
34 | 34 | array( |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | ) |
40 | 40 | ); |
41 | 41 | // if the incoming country has a set format, use that, else use the default |
42 | - $formatted_address = isset( $address_formats[ $CNT_ISO ] ) ? $address_formats[ $CNT_ISO ] |
|
42 | + $formatted_address = isset($address_formats[$CNT_ISO]) ? $address_formats[$CNT_ISO] |
|
43 | 43 | : $address_formats['ZZZ']; |
44 | 44 | return $this->parse_formatted_address( |
45 | 45 | $address, |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('No direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * ------------------------------------------------------------------------ |
26 | 26 | */ |
27 | -class EE_Credit_Card_Month_Input extends EE_Month_Input{ |
|
27 | +class EE_Credit_Card_Month_Input extends EE_Month_Input { |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * @param bool $leading_zero |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | $leading_zero = false, |
36 | 36 | $input_settings = array(), |
37 | 37 | $january_is_month_1 = true |
38 | - ){ |
|
39 | - $this->set_sensitive_data_removal_strategy( new EE_All_Sensitive_Data_Removal() ); |
|
38 | + ) { |
|
39 | + $this->set_sensitive_data_removal_strategy(new EE_All_Sensitive_Data_Removal()); |
|
40 | 40 | parent::__construct( |
41 | 41 | $leading_zero, |
42 | 42 | $input_settings, |
@@ -6,21 +6,21 @@ discard block |
||
6 | 6 | * @subpackage |
7 | 7 | * @author Mike Nelson |
8 | 8 | */ |
9 | -class EE_Month_Input extends EE_Select_Input{ |
|
9 | +class EE_Month_Input extends EE_Select_Input { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @param bool $leading_zero |
13 | 13 | * @param array $input_settings |
14 | 14 | * @param bool $january_is_month_1 whether january should have value of 1; or it should be month 0 |
15 | 15 | */ |
16 | - function __construct( $leading_zero = false, $input_settings = array(), $january_is_month_1 = true){ |
|
16 | + function __construct($leading_zero = false, $input_settings = array(), $january_is_month_1 = true) { |
|
17 | 17 | $key_begin_range = $january_is_month_1 ? 1 : 0; |
18 | - $key_range = range($key_begin_range, $key_begin_range + 11 ); |
|
19 | - if($leading_zero){ |
|
20 | - array_walk( $key_range, array( $this, '_zero_pad' ) ); |
|
18 | + $key_range = range($key_begin_range, $key_begin_range + 11); |
|
19 | + if ($leading_zero) { |
|
20 | + array_walk($key_range, array($this, '_zero_pad')); |
|
21 | 21 | } |
22 | - $value_range = range( 1, 12 ); |
|
23 | - array_walk( $value_range, array( $this, '_zero_pad' ) ); |
|
22 | + $value_range = range(1, 12); |
|
23 | + array_walk($value_range, array($this, '_zero_pad')); |
|
24 | 24 | parent::__construct( |
25 | 25 | array_combine( |
26 | 26 | $key_range, |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @param int $input |
36 | 36 | * @param mixed $key |
37 | 37 | */ |
38 | - protected function _zero_pad( &$input, $key ) { |
|
39 | - $input = str_pad( $input, 2, '0', STR_PAD_LEFT ); |
|
38 | + protected function _zero_pad(&$input, $key) { |
|
39 | + $input = str_pad($input, 2, '0', STR_PAD_LEFT); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | \ No newline at end of file |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * ------------------------------------------------------------------------ |
26 | 26 | */ |
27 | -abstract class EE_Offsite_Gateway extends EE_Gateway{ |
|
27 | +abstract class EE_Offsite_Gateway extends EE_Gateway { |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * whether or not the gateway uses an IPN |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @param string $cancel_url URL to send the user to after a cancelled payment attempt on teh payment provider's website |
62 | 62 | * @return EE_Payment |
63 | 63 | */ |
64 | - public abstract function set_redirection_info( $payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL); |
|
64 | + public abstract function set_redirection_info($payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL); |
|
65 | 65 | |
66 | 66 | |
67 | 67 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param EEI_Transaction $transaction |
75 | 75 | * @return EEI_Payment updated |
76 | 76 | */ |
77 | - public abstract function handle_payment_update($update_info,$transaction); |
|
77 | + public abstract function handle_payment_update($update_info, $transaction); |
|
78 | 78 | |
79 | 79 | |
80 | 80 | |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | * @access protected |
102 | 102 | * @param boolean $uses_separate_IPN_request |
103 | 103 | */ |
104 | - protected function set_uses_separate_IPN_request( $uses_separate_IPN_request ) { |
|
105 | - $this->_uses_separate_IPN_request = filter_var( $uses_separate_IPN_request, FILTER_VALIDATE_BOOLEAN ); |
|
104 | + protected function set_uses_separate_IPN_request($uses_separate_IPN_request) { |
|
105 | + $this->_uses_separate_IPN_request = filter_var($uses_separate_IPN_request, FILTER_VALIDATE_BOOLEAN); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | * @param boolean $separate_IPN_request |
117 | 117 | * @return boolean |
118 | 118 | */ |
119 | - public function handle_IPN_in_this_request( $request_data, $separate_IPN_request ) { |
|
120 | - if( $separate_IPN_request ) { |
|
119 | + public function handle_IPN_in_this_request($request_data, $separate_IPN_request) { |
|
120 | + if ($separate_IPN_request) { |
|
121 | 121 | return $this->_uses_separate_IPN_request; |
122 | 122 | } else { |
123 | 123 | //it's a request where the user returned from an offsite gateway |