@@ -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 Support_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 | |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | 'nav' => array( |
86 | 86 | 'label' => __('Shortcodes', 'event_espresso'), |
87 | 87 | 'order' => 30), |
88 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_shortcodes_boxes' ) ), |
|
88 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_shortcodes_boxes')), |
|
89 | 89 | 'require_nonce' => FALSE |
90 | 90 | ), |
91 | 91 | 'contact_support' => array( |
92 | 92 | 'nav' => array( |
93 | 93 | 'label' => __('Support', 'event_espresso'), |
94 | 94 | 'order' => 40), |
95 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_support_boxes' ) ), |
|
95 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_support_boxes')), |
|
96 | 96 | 'require_nonce' => FALSE |
97 | 97 | ), |
98 | 98 | 'developers' => array( |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | |
121 | 121 | |
122 | 122 | protected function _installation() { |
123 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_installation.template.php'; |
|
124 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, '', TRUE); |
|
123 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_installation.template.php'; |
|
124 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, '', TRUE); |
|
125 | 125 | $this->display_admin_page_with_sidebar(); |
126 | 126 | } |
127 | 127 | |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | 'other_resources' => __('Other Resources', 'event_espresso') |
147 | 147 | ); |
148 | 148 | |
149 | - foreach ( $boxes as $box => $label ) { |
|
150 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
149 | + foreach ($boxes as $box => $label) { |
|
150 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
151 | 151 | $callback_args = array('template_path' => $template_path); |
152 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
152 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
@@ -170,15 +170,15 @@ discard block |
||
170 | 170 | 'shortcodes_event_listings' => __('Event Listings', 'event_espresso'), |
171 | 171 | 'shortcodes_ticket_selector' => __('Event Ticket Selector', 'event_espresso'), |
172 | 172 | 'shortcodes_category' => __('Event Categories', 'event_espresso'), |
173 | - 'shortcodes_attendee' => __( 'Event Attendees', 'event_espresso' ) |
|
173 | + 'shortcodes_attendee' => __('Event Attendees', 'event_espresso') |
|
174 | 174 | /*'shortcodes_single_events' => __('Single Events', 'event_espresso'),*/ |
175 | 175 | /*'shortcodes_attendee_listings' => __('Attendee Listings', 'event_espresso'),*/ |
176 | 176 | ); |
177 | 177 | |
178 | - foreach ( $boxes as $box => $label ) { |
|
179 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
178 | + foreach ($boxes as $box => $label) { |
|
179 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
180 | 180 | $callback_args = array('template_path' => $template_path); |
181 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
181 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
@@ -197,17 +197,17 @@ discard block |
||
197 | 197 | 'important_information' => __('Important Information', 'event_espresso') |
198 | 198 | ); |
199 | 199 | |
200 | - foreach ( $boxes as $box => $label ) { |
|
201 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php'; |
|
200 | + foreach ($boxes as $box => $label) { |
|
201 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php'; |
|
202 | 202 | $callback_args = array('template_path' => $template_path, 'template_args' => $this->_template_args); |
203 | - add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
203 | + add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen_id, 'normal', 'high', $callback_args); |
|
204 | 204 | } |
205 | 205 | } |
206 | 206 | |
207 | 207 | |
208 | 208 | protected function _developers() { |
209 | - $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'developers_admin_details.template.php'; |
|
210 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, array(), true ); |
|
209 | + $template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'developers_admin_details.template.php'; |
|
210 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, array(), true); |
|
211 | 211 | $this->display_admin_page_with_sidebar(); |
212 | 212 | } |
213 | 213 |
@@ -808,7 +808,7 @@ |
||
808 | 808 | |
809 | 809 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
810 | 810 | |
811 | - } else { |
|
811 | + } else { |
|
812 | 812 | EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
813 | 813 | // remove malformed data |
814 | 814 | unset( $valid_data[ $reg_url_link ] ); |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | * @param EE_Checkout $checkout |
38 | 38 | * @return \EE_SPCO_Reg_Step_Attendee_Information |
39 | 39 | */ |
40 | - public function __construct( EE_Checkout $checkout ) { |
|
40 | + public function __construct(EE_Checkout $checkout) { |
|
41 | 41 | $this->_slug = 'attendee_information'; |
42 | 42 | $this->_name = __('Attendee Information', 'event_espresso'); |
43 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php'; |
|
43 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php'; |
|
44 | 44 | $this->checkout = $checkout; |
45 | 45 | $this->_reset_success_message(); |
46 | - $this->set_instructions( __('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
46 | + $this->set_instructions(__('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso'); |
53 | 53 | EE_Registry::$i18n_js_strings['required_multi_field'] = __(' is a required question. Please enter a value for at least one of the options.', 'event_espresso'); |
54 | 54 | EE_Registry::$i18n_js_strings['answer_required_questions'] = __('Please answer all required questions correctly before proceeding.', 'event_espresso'); |
55 | - EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf( __('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>' ); |
|
55 | + EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf(__('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>'); |
|
56 | 56 | EE_Registry::$i18n_js_strings['attendee_info_copy_error'] = __('An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.', 'event_espresso'); |
57 | 57 | EE_Registry::$i18n_js_strings['enter_valid_email'] = __('You must enter a valid email address.', 'event_espresso'); |
58 | 58 | EE_Registry::$i18n_js_strings['valid_email_and_questions'] = __('You must enter a valid email address and answer all other required questions before you can proceed.', 'event_espresso'); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | EEH_Autoloader::register_line_item_display_autoloaders(); |
86 | 86 | $Line_Item_Display = new EE_Line_Item_Display(); |
87 | 87 | // calculate taxes |
88 | - $Line_Item_Display->display_line_item( $this->checkout->cart->get_grand_total(), array( 'set_tax_rate' => true ) ); |
|
88 | + $Line_Item_Display->display_line_item($this->checkout->cart->get_grand_total(), array('set_tax_rate' => true)); |
|
89 | 89 | EE_Registry::instance()->load_helper('Line_Item'); |
90 | 90 | /** @var $subsections EE_Form_Section_Proper[] */ |
91 | 91 | $subsections = array( |
@@ -97,33 +97,33 @@ discard block |
||
97 | 97 | 'ticket_count' => array() |
98 | 98 | ); |
99 | 99 | // grab the saved registrations from the transaction |
100 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
101 | - if ( $registrations ) { |
|
102 | - foreach ( $registrations as $registration ) { |
|
103 | - if ( $registration instanceof EE_Registration ) { |
|
100 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
101 | + if ($registrations) { |
|
102 | + foreach ($registrations as $registration) { |
|
103 | + if ($registration instanceof EE_Registration) { |
|
104 | 104 | // can this registration be processed during this visit ? |
105 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
106 | - $subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration ); |
|
107 | - if ( ! $this->checkout->admin_request ) { |
|
108 | - $template_args['registrations'][ $registration->reg_url_link() ] = $registration; |
|
109 | - $template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( $template_args['ticket_count'][ $registration->ticket()->ID() ] ) ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 : 1; |
|
110 | - $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( $this->checkout->cart->get_grand_total(), 'Ticket', array( $registration->ticket()->ID() ) ); |
|
111 | - $ticket_line_item = is_array( $ticket_line_item ) ? reset( $ticket_line_item ) : $ticket_line_item; |
|
112 | - $template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item( $ticket_line_item ); |
|
105 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
106 | + $subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration); |
|
107 | + if ( ! $this->checkout->admin_request) { |
|
108 | + $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
109 | + $template_args['ticket_count'][$registration->ticket()->ID()] = isset($template_args['ticket_count'][$registration->ticket()->ID()]) ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 : 1; |
|
110 | + $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs($this->checkout->cart->get_grand_total(), 'Ticket', array($registration->ticket()->ID())); |
|
111 | + $ticket_line_item = is_array($ticket_line_item) ? reset($ticket_line_item) : $ticket_line_item; |
|
112 | + $template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item($ticket_line_item); |
|
113 | 113 | } |
114 | - if ( $registration->is_primary_registrant() ) { |
|
114 | + if ($registration->is_primary_registrant()) { |
|
115 | 115 | $primary_registrant = $registration->reg_url_link(); |
116 | 116 | } |
117 | 117 | } |
118 | 118 | } |
119 | 119 | } |
120 | 120 | // print_copy_info ? |
121 | - if ( $primary_registrant && count( $registrations ) > 1 && ! $this->checkout->admin_request ) { |
|
121 | + if ($primary_registrant && count($registrations) > 1 && ! $this->checkout->admin_request) { |
|
122 | 122 | // TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info |
123 | 123 | $copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info ? $this->_copy_attendee_info_form() : $this->_auto_copy_attendee_info(); |
124 | 124 | // generate hidden input |
125 | - if ( isset( $subsections[ $primary_registrant ] ) && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper ) { |
|
126 | - $subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false ); |
|
125 | + if (isset($subsections[$primary_registrant]) && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper) { |
|
126 | + $subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
@@ -135,8 +135,7 @@ discard block |
||
135 | 135 | 'html_id' => $this->reg_form_name(), |
136 | 136 | 'subsections' => $subsections, |
137 | 137 | 'layout_strategy' => $this->checkout->admin_request ? |
138 | - new EE_Div_Per_Section_Layout() : |
|
139 | - new EE_Template_Layout( |
|
138 | + new EE_Div_Per_Section_Layout() : new EE_Template_Layout( |
|
140 | 139 | array( |
141 | 140 | 'layout_template_file' => $this->_template, // layout_template |
142 | 141 | 'template_args' => $template_args |
@@ -153,61 +152,61 @@ discard block |
||
153 | 152 | * @param EE_Registration $registration |
154 | 153 | * @return EE_Form_Section_Proper |
155 | 154 | */ |
156 | - private function _registrations_reg_form( EE_Registration $registration ) { |
|
157 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
155 | + private function _registrations_reg_form(EE_Registration $registration) { |
|
156 | + EE_Registry::instance()->load_helper('Template'); |
|
158 | 157 | static $attendee_nmbr = 1; |
159 | 158 | // array of params to pass to parent constructor |
160 | 159 | $form_args = array( |
161 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
160 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link(), |
|
162 | 161 | 'html_class' => 'ee-reg-form-attendee-dv', |
163 | 162 | 'html_style' => $this->checkout->admin_request ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' : '', |
164 | 163 | 'subsections' => array(), |
165 | 164 | 'layout_strategy' => new EE_Fieldset_Section_Layout( |
166 | 165 | array( |
167 | 166 | 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
168 | - 'legend_text' => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr ) |
|
167 | + 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
169 | 168 | ) |
170 | 169 | ) |
171 | 170 | ); |
172 | 171 | // verify that registration has valid event |
173 | - if ( $registration->event() instanceof EE_Event ) { |
|
172 | + if ($registration->event() instanceof EE_Event) { |
|
174 | 173 | $query_params = array( |
175 | 174 | array( |
176 | 175 | 'Event.EVT_ID' => $registration->event()->ID(), |
177 | 176 | 'Event_Question_Group.EQG_primary' => $registration->count() == 1 ? TRUE : FALSE |
178 | 177 | ), |
179 | - 'order_by'=>array( 'QSG_order'=>'ASC' ) |
|
178 | + 'order_by'=>array('QSG_order'=>'ASC') |
|
180 | 179 | ); |
181 | - $question_groups = $registration->event()->question_groups( $query_params ); |
|
182 | - if ( $question_groups ) { |
|
183 | - foreach ( $question_groups as $question_group ) { |
|
184 | - if ( $question_group instanceof EE_Question_Group ) { |
|
185 | - $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( $registration, $question_group ); |
|
180 | + $question_groups = $registration->event()->question_groups($query_params); |
|
181 | + if ($question_groups) { |
|
182 | + foreach ($question_groups as $question_group) { |
|
183 | + if ($question_group instanceof EE_Question_Group) { |
|
184 | + $form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form($registration, $question_group); |
|
186 | 185 | // add hidden input |
187 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration ); |
|
186 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration); |
|
188 | 187 | } |
189 | 188 | } |
190 | 189 | // if we have question groups for additional attendees, then display the copy options |
191 | 190 | $this->_print_copy_info = $attendee_nmbr > 1 ? TRUE : $this->_print_copy_info; |
192 | 191 | } else { |
193 | - $form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link() ] = new EE_Form_Section_HTML( |
|
192 | + $form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link()] = new EE_Form_Section_HTML( |
|
194 | 193 | EEH_Template::locate_template( |
195 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php', |
|
196 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
194 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php', |
|
195 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
197 | 196 | TRUE, |
198 | 197 | TRUE |
199 | 198 | ) |
200 | 199 | ); |
201 | 200 | // add hidden input |
202 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration, FALSE ); |
|
201 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration, FALSE); |
|
203 | 202 | } |
204 | 203 | } |
205 | - if ( $registration->is_primary_registrant() ) { |
|
204 | + if ($registration->is_primary_registrant()) { |
|
206 | 205 | // generate hidden input |
207 | - $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration ); |
|
206 | + $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
208 | 207 | } |
209 | 208 | $attendee_nmbr++; |
210 | - return new EE_Form_Section_Proper( $form_args ); |
|
209 | + return new EE_Form_Section_Proper($form_args); |
|
211 | 210 | } |
212 | 211 | |
213 | 212 | |
@@ -220,11 +219,11 @@ discard block |
||
220 | 219 | * @param bool $additional_attendee_reg_info |
221 | 220 | * @return EE_Form_Input_Base |
222 | 221 | */ |
223 | - private function _additional_attendee_reg_info_input( EE_Registration $registration, $additional_attendee_reg_info = TRUE ){ |
|
222 | + private function _additional_attendee_reg_info_input(EE_Registration $registration, $additional_attendee_reg_info = TRUE) { |
|
224 | 223 | // generate hidden input |
225 | 224 | return new EE_Hidden_Input( |
226 | 225 | array( |
227 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(), |
|
226 | + 'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(), |
|
228 | 227 | 'default' => $additional_attendee_reg_info |
229 | 228 | ) |
230 | 229 | ); |
@@ -237,22 +236,22 @@ discard block |
||
237 | 236 | * @param EE_Question_Group $question_group |
238 | 237 | * @return EE_Form_Section_Proper |
239 | 238 | */ |
240 | - private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
239 | + private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) { |
|
241 | 240 | // array of params to pass to parent constructor |
242 | 241 | $form_args = array( |
243 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
242 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
244 | 243 | 'html_class' => $this->checkout->admin_request ? 'form-table ee-reg-form-qstn-grp-dv' : 'ee-reg-form-qstn-grp-dv', |
245 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl', |
|
244 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl', |
|
246 | 245 | 'subsections' => array( |
247 | - 'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group ) |
|
246 | + 'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group) |
|
248 | 247 | ), |
249 | 248 | 'layout_strategy' => $this->checkout->admin_request ? new EE_Admin_Two_Column_Layout() : new EE_Div_Per_Section_Layout() |
250 | 249 | ); |
251 | 250 | // where params |
252 | - $query_params = array( 'QST_deleted' => 0 ); |
|
251 | + $query_params = array('QST_deleted' => 0); |
|
253 | 252 | // don't load admin only questions on the frontend |
254 | - if ( ! $this->checkout->admin_request ) { |
|
255 | - $query_params['QST_admin_only'] = array( '!=', TRUE ); |
|
253 | + if ( ! $this->checkout->admin_request) { |
|
254 | + $query_params['QST_admin_only'] = array('!=', TRUE); |
|
256 | 255 | } |
257 | 256 | $questions = $question_group->get_many_related( |
258 | 257 | 'Question', |
@@ -264,21 +263,21 @@ discard block |
||
264 | 263 | ) |
265 | 264 | ); |
266 | 265 | // filter for additional content before questions |
267 | - $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this )); |
|
266 | + $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this)); |
|
268 | 267 | // loop thru questions |
269 | - foreach ( $questions as $question ) { |
|
270 | - if( $question instanceof EE_Question ){ |
|
268 | + foreach ($questions as $question) { |
|
269 | + if ($question instanceof EE_Question) { |
|
271 | 270 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
272 | - $form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question ); |
|
271 | + $form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question); |
|
273 | 272 | } |
274 | 273 | } |
275 | - $form_args['subsections'] = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this ); |
|
274 | + $form_args['subsections'] = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this); |
|
276 | 275 | |
277 | 276 | // filter for additional content after questions |
278 | - $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this )); |
|
277 | + $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this)); |
|
279 | 278 | // d( $form_args ); |
280 | - $question_group_reg_form = new EE_Form_Section_Proper( $form_args ); |
|
281 | - return apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this ); |
|
279 | + $question_group_reg_form = new EE_Form_Section_Proper($form_args); |
|
280 | + return apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this); |
|
282 | 281 | } |
283 | 282 | |
284 | 283 | |
@@ -288,12 +287,12 @@ discard block |
||
288 | 287 | * @param EE_Question_Group $question_group |
289 | 288 | * @return EE_Form_Section_HTML |
290 | 289 | */ |
291 | - private function _question_group_header( EE_Question_Group $question_group ){ |
|
290 | + private function _question_group_header(EE_Question_Group $question_group) { |
|
292 | 291 | $html = ''; |
293 | 292 | // group_name |
294 | - if ( $question_group->show_group_name() && $question_group->name() != '' ) { |
|
293 | + if ($question_group->show_group_name() && $question_group->name() != '') { |
|
295 | 294 | EE_Registry::instance()->load_helper('HTML'); |
296 | - if ( $this->checkout->admin_request ) { |
|
295 | + if ($this->checkout->admin_request) { |
|
297 | 296 | $html .= EEH_HTML::br(); |
298 | 297 | $html .= EEH_HTML::h3( |
299 | 298 | $question_group->name(), |
@@ -307,7 +306,7 @@ discard block |
||
307 | 306 | } |
308 | 307 | } |
309 | 308 | // group_desc |
310 | - if ( $question_group->show_group_desc() && $question_group->desc() != '' ) { |
|
309 | + if ($question_group->show_group_desc() && $question_group->desc() != '') { |
|
311 | 310 | $html .= EEH_HTML::p( |
312 | 311 | $question_group->desc(), |
313 | 312 | '', |
@@ -315,7 +314,7 @@ discard block |
||
315 | 314 | ); |
316 | 315 | |
317 | 316 | } |
318 | - return new EE_Form_Section_HTML( $html ); |
|
317 | + return new EE_Form_Section_HTML($html); |
|
319 | 318 | } |
320 | 319 | |
321 | 320 | |
@@ -324,14 +323,14 @@ discard block |
||
324 | 323 | * @access public |
325 | 324 | * @return EE_Form_Section_Proper |
326 | 325 | */ |
327 | - private function _copy_attendee_info_form(){ |
|
326 | + private function _copy_attendee_info_form() { |
|
328 | 327 | // array of params to pass to parent constructor |
329 | 328 | return new EE_Form_Section_Proper( |
330 | 329 | array( |
331 | 330 | 'subsections' => $this->_copy_attendee_info_inputs(), |
332 | 331 | 'layout_strategy' => new EE_Template_Layout( |
333 | 332 | array( |
334 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'copy_attendee_info.template.php', // layout_template |
|
333 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'copy_attendee_info.template.php', // layout_template |
|
335 | 334 | 'begin_template_file' => NULL, |
336 | 335 | 'input_template_file' => NULL, |
337 | 336 | 'subsection_template_file' => NULL, |
@@ -353,8 +352,8 @@ discard block |
||
353 | 352 | private function _auto_copy_attendee_info() { |
354 | 353 | return new EE_Form_Section_HTML( |
355 | 354 | EEH_Template::locate_template( |
356 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php', |
|
357 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
355 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php', |
|
356 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
358 | 357 | TRUE, |
359 | 358 | TRUE |
360 | 359 | ) |
@@ -373,25 +372,25 @@ discard block |
||
373 | 372 | $copy_attendee_info_inputs = array(); |
374 | 373 | $prev_ticket = NULL; |
375 | 374 | // grab the saved registrations from the transaction |
376 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
377 | - foreach ( $registrations as $registration ) { |
|
375 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
376 | + foreach ($registrations as $registration) { |
|
378 | 377 | // for all attendees other than the primary attendee |
379 | - if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) { |
|
378 | + if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { |
|
380 | 379 | // if this is a new ticket OR if this is the very first additional attendee after the primary attendee |
381 | - if ( $registration->ticket()->ID() !== $prev_ticket ) { |
|
380 | + if ($registration->ticket()->ID() !== $prev_ticket) { |
|
382 | 381 | $item_name = $registration->ticket()->name(); |
383 | - $item_name .= $registration->ticket()->description() != '' ? ' - ' . $registration->ticket()->description() : ''; |
|
384 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML( |
|
385 | - '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>' |
|
382 | + $item_name .= $registration->ticket()->description() != '' ? ' - '.$registration->ticket()->description() : ''; |
|
383 | + $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML( |
|
384 | + '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>' |
|
386 | 385 | ); |
387 | 386 | $prev_ticket = $registration->ticket()->ID(); |
388 | 387 | } |
389 | 388 | |
390 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new |
|
389 | + $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new |
|
391 | 390 | EE_Checkbox_Multi_Input( |
392 | - array( $registration->ID() => sprintf( __('Attendee #%s', 'event_espresso'), $registration->count() )), |
|
391 | + array($registration->ID() => sprintf(__('Attendee #%s', 'event_espresso'), $registration->count())), |
|
393 | 392 | array( |
394 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(), |
|
393 | + 'html_id' => 'spco-copy-attendee-chk-'.$registration->reg_url_link(), |
|
395 | 394 | 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate', |
396 | 395 | 'display_html_label_text' => FALSE |
397 | 396 | ) |
@@ -410,7 +409,7 @@ discard block |
||
410 | 409 | * @param EE_Registration $registration |
411 | 410 | * @return EE_Form_Input_Base |
412 | 411 | */ |
413 | - private function _additional_primary_registrant_inputs( EE_Registration $registration ){ |
|
412 | + private function _additional_primary_registrant_inputs(EE_Registration $registration) { |
|
414 | 413 | // generate hidden input |
415 | 414 | return new EE_Hidden_Input( |
416 | 415 | array( |
@@ -428,31 +427,31 @@ discard block |
||
428 | 427 | * @param EE_Question $question |
429 | 428 | * @return EE_Form_Input_Base |
430 | 429 | */ |
431 | - public function reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
430 | + public function reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
432 | 431 | |
433 | 432 | // if this question was for an attendee detail, then check for that answer |
434 | - $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->system_ID() ); |
|
433 | + $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->system_ID()); |
|
435 | 434 | $answer = $answer_value === null |
436 | - ? EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) ) |
|
435 | + ? EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))) |
|
437 | 436 | : null; |
438 | 437 | // if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object |
439 | - if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) { |
|
438 | + if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) { |
|
440 | 439 | // create an EE_Answer object for storing everything in |
441 | - $answer = EE_Answer::new_instance ( array( |
|
440 | + $answer = EE_Answer::new_instance(array( |
|
442 | 441 | 'QST_ID'=> $question->ID(), |
443 | 442 | 'REG_ID'=> $registration->ID() |
444 | 443 | )); |
445 | 444 | } |
446 | 445 | // verify instance |
447 | - if( $answer instanceof EE_Answer ){ |
|
448 | - if ( ! empty( $answer_value )) { |
|
449 | - $answer->set( 'ANS_value', $answer_value ); |
|
446 | + if ($answer instanceof EE_Answer) { |
|
447 | + if ( ! empty($answer_value)) { |
|
448 | + $answer->set('ANS_value', $answer_value); |
|
450 | 449 | } |
451 | - $answer->cache( 'Question', $question ); |
|
452 | - $answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link(); |
|
453 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
450 | + $answer->cache('Question', $question); |
|
451 | + $answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link(); |
|
452 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
454 | 453 | } |
455 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
454 | + return $this->_generate_question_input($registration, $question, $answer); |
|
456 | 455 | |
457 | 456 | } |
458 | 457 | |
@@ -464,31 +463,31 @@ discard block |
||
464 | 463 | * @param mixed EE_Answer|NULL $answer |
465 | 464 | * @return EE_Form_Input_Base |
466 | 465 | */ |
467 | - private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
466 | + private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
468 | 467 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
469 | - $this->_required_questions[ $identifier ] = $question->required() ? true : false; |
|
470 | - add_filter( 'FHEE__EE_Question__generate_form_input__country_options', array( $this, 'use_cached_countries_for_form_input' ), 10, 4 ); |
|
471 | - add_filter( 'FHEE__EE_Question__generate_form_input__state_options', array( $this, 'use_cached_states_for_form_input' ), 10, 4 ); |
|
468 | + $this->_required_questions[$identifier] = $question->required() ? true : false; |
|
469 | + add_filter('FHEE__EE_Question__generate_form_input__country_options', array($this, 'use_cached_countries_for_form_input'), 10, 4); |
|
470 | + add_filter('FHEE__EE_Question__generate_form_input__state_options', array($this, 'use_cached_states_for_form_input'), 10, 4); |
|
472 | 471 | $input_constructor_args = array( |
473 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', |
|
474 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
475 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, |
|
476 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
472 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']', |
|
473 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
474 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier, |
|
475 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
477 | 476 | 'html_label_class' => 'ee-reg-qstn', |
478 | 477 | ); |
479 | - $input_constructor_args['html_label_id'] .= '-lbl'; |
|
480 | - if ( $answer instanceof EE_Answer && $answer->ID() ) { |
|
481 | - $input_constructor_args[ 'html_name' ] .= '[' . $answer->ID() . ']'; |
|
482 | - $input_constructor_args[ 'html_id' ] .= '-' . $answer->ID(); |
|
483 | - $input_constructor_args[ 'html_label_id' ] .= '-' . $answer->ID(); |
|
478 | + $input_constructor_args['html_label_id'] .= '-lbl'; |
|
479 | + if ($answer instanceof EE_Answer && $answer->ID()) { |
|
480 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
481 | + $input_constructor_args['html_id'] .= '-'.$answer->ID(); |
|
482 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID(); |
|
484 | 483 | } |
485 | - $form_input = $question->generate_form_input( |
|
484 | + $form_input = $question->generate_form_input( |
|
486 | 485 | $registration, |
487 | 486 | $answer, |
488 | 487 | $input_constructor_args |
489 | 488 | ); |
490 | - remove_filter( 'FHEE__EE_Question__generate_form_input__country_options', array( $this, 'use_cached_countries_for_form_input' ) ); |
|
491 | - remove_filter( 'FHEE__EE_Question__generate_form_input__state_options', array( $this, 'use_cached_states_for_form_input' ) ); |
|
489 | + remove_filter('FHEE__EE_Question__generate_form_input__country_options', array($this, 'use_cached_countries_for_form_input')); |
|
490 | + remove_filter('FHEE__EE_Question__generate_form_input__state_options', array($this, 'use_cached_states_for_form_input')); |
|
492 | 491 | return $form_input; |
493 | 492 | } |
494 | 493 | |
@@ -502,20 +501,20 @@ discard block |
||
502 | 501 | * @param EE_Registration $registration |
503 | 502 | * @return array 2d keys are country IDs, values are their names |
504 | 503 | */ |
505 | - public function use_cached_countries_for_form_input( $countries_list, $question, $registration, $answer ) { |
|
506 | - $country_options = array( '' => '' ); |
|
504 | + public function use_cached_countries_for_form_input($countries_list, $question, $registration, $answer) { |
|
505 | + $country_options = array('' => ''); |
|
507 | 506 | // get possibly cached list of countries |
508 | 507 | $countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries(); |
509 | - if ( ! empty( $countries )) { |
|
510 | - foreach( $countries as $country ){ |
|
511 | - if ( $country instanceof EE_Country ) { |
|
512 | - $country_options[ $country->ID() ] = $country->name(); |
|
508 | + if ( ! empty($countries)) { |
|
509 | + foreach ($countries as $country) { |
|
510 | + if ($country instanceof EE_Country) { |
|
511 | + $country_options[$country->ID()] = $country->name(); |
|
513 | 512 | } |
514 | 513 | } |
515 | 514 | } |
516 | - if( $question instanceof EE_Question |
|
517 | - && $registration instanceof EE_Registration ) { |
|
518 | - $answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) ); |
|
515 | + if ($question instanceof EE_Question |
|
516 | + && $registration instanceof EE_Registration) { |
|
517 | + $answer = EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))); |
|
519 | 518 | } else { |
520 | 519 | $answer = EE_Answer::new_instance(); |
521 | 520 | } |
@@ -540,19 +539,19 @@ discard block |
||
540 | 539 | * @param EE_Registration $registration |
541 | 540 | * @return array 2d keys are state IDs, values are their names |
542 | 541 | */ |
543 | - public function use_cached_states_for_form_input( $states_list, $question, $registration, $answer ) { |
|
544 | - $state_options = array( '' => array( '' => '')); |
|
542 | + public function use_cached_states_for_form_input($states_list, $question, $registration, $answer) { |
|
543 | + $state_options = array('' => array('' => '')); |
|
545 | 544 | $states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states(); |
546 | - if ( ! empty( $states )) { |
|
547 | - foreach( $states as $state ){ |
|
548 | - if ( $state instanceof EE_State ) { |
|
549 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
545 | + if ( ! empty($states)) { |
|
546 | + foreach ($states as $state) { |
|
547 | + if ($state instanceof EE_State) { |
|
548 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
550 | 549 | } |
551 | 550 | } |
552 | 551 | } |
553 | - if( $question instanceof EE_Question |
|
554 | - && $registration instanceof EE_Registration ) { |
|
555 | - $answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) ); |
|
552 | + if ($question instanceof EE_Question |
|
553 | + && $registration instanceof EE_Registration) { |
|
554 | + $answer = EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))); |
|
556 | 555 | } else { |
557 | 556 | $answer = EE_Answer::new_instance(); |
558 | 557 | } |
@@ -586,65 +585,65 @@ discard block |
||
586 | 585 | */ |
587 | 586 | public function process_reg_step() { |
588 | 587 | |
589 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
588 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
590 | 589 | // grab validated data from form |
591 | 590 | $valid_data = $this->checkout->current_step->valid_data(); |
592 | 591 | //EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
593 | 592 | //EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
594 | 593 | // if we don't have any $valid_data then something went TERRIBLY WRONG !!! |
595 | - if ( empty( $valid_data )) { |
|
596 | - EE_Error::add_error( __('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
594 | + if (empty($valid_data)) { |
|
595 | + EE_Error::add_error(__('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
597 | 596 | return FALSE; |
598 | 597 | } |
599 | 598 | //EEH_Debug_Tools::printr( $this->checkout->transaction, '$this->checkout->transaction', __FILE__, __LINE__ ); |
600 | - if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) { |
|
601 | - EE_Error::add_error( __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
599 | + if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { |
|
600 | + EE_Error::add_error(__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
602 | 601 | return FALSE; |
603 | 602 | } |
604 | 603 | // get cached registrations |
605 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
604 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
606 | 605 | // verify we got the goods |
607 | - if ( empty( $registrations )) { |
|
608 | - EE_Error::add_error( __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
606 | + if (empty($registrations)) { |
|
607 | + EE_Error::add_error(__('Your form data could not be applied to any valid registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
609 | 608 | return FALSE; |
610 | 609 | } |
611 | 610 | // extract attendee info from form data and save to model objects |
612 | - $registrations_processed = $this->_process_registrations( $registrations, $valid_data ); |
|
611 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data); |
|
613 | 612 | // if first pass thru SPCO, then let's check processed registrations against the total number of tickets in the cart |
614 | - if ( $registrations_processed === FALSE ) { |
|
613 | + if ($registrations_processed === FALSE) { |
|
615 | 614 | // but return immediately if the previous step exited early due to errors |
616 | 615 | return FALSE; |
617 | - } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) { |
|
616 | + } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { |
|
618 | 617 | // generate a correctly translated string for all possible singular/plural combinations |
619 | - if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) { |
|
618 | + if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { |
|
620 | 619 | $error_msg = sprintf( |
621 | - __( 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
620 | + __('There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
622 | 621 | $this->checkout->total_ticket_count, |
623 | 622 | $registrations_processed |
624 | 623 | ); |
625 | - } else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) { |
|
624 | + } else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { |
|
626 | 625 | $error_msg = sprintf( |
627 | - __( 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso' ), |
|
626 | + __('There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso'), |
|
628 | 627 | $this->checkout->total_ticket_count, |
629 | 628 | $registrations_processed |
630 | 629 | ); |
631 | 630 | } else { |
632 | 631 | $error_msg = sprintf( |
633 | - __( 'There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
632 | + __('There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
634 | 633 | $this->checkout->total_ticket_count, |
635 | 634 | $registrations_processed |
636 | 635 | ); |
637 | 636 | |
638 | 637 | } |
639 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
638 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
640 | 639 | return FALSE; |
641 | 640 | } |
642 | 641 | // mark this reg step as completed |
643 | 642 | $this->set_completed(); |
644 | - $this->_set_success_message( __('The Attendee Information Step has been successfully completed.', 'event_espresso' )); |
|
643 | + $this->_set_success_message(__('The Attendee Information Step has been successfully completed.', 'event_espresso')); |
|
645 | 644 | //do action in case a plugin wants to do something with the data submitted in step 1. |
646 | 645 | //passes EE_Single_Page_Checkout, and it's posted data |
647 | - do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data ); |
|
646 | + do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); |
|
648 | 647 | return TRUE; |
649 | 648 | |
650 | 649 | } |
@@ -658,9 +657,9 @@ discard block |
||
658 | 657 | * @param array $valid_data |
659 | 658 | * @return boolean | int |
660 | 659 | */ |
661 | - private function _process_registrations( $registrations = array(), $valid_data = array() ) { |
|
660 | + private function _process_registrations($registrations = array(), $valid_data = array()) { |
|
662 | 661 | // load resources and set some defaults |
663 | - EE_Registry::instance()->load_model( 'Attendee' ); |
|
662 | + EE_Registry::instance()->load_model('Attendee'); |
|
664 | 663 | // holder for primary registrant attendee object |
665 | 664 | $this->checkout->primary_attendee_obj = NULL; |
666 | 665 | // array for tracking reg form data for the primary registrant |
@@ -677,19 +676,19 @@ discard block |
||
677 | 676 | // attendee counter |
678 | 677 | $att_nmbr = 0; |
679 | 678 | // grab the saved registrations from the transaction |
680 | - foreach ( $registrations as $registration ) { |
|
679 | + foreach ($registrations as $registration) { |
|
681 | 680 | // verify EE_Registration object |
682 | - if ( ! $registration instanceof EE_Registration ) { |
|
683 | - EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
681 | + if ( ! $registration instanceof EE_Registration) { |
|
682 | + EE_Error::add_error(__('An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
684 | 683 | return FALSE; |
685 | 684 | } |
686 | 685 | $reg_url_link = $registration->reg_url_link(); |
687 | 686 | // reg_url_link exists ? |
688 | - if ( $reg_url_link ) { |
|
687 | + if ($reg_url_link) { |
|
689 | 688 | // should this registration be processed during this visit ? |
690 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
689 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
691 | 690 | // if NOT revisiting, then let's save the registration now, so that we have a REG_ID to use when generating other objects |
692 | - if ( ! $this->checkout->revisit ) { |
|
691 | + if ( ! $this->checkout->revisit) { |
|
693 | 692 | $registration->save(); |
694 | 693 | } |
695 | 694 | |
@@ -700,41 +699,41 @@ discard block |
||
700 | 699 | * @var bool if TRUE is returned by the plugin then the |
701 | 700 | * registration processing is halted. |
702 | 701 | */ |
703 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this ) ) { |
|
702 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this)) { |
|
704 | 703 | return FALSE; |
705 | 704 | } |
706 | 705 | |
707 | 706 | // Houston, we have a registration! |
708 | 707 | $att_nmbr++; |
709 | - $this->_attendee_data[ $reg_url_link ] = array(); |
|
708 | + $this->_attendee_data[$reg_url_link] = array(); |
|
710 | 709 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ); |
711 | - if ( isset( $valid_data[ $reg_url_link ] )) { |
|
710 | + if (isset($valid_data[$reg_url_link])) { |
|
712 | 711 | // do we need to copy basic info from primary attendee ? |
713 | - $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 ? TRUE : FALSE; |
|
712 | + $copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 ? TRUE : FALSE; |
|
714 | 713 | // filter form input data for this registration |
715 | - $valid_data[ $reg_url_link ] = apply_filters( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[ $reg_url_link ] ); |
|
714 | + $valid_data[$reg_url_link] = apply_filters('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[$reg_url_link]); |
|
716 | 715 | //EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ ); |
717 | - if ( isset( $valid_data['primary_attendee'] )) { |
|
718 | - $primary_registrant['line_item_id'] = ! empty( $valid_data['primary_attendee'] ) ? $valid_data['primary_attendee'] : FALSE; |
|
719 | - unset( $valid_data['primary_attendee'] ); |
|
716 | + if (isset($valid_data['primary_attendee'])) { |
|
717 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) ? $valid_data['primary_attendee'] : FALSE; |
|
718 | + unset($valid_data['primary_attendee']); |
|
720 | 719 | } |
721 | 720 | // now loop through our array of valid post data && process attendee reg forms |
722 | - foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) { |
|
723 | - if ( ! in_array( $form_section, $non_input_form_sections )) { |
|
724 | - foreach ( $form_inputs as $form_input => $input_value ) { |
|
721 | + foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { |
|
722 | + if ( ! in_array($form_section, $non_input_form_sections)) { |
|
723 | + foreach ($form_inputs as $form_input => $input_value) { |
|
725 | 724 | // check for critical inputs |
726 | - if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email( $form_input, $input_value )) { |
|
725 | + if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email($form_input, $input_value)) { |
|
727 | 726 | return FALSE; |
728 | 727 | } |
729 | 728 | // store a bit of data about the primary attendee |
730 | - if ( $att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty( $input_value )) { |
|
731 | - $primary_registrant[ $form_input ] = $input_value; |
|
732 | - } else if ( $copy_primary && isset( $primary_registrant[ $form_input ] ) && $input_value == NULL ) { |
|
733 | - $input_value = $primary_registrant[ $form_input ]; |
|
729 | + if ($att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty($input_value)) { |
|
730 | + $primary_registrant[$form_input] = $input_value; |
|
731 | + } else if ($copy_primary && isset($primary_registrant[$form_input]) && $input_value == NULL) { |
|
732 | + $input_value = $primary_registrant[$form_input]; |
|
734 | 733 | } |
735 | 734 | // now attempt to save the input data |
736 | - if ( ! $this->_save_registration_form_input( $registration, $form_input, $input_value )) { |
|
737 | - EE_Error::add_error( sprintf( __( 'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso' ), $form_input, $input_value ), __FILE__, __FUNCTION__, __LINE__ ); |
|
735 | + if ( ! $this->_save_registration_form_input($registration, $form_input, $input_value)) { |
|
736 | + EE_Error::add_error(sprintf(__('Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso'), $form_input, $input_value), __FILE__, __FUNCTION__, __LINE__); |
|
738 | 737 | return FALSE; |
739 | 738 | } |
740 | 739 | } |
@@ -743,51 +742,51 @@ discard block |
||
743 | 742 | } |
744 | 743 | //EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ ); |
745 | 744 | // this registration does not require additional attendee information ? |
746 | - if ( $copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
745 | + if ($copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
747 | 746 | // just copy the primary registrant |
748 | 747 | $attendee = $this->checkout->primary_attendee_obj; |
749 | 748 | } else { |
750 | 749 | // have we met before? |
751 | - $attendee = $this->_find_existing_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
750 | + $attendee = $this->_find_existing_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
752 | 751 | // did we find an already existing record for this attendee ? |
753 | - if ( $attendee instanceof EE_Attendee ) { |
|
754 | - $attendee = $this->_update_existing_attendee_data( $attendee, $this->_attendee_data[ $reg_url_link ] ); |
|
752 | + if ($attendee instanceof EE_Attendee) { |
|
753 | + $attendee = $this->_update_existing_attendee_data($attendee, $this->_attendee_data[$reg_url_link]); |
|
755 | 754 | } else { |
756 | 755 | // ensure critical details are set for additional attendees |
757 | - $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant( $this->_attendee_data[ $reg_url_link ] ) : $this->_attendee_data[ $reg_url_link ]; |
|
758 | - $attendee = $this->_create_new_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
756 | + $this->_attendee_data[$reg_url_link] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant($this->_attendee_data[$reg_url_link]) : $this->_attendee_data[$reg_url_link]; |
|
757 | + $attendee = $this->_create_new_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
759 | 758 | } |
760 | 759 | // who's #1 ? |
761 | - if ( $att_nmbr == 1 ) { |
|
760 | + if ($att_nmbr == 1) { |
|
762 | 761 | $this->checkout->primary_attendee_obj = $attendee; |
763 | 762 | } |
764 | 763 | } |
765 | 764 | //EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ ); |
766 | 765 | // add relation to registration, set attendee ID, and cache attendee |
767 | - $this->_associate_attendee_with_registration( $registration, $attendee ); |
|
768 | - if ( ! $registration->attendee() instanceof EE_Attendee ) { |
|
769 | - EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ ); |
|
766 | + $this->_associate_attendee_with_registration($registration, $attendee); |
|
767 | + if ( ! $registration->attendee() instanceof EE_Attendee) { |
|
768 | + EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__); |
|
770 | 769 | return FALSE; |
771 | 770 | } |
772 | 771 | /** @type EE_Registration_Processor $registration_processor */ |
773 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
772 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
774 | 773 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
775 | - $registration_processor->toggle_incomplete_registration_status_to_default( $registration, FALSE ); |
|
774 | + $registration_processor->toggle_incomplete_registration_status_to_default($registration, FALSE); |
|
776 | 775 | /** @type EE_Transaction_Processor $transaction_processor */ |
777 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
776 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
778 | 777 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
779 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
778 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
780 | 779 | // if we've gotten this far, then let's save what we have |
781 | 780 | $registration->save(); |
782 | 781 | // add relation between TXN and registration |
783 | - $this->_associate_registration_with_transaction( $registration ); |
|
782 | + $this->_associate_registration_with_transaction($registration); |
|
784 | 783 | |
785 | 784 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
786 | 785 | |
787 | - } else { |
|
788 | - EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
786 | + } else { |
|
787 | + EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
789 | 788 | // remove malformed data |
790 | - unset( $valid_data[ $reg_url_link ] ); |
|
789 | + unset($valid_data[$reg_url_link]); |
|
791 | 790 | return FALSE; |
792 | 791 | } |
793 | 792 | |
@@ -805,22 +804,22 @@ discard block |
||
805 | 804 | * @param string $input_value |
806 | 805 | * @return boolean |
807 | 806 | */ |
808 | - private function _save_registration_form_input( EE_Registration $registration, $form_input = '', $input_value = '' ) { |
|
807 | + private function _save_registration_form_input(EE_Registration $registration, $form_input = '', $input_value = '') { |
|
809 | 808 | //echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '()</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span> <b style="font-size:10px;"> ' . __LINE__ . ' </b></h3>'; |
810 | 809 | //EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ ); |
811 | 810 | // allow for plugins to hook in and do their own processing of the form input. |
812 | 811 | // For plugins to bypass normal processing here, they just need to return a boolean value. |
813 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this ) ) { |
|
812 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this)) { |
|
814 | 813 | return TRUE; |
815 | 814 | } |
816 | 815 | |
817 | 816 | // grab related answer objects |
818 | 817 | $answers = $registration->answers(); |
819 | 818 | // $answer_cache_id is the key used to find the EE_Answer we want |
820 | - $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input . '-' . $registration->reg_url_link(); |
|
821 | - $answer_is_obj = isset( $answers[ $answer_cache_id ] ) && $answers[ $answer_cache_id ] instanceof EE_Answer ? TRUE : FALSE; |
|
819 | + $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input.'-'.$registration->reg_url_link(); |
|
820 | + $answer_is_obj = isset($answers[$answer_cache_id]) && $answers[$answer_cache_id] instanceof EE_Answer ? TRUE : FALSE; |
|
822 | 821 | //rename form_inputs if they are EE_Attendee properties |
823 | - switch( (string)$form_input ) { |
|
822 | + switch ((string) $form_input) { |
|
824 | 823 | |
825 | 824 | case 'state' : |
826 | 825 | case 'STA_ID' : |
@@ -835,33 +834,33 @@ discard block |
||
835 | 834 | break; |
836 | 835 | |
837 | 836 | default : |
838 | - $ATT_input = 'ATT_' . $form_input; |
|
837 | + $ATT_input = 'ATT_'.$form_input; |
|
839 | 838 | //EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ ); |
840 | - $attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? TRUE : FALSE; |
|
841 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input; |
|
839 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? TRUE : FALSE; |
|
840 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input; |
|
842 | 841 | } |
843 | 842 | //EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ ); |
844 | 843 | //EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ ); |
845 | 844 | //EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ ); |
846 | 845 | //EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ ); |
847 | 846 | // if this form input has a corresponding attendee property |
848 | - if ( $attendee_property ) { |
|
849 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value; |
|
850 | - if ( $answer_is_obj ) { |
|
847 | + if ($attendee_property) { |
|
848 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value; |
|
849 | + if ($answer_is_obj) { |
|
851 | 850 | // and delete the corresponding answer since we won't be storing this data in that object |
852 | - $registration->_remove_relation_to( $answers[ $answer_cache_id ], 'Answer' ); |
|
853 | - $answers[ $answer_cache_id ]->delete_permanently(); |
|
851 | + $registration->_remove_relation_to($answers[$answer_cache_id], 'Answer'); |
|
852 | + $answers[$answer_cache_id]->delete_permanently(); |
|
854 | 853 | } |
855 | 854 | return TRUE; |
856 | - } elseif ( $answer_is_obj ) { |
|
855 | + } elseif ($answer_is_obj) { |
|
857 | 856 | // save this data to the answer object |
858 | - $answers[ $answer_cache_id ]->set_value( $input_value ); |
|
859 | - $result = $answers[ $answer_cache_id ]->save(); |
|
857 | + $answers[$answer_cache_id]->set_value($input_value); |
|
858 | + $result = $answers[$answer_cache_id]->save(); |
|
860 | 859 | return $result !== false ? true : false; |
861 | 860 | } else { |
862 | - foreach ( $answers as $answer ) { |
|
863 | - if ( $answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id ) { |
|
864 | - $answer->set_value( $input_value ); |
|
861 | + foreach ($answers as $answer) { |
|
862 | + if ($answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id) { |
|
863 | + $answer->set_value($input_value); |
|
865 | 864 | $result = $answer->save(); |
866 | 865 | return $result !== false ? true : false; |
867 | 866 | } |
@@ -879,33 +878,33 @@ discard block |
||
879 | 878 | * @param string $input_value |
880 | 879 | * @return boolean |
881 | 880 | */ |
882 | - private function _verify_critical_attendee_details_are_set_and_validate_email( $form_input = '', $input_value = '' ) { |
|
883 | - if ( empty( $input_value )) { |
|
881 | + private function _verify_critical_attendee_details_are_set_and_validate_email($form_input = '', $input_value = '') { |
|
882 | + if (empty($input_value)) { |
|
884 | 883 | // if the form input isn't marked as being required, then just return |
885 | - if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) { |
|
884 | + if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) { |
|
886 | 885 | return true; |
887 | 886 | } |
888 | - switch( $form_input ) { |
|
887 | + switch ($form_input) { |
|
889 | 888 | case 'fname' : |
890 | - EE_Error::add_error( __( 'First Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
889 | + EE_Error::add_error(__('First Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
891 | 890 | return FALSE; |
892 | 891 | break; |
893 | 892 | case 'lname' : |
894 | - EE_Error::add_error( __( 'Last Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
893 | + EE_Error::add_error(__('Last Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
895 | 894 | return FALSE; |
896 | 895 | break; |
897 | 896 | case 'email' : |
898 | - EE_Error::add_error( __( 'Email Address is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
897 | + EE_Error::add_error(__('Email Address is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
899 | 898 | return FALSE; |
900 | 899 | break; |
901 | 900 | } |
902 | - } else if ( $form_input === 'email' ) { |
|
901 | + } else if ($form_input === 'email') { |
|
903 | 902 | // clean the email address |
904 | - $valid_email = sanitize_email( $input_value ); |
|
903 | + $valid_email = sanitize_email($input_value); |
|
905 | 904 | // check if it matches |
906 | - if ( $input_value != $valid_email ) { |
|
905 | + if ($input_value != $valid_email) { |
|
907 | 906 | // whoops!!! |
908 | - EE_Error::add_error( __( 'Please enter a valid email address.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
907 | + EE_Error::add_error(__('Please enter a valid email address.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
909 | 908 | return FALSE; |
910 | 909 | } |
911 | 910 | } |
@@ -933,14 +932,14 @@ discard block |
||
933 | 932 | * @param array $attendee_data |
934 | 933 | * @return boolean |
935 | 934 | */ |
936 | - private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
935 | + private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
937 | 936 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
938 | - $ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : ''; |
|
939 | - $ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : ''; |
|
940 | - $ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) ? $attendee_data['ATT_email'] : ''; |
|
937 | + $ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : ''; |
|
938 | + $ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : ''; |
|
939 | + $ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) ? $attendee_data['ATT_email'] : ''; |
|
941 | 940 | // but only if those have values |
942 | - if ( $ATT_fname && $ATT_lname && $ATT_email ) { |
|
943 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
941 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
942 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
944 | 943 | 'ATT_fname' => $ATT_fname, |
945 | 944 | 'ATT_lname' => $ATT_lname, |
946 | 945 | 'ATT_email' => $ATT_email |
@@ -948,7 +947,7 @@ discard block |
||
948 | 947 | } else { |
949 | 948 | $existing_attendee = NULL; |
950 | 949 | } |
951 | - return apply_filters( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data ); |
|
950 | + return apply_filters('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data); |
|
952 | 951 | } |
953 | 952 | |
954 | 953 | |
@@ -960,13 +959,13 @@ discard block |
||
960 | 959 | * @param array $attendee_data |
961 | 960 | * @return \EE_Attendee |
962 | 961 | */ |
963 | - private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) { |
|
962 | + private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { |
|
964 | 963 | // first remove fname, lname, and email from attendee data |
965 | - $dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
964 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
966 | 965 | // now loop thru what's left and add to attendee CPT |
967 | - foreach ( $attendee_data as $property_name => $property_value ) { |
|
968 | - if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) { |
|
969 | - $existing_attendee->set( $property_name, $property_value ); |
|
966 | + foreach ($attendee_data as $property_name => $property_value) { |
|
967 | + if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { |
|
968 | + $existing_attendee->set($property_name, $property_value); |
|
970 | 969 | } |
971 | 970 | } |
972 | 971 | // better save that now |
@@ -983,11 +982,11 @@ discard block |
||
983 | 982 | * @param EE_Attendee $attendee |
984 | 983 | * @return void |
985 | 984 | */ |
986 | - private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) { |
|
985 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { |
|
987 | 986 | // add relation to attendee |
988 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
989 | - $registration->set_attendee_id( $attendee->ID() ); |
|
990 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
987 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
988 | + $registration->set_attendee_id($attendee->ID()); |
|
989 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
991 | 990 | } |
992 | 991 | |
993 | 992 | |
@@ -998,10 +997,10 @@ discard block |
||
998 | 997 | * @param EE_Registration $registration |
999 | 998 | * @return void |
1000 | 999 | */ |
1001 | - private function _associate_registration_with_transaction( EE_Registration $registration ) { |
|
1000 | + private function _associate_registration_with_transaction(EE_Registration $registration) { |
|
1002 | 1001 | // add relation to attendee |
1003 | - $this->checkout->transaction->_add_relation_to( $registration, 'Registration' ); |
|
1004 | - $this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration ); |
|
1002 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration'); |
|
1003 | + $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); |
|
1005 | 1004 | } |
1006 | 1005 | |
1007 | 1006 | |
@@ -1013,17 +1012,17 @@ discard block |
||
1013 | 1012 | * @param array $attendee_data |
1014 | 1013 | * @return array |
1015 | 1014 | */ |
1016 | - private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) { |
|
1015 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) { |
|
1017 | 1016 | // bare minimum critical details include first name, last name, email address |
1018 | - $critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1017 | + $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1019 | 1018 | // add address info to critical details? |
1020 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE )) { |
|
1021 | - $address_details = array( 'ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone' ); |
|
1022 | - $critical_attendee_details = array_merge( $critical_attendee_details, $address_details ); |
|
1019 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE)) { |
|
1020 | + $address_details = array('ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone'); |
|
1021 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details); |
|
1023 | 1022 | } |
1024 | - foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
|
1025 | - if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) || empty( $attendee_data[ $critical_attendee_detail ] )) { |
|
1026 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( $critical_attendee_detail ); |
|
1023 | + foreach ($critical_attendee_details as $critical_attendee_detail) { |
|
1024 | + if ( ! isset($attendee_data[$critical_attendee_detail]) || empty($attendee_data[$critical_attendee_detail])) { |
|
1025 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get($critical_attendee_detail); |
|
1027 | 1026 | } |
1028 | 1027 | } |
1029 | 1028 | return $attendee_data; |
@@ -1038,11 +1037,11 @@ discard block |
||
1038 | 1037 | * @param array $attendee_data |
1039 | 1038 | * @return \EE_Attendee |
1040 | 1039 | */ |
1041 | - private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1040 | + private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1042 | 1041 | // create new attendee object |
1043 | - $new_attendee = EE_Attendee::new_instance( $attendee_data ); |
|
1042 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
1044 | 1043 | // set author to event creator |
1045 | - $new_attendee->set( 'ATT_author', $registration->event()->wp_user() ); |
|
1044 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
1046 | 1045 | $new_attendee->save(); |
1047 | 1046 | return $new_attendee; |
1048 | 1047 | } |
@@ -1058,7 +1057,7 @@ discard block |
||
1058 | 1057 | */ |
1059 | 1058 | public function update_reg_step() { |
1060 | 1059 | // save everything |
1061 | - if ( $this->process_reg_step() ) { |
|
1060 | + if ($this->process_reg_step()) { |
|
1062 | 1061 | $this->checkout->redirect = TRUE; |
1063 | 1062 | $this->checkout->redirect_url = add_query_arg( |
1064 | 1063 | array( |
@@ -1067,7 +1066,7 @@ discard block |
||
1067 | 1066 | ), |
1068 | 1067 | $this->checkout->thank_you_page_url |
1069 | 1068 | ); |
1070 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1069 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1071 | 1070 | return TRUE; |
1072 | 1071 | } |
1073 | 1072 | return FALSE; |
@@ -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 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | class Registration_Form_Question_Groups_Admin_List_Table extends EE_Admin_List_Table { |
32 | 32 | |
33 | 33 | |
34 | - public function __construct( $admin_page ) { |
|
34 | + public function __construct($admin_page) { |
|
35 | 35 | parent::__construct($admin_page); |
36 | 36 | } |
37 | 37 | |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | |
40 | 40 | |
41 | 41 | protected function _setup_data() { |
42 | - $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_question_groups( $this->_per_page,$this->_current_page, FALSE ) : $this->_admin_page->get_trashed_question_groups( $this->_per_page,$this->_current_page, FALSE ); |
|
43 | - $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_question_groups( $this->_per_page,$this->_current_page, TRUE ) : $this->_admin_page->get_trashed_question_groups( $this->_per_page,$this->_current_page, TRUE ); |
|
42 | + $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, FALSE) : $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, FALSE); |
|
43 | + $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, TRUE) : $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, TRUE); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | |
50 | 50 | protected function _set_properties() { |
51 | 51 | $this->_wp_list_args = array( |
52 | - 'singular' => __('question group', 'event_espresso' ), |
|
53 | - 'plural' => __('question groups', 'event_espresso' ), |
|
52 | + 'singular' => __('question group', 'event_espresso'), |
|
53 | + 'plural' => __('question groups', 'event_espresso'), |
|
54 | 54 | 'ajax' => TRUE, //for now, |
55 | 55 | 'screen' => $this->_admin_page->get_current_screen()->id |
56 | 56 | ); |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | ); |
66 | 66 | |
67 | 67 | $this->_sortable_columns = array( |
68 | - 'id' => array( 'QSG_ID' => FALSE ), |
|
69 | - 'name' => array( 'QSG_name' => FALSE ) |
|
68 | + 'id' => array('QSG_ID' => FALSE), |
|
69 | + 'name' => array('QSG_name' => FALSE) |
|
70 | 70 | ); |
71 | 71 | |
72 | 72 | $this->_hidden_columns = array( |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | |
93 | 93 | |
94 | 94 | protected function _add_view_counts() { |
95 | - $this->_views['all']['count'] = $this->_admin_page->get_question_groups( $this->_per_page,$this->_current_page, TRUE ); |
|
96 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_group' ) ) { |
|
97 | - $this->_views['trash']['count'] = $this->_admin_page->get_trashed_question_groups( $this->_per_page,$this->_current_page, TRUE ); |
|
95 | + $this->_views['all']['count'] = $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, TRUE); |
|
96 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_group')) { |
|
97 | + $this->_views['trash']['count'] = $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, TRUE); |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $system_group = $item->get('QSG_system'); |
108 | 108 | $has_questions_with_answers = $item->has_questions_with_answers(); |
109 | 109 | $lock_icon = $system_group === 0 && $this->_view == 'trash' && $has_questions_with_answers ? 'ee-lock-icon ee-alternate-color' : 'ee-lock-icon ee-system-lock'; |
110 | - return $system_group > 0 || ( $system_group === 0 && $this->_view == 'trash' && $has_questions_with_answers ) || ! EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_groups', $item->ID() ) ? '<span class="' . $lock_icon . '"></span>' . sprintf( '<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', $item->ID() ) : sprintf( '<input type="checkbox" id="QSG_ID[%1$d]" name="checkbox[%1$d]" value="%1$d" />', $item->ID() ); |
|
110 | + return $system_group > 0 || ($system_group === 0 && $this->_view == 'trash' && $has_questions_with_answers) || ! EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_groups', $item->ID()) ? '<span class="'.$lock_icon.'"></span>'.sprintf('<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', $item->ID()) : sprintf('<input type="checkbox" id="QSG_ID[%1$d]" name="checkbox[%1$d]" value="%1$d" />', $item->ID()); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | public function column_id(EE_Question_Group $item) { |
119 | 119 | $content = $item->ID(); |
120 | - $content .= ' <span class="show-on-mobile-view-only">' .$item->name() . '</span>'; |
|
120 | + $content .= ' <span class="show-on-mobile-view-only">'.$item->name().'</span>'; |
|
121 | 121 | return $content; |
122 | 122 | } |
123 | 123 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $actions = array(); |
128 | 128 | |
129 | 129 | //return $item->name(); |
130 | - if ( !defined('REG_ADMIN_URL') ) |
|
130 | + if ( ! defined('REG_ADMIN_URL')) |
|
131 | 131 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
132 | 132 | |
133 | 133 | $edit_query_args = array( |
@@ -152,32 +152,32 @@ discard block |
||
152 | 152 | |
153 | 153 | |
154 | 154 | |
155 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EE_FORMS_ADMIN_URL ); |
|
156 | - $trash_link = EE_Admin_Page::add_query_args_and_nonce( $trash_query_args, EE_FORMS_ADMIN_URL ); |
|
157 | - $restore_link = EE_Admin_Page::add_query_args_and_nonce( $restore_query_args, EE_FORMS_ADMIN_URL ); |
|
158 | - $delete_link = EE_Admin_Page::add_query_args_and_nonce( $delete_query_args, EE_FORMS_ADMIN_URL ); |
|
155 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
|
156 | + $trash_link = EE_Admin_Page::add_query_args_and_nonce($trash_query_args, EE_FORMS_ADMIN_URL); |
|
157 | + $restore_link = EE_Admin_Page::add_query_args_and_nonce($restore_query_args, EE_FORMS_ADMIN_URL); |
|
158 | + $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_FORMS_ADMIN_URL); |
|
159 | 159 | |
160 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID() ) ) { |
|
160 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID())) { |
|
161 | 161 | $actions = array( |
162 | - 'edit' => '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Question Group', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>' |
|
162 | + 'edit' => '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Question Group', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>' |
|
163 | 163 | ); |
164 | 164 | } |
165 | - if ( $item->get('QSG_system') < 1 && $this->_view != 'trash' && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_group', 'espresso_registration_form_trash_question_group', $item->ID() ) ) { |
|
166 | - $actions['delete'] = '<a href="' . $trash_link . '" title="' . esc_attr__('Delete Question Group', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>'; |
|
165 | + if ($item->get('QSG_system') < 1 && $this->_view != 'trash' && EE_Registry::instance()->CAP->current_user_can('ee_delete_question_group', 'espresso_registration_form_trash_question_group', $item->ID())) { |
|
166 | + $actions['delete'] = '<a href="'.$trash_link.'" title="'.esc_attr__('Delete Question Group', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
167 | 167 | } |
168 | 168 | |
169 | - if ( $this->_view == 'trash' ) { |
|
169 | + if ($this->_view == 'trash') { |
|
170 | 170 | |
171 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_group', 'espresso_registration_form_restore_question_group', $item->ID() ) ) { |
|
172 | - $actions['restore'] = '<a href="' . $restore_link . '" title="' . esc_attr__('Restore Question Group', 'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>'; |
|
171 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_group', 'espresso_registration_form_restore_question_group', $item->ID())) { |
|
172 | + $actions['restore'] = '<a href="'.$restore_link.'" title="'.esc_attr__('Restore Question Group', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
173 | 173 | } |
174 | 174 | |
175 | - if ( !$item->has_questions_with_answers() && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_group', 'espresso_registration_form_delete_question_group', $item->ID() ) ) { |
|
176 | - $actions['delete'] = '<a href="' . $delete_link . '" title="' . esc_attr__('Delete Question Group Permanently', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
175 | + if ( ! $item->has_questions_with_answers() && EE_Registry::instance()->CAP->current_user_can('ee_delete_question_group', 'espresso_registration_form_delete_question_group', $item->ID())) { |
|
176 | + $actions['delete'] = '<a href="'.$delete_link.'" title="'.esc_attr__('Delete Question Group Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | - $content = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID() ) ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->name() . '</a></strong>' : $item->name(); |
|
180 | + $content = EE_Registry::instance()->CAP->current_user_can('ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID()) ? '<strong><a class="row-title" href="'.$edit_link.'">'.$item->name().'</a></strong>' : $item->name(); |
|
181 | 181 | $content .= $this->row_actions($actions); |
182 | 182 | return $content; |
183 | 183 | } |
@@ -198,13 +198,13 @@ discard block |
||
198 | 198 | |
199 | 199 | |
200 | 200 | public function column_show_group_name(EE_Question_Group $item) { |
201 | - return $this->_yes_no[ $item->show_group_name() ]; |
|
201 | + return $this->_yes_no[$item->show_group_name()]; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
205 | 205 | |
206 | 206 | public function column_show_group_desc(EE_Question_Group $item) { |
207 | - return $this->_yes_no[ $item->show_group_desc() ]; |
|
207 | + return $this->_yes_no[$item->show_group_desc()]; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | * @param WP $wp |
66 | 66 | * @return \EE_Request_Handler |
67 | 67 | */ |
68 | - public function __construct( $wp = null ) { |
|
68 | + public function __construct($wp = null) { |
|
69 | 69 | // grab request vars |
70 | 70 | $this->_params = $_REQUEST; |
71 | 71 | // AJAX ??? |
72 | - $this->ajax = defined( 'DOING_AJAX' ) ? true : false; |
|
73 | - $this->front_ajax = $this->is_set( 'ee_front_ajax' ) && $this->get( 'ee_front_ajax' ) == 1 ? true : false; |
|
74 | - do_action( 'AHEE__EE_Request_Handler__construct__complete' ); |
|
72 | + $this->ajax = defined('DOING_AJAX') ? true : false; |
|
73 | + $this->front_ajax = $this->is_set('ee_front_ajax') && $this->get('ee_front_ajax') == 1 ? true : false; |
|
74 | + do_action('AHEE__EE_Request_Handler__construct__complete'); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -83,12 +83,12 @@ discard block |
||
83 | 83 | * @param WP $wp |
84 | 84 | * @return void |
85 | 85 | */ |
86 | - public function parse_request( $wp = null ) { |
|
86 | + public function parse_request($wp = null) { |
|
87 | 87 | //if somebody forgot to provide us with WP, that's ok because its global |
88 | - if ( ! $wp instanceof WP ) { |
|
88 | + if ( ! $wp instanceof WP) { |
|
89 | 89 | global $wp; |
90 | 90 | } |
91 | - $this->set_request_vars( $wp ); |
|
91 | + $this->set_request_vars($wp); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | * @param WP $wp |
101 | 101 | * @return void |
102 | 102 | */ |
103 | - public function set_request_vars( $wp = null ) { |
|
104 | - if ( ! is_admin() ) { |
|
103 | + public function set_request_vars($wp = null) { |
|
104 | + if ( ! is_admin()) { |
|
105 | 105 | // set request post_id |
106 | - $this->set( 'post_id', $this->get_post_id_from_request( $wp )); |
|
106 | + $this->set('post_id', $this->get_post_id_from_request($wp)); |
|
107 | 107 | // set request post name |
108 | - $this->set( 'post_name', $this->get_post_name_from_request( $wp )); |
|
108 | + $this->set('post_name', $this->get_post_name_from_request($wp)); |
|
109 | 109 | // set request post_type |
110 | - $this->set( 'post_type', $this->get_post_type_from_request( $wp )); |
|
110 | + $this->set('post_type', $this->get_post_type_from_request($wp)); |
|
111 | 111 | // true or false ? is this page being used by EE ? |
112 | 112 | $this->set_espresso_page(); |
113 | 113 | } |
@@ -122,20 +122,20 @@ discard block |
||
122 | 122 | * @param WP $wp |
123 | 123 | * @return int |
124 | 124 | */ |
125 | - public function get_post_id_from_request( $wp = null ) { |
|
126 | - if ( ! $wp instanceof WP ){ |
|
125 | + public function get_post_id_from_request($wp = null) { |
|
126 | + if ( ! $wp instanceof WP) { |
|
127 | 127 | global $wp; |
128 | 128 | } |
129 | 129 | $post_id = null; |
130 | - if ( isset( $wp->query_vars['p'] )) { |
|
130 | + if (isset($wp->query_vars['p'])) { |
|
131 | 131 | $post_id = $wp->query_vars['p']; |
132 | 132 | } |
133 | - if ( ! $post_id && isset( $wp->query_vars['page_id'] )) { |
|
133 | + if ( ! $post_id && isset($wp->query_vars['page_id'])) { |
|
134 | 134 | $post_id = $wp->query_vars['page_id']; |
135 | 135 | } |
136 | - if ( ! $post_id && isset( $wp->request )) { |
|
137 | - if ( is_numeric( basename( $wp->request ))) { |
|
138 | - $post_id = basename( $wp->request ); |
|
136 | + if ( ! $post_id && isset($wp->request)) { |
|
137 | + if (is_numeric(basename($wp->request))) { |
|
138 | + $post_id = basename($wp->request); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | return $post_id; |
@@ -150,35 +150,35 @@ discard block |
||
150 | 150 | * @param WP $wp |
151 | 151 | * @return string |
152 | 152 | */ |
153 | - public function get_post_name_from_request( $wp = null ) { |
|
154 | - if ( ! $wp instanceof WP ){ |
|
153 | + public function get_post_name_from_request($wp = null) { |
|
154 | + if ( ! $wp instanceof WP) { |
|
155 | 155 | global $wp; |
156 | 156 | } |
157 | 157 | $post_name = null; |
158 | - if ( isset( $wp->query_vars['name'] ) && ! empty( $wp->query_vars['name'] )) { |
|
158 | + if (isset($wp->query_vars['name']) && ! empty($wp->query_vars['name'])) { |
|
159 | 159 | $post_name = $wp->query_vars['name']; |
160 | 160 | } |
161 | - if ( ! $post_name && isset( $wp->query_vars['pagename'] ) && ! empty( $wp->query_vars['pagename'] )) { |
|
161 | + if ( ! $post_name && isset($wp->query_vars['pagename']) && ! empty($wp->query_vars['pagename'])) { |
|
162 | 162 | $post_name = $wp->query_vars['pagename']; |
163 | 163 | } |
164 | - if ( ! $post_name && isset( $wp->request ) && ! empty( $wp->request )) { |
|
165 | - $possible_post_name = basename( $wp->request ); |
|
166 | - if ( ! is_numeric( $possible_post_name )) { |
|
164 | + if ( ! $post_name && isset($wp->request) && ! empty($wp->request)) { |
|
165 | + $possible_post_name = basename($wp->request); |
|
166 | + if ( ! is_numeric($possible_post_name)) { |
|
167 | 167 | /** @type WPDB $wpdb */ |
168 | 168 | global $wpdb; |
169 | 169 | $SQL = "SELECT ID from $wpdb->posts WHERE post_status='publish' AND post_name=%s"; |
170 | - $possible_post_name = $wpdb->get_var( $wpdb->prepare( $SQL, $possible_post_name )); |
|
171 | - if ( $possible_post_name ) { |
|
170 | + $possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $possible_post_name)); |
|
171 | + if ($possible_post_name) { |
|
172 | 172 | $post_name = $possible_post_name; |
173 | 173 | } |
174 | 174 | } |
175 | 175 | } |
176 | - if ( ! $post_name && $this->get( 'post_id' )) { |
|
176 | + if ( ! $post_name && $this->get('post_id')) { |
|
177 | 177 | /** @type WPDB $wpdb */ |
178 | 178 | global $wpdb; |
179 | 179 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_status='publish' AND ID=%d"; |
180 | - $possible_post_name = $wpdb->get_var( $wpdb->prepare( $SQL, $this->get( 'post_id' ))); |
|
181 | - if( $possible_post_name ) { |
|
180 | + $possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $this->get('post_id'))); |
|
181 | + if ($possible_post_name) { |
|
182 | 182 | $post_name = $possible_post_name; |
183 | 183 | } |
184 | 184 | } |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | * @param WP $wp |
195 | 195 | * @return mixed |
196 | 196 | */ |
197 | - public function get_post_type_from_request( $wp = null ) { |
|
198 | - if ( ! $wp instanceof WP ){ |
|
197 | + public function get_post_type_from_request($wp = null) { |
|
198 | + if ( ! $wp instanceof WP) { |
|
199 | 199 | global $wp; |
200 | 200 | } |
201 | - return isset( $wp->query_vars['post_type'] ) ? $wp->query_vars['post_type'] : null; |
|
201 | + return isset($wp->query_vars['post_type']) ? $wp->query_vars['post_type'] : null; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -208,18 +208,18 @@ discard block |
||
208 | 208 | * @param WP $wp |
209 | 209 | * @return bool|string|void |
210 | 210 | */ |
211 | - public function get_current_page_permalink( $wp = null ) { |
|
212 | - $post_id = $this->get_post_id_from_request( $wp ); |
|
213 | - if ( $post_id ) { |
|
214 | - $current_page_permalink = get_permalink( $post_id ); |
|
211 | + public function get_current_page_permalink($wp = null) { |
|
212 | + $post_id = $this->get_post_id_from_request($wp); |
|
213 | + if ($post_id) { |
|
214 | + $current_page_permalink = get_permalink($post_id); |
|
215 | 215 | } else { |
216 | - if ( ! $wp instanceof WP ) { |
|
216 | + if ( ! $wp instanceof WP) { |
|
217 | 217 | global $wp; |
218 | 218 | } |
219 | - if ( $wp->request ) { |
|
220 | - $current_page_permalink = site_url( $wp->request ); |
|
219 | + if ($wp->request) { |
|
220 | + $current_page_permalink = site_url($wp->request); |
|
221 | 221 | } else { |
222 | - $current_page_permalink = esc_url( site_url( $_SERVER[ 'REQUEST_URI' ] ) ); |
|
222 | + $current_page_permalink = esc_url(site_url($_SERVER['REQUEST_URI'])); |
|
223 | 223 | } |
224 | 224 | } |
225 | 225 | return $current_page_permalink; |
@@ -236,41 +236,41 @@ discard block |
||
236 | 236 | public function test_for_espresso_page() { |
237 | 237 | global $wp; |
238 | 238 | /** @type EE_CPT_Strategy $EE_CPT_Strategy */ |
239 | - $EE_CPT_Strategy = EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
239 | + $EE_CPT_Strategy = EE_Registry::instance()->load_core('CPT_Strategy'); |
|
240 | 240 | $espresso_CPT_taxonomies = $EE_CPT_Strategy->get_CPT_taxonomies(); |
241 | - if ( is_array( $espresso_CPT_taxonomies ) ) { |
|
242 | - foreach ( $espresso_CPT_taxonomies as $espresso_CPT_taxonomy =>$details ) { |
|
243 | - if ( isset( $wp->query_vars, $wp->query_vars[ $espresso_CPT_taxonomy ] ) ) { |
|
241 | + if (is_array($espresso_CPT_taxonomies)) { |
|
242 | + foreach ($espresso_CPT_taxonomies as $espresso_CPT_taxonomy =>$details) { |
|
243 | + if (isset($wp->query_vars, $wp->query_vars[$espresso_CPT_taxonomy])) { |
|
244 | 244 | return true; |
245 | 245 | } |
246 | 246 | } |
247 | 247 | } |
248 | 248 | // load espresso CPT endpoints |
249 | 249 | $espresso_CPT_endpoints = $EE_CPT_Strategy->get_CPT_endpoints(); |
250 | - $post_type_CPT_endpoints = array_flip( $espresso_CPT_endpoints ); |
|
251 | - $post_types = (array)$this->get( 'post_type' ); |
|
252 | - foreach ( $post_types as $post_type ) { |
|
250 | + $post_type_CPT_endpoints = array_flip($espresso_CPT_endpoints); |
|
251 | + $post_types = (array) $this->get('post_type'); |
|
252 | + foreach ($post_types as $post_type) { |
|
253 | 253 | // was a post name passed ? |
254 | - if ( isset( $post_type_CPT_endpoints[ $post_type ] ) ) { |
|
254 | + if (isset($post_type_CPT_endpoints[$post_type])) { |
|
255 | 255 | // kk we know this is an espresso page, but is it a specific post ? |
256 | - if ( ! $this->get( 'post_name' ) ) { |
|
256 | + if ( ! $this->get('post_name')) { |
|
257 | 257 | // there's no specific post name set, so maybe it's one of our endpoints like www.domain.com/events |
258 | - $post_name = isset( $post_type_CPT_endpoints[ $this->get( 'post_type' ) ] ) ? $post_type_CPT_endpoints[ $this->get( 'post_type' ) ] : null; |
|
258 | + $post_name = isset($post_type_CPT_endpoints[$this->get('post_type')]) ? $post_type_CPT_endpoints[$this->get('post_type')] : null; |
|
259 | 259 | // if the post type matches on of our then set the endpoint |
260 | - if ( $post_name ) { |
|
261 | - $this->set( 'post_name', $post_name ); |
|
260 | + if ($post_name) { |
|
261 | + $this->set('post_name', $post_name); |
|
262 | 262 | } |
263 | 263 | } |
264 | 264 | return true; |
265 | 265 | } |
266 | 266 | } |
267 | - if ( $this->get( 'post_name' )) { |
|
267 | + if ($this->get('post_name')) { |
|
268 | 268 | // load all pages using espresso shortcodes |
269 | - $post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
269 | + $post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
270 | 270 | // make sure core pages are included |
271 | - $espresso_pages = array_merge( $espresso_CPT_endpoints, $post_shortcodes ); |
|
271 | + $espresso_pages = array_merge($espresso_CPT_endpoints, $post_shortcodes); |
|
272 | 272 | // was a post name passed ? |
273 | - if ( isset( $espresso_pages[ $this->get( 'post_name' ) ] )) { |
|
273 | + if (isset($espresso_pages[$this->get('post_name')])) { |
|
274 | 274 | return true; |
275 | 275 | } |
276 | 276 | } |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * @param null $value |
287 | 287 | * @return mixed |
288 | 288 | */ |
289 | - public function set_espresso_page( $value = null ) { |
|
289 | + public function set_espresso_page($value = null) { |
|
290 | 290 | $value = $value ? $value : $this->test_for_espresso_page(); |
291 | 291 | $this->_params['is_espresso_page'] = $value; |
292 | 292 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @return mixed |
301 | 301 | */ |
302 | 302 | public function is_espresso_page() { |
303 | - return isset( $this->_params['is_espresso_page'] ) ? $this->_params['is_espresso_page'] : false; |
|
303 | + return isset($this->_params['is_espresso_page']) ? $this->_params['is_espresso_page'] : false; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | * @param bool $override_ee |
325 | 325 | * @return void |
326 | 326 | */ |
327 | - public function set( $key, $value, $override_ee = false ) { |
|
327 | + public function set($key, $value, $override_ee = false) { |
|
328 | 328 | // don't allow "ee" to be overwritten unless explicitly instructed to do so |
329 | - if ( $key != 'ee' || ( $key == 'ee' && empty( $this->_params['ee'] )) || ( $key == 'ee' && ! empty( $this->_params['ee'] ) && $override_ee )) { |
|
330 | - $this->_params[ $key ] = $value; |
|
329 | + if ($key != 'ee' || ($key == 'ee' && empty($this->_params['ee'])) || ($key == 'ee' && ! empty($this->_params['ee']) && $override_ee)) { |
|
330 | + $this->_params[$key] = $value; |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | * @param null $default |
342 | 342 | * @return mixed |
343 | 343 | */ |
344 | - public function get( $key, $default = null ) { |
|
345 | - return isset( $this->_params[ $key ] ) ? $this->_params[ $key ] : $default; |
|
344 | + public function get($key, $default = null) { |
|
345 | + return isset($this->_params[$key]) ? $this->_params[$key] : $default; |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | * @param $key |
355 | 355 | * @return boolean |
356 | 356 | */ |
357 | - public function is_set( $key ) { |
|
358 | - return isset( $this->_params[ $key ] ) ? true : false; |
|
357 | + public function is_set($key) { |
|
358 | + return isset($this->_params[$key]) ? true : false; |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | |
@@ -367,8 +367,8 @@ discard block |
||
367 | 367 | * @param $key |
368 | 368 | * @return void |
369 | 369 | */ |
370 | - public function un_set( $key ) { |
|
371 | - unset( $this->_params[ $key ] ); |
|
370 | + public function un_set($key) { |
|
371 | + unset($this->_params[$key]); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | |
@@ -381,8 +381,8 @@ discard block |
||
381 | 381 | * @param $value |
382 | 382 | * @return void |
383 | 383 | */ |
384 | - public function set_notice( $key, $value ) { |
|
385 | - $this->_notice[ $key ] = $value; |
|
384 | + public function set_notice($key, $value) { |
|
385 | + $this->_notice[$key] = $value; |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -394,8 +394,8 @@ discard block |
||
394 | 394 | * @param $key |
395 | 395 | * @return mixed |
396 | 396 | */ |
397 | - public function get_notice( $key ) { |
|
398 | - return isset( $this->_notice[ $key ] ) ? $this->_notice[ $key ] : null; |
|
397 | + public function get_notice($key) { |
|
398 | + return isset($this->_notice[$key]) ? $this->_notice[$key] : null; |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | * @param $string |
408 | 408 | * @return void |
409 | 409 | */ |
410 | - public function add_output( $string ) { |
|
410 | + public function add_output($string) { |
|
411 | 411 | $this->_output .= $string; |
412 | 412 | } |
413 | 413 | |
@@ -429,8 +429,8 @@ discard block |
||
429 | 429 | * @param $item |
430 | 430 | * @param $key |
431 | 431 | */ |
432 | - function sanitize_text_field_for_array_walk( &$item, &$key ) { |
|
433 | - $item = strpos( $item, 'email' ) !== false ? sanitize_email( $item ) : sanitize_text_field( $item ); |
|
432 | + function sanitize_text_field_for_array_walk(&$item, &$key) { |
|
433 | + $item = strpos($item, 'email') !== false ? sanitize_email($item) : sanitize_text_field($item); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | * @param $b |
441 | 441 | * @return bool |
442 | 442 | */ |
443 | - public function __set($a,$b) { return false; } |
|
443 | + public function __set($a, $b) { return false; } |
|
444 | 444 | |
445 | 445 | |
446 | 446 |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | */ |
37 | 37 | protected $_price_types = array(); |
38 | 38 | |
39 | - public function __construct( $admin_page ) { |
|
39 | + public function __construct($admin_page) { |
|
40 | 40 | parent::__construct($admin_page); |
41 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
41 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
42 | 42 | $this->_PRT = EEM_Price_Type::instance(); |
43 | 43 | $this->_price_types = $this->_PRT->get_all_deleted_and_undeleted(); |
44 | 44 | } |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | |
49 | 49 | protected function _setup_data() { |
50 | 50 | $trashed = $this->_admin_page->get_view() == 'trashed' ? true : false; |
51 | - $this->_data = $this->_admin_page->get_prices_overview_data( $this->_per_page, false, $trashed ); |
|
52 | - $this->_all_data_count = $this->_admin_page->get_prices_overview_data( $this->_per_page, true, false ); |
|
53 | - $this->_trashed_count = $this->_admin_page->get_prices_overview_data( $this->_per_page, true, true ); |
|
51 | + $this->_data = $this->_admin_page->get_prices_overview_data($this->_per_page, false, $trashed); |
|
52 | + $this->_all_data_count = $this->_admin_page->get_prices_overview_data($this->_per_page, true, false); |
|
53 | + $this->_trashed_count = $this->_admin_page->get_prices_overview_data($this->_per_page, true, true); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | |
75 | 75 | $this->_sortable_columns = array( |
76 | 76 | // true means its already sorted |
77 | - 'name' => array( 'name' => false ), |
|
78 | - 'type' => array( 'type' => false ), |
|
79 | - 'amount' => array( 'amount' => false ) |
|
77 | + 'name' => array('name' => false), |
|
78 | + 'type' => array('type' => false), |
|
79 | + 'amount' => array('amount' => false) |
|
80 | 80 | ); |
81 | 81 | |
82 | 82 | $this->_hidden_columns = array( |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | protected function _add_view_counts() { |
100 | 100 | $this->_views['all']['count'] = $this->_all_data_count; |
101 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price') ) { |
|
101 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) { |
|
102 | 102 | $this->_views['trashed']['count'] = $this->_trashed_count; |
103 | 103 | } |
104 | 104 | } |
@@ -112,16 +112,16 @@ discard block |
||
112 | 112 | * @param object $item the current item |
113 | 113 | * @return string |
114 | 114 | */ |
115 | - protected function _get_row_class( $item ) { |
|
115 | + protected function _get_row_class($item) { |
|
116 | 116 | static $row_class = ''; |
117 | - $row_class = ( $row_class == '' ? 'alternate' : '' ); |
|
117 | + $row_class = ($row_class == '' ? 'alternate' : ''); |
|
118 | 118 | |
119 | 119 | $new_row = $row_class; |
120 | 120 | |
121 | - if ( $item->type_obj()->base_type() !== 1 && $item->type_obj()->base_type() !== 4 ) |
|
121 | + if ($item->type_obj()->base_type() !== 1 && $item->type_obj()->base_type() !== 4) |
|
122 | 122 | $new_row .= ' rowsortable'; |
123 | 123 | |
124 | - return ' class="' . $new_row . '"'; |
|
124 | + return ' class="'.$new_row.'"'; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | |
132 | 132 | |
133 | 133 | function column_cb($item) { |
134 | - if ( $item->type_obj()->base_type() !== 1 ) |
|
135 | - return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', /* $1%s */ $item->ID() ); |
|
134 | + if ($item->type_obj()->base_type() !== 1) |
|
135 | + return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', /* $1%s */ $item->ID()); |
|
136 | 136 | return ''; |
137 | 137 | } |
138 | 138 | |
@@ -145,31 +145,31 @@ discard block |
||
145 | 145 | //Build row actions |
146 | 146 | $actions = array(); |
147 | 147 | // edit price link |
148 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_default_price', 'pricing_edit_price', $item->ID() ) ) { |
|
149 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_price', 'id'=>$item->ID() ), PRICING_ADMIN_URL ); |
|
150 | - $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Price', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>'; |
|
148 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_default_price', 'pricing_edit_price', $item->ID())) { |
|
149 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_price', 'id'=>$item->ID()), PRICING_ADMIN_URL); |
|
150 | + $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Price', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>'; |
|
151 | 151 | } |
152 | 152 | |
153 | - $name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_default_price', 'edit_price', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Price', 'event_espresso' ) . '">' . stripslashes( $item->name() ) . '</a>' : $item->name(); |
|
153 | + $name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_default_price', 'edit_price', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Price', 'event_espresso').'">'.stripslashes($item->name()).'</a>' : $item->name(); |
|
154 | 154 | |
155 | - if ( $item->type_obj()->base_type() !== 1 ) { |
|
155 | + if ($item->type_obj()->base_type() !== 1) { |
|
156 | 156 | if ($this->_view == 'all') { |
157 | 157 | // trash price link |
158 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_trash_price', $item->ID() ) ) { |
|
159 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_price', 'id'=>$item->ID(), 'noheader' => true ), PRICING_ADMIN_URL ); |
|
160 | - $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Move Price to Trash', 'event_espresso' ) . '">' . __( 'Move to Trash', 'event_espresso' ) . '</a>'; |
|
158 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_trash_price', $item->ID())) { |
|
159 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_price', 'id'=>$item->ID(), 'noheader' => true), PRICING_ADMIN_URL); |
|
160 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Move Price to Trash', 'event_espresso').'">'.__('Move to Trash', 'event_espresso').'</a>'; |
|
161 | 161 | } |
162 | 162 | } else { |
163 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_restore_price', $item->ID() ) ) { |
|
163 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_restore_price', $item->ID())) { |
|
164 | 164 | // restore price link |
165 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_price', 'id'=>$item->ID(), 'noheader' => true ), PRICING_ADMIN_URL ); |
|
166 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Price', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
165 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_price', 'id'=>$item->ID(), 'noheader' => true), PRICING_ADMIN_URL); |
|
166 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Price', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | // delete price link |
170 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price', 'pricing_delete_price', $item->ID() ) ) { |
|
171 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_price', 'id'=>$item->ID(), 'noheader' => true ), PRICING_ADMIN_URL ); |
|
172 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Price Permanently', 'event_espresso' ) . '">' . __( 'Delete Permanently', 'event_espresso' ) . '</a>'; |
|
170 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price', 'pricing_delete_price', $item->ID())) { |
|
171 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_price', 'id'=>$item->ID(), 'noheader' => true), PRICING_ADMIN_URL); |
|
172 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Price Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | return sprintf('%1$s <span style="color:silver">(id:%2$s)</span>%3$s', |
179 | 179 | /* $1%s */ $name_link, |
180 | 180 | /* $2%s */ $item->ID(), |
181 | - /* $3%s */ $this->row_actions( $actions ) |
|
181 | + /* $3%s */ $this->row_actions($actions) |
|
182 | 182 | ); |
183 | 183 | } |
184 | 184 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | |
196 | 196 | |
197 | 197 | function column_description($item) { |
198 | - return stripslashes( $item->desc() ); |
|
198 | + return stripslashes($item->desc()); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | |
205 | 205 | function column_amount($item) { |
206 | 206 | if ($this->_price_types[$item->type()]->is_percent()) { |
207 | - return '<div class="pad-amnt-rght">' . number_format($item->amount(), 1) . '%</div>'; |
|
207 | + return '<div class="pad-amnt-rght">'.number_format($item->amount(), 1).'%</div>'; |
|
208 | 208 | } else { |
209 | - return '<div class="pad-amnt-rght">' . EEH_Template::format_currency( $item->amount() ) . '</div>'; |
|
209 | + return '<div class="pad-amnt-rght">'.EEH_Template::format_currency($item->amount()).'</div>'; |
|
210 | 210 | } |
211 | 211 | } |
212 | 212 |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | * @param bool $routing |
32 | 32 | * @return Pricing_Admin_Page |
33 | 33 | */ |
34 | - public function __construct( $routing = TRUE ) { |
|
35 | - parent::__construct( $routing ); |
|
34 | + public function __construct($routing = TRUE) { |
|
35 | + parent::__construct($routing); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | protected function _ajax_hooks() { |
52 | - add_action('wp_ajax_espresso_update_prices_order', array( $this, 'update_price_order' )); |
|
52 | + add_action('wp_ajax_espresso_update_prices_order', array($this, 'update_price_order')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | protected function _set_page_routes() { |
85 | - $prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | - $prt_id = ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0; |
|
85 | + $prc_id = ! empty($this->_req_data['PRC_ID']) && ! is_array($this->_req_data['PRC_ID']) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | + $prt_id = ! empty($this->_req_data['PRT_ID']) && ! is_array($this->_req_data['PRT_ID']) ? $this->_req_data['PRT_ID'] : 0; |
|
87 | 87 | $this->_page_routes = array( |
88 | 88 | 'default' => array( |
89 | 89 | 'func' => '_price_overview_list_table', |
@@ -91,38 +91,38 @@ discard block |
||
91 | 91 | ), |
92 | 92 | 'add_new_price' => array( |
93 | 93 | 'func' => '_edit_price_details', |
94 | - 'args' => array( 'new_price' => TRUE ), |
|
94 | + 'args' => array('new_price' => TRUE), |
|
95 | 95 | 'capability' => 'ee_edit_default_prices' |
96 | 96 | ), |
97 | 97 | 'edit_price' => array( |
98 | 98 | 'func' => '_edit_price_details', |
99 | - 'args' => array( 'new_price' => FALSE ), |
|
99 | + 'args' => array('new_price' => FALSE), |
|
100 | 100 | 'capability' => 'ee_edit_default_price', |
101 | 101 | 'obj_id' => $prc_id |
102 | 102 | ), |
103 | 103 | 'insert_price' => array( |
104 | 104 | 'func' => '_insert_or_update_price', |
105 | - 'args' => array( 'new_price' => TRUE ), |
|
105 | + 'args' => array('new_price' => TRUE), |
|
106 | 106 | 'noheader' => TRUE, |
107 | 107 | 'capability' => 'ee_edit_default_prices', |
108 | 108 | ), |
109 | 109 | 'update_price' => array( |
110 | 110 | 'func' => '_insert_or_update_price', |
111 | - 'args' => array( 'new_price' => FALSE ), |
|
111 | + 'args' => array('new_price' => FALSE), |
|
112 | 112 | 'noheader' => TRUE, |
113 | 113 | 'capability' => 'ee_edit_default_price', |
114 | 114 | 'obj_id' => $prc_id |
115 | 115 | ), |
116 | 116 | 'trash_price' => array( |
117 | 117 | 'func' => '_trash_or_restore_price', |
118 | - 'args' => array( 'trash' => TRUE ), |
|
118 | + 'args' => array('trash' => TRUE), |
|
119 | 119 | 'noheader' => TRUE, |
120 | 120 | 'capability' => 'ee_delete_default_price', |
121 | 121 | 'obj_id' => $prc_id |
122 | 122 | ), |
123 | 123 | 'restore_price' => array( |
124 | 124 | 'func' => '_trash_or_restore_price', |
125 | - 'args' => array( 'trash' => FALSE ), |
|
125 | + 'args' => array('trash' => FALSE), |
|
126 | 126 | 'noheader' => TRUE, |
127 | 127 | 'capability' => 'ee_delete_default_price', |
128 | 128 | 'obj_id' => $prc_id |
@@ -154,27 +154,27 @@ discard block |
||
154 | 154 | ), |
155 | 155 | 'insert_price_type' => array( |
156 | 156 | 'func' => '_insert_or_update_price_type', |
157 | - 'args' => array( 'new_price_type' => TRUE ), |
|
157 | + 'args' => array('new_price_type' => TRUE), |
|
158 | 158 | 'noheader' => TRUE, |
159 | 159 | 'capability' => 'ee_edit_default_price_types' |
160 | 160 | ), |
161 | 161 | 'update_price_type' => array( |
162 | 162 | 'func' => '_insert_or_update_price_type', |
163 | - 'args' => array( 'new_price_type' => FALSE ), |
|
163 | + 'args' => array('new_price_type' => FALSE), |
|
164 | 164 | 'noheader' => TRUE, |
165 | 165 | 'capability' => 'ee_edit_default_price_type', |
166 | 166 | 'obj_id' => $prt_id |
167 | 167 | ), |
168 | 168 | 'trash_price_type' => array( |
169 | 169 | 'func' => '_trash_or_restore_price_type', |
170 | - 'args' => array( 'trash' => TRUE ), |
|
170 | + 'args' => array('trash' => TRUE), |
|
171 | 171 | 'noheader' => TRUE, |
172 | 172 | 'capability' => 'ee_delete_default_price_type', |
173 | 173 | 'obj_id' => $prt_id |
174 | 174 | ), |
175 | 175 | 'restore_price_type' => array( |
176 | 176 | 'func' => '_trash_or_restore_price_type', |
177 | - 'args' => array( 'trash' => FALSE ), |
|
177 | + 'args' => array('trash' => FALSE), |
|
178 | 178 | 'noheader' => TRUE, |
179 | 179 | 'capability' => 'ee_delete_default_price_type', |
180 | 180 | 'obj_id' => $prt_id |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | 'filename' => 'pricing_default_pricing_views_bulk_actions_search' |
215 | 215 | ) |
216 | 216 | ), |
217 | - 'help_tour' => array( 'Pricing_Default_Prices_Help_Tour'), |
|
217 | + 'help_tour' => array('Pricing_Default_Prices_Help_Tour'), |
|
218 | 218 | 'require_nonce' => FALSE |
219 | 219 | ), |
220 | 220 | 'add_new_price' => array( |
@@ -230,24 +230,24 @@ discard block |
||
230 | 230 | ) |
231 | 231 | ), |
232 | 232 | 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
233 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
233 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
234 | 234 | 'require_nonce' => FALSE |
235 | 235 | ), |
236 | 236 | 'edit_price' => array( |
237 | 237 | 'nav' => array( |
238 | 238 | 'label' => __('Edit Default Price', 'event_espresso'), |
239 | 239 | 'order' => 20, |
240 | - 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
240 | + 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
241 | 241 | 'persistent' => FALSE |
242 | 242 | ), |
243 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
243 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
244 | 244 | 'help_tabs' => array( |
245 | 245 | 'edit_default_price_help_tab' => array( |
246 | 246 | 'title' => __('Edit Default Price', 'event_espresso'), |
247 | 247 | 'filename' => 'pricing_edit_default_price' |
248 | 248 | ) |
249 | 249 | ), |
250 | - 'help_tour' => array( 'Pricing_Edit_Default_Price_Help_Tour' ), |
|
250 | + 'help_tour' => array('Pricing_Edit_Default_Price_Help_Tour'), |
|
251 | 251 | 'require_nonce' => FALSE |
252 | 252 | ), |
253 | 253 | 'price_types' => array( |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | 'filename' => 'pricing_price_types_views_bulk_actions_search' |
271 | 271 | ), |
272 | 272 | ), |
273 | - 'help_tour' => array( 'Pricing_Price_Types_Default_Help_Tour' ), |
|
273 | + 'help_tour' => array('Pricing_Price_Types_Default_Help_Tour'), |
|
274 | 274 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
275 | 275 | 'require_nonce' => FALSE |
276 | 276 | ), |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | 'filename' => 'pricing_add_new_price_type' |
287 | 287 | ) |
288 | 288 | ), |
289 | - 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
290 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
289 | + 'help_tour' => array('Pricing_Add_New_Price_Type_Help_Tour'), |
|
290 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
291 | 291 | 'require_nonce' => FALSE |
292 | 292 | ), |
293 | 293 | 'edit_price_type' => array( |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | 'filename' => 'pricing_edit_price_type' |
303 | 303 | ) |
304 | 304 | ), |
305 | - 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
306 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
305 | + 'help_tour' => array('Pricing_Edit_Price_Type_Help_Tour'), |
|
306 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
307 | 307 | |
308 | 308 | 'require_nonce' => FALSE |
309 | 309 | ) |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | public function load_scripts_styles() { |
341 | 341 | //styles |
342 | 342 | wp_enqueue_style('espresso-ui-theme'); |
343 | - wp_register_style( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
343 | + wp_register_style('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
344 | 344 | wp_enqueue_style('espresso_PRICING'); |
345 | 345 | |
346 | 346 | //scripts |
@@ -350,8 +350,8 @@ discard block |
||
350 | 350 | //wp_enqueue_script('jquery-ui-dialog'); |
351 | 351 | //wp_enqueue_script('jquery-ui-draggable'); |
352 | 352 | //wp_enqueue_script('jquery-ui-datepicker'); |
353 | - wp_register_script( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
354 | - wp_enqueue_script( 'espresso_PRICING' ); |
|
353 | + wp_register_script('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
354 | + wp_enqueue_script('espresso_PRICING'); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | |
360 | 360 | |
361 | 361 | public function load_scripts_styles_default() { |
362 | - wp_enqueue_script( 'espresso_ajax_table_sorting' ); |
|
362 | + wp_enqueue_script('espresso_ajax_table_sorting'); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | ) |
388 | 388 | ); |
389 | 389 | |
390 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price' ) ) { |
|
390 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) { |
|
391 | 391 | $this->_views['trashed'] = array( |
392 | 392 | 'slug' => 'trashed', |
393 | 393 | 'label' => __('Trash', 'event_espresso'), |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | ) |
418 | 418 | ); |
419 | 419 | |
420 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price_types', 'pricing_trash_price_type' ) ) { |
|
420 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price_types', 'pricing_trash_price_type')) { |
|
421 | 421 | $this->_views['trashed'] = array( |
422 | 422 | 'slug' => 'trashed', |
423 | 423 | 'label' => __('Trash', 'event_espresso'), |
@@ -456,18 +456,18 @@ discard block |
||
456 | 456 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
457 | 457 | * @return mixed (int|array) int = count || array of price objects |
458 | 458 | */ |
459 | - public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
459 | + public function get_prices_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
460 | 460 | |
461 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
461 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
462 | 462 | // start with an empty array |
463 | 463 | $event_pricing = array(); |
464 | 464 | |
465 | - require_once( PRICING_ADMIN . 'Prices_List_Table.class.php' ); |
|
466 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
465 | + require_once(PRICING_ADMIN.'Prices_List_Table.class.php'); |
|
466 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
467 | 467 | //$PRC = EEM_Price::instance(); |
468 | 468 | |
469 | 469 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
470 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
470 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
471 | 471 | |
472 | 472 | switch ($this->_req_data['orderby']) { |
473 | 473 | case 'name': |
@@ -480,27 +480,27 @@ discard block |
||
480 | 480 | $orderby = array('PRC_amount'=>$order); |
481 | 481 | break; |
482 | 482 | default: |
483 | - $orderby = array( 'PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
483 | + $orderby = array('PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
484 | 484 | } |
485 | 485 | |
486 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
487 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
486 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
487 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
488 | 488 | |
489 | 489 | $_where = array( |
490 | 490 | 'PRC_is_default' => 1, |
491 | 491 | 'PRC_deleted' => $trashed |
492 | 492 | ); |
493 | 493 | |
494 | - $offset = ($current_page-1)*$per_page; |
|
495 | - $limit = array( $offset, $per_page ); |
|
494 | + $offset = ($current_page - 1) * $per_page; |
|
495 | + $limit = array($offset, $per_page); |
|
496 | 496 | |
497 | - if ( isset( $this->_req_data['s'] ) ) { |
|
498 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
497 | + if (isset($this->_req_data['s'])) { |
|
498 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
499 | 499 | $_where['OR'] = array( |
500 | - 'PRC_name' => array('LIKE',$sstr ), |
|
501 | - 'PRC_desc' => array('LIKE',$sstr ), |
|
502 | - 'PRC_amount' => array( 'LIKE',$sstr ), |
|
503 | - 'Price_Type.PRT_name' => array( 'LIKE', $sstr ) |
|
500 | + 'PRC_name' => array('LIKE', $sstr), |
|
501 | + 'PRC_desc' => array('LIKE', $sstr), |
|
502 | + 'PRC_amount' => array('LIKE', $sstr), |
|
503 | + 'Price_Type.PRT_name' => array('LIKE', $sstr) |
|
504 | 504 | ); |
505 | 505 | } |
506 | 506 | |
@@ -511,9 +511,9 @@ discard block |
||
511 | 511 | 'group_by'=>'PRC_ID' |
512 | 512 | ); |
513 | 513 | |
514 | - if($count){ |
|
515 | - return $trashed ? EEM_Price::instance()->count( array( $_where ) ) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
516 | - }else{ |
|
514 | + if ($count) { |
|
515 | + return $trashed ? EEM_Price::instance()->count(array($_where)) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
516 | + } else { |
|
517 | 517 | return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params); |
518 | 518 | } |
519 | 519 | } |
@@ -529,40 +529,40 @@ discard block |
||
529 | 529 | * @return void |
530 | 530 | */ |
531 | 531 | protected function _edit_price_details() { |
532 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
532 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
533 | 533 | // grab price ID |
534 | - $PRC_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
534 | + $PRC_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
535 | 535 | // change page title based on request action |
536 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
536 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
537 | 537 | // add PRC_ID to title if editing |
538 | - $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title . ' # ' . $PRC_ID : $this->_admin_page_title; |
|
538 | + $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title.' # '.$PRC_ID : $this->_admin_page_title; |
|
539 | 539 | |
540 | 540 | // get prices |
541 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
541 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
542 | 542 | $PRC = EEM_Price::instance(); |
543 | 543 | |
544 | - if ( $PRC_ID ) { |
|
545 | - $price = $PRC->get_one_by_ID( $PRC_ID ); |
|
544 | + if ($PRC_ID) { |
|
545 | + $price = $PRC->get_one_by_ID($PRC_ID); |
|
546 | 546 | $additional_hidden_fields = array( |
547 | - 'PRC_ID' => array( 'type' => 'hidden', 'value' => $PRC_ID ) |
|
547 | + 'PRC_ID' => array('type' => 'hidden', 'value' => $PRC_ID) |
|
548 | 548 | ); |
549 | - $this->_set_add_edit_form_tags( 'update_price', $additional_hidden_fields ); |
|
549 | + $this->_set_add_edit_form_tags('update_price', $additional_hidden_fields); |
|
550 | 550 | } else { |
551 | 551 | $price = $PRC->get_new_price(); |
552 | - $this->_set_add_edit_form_tags( 'insert_price' ); |
|
552 | + $this->_set_add_edit_form_tags('insert_price'); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | $this->_template_args['PRC_ID'] = $PRC_ID; |
556 | 556 | $this->_template_args['price'] = $price; |
557 | 557 | |
558 | 558 | // get price types |
559 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
559 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
560 | 560 | $PRT = EEM_Price_Type::instance(); |
561 | - $price_types = $PRT->get_all( array( array('PBT_ID' => array('!=', 1 ) ) ) ); |
|
561 | + $price_types = $PRT->get_all(array(array('PBT_ID' => array('!=', 1)))); |
|
562 | 562 | $price_type_names = array(); |
563 | 563 | if (empty($price_types)) { |
564 | - $msg = __( 'You have no price types defined. Please add a price type before adding a price.', 'event_espresso' ); |
|
565 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
564 | + $msg = __('You have no price types defined. Please add a price type before adding a price.', 'event_espresso'); |
|
565 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
566 | 566 | exit(); |
567 | 567 | } else { |
568 | 568 | foreach ($price_types as $type) { |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | $this->_template_args['price_types'] = $price_type_names; |
576 | 576 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
577 | 577 | |
578 | - $this->_set_publish_post_box_vars( 'id', $PRC_ID ); |
|
578 | + $this->_set_publish_post_box_vars('id', $PRC_ID); |
|
579 | 579 | // the details template wrapper |
580 | 580 | $this->display_admin_page_with_sidebar(); |
581 | 581 | } |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | * @return void |
592 | 592 | */ |
593 | 593 | protected function _price_details_meta_boxes() { |
594 | - add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
594 | + add_meta_box('edit-price-details-mbox', __('Default Price Details', 'event_espresso'), array($this, '_edit_price_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
595 | 595 | } |
596 | 596 | |
597 | 597 | |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | * @return void |
606 | 606 | */ |
607 | 607 | public function _edit_price_details_meta_box() { |
608 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
608 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
609 | 609 | } |
610 | 610 | |
611 | 611 | |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | */ |
620 | 620 | protected function set_price_column_values() { |
621 | 621 | |
622 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
622 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
623 | 623 | |
624 | 624 | $set_column_values = array( |
625 | 625 | 'PRT_ID' => absint($this->_req_data['PRT_ID']), |
@@ -647,12 +647,12 @@ discard block |
||
647 | 647 | * @access protected |
648 | 648 | * @return void |
649 | 649 | */ |
650 | - protected function _insert_or_update_price( $insert = FALSE ) { |
|
650 | + protected function _insert_or_update_price($insert = FALSE) { |
|
651 | 651 | |
652 | 652 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
653 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
653 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
654 | 654 | |
655 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
655 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
656 | 656 | $PRC = EEM_Price::instance(); |
657 | 657 | |
658 | 658 | // why be so pessimistic ??? : ( |
@@ -660,14 +660,14 @@ discard block |
||
660 | 660 | |
661 | 661 | $set_column_values = $this->set_price_column_values(); |
662 | 662 | // is this a new Price ? |
663 | - if ( $insert ) { |
|
663 | + if ($insert) { |
|
664 | 664 | // run the insert |
665 | - if ( $PRC_ID = $PRC->insert( $set_column_values )) { |
|
665 | + if ($PRC_ID = $PRC->insert($set_column_values)) { |
|
666 | 666 | //make sure this new price modifier is attached to the ticket but ONLY if it is not a tax type |
667 | 667 | $PR = EEM_price::instance()->get_one_by_ID($PRC_ID); |
668 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
668 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
669 | 669 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
670 | - $ticket->_add_relation_to( $PR, 'Price' ); |
|
670 | + $ticket->_add_relation_to($PR, 'Price'); |
|
671 | 671 | $ticket->save(); |
672 | 672 | } |
673 | 673 | $success = 1; |
@@ -677,29 +677,29 @@ discard block |
||
677 | 677 | } |
678 | 678 | $action_desc = 'created'; |
679 | 679 | } else { |
680 | - $PRC_ID = absint( $this->_req_data['PRC_ID'] ); |
|
680 | + $PRC_ID = absint($this->_req_data['PRC_ID']); |
|
681 | 681 | // run the update |
682 | - $where_cols_n_values = array( 'PRC_ID' => $PRC_ID ); |
|
683 | - if ( $PRC->update( $set_column_values, array($where_cols_n_values))) { |
|
682 | + $where_cols_n_values = array('PRC_ID' => $PRC_ID); |
|
683 | + if ($PRC->update($set_column_values, array($where_cols_n_values))) { |
|
684 | 684 | $success = 1; |
685 | 685 | } |
686 | 686 | |
687 | 687 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
688 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
688 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
689 | 689 | |
690 | 690 | //if this is $PRC_ID == 1, then we need to update the default ticket attached to this price so the TKT_price value is updated. |
691 | - if ( $PRC_ID === 1 ) { |
|
691 | + if ($PRC_ID === 1) { |
|
692 | 692 | $ticket = $PR->get_first_related('Ticket'); |
693 | - if ( $ticket ) { |
|
694 | - $ticket->set('TKT_price', $PR->get('PRC_amount') ); |
|
695 | - $ticket->set('TKT_name', $PR->get('PRC_name') ); |
|
693 | + if ($ticket) { |
|
694 | + $ticket->set('TKT_price', $PR->get('PRC_amount')); |
|
695 | + $ticket->set('TKT_name', $PR->get('PRC_name')); |
|
696 | 696 | $ticket->set('TKT_description', $PR->get('PRC_desc')); |
697 | 697 | $ticket->save(); |
698 | 698 | } |
699 | 699 | } else { |
700 | 700 | //we make sure this price is attached to base ticket. but ONLY if its not a tax ticket type. |
701 | 701 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
702 | - $ticket->_add_relation_to( $PRC_ID, 'Price' ); |
|
702 | + $ticket->_add_relation_to($PRC_ID, 'Price'); |
|
703 | 703 | $ticket->save(); |
704 | 704 | } |
705 | 705 | } |
@@ -707,9 +707,9 @@ discard block |
||
707 | 707 | $action_desc = 'updated'; |
708 | 708 | } |
709 | 709 | |
710 | - $query_args = array( 'action' => 'edit_price', 'id' => $PRC_ID ); |
|
710 | + $query_args = array('action' => 'edit_price', 'id' => $PRC_ID); |
|
711 | 711 | |
712 | - $this->_redirect_after_action( $success, 'Prices', $action_desc, $query_args ); |
|
712 | + $this->_redirect_after_action($success, 'Prices', $action_desc, $query_args); |
|
713 | 713 | |
714 | 714 | } |
715 | 715 | |
@@ -723,12 +723,12 @@ discard block |
||
723 | 723 | * @access protected |
724 | 724 | * @return void |
725 | 725 | */ |
726 | - protected function _trash_or_restore_price( $trash = TRUE ) { |
|
726 | + protected function _trash_or_restore_price($trash = TRUE) { |
|
727 | 727 | |
728 | 728 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
729 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
729 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
730 | 730 | |
731 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
731 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
732 | 732 | $PRC = EEM_Price::instance(); |
733 | 733 | |
734 | 734 | $success = 1; |
@@ -737,18 +737,18 @@ discard block |
||
737 | 737 | //get base ticket for updating |
738 | 738 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
739 | 739 | //Checkboxes |
740 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
740 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
741 | 741 | // if array has more than one element than success message should be plural |
742 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
742 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
743 | 743 | // cycle thru checkboxes |
744 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
745 | - if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID) ) ) { |
|
744 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
745 | + if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) { |
|
746 | 746 | $success = 0; |
747 | 747 | } else { |
748 | 748 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
749 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
749 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
750 | 750 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
751 | - if ( $PRC_deleted ) { |
|
751 | + if ($PRC_deleted) { |
|
752 | 752 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
753 | 753 | } else { |
754 | 754 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -760,14 +760,14 @@ discard block |
||
760 | 760 | |
761 | 761 | } else { |
762 | 762 | // grab single id and delete |
763 | - $PRC_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
764 | - if ( empty( $PRC_ID ) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID) ) { |
|
763 | + $PRC_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
764 | + if (empty($PRC_ID) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID)) { |
|
765 | 765 | $success = 0; |
766 | 766 | } else { |
767 | 767 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
768 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
768 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
769 | 769 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
770 | - if ( $PRC_deleted ) { |
|
770 | + if ($PRC_deleted) { |
|
771 | 771 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
772 | 772 | } else { |
773 | 773 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -781,17 +781,17 @@ discard block |
||
781 | 781 | 'action' => 'default' |
782 | 782 | ); |
783 | 783 | |
784 | - if ( $success ) { |
|
785 | - if ( $trash ) { |
|
784 | + if ($success) { |
|
785 | + if ($trash) { |
|
786 | 786 | $msg = $success == 2 ? __('The Prices have been trashed.', 'event_espresso') : __('The Price has been trashed.', 'event_espresso'); |
787 | 787 | } else { |
788 | 788 | $msg = $success == 2 ? __('The Prices have been restored.', 'event_espresso') : __('The Price has been restored.', 'event_espresso'); |
789 | 789 | } |
790 | 790 | |
791 | - EE_Error::add_success( $msg ); |
|
791 | + EE_Error::add_success($msg); |
|
792 | 792 | } |
793 | 793 | |
794 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
794 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
795 | 795 | |
796 | 796 | } |
797 | 797 | |
@@ -808,19 +808,19 @@ discard block |
||
808 | 808 | protected function _delete_price() { |
809 | 809 | |
810 | 810 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
811 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
811 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
812 | 812 | |
813 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
813 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
814 | 814 | $PRC = EEM_Price::instance(); |
815 | 815 | |
816 | 816 | $success = 1; |
817 | 817 | //Checkboxes |
818 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
818 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
819 | 819 | // if array has more than one element than success message should be plural |
820 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
820 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
821 | 821 | // cycle thru bulk action checkboxes |
822 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
823 | - if (!$PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
822 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
823 | + if ( ! $PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
824 | 824 | $success = 0; |
825 | 825 | } |
826 | 826 | } |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | |
835 | 835 | } |
836 | 836 | |
837 | - $this->_redirect_after_action( $success, 'Prices', 'deleted', array() ); |
|
837 | + $this->_redirect_after_action($success, 'Prices', 'deleted', array()); |
|
838 | 838 | |
839 | 839 | } |
840 | 840 | |
@@ -842,16 +842,16 @@ discard block |
||
842 | 842 | |
843 | 843 | |
844 | 844 | public function update_price_order() { |
845 | - $success = __( 'Price order was updated successfully.', 'event_espresso' ); |
|
845 | + $success = __('Price order was updated successfully.', 'event_espresso'); |
|
846 | 846 | |
847 | 847 | // grab our row IDs |
848 | - $row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE; |
|
848 | + $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE; |
|
849 | 849 | |
850 | - if ( is_array( $row_ids )) { |
|
851 | - for ( $i = 0; $i < count( $row_ids ); $i++ ) { |
|
850 | + if (is_array($row_ids)) { |
|
851 | + for ($i = 0; $i < count($row_ids); $i++) { |
|
852 | 852 | //Update the prices when re-ordering |
853 | 853 | $id = absint($row_ids[$i]); |
854 | - if ( EEM_Price::instance()->update ( array( 'PRC_order' => $i+1 ), array(array( 'PRC_ID' => $id ) )) === FALSE ) { |
|
854 | + if (EEM_Price::instance()->update(array('PRC_order' => $i + 1), array(array('PRC_ID' => $id))) === FALSE) { |
|
855 | 855 | $success = FALSE; |
856 | 856 | } |
857 | 857 | } |
@@ -859,9 +859,9 @@ discard block |
||
859 | 859 | $success = FALSE; |
860 | 860 | } |
861 | 861 | |
862 | - $errors = ! $success ? __( 'An error occurred. The price order was not updated.', 'event_espresso' ) : FALSE; |
|
862 | + $errors = ! $success ? __('An error occurred. The price order was not updated.', 'event_espresso') : FALSE; |
|
863 | 863 | |
864 | - echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors )); |
|
864 | + echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors)); |
|
865 | 865 | die(); |
866 | 866 | } |
867 | 867 | |
@@ -904,46 +904,46 @@ discard block |
||
904 | 904 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
905 | 905 | * @return mixed (int|array) int = count || array of price objects |
906 | 906 | */ |
907 | - public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
907 | + public function get_price_types_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
908 | 908 | |
909 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
909 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
910 | 910 | // start with an empty array |
911 | 911 | |
912 | - require_once( PRICING_ADMIN . 'Price_Types_List_Table.class.php' ); |
|
913 | - require_once( EE_MODELS . 'EEM_Price_Type.model.php' ); |
|
912 | + require_once(PRICING_ADMIN.'Price_Types_List_Table.class.php'); |
|
913 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
914 | 914 | |
915 | 915 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
916 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
916 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
917 | 917 | switch ($this->_req_data['orderby']) { |
918 | 918 | case 'name': |
919 | - $orderby = array( 'PRT_name' => $order); |
|
919 | + $orderby = array('PRT_name' => $order); |
|
920 | 920 | break; |
921 | 921 | default: |
922 | - $orderby = array( 'PRT_order' => $order); |
|
922 | + $orderby = array('PRT_order' => $order); |
|
923 | 923 | } |
924 | 924 | |
925 | 925 | |
926 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
927 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
926 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
927 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
928 | 928 | |
929 | - $offset = ($current_page-1)*$per_page; |
|
930 | - $limit = array( $offset, $per_page ); |
|
929 | + $offset = ($current_page - 1) * $per_page; |
|
930 | + $limit = array($offset, $per_page); |
|
931 | 931 | |
932 | - $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1 ) ); |
|
932 | + $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1)); |
|
933 | 933 | |
934 | - if ( isset( $this->_req_data['s'] ) ) { |
|
935 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
934 | + if (isset($this->_req_data['s'])) { |
|
935 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
936 | 936 | $_where['OR'] = array( |
937 | - 'PRT_name' => array( 'LIKE', $sstr ) |
|
937 | + 'PRT_name' => array('LIKE', $sstr) |
|
938 | 938 | ); |
939 | 939 | } |
940 | 940 | $query_params = array( |
941 | 941 | $_where, |
942 | 942 | 'order_by'=>$orderby, |
943 | 943 | 'limit'=>$limit); |
944 | - if($count){ |
|
944 | + if ($count) { |
|
945 | 945 | return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params); |
946 | - }else{ |
|
946 | + } else { |
|
947 | 947 | return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params); |
948 | 948 | } |
949 | 949 | |
@@ -963,25 +963,25 @@ discard block |
||
963 | 963 | */ |
964 | 964 | protected function _edit_price_type_details() { |
965 | 965 | |
966 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
966 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
967 | 967 | |
968 | 968 | |
969 | 969 | // grab price type ID |
970 | - $PRT_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
970 | + $PRT_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
971 | 971 | // change page title based on request action |
972 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
972 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
973 | 973 | // add PRT_ID to title if editing |
974 | - $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title . ' # ' . $PRT_ID : $this->_admin_page_title; |
|
974 | + $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title.' # '.$PRT_ID : $this->_admin_page_title; |
|
975 | 975 | |
976 | 976 | // require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
977 | 977 | |
978 | - if ( $PRT_ID ) { |
|
979 | - $price_type = EEM_Price_Type::instance()->get_one_by_ID( $PRT_ID ); |
|
980 | - $additional_hidden_fields = array( 'PRT_ID' => array( 'type' => 'hidden', 'value' => $PRT_ID )); |
|
981 | - $this->_set_add_edit_form_tags( 'update_price_type', $additional_hidden_fields ); |
|
978 | + if ($PRT_ID) { |
|
979 | + $price_type = EEM_Price_Type::instance()->get_one_by_ID($PRT_ID); |
|
980 | + $additional_hidden_fields = array('PRT_ID' => array('type' => 'hidden', 'value' => $PRT_ID)); |
|
981 | + $this->_set_add_edit_form_tags('update_price_type', $additional_hidden_fields); |
|
982 | 982 | } else { |
983 | 983 | $price_type = EEM_Price_Type::instance()->get_new_price_type(); |
984 | - $this->_set_add_edit_form_tags( 'insert_price_type' ); |
|
984 | + $this->_set_add_edit_form_tags('insert_price_type'); |
|
985 | 985 | } |
986 | 986 | |
987 | 987 | $this->_template_args['PRT_ID'] = $PRT_ID; |
@@ -990,19 +990,19 @@ discard block |
||
990 | 990 | |
991 | 991 | $base_types = EEM_Price_Type::instance()->get_base_types(); |
992 | 992 | $select_values = array(); |
993 | - foreach ( $base_types as $ref => $text ) { |
|
994 | - if ( $ref == EEM_Price_Type::base_type_base_price ) { |
|
993 | + foreach ($base_types as $ref => $text) { |
|
994 | + if ($ref == EEM_Price_Type::base_type_base_price) { |
|
995 | 995 | //do not allow creation of base_type_base_prices because that's a system only base type. |
996 | 996 | continue; |
997 | 997 | } |
998 | - $values[] = array( 'id' => $ref, 'text' => $text ); |
|
998 | + $values[] = array('id' => $ref, 'text' => $text); |
|
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | |
1002 | 1002 | $this->_template_args['base_type_select'] = EEH_Form_Fields::select_input('base_type', $values, $price_type->base_type(), 'id="price-type-base-type-slct"'); |
1003 | 1003 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
1004 | - $redirect_URL = add_query_arg( array( 'action' => 'price_types'), $this->_admin_base_url ); |
|
1005 | - $this->_set_publish_post_box_vars( 'id', $PRT_ID, FALSE, $redirect_URL ); |
|
1004 | + $redirect_URL = add_query_arg(array('action' => 'price_types'), $this->_admin_base_url); |
|
1005 | + $this->_set_publish_post_box_vars('id', $PRT_ID, FALSE, $redirect_URL); |
|
1006 | 1006 | // the details template wrapper |
1007 | 1007 | $this->display_admin_page_with_sidebar(); |
1008 | 1008 | |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | * @return void |
1020 | 1020 | */ |
1021 | 1021 | protected function _price_type_details_meta_boxes() { |
1022 | - add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1022 | + add_meta_box('edit-price-details-mbox', __('Price Type Details', 'event_espresso'), array($this, '_edit_price_type_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1023 | 1023 | } |
1024 | 1024 | |
1025 | 1025 | |
@@ -1032,7 +1032,7 @@ discard block |
||
1032 | 1032 | * @return void |
1033 | 1033 | */ |
1034 | 1034 | public function _edit_price_type_details_meta_box() { |
1035 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
1035 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
1036 | 1036 | } |
1037 | 1037 | |
1038 | 1038 | |
@@ -1045,9 +1045,9 @@ discard block |
||
1045 | 1045 | */ |
1046 | 1046 | protected function set_price_type_column_values() { |
1047 | 1047 | |
1048 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1048 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1049 | 1049 | |
1050 | - $base_type = !empty( $this->_req_data['base_type'] ) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1050 | + $base_type = ! empty($this->_req_data['base_type']) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1051 | 1051 | |
1052 | 1052 | switch ($base_type) { |
1053 | 1053 | |
@@ -1094,12 +1094,12 @@ discard block |
||
1094 | 1094 | * @access protected |
1095 | 1095 | * @return void |
1096 | 1096 | */ |
1097 | - protected function _insert_or_update_price_type( $new_price_type = FALSE ) { |
|
1097 | + protected function _insert_or_update_price_type($new_price_type = FALSE) { |
|
1098 | 1098 | |
1099 | 1099 | // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1100 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1100 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1101 | 1101 | |
1102 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1102 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1103 | 1103 | $PRT = EEM_Price_Type::instance(); |
1104 | 1104 | |
1105 | 1105 | // why be so pessimistic ??? : ( |
@@ -1107,24 +1107,24 @@ discard block |
||
1107 | 1107 | |
1108 | 1108 | $set_column_values = $this->set_price_type_column_values(); |
1109 | 1109 | // is this a new Price ? |
1110 | - if ( $new_price_type ) { |
|
1110 | + if ($new_price_type) { |
|
1111 | 1111 | // run the insert |
1112 | - if ( $PRT_ID = $PRT->insert( $set_column_values )) { |
|
1112 | + if ($PRT_ID = $PRT->insert($set_column_values)) { |
|
1113 | 1113 | $success = 1; |
1114 | 1114 | } |
1115 | 1115 | $action_desc = 'created'; |
1116 | 1116 | } else { |
1117 | 1117 | $PRT_ID = absint($this->_req_data['PRT_ID']); |
1118 | 1118 | // run the update |
1119 | - $where_cols_n_values = array('PRT_ID' => $PRT_ID ); |
|
1120 | - if ( $PRT->update( $set_column_values, array( $where_cols_n_values ))) { |
|
1119 | + $where_cols_n_values = array('PRT_ID' => $PRT_ID); |
|
1120 | + if ($PRT->update($set_column_values, array($where_cols_n_values))) { |
|
1121 | 1121 | $success = 1; |
1122 | 1122 | } |
1123 | 1123 | $action_desc = 'updated'; |
1124 | 1124 | } |
1125 | 1125 | |
1126 | - $query_args = array( 'action'=> 'edit_price_type', 'id' => $PRT_ID ); |
|
1127 | - $this->_redirect_after_action( $success, 'Price Type', $action_desc, $query_args ); |
|
1126 | + $query_args = array('action'=> 'edit_price_type', 'id' => $PRT_ID); |
|
1127 | + $this->_redirect_after_action($success, 'Price Type', $action_desc, $query_args); |
|
1128 | 1128 | |
1129 | 1129 | } |
1130 | 1130 | |
@@ -1138,49 +1138,49 @@ discard block |
||
1138 | 1138 | * @access protected |
1139 | 1139 | * @return void |
1140 | 1140 | */ |
1141 | - protected function _trash_or_restore_price_type( $trash = TRUE ) { |
|
1141 | + protected function _trash_or_restore_price_type($trash = TRUE) { |
|
1142 | 1142 | |
1143 | 1143 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1144 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1144 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1145 | 1145 | |
1146 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1146 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1147 | 1147 | $PRT = EEM_Price_Type::instance(); |
1148 | 1148 | |
1149 | 1149 | $success = 1; |
1150 | 1150 | $PRT_deleted = $trash ? TRUE : FALSE; |
1151 | 1151 | //Checkboxes |
1152 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1152 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1153 | 1153 | // if array has more than one element than success message should be plural |
1154 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1155 | - $what = count( $this->_req_data['checkbox'] ) > 1 ? 'Price Types' : 'Price Type'; |
|
1154 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1155 | + $what = count($this->_req_data['checkbox']) > 1 ? 'Price Types' : 'Price Type'; |
|
1156 | 1156 | // cycle thru checkboxes |
1157 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1158 | - if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID ) ) { |
|
1157 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1158 | + if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1159 | 1159 | $success = 0; |
1160 | 1160 | } |
1161 | 1161 | } |
1162 | 1162 | |
1163 | 1163 | } else { |
1164 | 1164 | // grab single id and delete |
1165 | - $PRT_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
1166 | - if ( empty( $PRT_ID ) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID )) { |
|
1165 | + $PRT_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
1166 | + if (empty($PRT_ID) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1167 | 1167 | $success = 0; |
1168 | 1168 | } |
1169 | 1169 | $what = 'Price Type'; |
1170 | 1170 | |
1171 | 1171 | } |
1172 | 1172 | |
1173 | - $query_args = array( 'action' => 'price_types' ); |
|
1174 | - if ( $success ) { |
|
1175 | - if ( $trash ) { |
|
1173 | + $query_args = array('action' => 'price_types'); |
|
1174 | + if ($success) { |
|
1175 | + if ($trash) { |
|
1176 | 1176 | $msg = $success > 1 ? __('The Price Types have been trashed.', 'event_espresso') : __('The Price Type has been trashed.', 'event_espresso'); |
1177 | 1177 | } else { |
1178 | 1178 | $msg = $success > 1 ? __('The Price Types have been restored.', 'event_espresso') : __('The Price Type has been restored.', 'event_espresso'); |
1179 | 1179 | } |
1180 | - EE_Error::add_success( $msg ); |
|
1180 | + EE_Error::add_success($msg); |
|
1181 | 1181 | } |
1182 | 1182 | |
1183 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
1183 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
1184 | 1184 | |
1185 | 1185 | } |
1186 | 1186 | |
@@ -1197,19 +1197,19 @@ discard block |
||
1197 | 1197 | protected function _delete_price_type() { |
1198 | 1198 | |
1199 | 1199 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1200 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1200 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1201 | 1201 | |
1202 | 1202 | $PRT = EEM_Price_Type::instance(); |
1203 | 1203 | |
1204 | 1204 | $success = 1; |
1205 | 1205 | //Checkboxes |
1206 | - if (!empty($this->_req_data['checkbox'])) { |
|
1206 | + if ( ! empty($this->_req_data['checkbox'])) { |
|
1207 | 1207 | // if array has more than one element than success message should be plural |
1208 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1208 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1209 | 1209 | $what = $PRT->item_name($success); |
1210 | 1210 | // cycle thru bulk action checkboxes |
1211 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1212 | - if (!$PRT->delete_permanently_by_ID($PRT_ID) ) { |
|
1211 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1212 | + if ( ! $PRT->delete_permanently_by_ID($PRT_ID)) { |
|
1213 | 1213 | $success = 0; |
1214 | 1214 | } |
1215 | 1215 | } |
@@ -1217,8 +1217,8 @@ discard block |
||
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | |
1220 | - $query_args = array( 'action'=> 'price_types' ); |
|
1221 | - $this->_redirect_after_action( $success, $what, 'deleted', $query_args ); |
|
1220 | + $query_args = array('action'=> 'price_types'); |
|
1221 | + $this->_redirect_after_action($success, $what, 'deleted', $query_args); |
|
1222 | 1222 | |
1223 | 1223 | } |
1224 | 1224 | |
@@ -1234,7 +1234,7 @@ discard block |
||
1234 | 1234 | * @return string |
1235 | 1235 | */ |
1236 | 1236 | protected function _learn_more_about_pricing_link() { |
1237 | - return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>'; |
|
1237 | + return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how pricing works', 'event_espresso').'</a>'; |
|
1238 | 1238 | } |
1239 | 1239 | |
1240 | 1240 |
@@ -1,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,13 +30,13 @@ discard block |
||
30 | 30 | |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( $routing = TRUE ) { |
|
34 | - define( 'REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND . 'registration_form' . DS ); |
|
35 | - define( 'REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN . 'assets' . DS ); |
|
36 | - define( 'REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/assets/' ); |
|
37 | - define( 'REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN . 'templates' . DS ); |
|
38 | - define( 'REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/templates/' ); |
|
39 | - parent::__construct( $routing ); |
|
33 | + public function __construct($routing = TRUE) { |
|
34 | + define('REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND.'registration_form'.DS); |
|
35 | + define('REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN.'assets'.DS); |
|
36 | + define('REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/assets/'); |
|
37 | + define('REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN.'templates'.DS); |
|
38 | + define('REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/templates/'); |
|
39 | + parent::__construct($routing); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | |
47 | 47 | protected function _extend_page_config() { |
48 | 48 | $this->_admin_base_path = REGISTRATION_FORM_CAF_ADMIN; |
49 | - $qst_id = ! empty( $this->_req_data['QST_ID'] ) && ! is_array( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0; |
|
50 | - $qsg_id = ! empty( $this->_req_data['QSG_ID'] ) && ! is_array( $this->_req_data['QSG_ID'] ) ? $this->_req_data['QSG_ID'] : 0; |
|
49 | + $qst_id = ! empty($this->_req_data['QST_ID']) && ! is_array($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0; |
|
50 | + $qsg_id = ! empty($this->_req_data['QSG_ID']) && ! is_array($this->_req_data['QSG_ID']) ? $this->_req_data['QSG_ID'] : 0; |
|
51 | 51 | |
52 | 52 | $new_page_routes = array( |
53 | 53 | 'question_groups' => array( |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | 'func' => '_trash_or_restore_questions', |
81 | 81 | 'capability' => 'ee_delete_question', |
82 | 82 | 'obj_id' => $qst_id, |
83 | - 'args' => array( 'trash' => FALSE ), |
|
83 | + 'args' => array('trash' => FALSE), |
|
84 | 84 | 'noheader' => TRUE |
85 | 85 | ), |
86 | 86 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | 'trash_question_group' => array( |
141 | 141 | 'func' => '_trash_or_restore_question_groups', |
142 | - 'args' => array( 'trash' => TRUE ), |
|
142 | + 'args' => array('trash' => TRUE), |
|
143 | 143 | 'capability' => 'ee_delete_question_group', |
144 | 144 | 'obj_id' => $qsg_id, |
145 | 145 | 'noheader' => TRUE |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | |
148 | 148 | 'restore_question_group' => array( |
149 | 149 | 'func' => '_trash_or_restore_question_groups', |
150 | - 'args' => array( 'trash' => FALSE ), |
|
150 | + 'args' => array('trash' => FALSE), |
|
151 | 151 | 'capability' => 'ee_delete_question_group', |
152 | 152 | 'obj_id' => $qsg_id, |
153 | 153 | 'noheader' => TRUE |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | 'update_question_group' => array( |
164 | 164 | 'func' => '_insert_or_update_question_group', |
165 | - 'args' => array('new_question_group' => FALSE ), |
|
165 | + 'args' => array('new_question_group' => FALSE), |
|
166 | 166 | 'capability' => 'ee_edit_question_group', |
167 | 167 | 'obj_id' => $qsg_id, |
168 | 168 | 'noheader' => TRUE, |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | 'noheader' => TRUE |
201 | 201 | ), |
202 | 202 | ); |
203 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
203 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
204 | 204 | |
205 | 205 | $new_page_config = array( |
206 | 206 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | 'filename' => 'registration_form_question_groups_views_bulk_actions_search' |
225 | 225 | ), |
226 | 226 | ), |
227 | - 'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'), |
|
227 | + 'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'), |
|
228 | 228 | 'metaboxes' => $this->_default_espresso_metaboxes, |
229 | 229 | 'require_nonce' => FALSE, |
230 | 230 | 'qtips' => array( |
@@ -238,14 +238,14 @@ discard block |
||
238 | 238 | 'order' => 5, |
239 | 239 | 'persistent' => FALSE |
240 | 240 | ), |
241 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
241 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
242 | 242 | 'help_tabs' => array( |
243 | 243 | 'registration_form_add_question_help_tab' => array( |
244 | 244 | 'title' => __('Add Question', 'event_espresso'), |
245 | 245 | 'filename' => 'registration_form_add_question' |
246 | 246 | ), |
247 | 247 | ), |
248 | - 'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'), |
|
248 | + 'help_tour' => array('Registration_Form_Add_Question_Help_Tour'), |
|
249 | 249 | 'require_nonce' => FALSE |
250 | 250 | ), |
251 | 251 | |
@@ -255,14 +255,14 @@ discard block |
||
255 | 255 | 'order' => 5, |
256 | 256 | 'persistent' => FALSE |
257 | 257 | ), |
258 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
258 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
259 | 259 | 'help_tabs' => array( |
260 | 260 | 'registration_form_add_question_group_help_tab' => array( |
261 | 261 | 'title' => __('Add Question Group', 'event_espresso'), |
262 | 262 | 'filename' => 'registration_form_add_question_group' |
263 | 263 | ), |
264 | 264 | ), |
265 | - 'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'), |
|
265 | + 'help_tour' => array('Registration_Form_Add_Question_Group_Help_Tour'), |
|
266 | 266 | 'require_nonce' => FALSE |
267 | 267 | ), |
268 | 268 | |
@@ -271,16 +271,16 @@ discard block |
||
271 | 271 | 'label' => __('Edit Question Group', 'event_espresso'), |
272 | 272 | 'order' => 5, |
273 | 273 | 'persistent' => FALSE, |
274 | - 'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(array('question_group_id' => $this->_req_data['question_group_id'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
274 | + 'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(array('question_group_id' => $this->_req_data['question_group_id']), $this->_current_page_view_url) : $this->_admin_base_url |
|
275 | 275 | ), |
276 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
276 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
277 | 277 | 'help_tabs' => array( |
278 | 278 | 'registration_form_edit_question_group_help_tab' => array( |
279 | 279 | 'title' => __('Edit Question Group', 'event_espresso'), |
280 | 280 | 'filename' => 'registration_form_edit_question_group' |
281 | 281 | ), |
282 | 282 | ), |
283 | - 'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'), |
|
283 | + 'help_tour' => array('Registration_Form_Edit_Question_Group_Help_Tour'), |
|
284 | 284 | 'require_nonce' => FALSE |
285 | 285 | ), |
286 | 286 | |
@@ -292,19 +292,19 @@ discard block |
||
292 | 292 | 'labels' => array( |
293 | 293 | 'publishbox' => __('Update Settings', 'event_espresso') |
294 | 294 | ), |
295 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
295 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
296 | 296 | 'help_tabs' => array( |
297 | 297 | 'registration_form_reg_form_settings_help_tab' => array( |
298 | 298 | 'title' => __('Registration Form Settings', 'event_espresso'), |
299 | 299 | 'filename' => 'registration_form_reg_form_settings' |
300 | 300 | ), |
301 | 301 | ), |
302 | - 'help_tour' => array( 'Registration_Form_Settings_Help_Tour'), |
|
302 | + 'help_tour' => array('Registration_Form_Settings_Help_Tour'), |
|
303 | 303 | 'require_nonce' => FALSE |
304 | 304 | ) |
305 | 305 | |
306 | 306 | ); |
307 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
307 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
308 | 308 | |
309 | 309 | //change the list table we're going to use so it's the NEW list table! |
310 | 310 | $this->_page_config['default']['list_table'] = 'Extend_Registration_Form_Questions_Admin_List_Table'; |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | 'edit_question_group' => __('Edit Question Group', 'event_espresso'), |
319 | 319 | 'delete_question_group' => __('Delete Question Group', 'event_espresso'), |
320 | 320 | ); |
321 | - $this->_labels['buttons'] = array_merge( $this->_labels['buttons'], $new_labels ); |
|
321 | + $this->_labels['buttons'] = array_merge($this->_labels['buttons'], $new_labels); |
|
322 | 322 | |
323 | 323 | } |
324 | 324 | |
@@ -327,14 +327,14 @@ discard block |
||
327 | 327 | |
328 | 328 | |
329 | 329 | protected function _ajax_hooks() { |
330 | - add_action('wp_ajax_espresso_update_question_group_order', array( $this, 'update_question_group_order' )); |
|
330 | + add_action('wp_ajax_espresso_update_question_group_order', array($this, 'update_question_group_order')); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | |
334 | 334 | |
335 | 335 | |
336 | 336 | public function load_scripts_styles_question_groups() { |
337 | - wp_enqueue_script( 'espresso_ajax_table_sorting' ); |
|
337 | + wp_enqueue_script('espresso_ajax_table_sorting'); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | * @return void |
356 | 356 | */ |
357 | 357 | public function load_sortable_question_script() { |
358 | - wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL . 'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true); |
|
358 | + wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL.'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true); |
|
359 | 359 | wp_enqueue_script('ee-question-sortable'); |
360 | 360 | } |
361 | 361 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | ) |
375 | 375 | ); |
376 | 376 | |
377 | - if ( EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) { |
|
377 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) { |
|
378 | 378 | $this->_views['trash'] = array( |
379 | 379 | 'slug' => 'trash', |
380 | 380 | 'label' => __('Trash', 'event_espresso'), |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | ) |
405 | 405 | ); |
406 | 406 | |
407 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_groups' ) ) { |
|
407 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_groups')) { |
|
408 | 408 | $this->_views['trash'] = array( |
409 | 409 | 'slug' => 'trash', |
410 | 410 | 'label' => __('Trash', 'event_espresso'), |
@@ -440,24 +440,24 @@ discard block |
||
440 | 440 | |
441 | 441 | |
442 | 442 | |
443 | - protected function _delete_question(){ |
|
444 | - $success = $this->_delete_items( $this->_question_model ); |
|
443 | + protected function _delete_question() { |
|
444 | + $success = $this->_delete_items($this->_question_model); |
|
445 | 445 | $this->_redirect_after_action( |
446 | 446 | $success, |
447 | - $this->_question_model->item_name( $success ), |
|
447 | + $this->_question_model->item_name($success), |
|
448 | 448 | 'deleted', |
449 | - array( 'action' => 'default', 'status' => 'all' ) |
|
449 | + array('action' => 'default', 'status' => 'all') |
|
450 | 450 | ); |
451 | 451 | } |
452 | 452 | |
453 | 453 | |
454 | 454 | protected function _delete_questions() { |
455 | - $success = $this->_delete_items( $this->_question_model ); |
|
455 | + $success = $this->_delete_items($this->_question_model); |
|
456 | 456 | $this->_redirect_after_action( |
457 | 457 | $success, |
458 | - $this->_question_model->item_name( $success ), |
|
458 | + $this->_question_model->item_name($success), |
|
459 | 459 | 'deleted permanently', |
460 | - array( 'action' => 'default', 'status' => 'trash' ) |
|
460 | + array('action' => 'default', 'status' => 'trash') |
|
461 | 461 | ); |
462 | 462 | } |
463 | 463 | |
@@ -468,26 +468,26 @@ discard block |
||
468 | 468 | * @param EEM_Soft_Delete_Base $model |
469 | 469 | * @return int number of items deleted permanently |
470 | 470 | */ |
471 | - private function _delete_items(EEM_Soft_Delete_Base $model){ |
|
471 | + private function _delete_items(EEM_Soft_Delete_Base $model) { |
|
472 | 472 | $success = 0; |
473 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
474 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
473 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
474 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
475 | 475 | // if array has more than one element than success message should be plural |
476 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
476 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
477 | 477 | // cycle thru bulk action checkboxes |
478 | - while (list( $ID, $value ) = each($this->_req_data['checkbox'])) { |
|
479 | - if ( ! $this->_delete_item( $ID, $model ) ) { |
|
478 | + while (list($ID, $value) = each($this->_req_data['checkbox'])) { |
|
479 | + if ( ! $this->_delete_item($ID, $model)) { |
|
480 | 480 | $success = 0; |
481 | 481 | } |
482 | 482 | } |
483 | 483 | |
484 | - }elseif( !empty($this->_req_data['QSG_ID'])){ |
|
485 | - $success = $this->_delete_item( $this->_req_data['QSG_ID'], $model ); |
|
484 | + }elseif ( ! empty($this->_req_data['QSG_ID'])) { |
|
485 | + $success = $this->_delete_item($this->_req_data['QSG_ID'], $model); |
|
486 | 486 | |
487 | - }elseif( !empty($this->_req_data['QST_ID'])){ |
|
488 | - $success = $this->_delete_item( $this->_req_data['QST_ID'], $model ); |
|
489 | - }else{ |
|
490 | - EE_Error::add_error( sprintf(__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__ ); |
|
487 | + }elseif ( ! empty($this->_req_data['QST_ID'])) { |
|
488 | + $success = $this->_delete_item($this->_req_data['QST_ID'], $model); |
|
489 | + } else { |
|
490 | + EE_Error::add_error(sprintf(__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__); |
|
491 | 491 | } |
492 | 492 | return $success; |
493 | 493 | } |
@@ -498,11 +498,11 @@ discard block |
||
498 | 498 | * @param EEM_Soft_Delete_Base $model |
499 | 499 | * @return boolean |
500 | 500 | */ |
501 | - protected function _delete_item( $id, $model ) { |
|
502 | - if( $model instanceof EEM_Question ) { |
|
503 | - EEM_Question_Option::instance()->delete_permanently( array( array( 'QST_ID' => absint( $id ) ) ) ); |
|
501 | + protected function _delete_item($id, $model) { |
|
502 | + if ($model instanceof EEM_Question) { |
|
503 | + EEM_Question_Option::instance()->delete_permanently(array(array('QST_ID' => absint($id)))); |
|
504 | 504 | } |
505 | - return $model->delete_permanently_by_ID( absint( $id ) ); |
|
505 | + return $model->delete_permanently_by_ID(absint($id)); |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | |
@@ -514,29 +514,29 @@ discard block |
||
514 | 514 | |
515 | 515 | |
516 | 516 | |
517 | - protected function _edit_question_group( $type = 'add' ) { |
|
518 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
519 | - $ID=isset( $this->_req_data['QSG_ID'] ) && ! empty( $this->_req_data['QSG_ID'] ) ? absint( $this->_req_data['QSG_ID'] ) : FALSE; |
|
520 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
517 | + protected function _edit_question_group($type = 'add') { |
|
518 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
519 | + $ID = isset($this->_req_data['QSG_ID']) && ! empty($this->_req_data['QSG_ID']) ? absint($this->_req_data['QSG_ID']) : FALSE; |
|
520 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
521 | 521 | // add ID to title if editing |
522 | - $this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title; |
|
523 | - if($ID){ |
|
524 | - $questionGroup=$this->_question_group_model->get_one_by_ID($ID); |
|
525 | - $additional_hidden_fields=array('QSG_ID'=>array('type'=>'hidden','value'=>$ID)); |
|
522 | + $this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title; |
|
523 | + if ($ID) { |
|
524 | + $questionGroup = $this->_question_group_model->get_one_by_ID($ID); |
|
525 | + $additional_hidden_fields = array('QSG_ID'=>array('type'=>'hidden', 'value'=>$ID)); |
|
526 | 526 | $this->_set_add_edit_form_tags('update_question_group', $additional_hidden_fields); |
527 | - }else{ |
|
527 | + } else { |
|
528 | 528 | $questionGroup = EEM_Question_Group::instance()->create_default_object(); |
529 | 529 | $questionGroup->set_order_to_latest(); |
530 | 530 | $this->_set_add_edit_form_tags('insert_question_group'); |
531 | 531 | } |
532 | 532 | $this->_template_args['values'] = $this->_yes_no_values; |
533 | - $this->_template_args['all_questions']=$questionGroup->questions_in_and_not_in_group(); |
|
534 | - $this->_template_args['QSG_ID']=$ID ? $ID : TRUE; |
|
535 | - $this->_template_args['question_group']=$questionGroup; |
|
533 | + $this->_template_args['all_questions'] = $questionGroup->questions_in_and_not_in_group(); |
|
534 | + $this->_template_args['QSG_ID'] = $ID ? $ID : TRUE; |
|
535 | + $this->_template_args['question_group'] = $questionGroup; |
|
536 | 536 | |
537 | - $redirect_URL = add_query_arg( array( 'action' => 'question_groups'), $this->_admin_base_url ); |
|
538 | - $this->_set_publish_post_box_vars( 'id', $ID, FALSE, $redirect_URL ); |
|
539 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'question_groups_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
537 | + $redirect_URL = add_query_arg(array('action' => 'question_groups'), $this->_admin_base_url); |
|
538 | + $this->_set_publish_post_box_vars('id', $ID, FALSE, $redirect_URL); |
|
539 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_CAF_TEMPLATE_PATH.'question_groups_main_meta_box.template.php', $this->_template_args, TRUE); |
|
540 | 540 | |
541 | 541 | // the details template wrapper |
542 | 542 | $this->display_admin_page_with_sidebar(); |
@@ -547,76 +547,76 @@ discard block |
||
547 | 547 | |
548 | 548 | protected function _delete_question_groups() { |
549 | 549 | $success = $this->_delete_items($this->_question_group_model); |
550 | - $this->_redirect_after_action( $success, $this->_question_group_model->item_name($success), 'deleted permanently', array( 'action'=>'question_groups', 'status'=>'trash' )); |
|
550 | + $this->_redirect_after_action($success, $this->_question_group_model->item_name($success), 'deleted permanently', array('action'=>'question_groups', 'status'=>'trash')); |
|
551 | 551 | } |
552 | 552 | |
553 | 553 | |
554 | 554 | |
555 | - protected function _insert_or_update_question_group( $new_question_group = TRUE) { |
|
556 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
557 | - $set_column_values=$this->_set_column_values_for($this->_question_group_model); |
|
558 | - if ( $new_question_group ){ |
|
555 | + protected function _insert_or_update_question_group($new_question_group = TRUE) { |
|
556 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
557 | + $set_column_values = $this->_set_column_values_for($this->_question_group_model); |
|
558 | + if ($new_question_group) { |
|
559 | 559 | $QSG_ID = $this->_question_group_model->insert($set_column_values); |
560 | 560 | $success = $QSG_ID ? 1 : 0; |
561 | 561 | } else { |
562 | 562 | $QSG_ID = absint($this->_req_data['QSG_ID']); |
563 | - unset( $set_column_values[ 'QSG_ID' ] ); |
|
564 | - $success= $this->_question_group_model->update( $set_column_values, array( array( 'QSG_ID' => $QSG_ID ))); |
|
563 | + unset($set_column_values['QSG_ID']); |
|
564 | + $success = $this->_question_group_model->update($set_column_values, array(array('QSG_ID' => $QSG_ID))); |
|
565 | 565 | } |
566 | - $phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string( EEM_Attendee::system_question_phone ); |
|
566 | + $phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string(EEM_Attendee::system_question_phone); |
|
567 | 567 | // update the existing related questions |
568 | 568 | // BUT FIRST... delete the phone question from the Question_Group_Question if it is being added to this question group (therefore removed from the existing group) |
569 | - if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $phone_question_id ] )) { |
|
569 | + if (isset($this->_req_data['questions'], $this->_req_data['questions'][$phone_question_id])) { |
|
570 | 570 | // delete where QST ID = system phone question ID and Question Group ID is NOT this group |
571 | - EEM_Question_Group_Question::instance()->delete( array( array( 'QST_ID' => $phone_question_id, 'QSG_ID' => array( '!=', $QSG_ID )))); |
|
571 | + EEM_Question_Group_Question::instance()->delete(array(array('QST_ID' => $phone_question_id, 'QSG_ID' => array('!=', $QSG_ID)))); |
|
572 | 572 | } |
573 | 573 | /** @type EE_Question_Group $question_group */ |
574 | - $question_group=$this->_question_group_model->get_one_by_ID( $QSG_ID ); |
|
574 | + $question_group = $this->_question_group_model->get_one_by_ID($QSG_ID); |
|
575 | 575 | $questions = $question_group->questions(); |
576 | 576 | // make sure system phone question is added to list of questions for this group |
577 | - if ( ! isset( $questions[$phone_question_id ] )) { |
|
578 | - $questions[ $phone_question_id ] = EEM_Question::instance()->get_one_by_ID( $phone_question_id ); |
|
577 | + if ( ! isset($questions[$phone_question_id])) { |
|
578 | + $questions[$phone_question_id] = EEM_Question::instance()->get_one_by_ID($phone_question_id); |
|
579 | 579 | } |
580 | 580 | |
581 | - foreach( $questions as $question_ID => $question ){ |
|
581 | + foreach ($questions as $question_ID => $question) { |
|
582 | 582 | // first we always check for order. |
583 | - if ( ! empty( $this->_req_data['question_orders'][ $question_ID ] ) ){ |
|
583 | + if ( ! empty($this->_req_data['question_orders'][$question_ID])) { |
|
584 | 584 | //update question order |
585 | - $question_group->update_question_order( $question_ID, $this->_req_data['question_orders'][ $question_ID ] ); |
|
585 | + $question_group->update_question_order($question_ID, $this->_req_data['question_orders'][$question_ID]); |
|
586 | 586 | } |
587 | 587 | |
588 | 588 | // then we always check if adding or removing. |
589 | - if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $question_ID ] )) { |
|
590 | - $question_group->add_question( $question_ID ); |
|
589 | + if (isset($this->_req_data['questions'], $this->_req_data['questions'][$question_ID])) { |
|
590 | + $question_group->add_question($question_ID); |
|
591 | 591 | } else { |
592 | 592 | // not found, remove it (but only if not a system question for the personal group with the exception of lname system question - we allow removal of it) |
593 | 593 | if ( |
594 | 594 | in_array( |
595 | 595 | $question->system_ID(), |
596 | - EEM_Question::instance()->required_system_questions_in_system_question_group( $question_group->system_group() ) |
|
596 | + EEM_Question::instance()->required_system_questions_in_system_question_group($question_group->system_group()) |
|
597 | 597 | ) |
598 | 598 | ) { |
599 | 599 | continue; |
600 | 600 | } else { |
601 | - $question_group->remove_question( $question_ID ); |
|
601 | + $question_group->remove_question($question_ID); |
|
602 | 602 | } |
603 | 603 | } |
604 | 604 | } |
605 | 605 | // save new related questions |
606 | - if ( isset( $this->_req_data['questions'] )) { |
|
607 | - foreach( $this->_req_data['questions'] as $QST_ID ){ |
|
608 | - $question_group->add_question( $QST_ID ); |
|
609 | - if ( isset( $this->_req_data['question_orders'][ $QST_ID ] )) { |
|
610 | - $question_group->update_question_order( $QST_ID, $this->_req_data['question_orders'][ $QST_ID ] ); |
|
606 | + if (isset($this->_req_data['questions'])) { |
|
607 | + foreach ($this->_req_data['questions'] as $QST_ID) { |
|
608 | + $question_group->add_question($QST_ID); |
|
609 | + if (isset($this->_req_data['question_orders'][$QST_ID])) { |
|
610 | + $question_group->update_question_order($QST_ID, $this->_req_data['question_orders'][$QST_ID]); |
|
611 | 611 | } |
612 | 612 | } |
613 | 613 | } |
614 | 614 | |
615 | - if ( $success !== FALSE ) { |
|
616 | - $msg = $new_question_group ? sprintf( __('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name() ) : sprintf( __('The %s has been updated', 'event_espresso' ), $this->_question_group_model->item_name() ); |
|
617 | - EE_Error::add_success( $msg ); |
|
615 | + if ($success !== FALSE) { |
|
616 | + $msg = $new_question_group ? sprintf(__('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name()) : sprintf(__('The %s has been updated', 'event_espresso'), $this->_question_group_model->item_name()); |
|
617 | + EE_Error::add_success($msg); |
|
618 | 618 | } |
619 | - $this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group','QSG_ID'=>$QSG_ID), TRUE); |
|
619 | + $this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group', 'QSG_ID'=>$QSG_ID), TRUE); |
|
620 | 620 | |
621 | 621 | } |
622 | 622 | |
@@ -624,39 +624,39 @@ discard block |
||
624 | 624 | * duplicates a question and all its question options and redirects to the new question. |
625 | 625 | */ |
626 | 626 | public function _duplicate_question() { |
627 | - $question_ID = intval( $this->_req_data[ 'QST_ID' ] ); |
|
628 | - $question = EEM_Question::instance()->get_one_by_ID( $question_ID ); |
|
629 | - if( $question instanceof EE_Question ) { |
|
627 | + $question_ID = intval($this->_req_data['QST_ID']); |
|
628 | + $question = EEM_Question::instance()->get_one_by_ID($question_ID); |
|
629 | + if ($question instanceof EE_Question) { |
|
630 | 630 | $new_question = $question->duplicate(); |
631 | - if( $new_question instanceof EE_Question ) { |
|
632 | - $this->_redirect_after_action( true, __( 'Question', 'event_espresso' ), __( 'Duplicated', 'event_espresso' ), array('action'=>'edit_question', 'QST_ID' => $new_question->ID() ), TRUE); |
|
631 | + if ($new_question instanceof EE_Question) { |
|
632 | + $this->_redirect_after_action(true, __('Question', 'event_espresso'), __('Duplicated', 'event_espresso'), array('action'=>'edit_question', 'QST_ID' => $new_question->ID()), TRUE); |
|
633 | 633 | } else { |
634 | 634 | global $wpdb; |
635 | - EE_Error::add_error( sprintf( __( 'Could not duplicate question with ID %1$d because: %2$s', 'event_espresso' ), $question_ID, $wpdb->last_error ), __FILE__, __FUNCTION__, __LINE__ ); |
|
636 | - $this->_redirect_after_action(false, '', '', array('action'=>'default'), false ); |
|
635 | + EE_Error::add_error(sprintf(__('Could not duplicate question with ID %1$d because: %2$s', 'event_espresso'), $question_ID, $wpdb->last_error), __FILE__, __FUNCTION__, __LINE__); |
|
636 | + $this->_redirect_after_action(false, '', '', array('action'=>'default'), false); |
|
637 | 637 | } |
638 | 638 | } else { |
639 | - EE_Error::add_error( sprintf( __( 'Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso' ), $question_ID ), __FILE__, __FUNCTION__, __LINE__ ); |
|
640 | - $this->_redirect_after_action( false, '', '', array( 'action' => 'default' ), false ); |
|
639 | + EE_Error::add_error(sprintf(__('Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso'), $question_ID), __FILE__, __FUNCTION__, __LINE__); |
|
640 | + $this->_redirect_after_action(false, '', '', array('action' => 'default'), false); |
|
641 | 641 | } |
642 | 642 | } |
643 | 643 | |
644 | 644 | |
645 | 645 | |
646 | 646 | protected function _trash_or_restore_question_groups($trash = TRUE) { |
647 | - return $this->_trash_or_restore_items( $this->_question_group_model, $trash ); |
|
647 | + return $this->_trash_or_restore_items($this->_question_group_model, $trash); |
|
648 | 648 | } |
649 | 649 | |
650 | - protected function _trash_question(){ |
|
651 | - $success=$this->_question_model->delete_by_ID(intval($this->_req_data['QST_ID'])); |
|
652 | - $query_args=array('action'=>'default','status'=>'all'); |
|
650 | + protected function _trash_question() { |
|
651 | + $success = $this->_question_model->delete_by_ID(intval($this->_req_data['QST_ID'])); |
|
652 | + $query_args = array('action'=>'default', 'status'=>'all'); |
|
653 | 653 | $this->_redirect_after_action($success, $this->_question_model->item_name($success), 'trashed', $query_args); |
654 | 654 | } |
655 | 655 | |
656 | 656 | |
657 | 657 | |
658 | - protected function _trash_or_restore_questions($trash=TRUE){ |
|
659 | - $this->_trash_or_restore_items( $this->_question_model, $trash ); |
|
658 | + protected function _trash_or_restore_questions($trash = TRUE) { |
|
659 | + $this->_trash_or_restore_items($this->_question_model, $trash); |
|
660 | 660 | } |
661 | 661 | |
662 | 662 | |
@@ -667,21 +667,21 @@ discard block |
||
667 | 667 | * @param EEM_Base $model |
668 | 668 | * @param boolean $trash wehter to trash or restore |
669 | 669 | */ |
670 | - private function _trash_or_restore_items( EEM_Base $model, $trash = TRUE ) { |
|
670 | + private function _trash_or_restore_items(EEM_Base $model, $trash = TRUE) { |
|
671 | 671 | |
672 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
672 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
673 | 673 | |
674 | 674 | $success = 1; |
675 | 675 | //Checkboxes |
676 | 676 | //echo "trash $trash"; |
677 | 677 | //var_dump($this->_req_data['checkbox']);die; |
678 | - if ( isset( $this->_req_data['checkbox'] )) { |
|
679 | - if ( isset( $this->_req_data['checkbox'] ) && ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) { |
|
678 | + if (isset($this->_req_data['checkbox'])) { |
|
679 | + if (isset($this->_req_data['checkbox']) && ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
680 | 680 | // if array has more than one element than success message should be plural |
681 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
681 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
682 | 682 | // cycle thru bulk action checkboxes |
683 | - while (list( $ID, $value ) = each($this->_req_data['checkbox'])) { |
|
684 | - if ( ! $model->delete_or_restore_by_ID($trash,absint($ID))) { |
|
683 | + while (list($ID, $value) = each($this->_req_data['checkbox'])) { |
|
684 | + if ( ! $model->delete_or_restore_by_ID($trash, absint($ID))) { |
|
685 | 685 | $success = 0; |
686 | 686 | } |
687 | 687 | } |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | } else { |
690 | 690 | // grab single id and delete |
691 | 691 | $ID = absint($this->_req_data['checkbox']); |
692 | - if ( ! $model->delete_or_restore_by_ID($trash,$ID)) { |
|
692 | + if ( ! $model->delete_or_restore_by_ID($trash, $ID)) { |
|
693 | 693 | $success = 0; |
694 | 694 | } |
695 | 695 | } |
@@ -697,53 +697,53 @@ discard block |
||
697 | 697 | } else { |
698 | 698 | // delete via trash link |
699 | 699 | // grab single id and delete |
700 | - $ID = absint($this->_req_data[ $model->primary_key_name() ]); |
|
701 | - if ( ! $model->delete_or_restore_by_ID($trash,$ID)) { |
|
700 | + $ID = absint($this->_req_data[$model->primary_key_name()]); |
|
701 | + if ( ! $model->delete_or_restore_by_ID($trash, $ID)) { |
|
702 | 702 | $success = 0; |
703 | 703 | } |
704 | 704 | |
705 | 705 | } |
706 | 706 | |
707 | 707 | |
708 | - $action = $model instanceof EEM_Question ? 'default' : 'question_groups';//strtolower( $model->item_name(2) ); |
|
708 | + $action = $model instanceof EEM_Question ? 'default' : 'question_groups'; //strtolower( $model->item_name(2) ); |
|
709 | 709 | //echo "action :$action"; |
710 | 710 | //$action = 'questions' ? 'default' : $action; |
711 | - if($trash){ |
|
711 | + if ($trash) { |
|
712 | 712 | $action_desc = 'trashed'; |
713 | 713 | $status = 'trash'; |
714 | - }else{ |
|
714 | + } else { |
|
715 | 715 | $action_desc = 'restored'; |
716 | 716 | $status = 'all'; |
717 | 717 | } |
718 | - $this->_redirect_after_action( $success, $model->item_name($success), $action_desc, array( 'action' => $action, 'status'=>$status ) ); |
|
718 | + $this->_redirect_after_action($success, $model->item_name($success), $action_desc, array('action' => $action, 'status'=>$status)); |
|
719 | 719 | } |
720 | 720 | |
721 | 721 | |
722 | 722 | |
723 | 723 | |
724 | - public function get_trashed_questions( $per_page,$current_page = 1, $count = FALSE ) { |
|
724 | + public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) { |
|
725 | 725 | $query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page); |
726 | 726 | |
727 | - if( $count ){ |
|
727 | + if ($count) { |
|
728 | 728 | //note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items |
729 | - $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
|
730 | - $results=$this->_question_model->count_deleted($where); |
|
731 | - }else{ |
|
729 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
730 | + $results = $this->_question_model->count_deleted($where); |
|
731 | + } else { |
|
732 | 732 | //note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items |
733 | - $results=$this->_question_model->get_all_deleted($query_params); |
|
733 | + $results = $this->_question_model->get_all_deleted($query_params); |
|
734 | 734 | } |
735 | 735 | return $results; |
736 | 736 | } |
737 | 737 | |
738 | 738 | |
739 | 739 | |
740 | - public function get_question_groups( $per_page, $current_page = 1, $count = FALSE ) { |
|
741 | - $questionGroupModel=EEM_Question_Group::instance(); |
|
742 | - $query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page); |
|
743 | - if ($count){ |
|
744 | - $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
|
740 | + public function get_question_groups($per_page, $current_page = 1, $count = FALSE) { |
|
741 | + $questionGroupModel = EEM_Question_Group::instance(); |
|
742 | + $query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page); |
|
743 | + if ($count) { |
|
744 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
745 | 745 | $results = $questionGroupModel->count($where); |
746 | - }else{ |
|
746 | + } else { |
|
747 | 747 | $results = $questionGroupModel->get_all($query_params); |
748 | 748 | } |
749 | 749 | return $results; |
@@ -751,14 +751,14 @@ discard block |
||
751 | 751 | |
752 | 752 | |
753 | 753 | |
754 | - public function get_trashed_question_groups( $per_page,$current_page = 1, $count = FALSE ) { |
|
755 | - $questionGroupModel=EEM_Question_Group::instance(); |
|
756 | - $query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page); |
|
757 | - if($count){ |
|
758 | - $where = isset( $query_params[0] ) ? array($query_params[0]) : array(); |
|
754 | + public function get_trashed_question_groups($per_page, $current_page = 1, $count = FALSE) { |
|
755 | + $questionGroupModel = EEM_Question_Group::instance(); |
|
756 | + $query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page); |
|
757 | + if ($count) { |
|
758 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
759 | 759 | $query_params['limit'] = NULL; |
760 | 760 | $results = $questionGroupModel->count_deleted($where); |
761 | - }else{ |
|
761 | + } else { |
|
762 | 762 | $results = $questionGroupModel->get_all_deleted($query_params); |
763 | 763 | } |
764 | 764 | return $results; |
@@ -771,22 +771,22 @@ discard block |
||
771 | 771 | */ |
772 | 772 | public function update_question_group_order() { |
773 | 773 | |
774 | - $success = __( 'Question group order was updated successfully.', 'event_espresso' ); |
|
774 | + $success = __('Question group order was updated successfully.', 'event_espresso'); |
|
775 | 775 | |
776 | 776 | // grab our row IDs |
777 | - $row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE; |
|
777 | + $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE; |
|
778 | 778 | |
779 | - $perpage = !empty( $this->_req_data['perpage'] ) ? (int) $this->_req_data['perpage'] : NULL; |
|
780 | - $curpage = !empty( $this->_req_data['curpage'] ) ? (int) $this->_req_data['curpage'] : NULL; |
|
779 | + $perpage = ! empty($this->_req_data['perpage']) ? (int) $this->_req_data['perpage'] : NULL; |
|
780 | + $curpage = ! empty($this->_req_data['curpage']) ? (int) $this->_req_data['curpage'] : NULL; |
|
781 | 781 | |
782 | - if ( is_array( $row_ids )) { |
|
782 | + if (is_array($row_ids)) { |
|
783 | 783 | //figure out where we start the row_id count at for the current page. |
784 | - $qsgcount = empty( $curpage ) ? 0 : ($curpage - 1 ) * $perpage; |
|
784 | + $qsgcount = empty($curpage) ? 0 : ($curpage - 1) * $perpage; |
|
785 | 785 | |
786 | 786 | global $wpdb; |
787 | - for ( $i = 0; $i < count($row_ids); $i++ ) { |
|
787 | + for ($i = 0; $i < count($row_ids); $i++) { |
|
788 | 788 | //Update the questions when re-ordering |
789 | - if ( EEM_Question_Group::instance()->update ( array( 'QSG_order' => $qsgcount ), array(array( 'QSG_ID' => $row_ids[$i] ))) === FALSE ) { |
|
789 | + if (EEM_Question_Group::instance()->update(array('QSG_order' => $qsgcount), array(array('QSG_ID' => $row_ids[$i]))) === FALSE) { |
|
790 | 790 | $success = FALSE; |
791 | 791 | } |
792 | 792 | $qsgcount++; |
@@ -795,9 +795,9 @@ discard block |
||
795 | 795 | $success = FALSE; |
796 | 796 | } |
797 | 797 | |
798 | - $errors = ! $success ? __( 'An error occurred. The question group order was not updated.', 'event_espresso' ) : FALSE; |
|
798 | + $errors = ! $success ? __('An error occurred. The question group order was not updated.', 'event_espresso') : FALSE; |
|
799 | 799 | |
800 | - echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors )); |
|
800 | + echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors)); |
|
801 | 801 | die(); |
802 | 802 | |
803 | 803 | } |
@@ -814,10 +814,10 @@ discard block |
||
814 | 814 | |
815 | 815 | protected function _reg_form_settings() { |
816 | 816 | $this->_template_args['values'] = $this->_yes_no_values; |
817 | - $this->_template_args = apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page___reg_form_settings___template_args', $this->_template_args ); |
|
818 | - $this->_set_add_edit_form_tags( 'update_reg_form_settings' ); |
|
819 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
820 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'reg_form_settings.template.php', $this->_template_args, TRUE ); |
|
817 | + $this->_template_args = apply_filters('FHEE__Extend_Registration_Form_Admin_Page___reg_form_settings___template_args', $this->_template_args); |
|
818 | + $this->_set_add_edit_form_tags('update_reg_form_settings'); |
|
819 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
820 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_CAF_TEMPLATE_PATH.'reg_form_settings.template.php', $this->_template_args, TRUE); |
|
821 | 821 | $this->display_admin_page_with_sidebar(); |
822 | 822 | } |
823 | 823 | |
@@ -825,9 +825,9 @@ discard block |
||
825 | 825 | |
826 | 826 | |
827 | 827 | protected function _update_reg_form_settings() { |
828 | - EE_Registry::instance()->CFG->registration = apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', EE_Registry::instance()->CFG->registration ); |
|
829 | - $success = $this->_update_espresso_configuration( __('Registration Form Options', 'event_espresso'), EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ ); |
|
830 | - $this->_redirect_after_action( $success, __('Registration Form Options', 'event_espresso'), 'updated', array( 'action' => 'view_reg_form_settings' ) ); |
|
828 | + EE_Registry::instance()->CFG->registration = apply_filters('FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', EE_Registry::instance()->CFG->registration); |
|
829 | + $success = $this->_update_espresso_configuration(__('Registration Form Options', 'event_espresso'), EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__); |
|
830 | + $this->_redirect_after_action($success, __('Registration Form Options', 'event_espresso'), 'updated', array('action' => 'view_reg_form_settings')); |
|
831 | 831 | } |
832 | 832 | |
833 | 833 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EEG_Paypal_Pro extends EE_Onsite_Gateway{ |
|
28 | +class EEG_Paypal_Pro extends EE_Onsite_Gateway { |
|
29 | 29 | /** |
30 | 30 | * |
31 | 31 | * @var $_paypal_api_username string |
@@ -88,21 +88,21 @@ discard block |
||
88 | 88 | * } @see parent::do_direct_payment for more info |
89 | 89 | * @return \EE_Payment|\EEI_Payment |
90 | 90 | */ |
91 | - public function do_direct_payment($payment,$billing_info = null){ |
|
91 | + public function do_direct_payment($payment, $billing_info = null) { |
|
92 | 92 | $transaction = $payment->transaction(); |
93 | 93 | $primary_registrant = $transaction->primary_registration(); |
94 | - $order_description = sprintf(__("Event Registrations from %s", "event_espresso"),get_bloginfo('name')); |
|
94 | + $order_description = sprintf(__("Event Registrations from %s", "event_espresso"), get_bloginfo('name')); |
|
95 | 95 | //charge for the full amount. Show itemized list |
96 | - if( $this->_can_easily_itemize_transaction_for( $payment ) ){ |
|
96 | + if ($this->_can_easily_itemize_transaction_for($payment)) { |
|
97 | 97 | $item_num = 1; |
98 | 98 | $total_line_item = $transaction->total_line_item(); |
99 | 99 | $order_items = array(); |
100 | 100 | foreach ($total_line_item->get_items() as $line_item) { |
101 | 101 | $item = array( |
102 | 102 | // Item Name. 127 char max. |
103 | - 'l_name' => substr($line_item->name(),0,127), |
|
103 | + 'l_name' => substr($line_item->name(), 0, 127), |
|
104 | 104 | // Item description. 127 char max. |
105 | - 'l_desc' => substr($line_item->desc(),0,127), |
|
105 | + 'l_desc' => substr($line_item->desc(), 0, 127), |
|
106 | 106 | // Cost of individual item. |
107 | 107 | 'l_amt' => $line_item->unit_price(), |
108 | 108 | // Item Number. 127 char max. |
@@ -123,14 +123,14 @@ discard block |
||
123 | 123 | } |
124 | 124 | $item_amount = $total_line_item->get_items_total(); |
125 | 125 | $tax_amount = $total_line_item->get_total_tax(); |
126 | - }else{ |
|
126 | + } else { |
|
127 | 127 | $order_items = array(); |
128 | 128 | $item_amount = $payment->amount(); |
129 | - $single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code()); |
|
129 | + $single_item_desc = sprintf(__("Partial payment of %s for %s", "event_espresso"), $payment->amount(), $primary_registrant->reg_code()); |
|
130 | 130 | $tax_amount = 0; |
131 | - array_push($order_items,array( |
|
131 | + array_push($order_items, array( |
|
132 | 132 | // Item Name. 127 char max. |
133 | - 'l_name' => sprintf(__("Partial payment for registration: %s", 'event_espresso'),$primary_registrant->reg_code()), |
|
133 | + 'l_name' => sprintf(__("Partial payment for registration: %s", 'event_espresso'), $primary_registrant->reg_code()), |
|
134 | 134 | // Item description. 127 char max. |
135 | 135 | 'l_desc' => $single_item_desc, |
136 | 136 | // Cost of individual item. |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | // Payer's salutation. 20 char max. |
178 | 178 | 'salutation' => '', |
179 | 179 | // Payer's first name. 25 char max. |
180 | - 'firstname' => substr($billing_info['first_name'],0,25), |
|
180 | + 'firstname' => substr($billing_info['first_name'], 0, 25), |
|
181 | 181 | // Payer's middle name. 25 char max. |
182 | 182 | 'middlename' => '', |
183 | 183 | // Payer's last name. 25 char max. |
184 | - 'lastname' => substr($billing_info['last_name'],0,25), |
|
184 | + 'lastname' => substr($billing_info['last_name'], 0, 25), |
|
185 | 185 | // Payer's suffix. 12 char max. |
186 | 186 | 'suffix' => '' |
187 | 187 | ); |
@@ -194,13 +194,13 @@ discard block |
||
194 | 194 | // Required. Name of City. |
195 | 195 | 'city' => $billing_info['city'], |
196 | 196 | // Required. Name of State or Province. |
197 | - 'state' => substr( $billing_info['state'], 0, 40 ), |
|
197 | + 'state' => substr($billing_info['state'], 0, 40), |
|
198 | 198 | // Required. Country code. |
199 | 199 | 'countrycode' => $billing_info['country'], |
200 | 200 | // Required. Postal code of payer. |
201 | 201 | 'zip' => $billing_info['zip'], |
202 | 202 | // Phone Number of payer. 20 char max. |
203 | - 'shiptophonenum' => substr($billing_info['phone'],0,20) |
|
203 | + 'shiptophonenum' => substr($billing_info['phone'], 0, 20) |
|
204 | 204 | ); |
205 | 205 | |
206 | 206 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | // Required. Three-letter currency code. Default is USD. |
211 | 211 | 'currencycode' => $payment->currency_code(), |
212 | 212 | // Required if you include itemized cart details. (L_AMTn, etc.) Subtotal of items not including S&H, or tax. |
213 | - 'itemamt' => $this->format_currency($item_amount),// |
|
213 | + 'itemamt' => $this->format_currency($item_amount), // |
|
214 | 214 | // Total shipping costs for the order. If you specify shippingamt, you must also specify itemamt. |
215 | 215 | 'shippingamt' => '', |
216 | 216 | // Total handling costs for the order. If you specify handlingamt, you must also specify itemamt. |
@@ -222,10 +222,10 @@ discard block |
||
222 | 222 | // Free-form field for your own use. 256 char max. |
223 | 223 | 'custom' => $primary_registrant ? $primary_registrant->ID() : '', |
224 | 224 | // Your own invoice or tracking number |
225 | - 'invnum' => wp_generate_password(12,false),//$transaction->ID(), |
|
225 | + 'invnum' => wp_generate_password(12, false), //$transaction->ID(), |
|
226 | 226 | // URL for receiving Instant Payment Notifications. This overrides what your profile is set to use. |
227 | 227 | 'notifyurl' => '', |
228 | - 'buttonsource' => 'EventEspresso_SP',//EE will blow up if you change this |
|
228 | + 'buttonsource' => 'EventEspresso_SP', //EE will blow up if you change this |
|
229 | 229 | ); |
230 | 230 | // Wrap all data arrays into a single, "master" array which will be passed into the class function. |
231 | 231 | $PayPalRequestData = array( |
@@ -238,32 +238,32 @@ discard block |
||
238 | 238 | 'OrderItems' => $order_items, |
239 | 239 | ); |
240 | 240 | $this->_log_clean_request($PayPalRequestData, $payment); |
241 | - try{ |
|
241 | + try { |
|
242 | 242 | $PayPalResult = $this->prep_and_curl_request($PayPalRequestData); |
243 | 243 | //remove PCI-sensitive data so it doesn't get stored |
244 | - $PayPalResult = $this->_log_clean_response($PayPalResult,$payment); |
|
244 | + $PayPalResult = $this->_log_clean_response($PayPalResult, $payment); |
|
245 | 245 | |
246 | 246 | $message = isset($PayPalResult['L_LONGMESSAGE0']) ? $PayPalResult['L_LONGMESSAGE0'] : $PayPalResult['ACK']; |
247 | - if( empty($PayPalResult[ 'RAWRESPONSE' ] ) ) { |
|
248 | - $payment->set_status( $this->_pay_model->failed_status() ) ; |
|
249 | - $payment->set_gateway_response( __( 'No response received from Paypal Pro', 'event_espresso' ) ); |
|
247 | + if (empty($PayPalResult['RAWRESPONSE'])) { |
|
248 | + $payment->set_status($this->_pay_model->failed_status()); |
|
249 | + $payment->set_gateway_response(__('No response received from Paypal Pro', 'event_espresso')); |
|
250 | 250 | $payment->set_details($PayPalResult); |
251 | - }else{ |
|
252 | - if($this->_APICallSuccessful($PayPalResult)){ |
|
251 | + } else { |
|
252 | + if ($this->_APICallSuccessful($PayPalResult)) { |
|
253 | 253 | $payment->set_status($this->_pay_model->approved_status()); |
254 | - }else{ |
|
254 | + } else { |
|
255 | 255 | $payment->set_status($this->_pay_model->declined_status()); |
256 | 256 | } |
257 | 257 | //make sure we interpret the AMT as a float, not an international string (where periods are thousand separators) |
258 | - $payment->set_amount(isset($PayPalResult['AMT']) ? floatval( $PayPalResult['AMT'] ) : 0); |
|
258 | + $payment->set_amount(isset($PayPalResult['AMT']) ? floatval($PayPalResult['AMT']) : 0); |
|
259 | 259 | $payment->set_gateway_response($message); |
260 | - $payment->set_txn_id_chq_nmbr(isset( $PayPalResult['TRANSACTIONID'] )? $PayPalResult['TRANSACTIONID'] : null); |
|
260 | + $payment->set_txn_id_chq_nmbr(isset($PayPalResult['TRANSACTIONID']) ? $PayPalResult['TRANSACTIONID'] : null); |
|
261 | 261 | |
262 | 262 | $primary_registration_code = $primary_registrant instanceof EE_Registration ? $primary_registrant->reg_code() : ''; |
263 | 263 | $payment->set_extra_accntng($primary_registration_code); |
264 | 264 | $payment->set_details($PayPalResult); |
265 | 265 | } |
266 | - }catch(Exception $e){ |
|
266 | + } catch (Exception $e) { |
|
267 | 267 | $payment->set_status($this->_pay_model->failed_status()); |
268 | 268 | $payment->set_gateway_response($e->getMessage()); |
269 | 269 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * @param EEI_Payment $payment |
281 | 281 | * @return array |
282 | 282 | */ |
283 | - private function _log_clean_request($request,$payment){ |
|
283 | + private function _log_clean_request($request, $payment) { |
|
284 | 284 | $cleaned_request_data = $request; |
285 | 285 | unset($cleaned_request_data['CCDetails']['acct']); |
286 | 286 | unset($cleaned_request_data['CCDetails']['cvv2']); |
@@ -296,13 +296,13 @@ discard block |
||
296 | 296 | * @param EEI_Payment $payment |
297 | 297 | * @return array cleaned |
298 | 298 | */ |
299 | - private function _log_clean_response($response,$payment){ |
|
299 | + private function _log_clean_response($response, $payment) { |
|
300 | 300 | unset($response['REQUESTDATA']['CREDITCARDTYPE']); |
301 | 301 | unset($response['REQUESTDATA']['ACCT']); |
302 | 302 | unset($response['REQUESTDATA']['EXPDATE']); |
303 | 303 | unset($response['REQUESTDATA']['CVV2']); |
304 | 304 | unset($response['RAWREQUEST']); |
305 | - $this->log(array('Paypal Response'=>$response),$payment); |
|
305 | + $this->log(array('Paypal Response'=>$response), $payment); |
|
306 | 306 | return $response; |
307 | 307 | } |
308 | 308 | |
@@ -327,32 +327,32 @@ discard block |
||
327 | 327 | // DP Fields |
328 | 328 | $DPFields = isset($DataArray['DPFields']) ? $DataArray['DPFields'] : array(); |
329 | 329 | foreach ($DPFields as $DPFieldsVar => $DPFieldsVal) |
330 | - $DPFieldsNVP .= '&' . strtoupper($DPFieldsVar) . '=' . urlencode($DPFieldsVal); |
|
330 | + $DPFieldsNVP .= '&'.strtoupper($DPFieldsVar).'='.urlencode($DPFieldsVal); |
|
331 | 331 | |
332 | 332 | // CC Details Fields |
333 | 333 | $CCDetails = isset($DataArray['CCDetails']) ? $DataArray['CCDetails'] : array(); |
334 | 334 | foreach ($CCDetails as $CCDetailsVar => $CCDetailsVal) |
335 | - $CCDetailsNVP .= '&' . strtoupper($CCDetailsVar) . '=' . urlencode($CCDetailsVal); |
|
335 | + $CCDetailsNVP .= '&'.strtoupper($CCDetailsVar).'='.urlencode($CCDetailsVal); |
|
336 | 336 | |
337 | 337 | // PayerInfo Type Fields |
338 | 338 | $PayerInfo = isset($DataArray['PayerInfo']) ? $DataArray['PayerInfo'] : array(); |
339 | 339 | foreach ($PayerInfo as $PayerInfoVar => $PayerInfoVal) |
340 | - $PayerInfoNVP .= '&' . strtoupper($PayerInfoVar) . '=' . urlencode($PayerInfoVal); |
|
340 | + $PayerInfoNVP .= '&'.strtoupper($PayerInfoVar).'='.urlencode($PayerInfoVal); |
|
341 | 341 | |
342 | 342 | // Payer Name Fields |
343 | 343 | $PayerName = isset($DataArray['PayerName']) ? $DataArray['PayerName'] : array(); |
344 | 344 | foreach ($PayerName as $PayerNameVar => $PayerNameVal) |
345 | - $PayerNameNVP .= '&' . strtoupper($PayerNameVar) . '=' . urlencode($PayerNameVal); |
|
345 | + $PayerNameNVP .= '&'.strtoupper($PayerNameVar).'='.urlencode($PayerNameVal); |
|
346 | 346 | |
347 | 347 | // Address Fields (Billing) |
348 | 348 | $BillingAddress = isset($DataArray['BillingAddress']) ? $DataArray['BillingAddress'] : array(); |
349 | 349 | foreach ($BillingAddress as $BillingAddressVar => $BillingAddressVal) |
350 | - $BillingAddressNVP .= '&' . strtoupper($BillingAddressVar) . '=' . urlencode($BillingAddressVal); |
|
350 | + $BillingAddressNVP .= '&'.strtoupper($BillingAddressVar).'='.urlencode($BillingAddressVal); |
|
351 | 351 | |
352 | 352 | // Payment Details Type Fields |
353 | 353 | $PaymentDetails = isset($DataArray['PaymentDetails']) ? $DataArray['PaymentDetails'] : array(); |
354 | 354 | foreach ($PaymentDetails as $PaymentDetailsVar => $PaymentDetailsVal) |
355 | - $PaymentDetailsNVP .= '&' . strtoupper($PaymentDetailsVar) . '=' . urlencode($PaymentDetailsVal); |
|
355 | + $PaymentDetailsNVP .= '&'.strtoupper($PaymentDetailsVar).'='.urlencode($PaymentDetailsVal); |
|
356 | 356 | |
357 | 357 | // Payment Details Item Type Fields |
358 | 358 | $OrderItems = isset($DataArray['OrderItems']) ? $DataArray['OrderItems'] : array(); |
@@ -360,22 +360,22 @@ discard block |
||
360 | 360 | foreach ($OrderItems as $OrderItemsVar => $OrderItemsVal) { |
361 | 361 | $CurrentItem = $OrderItems[$OrderItemsVar]; |
362 | 362 | foreach ($CurrentItem as $CurrentItemVar => $CurrentItemVal) |
363 | - $OrderItemsNVP .= '&' . strtoupper($CurrentItemVar) . $n . '=' . urlencode($CurrentItemVal); |
|
363 | + $OrderItemsNVP .= '&'.strtoupper($CurrentItemVar).$n.'='.urlencode($CurrentItemVal); |
|
364 | 364 | $n++; |
365 | 365 | } |
366 | 366 | |
367 | 367 | // Ship To Address Fields |
368 | 368 | $ShippingAddress = isset($DataArray['ShippingAddress']) ? $DataArray['ShippingAddress'] : array(); |
369 | 369 | foreach ($ShippingAddress as $ShippingAddressVar => $ShippingAddressVal) |
370 | - $ShippingAddressNVP .= '&' . strtoupper($ShippingAddressVar) . '=' . urlencode($ShippingAddressVal); |
|
370 | + $ShippingAddressNVP .= '&'.strtoupper($ShippingAddressVar).'='.urlencode($ShippingAddressVal); |
|
371 | 371 | |
372 | 372 | // 3D Secure Fields |
373 | 373 | $Secure3D = isset($DataArray['Secure3D']) ? $DataArray['Secure3D'] : array(); |
374 | 374 | foreach ($Secure3D as $Secure3DVar => $Secure3DVal) |
375 | - $Secure3DNVP .= '&' . strtoupper($Secure3DVar) . '=' . urlencode($Secure3DVal); |
|
375 | + $Secure3DNVP .= '&'.strtoupper($Secure3DVar).'='.urlencode($Secure3DVal); |
|
376 | 376 | |
377 | 377 | // Now that we have each chunk we need to go ahead and append them all together for our entire NVP string |
378 | - $NVPRequest = 'USER=' . $this->_username . '&PWD=' . $this->_password . '&VERSION=64.0' . '&SIGNATURE=' . $this->_signature . $DPFieldsNVP . $CCDetailsNVP . $PayerInfoNVP . $PayerNameNVP . $BillingAddressNVP . $PaymentDetailsNVP . $OrderItemsNVP . $ShippingAddressNVP . $Secure3DNVP; |
|
378 | + $NVPRequest = 'USER='.$this->_username.'&PWD='.$this->_password.'&VERSION=64.0'.'&SIGNATURE='.$this->_signature.$DPFieldsNVP.$CCDetailsNVP.$PayerInfoNVP.$PayerNameNVP.$BillingAddressNVP.$PaymentDetailsNVP.$OrderItemsNVP.$ShippingAddressNVP.$Secure3DNVP; |
|
379 | 379 | $NVPResponse = $this->_CURLRequest($NVPRequest); |
380 | 380 | $NVPRequestArray = $this->_NVPToArray($NVPRequest); |
381 | 381 | $NVPResponseArray = $this->_NVPToArray($NVPResponse); |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | private function _CURLRequest($Request) { |
400 | 400 | $EndPointURL = $this->_debug_mode ? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp'; |
401 | 401 | $curl = curl_init(); |
402 | - curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE ) ); |
|
402 | + curl_setopt($curl, CURLOPT_VERBOSE, apply_filters('FHEE__EEG_Paypal_Pro__CurlRequest__CURLOPT_VERBOSE', TRUE)); |
|
403 | 403 | curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); |
404 | 404 | curl_setopt($curl, CURLOPT_TIMEOUT, 60); |
405 | 405 | curl_setopt($curl, CURLOPT_URL, $EndPointURL); |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | private function _APICallSuccessful($PayPalResult) { |
450 | 450 | $approved = false; |
451 | 451 | // check main response message from PayPal |
452 | - if (isset($PayPalResult['ACK']) && !empty($PayPalResult['ACK'])) { |
|
452 | + if (isset($PayPalResult['ACK']) && ! empty($PayPalResult['ACK'])) { |
|
453 | 453 | $ack = strtoupper($PayPalResult['ACK']); |
454 | - $approved = ( $ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS' ) ? true : false; |
|
454 | + $approved = ($ack == 'SUCCESS' || $ack == 'SUCCESSWITHWARNING' || $ack == 'PARTIALSUCCESS') ? true : false; |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | return $approved; |
@@ -467,11 +467,11 @@ discard block |
||
467 | 467 | |
468 | 468 | $Errors = array(); |
469 | 469 | $n = 0; |
470 | - while (isset($DataArray['L_ERRORCODE' . $n . ''])) { |
|
471 | - $LErrorCode = isset($DataArray['L_ERRORCODE' . $n . '']) ? $DataArray['L_ERRORCODE' . $n . ''] : ''; |
|
472 | - $LShortMessage = isset($DataArray['L_SHORTMESSAGE' . $n . '']) ? $DataArray['L_SHORTMESSAGE' . $n . ''] : ''; |
|
473 | - $LLongMessage = isset($DataArray['L_LONGMESSAGE' . $n . '']) ? $DataArray['L_LONGMESSAGE' . $n . ''] : ''; |
|
474 | - $LSeverityCode = isset($DataArray['L_SEVERITYCODE' . $n . '']) ? $DataArray['L_SEVERITYCODE' . $n . ''] : ''; |
|
470 | + while (isset($DataArray['L_ERRORCODE'.$n.''])) { |
|
471 | + $LErrorCode = isset($DataArray['L_ERRORCODE'.$n.'']) ? $DataArray['L_ERRORCODE'.$n.''] : ''; |
|
472 | + $LShortMessage = isset($DataArray['L_SHORTMESSAGE'.$n.'']) ? $DataArray['L_SHORTMESSAGE'.$n.''] : ''; |
|
473 | + $LLongMessage = isset($DataArray['L_LONGMESSAGE'.$n.'']) ? $DataArray['L_LONGMESSAGE'.$n.''] : ''; |
|
474 | + $LSeverityCode = isset($DataArray['L_SEVERITYCODE'.$n.'']) ? $DataArray['L_SEVERITYCODE'.$n.''] : ''; |
|
475 | 475 | |
476 | 476 | $CurrentItem = array( |
477 | 477 | 'L_ERRORCODE' => $LErrorCode, |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | elseif ($CurrentErrorVar == 'L_SEVERITYCODE') |
512 | 512 | $CurrentVarName = 'Severity Code'; |
513 | 513 | |
514 | - $error .= '<br />' . $CurrentVarName . ': ' . $CurrentErrorVal; |
|
514 | + $error .= '<br />'.$CurrentVarName.': '.$CurrentErrorVal; |
|
515 | 515 | } |
516 | 516 | } |
517 | 517 | return $error; |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | |
17 | 17 | use EventEspressoBatchRequest\Helpers\BatchRequestException; |
18 | 18 | |
19 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
20 | - exit( 'No direct script access allowed' ); |
|
19 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
20 | + exit('No direct script access allowed'); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @param \EEHI_File|null $file_helper |
41 | 41 | */ |
42 | - public function __construct( \EEHI_File $file_helper = null ) { |
|
43 | - if( ! $file_helper ) { |
|
42 | + public function __construct(\EEHI_File $file_helper = null) { |
|
43 | + if ( ! $file_helper) { |
|
44 | 44 | $this->_file_helper = new \EEH_File(); |
45 | 45 | } |
46 | 46 | } |
@@ -56,39 +56,39 @@ discard block |
||
56 | 56 | * @return string |
57 | 57 | * @throws \EventEspressoBatchRequest\Helpers\BatchRequestException |
58 | 58 | */ |
59 | - public function create_file_from_job_with_name( $job_id, $filename, $filetype = 'application/ms-excel' ) { |
|
59 | + public function create_file_from_job_with_name($job_id, $filename, $filetype = 'application/ms-excel') { |
|
60 | 60 | $filepath = ''; |
61 | - try{ |
|
61 | + try { |
|
62 | 62 | $success = $this->_file_helper->ensure_folder_exists_and_is_writable( |
63 | - EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name |
|
63 | + EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name |
|
64 | 64 | ); |
65 | - if ( $success ) { |
|
65 | + if ($success) { |
|
66 | 66 | $success = $this->_file_helper->ensure_folder_exists_and_is_writable( |
67 | - EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name . DS . $job_id |
|
67 | + EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name.DS.$job_id |
|
68 | 68 | ); |
69 | 69 | } |
70 | - if( $success ) { |
|
71 | - $filepath = EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name . DS . $job_id . DS. $filename; |
|
72 | - $success = $this->_file_helper->ensure_file_exists_and_is_writable( $filepath ); |
|
70 | + if ($success) { |
|
71 | + $filepath = EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name.DS.$job_id.DS.$filename; |
|
72 | + $success = $this->_file_helper->ensure_file_exists_and_is_writable($filepath); |
|
73 | 73 | } |
74 | 74 | //let's add the .htaccess file so safari will open the file properly |
75 | - if( $success ) { |
|
76 | - $extension = \EEH_File::get_file_extension( $filepath ); |
|
75 | + if ($success) { |
|
76 | + $extension = \EEH_File::get_file_extension($filepath); |
|
77 | 77 | \EEH_File::write_to_file( |
78 | - EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name . DS . $job_id . DS . '.htaccess', |
|
79 | - 'AddType ' . $filetype . ' ' . $extension, |
|
78 | + EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name.DS.$job_id.DS.'.htaccess', |
|
79 | + 'AddType '.$filetype.' '.$extension, |
|
80 | 80 | '.htaccess' |
81 | 81 | ); |
82 | 82 | } |
83 | 83 | //those methods normally fail with an exception, but if not, let's do it |
84 | - if( ! $success ) { |
|
85 | - throw new \EE_Error( 'could_not_create_temp_file', |
|
86 | - __( 'An unknown error occurred', 'event_espresso' )); |
|
84 | + if ( ! $success) { |
|
85 | + throw new \EE_Error('could_not_create_temp_file', |
|
86 | + __('An unknown error occurred', 'event_espresso')); |
|
87 | 87 | } |
88 | - } catch( \EE_Error $e ) { |
|
88 | + } catch (\EE_Error $e) { |
|
89 | 89 | throw new BatchRequestException( |
90 | 90 | sprintf( |
91 | - __( 'Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso' ), |
|
91 | + __('Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso'), |
|
92 | 92 | $job_id, |
93 | 93 | $e->getMessage() |
94 | 94 | ), |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param string $filepath |
105 | 105 | * @return string url to file |
106 | 106 | */ |
107 | - public function get_url_to_file( $filepath ) { |
|
108 | - return str_replace( EVENT_ESPRESSO_UPLOAD_DIR, EVENT_ESPRESSO_UPLOAD_URL, $filepath ); |
|
107 | + public function get_url_to_file($filepath) { |
|
108 | + return str_replace(EVENT_ESPRESSO_UPLOAD_DIR, EVENT_ESPRESSO_UPLOAD_URL, $filepath); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 |