@@ -1,26 +1,26 @@ |
||
| 1 | 1 | |
| 2 | - <h3 style="padding:0;margin:-.5em 0 1em;"><?php echo __( 'Transaction # ', 'event_espresso' ) . $txn_nmbr['value'];?></h3> |
|
| 2 | + <h3 style="padding:0;margin:-.5em 0 1em;"><?php echo __('Transaction # ', 'event_espresso').$txn_nmbr['value']; ?></h3> |
|
| 3 | 3 | |
| 4 | - <h2 id="txn-date-h2" style="padding:0;margin:0 0 1em;"><?php echo $txn_datetime['value'];?></h2> |
|
| 4 | + <h2 id="txn-date-h2" style="padding:0;margin:0 0 1em;"><?php echo $txn_datetime['value']; ?></h2> |
|
| 5 | 5 | |
| 6 | 6 | <?php echo $send_payment_reminder_button; ?> |
| 7 | 7 | <h2 id="txn-status-h2" style="padding:0;margin:0 0 1em;"> |
| 8 | - <?php echo __( 'Transaction Status: ', 'event_espresso' );?><span id="txn-status" class="<?php echo $txn_status['class'];?>"><?php echo $txn_status['value'];?></span> |
|
| 8 | + <?php echo __('Transaction Status: ', 'event_espresso'); ?><span id="txn-status" class="<?php echo $txn_status['class']; ?>"><?php echo $txn_status['value']; ?></span> |
|
| 9 | 9 | </h2> |
| 10 | 10 | |
| 11 | - <?php if ( $amount_due ) : ?> |
|
| 11 | + <?php if ($amount_due) : ?> |
|
| 12 | 12 | <h2 id="txn-amount-due-h2" style="padding:0;margin:0 0 1em;"> |
| 13 | - <?php echo __( 'Total Amount Due: ', 'event_espresso' );?><span class="<?php echo $amount_due_class;?>"><?php echo $amount_due;?></span> |
|
| 13 | + <?php echo __('Total Amount Due: ', 'event_espresso'); ?><span class="<?php echo $amount_due_class; ?>"><?php echo $amount_due; ?></span> |
|
| 14 | 14 | </h2> |
| 15 | 15 | <?php else : ?> |
| 16 | 16 | <h2 id="txn-amount-due-h2" class="hidden" style="padding:0;margin:0 0 1em;"> |
| 17 | - <?php echo __( 'Total Amount Due: ', 'event_espresso' );?><span class="<?php echo $amount_due_class;?>"><?php echo $amount_due;?></span> |
|
| 17 | + <?php echo __('Total Amount Due: ', 'event_espresso'); ?><span class="<?php echo $amount_due_class; ?>"><?php echo $amount_due; ?></span> |
|
| 18 | 18 | </h2> |
| 19 | 19 | <?php endif; ?> |
| 20 | 20 | |
| 21 | - <?php if ( $method_of_payment ) : ?> |
|
| 21 | + <?php if ($method_of_payment) : ?> |
|
| 22 | 22 | <h3 id="txn-selected-method-of-payment-h3" style="padding:0;margin:0 0 1em;"> |
| 23 | - <?php echo __( 'Selected Method of Payment: ', 'event_espresso' );?><?php echo $method_of_payment;?> |
|
| 23 | + <?php echo __('Selected Method of Payment: ', 'event_espresso'); ?><?php echo $method_of_payment; ?> |
|
| 24 | 24 | </h3> |
| 25 | 25 | <?php endif; ?> |
| 26 | 26 | |
@@ -12,9 +12,12 @@ |
||
| 12 | 12 | <h2 id="txn-amount-due-h2" style="padding:0;margin:0 0 1em;"> |
| 13 | 13 | <?php echo __( 'Total Amount Due: ', 'event_espresso' );?><span class="<?php echo $amount_due_class;?>"><?php echo $amount_due;?></span> |
| 14 | 14 | </h2> |
| 15 | - <?php else : ?> |
|
| 15 | + <?php else { |
|
| 16 | + : ?> |
|
| 16 | 17 | <h2 id="txn-amount-due-h2" class="hidden" style="padding:0;margin:0 0 1em;"> |
| 17 | - <?php echo __( 'Total Amount Due: ', 'event_espresso' );?><span class="<?php echo $amount_due_class;?>"><?php echo $amount_due;?></span> |
|
| 18 | + <?php echo __( 'Total Amount Due: ', 'event_espresso' ); |
|
| 19 | +} |
|
| 20 | +?><span class="<?php echo $amount_due_class;?>"><?php echo $amount_due;?></span> |
|
| 18 | 21 | </h2> |
| 19 | 22 | <?php endif; ?> |
| 20 | 23 | |
@@ -1,31 +1,31 @@ |
||
| 1 | 1 | |
| 2 | - <h3><?php echo __( 'Transaction # ', 'event_espresso' ) . $txn_nmbr['value'];?></h3> |
|
| 2 | + <h3><?php echo __('Transaction # ', 'event_espresso').$txn_nmbr['value']; ?></h3> |
|
| 3 | 3 | |
| 4 | - <h2><?php echo $txn_datetime['value'];?></h2> |
|
| 4 | + <h2><?php echo $txn_datetime['value']; ?></h2> |
|
| 5 | 5 | |
| 6 | 6 | <h2 id="txn-status-h2"> |
| 7 | - <?php echo __( 'Transaction Status : ', 'event_espresso' );?><span id="txn-status" class="<?php echo $txn_status['class'];?>"><?php echo $txn_status['value'];?></span> |
|
| 7 | + <?php echo __('Transaction Status : ', 'event_espresso'); ?><span id="txn-status" class="<?php echo $txn_status['class']; ?>"><?php echo $txn_status['value']; ?></span> |
|
| 8 | 8 | </h2> |
| 9 | 9 | |
| 10 | - <?php if ( $amount_due ) : ?> |
|
| 10 | + <?php if ($amount_due) : ?> |
|
| 11 | 11 | <h2 id="txn-amount-due-h2"> |
| 12 | - <?php echo __( 'Total Amount Due : ', 'event_espresso' );?><span class="<?php echo $amount_due_class;?>"><?php echo $amount_due;?></span> |
|
| 12 | + <?php echo __('Total Amount Due : ', 'event_espresso'); ?><span class="<?php echo $amount_due_class; ?>"><?php echo $amount_due; ?></span> |
|
| 13 | 13 | </h2> |
| 14 | 14 | <?php else : ?> |
| 15 | 15 | <h2 id="txn-amount-due-h2" class="hidden"> |
| 16 | - <?php echo __( 'Total Amount Due : ', 'event_espresso' );?><span class="<?php echo $amount_due_class;?>"><?php echo $amount_due;?></span> |
|
| 16 | + <?php echo __('Total Amount Due : ', 'event_espresso'); ?><span class="<?php echo $amount_due_class; ?>"><?php echo $amount_due; ?></span> |
|
| 17 | 17 | </h2> |
| 18 | 18 | <?php endif; ?> |
| 19 | 19 | |
| 20 | 20 | <div id="poststuff" class="metabox-holder has-right-sidebar"> |
| 21 | 21 | |
| 22 | 22 | <div id="side-info-column" class="inner-sidebar"> |
| 23 | - <?php do_meta_boxes( $transactions_page, 'side', '' ); ?> |
|
| 23 | + <?php do_meta_boxes($transactions_page, 'side', ''); ?> |
|
| 24 | 24 | </div> |
| 25 | 25 | |
| 26 | 26 | <div id="post-body" class=""> |
| 27 | 27 | <div id="post-body-content" class=""> |
| 28 | - <?php do_meta_boxes( $transactions_page, 'normal', '' ); ?> |
|
| 28 | + <?php do_meta_boxes($transactions_page, 'normal', ''); ?> |
|
| 29 | 29 | </div> |
| 30 | 30 | </div> |
| 31 | 31 | <br class="clear"/> |
@@ -11,9 +11,12 @@ |
||
| 11 | 11 | <h2 id="txn-amount-due-h2"> |
| 12 | 12 | <?php echo __( 'Total Amount Due : ', 'event_espresso' );?><span class="<?php echo $amount_due_class;?>"><?php echo $amount_due;?></span> |
| 13 | 13 | </h2> |
| 14 | - <?php else : ?> |
|
| 14 | + <?php else { |
|
| 15 | + : ?> |
|
| 15 | 16 | <h2 id="txn-amount-due-h2" class="hidden"> |
| 16 | - <?php echo __( 'Total Amount Due : ', 'event_espresso' );?><span class="<?php echo $amount_due_class;?>"><?php echo $amount_due;?></span> |
|
| 17 | + <?php echo __( 'Total Amount Due : ', 'event_espresso' ); |
|
| 18 | +} |
|
| 19 | +?><span class="<?php echo $amount_due_class;?>"><?php echo $amount_due;?></span> |
|
| 17 | 20 | </h2> |
| 18 | 21 | <?php endif; ?> |
| 19 | 22 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * @since 4.3.2 |
| 16 | 16 | * @author Darren Ethier |
| 17 | 17 | */ |
| 18 | -class EE_Caf_Messages { |
|
| 18 | +class EE_Caf_Messages { |
|
| 19 | 19 | |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -34,32 +34,32 @@ discard block |
||
| 34 | 34 | * @return void |
| 35 | 35 | */ |
| 36 | 36 | private function _caf_hooks() { |
| 37 | - add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array( $this, 'messages_autoload_paths'), 5 ); |
|
| 38 | - add_filter('FHEE__EE_Email_messenger__get_validator_config', array( $this, 'email_messenger_validator_config'), 5, 2 ); |
|
| 39 | - add_filter('FHEE__EE_Email_messenger__get_template_fields', array( $this, 'email_messenger_template_fields'), 5, 2 ); |
|
| 40 | - add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', array( $this, 'new_default_templates'), 5, 7 ); |
|
| 41 | - add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', array( $this, 'message_types_valid_shortcodes'), 5, 2 ); |
|
| 37 | + add_filter('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', array($this, 'messages_autoload_paths'), 5); |
|
| 38 | + add_filter('FHEE__EE_Email_messenger__get_validator_config', array($this, 'email_messenger_validator_config'), 5, 2); |
|
| 39 | + add_filter('FHEE__EE_Email_messenger__get_template_fields', array($this, 'email_messenger_template_fields'), 5, 2); |
|
| 40 | + add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', array($this, 'new_default_templates'), 5, 7); |
|
| 41 | + add_filter('FHEE__EE_Messages_Base__get_valid_shortcodes', array($this, 'message_types_valid_shortcodes'), 5, 2); |
|
| 42 | 42 | |
| 43 | 43 | //shortcode parsers |
| 44 | - add_filter('FHEE__EE_Attendee_Shortcodes__shortcodes', array( $this, 'additional_attendee_shortcodes'), 5, 2 ); |
|
| 45 | - add_filter('FHEE__EE_Attendee_Shortcodes__parser_after', array( $this, 'additional_attendee_parser'), 5, 5 ); |
|
| 46 | - add_filter('FHEE__EE_Recipient_List_Shortcodes__shortcodes', array( $this, 'additional_recipient_details_shortcodes'), 5, 2 ); |
|
| 47 | - add_filter('FHEE__EE_Recipient_List_Shortcodes__parser_after', array( $this, 'additional_recipient_details_parser'), 5, 5 ); |
|
| 48 | - add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__shortcodes', array( $this, 'additional_primary_registration_details_shortcodes'), 5, 2 ); |
|
| 49 | - add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__parser_after', array( $this, 'additional_primary_registration_details_parser'), 5, 5 ); |
|
| 44 | + add_filter('FHEE__EE_Attendee_Shortcodes__shortcodes', array($this, 'additional_attendee_shortcodes'), 5, 2); |
|
| 45 | + add_filter('FHEE__EE_Attendee_Shortcodes__parser_after', array($this, 'additional_attendee_parser'), 5, 5); |
|
| 46 | + add_filter('FHEE__EE_Recipient_List_Shortcodes__shortcodes', array($this, 'additional_recipient_details_shortcodes'), 5, 2); |
|
| 47 | + add_filter('FHEE__EE_Recipient_List_Shortcodes__parser_after', array($this, 'additional_recipient_details_parser'), 5, 5); |
|
| 48 | + add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__shortcodes', array($this, 'additional_primary_registration_details_shortcodes'), 5, 2); |
|
| 49 | + add_filter('FHEE__EE_Primary_Registration_List_Shortcodes__parser_after', array($this, 'additional_primary_registration_details_parser'), 5, 5); |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * @since 4.2.0 |
| 53 | 53 | */ |
| 54 | - add_filter( 'FHEE__EE_Datetime_Shortcodes__shortcodes', array( $this, 'additional_datetime_shortcodes'), 10, 2 ); |
|
| 55 | - add_filter( 'FHEE__EE_Datetime_Shortcodes__parser_after', array( $this, 'additional_datetime_parser'), 10, 5 ); |
|
| 54 | + add_filter('FHEE__EE_Datetime_Shortcodes__shortcodes', array($this, 'additional_datetime_shortcodes'), 10, 2); |
|
| 55 | + add_filter('FHEE__EE_Datetime_Shortcodes__parser_after', array($this, 'additional_datetime_parser'), 10, 5); |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * @since 4.3.0 |
| 59 | 59 | */ |
| 60 | 60 | //eat our own dogfood! |
| 61 | - add_action('EE_Brewing_Regular___messages_caf', array( $this, 'register_caf_message_types' ) ); |
|
| 62 | - add_action('EE_Brewing_Regular___messages_caf', array( $this, 'register_caf_shortcodes' ) ); |
|
| 61 | + add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_message_types')); |
|
| 62 | + add_action('EE_Brewing_Regular___messages_caf', array($this, 'register_caf_shortcodes')); |
|
| 63 | 63 | do_action('EE_Brewing_Regular___messages_caf'); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -70,14 +70,14 @@ discard block |
||
| 70 | 70 | * @param array $dir_ref original array of paths |
| 71 | 71 | * @return array appended paths |
| 72 | 72 | */ |
| 73 | - public function messages_autoload_paths( $dir_ref ) { |
|
| 74 | - $dir_ref[] = EE_CAF_LIBRARIES . 'shortcodes/'; |
|
| 73 | + public function messages_autoload_paths($dir_ref) { |
|
| 74 | + $dir_ref[] = EE_CAF_LIBRARIES.'shortcodes/'; |
|
| 75 | 75 | return $dir_ref; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | |
| 80 | - public function email_messenger_validator_config( $validator_config, EE_Email_messenger $messenger ) { |
|
| 80 | + public function email_messenger_validator_config($validator_config, EE_Email_messenger $messenger) { |
|
| 81 | 81 | $validator_config['attendee_list'] = array( |
| 82 | 82 | 'shortcodes' => array('attendee', 'event_list', 'ticket_list', 'question_list'), |
| 83 | 83 | 'required' => array('[ATTENDEE_LIST]') |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | |
| 95 | - public function email_messenger_template_fields( $template_fields, EE_Email_messenger $messenger ) { |
|
| 95 | + public function email_messenger_template_fields($template_fields, EE_Email_messenger $messenger) { |
|
| 96 | 96 | $template_fields['extra']['content']['question_list'] = array( |
| 97 | 97 | 'input' => 'textarea', |
| 98 | 98 | 'label' => '[QUESTION_LIST]', |
@@ -109,39 +109,39 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | |
| 111 | 111 | |
| 112 | - public function new_default_templates( $contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack ) { |
|
| 112 | + public function new_default_templates($contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack) { |
|
| 113 | 113 | |
| 114 | 114 | //we're only modifying templates for the default template pack |
| 115 | - if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default ) { |
|
| 115 | + if ( ! $template_pack instanceof EE_Messages_Template_Pack_Default) { |
|
| 116 | 116 | return $contents; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | //the template file name we're replacing contents for. |
| 120 | - $template_file_prefix = $field . '_' . $context; |
|
| 121 | - $msg_prefix = $messenger->name . '_' . $message_type->name . '_' ; |
|
| 120 | + $template_file_prefix = $field.'_'.$context; |
|
| 121 | + $msg_prefix = $messenger->name.'_'.$message_type->name.'_'; |
|
| 122 | 122 | |
| 123 | - $base_path = EE_CAF_LIBRARIES . 'messages/defaults/default/'; |
|
| 123 | + $base_path = EE_CAF_LIBRARIES.'messages/defaults/default/'; |
|
| 124 | 124 | |
| 125 | - if ( $messenger->name == 'email' && $message_type->name == 'registration' ) { |
|
| 125 | + if ($messenger->name == 'email' && $message_type->name == 'registration') { |
|
| 126 | 126 | |
| 127 | - switch ( $template_file_prefix ) { |
|
| 127 | + switch ($template_file_prefix) { |
|
| 128 | 128 | |
| 129 | 129 | case 'question_list_admin' : |
| 130 | 130 | case 'question_list_attendee' : |
| 131 | 131 | case 'question_list_primary_attendee' : |
| 132 | - $path = $base_path . $msg_prefix . 'question_list.template.php'; |
|
| 133 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
| 132 | + $path = $base_path.$msg_prefix.'question_list.template.php'; |
|
| 133 | + $contents = EEH_Template::display_template($path, array(), true); |
|
| 134 | 134 | break; |
| 135 | 135 | |
| 136 | 136 | case 'attendee_list_primary_attendee' : |
| 137 | - $path = $base_path . $msg_prefix . 'attendee_list.template.php'; |
|
| 138 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
| 137 | + $path = $base_path.$msg_prefix.'attendee_list.template.php'; |
|
| 138 | + $contents = EEH_Template::display_template($path, array(), true); |
|
| 139 | 139 | break; |
| 140 | 140 | |
| 141 | 141 | case 'attendee_list_admin' : |
| 142 | - $path = $base_path . $msg_prefix . 'attendee_list_admin.template.php'; |
|
| 143 | - $contents = EEH_Template::display_template( $path, |
|
| 144 | - array(), true ); |
|
| 142 | + $path = $base_path.$msg_prefix.'attendee_list_admin.template.php'; |
|
| 143 | + $contents = EEH_Template::display_template($path, |
|
| 144 | + array(), true); |
|
| 145 | 145 | break; |
| 146 | 146 | |
| 147 | 147 | case 'attendee_list_attendee' : |
@@ -149,26 +149,26 @@ discard block |
||
| 149 | 149 | break; |
| 150 | 150 | |
| 151 | 151 | case 'event_list_attendee' : |
| 152 | - $path = $base_path . $msg_prefix . 'event_list_attendee.template.php'; |
|
| 153 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
| 152 | + $path = $base_path.$msg_prefix.'event_list_attendee.template.php'; |
|
| 153 | + $contents = EEH_Template::display_template($path, array(), true); |
|
| 154 | 154 | break; |
| 155 | 155 | } |
| 156 | - } elseif ( $messenger->name == 'email' && $message_type->name == 'newsletter' ) { |
|
| 157 | - switch( $template_file_prefix ) { |
|
| 156 | + } elseif ($messenger->name == 'email' && $message_type->name == 'newsletter') { |
|
| 157 | + switch ($template_file_prefix) { |
|
| 158 | 158 | |
| 159 | 159 | case 'content_attendee' : |
| 160 | - $path = $base_path . $msg_prefix . 'content.template.php'; |
|
| 161 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
| 160 | + $path = $base_path.$msg_prefix.'content.template.php'; |
|
| 161 | + $contents = EEH_Template::display_template($path, array(), true); |
|
| 162 | 162 | break; |
| 163 | 163 | |
| 164 | 164 | case 'newsletter_content_attendee' : |
| 165 | - $path = $base_path . $msg_prefix . 'newsletter_content.template.php'; |
|
| 166 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
| 165 | + $path = $base_path.$msg_prefix.'newsletter_content.template.php'; |
|
| 166 | + $contents = EEH_Template::display_template($path, array(), true); |
|
| 167 | 167 | break; |
| 168 | 168 | |
| 169 | 169 | case 'newsletter_subject_attendee' : |
| 170 | - $path = $base_path . $msg_prefix . 'subject.template.php'; |
|
| 171 | - $contents = EEH_Template::display_template( $path, array(), true ); |
|
| 170 | + $path = $base_path.$msg_prefix.'subject.template.php'; |
|
| 171 | + $contents = EEH_Template::display_template($path, array(), true); |
|
| 172 | 172 | break; |
| 173 | 173 | } |
| 174 | 174 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | |
| 181 | 181 | |
| 182 | - public function message_types_valid_shortcodes( $valid_shortcodes, EE_Messages_Base $msg ) { |
|
| 182 | + public function message_types_valid_shortcodes($valid_shortcodes, EE_Messages_Base $msg) { |
|
| 183 | 183 | //make sure question_list and question are ONLY added for the core message types. Any other message types will have to explicitly set question_list as a valid shortcode. |
| 184 | 184 | $include_with = array( |
| 185 | 185 | 'registration', |
@@ -193,9 +193,9 @@ discard block |
||
| 193 | 193 | 'payment_reminder', |
| 194 | 194 | 'pending_approval' |
| 195 | 195 | ); |
| 196 | - if ( $msg instanceof EE_message_type && in_array( $msg->name, $include_with )) { |
|
| 196 | + if ($msg instanceof EE_message_type && in_array($msg->name, $include_with)) { |
|
| 197 | 197 | $contexts = array_keys($msg->get_contexts()); |
| 198 | - foreach ( $contexts as $context ) { |
|
| 198 | + foreach ($contexts as $context) { |
|
| 199 | 199 | $valid_shortcodes[$context][] = 'question_list'; |
| 200 | 200 | $valid_shortcodes[$context][] = 'question'; |
| 201 | 201 | } |
@@ -207,35 +207,35 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | |
| 209 | 209 | |
| 210 | - public function additional_attendee_shortcodes( $shortcodes, $shortcode_parser ) { |
|
| 210 | + public function additional_attendee_shortcodes($shortcodes, $shortcode_parser) { |
|
| 211 | 211 | $shortcodes['[ANSWER_*]'] = __('This is a special dynamic shortcode. Right after the "*", add the exact text of a existing question, and if there is an answer for that question for this registrant, that will take the place of this shortcode.', 'event_espresso'); |
| 212 | 212 | return $shortcodes; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | |
| 216 | 216 | |
| 217 | - public function additional_attendee_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
|
| 217 | + public function additional_attendee_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) { |
|
| 218 | 218 | |
| 219 | - if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) ) |
|
| 219 | + if (strpos($shortcode, '[ANSWER_*') === FALSE || ! isset($extra_data['data']->questions) || ! isset($extra_data['data']->registrations)) |
|
| 220 | 220 | return $parsed; |
| 221 | 221 | |
| 222 | 222 | //let's get the question from the code. |
| 223 | 223 | $shortcode = str_replace('[ANSWER_*', '', $shortcode); |
| 224 | - $shortcode = trim( str_replace(']', '', $shortcode) ); |
|
| 224 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
| 225 | 225 | |
| 226 | 226 | $registration = $data instanceof EE_Registration ? $data : null; |
| 227 | - $registration = ! $registration instanceof EE_Registration && is_array( $extra_data ) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Registration ? $extra_data['data'] : $registration; |
|
| 227 | + $registration = ! $registration instanceof EE_Registration && is_array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Registration ? $extra_data['data'] : $registration; |
|
| 228 | 228 | |
| 229 | 229 | $aee = $data instanceof EE_Messages_Addressee ? $data : null; |
| 230 | - $aee = ! $aee instanceof EE_Messages_Adressee && is_array( $extra_data ) && isset( $extra_data['data'] ) ? $extra_data['data'] : $aee; |
|
| 230 | + $aee = ! $aee instanceof EE_Messages_Adressee && is_array($extra_data) && isset($extra_data['data']) ? $extra_data['data'] : $aee; |
|
| 231 | 231 | |
| 232 | - if ( ! $registration instanceof EE_Registration || ! $aee instanceof EE_Messages_Addressee ) { |
|
| 232 | + if ( ! $registration instanceof EE_Registration || ! $aee instanceof EE_Messages_Addressee) { |
|
| 233 | 233 | return $parsed; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | //now let's figure out which question has this text. |
| 237 | - foreach ( $aee->questions as $ansid => $question ) { |
|
| 238 | - if ( $question->get('QST_display_text') == $shortcode && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid]) ) |
|
| 237 | + foreach ($aee->questions as $ansid => $question) { |
|
| 238 | + if ($question->get('QST_display_text') == $shortcode && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid])) |
|
| 239 | 239 | return $aee->registrations[$registration->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop'); |
| 240 | 240 | } |
| 241 | 241 | |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * @return array array of shortcodes and |
| 257 | 257 | * descriptions |
| 258 | 258 | */ |
| 259 | - public function additional_datetime_shortcodes( $shortcodes, $shortcode_parser ) { |
|
| 259 | + public function additional_datetime_shortcodes($shortcodes, $shortcode_parser) { |
|
| 260 | 260 | $shortcodes['[DTT_NAME]'] = __('This will be parsed to the Title given for a Datetime', 'event_espresso'); |
| 261 | 261 | $shortcodes['[DTT_DESCRIPTION]'] = __('This will be parsed to the description for a Datetime', 'event_espresso'); |
| 262 | 262 | $shortcodes['[DTT_NAME_OR_DATES]'] = __('When parsed, if the Datetime has a name, it is used, otherwise a formatted string including the start date and end date will be used.', 'event_espresso'); |
@@ -278,13 +278,13 @@ discard block |
||
| 278 | 278 | * @param EE_Datetime_Shortcodes $shortcode_parser |
| 279 | 279 | * @return string The new parsed string. |
| 280 | 280 | */ |
| 281 | - public function additional_datetime_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
|
| 281 | + public function additional_datetime_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) { |
|
| 282 | 282 | |
| 283 | - if ( ! $data instanceof EE_Datetime ) { |
|
| 283 | + if ( ! $data instanceof EE_Datetime) { |
|
| 284 | 284 | return ''; //get out because we can only parse with the datetime object. |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - switch ( $shortcode ) { |
|
| 287 | + switch ($shortcode) { |
|
| 288 | 288 | case '[DTT_NAME]' : |
| 289 | 289 | return $data->name(); |
| 290 | 290 | break; |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | return $data->description(); |
| 293 | 293 | break; |
| 294 | 294 | case '[DTT_NAME_OR_DATES]' : |
| 295 | - return $data->get_dtt_display_name( TRUE ); |
|
| 295 | + return $data->get_dtt_display_name(TRUE); |
|
| 296 | 296 | break; |
| 297 | 297 | default : |
| 298 | 298 | return $parsed; |
@@ -304,43 +304,43 @@ discard block |
||
| 304 | 304 | |
| 305 | 305 | |
| 306 | 306 | |
| 307 | - public function additional_recipient_details_shortcodes( $shortcodes, $shortcode_parser ) { |
|
| 307 | + public function additional_recipient_details_shortcodes($shortcodes, $shortcode_parser) { |
|
| 308 | 308 | $shortcodes['[RECIPIENT_QUESTION_LIST]'] = __('This is used to indicate where you want the list of questions and answers to show for the person receiving the message.', 'event_espresso'); |
| 309 | 309 | return $shortcodes; |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | |
| 313 | - public function additional_recipient_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
|
| 313 | + public function additional_recipient_details_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) { |
|
| 314 | 314 | |
| 315 | - if ( array($data) && ! isset( $data['data'] ) ) |
|
| 315 | + if (array($data) && ! isset($data['data'])) |
|
| 316 | 316 | return $parsed; |
| 317 | 317 | |
| 318 | 318 | $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL; |
| 319 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
| 319 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
| 320 | 320 | |
| 321 | - if ( ! $recipient instanceof EE_Messages_Addressee ) |
|
| 321 | + if ( ! $recipient instanceof EE_Messages_Addressee) |
|
| 322 | 322 | return $parsed; |
| 323 | 323 | |
| 324 | 324 | $send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data; |
| 325 | 325 | |
| 326 | - switch ( $shortcode ) { |
|
| 326 | + switch ($shortcode) { |
|
| 327 | 327 | case '[RECIPIENT_QUESTION_LIST]' : |
| 328 | - if ( ! $recipient->reg_obj instanceof EE_Registration || ! $recipient->att_obj instanceof EE_Attendee ) |
|
| 328 | + if ( ! $recipient->reg_obj instanceof EE_Registration || ! $recipient->att_obj instanceof EE_Attendee) |
|
| 329 | 329 | return ''; |
| 330 | 330 | |
| 331 | 331 | $registration = $recipient->reg_obj; |
| 332 | 332 | $attendee = $recipient->att_obj; |
| 333 | - $template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
| 333 | + $template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
| 334 | 334 | $valid_shortcodes = array('question'); |
| 335 | 335 | $shortcode_helper = $shortcode_parser->get_shortcode_helper(); |
| 336 | - $answers = !empty($recipient->registrations[$registration->ID()]['ans_objs']) ? $recipient->registrations[$registration->ID()]['ans_objs'] : array(); |
|
| 336 | + $answers = ! empty($recipient->registrations[$registration->ID()]['ans_objs']) ? $recipient->registrations[$registration->ID()]['ans_objs'] : array(); |
|
| 337 | 337 | $question_list = ''; |
| 338 | - foreach ( $answers as $answer ) { |
|
| 338 | + foreach ($answers as $answer) { |
|
| 339 | 339 | $question = $answer->question(); |
| 340 | - if ( $question instanceof EE_Question and $question->admin_only() ) { |
|
| 340 | + if ($question instanceof EE_Question and $question->admin_only()) { |
|
| 341 | 341 | continue; |
| 342 | 342 | } |
| 343 | - $question_list .= $shortcode_helper->parse_question_list_template( $template, $answer, $valid_shortcodes, $send_data); |
|
| 343 | + $question_list .= $shortcode_helper->parse_question_list_template($template, $answer, $valid_shortcodes, $send_data); |
|
| 344 | 344 | } |
| 345 | 345 | return $question_list; |
| 346 | 346 | break; |
@@ -352,41 +352,41 @@ discard block |
||
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | |
| 355 | - public function additional_primary_registration_details_shortcodes( $shortcodes, $shortcode_parser ) { |
|
| 355 | + public function additional_primary_registration_details_shortcodes($shortcodes, $shortcode_parser) { |
|
| 356 | 356 | $shortcodes['[PRIMARY_REGISTRANT_QUESTION_LIST]'] = __('This is used to indicate the questions and answers for the primary_registrant. It should be placed in the "[attendee_list]" field', 'event_espresso'); |
| 357 | 357 | return $shortcodes; |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | |
| 361 | - public function additional_primary_registration_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
|
| 362 | - if ( array($data) && ! isset( $data['data'] ) ) |
|
| 361 | + public function additional_primary_registration_details_parser($parsed, $shortcode, $data, $extra_data, $shortcode_parser) { |
|
| 362 | + if (array($data) && ! isset($data['data'])) |
|
| 363 | 363 | return $parsed; |
| 364 | 364 | |
| 365 | 365 | $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL; |
| 366 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
| 366 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset($extra_data['data']) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
|
| 367 | 367 | |
| 368 | - if ( ! $recipient instanceof EE_Messages_Addressee ) |
|
| 368 | + if ( ! $recipient instanceof EE_Messages_Addressee) |
|
| 369 | 369 | return $parsed; |
| 370 | 370 | |
| 371 | 371 | $send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data; |
| 372 | 372 | |
| 373 | - switch ( $shortcode ) { |
|
| 373 | + switch ($shortcode) { |
|
| 374 | 374 | case '[RECIPIENT_QUESTION_LIST]' : |
| 375 | - if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration ) |
|
| 375 | + if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration) |
|
| 376 | 376 | return ''; |
| 377 | 377 | $attendee = $recipient->primary_att_obj; |
| 378 | 378 | $registration = $recipient->primary_reg_obj; |
| 379 | - $template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
| 379 | + $template = is_array($data['template']) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
|
| 380 | 380 | $valid_shortcodes = array('question'); |
| 381 | 381 | $shortcode_helper = $shortcode_parser->get_shortcode_helper(); |
| 382 | 382 | $answers = $recipient->registrations[$registration->ID()]['ans_objs']; |
| 383 | 383 | $question_list = ''; |
| 384 | - foreach ( $answers as $answer ) { |
|
| 384 | + foreach ($answers as $answer) { |
|
| 385 | 385 | $question = $answer->question(); |
| 386 | - if ( $question instanceof EE_Question and $question->admin_only() ) { |
|
| 386 | + if ($question instanceof EE_Question and $question->admin_only()) { |
|
| 387 | 387 | continue; |
| 388 | 388 | } |
| 389 | - $question_list .= $shortcode_helper->parse_question_list_template( $template, $answer, $valid_shortcodes, $send_data); |
|
| 389 | + $question_list .= $shortcode_helper->parse_question_list_template($template, $answer, $valid_shortcodes, $send_data); |
|
| 390 | 390 | } |
| 391 | 391 | return $question_list; |
| 392 | 392 | break; |
@@ -411,67 +411,67 @@ discard block |
||
| 411 | 411 | $setup_args = array( |
| 412 | 412 | 'mtfilename' => 'EE_Newsletter_message_type.class.php', |
| 413 | 413 | 'autoloadpaths' => array( |
| 414 | - EE_CAF_LIBRARIES . 'messages/message_type/newsletter/' |
|
| 414 | + EE_CAF_LIBRARIES.'messages/message_type/newsletter/' |
|
| 415 | 415 | ), |
| 416 | - 'messengers_to_activate_with' => array( 'email' ), |
|
| 417 | - 'messengers_to_validate_with' => array( 'email' ) |
|
| 416 | + 'messengers_to_activate_with' => array('email'), |
|
| 417 | + 'messengers_to_validate_with' => array('email') |
|
| 418 | 418 | ); |
| 419 | - EE_Register_Message_Type::register( 'newsletter', $setup_args ); |
|
| 419 | + EE_Register_Message_Type::register('newsletter', $setup_args); |
|
| 420 | 420 | |
| 421 | 421 | //register payment reminder message type |
| 422 | 422 | $setup_args = array( |
| 423 | 423 | 'mtfilename' => 'EE_Payment_Reminder_message_type.class.php', |
| 424 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_reminder/' ), |
|
| 425 | - 'messengers_to_activate_with' => array( 'email' ), |
|
| 426 | - 'messengers_to_validate_with' => array( 'email' ) |
|
| 424 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_reminder/'), |
|
| 425 | + 'messengers_to_activate_with' => array('email'), |
|
| 426 | + 'messengers_to_validate_with' => array('email') |
|
| 427 | 427 | ); |
| 428 | - EE_Register_Message_Type::register( 'payment_reminder', $setup_args ); |
|
| 428 | + EE_Register_Message_Type::register('payment_reminder', $setup_args); |
|
| 429 | 429 | |
| 430 | 430 | //register payment declined message type |
| 431 | 431 | $setup_args = array( |
| 432 | 432 | 'mtfilename' => 'EE_Payment_Declined_message_type.class.php', |
| 433 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_declined/' ), |
|
| 434 | - 'messengers_to_activate_with' => array( 'email' ), |
|
| 435 | - 'messengers_to_validate_with' => array( 'email' ) |
|
| 433 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_declined/'), |
|
| 434 | + 'messengers_to_activate_with' => array('email'), |
|
| 435 | + 'messengers_to_validate_with' => array('email') |
|
| 436 | 436 | ); |
| 437 | - EE_Register_Message_Type::register( 'payment_declined', $setup_args ); |
|
| 437 | + EE_Register_Message_Type::register('payment_declined', $setup_args); |
|
| 438 | 438 | |
| 439 | 439 | //register registration declined message type |
| 440 | 440 | $setup_args = array( |
| 441 | 441 | 'mtfilename' => 'EE_Declined_Registration_message_type.class.php', |
| 442 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/declined_registration/' ), |
|
| 443 | - 'messengers_to_activate_with' => array( 'email' ), |
|
| 444 | - 'messengers_to_validate_with' => array( 'email' ) |
|
| 442 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/declined_registration/'), |
|
| 443 | + 'messengers_to_activate_with' => array('email'), |
|
| 444 | + 'messengers_to_validate_with' => array('email') |
|
| 445 | 445 | ); |
| 446 | - EE_Register_Message_Type::register( 'declined_registration', $setup_args ); |
|
| 446 | + EE_Register_Message_Type::register('declined_registration', $setup_args); |
|
| 447 | 447 | |
| 448 | 448 | //register registration cancelled message type |
| 449 | 449 | $setup_args = array( |
| 450 | 450 | 'mtfilename' => 'EE_Cancelled_Registration_message_type.class.php', |
| 451 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/cancelled_registration/' ), |
|
| 452 | - 'messengers_to_activate_with' => array( 'email' ), |
|
| 453 | - 'messengers_to_validate_with' => array( 'email' ) |
|
| 451 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/cancelled_registration/'), |
|
| 452 | + 'messengers_to_activate_with' => array('email'), |
|
| 453 | + 'messengers_to_validate_with' => array('email') |
|
| 454 | 454 | ); |
| 455 | - EE_Register_Message_Type::register( 'cancelled_registration', $setup_args ); |
|
| 455 | + EE_Register_Message_Type::register('cancelled_registration', $setup_args); |
|
| 456 | 456 | |
| 457 | 457 | |
| 458 | 458 | //register payment failed message type |
| 459 | 459 | $setup_args = array( |
| 460 | 460 | 'mtfilename' => 'EE_Payment_Failed_message_type.class.php', |
| 461 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_failed/' ), |
|
| 462 | - 'messengers_to_activate_with' => array( 'email' ), |
|
| 463 | - 'messengers_to_validate_with' => array( 'email' ) |
|
| 461 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_failed/'), |
|
| 462 | + 'messengers_to_activate_with' => array('email'), |
|
| 463 | + 'messengers_to_validate_with' => array('email') |
|
| 464 | 464 | ); |
| 465 | - EE_Register_Message_Type::register( 'payment_failed', $setup_args ); |
|
| 465 | + EE_Register_Message_Type::register('payment_failed', $setup_args); |
|
| 466 | 466 | |
| 467 | 467 | //register payment declined message type |
| 468 | 468 | $setup_args = array( |
| 469 | 469 | 'mtfilename' => 'EE_Payment_Cancelled_message_type.class.php', |
| 470 | - 'autoloadpaths' => array( EE_CAF_LIBRARIES . 'messages/message_type/payment_cancelled/' ), |
|
| 471 | - 'messengers_to_activate_with' => array( 'email' ), |
|
| 472 | - 'messengers_to_validate_with' => array( 'email' ) |
|
| 470 | + 'autoloadpaths' => array(EE_CAF_LIBRARIES.'messages/message_type/payment_cancelled/'), |
|
| 471 | + 'messengers_to_activate_with' => array('email'), |
|
| 472 | + 'messengers_to_validate_with' => array('email') |
|
| 473 | 473 | ); |
| 474 | - EE_Register_Message_Type::register( 'payment_cancelled', $setup_args ); |
|
| 474 | + EE_Register_Message_Type::register('payment_cancelled', $setup_args); |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | |
@@ -487,12 +487,12 @@ discard block |
||
| 487 | 487 | public function register_caf_shortcodes() { |
| 488 | 488 | $setup_args = array( |
| 489 | 489 | 'autoloadpaths' => array( |
| 490 | - EE_CAF_LIBRARIES . 'shortcodes/' |
|
| 490 | + EE_CAF_LIBRARIES.'shortcodes/' |
|
| 491 | 491 | ), |
| 492 | - 'msgr_validator_callback' => array( 'EE_Newsletter_Shortcodes', 'messenger_validator_config' ), |
|
| 493 | - 'msgr_template_fields_callback' => array( 'EE_Newsletter_Shortcodes', 'messenger_template_fields' ), |
|
| 494 | - 'list_type_shortcodes' => array( '[NEWSLETTER_CONTENT]' ) |
|
| 492 | + 'msgr_validator_callback' => array('EE_Newsletter_Shortcodes', 'messenger_validator_config'), |
|
| 493 | + 'msgr_template_fields_callback' => array('EE_Newsletter_Shortcodes', 'messenger_template_fields'), |
|
| 494 | + 'list_type_shortcodes' => array('[NEWSLETTER_CONTENT]') |
|
| 495 | 495 | ); |
| 496 | - EE_Register_Messages_Shortcode_Library::register( 'newsletter', $setup_args ); |
|
| 496 | + EE_Register_Messages_Shortcode_Library::register('newsletter', $setup_args); |
|
| 497 | 497 | } |
| 498 | 498 | } |
@@ -5,7 +5,9 @@ discard block |
||
| 5 | 5 | * @subpackage plugin api, messages |
| 6 | 6 | * @since 4.3.2 |
| 7 | 7 | */ |
| 8 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 9 | + exit('No direct script access allowed'); |
|
| 10 | +} |
|
| 9 | 11 | |
| 10 | 12 | /** |
| 11 | 13 | * Used to initialize all EE messages caffeianted functionality. |
@@ -216,8 +218,9 @@ discard block |
||
| 216 | 218 | |
| 217 | 219 | public function additional_attendee_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
| 218 | 220 | |
| 219 | - if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) ) |
|
| 220 | - return $parsed; |
|
| 221 | + if ( strpos( $shortcode, '[ANSWER_*' ) === FALSE || !isset( $extra_data['data']->questions) || !isset( $extra_data['data']->registrations) ) { |
|
| 222 | + return $parsed; |
|
| 223 | + } |
|
| 221 | 224 | |
| 222 | 225 | //let's get the question from the code. |
| 223 | 226 | $shortcode = str_replace('[ANSWER_*', '', $shortcode); |
@@ -235,8 +238,9 @@ discard block |
||
| 235 | 238 | |
| 236 | 239 | //now let's figure out which question has this text. |
| 237 | 240 | foreach ( $aee->questions as $ansid => $question ) { |
| 238 | - if ( $question->get('QST_display_text') == $shortcode && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid]) ) |
|
| 239 | - return $aee->registrations[$registration->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop'); |
|
| 241 | + if ( $question->get('QST_display_text') == $shortcode && isset($aee->registrations[$registration->ID()]['ans_objs'][$ansid]) ) { |
|
| 242 | + return $aee->registrations[$registration->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop'); |
|
| 243 | + } |
|
| 240 | 244 | } |
| 241 | 245 | |
| 242 | 246 | //nothing! |
@@ -312,21 +316,24 @@ discard block |
||
| 312 | 316 | |
| 313 | 317 | public function additional_recipient_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
| 314 | 318 | |
| 315 | - if ( array($data) && ! isset( $data['data'] ) ) |
|
| 316 | - return $parsed; |
|
| 319 | + if ( array($data) && ! isset( $data['data'] ) ) { |
|
| 320 | + return $parsed; |
|
| 321 | + } |
|
| 317 | 322 | |
| 318 | 323 | $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL; |
| 319 | 324 | $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
| 320 | 325 | |
| 321 | - if ( ! $recipient instanceof EE_Messages_Addressee ) |
|
| 322 | - return $parsed; |
|
| 326 | + if ( ! $recipient instanceof EE_Messages_Addressee ) { |
|
| 327 | + return $parsed; |
|
| 328 | + } |
|
| 323 | 329 | |
| 324 | 330 | $send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data; |
| 325 | 331 | |
| 326 | 332 | switch ( $shortcode ) { |
| 327 | 333 | case '[RECIPIENT_QUESTION_LIST]' : |
| 328 | - if ( ! $recipient->reg_obj instanceof EE_Registration || ! $recipient->att_obj instanceof EE_Attendee ) |
|
| 329 | - return ''; |
|
| 334 | + if ( ! $recipient->reg_obj instanceof EE_Registration || ! $recipient->att_obj instanceof EE_Attendee ) { |
|
| 335 | + return ''; |
|
| 336 | + } |
|
| 330 | 337 | |
| 331 | 338 | $registration = $recipient->reg_obj; |
| 332 | 339 | $attendee = $recipient->att_obj; |
@@ -359,21 +366,24 @@ discard block |
||
| 359 | 366 | |
| 360 | 367 | |
| 361 | 368 | public function additional_primary_registration_details_parser( $parsed, $shortcode, $data, $extra_data, $shortcode_parser ) { |
| 362 | - if ( array($data) && ! isset( $data['data'] ) ) |
|
| 363 | - return $parsed; |
|
| 369 | + if ( array($data) && ! isset( $data['data'] ) ) { |
|
| 370 | + return $parsed; |
|
| 371 | + } |
|
| 364 | 372 | |
| 365 | 373 | $recipient = $data['data'] instanceof EE_Messages_Addressee ? $data['data'] : NULL; |
| 366 | 374 | $recipient = ! $recipient instanceof EE_Messages_Addressee && array($extra_data) && isset( $extra_data['data'] ) && $extra_data['data'] instanceof EE_Messages_Addressee ? $extra_data['data'] : $recipient; |
| 367 | 375 | |
| 368 | - if ( ! $recipient instanceof EE_Messages_Addressee ) |
|
| 369 | - return $parsed; |
|
| 376 | + if ( ! $recipient instanceof EE_Messages_Addressee ) { |
|
| 377 | + return $parsed; |
|
| 378 | + } |
|
| 370 | 379 | |
| 371 | 380 | $send_data = ! $data['data'] instanceof EE_Messages_Addressee ? $extra_data : $data; |
| 372 | 381 | |
| 373 | 382 | switch ( $shortcode ) { |
| 374 | 383 | case '[RECIPIENT_QUESTION_LIST]' : |
| 375 | - if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration ) |
|
| 376 | - return ''; |
|
| 384 | + if ( ! $recipient->primary_att_obj instanceof EE_Attendee || ! $recipient->primary_reg_obj instanceof EE_Registration ) { |
|
| 385 | + return ''; |
|
| 386 | + } |
|
| 377 | 387 | $attendee = $recipient->primary_att_obj; |
| 378 | 388 | $registration = $recipient->primary_reg_obj; |
| 379 | 389 | $template = is_array($data['template'] ) && isset($data['template']['question_list']) ? $data['template']['question_list'] : $extra_data['template']['question_list']; |
@@ -87,19 +87,19 @@ discard block |
||
| 87 | 87 | <td> |
| 88 | 88 | <label for="event_details_control_type-default" class="ee-admin-radio-lbl"> |
| 89 | 89 | <?php $checked = $map_settings->event_details_control_type == 'default' ? 'checked="checked"' : ''; ?> |
| 90 | - <input id="event_details_control_type-default" type="radio" name="event_details_control_type" value="default"<?php echo $checked;?>/> |
|
| 90 | + <input id="event_details_control_type-default" type="radio" name="event_details_control_type" value="default"<?php echo $checked; ?>/> |
|
| 91 | 91 | <?php _e(' Default', 'event_espresso') ?> |
| 92 | 92 | </label> |
| 93 | 93 | |
| 94 | 94 | <label for="event_details_control_type-horizontal" class="ee-admin-radio-lbl"> |
| 95 | 95 | <?php $checked = $map_settings->event_details_control_type == 'horizontal' ? 'checked="checked"' : ''; ?> |
| 96 | - <input id="event_details_control_type-horizontal" type="radio" name="event_details_control_type" value="horizontal"<?php echo $checked;?>/> |
|
| 96 | + <input id="event_details_control_type-horizontal" type="radio" name="event_details_control_type" value="horizontal"<?php echo $checked; ?>/> |
|
| 97 | 97 | <?php _e(' Horizontal', 'event_espresso') ?> |
| 98 | 98 | </label> |
| 99 | 99 | |
| 100 | 100 | <label for="event_details_control_type-dropdown" class="ee-admin-radio-lbl"> |
| 101 | 101 | <?php $checked = $map_settings->event_details_control_type == 'dropdown' ? 'checked="checked"' : ''; ?> |
| 102 | - <input id="event_details_control_type-dropdown" type="radio" name="event_details_control_type" value="dropdown"<?php echo $checked;?>/> |
|
| 102 | + <input id="event_details_control_type-dropdown" type="radio" name="event_details_control_type" value="dropdown"<?php echo $checked; ?>/> |
|
| 103 | 103 | <?php _e(' Dropdown', 'event_espresso') ?> |
| 104 | 104 | </label> |
| 105 | 105 | </td> |
@@ -112,25 +112,25 @@ discard block |
||
| 112 | 112 | <td> |
| 113 | 113 | <label for="event_details_map_align-none" class="ee-admin-radio-lbl"> |
| 114 | 114 | <?php $checked = $map_settings->event_details_map_align == 'none' ? 'checked="checked"' : ''; ?> |
| 115 | - <input id="event_details_map_align-none" type="radio" name="event_details_map_align" value="none"<?php echo $checked;?>/> |
|
| 115 | + <input id="event_details_map_align-none" type="radio" name="event_details_map_align" value="none"<?php echo $checked; ?>/> |
|
| 116 | 116 | <?php _e(' None', 'event_espresso') ?> |
| 117 | 117 | </label> |
| 118 | 118 | |
| 119 | 119 | <label for="event_details_map_align-left" class="ee-admin-radio-lbl"> |
| 120 | 120 | <?php $checked = $map_settings->event_details_map_align == 'left' ? 'checked="checked"' : ''; ?> |
| 121 | - <input id="event_details_map_align-left" type="radio" name="event_details_map_align" value="left"<?php echo $checked;?>/> |
|
| 121 | + <input id="event_details_map_align-left" type="radio" name="event_details_map_align" value="left"<?php echo $checked; ?>/> |
|
| 122 | 122 | <?php _e(' Align Left', 'event_espresso') ?> |
| 123 | 123 | </label> |
| 124 | 124 | |
| 125 | 125 | <label for="event_details_map_align-center" class="ee-admin-radio-lbl"> |
| 126 | 126 | <?php $checked = $map_settings->event_details_map_align == 'center' ? 'checked="checked"' : ''; ?> |
| 127 | - <input id="event_details_map_align-center" type="radio" name="event_details_map_align" value="center"<?php echo $checked;?>/> |
|
| 127 | + <input id="event_details_map_align-center" type="radio" name="event_details_map_align" value="center"<?php echo $checked; ?>/> |
|
| 128 | 128 | <?php _e(' Align Center', 'event_espresso') ?> |
| 129 | 129 | </label> |
| 130 | 130 | |
| 131 | 131 | <label for="event_details_map_align-right" class="ee-admin-radio-lbl"> |
| 132 | 132 | <?php $checked = $map_settings->event_details_map_align == 'right' ? 'checked="checked"' : ''; ?> |
| 133 | - <input id="event_details_map_align-right" type="radio" name="event_details_map_align" value="right"<?php echo $checked;?>/> |
|
| 133 | + <input id="event_details_map_align-right" type="radio" name="event_details_map_align" value="right"<?php echo $checked; ?>/> |
|
| 134 | 134 | <?php _e(' Align Right', 'event_espresso') ?> |
| 135 | 135 | </label> |
| 136 | 136 | </td> |
@@ -205,19 +205,19 @@ discard block |
||
| 205 | 205 | <td> |
| 206 | 206 | <label for="event_list_control_type-default" class="ee-admin-radio-lbl"> |
| 207 | 207 | <?php $checked = $map_settings->event_list_control_type == 'default' ? 'checked="checked"' : ''; ?> |
| 208 | - <input id="event_list_control_type-default" type="radio" name="event_list_control_type" value="default"<?php echo $checked;?>/> |
|
| 208 | + <input id="event_list_control_type-default" type="radio" name="event_list_control_type" value="default"<?php echo $checked; ?>/> |
|
| 209 | 209 | <?php _e(' Default', 'event_espresso') ?> |
| 210 | 210 | </label> |
| 211 | 211 | |
| 212 | 212 | <label for="event_list_control_type-horizontal" class="ee-admin-radio-lbl"> |
| 213 | 213 | <?php $checked = $map_settings->event_list_control_type == 'horizontal' ? 'checked="checked"' : ''; ?> |
| 214 | - <input id="event_list_control_type-horizontal" type="radio" name="event_list_control_type" value="horizontal"<?php echo $checked;?>/> |
|
| 214 | + <input id="event_list_control_type-horizontal" type="radio" name="event_list_control_type" value="horizontal"<?php echo $checked; ?>/> |
|
| 215 | 215 | <?php _e(' Horizontal', 'event_espresso') ?> |
| 216 | 216 | </label> |
| 217 | 217 | |
| 218 | 218 | <label for="event_list_control_type-dropdown" class="ee-admin-radio-lbl"> |
| 219 | 219 | <?php $checked = $map_settings->event_list_control_type == 'dropdown' ? 'checked="checked"' : ''; ?> |
| 220 | - <input id="event_list_control_type-dropdown" type="radio" name="event_list_control_type" value="dropdown"<?php echo $checked;?>/> |
|
| 220 | + <input id="event_list_control_type-dropdown" type="radio" name="event_list_control_type" value="dropdown"<?php echo $checked; ?>/> |
|
| 221 | 221 | <?php _e(' Dropdown', 'event_espresso') ?> |
| 222 | 222 | </label> |
| 223 | 223 | |
@@ -231,25 +231,25 @@ discard block |
||
| 231 | 231 | <td> |
| 232 | 232 | <label for="event_list_map_align-none" class="ee-admin-radio-lbl"> |
| 233 | 233 | <?php $checked = $map_settings->event_list_map_align == 'none' ? 'checked="checked"' : ''; ?> |
| 234 | - <input id="event_list_map_align-none" type="radio" name="event_list_map_align" value="none"<?php echo $checked;?>/> |
|
| 234 | + <input id="event_list_map_align-none" type="radio" name="event_list_map_align" value="none"<?php echo $checked; ?>/> |
|
| 235 | 235 | <?php _e(' None', 'event_espresso') ?> |
| 236 | 236 | </label> |
| 237 | 237 | |
| 238 | 238 | <label for="event_list_map_align-left" class="ee-admin-radio-lbl"> |
| 239 | 239 | <?php $checked = $map_settings->event_list_map_align == 'left' ? 'checked="checked"' : ''; ?> |
| 240 | - <input id="event_list_map_align-left" type="radio" name="event_list_map_align" value="left"<?php echo $checked;?>/> |
|
| 240 | + <input id="event_list_map_align-left" type="radio" name="event_list_map_align" value="left"<?php echo $checked; ?>/> |
|
| 241 | 241 | <?php _e(' Align Left', 'event_espresso') ?> |
| 242 | 242 | </label> |
| 243 | 243 | |
| 244 | 244 | <label for="event_list_map_align-center" class="ee-admin-radio-lbl"> |
| 245 | 245 | <?php $checked = $map_settings->event_list_map_align == 'center' ? 'checked="checked"' : ''; ?> |
| 246 | - <input id="event_list_map_align-center" type="radio" name="event_list_map_align" value="center"<?php echo $checked;?>/> |
|
| 246 | + <input id="event_list_map_align-center" type="radio" name="event_list_map_align" value="center"<?php echo $checked; ?>/> |
|
| 247 | 247 | <?php _e(' Align Center', 'event_espresso') ?> |
| 248 | 248 | </label> |
| 249 | 249 | |
| 250 | 250 | <label for="event_list_map_align-right" class="ee-admin-radio-lbl"> |
| 251 | 251 | <?php $checked = $map_settings->event_list_map_align == 'right' ? 'checked="checked"' : ''; ?> |
| 252 | - <input id="event_list_map_align-right" type="radio" name="event_list_map_align" value="right"<?php echo $checked;?>/> |
|
| 252 | + <input id="event_list_map_align-right" type="radio" name="event_list_map_align" value="right"<?php echo $checked; ?>/> |
|
| 253 | 253 | <?php _e(' Align Right', 'event_espresso') ?> |
| 254 | 254 | </label> |
| 255 | 255 | |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <div class="padding"> |
| 2 | 2 | |
| 3 | - <?php do_action( 'AHEE__template_settings__template__before_settings_form' ); ?> |
|
| 3 | + <?php do_action('AHEE__template_settings__template__before_settings_form'); ?> |
|
| 4 | 4 | |
| 5 | 5 | </div> |
| 6 | 6 | \ No newline at end of file |
@@ -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 | |
| 32 | 32 | class Venues_Admin_List_Table extends EE_Admin_List_Table { |
| 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->_admin_page->get_venues( $this->_per_page); |
|
| 43 | - $this->_all_data_count = $this->_admin_page->get_venues( $this->_per_page, TRUE ); |
|
| 42 | + $this->_data = $this->_admin_page->get_venues($this->_per_page); |
|
| 43 | + $this->_all_data_count = $this->_admin_page->get_venues($this->_per_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' => __('Event Venue', 'event_espresso' ), |
|
| 53 | - 'plural' => __('Event Venues', 'event_espresso' ), |
|
| 52 | + 'singular' => __('Event Venue', 'event_espresso'), |
|
| 53 | + 'plural' => __('Event Venues', 'event_espresso'), |
|
| 54 | 54 | 'ajax' => TRUE, //for now, |
| 55 | 55 | 'screen' => $this->_admin_page->get_current_screen()->id |
| 56 | 56 | ); |
@@ -66,10 +66,10 @@ discard block |
||
| 66 | 66 | ); |
| 67 | 67 | |
| 68 | 68 | $this->_sortable_columns = array( |
| 69 | - 'id' => array( 'id' => true ), |
|
| 70 | - 'name' => array( 'name' => false ), |
|
| 71 | - 'city' => array( 'city' => false ), |
|
| 72 | - 'capacity' => array( 'capacity' => false ) |
|
| 69 | + 'id' => array('id' => true), |
|
| 70 | + 'name' => array('name' => false), |
|
| 71 | + 'city' => array('city' => false), |
|
| 72 | + 'capacity' => array('capacity' => false) |
|
| 73 | 73 | ); |
| 74 | 74 | |
| 75 | 75 | $this->_hidden_columns = array(); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | public function column_cb($item) { |
| 102 | 102 | |
| 103 | - return $item->count_related('Event') > 0 ? '<span class="ee-lock-icon"></span>' : sprintf( '<input type="checkbox" name="venue_id[]" value="%s" />', $item->ID()); |
|
| 103 | + return $item->count_related('Event') > 0 ? '<span class="ee-lock-icon"></span>' : sprintf('<input type="checkbox" name="venue_id[]" value="%s" />', $item->ID()); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -122,23 +122,23 @@ discard block |
||
| 122 | 122 | 'post' => $item->ID() |
| 123 | 123 | ); |
| 124 | 124 | |
| 125 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EE_VENUES_ADMIN_URL ); |
|
| 126 | - $delete_link = EE_Admin_Page::add_query_args_and_nonce( $delete_query_args, EE_VENUES_ADMIN_URL ); |
|
| 125 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL); |
|
| 126 | + $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_VENUES_ADMIN_URL); |
|
| 127 | 127 | |
| 128 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_venue', 'espresso_venues_edit', $item->ID() ) ) { |
|
| 128 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_venue', 'espresso_venues_edit', $item->ID())) { |
|
| 129 | 129 | $actions = array( |
| 130 | - 'edit' => '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Venue', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>' |
|
| 130 | + 'edit' => '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Venue', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>' |
|
| 131 | 131 | ); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - if ( $item->count_related('Event') === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venue', 'espresso_venues_delete_venue', $item->ID() ) ) { |
|
| 135 | - $actions['delete'] = '<a href="' . $delete_link . '" title="' . esc_attr__('Delete Venue', 'event_espresso') . '">' . __('Delete', 'event_espresso') . '</a>'; |
|
| 134 | + if ($item->count_related('Event') === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_venue', 'espresso_venues_delete_venue', $item->ID())) { |
|
| 135 | + $actions['delete'] = '<a href="'.$delete_link.'" title="'.esc_attr__('Delete Venue', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>'; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | $statuses = EEM_Venue::instance()->get_status_array(); |
| 139 | 139 | |
| 140 | - $content = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_venue', 'espresso_venues_edit', $item->ID() ) ? '<strong><a class="row-title" href="' . $edit_link . '">' . stripslashes_deep($item->name()) . '</a></strong>' : $item->name(); |
|
| 141 | - $content .= $item->status() == 'draft' ? ' - <span class="post-state">' . $statuses['draft'] . '</span>' : ''; |
|
| 140 | + $content = EE_Registry::instance()->CAP->current_user_can('ee_edit_venue', 'espresso_venues_edit', $item->ID()) ? '<strong><a class="row-title" href="'.$edit_link.'">'.stripslashes_deep($item->name()).'</a></strong>' : $item->name(); |
|
| 141 | + $content .= $item->status() == 'draft' ? ' - <span class="post-state">'.$statuses['draft'].'</span>' : ''; |
|
| 142 | 142 | $content .= $this->row_actions($actions); |
| 143 | 143 | return $content; |
| 144 | 144 | } |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | |
| 166 | 166 | public function column_shortcode($item) { |
| 167 | - $content = '[ESPRESSO_VENUE id=' . $item->ID() . ']'; |
|
| 167 | + $content = '[ESPRESSO_VENUE id='.$item->ID().']'; |
|
| 168 | 168 | return $content; |
| 169 | 169 | } |
| 170 | 170 | |
@@ -1,6 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | +} |
|
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * Event Espresso |
@@ -65,18 +65,18 @@ discard block |
||
| 65 | 65 | * @param WP_Query $wp |
| 66 | 66 | * @return \EE_Request_Handler |
| 67 | 67 | */ |
| 68 | - public function __construct( $wp = NULL ) { |
|
| 68 | + public function __construct($wp = NULL) { |
|
| 69 | 69 | //if somebody forgot to provide us with WP, that's ok because its global |
| 70 | - if( ! $wp){ |
|
| 70 | + if ( ! $wp) { |
|
| 71 | 71 | global $wp; |
| 72 | 72 | } |
| 73 | 73 | // grab request vars |
| 74 | 74 | $this->_params = $_REQUEST; |
| 75 | 75 | // AJAX ??? |
| 76 | - $this->ajax = defined( 'DOING_AJAX' ) ? TRUE : FALSE; |
|
| 77 | - $this->front_ajax = $this->is_set( 'ee_front_ajax' ) && $this->get( 'ee_front_ajax' ) == 1 ? TRUE : FALSE; |
|
| 78 | - $this->set_request_vars( $wp ); |
|
| 79 | - do_action( 'AHEE__EE_Request_Handler__construct__complete' ); |
|
| 76 | + $this->ajax = defined('DOING_AJAX') ? TRUE : FALSE; |
|
| 77 | + $this->front_ajax = $this->is_set('ee_front_ajax') && $this->get('ee_front_ajax') == 1 ? TRUE : FALSE; |
|
| 78 | + $this->set_request_vars($wp); |
|
| 79 | + do_action('AHEE__EE_Request_Handler__construct__complete'); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | * @param WP_Query $wp |
| 89 | 89 | * @return void |
| 90 | 90 | */ |
| 91 | - public function set_request_vars( $wp = NULL ) { |
|
| 92 | - if ( ! is_admin() ) { |
|
| 91 | + public function set_request_vars($wp = NULL) { |
|
| 92 | + if ( ! is_admin()) { |
|
| 93 | 93 | // set request post_id |
| 94 | - $this->set( 'post_id', $this->get_post_id_from_request( $wp )); |
|
| 94 | + $this->set('post_id', $this->get_post_id_from_request($wp)); |
|
| 95 | 95 | // set request post name |
| 96 | - $this->set( 'post_name', $this->get_post_name_from_request( $wp )); |
|
| 96 | + $this->set('post_name', $this->get_post_name_from_request($wp)); |
|
| 97 | 97 | // set request post_type |
| 98 | - $this->set( 'post_type', $this->get_post_type_from_request( $wp )); |
|
| 98 | + $this->set('post_type', $this->get_post_type_from_request($wp)); |
|
| 99 | 99 | // TRUE or FALSE ? is this page being used by EE ? |
| 100 | 100 | $this->set_espresso_page(); |
| 101 | 101 | } |
@@ -110,20 +110,20 @@ discard block |
||
| 110 | 110 | * @param WP_Query $wp |
| 111 | 111 | * @return int |
| 112 | 112 | */ |
| 113 | - public function get_post_id_from_request( $wp = NULL ) { |
|
| 114 | - if( ! $wp){ |
|
| 113 | + public function get_post_id_from_request($wp = NULL) { |
|
| 114 | + if ( ! $wp) { |
|
| 115 | 115 | global $wp; |
| 116 | 116 | } |
| 117 | 117 | $post_id = NULL; |
| 118 | - if ( isset( $wp->query_vars['p'] )) { |
|
| 118 | + if (isset($wp->query_vars['p'])) { |
|
| 119 | 119 | $post_id = $wp->query_vars['p']; |
| 120 | 120 | } |
| 121 | - if ( ! $post_id && isset( $wp->query_vars['page_id'] )) { |
|
| 121 | + if ( ! $post_id && isset($wp->query_vars['page_id'])) { |
|
| 122 | 122 | $post_id = $wp->query_vars['page_id']; |
| 123 | 123 | } |
| 124 | - if ( ! $post_id && isset( $wp->request )) { |
|
| 125 | - if ( is_numeric( basename( $wp->request ))) { |
|
| 126 | - $post_id = basename( $wp->request ); |
|
| 124 | + if ( ! $post_id && isset($wp->request)) { |
|
| 125 | + if (is_numeric(basename($wp->request))) { |
|
| 126 | + $post_id = basename($wp->request); |
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | return $post_id; |
@@ -138,35 +138,35 @@ discard block |
||
| 138 | 138 | * @param WP_Query $wp |
| 139 | 139 | * @return string |
| 140 | 140 | */ |
| 141 | - public function get_post_name_from_request( $wp = NULL ) { |
|
| 142 | - if( ! $wp){ |
|
| 141 | + public function get_post_name_from_request($wp = NULL) { |
|
| 142 | + if ( ! $wp) { |
|
| 143 | 143 | global $wp; |
| 144 | 144 | } |
| 145 | 145 | $post_name = NULL; |
| 146 | - if ( isset( $wp->query_vars['name'] ) && ! empty( $wp->query_vars['name'] )) { |
|
| 146 | + if (isset($wp->query_vars['name']) && ! empty($wp->query_vars['name'])) { |
|
| 147 | 147 | $post_name = $wp->query_vars['name']; |
| 148 | 148 | } |
| 149 | - if ( ! $post_name && isset( $wp->query_vars['pagename'] ) && ! empty( $wp->query_vars['pagename'] )) { |
|
| 149 | + if ( ! $post_name && isset($wp->query_vars['pagename']) && ! empty($wp->query_vars['pagename'])) { |
|
| 150 | 150 | $post_name = $wp->query_vars['pagename']; |
| 151 | 151 | } |
| 152 | - if ( ! $post_name && isset( $wp->request ) && ! empty( $wp->request )) { |
|
| 153 | - $possible_post_name = basename( $wp->request ); |
|
| 154 | - if ( ! is_numeric( $possible_post_name )) { |
|
| 152 | + if ( ! $post_name && isset($wp->request) && ! empty($wp->request)) { |
|
| 153 | + $possible_post_name = basename($wp->request); |
|
| 154 | + if ( ! is_numeric($possible_post_name)) { |
|
| 155 | 155 | /** @type WPDB $wpdb */ |
| 156 | 156 | global $wpdb; |
| 157 | - $SQL = 'SELECT ID from ' . $wpdb->posts . ' WHERE post_status="publish" AND post_name=%d'; |
|
| 158 | - $possible_post_name = $wpdb->get_var( $wpdb->prepare( $SQL, $possible_post_name )); |
|
| 159 | - if ( $possible_post_name ) { |
|
| 157 | + $SQL = 'SELECT ID from '.$wpdb->posts.' WHERE post_status="publish" AND post_name=%d'; |
|
| 158 | + $possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $possible_post_name)); |
|
| 159 | + if ($possible_post_name) { |
|
| 160 | 160 | $post_name = $possible_post_name; |
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | - if ( ! $post_name && $this->get( 'post_id' )) { |
|
| 164 | + if ( ! $post_name && $this->get('post_id')) { |
|
| 165 | 165 | /** @type WPDB $wpdb */ |
| 166 | 166 | global $wpdb; |
| 167 | - $SQL = 'SELECT post_name from ' . $wpdb->posts . ' WHERE post_status="publish" AND ID=%d'; |
|
| 168 | - $possible_post_name = $wpdb->get_var( $wpdb->prepare( $SQL, $this->get( 'post_id' ))); |
|
| 169 | - if( $possible_post_name ) { |
|
| 167 | + $SQL = 'SELECT post_name from '.$wpdb->posts.' WHERE post_status="publish" AND ID=%d'; |
|
| 168 | + $possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $this->get('post_id'))); |
|
| 169 | + if ($possible_post_name) { |
|
| 170 | 170 | $post_name = $possible_post_name; |
| 171 | 171 | } |
| 172 | 172 | } |
@@ -182,11 +182,11 @@ discard block |
||
| 182 | 182 | * @param WP_Query $wp |
| 183 | 183 | * @return mixed |
| 184 | 184 | */ |
| 185 | - public function get_post_type_from_request( $wp = NULL ) { |
|
| 186 | - if( ! $wp){ |
|
| 185 | + public function get_post_type_from_request($wp = NULL) { |
|
| 186 | + if ( ! $wp) { |
|
| 187 | 187 | global $wp; |
| 188 | 188 | } |
| 189 | - return isset( $wp->query_vars['post_type'] ) ? $wp->query_vars['post_type'] : NULL; |
|
| 189 | + return isset($wp->query_vars['post_type']) ? $wp->query_vars['post_type'] : NULL; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | |
@@ -199,30 +199,30 @@ discard block |
||
| 199 | 199 | public function test_for_espresso_page() { |
| 200 | 200 | // load espresso CPT endpoints |
| 201 | 201 | $espresso_CPT_endpoints = EE_Registry::instance()->load_core('CPT_Strategy')->get_CPT_endpoints(); |
| 202 | - $post_type_CPT_endpoints = array_flip( $espresso_CPT_endpoints ); |
|
| 203 | - $post_types = (array)$this->get( 'post_type' ); |
|
| 204 | - foreach ( $post_types as $post_type ) { |
|
| 202 | + $post_type_CPT_endpoints = array_flip($espresso_CPT_endpoints); |
|
| 203 | + $post_types = (array) $this->get('post_type'); |
|
| 204 | + foreach ($post_types as $post_type) { |
|
| 205 | 205 | // was a post name passed ? |
| 206 | - if ( isset( $post_type_CPT_endpoints[ $post_type ] ) ) { |
|
| 206 | + if (isset($post_type_CPT_endpoints[$post_type])) { |
|
| 207 | 207 | // kk we know this is an espresso page, but is it a specific post ? |
| 208 | - if ( ! $this->get( 'post_name' ) ) { |
|
| 208 | + if ( ! $this->get('post_name')) { |
|
| 209 | 209 | // there's no specific post name set, so maybe it's one of our endpoints like www.domain.com/events |
| 210 | - $post_name = isset( $post_type_CPT_endpoints[ $this->get( 'post_type' ) ] ) ? $post_type_CPT_endpoints[ $this->get( 'post_type' ) ] : NULL; |
|
| 210 | + $post_name = isset($post_type_CPT_endpoints[$this->get('post_type')]) ? $post_type_CPT_endpoints[$this->get('post_type')] : NULL; |
|
| 211 | 211 | // if the post type matches on of our then set the endpoint |
| 212 | - if ( $post_name ) { |
|
| 213 | - $this->set( 'post_name', $post_name ); |
|
| 212 | + if ($post_name) { |
|
| 213 | + $this->set('post_name', $post_name); |
|
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | return TRUE; |
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | - if ( $this->get( 'post_name' )) { |
|
| 219 | + if ($this->get('post_name')) { |
|
| 220 | 220 | // load all pages using espresso shortcodes |
| 221 | - $post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
| 221 | + $post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
| 222 | 222 | // make sure core pages are included |
| 223 | - $espresso_pages = array_merge( $espresso_CPT_endpoints, $post_shortcodes ); |
|
| 223 | + $espresso_pages = array_merge($espresso_CPT_endpoints, $post_shortcodes); |
|
| 224 | 224 | // was a post name passed ? |
| 225 | - if ( isset( $espresso_pages[ $this->get( 'post_name' ) ] )) { |
|
| 225 | + if (isset($espresso_pages[$this->get('post_name')])) { |
|
| 226 | 226 | return TRUE; |
| 227 | 227 | } |
| 228 | 228 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | * @param null $value |
| 239 | 239 | * @return mixed |
| 240 | 240 | */ |
| 241 | - public function set_espresso_page( $value = NULL ) { |
|
| 241 | + public function set_espresso_page($value = NULL) { |
|
| 242 | 242 | $value = $value ? $value : $this->test_for_espresso_page(); |
| 243 | 243 | $this->_params['is_espresso_page'] = $value; |
| 244 | 244 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * @return mixed |
| 253 | 253 | */ |
| 254 | 254 | public function is_espresso_page() { |
| 255 | - return isset( $this->_params['is_espresso_page'] ) ? $this->_params['is_espresso_page'] : FALSE; |
|
| 255 | + return isset($this->_params['is_espresso_page']) ? $this->_params['is_espresso_page'] : FALSE; |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | |
@@ -276,10 +276,10 @@ discard block |
||
| 276 | 276 | * @param bool $override_ee |
| 277 | 277 | * @return void |
| 278 | 278 | */ |
| 279 | - public function set( $key, $value, $override_ee = FALSE ) { |
|
| 279 | + public function set($key, $value, $override_ee = FALSE) { |
|
| 280 | 280 | // don't allow "ee" to be overwritten unless explicitly instructed to do so |
| 281 | - if ( $key != 'ee' || ( $key == 'ee' && empty( $this->_params['ee'] )) || ( $key == 'ee' && ! empty( $this->_params['ee'] ) && $override_ee )) { |
|
| 282 | - $this->_params[ $key ] = $value; |
|
| 281 | + if ($key != 'ee' || ($key == 'ee' && empty($this->_params['ee'])) || ($key == 'ee' && ! empty($this->_params['ee']) && $override_ee)) { |
|
| 282 | + $this->_params[$key] = $value; |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | |
@@ -293,8 +293,8 @@ discard block |
||
| 293 | 293 | * @param null $default |
| 294 | 294 | * @return mixed |
| 295 | 295 | */ |
| 296 | - public function get( $key, $default = NULL ) { |
|
| 297 | - return isset( $this->_params[ $key ] ) ? $this->_params[ $key ] : $default; |
|
| 296 | + public function get($key, $default = NULL) { |
|
| 297 | + return isset($this->_params[$key]) ? $this->_params[$key] : $default; |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | |
@@ -306,8 +306,8 @@ discard block |
||
| 306 | 306 | * @param $key |
| 307 | 307 | * @return boolean |
| 308 | 308 | */ |
| 309 | - public function is_set( $key ) { |
|
| 310 | - return isset( $this->_params[ $key ] ) ? TRUE : FALSE; |
|
| 309 | + public function is_set($key) { |
|
| 310 | + return isset($this->_params[$key]) ? TRUE : FALSE; |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | |
@@ -319,8 +319,8 @@ discard block |
||
| 319 | 319 | * @param $key |
| 320 | 320 | * @return void |
| 321 | 321 | */ |
| 322 | - public function un_set( $key ) { |
|
| 323 | - unset( $this->_params[ $key ] ); |
|
| 322 | + public function un_set($key) { |
|
| 323 | + unset($this->_params[$key]); |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | |
@@ -333,8 +333,8 @@ discard block |
||
| 333 | 333 | * @param $value |
| 334 | 334 | * @return void |
| 335 | 335 | */ |
| 336 | - public function set_notice( $key, $value ) { |
|
| 337 | - $this->_notice[ $key ] = $value; |
|
| 336 | + public function set_notice($key, $value) { |
|
| 337 | + $this->_notice[$key] = $value; |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | |
@@ -346,8 +346,8 @@ discard block |
||
| 346 | 346 | * @param $key |
| 347 | 347 | * @return mixed |
| 348 | 348 | */ |
| 349 | - public function get_notice( $key ) { |
|
| 350 | - return isset( $this->_notice[ $key ] ) ? $this->_notice[ $key ] : NULL; |
|
| 349 | + public function get_notice($key) { |
|
| 350 | + return isset($this->_notice[$key]) ? $this->_notice[$key] : NULL; |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | * @param $string |
| 360 | 360 | * @return void |
| 361 | 361 | */ |
| 362 | - public function add_output( $string ) { |
|
| 362 | + public function add_output($string) { |
|
| 363 | 363 | $this->_output .= $string; |
| 364 | 364 | } |
| 365 | 365 | |
@@ -381,8 +381,8 @@ discard block |
||
| 381 | 381 | * @param $item |
| 382 | 382 | * @param $key |
| 383 | 383 | */ |
| 384 | - function sanitize_text_field_for_array_walk( &$item, &$key ) { |
|
| 385 | - $item = strpos( $item, 'email' ) !== FALSE ? sanitize_email( $item ) : sanitize_text_field( $item ); |
|
| 384 | + function sanitize_text_field_for_array_walk(&$item, &$key) { |
|
| 385 | + $item = strpos($item, 'email') !== FALSE ? sanitize_email($item) : sanitize_text_field($item); |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | * @param $b |
| 393 | 393 | * @return bool |
| 394 | 394 | */ |
| 395 | - public function __set($a,$b) { return FALSE; } |
|
| 395 | + public function __set($a, $b) { return FALSE; } |
|
| 396 | 396 | |
| 397 | 397 | |
| 398 | 398 | |
@@ -1,4 +1,6 @@ |
||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * Event Espresso |
| 4 | 6 | * |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
| 2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
| 2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Class EE_Registration_Processor |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public static function instance() { |
| 48 | 48 | // check if class object is instantiated |
| 49 | - if ( ! self::$_instance instanceof EE_Registration_Processor ) { |
|
| 49 | + if ( ! self::$_instance instanceof EE_Registration_Processor) { |
|
| 50 | 50 | self::$_instance = new self(); |
| 51 | 51 | } |
| 52 | 52 | return self::$_instance; |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | * @param EE_Line_Item | string $item |
| 70 | 70 | * @return string |
| 71 | 71 | */ |
| 72 | - public function generate_reg_url_link( $att_nmbr, $item ) { |
|
| 73 | - return $item instanceof EE_Line_Item ? $att_nmbr . '-' . $item->code() : $att_nmbr . '-' . $item; |
|
| 72 | + public function generate_reg_url_link($att_nmbr, $item) { |
|
| 73 | + return $item instanceof EE_Line_Item ? $att_nmbr.'-'.$item->code() : $att_nmbr.'-'.$item; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
@@ -81,18 +81,18 @@ discard block |
||
| 81 | 81 | * @param \EE_Registration $registration |
| 82 | 82 | * @return string |
| 83 | 83 | */ |
| 84 | - public function generate_reg_code( EE_Registration $registration ) { |
|
| 84 | + public function generate_reg_code(EE_Registration $registration) { |
|
| 85 | 85 | // figure out where to start parsing the reg code |
| 86 | - $chars = strpos( $registration->reg_url_link(), '-' ) + 4; |
|
| 86 | + $chars = strpos($registration->reg_url_link(), '-') + 4; |
|
| 87 | 87 | // TXN_ID + TKT_ID + first 3 and last 3 chars of reg_url_link |
| 88 | 88 | $new_reg_code = array( |
| 89 | 89 | $registration->transaction_ID(), |
| 90 | 90 | $registration->ticket_ID(), |
| 91 | - substr( $registration->reg_url_link(), 0, $chars ) . substr( $registration->reg_url_link(), - 3 ) |
|
| 91 | + substr($registration->reg_url_link(), 0, $chars).substr($registration->reg_url_link(), - 3) |
|
| 92 | 92 | ); |
| 93 | 93 | // now put it all together |
| 94 | - $new_reg_code = implode( '-', $new_reg_code ); |
|
| 95 | - return apply_filters( 'FHEE__EE_Registration_Processor___generate_reg_code__new_reg_code', $new_reg_code, $registration ); |
|
| 94 | + $new_reg_code = implode('-', $new_reg_code); |
|
| 95 | + return apply_filters('FHEE__EE_Registration_Processor___generate_reg_code__new_reg_code', $new_reg_code, $registration); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | * @param int $REG_ID |
| 102 | 102 | * @return string |
| 103 | 103 | */ |
| 104 | - public function old_reg_status( $REG_ID ) { |
|
| 105 | - return isset( $this->_old_reg_status[ $REG_ID ] ) ? $this->_old_reg_status[ $REG_ID ] : null; |
|
| 104 | + public function old_reg_status($REG_ID) { |
|
| 105 | + return isset($this->_old_reg_status[$REG_ID]) ? $this->_old_reg_status[$REG_ID] : null; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -111,10 +111,10 @@ discard block |
||
| 111 | 111 | * @param int $REG_ID |
| 112 | 112 | * @param string $old_reg_status |
| 113 | 113 | */ |
| 114 | - public function set_old_reg_status( $REG_ID, $old_reg_status ) { |
|
| 114 | + public function set_old_reg_status($REG_ID, $old_reg_status) { |
|
| 115 | 115 | // only set the first time |
| 116 | - if ( ! isset( $this->_old_reg_status[ $REG_ID ] ) ) { |
|
| 117 | - $this->_old_reg_status[ $REG_ID ] = $old_reg_status; |
|
| 116 | + if ( ! isset($this->_old_reg_status[$REG_ID])) { |
|
| 117 | + $this->_old_reg_status[$REG_ID] = $old_reg_status; |
|
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | |
@@ -124,8 +124,8 @@ discard block |
||
| 124 | 124 | * @param int $REG_ID |
| 125 | 125 | * @return string |
| 126 | 126 | */ |
| 127 | - public function new_reg_status( $REG_ID ) { |
|
| 128 | - return isset( $this->_new_reg_status[ $REG_ID ] ) ? $this->_new_reg_status[ $REG_ID ] : null; |
|
| 127 | + public function new_reg_status($REG_ID) { |
|
| 128 | + return isset($this->_new_reg_status[$REG_ID]) ? $this->_new_reg_status[$REG_ID] : null; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | |
@@ -134,8 +134,8 @@ discard block |
||
| 134 | 134 | * @param int $REG_ID |
| 135 | 135 | * @param string $new_reg_status |
| 136 | 136 | */ |
| 137 | - public function set_new_reg_status( $REG_ID, $new_reg_status ) { |
|
| 138 | - $this->_new_reg_status[ $REG_ID ] = $new_reg_status; |
|
| 137 | + public function set_new_reg_status($REG_ID, $new_reg_status) { |
|
| 138 | + $this->_new_reg_status[$REG_ID] = $new_reg_status; |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | |
@@ -146,8 +146,8 @@ discard block |
||
| 146 | 146 | * @param int $REG_ID |
| 147 | 147 | * @return bool |
| 148 | 148 | */ |
| 149 | - public function reg_status_updated( $REG_ID ) { |
|
| 150 | - return $this->new_reg_status( $REG_ID ) !== $this->old_reg_status( $REG_ID ) ? true : false; |
|
| 149 | + public function reg_status_updated($REG_ID) { |
|
| 150 | + return $this->new_reg_status($REG_ID) !== $this->old_reg_status($REG_ID) ? true : false; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
@@ -161,24 +161,24 @@ discard block |
||
| 161 | 161 | * @param bool $save TRUE will save the registration if the status is updated, FALSE will leave that up to client code |
| 162 | 162 | * @return boolean |
| 163 | 163 | */ |
| 164 | - public function manually_update_registration_status( EE_Registration $registration, $new_reg_status = '', $save = true ) { |
|
| 164 | + public function manually_update_registration_status(EE_Registration $registration, $new_reg_status = '', $save = true) { |
|
| 165 | 165 | // set initial REG_Status |
| 166 | - $this->set_old_reg_status( $registration->ID(), $registration->status_ID() ); |
|
| 166 | + $this->set_old_reg_status($registration->ID(), $registration->status_ID()); |
|
| 167 | 167 | // set incoming REG_Status |
| 168 | - $this->set_new_reg_status( $registration->ID(), $new_reg_status ); |
|
| 168 | + $this->set_new_reg_status($registration->ID(), $new_reg_status); |
|
| 169 | 169 | // toggle reg status but only if it has changed and the user can do so |
| 170 | - if ( $this->reg_status_updated( $registration->ID() ) && EE_Registry::instance()->CAP->current_user_can( |
|
| 170 | + if ($this->reg_status_updated($registration->ID()) && EE_Registry::instance()->CAP->current_user_can( |
|
| 171 | 171 | 'ee_edit_registration', |
| 172 | 172 | 'toggle_registration_status', $registration->ID() )) { |
| 173 | 173 | // change status to new value |
| 174 | - if ( $registration->set_status( $this->new_reg_status( $registration->ID() ) )) { |
|
| 175 | - if ( $save ) { |
|
| 174 | + if ($registration->set_status($this->new_reg_status($registration->ID()))) { |
|
| 175 | + if ($save) { |
|
| 176 | 176 | $registration->save(); |
| 177 | 177 | } |
| 178 | 178 | // send messages |
| 179 | 179 | $this->trigger_registration_update_notifications( |
| 180 | 180 | $registration, |
| 181 | - array( 'manually_updated' => true ) |
|
| 181 | + array('manually_updated' => true) |
|
| 182 | 182 | ); |
| 183 | 183 | } |
| 184 | 184 | return TRUE; |
@@ -198,27 +198,27 @@ discard block |
||
| 198 | 198 | * @param bool $save TRUE will save the registration if the status is updated, FALSE will leave that up to client code |
| 199 | 199 | * @return void |
| 200 | 200 | */ |
| 201 | - public function toggle_incomplete_registration_status_to_default( EE_Registration $registration, $save = TRUE ) { |
|
| 201 | + public function toggle_incomplete_registration_status_to_default(EE_Registration $registration, $save = TRUE) { |
|
| 202 | 202 | // set initial REG_Status |
| 203 | - $this->set_old_reg_status( $registration->ID(), $registration->status_ID() ); |
|
| 203 | + $this->set_old_reg_status($registration->ID(), $registration->status_ID()); |
|
| 204 | 204 | // is the registration currently incomplete ? |
| 205 | - if ( $registration->status_ID() === EEM_Registration::status_id_incomplete ) { |
|
| 205 | + if ($registration->status_ID() === EEM_Registration::status_id_incomplete) { |
|
| 206 | 206 | // grab default reg status for the event, if set |
| 207 | 207 | $event_default_registration_status = $registration->event()->default_registration_status(); |
| 208 | 208 | // if no default reg status is set for the event, then use the global value |
| 209 | - $STS_ID = ! empty( $event_default_registration_status ) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID; |
|
| 209 | + $STS_ID = ! empty($event_default_registration_status) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID; |
|
| 210 | 210 | // if the event default reg status is approved, then downgrade temporarily to payment pending to ensure that payments are triggered |
| 211 | 211 | $STS_ID = $STS_ID === EEM_Registration::status_id_approved ? EEM_Registration::status_id_pending_payment : $STS_ID; |
| 212 | 212 | // set incoming REG_Status |
| 213 | - $this->set_new_reg_status( $registration->ID(), $STS_ID ); |
|
| 214 | - $registration->set_status( $STS_ID ); |
|
| 215 | - if ( $save ) { |
|
| 213 | + $this->set_new_reg_status($registration->ID(), $STS_ID); |
|
| 214 | + $registration->set_status($STS_ID); |
|
| 215 | + if ($save) { |
|
| 216 | 216 | $registration->save(); |
| 217 | 217 | } |
| 218 | 218 | // don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor |
| 219 | - if ( ! EE_Processor_Base::$IPN ) { |
|
| 219 | + if ( ! EE_Processor_Base::$IPN) { |
|
| 220 | 220 | // otherwise, send out notifications |
| 221 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
| 221 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
| 222 | 222 | } |
| 223 | 223 | // DEBUG LOG |
| 224 | 224 | //$this->log( |
@@ -242,25 +242,25 @@ discard block |
||
| 242 | 242 | * @param bool $save TRUE will save the registration if the status is updated, FALSE will leave that up to client code |
| 243 | 243 | * @return boolean |
| 244 | 244 | */ |
| 245 | - public function toggle_registration_status_for_default_approved_events( EE_Registration $registration, $save = TRUE ) { |
|
| 245 | + public function toggle_registration_status_for_default_approved_events(EE_Registration $registration, $save = TRUE) { |
|
| 246 | 246 | // set initial REG_Status |
| 247 | - $this->set_old_reg_status( $registration->ID(), $registration->status_ID() ); |
|
| 247 | + $this->set_old_reg_status($registration->ID(), $registration->status_ID()); |
|
| 248 | 248 | // if not already, toggle reg status to approved IF the event default reg status is approved |
| 249 | 249 | if ( |
| 250 | 250 | $registration->status_ID() !== EEM_Registration::status_id_approved && |
| 251 | 251 | $registration->event()->default_registration_status() == EEM_Registration::status_id_approved |
| 252 | 252 | ) { |
| 253 | 253 | // set incoming REG_Status |
| 254 | - $this->set_new_reg_status( $registration->ID(), EEM_Registration::status_id_approved ); |
|
| 254 | + $this->set_new_reg_status($registration->ID(), EEM_Registration::status_id_approved); |
|
| 255 | 255 | // toggle status to approved |
| 256 | - $registration->set_status( EEM_Registration::status_id_approved ); |
|
| 257 | - if ( $save ) { |
|
| 256 | + $registration->set_status(EEM_Registration::status_id_approved); |
|
| 257 | + if ($save) { |
|
| 258 | 258 | $registration->save(); |
| 259 | 259 | } |
| 260 | 260 | // don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor |
| 261 | - if ( ! EE_Processor_Base::$IPN ) { |
|
| 261 | + if ( ! EE_Processor_Base::$IPN) { |
|
| 262 | 262 | // otherwise, send out notifications |
| 263 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
| 263 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
| 264 | 264 | } |
| 265 | 265 | // DEBUG LOG |
| 266 | 266 | //$this->log( |
@@ -285,27 +285,27 @@ discard block |
||
| 285 | 285 | * @param bool $save TRUE will save the registration if the status is updated, FALSE will leave that up to client code |
| 286 | 286 | * @return boolean |
| 287 | 287 | */ |
| 288 | - public function toggle_registration_status_if_no_monies_owing( EE_Registration $registration, $save = TRUE ) { |
|
| 288 | + public function toggle_registration_status_if_no_monies_owing(EE_Registration $registration, $save = TRUE) { |
|
| 289 | 289 | // set initial REG_Status |
| 290 | - $this->set_old_reg_status( $registration->ID(), $registration->status_ID() ); |
|
| 290 | + $this->set_old_reg_status($registration->ID(), $registration->status_ID()); |
|
| 291 | 291 | // toggle reg status to approved IF |
| 292 | 292 | if ( |
| 293 | 293 | // REG status is pending payment |
| 294 | 294 | $registration->status_ID() == EEM_Registration::status_id_pending_payment |
| 295 | 295 | // AND no monies are owing |
| 296 | - && ( $registration->transaction()->is_completed() || $registration->transaction()->is_overpaid() || $registration->transaction()->is_free() ) |
|
| 296 | + && ($registration->transaction()->is_completed() || $registration->transaction()->is_overpaid() || $registration->transaction()->is_free()) |
|
| 297 | 297 | ) { |
| 298 | 298 | // set incoming REG_Status |
| 299 | - $this->set_new_reg_status( $registration->ID(), EEM_Registration::status_id_approved ); |
|
| 299 | + $this->set_new_reg_status($registration->ID(), EEM_Registration::status_id_approved); |
|
| 300 | 300 | // toggle status to approved |
| 301 | - $registration->set_status( EEM_Registration::status_id_approved ); |
|
| 302 | - if ( $save ) { |
|
| 301 | + $registration->set_status(EEM_Registration::status_id_approved); |
|
| 302 | + if ($save) { |
|
| 303 | 303 | $registration->save(); |
| 304 | 304 | } |
| 305 | 305 | // don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor |
| 306 | - if ( ! EE_Processor_Base::$IPN ) { |
|
| 306 | + if ( ! EE_Processor_Base::$IPN) { |
|
| 307 | 307 | // otherwise, send out notifications |
| 308 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
| 308 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
| 309 | 309 | } |
| 310 | 310 | // DEBUG LOG |
| 311 | 311 | //$this->log( |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | * @param array $additional_details |
| 332 | 332 | * @return void |
| 333 | 333 | */ |
| 334 | - public function trigger_registration_update_notifications( EE_Registration $registration, $additional_details = array() ) { |
|
| 334 | + public function trigger_registration_update_notifications(EE_Registration $registration, $additional_details = array()) { |
|
| 335 | 335 | |
| 336 | 336 | try { |
| 337 | 337 | //do_action( |
@@ -365,8 +365,8 @@ discard block |
||
| 365 | 365 | $additional_details |
| 366 | 366 | ); |
| 367 | 367 | |
| 368 | - } catch( Exception $e ) { |
|
| 369 | - EE_Error::add_error( $e->getMessage(), $e->getFile(), '', $e->getLine() ); |
|
| 368 | + } catch (Exception $e) { |
|
| 369 | + EE_Error::add_error($e->getMessage(), $e->getFile(), '', $e->getLine()); |
|
| 370 | 370 | } |
| 371 | 371 | } |
| 372 | 372 | |
@@ -379,26 +379,26 @@ discard block |
||
| 379 | 379 | * @param array $additional_details |
| 380 | 380 | * @return bool |
| 381 | 381 | */ |
| 382 | - public function update_registration_after_checkout_or_payment( EE_Registration $registration, $additional_details = array() ) { |
|
| 382 | + public function update_registration_after_checkout_or_payment(EE_Registration $registration, $additional_details = array()) { |
|
| 383 | 383 | // set initial REG_Status |
| 384 | - $this->set_old_reg_status( $registration->ID(), $registration->status_ID() ); |
|
| 384 | + $this->set_old_reg_status($registration->ID(), $registration->status_ID()); |
|
| 385 | 385 | |
| 386 | 386 | // if the registration status gets updated, then save the registration |
| 387 | - if ( $this->toggle_registration_status_for_default_approved_events( $registration, false ) || $this->toggle_registration_status_if_no_monies_owing( $registration, false )) { |
|
| 387 | + if ($this->toggle_registration_status_for_default_approved_events($registration, false) || $this->toggle_registration_status_if_no_monies_owing($registration, false)) { |
|
| 388 | 388 | $registration->save(); |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | // set new REG_Status |
| 392 | - $this->set_new_reg_status( $registration->ID(), $registration->status_ID() ); |
|
| 392 | + $this->set_new_reg_status($registration->ID(), $registration->status_ID()); |
|
| 393 | 393 | // send messages |
| 394 | 394 | $this->trigger_registration_update_notifications( |
| 395 | 395 | $registration, |
| 396 | 396 | array_merge( |
| 397 | - is_array( $additional_details ) ? $additional_details : array( $additional_details ), |
|
| 398 | - array( 'checkout_or_payment' => true ) |
|
| 397 | + is_array($additional_details) ? $additional_details : array($additional_details), |
|
| 398 | + array('checkout_or_payment' => true) |
|
| 399 | 399 | ) |
| 400 | 400 | ); |
| 401 | - return $this->new_reg_status( $registration->ID() ) == EEM_Registration::status_id_approved ? true : false; |
|
| 401 | + return $this->new_reg_status($registration->ID()) == EEM_Registration::status_id_approved ? true : false; |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
| 2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
| 2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Class EE_Transaction_Payments |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public static function instance() { |
| 46 | 46 | // check if class object is instantiated |
| 47 | - if ( ! self::$_instance instanceof EE_Transaction_Payments ) { |
|
| 47 | + if ( ! self::$_instance instanceof EE_Transaction_Payments) { |
|
| 48 | 48 | self::$_instance = new self(); |
| 49 | 49 | } |
| 50 | 50 | return self::$_instance; |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | /** |
| 73 | 73 | * @param string $old_txn_status |
| 74 | 74 | */ |
| 75 | - public function set_old_txn_status( $old_txn_status ) { |
|
| 75 | + public function set_old_txn_status($old_txn_status) { |
|
| 76 | 76 | // only set the first time |
| 77 | - if ( $this->_old_txn_status === null ) { |
|
| 77 | + if ($this->_old_txn_status === null) { |
|
| 78 | 78 | $this->_old_txn_status = $old_txn_status; |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | /** |
| 94 | 94 | * @param string $new_txn_status |
| 95 | 95 | */ |
| 96 | - public function set_new_txn_status( $new_txn_status ) { |
|
| 96 | + public function set_new_txn_status($new_txn_status) { |
|
| 97 | 97 | $this->_new_txn_status = $new_txn_status; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -124,22 +124,22 @@ discard block |
||
| 124 | 124 | * @param boolean $update_txn whether to save the TXN |
| 125 | 125 | * @return boolean whether the TXN was saved |
| 126 | 126 | */ |
| 127 | - public function calculate_total_payments_and_update_status( EE_Transaction $transaction, $update_txn = true ){ |
|
| 127 | + public function calculate_total_payments_and_update_status(EE_Transaction $transaction, $update_txn = true) { |
|
| 128 | 128 | // verify transaction |
| 129 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
| 130 | - EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 129 | + if ( ! $transaction instanceof EE_Transaction) { |
|
| 130 | + EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 131 | 131 | return false; |
| 132 | 132 | } |
| 133 | 133 | // set incoming TXN_Status |
| 134 | - $this->set_old_txn_status( $transaction->status_ID() ); |
|
| 134 | + $this->set_old_txn_status($transaction->status_ID()); |
|
| 135 | 135 | // calculate total paid |
| 136 | - $total_paid = $this->recalculate_total_payments_for_transaction( $transaction ); |
|
| 136 | + $total_paid = $this->recalculate_total_payments_for_transaction($transaction); |
|
| 137 | 137 | // if total paid has changed |
| 138 | - if ( $total_paid != $transaction->paid() ) { |
|
| 139 | - $transaction->set_paid( $total_paid ); |
|
| 138 | + if ($total_paid != $transaction->paid()) { |
|
| 139 | + $transaction->set_paid($total_paid); |
|
| 140 | 140 | // maybe update status, and make sure to save transaction if not done already |
| 141 | - if ( ! $this->update_transaction_status_based_on_total_paid( $transaction, $update_txn )) { |
|
| 142 | - if ( $update_txn ) { |
|
| 141 | + if ( ! $this->update_transaction_status_based_on_total_paid($transaction, $update_txn)) { |
|
| 142 | + if ($update_txn) { |
|
| 143 | 143 | return $transaction->save() ? TRUE : FALSE; |
| 144 | 144 | } |
| 145 | 145 | } else { |
@@ -160,18 +160,18 @@ discard block |
||
| 160 | 160 | * @param string $payment_status, one of EEM_Payment's statuses, like 'PAP' (Approved). By default, searches for approved payments |
| 161 | 161 | * @return mixed float on success, false on fail |
| 162 | 162 | */ |
| 163 | - public function recalculate_total_payments_for_transaction( EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved ) { |
|
| 163 | + public function recalculate_total_payments_for_transaction(EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved) { |
|
| 164 | 164 | // verify transaction |
| 165 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
| 166 | - EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 165 | + if ( ! $transaction instanceof EE_Transaction) { |
|
| 166 | + EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 167 | 167 | return false; |
| 168 | 168 | } |
| 169 | 169 | // ensure Payment model is loaded |
| 170 | - EE_Registry::instance()->load_model( 'Payment' ); |
|
| 170 | + EE_Registry::instance()->load_model('Payment'); |
|
| 171 | 171 | // calls EEM_Base::sum() |
| 172 | 172 | return EEM_Payment::instance()->sum( |
| 173 | 173 | // query params |
| 174 | - array( array( 'TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status )), |
|
| 174 | + array(array('TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status)), |
|
| 175 | 175 | // field to sum |
| 176 | 176 | 'PAY_amount' |
| 177 | 177 | ); |
@@ -187,37 +187,37 @@ discard block |
||
| 187 | 187 | * @return boolean whether the TXN was saved |
| 188 | 188 | * @throws \EE_Error |
| 189 | 189 | */ |
| 190 | - public function update_transaction_status_based_on_total_paid( EE_Transaction $transaction, $update_txn = TRUE ) { |
|
| 190 | + public function update_transaction_status_based_on_total_paid(EE_Transaction $transaction, $update_txn = TRUE) { |
|
| 191 | 191 | // verify transaction |
| 192 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
| 192 | + if ( ! $transaction instanceof EE_Transaction) { |
|
| 193 | 193 | EE_Error::add_error( |
| 194 | - __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), |
|
| 194 | + __('Please provide a valid EE_Transaction object.', 'event_espresso'), |
|
| 195 | 195 | __FILE__, __FUNCTION__, __LINE__ |
| 196 | 196 | ); |
| 197 | 197 | return FALSE; |
| 198 | 198 | } |
| 199 | - EE_Registry::instance()->load_helper( 'Money' ); |
|
| 199 | + EE_Registry::instance()->load_helper('Money'); |
|
| 200 | 200 | // set incoming TXN_Status |
| 201 | - $this->set_old_txn_status( $transaction->status_ID() ); |
|
| 201 | + $this->set_old_txn_status($transaction->status_ID()); |
|
| 202 | 202 | // set transaction status based on comparison of TXN_paid vs TXN_total |
| 203 | - if ( EEH_Money::compare_floats( $transaction->paid(), $transaction->total(), '>' ) ){ |
|
| 203 | + if (EEH_Money::compare_floats($transaction->paid(), $transaction->total(), '>')) { |
|
| 204 | 204 | $new_txn_status = EEM_Transaction::overpaid_status_code; |
| 205 | - } else if ( EEH_Money::compare_floats( $transaction->paid(), $transaction->total() ) ) { |
|
| 205 | + } else if (EEH_Money::compare_floats($transaction->paid(), $transaction->total())) { |
|
| 206 | 206 | $new_txn_status = EEM_Transaction::complete_status_code; |
| 207 | - } else if ( EEH_Money::compare_floats( $transaction->paid(), $transaction->total(), '<' ) ) { |
|
| 207 | + } else if (EEH_Money::compare_floats($transaction->paid(), $transaction->total(), '<')) { |
|
| 208 | 208 | $new_txn_status = EEM_Transaction::incomplete_status_code; |
| 209 | 209 | } else { |
| 210 | 210 | EE_Error::add_error( |
| 211 | - __( 'The total paid calculation for this transaction is inaccurate.', 'event_espresso' ), |
|
| 211 | + __('The total paid calculation for this transaction is inaccurate.', 'event_espresso'), |
|
| 212 | 212 | __FILE__, __FUNCTION__, __LINE__ |
| 213 | 213 | ); |
| 214 | 214 | return FALSE; |
| 215 | 215 | } |
| 216 | - if ( $new_txn_status !== $transaction->status_ID() ) { |
|
| 216 | + if ($new_txn_status !== $transaction->status_ID()) { |
|
| 217 | 217 | // set incoming TXN_Status |
| 218 | - $this->set_new_txn_status( $new_txn_status ); |
|
| 219 | - $transaction->set_status( $new_txn_status ); |
|
| 220 | - if ( $update_txn ) { |
|
| 218 | + $this->set_new_txn_status($new_txn_status); |
|
| 219 | + $transaction->set_status($new_txn_status); |
|
| 220 | + if ($update_txn) { |
|
| 221 | 221 | return $transaction->save() ? TRUE : FALSE; |
| 222 | 222 | } |
| 223 | 223 | } |
@@ -236,18 +236,18 @@ discard block |
||
| 236 | 236 | * @param EE_Payment $payment |
| 237 | 237 | * @return boolean |
| 238 | 238 | */ |
| 239 | - public function delete_payment_and_update_transaction( EE_Payment $payment ) { |
|
| 239 | + public function delete_payment_and_update_transaction(EE_Payment $payment) { |
|
| 240 | 240 | // verify payment |
| 241 | - if ( ! $payment instanceof EE_Payment ) { |
|
| 242 | - EE_Error::add_error( __( 'A valid Payment object was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 241 | + if ( ! $payment instanceof EE_Payment) { |
|
| 242 | + EE_Error::add_error(__('A valid Payment object was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 243 | 243 | return FALSE; |
| 244 | 244 | } |
| 245 | 245 | $transaction = $payment->transaction(); |
| 246 | - if ( ! $payment->delete() ) { |
|
| 247 | - EE_Error::add_error( __( 'The payment could not be deleted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 246 | + if ( ! $payment->delete()) { |
|
| 247 | + EE_Error::add_error(__('The payment could not be deleted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 248 | 248 | return FALSE; |
| 249 | 249 | } |
| 250 | - return $this->calculate_total_payments_and_update_status( $transaction ); |
|
| 250 | + return $this->calculate_total_payments_and_update_status($transaction); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |