@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | * Specialized form for payment methods, allowing for easy setting and retrieving of meta fields. |
| 5 | 5 | * Uses EEM_Payment_Method as the model |
| 6 | 6 | */ |
| 7 | -class EE_Payment_Method_Form extends EE_Model_Form_Section{ |
|
| 7 | +class EE_Payment_Method_Form extends EE_Model_Form_Section { |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * All the subsection inputs that correspond ot extra meta rows |
@@ -39,37 +39,37 @@ discard block |
||
| 39 | 39 | * @see EE_Model_Form_Section::__construct() for more |
| 40 | 40 | * } |
| 41 | 41 | */ |
| 42 | - public function __construct($options_array = array()){ |
|
| 42 | + public function __construct($options_array = array()) { |
|
| 43 | 43 | $this->_model = EEM_Payment_Method::instance(); |
| 44 | 44 | $this->_options_array = $options_array; |
| 45 | - if(isset($options_array['payment_method_type'])){ |
|
| 45 | + if (isset($options_array['payment_method_type'])) { |
|
| 46 | 46 | $this->_payment_method_type = $options_array['payment_method_type']; |
| 47 | 47 | } |
| 48 | 48 | $options_array = $this->_options_array; |
| 49 | - if(isset($options_array['extra_meta_inputs'])){ |
|
| 50 | - $this->_extra_meta_inputs = array_merge($this->_extra_meta_inputs,$options_array['extra_meta_inputs']); |
|
| 49 | + if (isset($options_array['extra_meta_inputs'])) { |
|
| 50 | + $this->_extra_meta_inputs = array_merge($this->_extra_meta_inputs, $options_array['extra_meta_inputs']); |
|
| 51 | 51 | } |
| 52 | - if($this->_extra_meta_inputs){ |
|
| 53 | - $this->_subsections = array_merge($this->_subsections,$this->_extra_meta_inputs); |
|
| 52 | + if ($this->_extra_meta_inputs) { |
|
| 53 | + $this->_subsections = array_merge($this->_subsections, $this->_extra_meta_inputs); |
|
| 54 | 54 | } |
| 55 | 55 | $this->_subsections['PMD_button_url'] = new EE_Admin_File_Uploader_Input( |
| 56 | - array( 'html_label_text'=> __( 'Button URL', 'event_espresso' )) |
|
| 56 | + array('html_label_text'=> __('Button URL', 'event_espresso')) |
|
| 57 | 57 | ); |
| 58 | 58 | $this->_subsections['PMD_scope'] = new EE_Checkbox_Multi_Input( |
| 59 | 59 | EEM_Payment_Method::instance()->scopes(), |
| 60 | - array( 'html_label_text' => $this->_model->field_settings_for('PMD_scope')->get_nicename() . EEH_Template::get_help_tab_link( 'payment_methods_overview' )) |
|
| 60 | + array('html_label_text' => $this->_model->field_settings_for('PMD_scope')->get_nicename().EEH_Template::get_help_tab_link('payment_methods_overview')) |
|
| 61 | 61 | ); |
| 62 | 62 | //setup the currency options |
| 63 | 63 | $this->_subsections['Currency'] = new EE_Select_Multi_Model_Input( |
| 64 | - EEM_Currency::instance()->get_all_currencies_usable_by( $this->_payment_method_type ), |
|
| 64 | + EEM_Currency::instance()->get_all_currencies_usable_by($this->_payment_method_type), |
|
| 65 | 65 | array( |
| 66 | - 'html_label_text'=> __( 'Currencies Supported', 'event_espresso' ), |
|
| 66 | + 'html_label_text'=> __('Currencies Supported', 'event_espresso'), |
|
| 67 | 67 | 'required'=>TRUE |
| 68 | 68 | ) |
| 69 | 69 | ); |
| 70 | - $this->_subsections['PMD_order'] = new EE_Text_Input( array( |
|
| 71 | - 'html_label_text' => __( 'Order', 'event_espresso' ), |
|
| 72 | - 'html_help_text' => __( 'Lowest numbers will be shown first', 'event_espresso' ), |
|
| 70 | + $this->_subsections['PMD_order'] = new EE_Text_Input(array( |
|
| 71 | + 'html_label_text' => __('Order', 'event_espresso'), |
|
| 72 | + 'html_help_text' => __('Lowest numbers will be shown first', 'event_espresso'), |
|
| 73 | 73 | 'normalization_strategy' => new EE_Int_Normalization(), |
| 74 | 74 | 'validation_strategies' => array( |
| 75 | 75 | new EE_Int_Validation_Strategy() |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | )); |
| 79 | 79 | $this->_layout_strategy = new EE_Admin_Two_Column_Layout(); |
| 80 | 80 | parent::__construct($options_array); |
| 81 | - $debug_mode = isset( $this->_subsections[ 'PMD_debug_mode' ] ) ? $this->_subsections[ 'PMD_debug_mode' ] : null; |
|
| 82 | - if( $debug_mode instanceof EE_Form_Input_Base ) { |
|
| 83 | - $debug_mode->set_html_help_text( __( 'This payment method has a Sandbox Server (also known as Testing Server, Development Server, Quality Assurance Server, etc). While in debug mode and using this sandbox server, real payments will not be processed.', 'event_espresso' ) ); |
|
| 81 | + $debug_mode = isset($this->_subsections['PMD_debug_mode']) ? $this->_subsections['PMD_debug_mode'] : null; |
|
| 82 | + if ($debug_mode instanceof EE_Form_Input_Base) { |
|
| 83 | + $debug_mode->set_html_help_text(__('This payment method has a Sandbox Server (also known as Testing Server, Development Server, Quality Assurance Server, etc). While in debug mode and using this sandbox server, real payments will not be processed.', 'event_espresso')); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
@@ -92,15 +92,15 @@ discard block |
||
| 92 | 92 | * @param string $name |
| 93 | 93 | * @throws EE_Error |
| 94 | 94 | */ |
| 95 | - public function _construct_finalize( $parent_form_section, $name ) { |
|
| 96 | - if( ! $this->_payment_method_type instanceof EE_PMT_Base ){ |
|
| 97 | - throw new EE_Error( sprintf( __( 'Payment Method forms must have set their payment method type BEFORE calling _construct_finalize', 'event_espresso' ))); |
|
| 95 | + public function _construct_finalize($parent_form_section, $name) { |
|
| 96 | + if ( ! $this->_payment_method_type instanceof EE_PMT_Base) { |
|
| 97 | + throw new EE_Error(sprintf(__('Payment Method forms must have set their payment method type BEFORE calling _construct_finalize', 'event_espresso'))); |
|
| 98 | 98 | } |
| 99 | 99 | //set the name of this form based on the payment method type |
| 100 | - if( ! $this->_name && ! $name ){ |
|
| 101 | - $name = str_replace(" ","_",ucwords(str_replace("_"," ",($this->_payment_method_type->system_name()))))."_Settings_Form"; |
|
| 100 | + if ( ! $this->_name && ! $name) { |
|
| 101 | + $name = str_replace(" ", "_", ucwords(str_replace("_", " ", ($this->_payment_method_type->system_name()))))."_Settings_Form"; |
|
| 102 | 102 | } |
| 103 | - parent::_construct_finalize( $parent_form_section, $name ); |
|
| 103 | + parent::_construct_finalize($parent_form_section, $name); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -109,8 +109,8 @@ discard block |
||
| 109 | 109 | * @param $payment_method_type |
| 110 | 110 | * @throws EE_Error |
| 111 | 111 | */ |
| 112 | - public function set_payment_method_type( $payment_method_type ){ |
|
| 113 | - if( ! $payment_method_type instanceof EE_PMT_Base){ |
|
| 112 | + public function set_payment_method_type($payment_method_type) { |
|
| 113 | + if ( ! $payment_method_type instanceof EE_PMT_Base) { |
|
| 114 | 114 | throw new EE_Error(sprintf(__("Payment Method forms MUST set a payment method type by using _set_payment_method_type", "event_espresso"))); |
| 115 | 115 | } |
| 116 | 116 | $this->_payment_method_type = $payment_method_type; |
@@ -122,10 +122,10 @@ discard block |
||
| 122 | 122 | * extends the model form section's save method to also save the extra meta field values |
| 123 | 123 | * @return int ID of the payment method inserted, or true on update |
| 124 | 124 | */ |
| 125 | - public function save(){ |
|
| 125 | + public function save() { |
|
| 126 | 126 | $parent_save_val = parent::save(); |
| 127 | - if( $this->_model_object && $this->_model_object->ID()){ |
|
| 128 | - foreach($this->_extra_meta_inputs as $input_name => $input){ |
|
| 127 | + if ($this->_model_object && $this->_model_object->ID()) { |
|
| 128 | + foreach ($this->_extra_meta_inputs as $input_name => $input) { |
|
| 129 | 129 | $this->_model_object->update_extra_meta($input_name, $input->normalized_value()); |
| 130 | 130 | } |
| 131 | 131 | } |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | $model_obj = $this->_model->ensure_is_obj($model_obj); |
| 143 | 143 | parent::populate_model_obj($model_obj); |
| 144 | 144 | $extra_meta = $model_obj->all_extra_meta_array(); |
| 145 | - foreach($this->_extra_meta_inputs as $input_name => $extra_meta_input){ |
|
| 146 | - if(isset($extra_meta[$input_name])){ |
|
| 145 | + foreach ($this->_extra_meta_inputs as $input_name => $extra_meta_input) { |
|
| 146 | + if (isset($extra_meta[$input_name])) { |
|
| 147 | 147 | $extra_meta_input->set_default($extra_meta[$input_name]); |
| 148 | 148 | } |
| 149 | 149 | } |
@@ -155,10 +155,10 @@ discard block |
||
| 155 | 155 | * gets the default name of this form section if none is specified |
| 156 | 156 | * @return string |
| 157 | 157 | */ |
| 158 | - protected function _set_default_name_if_empty(){ |
|
| 159 | - if( ! $this->_name ){ |
|
| 160 | - $default_name = str_replace("EEM_", "", get_class($this->_model)) . "_Model_Form"; |
|
| 161 | - $this->_name = $default_name; |
|
| 158 | + protected function _set_default_name_if_empty() { |
|
| 159 | + if ( ! $this->_name) { |
|
| 160 | + $default_name = str_replace("EEM_", "", get_class($this->_model))."_Model_Form"; |
|
| 161 | + $this->_name = $default_name; |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | * Gets all the extra meta inputs in this form |
| 169 | 169 | * @return EE_Form_Input_Base[] |
| 170 | 170 | */ |
| 171 | - public function extra_meta_inputs(){ |
|
| 171 | + public function extra_meta_inputs() { |
|
| 172 | 172 | return $this->_extra_meta_inputs; |
| 173 | 173 | } |
| 174 | 174 | } |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | 'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false ), |
| 159 | 159 | )); |
| 160 | 160 | */ |
| 161 | -class EE_DMS_4_1_0_events extends EE_Data_Migration_Script_Stage{ |
|
| 161 | +class EE_DMS_4_1_0_events extends EE_Data_Migration_Script_Stage { |
|
| 162 | 162 | private $_old_table; |
| 163 | 163 | private $_old_start_end_table; |
| 164 | 164 | private $_new_table; |
@@ -184,41 +184,41 @@ discard block |
||
| 184 | 184 | protected function _migration_step($num_items_to_migrate = 50) { |
| 185 | 185 | global $wpdb; |
| 186 | 186 | //because the migration of each event can be a LOT more work, make each step smaller |
| 187 | - $num_items_to_migrate = max(1,$num_items_to_migrate/5); |
|
| 188 | - $events = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d",$this->count_records_migrated(),$num_items_to_migrate),ARRAY_A); |
|
| 187 | + $num_items_to_migrate = max(1, $num_items_to_migrate / 5); |
|
| 188 | + $events = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d", $this->count_records_migrated(), $num_items_to_migrate), ARRAY_A); |
|
| 189 | 189 | $items_migrated_this_step = 0; |
| 190 | 190 | |
| 191 | - foreach($events as $event_row){ |
|
| 191 | + foreach ($events as $event_row) { |
|
| 192 | 192 | $created_attachment_post = false; |
| 193 | 193 | //insert new 4.1 Attendee object using $wpdb |
| 194 | 194 | $post_id = $this->_insert_cpt($event_row); |
| 195 | - if($post_id){ |
|
| 195 | + if ($post_id) { |
|
| 196 | 196 | $this->get_migration_script()->set_mapping($this->_old_table, $event_row['id'], $this->_new_table, $post_id); |
| 197 | 197 | $meta_id = $this->_insert_event_meta($event_row, $post_id); |
| 198 | - if($meta_id){ |
|
| 198 | + if ($meta_id) { |
|
| 199 | 199 | $this->get_migration_script()->set_mapping($this->_old_table, $event_row['id'], $this->_new_meta_table, $meta_id); |
| 200 | 200 | } |
| 201 | - $this->_convert_start_end_times($event_row,$post_id); |
|
| 201 | + $this->_convert_start_end_times($event_row, $post_id); |
|
| 202 | 202 | $event_meta = maybe_unserialize($event_row['event_meta']); |
| 203 | 203 | $guid = isset($event_meta['event_thumbnail_url']) ? $event_meta['event_thumbnail_url'] : null; |
| 204 | - $created_attachment_post = $this->get_migration_script()->convert_image_url_to_attachment_and_attach_to_post($guid,$post_id,$this); |
|
| 204 | + $created_attachment_post = $this->get_migration_script()->convert_image_url_to_attachment_and_attach_to_post($guid, $post_id, $this); |
|
| 205 | 205 | |
| 206 | 206 | //maybe create a venue from info on the event? |
| 207 | 207 | $new_venue_id = $this->_maybe_create_venue($event_row); |
| 208 | - if($new_venue_id){ |
|
| 209 | - $this->_insert_new_venue_to_event($post_id,$new_venue_id); |
|
| 208 | + if ($new_venue_id) { |
|
| 209 | + $this->_insert_new_venue_to_event($post_id, $new_venue_id); |
|
| 210 | 210 | } |
| 211 | 211 | $this->_add_post_metas($event_row, $post_id); |
| 212 | 212 | |
| 213 | 213 | } |
| 214 | 214 | $items_migrated_this_step++; |
| 215 | - if($guid){ |
|
| 215 | + if ($guid) { |
|
| 216 | 216 | //if we had to check for an image attachment |
| 217 | 217 | //then let's call it a day (avoid timing out, because this took a long time) |
| 218 | 218 | break; |
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | - if($this->count_records_migrated() + $items_migrated_this_step >= $this->count_records_to_migrate()){ |
|
| 221 | + if ($this->count_records_migrated() + $items_migrated_this_step >= $this->count_records_to_migrate()) { |
|
| 222 | 222 | $this->set_status(EE_Data_Migration_Manager::status_completed); |
| 223 | 223 | } |
| 224 | 224 | return $items_migrated_this_step; |
@@ -230,28 +230,28 @@ discard block |
||
| 230 | 230 | * @param type $post_id |
| 231 | 231 | * @return void |
| 232 | 232 | */ |
| 233 | - private function _add_post_metas($old_event,$post_id){ |
|
| 233 | + private function _add_post_metas($old_event, $post_id) { |
|
| 234 | 234 | $event_meta = maybe_unserialize($old_event['event_meta']); |
| 235 | - if( ! $event_meta || ! is_array( $event_meta ) ){ |
|
| 235 | + if ( ! $event_meta || ! is_array($event_meta)) { |
|
| 236 | 236 | return; |
| 237 | 237 | } |
| 238 | - unset($event_meta['date_submitted']);//factored into CPT |
|
| 239 | - unset($event_meta['additional_attendee_reg_info']);//facotred into event meta table |
|
| 240 | - unset($event_meta['default_payment_status']);//dido |
|
| 241 | - unset($event_meta['event_thumbnail_url']);//used to find post featured image |
|
| 242 | - foreach($event_meta as $meta_key => $meta_value){ |
|
| 243 | - if ($meta_key){//if th emeta key is just an empty string, ignore it |
|
| 244 | - $success = add_post_meta($post_id,$meta_key,$meta_value,true); |
|
| 245 | - if( ! $success ){ |
|
| 246 | - $this->add_error(sprintf(__("Could not add post meta for CPT with ID #%d. Meta key: '%s',meta value:'%d' for 3.1 event: %s", "event_espresso"),$post_id,$meta_key,$meta_value,implode(",",$old_event))); |
|
| 238 | + unset($event_meta['date_submitted']); //factored into CPT |
|
| 239 | + unset($event_meta['additional_attendee_reg_info']); //facotred into event meta table |
|
| 240 | + unset($event_meta['default_payment_status']); //dido |
|
| 241 | + unset($event_meta['event_thumbnail_url']); //used to find post featured image |
|
| 242 | + foreach ($event_meta as $meta_key => $meta_value) { |
|
| 243 | + if ($meta_key) {//if th emeta key is just an empty string, ignore it |
|
| 244 | + $success = add_post_meta($post_id, $meta_key, $meta_value, true); |
|
| 245 | + if ( ! $success) { |
|
| 246 | + $this->add_error(sprintf(__("Could not add post meta for CPT with ID #%d. Meta key: '%s',meta value:'%d' for 3.1 event: %s", "event_espresso"), $post_id, $meta_key, $meta_value, implode(",", $old_event))); |
|
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | - if($old_event['alt_email']){ |
|
| 251 | - add_post_meta($post_id,'alt_email',$old_event['alt_email']); |
|
| 250 | + if ($old_event['alt_email']) { |
|
| 251 | + add_post_meta($post_id, 'alt_email', $old_event['alt_email']); |
|
| 252 | 252 | } |
| 253 | - if($old_event['recurrence_id']){ |
|
| 254 | - add_post_meta($post_id,'recurrence_id',$old_event['recurrence_id']); |
|
| 253 | + if ($old_event['recurrence_id']) { |
|
| 254 | + add_post_meta($post_id, 'recurrence_id', $old_event['recurrence_id']); |
|
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | /** |
@@ -263,13 +263,13 @@ discard block |
||
| 263 | 263 | * @param string $new_post_status a post status |
| 264 | 264 | * @return string |
| 265 | 265 | */ |
| 266 | - private function _find_unique_slug($event_name, $old_identifier = '', $new_post_status = 'publish'){ |
|
| 266 | + private function _find_unique_slug($event_name, $old_identifier = '', $new_post_status = 'publish') { |
|
| 267 | 267 | $count = 0; |
| 268 | 268 | $original_name = $event_name ? sanitize_title($event_name) : $old_identifier; |
| 269 | - return wp_unique_post_slug($original_name, 0, $new_post_status, 'espresso_events', 0 ); |
|
| 269 | + return wp_unique_post_slug($original_name, 0, $new_post_status, 'espresso_events', 0); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - private function _insert_cpt($old_event){ |
|
| 272 | + private function _insert_cpt($old_event) { |
|
| 273 | 273 | global $wpdb; |
| 274 | 274 | //convert 3.1 event status to 4.1 CPT status |
| 275 | 275 | //for refrence, 3.1 event stati available for setting are: |
@@ -288,55 +288,55 @@ discard block |
||
| 288 | 288 | // and 3 custom ones: cancelled,postponed,sold_out |
| 289 | 289 | $status_conversions = array( |
| 290 | 290 | 'R'=>'draft', |
| 291 | - 'X'=>'draft',//4.1 doesn't have a "not approved for publishing" status. this is what posts are set to that aren't approved |
|
| 291 | + 'X'=>'draft', //4.1 doesn't have a "not approved for publishing" status. this is what posts are set to that aren't approved |
|
| 292 | 292 | 'P'=>'pending', |
| 293 | - 'IA'=>'draft',//draft and in the past |
|
| 293 | + 'IA'=>'draft', //draft and in the past |
|
| 294 | 294 | //IA=inactive in 3.1: events were switched to this when they expired. in 4.1 that's just calculated |
| 295 | - 'O'=>'publish',//@todo: will be an event type later; if this is the status, set the end date WAAAY later; and add term for 'ongoing' |
|
| 295 | + 'O'=>'publish', //@todo: will be an event type later; if this is the status, set the end date WAAAY later; and add term for 'ongoing' |
|
| 296 | 296 | 'A'=>'publish', |
| 297 | - 'S'=>'draft',//@todo: is it ok to just mark secondary/waitlist events as DRAFTS? |
|
| 297 | + 'S'=>'draft', //@todo: is it ok to just mark secondary/waitlist events as DRAFTS? |
|
| 298 | 298 | 'D'=>'trash', |
| 299 | 299 | ); |
| 300 | 300 | $post_status = $status_conversions[$old_event['event_status']]; |
| 301 | 301 | //check if we've sold out |
| 302 | - if (intval($old_event['reg_limit']) <= self::count_registrations($old_event['id'])){ |
|
| 302 | + if (intval($old_event['reg_limit']) <= self::count_registrations($old_event['id'])) { |
|
| 303 | 303 | $post_status = 'sold_out'; |
| 304 | 304 | } |
| 305 | 305 | // FYI postponed and cancelled don't exist in 3.1 |
| 306 | 306 | $cols_n_values = array( |
| 307 | - 'post_title'=>stripslashes($old_event['event_name']),//EVT_name |
|
| 308 | - 'post_content'=>stripslashes($old_event['event_desc']),//EVT_desc |
|
| 309 | - 'post_name'=>$this->_find_unique_slug($old_event['event_name'], $old_event['event_identifier'], $post_status ),//EVT_slug |
|
| 310 | - 'post_date'=>$old_event['submitted'],//EVT_created NOT |
|
| 307 | + 'post_title'=>stripslashes($old_event['event_name']), //EVT_name |
|
| 308 | + 'post_content'=>stripslashes($old_event['event_desc']), //EVT_desc |
|
| 309 | + 'post_name'=>$this->_find_unique_slug($old_event['event_name'], $old_event['event_identifier'], $post_status), //EVT_slug |
|
| 310 | + 'post_date'=>$old_event['submitted'], //EVT_created NOT |
|
| 311 | 311 | 'post_date_gmt'=>get_gmt_from_date($old_event['submitted']), |
| 312 | - 'post_excerpt'=>'',//EVT_short_desc |
|
| 313 | - 'post_modified'=>$old_event['submitted'],//EVT_modified |
|
| 312 | + 'post_excerpt'=>'', //EVT_short_desc |
|
| 313 | + 'post_modified'=>$old_event['submitted'], //EVT_modified |
|
| 314 | 314 | 'post_modified_gmt'=>get_gmt_from_date($old_event['submitted']), |
| 315 | - 'post_author'=>$old_event['wp_user'],//EVT_wp_user |
|
| 316 | - 'post_parent'=>0,//parent maybe get this from some REM field? |
|
| 317 | - 'menu_order'=>0,//EVT_order |
|
| 318 | - 'post_type'=>'espresso_events',//post_type |
|
| 319 | - 'post_status'=>$post_status,//status |
|
| 315 | + 'post_author'=>$old_event['wp_user'], //EVT_wp_user |
|
| 316 | + 'post_parent'=>0, //parent maybe get this from some REM field? |
|
| 317 | + 'menu_order'=>0, //EVT_order |
|
| 318 | + 'post_type'=>'espresso_events', //post_type |
|
| 319 | + 'post_status'=>$post_status, //status |
|
| 320 | 320 | ); |
| 321 | 321 | $datatypes = array( |
| 322 | - '%s',//EVT_name |
|
| 323 | - '%s',//EVT_desc |
|
| 324 | - '%s',//EVT_slug |
|
| 325 | - '%s',//EVT_created |
|
| 322 | + '%s', //EVT_name |
|
| 323 | + '%s', //EVT_desc |
|
| 324 | + '%s', //EVT_slug |
|
| 325 | + '%s', //EVT_created |
|
| 326 | 326 | '%s', |
| 327 | - '%s',//EVT_short_desc |
|
| 328 | - '%s',//EVT_modified |
|
| 327 | + '%s', //EVT_short_desc |
|
| 328 | + '%s', //EVT_modified |
|
| 329 | 329 | '%s', |
| 330 | - '%s',//EVT_wp_user |
|
| 331 | - '%d',//post_parent |
|
| 332 | - '%d',//EVT_order |
|
| 333 | - '%s',//post_type |
|
| 334 | - '%s',//status |
|
| 330 | + '%s', //EVT_wp_user |
|
| 331 | + '%d', //post_parent |
|
| 332 | + '%d', //EVT_order |
|
| 333 | + '%s', //post_type |
|
| 334 | + '%s', //status |
|
| 335 | 335 | ); |
| 336 | 336 | $success = $wpdb->insert($this->_new_table, |
| 337 | 337 | $cols_n_values, |
| 338 | 338 | $datatypes); |
| 339 | - if( ! $success ){ |
|
| 339 | + if ( ! $success) { |
|
| 340 | 340 | $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_event, $this->_new_table, $cols_n_values, $datatypes)); |
| 341 | 341 | return 0; |
| 342 | 342 | } |
@@ -349,13 +349,13 @@ discard block |
||
| 349 | 349 | * @param type $event_id |
| 350 | 350 | * @return int |
| 351 | 351 | */ |
| 352 | - public static function count_registrations($event_id){ |
|
| 352 | + public static function count_registrations($event_id) { |
|
| 353 | 353 | global $wpdb; |
| 354 | - $count = $wpdb->get_var($wpdb->prepare("SELECT sum(quantity) FROM {$wpdb->prefix}events_attendee WHERE event_id=%d",$event_id)); |
|
| 354 | + $count = $wpdb->get_var($wpdb->prepare("SELECT sum(quantity) FROM {$wpdb->prefix}events_attendee WHERE event_id=%d", $event_id)); |
|
| 355 | 355 | return intval($count); |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | - private function _insert_event_meta($old_event,$new_cpt_id){ |
|
| 358 | + private function _insert_event_meta($old_event, $new_cpt_id) { |
|
| 359 | 359 | global $wpdb; |
| 360 | 360 | $event_meta = maybe_unserialize($old_event['event_meta']); |
| 361 | 361 | // for reference, 3.1 'default_payment_status' are: $default_payment_status = array( |
@@ -366,10 +366,10 @@ discard block |
||
| 366 | 366 | //); |
| 367 | 367 | $default_reg_status = $this->get_migration_script()->convert_3_1_payment_status_to_4_1_STS_ID(isset($event_meta['default_payment_status']) ? $event_meta['default_payment_status'] : '', intval($old_event['require_pre_approval'])); |
| 368 | 368 | $cols_n_values = array( |
| 369 | - 'EVT_ID'=>$new_cpt_id,//EVT_ID_fk |
|
| 369 | + 'EVT_ID'=>$new_cpt_id, //EVT_ID_fk |
|
| 370 | 370 | 'EVT_display_desc'=> 'Y' == $old_event['display_desc'], |
| 371 | - 'EVT_display_ticket_selector'=> 'Y'== $old_event['display_reg_form'], |
|
| 372 | - 'EVT_visible_on'=> $this->get_migration_script()->convert_date_string_to_utc($this,$old_event,current_time('mysql'),$old_event['timezone_string']),//don't use the old 'visible_on', as it wasnt ever used |
|
| 371 | + 'EVT_display_ticket_selector'=> 'Y' == $old_event['display_reg_form'], |
|
| 372 | + 'EVT_visible_on'=> $this->get_migration_script()->convert_date_string_to_utc($this, $old_event, current_time('mysql'), $old_event['timezone_string']), //don't use the old 'visible_on', as it wasnt ever used |
|
| 373 | 373 | 'EVT_additional_limit'=> $old_event['allow_multiple'] == 'N' ? 1 : $old_event['additional_limit'], |
| 374 | 374 | 'EVT_default_registration_status' => $default_reg_status, |
| 375 | 375 | 'EVT_member_only'=>$old_event['member_only'], |
@@ -381,31 +381,31 @@ discard block |
||
| 381 | 381 | |
| 382 | 382 | ); |
| 383 | 383 | $datatypes = array( |
| 384 | - '%s',//EVT_ID |
|
| 385 | - '%d',//EVT_display_desc |
|
| 386 | - '%d',//EVT_display_ticket_selector |
|
| 387 | - '%s',//EVT_visible_on |
|
| 388 | - '%d',//EVT_additional_limit |
|
| 389 | - '%s',//EVT_default_registration_status |
|
| 390 | - '%d',//EVT_member_only |
|
| 391 | - '%s',//EVT_phone |
|
| 392 | - '%d',//EVT_allow_overflow |
|
| 393 | - '%s',//EVT_timezone_string |
|
| 394 | - '%s',//EVT_external_URL |
|
| 395 | - '%d',//EVT_donations |
|
| 384 | + '%s', //EVT_ID |
|
| 385 | + '%d', //EVT_display_desc |
|
| 386 | + '%d', //EVT_display_ticket_selector |
|
| 387 | + '%s', //EVT_visible_on |
|
| 388 | + '%d', //EVT_additional_limit |
|
| 389 | + '%s', //EVT_default_registration_status |
|
| 390 | + '%d', //EVT_member_only |
|
| 391 | + '%s', //EVT_phone |
|
| 392 | + '%d', //EVT_allow_overflow |
|
| 393 | + '%s', //EVT_timezone_string |
|
| 394 | + '%s', //EVT_external_URL |
|
| 395 | + '%d', //EVT_donations |
|
| 396 | 396 | ); |
| 397 | 397 | $success = $wpdb->insert($this->_new_meta_table, |
| 398 | 398 | $cols_n_values, |
| 399 | 399 | $datatypes); |
| 400 | - if( ! $success ){ |
|
| 400 | + if ( ! $success) { |
|
| 401 | 401 | $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_event, $this->_new_meta_table, $cols_n_values, $datatypes)); |
| 402 | 402 | return 0; |
| 403 | 403 | } |
| 404 | 404 | return $wpdb->insert_id; |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | - private function _maybe_create_venue($old_event){ |
|
| 408 | - if( $old_event['address'] || |
|
| 407 | + private function _maybe_create_venue($old_event) { |
|
| 408 | + if ($old_event['address'] || |
|
| 409 | 409 | $old_event['address2'] || |
| 410 | 410 | $old_event['city'] || |
| 411 | 411 | $old_event['state'] || |
@@ -416,21 +416,21 @@ discard block |
||
| 416 | 416 | $old_event['venue_phone'] || |
| 417 | 417 | $old_event['virtual_url'] || |
| 418 | 418 | $old_event['virtual_phone'] |
| 419 | - ){ |
|
| 420 | - $old_id = $this->_duplicate_venue_exists( $old_event ); |
|
| 421 | - if( $old_id ){ |
|
| 419 | + ) { |
|
| 420 | + $old_id = $this->_duplicate_venue_exists($old_event); |
|
| 421 | + if ($old_id) { |
|
| 422 | 422 | return $old_id; |
| 423 | 423 | } |
| 424 | 424 | $new_id = $this->_insert_venue_into_posts($old_event); |
| 425 | - if( $new_id ){ |
|
| 425 | + if ($new_id) { |
|
| 426 | 426 | $this->_insert_venue_into_meta_table($new_id, $old_event); |
| 427 | - $guid = isset($old_event['venue_image']) ? $old_event['venue_image'] : null; |
|
| 428 | - $this->get_migration_script()->convert_image_url_to_attachment_and_attach_to_post($guid, $new_id,$this); |
|
| 427 | + $guid = isset($old_event['venue_image']) ? $old_event['venue_image'] : null; |
|
| 428 | + $this->get_migration_script()->convert_image_url_to_attachment_and_attach_to_post($guid, $new_id, $this); |
|
| 429 | 429 | } |
| 430 | 430 | //we don't bother recording the conversion from old events to venues as that |
| 431 | 431 | //will complicate finding the conversion from old venues to new events |
| 432 | 432 | return $new_id; |
| 433 | - }else{ |
|
| 433 | + } else { |
|
| 434 | 434 | return 0; |
| 435 | 435 | } |
| 436 | 436 | } |
@@ -441,29 +441,29 @@ discard block |
||
| 441 | 441 | * @param array $old_event |
| 442 | 442 | * @return int duplicate venue id |
| 443 | 443 | */ |
| 444 | - private function _duplicate_venue_exists($old_event){ |
|
| 444 | + private function _duplicate_venue_exists($old_event) { |
|
| 445 | 445 | global $wpdb; |
| 446 | 446 | $conditions = array( |
| 447 | - 'VNU_address' => $old_event [ 'address' ], |
|
| 448 | - 'VNU_address2' => $old_event[ 'address2' ], |
|
| 449 | - 'VNU_city' => $old_event[ 'city' ], |
|
| 450 | - 'VNU_zip' => $old_event[ 'zip' ], |
|
| 451 | - 'post_title'=> $this->_get_venue_title_for_event( $old_event ), |
|
| 452 | - 'VNU_phone'=>$old_event['venue_phone'],//VNU_phone |
|
| 453 | - 'VNU_url'=>$old_event['venue_url'],//VNU_url |
|
| 454 | - 'VNU_virtual_phone'=>$old_event['virtual_phone'],//VNU_virtual_phone |
|
| 455 | - 'VNU_virtual_url'=>$old_event['virtual_url'],//VNU_virtual_url |
|
| 447 | + 'VNU_address' => $old_event ['address'], |
|
| 448 | + 'VNU_address2' => $old_event['address2'], |
|
| 449 | + 'VNU_city' => $old_event['city'], |
|
| 450 | + 'VNU_zip' => $old_event['zip'], |
|
| 451 | + 'post_title'=> $this->_get_venue_title_for_event($old_event), |
|
| 452 | + 'VNU_phone'=>$old_event['venue_phone'], //VNU_phone |
|
| 453 | + 'VNU_url'=>$old_event['venue_url'], //VNU_url |
|
| 454 | + 'VNU_virtual_phone'=>$old_event['virtual_phone'], //VNU_virtual_phone |
|
| 455 | + 'VNU_virtual_url'=>$old_event['virtual_url'], //VNU_virtual_url |
|
| 456 | 456 | ); |
| 457 | 457 | $sql_conditions = array(); |
| 458 | - foreach($conditions as $column => $value){ |
|
| 458 | + foreach ($conditions as $column => $value) { |
|
| 459 | 459 | $sql_conditions [] = "$column = '$value'"; |
| 460 | 460 | } |
| 461 | 461 | $query = "SELECT VNU_ID |
| 462 | 462 | FROM |
| 463 | 463 | {$wpdb->posts} as p INNER JOIN |
| 464 | 464 | {$wpdb->prefix}esp_venue_meta as v ON p.ID = v.VNU_ID |
| 465 | - WHERE " . implode( " AND ",$sql_conditions ) . " LIMIT 1"; |
|
| 466 | - $id = $wpdb->get_var( $query ); |
|
| 465 | + WHERE ".implode(" AND ", $sql_conditions)." LIMIT 1"; |
|
| 466 | + $id = $wpdb->get_var($query); |
|
| 467 | 467 | return $id; |
| 468 | 468 | } |
| 469 | 469 | |
@@ -472,8 +472,8 @@ discard block |
||
| 472 | 472 | * @param array $event_data_array keys are events_details columns and valuesa re their values |
| 473 | 473 | * @return string |
| 474 | 474 | */ |
| 475 | - protected function _get_venue_title_for_event( $event_data_array ) { |
|
| 476 | - return $event_data_array['venue_title'] ? stripslashes($event_data_array['venue_title']) : stripslashes( sprintf( __( 'Venue of %s', 'event_espresso' ), $event_data_array['event_name'])); |
|
| 475 | + protected function _get_venue_title_for_event($event_data_array) { |
|
| 476 | + return $event_data_array['venue_title'] ? stripslashes($event_data_array['venue_title']) : stripslashes(sprintf(__('Venue of %s', 'event_espresso'), $event_data_array['event_name'])); |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | /** |
@@ -481,40 +481,40 @@ discard block |
||
| 481 | 481 | * @param array $old_venue keys are cols, values are col values |
| 482 | 482 | * @return int |
| 483 | 483 | */ |
| 484 | - private function _insert_venue_into_posts($old_event){ |
|
| 484 | + private function _insert_venue_into_posts($old_event) { |
|
| 485 | 485 | global $wpdb; |
| 486 | 486 | $insertion_array = array( |
| 487 | - 'post_title'=> $this->_get_venue_title_for_event( $old_event ),//VNU_name |
|
| 488 | - 'post_content'=>'',//VNU_desc |
|
| 489 | - 'post_name'=> $this->_find_unique_slug( $old_event['venue_title'], sanitize_title( 'venue-of-' . $old_event['event_name'] ) ),//VNU_identifier |
|
| 490 | - 'post_date'=>current_time('mysql'),//VNU_created |
|
| 487 | + 'post_title'=> $this->_get_venue_title_for_event($old_event), //VNU_name |
|
| 488 | + 'post_content'=>'', //VNU_desc |
|
| 489 | + 'post_name'=> $this->_find_unique_slug($old_event['venue_title'], sanitize_title('venue-of-'.$old_event['event_name'])), //VNU_identifier |
|
| 490 | + 'post_date'=>current_time('mysql'), //VNU_created |
|
| 491 | 491 | 'post_date_gmt'=>get_gmt_from_date(current_time('mysql')), |
| 492 | - 'post_excerpt'=>'',//VNU_short_desc arbitraty only 50 characters |
|
| 493 | - 'post_modified'=>current_time('mysql'),//VNU_modified |
|
| 492 | + 'post_excerpt'=>'', //VNU_short_desc arbitraty only 50 characters |
|
| 493 | + 'post_modified'=>current_time('mysql'), //VNU_modified |
|
| 494 | 494 | 'post_modified_gmt'=>get_gmt_from_date(current_time('mysql')), |
| 495 | - 'post_author'=>$old_event['wp_user'],//VNU_wp_user |
|
| 496 | - 'post_parent'=>0,//parent |
|
| 497 | - 'menu_order'=>0,//VNU_order |
|
| 495 | + 'post_author'=>$old_event['wp_user'], //VNU_wp_user |
|
| 496 | + 'post_parent'=>0, //parent |
|
| 497 | + 'menu_order'=>0, //VNU_order |
|
| 498 | 498 | 'post_type'=>'espresso_venues'//post_type |
| 499 | 499 | ); |
| 500 | 500 | $datatypes_array = array( |
| 501 | - '%s',//VNU_name |
|
| 502 | - '%s',//VNU_desc |
|
| 503 | - '%s',//VNU_identifier |
|
| 504 | - '%s',//VNU_created |
|
| 501 | + '%s', //VNU_name |
|
| 502 | + '%s', //VNU_desc |
|
| 503 | + '%s', //VNU_identifier |
|
| 504 | + '%s', //VNU_created |
|
| 505 | 505 | '%s', |
| 506 | - '%s',//VNU_short_desc |
|
| 507 | - '%s',//VNU_modified |
|
| 506 | + '%s', //VNU_short_desc |
|
| 507 | + '%s', //VNU_modified |
|
| 508 | 508 | '%s', |
| 509 | - '%d',//VNU_wp_user |
|
| 510 | - '%d',//parent |
|
| 511 | - '%d',//VNU_order |
|
| 512 | - '%s',//post_type |
|
| 509 | + '%d', //VNU_wp_user |
|
| 510 | + '%d', //parent |
|
| 511 | + '%d', //VNU_order |
|
| 512 | + '%s', //post_type |
|
| 513 | 513 | ); |
| 514 | 514 | $success = $wpdb->insert($wpdb->posts, |
| 515 | 515 | $insertion_array, |
| 516 | 516 | $datatypes_array); |
| 517 | - if( ! $success ){ |
|
| 517 | + if ( ! $success) { |
|
| 518 | 518 | $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_venue, $this->_new_table, $insertion_array, $datatypes_array)); |
| 519 | 519 | return 0; |
| 520 | 520 | } |
@@ -527,78 +527,78 @@ discard block |
||
| 527 | 527 | * @param type $old_event |
| 528 | 528 | * @return int |
| 529 | 529 | */ |
| 530 | - private function _insert_venue_into_meta_table($cpt_id,$old_event){ |
|
| 530 | + private function _insert_venue_into_meta_table($cpt_id, $old_event) { |
|
| 531 | 531 | global $wpdb; |
| 532 | 532 | |
| 533 | 533 | //assume the country is the same as the organization's old settings |
| 534 | 534 | $country_iso = $this->get_migration_script()->get_default_country_iso(); |
| 535 | 535 | //find the state from the venue, or the organization, or just guess california |
| 536 | - if( ! $old_event['state']){ |
|
| 536 | + if ( ! $old_event['state']) { |
|
| 537 | 537 | $old_org_options = get_option('events_organization_settings'); |
| 538 | 538 | $state_name = stripslashes($old_org_options['organization_state']); |
| 539 | - }else{ |
|
| 539 | + } else { |
|
| 540 | 540 | $state_name = $old_event['state']; |
| 541 | 541 | } |
| 542 | - if ( ! $state_name ){ |
|
| 542 | + if ( ! $state_name) { |
|
| 543 | 543 | $state_name = 'CA'; |
| 544 | 544 | } |
| 545 | 545 | //get a state ID with the same name, if possible |
| 546 | - try{ |
|
| 547 | - $state = $this->get_migration_script()->get_or_create_state($state_name,$country_iso); |
|
| 546 | + try { |
|
| 547 | + $state = $this->get_migration_script()->get_or_create_state($state_name, $country_iso); |
|
| 548 | 548 | $state_id = $state['STA_ID']; |
| 549 | - }catch(EE_Error $e){ |
|
| 549 | + } catch (EE_Error $e) { |
|
| 550 | 550 | $this->add_error($e->getMessage()); |
| 551 | 551 | $state_id = 0; |
| 552 | 552 | } |
| 553 | 553 | //now insert into meta table |
| 554 | 554 | $insertion_array = array( |
| 555 | - 'VNU_ID'=>$cpt_id,//VNU_ID_fk |
|
| 556 | - 'VNU_address'=>stripslashes($old_event['address']),//VNU_address |
|
| 557 | - 'VNU_address2'=>stripslashes($old_event['address2']),//VNU_address2 |
|
| 558 | - 'VNU_city'=>stripslashes($old_event['city']),//VNU_city |
|
| 559 | - 'STA_ID'=>$state_id,//STA_ID |
|
| 560 | - 'CNT_ISO'=>$country_iso,//CNT_ISO |
|
| 561 | - 'VNU_zip'=>$old_event['zip'],//VNU_zip |
|
| 562 | - 'VNU_phone'=>$old_event['venue_phone'],//VNU_phone |
|
| 563 | - 'VNU_capacity'=>-1,//VNU_capacity |
|
| 564 | - 'VNU_url'=>$old_event['venue_url'],//VNU_url |
|
| 565 | - 'VNU_virtual_phone'=>$old_event['virtual_phone'],//VNU_virtual_phone |
|
| 566 | - 'VNU_virtual_url'=>$old_event['virtual_url'],//VNU_virtual_url |
|
| 567 | - 'VNU_google_map_link'=>'',//VNU_google_map_link |
|
| 555 | + 'VNU_ID'=>$cpt_id, //VNU_ID_fk |
|
| 556 | + 'VNU_address'=>stripslashes($old_event['address']), //VNU_address |
|
| 557 | + 'VNU_address2'=>stripslashes($old_event['address2']), //VNU_address2 |
|
| 558 | + 'VNU_city'=>stripslashes($old_event['city']), //VNU_city |
|
| 559 | + 'STA_ID'=>$state_id, //STA_ID |
|
| 560 | + 'CNT_ISO'=>$country_iso, //CNT_ISO |
|
| 561 | + 'VNU_zip'=>$old_event['zip'], //VNU_zip |
|
| 562 | + 'VNU_phone'=>$old_event['venue_phone'], //VNU_phone |
|
| 563 | + 'VNU_capacity'=>-1, //VNU_capacity |
|
| 564 | + 'VNU_url'=>$old_event['venue_url'], //VNU_url |
|
| 565 | + 'VNU_virtual_phone'=>$old_event['virtual_phone'], //VNU_virtual_phone |
|
| 566 | + 'VNU_virtual_url'=>$old_event['virtual_url'], //VNU_virtual_url |
|
| 567 | + 'VNU_google_map_link'=>'', //VNU_google_map_link |
|
| 568 | 568 | 'VNU_enable_for_gmap'=>true //VNU_enable_for_gmap |
| 569 | 569 | ); |
| 570 | 570 | $datatypes = array( |
| 571 | - '%d',//VNU_ID_fk |
|
| 572 | - '%s',//VNU_address |
|
| 573 | - '%s',//VNU_address2 |
|
| 574 | - '%s',//VNU_city |
|
| 575 | - '%d',//STA_ID |
|
| 576 | - '%s',//CNT_ISO |
|
| 577 | - '%s',//VNU_zip |
|
| 578 | - '%s',//VNU_phone |
|
| 579 | - '%d',//VNU_capacity |
|
| 580 | - '%s',//VNU_url |
|
| 581 | - '%s',//VNU_virtual_phone |
|
| 582 | - '%s',//VNU_virtual_url |
|
| 583 | - '%s',//VNU_google_map_link |
|
| 584 | - '%d',//VNU_enable_for_gmap |
|
| 571 | + '%d', //VNU_ID_fk |
|
| 572 | + '%s', //VNU_address |
|
| 573 | + '%s', //VNU_address2 |
|
| 574 | + '%s', //VNU_city |
|
| 575 | + '%d', //STA_ID |
|
| 576 | + '%s', //CNT_ISO |
|
| 577 | + '%s', //VNU_zip |
|
| 578 | + '%s', //VNU_phone |
|
| 579 | + '%d', //VNU_capacity |
|
| 580 | + '%s', //VNU_url |
|
| 581 | + '%s', //VNU_virtual_phone |
|
| 582 | + '%s', //VNU_virtual_url |
|
| 583 | + '%s', //VNU_google_map_link |
|
| 584 | + '%d', //VNU_enable_for_gmap |
|
| 585 | 585 | ); |
| 586 | - $success = $wpdb->insert($wpdb->prefix."esp_venue_meta",$insertion_array,$datatypes); |
|
| 587 | - if( ! $success ){ |
|
| 586 | + $success = $wpdb->insert($wpdb->prefix."esp_venue_meta", $insertion_array, $datatypes); |
|
| 587 | + if ( ! $success) { |
|
| 588 | 588 | $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_event, $this->_new_meta_table, $insertion_array, $datatypes)); |
| 589 | 589 | return 0; |
| 590 | 590 | } |
| 591 | 591 | return $wpdb->insert_id; |
| 592 | 592 | } |
| 593 | 593 | |
| 594 | - private function _insert_new_venue_to_event($new_event_id,$new_venue_id){ |
|
| 594 | + private function _insert_new_venue_to_event($new_event_id, $new_venue_id) { |
|
| 595 | 595 | global $wpdb; |
| 596 | - if( ! $new_event_id){ |
|
| 597 | - $this->add_error(sprintf(__("Could not find 4.1 event id for 3.1 event #%d.", "event_espresso"),$new_event_id)); |
|
| 596 | + if ( ! $new_event_id) { |
|
| 597 | + $this->add_error(sprintf(__("Could not find 4.1 event id for 3.1 event #%d.", "event_espresso"), $new_event_id)); |
|
| 598 | 598 | return 0; |
| 599 | 599 | } |
| 600 | - if( ! $new_venue_id){ |
|
| 601 | - $this->add_error(sprintf(__("Could not find 4.1 venue id for 3.1 venue #%d.", "event_espresso"),$new_venue_id)); |
|
| 600 | + if ( ! $new_venue_id) { |
|
| 601 | + $this->add_error(sprintf(__("Could not find 4.1 venue id for 3.1 venue #%d.", "event_espresso"), $new_venue_id)); |
|
| 602 | 602 | return 0; |
| 603 | 603 | } |
| 604 | 604 | $cols_n_values = array( |
@@ -607,12 +607,12 @@ discard block |
||
| 607 | 607 | 'EVV_primary'=>true |
| 608 | 608 | ); |
| 609 | 609 | $datatypes = array( |
| 610 | - '%d',//EVT_ID |
|
| 611 | - '%d',//VNU_ID |
|
| 612 | - '%d',//EVT_primary |
|
| 610 | + '%d', //EVT_ID |
|
| 611 | + '%d', //VNU_ID |
|
| 612 | + '%d', //EVT_primary |
|
| 613 | 613 | ); |
| 614 | - $success = $wpdb->insert($wpdb->prefix."esp_event_venue",$cols_n_values,$datatypes); |
|
| 615 | - if ( ! $success){ |
|
| 614 | + $success = $wpdb->insert($wpdb->prefix."esp_event_venue", $cols_n_values, $datatypes); |
|
| 615 | + if ( ! $success) { |
|
| 616 | 616 | $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_event_venue_rel, $this->_new_table, $cols_n_values, $datatypes)); |
| 617 | 617 | return 0; |
| 618 | 618 | } |
@@ -626,11 +626,11 @@ discard block |
||
| 626 | 626 | * @param int $new_cpt_id new post ID |
| 627 | 627 | * @return void (if there are errors though, adds them to the stage's error list |
| 628 | 628 | */ |
| 629 | - private function _convert_start_end_times($old_event,$new_cpt_id){ |
|
| 629 | + private function _convert_start_end_times($old_event, $new_cpt_id) { |
|
| 630 | 630 | $start_end_times = $this->_get_old_start_end_times($old_event['id']); |
| 631 | - foreach($start_end_times as $start_end_time){ |
|
| 632 | - $datetime_id = $this->_insert_new_datetime($start_end_time,$old_event,$new_cpt_id); |
|
| 633 | - if($datetime_id){ |
|
| 631 | + foreach ($start_end_times as $start_end_time) { |
|
| 632 | + $datetime_id = $this->_insert_new_datetime($start_end_time, $old_event, $new_cpt_id); |
|
| 633 | + if ($datetime_id) { |
|
| 634 | 634 | $this->get_migration_script()->set_mapping($this->_old_start_end_table, $start_end_time['id'], $this->_new_datetime_table, $datetime_id); |
| 635 | 635 | } |
| 636 | 636 | } |
@@ -641,9 +641,9 @@ discard block |
||
| 641 | 641 | * @param type $old_event_id |
| 642 | 642 | * @return type |
| 643 | 643 | */ |
| 644 | - private function _get_old_start_end_times($old_event_id){ |
|
| 644 | + private function _get_old_start_end_times($old_event_id) { |
|
| 645 | 645 | global $wpdb; |
| 646 | - return $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_start_end_table WHERE event_id=%d",$old_event_id),ARRAY_A); |
|
| 646 | + return $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_start_end_table WHERE event_id=%d", $old_event_id), ARRAY_A); |
|
| 647 | 647 | } |
| 648 | 648 | /** |
| 649 | 649 | * Inserts a 4.1 datetime given the 3.1 start_end db row and event_details row |
@@ -652,40 +652,40 @@ discard block |
||
| 652 | 652 | * @param type $new_cpt_id |
| 653 | 653 | * @return int ID of new datetime |
| 654 | 654 | */ |
| 655 | - private function _insert_new_datetime($start_end_time_row,$old_event_row,$new_cpt_id){ |
|
| 655 | + private function _insert_new_datetime($start_end_time_row, $old_event_row, $new_cpt_id) { |
|
| 656 | 656 | global $wpdb; |
| 657 | 657 | $start_date = $old_event_row['start_date']; |
| 658 | 658 | $start_time = $this->get_migration_script()->convertTimeFromAMPM($start_end_time_row['start_time']); |
| 659 | 659 | $end_date = $old_event_row['end_date']; |
| 660 | 660 | $end_time = $this->get_migration_script()->convertTimeFromAMPM($start_end_time_row['end_time']); |
| 661 | 661 | $existing_datetimes = $this->_count_other_datetimes_exist_for_new_event($new_cpt_id); |
| 662 | - $start_datetime_utc = $this->get_migration_script()->convert_date_string_to_utc($this,$start_end_time_row,"$start_date $start_time:00",$old_event_row['timezone_string']); |
|
| 663 | - $end_datetime_utc = $this->get_migration_script()->convert_date_string_to_utc($this,$start_end_time_row,"$end_date $end_time:00",$old_event_row['timezone_string']); |
|
| 662 | + $start_datetime_utc = $this->get_migration_script()->convert_date_string_to_utc($this, $start_end_time_row, "$start_date $start_time:00", $old_event_row['timezone_string']); |
|
| 663 | + $end_datetime_utc = $this->get_migration_script()->convert_date_string_to_utc($this, $start_end_time_row, "$end_date $end_time:00", $old_event_row['timezone_string']); |
|
| 664 | 664 | $cols_n_values = array( |
| 665 | - 'EVT_ID'=>$new_cpt_id,//EVT_ID |
|
| 666 | - 'DTT_EVT_start'=>$start_datetime_utc,//DTT_EVT_start |
|
| 667 | - 'DTT_EVT_end'=> $end_datetime_utc,//DTT_EVT_end |
|
| 668 | - 'DTT_reg_limit'=>intval($start_end_time_row['reg_limit']) ? $start_end_time_row['reg_limit'] : $old_event_row['reg_limit'],//DTT_reg_limit |
|
| 669 | - 'DTT_sold'=>0,//note: we will increment this as registrations are added during the migration |
|
| 665 | + 'EVT_ID'=>$new_cpt_id, //EVT_ID |
|
| 666 | + 'DTT_EVT_start'=>$start_datetime_utc, //DTT_EVT_start |
|
| 667 | + 'DTT_EVT_end'=> $end_datetime_utc, //DTT_EVT_end |
|
| 668 | + 'DTT_reg_limit'=>intval($start_end_time_row['reg_limit']) ? $start_end_time_row['reg_limit'] : $old_event_row['reg_limit'], //DTT_reg_limit |
|
| 669 | + 'DTT_sold'=>0, //note: we will increment this as registrations are added during the migration |
|
| 670 | 670 | // 'DTT_is_primary'=> 0 == $existing_datetimes ,//DTT_is_primary... if count==0, then we'll call it the 'primary' |
| 671 | - 'DTT_order'=> $existing_datetimes,//DTT_order, just give it the same order as the count of how many datetimes already exist |
|
| 671 | + 'DTT_order'=> $existing_datetimes, //DTT_order, just give it the same order as the count of how many datetimes already exist |
|
| 672 | 672 | 'DTT_parent'=>0, |
| 673 | 673 | 'DTT_deleted'=>false |
| 674 | 674 | ); |
| 675 | 675 | $datatypes = array( |
| 676 | - '%d',//EVT_Id |
|
| 677 | - '%s',//DTT_EVT_start |
|
| 678 | - '%s',//DTT_EVT_end |
|
| 679 | - '%d',//DTT_reg_limit |
|
| 680 | - '%d',//DTT_sold |
|
| 676 | + '%d', //EVT_Id |
|
| 677 | + '%s', //DTT_EVT_start |
|
| 678 | + '%s', //DTT_EVT_end |
|
| 679 | + '%d', //DTT_reg_limit |
|
| 680 | + '%d', //DTT_sold |
|
| 681 | 681 | // '%d',//DTT_is_primary |
| 682 | - '%d',//DTT_order |
|
| 683 | - '%d',//DTT_parent |
|
| 684 | - '%d',//DTT_deleted |
|
| 682 | + '%d', //DTT_order |
|
| 683 | + '%d', //DTT_parent |
|
| 684 | + '%d', //DTT_deleted |
|
| 685 | 685 | ); |
| 686 | - $success = $wpdb->insert($this->_new_datetime_table,$cols_n_values,$datatypes); |
|
| 687 | - if ( ! $success){ |
|
| 688 | - $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_start_end_table, array_merge($old_event_row,$start_end_time_row), $this->_new_datetime_table, $cols_n_values, $datatypes)); |
|
| 686 | + $success = $wpdb->insert($this->_new_datetime_table, $cols_n_values, $datatypes); |
|
| 687 | + if ( ! $success) { |
|
| 688 | + $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_start_end_table, array_merge($old_event_row, $start_end_time_row), $this->_new_datetime_table, $cols_n_values, $datatypes)); |
|
| 689 | 689 | return 0; |
| 690 | 690 | } |
| 691 | 691 | return $wpdb->insert_id; |
@@ -698,9 +698,9 @@ discard block |
||
| 698 | 698 | * @param type $cpt_event_id |
| 699 | 699 | * @return int |
| 700 | 700 | */ |
| 701 | - private function _count_other_datetimes_exist_for_new_event($cpt_event_id){ |
|
| 701 | + private function _count_other_datetimes_exist_for_new_event($cpt_event_id) { |
|
| 702 | 702 | global $wpdb; |
| 703 | - $count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $this->_new_datetime_table WHERE EVT_ID=%d",$cpt_event_id)); |
|
| 703 | + $count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $this->_new_datetime_table WHERE EVT_ID=%d", $cpt_event_id)); |
|
| 704 | 704 | return intval($count); |
| 705 | 705 | } |
| 706 | 706 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 4 | 4 | exit('No direct script access allowed'); |
| 5 | 5 | |
| 6 | 6 | /** |
@@ -25,32 +25,32 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * ------------------------------------------------------------------------ |
| 27 | 27 | */ |
| 28 | -class EEM_Currency extends EEM_Base{ |
|
| 28 | +class EEM_Currency extends EEM_Base { |
|
| 29 | 29 | // private instance of the Attendee object |
| 30 | 30 | protected static $_instance = NULL; |
| 31 | 31 | |
| 32 | - protected function __construct( $timezone = NULL ) { |
|
| 33 | - $this->singular_item = __('Currency','event_espresso'); |
|
| 34 | - $this->plural_item = __('Currencies','event_espresso'); |
|
| 32 | + protected function __construct($timezone = NULL) { |
|
| 33 | + $this->singular_item = __('Currency', 'event_espresso'); |
|
| 34 | + $this->plural_item = __('Currencies', 'event_espresso'); |
|
| 35 | 35 | $this->_tables = array( |
| 36 | 36 | 'Currency'=> new EE_Primary_Table('esp_currency', 'CUR_code') |
| 37 | 37 | ); |
| 38 | 38 | $this->_fields = array( |
| 39 | 39 | 'Currency'=>array( |
| 40 | - 'CUR_code'=> new EE_Primary_Key_String_Field('CUR_code', __('Currency Code','event_espresso')), |
|
| 41 | - 'CUR_single' => new EE_Plain_Text_Field('CUR_single', __('Currency Name Singular','event_espresso'), false), |
|
| 42 | - 'CUR_plural' => new EE_Plain_Text_Field('CUR_plural', __('Currency Name Plural','event_espresso'), false), |
|
| 43 | - 'CUR_sign' => new EE_Plain_Text_Field('CUR_sign', __('Currency Sign','event_espresso'), false), |
|
| 44 | - 'CUR_dec_plc' => new EE_Integer_Field('CUR_dec_plc', __('Currency Decimal Places','event_espresso'), false, 2), |
|
| 45 | - 'CUR_active'=>new EE_Boolean_Field('CUR_active', __('Active?', 'event_espresso'), false,true), |
|
| 40 | + 'CUR_code'=> new EE_Primary_Key_String_Field('CUR_code', __('Currency Code', 'event_espresso')), |
|
| 41 | + 'CUR_single' => new EE_Plain_Text_Field('CUR_single', __('Currency Name Singular', 'event_espresso'), false), |
|
| 42 | + 'CUR_plural' => new EE_Plain_Text_Field('CUR_plural', __('Currency Name Plural', 'event_espresso'), false), |
|
| 43 | + 'CUR_sign' => new EE_Plain_Text_Field('CUR_sign', __('Currency Sign', 'event_espresso'), false), |
|
| 44 | + 'CUR_dec_plc' => new EE_Integer_Field('CUR_dec_plc', __('Currency Decimal Places', 'event_espresso'), false, 2), |
|
| 45 | + 'CUR_active'=>new EE_Boolean_Field('CUR_active', __('Active?', 'event_espresso'), false, true), |
|
| 46 | 46 | )); |
| 47 | 47 | $this->_model_relations = array( |
| 48 | 48 | 'Payment_Method'=>new EE_HABTM_Relation('Currency_Payment_Method'), |
| 49 | 49 | ); |
| 50 | 50 | //this model is generally available for reading |
| 51 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
| 51 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
| 52 | 52 | |
| 53 | - parent::__construct( $timezone ); |
|
| 53 | + parent::__construct($timezone); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -59,10 +59,10 @@ discard block |
||
| 59 | 59 | * @param array $query_params see EEM_Base::get_all |
| 60 | 60 | * @return EE_Currency[] |
| 61 | 61 | */ |
| 62 | - public function get_all_active($query_params = array()){ |
|
| 62 | + public function get_all_active($query_params = array()) { |
|
| 63 | 63 | $query_params[0]['CUR_active'] = true; |
| 64 | - if( ! isset($query_params['order_by'])){ |
|
| 65 | - $query_params['order_by'] = array('CUR_code'=>'ASC','CUR_single'=>'ASC'); |
|
| 64 | + if ( ! isset($query_params['order_by'])) { |
|
| 65 | + $query_params['order_by'] = array('CUR_code'=>'ASC', 'CUR_single'=>'ASC'); |
|
| 66 | 66 | } |
| 67 | 67 | return $this->get_all($query_params); |
| 68 | 68 | } |
@@ -71,17 +71,17 @@ discard block |
||
| 71 | 71 | * @param EE_PMT_Base $payment_method_type |
| 72 | 72 | * @return EE_Currency[] |
| 73 | 73 | */ |
| 74 | - public function get_all_currencies_usable_by($payment_method_type){ |
|
| 75 | - if($payment_method_type instanceof EE_PMT_Base && |
|
| 76 | - $payment_method_type->get_gateway()){ |
|
| 74 | + public function get_all_currencies_usable_by($payment_method_type) { |
|
| 75 | + if ($payment_method_type instanceof EE_PMT_Base && |
|
| 76 | + $payment_method_type->get_gateway()) { |
|
| 77 | 77 | $currencies_supported = $payment_method_type->get_gateway()->currencies_supported(); |
| 78 | - }else{ |
|
| 78 | + } else { |
|
| 79 | 79 | $currencies_supported = EE_Gateway::all_currencies_supported; |
| 80 | 80 | } |
| 81 | - if($currencies_supported == EE_Gateway::all_currencies_supported || empty( $currencies_supported ) ) { |
|
| 81 | + if ($currencies_supported == EE_Gateway::all_currencies_supported || empty($currencies_supported)) { |
|
| 82 | 82 | $currencies = $this->get_all_active(); |
| 83 | - }else{ |
|
| 84 | - $currencies = $this->get_all_active(array(array('CUR_code'=>array('IN',$currencies_supported)))); |
|
| 83 | + } else { |
|
| 84 | + $currencies = $this->get_all_active(array(array('CUR_code'=>array('IN', $currencies_supported)))); |
|
| 85 | 85 | } |
| 86 | 86 | return $currencies; |
| 87 | 87 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | |
| 17 | 17 | |
| 18 | -if ( ! function_exists( 'espresso_get_template_part' )) { |
|
| 18 | +if ( ! function_exists('espresso_get_template_part')) { |
|
| 19 | 19 | /** |
| 20 | 20 | * espresso_get_template_part |
| 21 | 21 | * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | * @param string $name The name of the specialised template. |
| 26 | 26 | * @return string the html output for the formatted money value |
| 27 | 27 | */ |
| 28 | - function espresso_get_template_part( $slug = NULL, $name = NULL ) { |
|
| 29 | - EEH_Template::get_template_part( $slug, $name ); |
|
| 28 | + function espresso_get_template_part($slug = NULL, $name = NULL) { |
|
| 29 | + EEH_Template::get_template_part($slug, $name); |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | |
| 35 | -if ( ! function_exists( 'espresso_get_object_css_class' )) { |
|
| 35 | +if ( ! function_exists('espresso_get_object_css_class')) { |
|
| 36 | 36 | /** |
| 37 | 37 | * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed |
| 38 | 38 | * |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | * @param string $suffix added to the end of the generated class |
| 43 | 43 | * @return string |
| 44 | 44 | */ |
| 45 | - function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
| 46 | - return EEH_Template::get_object_css_class( $object, $prefix, $suffix ); |
|
| 45 | + function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
| 46 | + return EEH_Template::get_object_css_class($object, $prefix, $suffix); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @return boolean |
| 71 | 71 | */ |
| 72 | 72 | public static function is_espresso_theme() { |
| 73 | - return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE; |
|
| 73 | + return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | * @return void |
| 80 | 80 | */ |
| 81 | 81 | public static function load_espresso_theme_functions() { |
| 82 | - if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) { |
|
| 83 | - if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) { |
|
| 84 | - require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' ); |
|
| 82 | + if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) { |
|
| 83 | + if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) { |
|
| 84 | + require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php'); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -93,17 +93,17 @@ discard block |
||
| 93 | 93 | * @return array |
| 94 | 94 | */ |
| 95 | 95 | public static function get_espresso_themes() { |
| 96 | - if ( empty( EEH_Template::$_espresso_themes )) { |
|
| 97 | - $espresso_themes = glob( EE_PUBLIC . '*', GLOB_ONLYDIR ); |
|
| 98 | - if ( empty( $espresso_themes ) ) { |
|
| 96 | + if (empty(EEH_Template::$_espresso_themes)) { |
|
| 97 | + $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR); |
|
| 98 | + if (empty($espresso_themes)) { |
|
| 99 | 99 | return array(); |
| 100 | 100 | } |
| 101 | - if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
|
| 102 | - unset( $espresso_themes[ $key ] ); |
|
| 101 | + if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) { |
|
| 102 | + unset($espresso_themes[$key]); |
|
| 103 | 103 | } |
| 104 | 104 | EEH_Template::$_espresso_themes = array(); |
| 105 | - foreach ( $espresso_themes as $espresso_theme ) { |
|
| 106 | - EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme; |
|
| 105 | + foreach ($espresso_themes as $espresso_theme) { |
|
| 106 | + EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme; |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | return EEH_Template::$_espresso_themes; |
@@ -122,16 +122,16 @@ discard block |
||
| 122 | 122 | * @param bool $return_string |
| 123 | 123 | * @return string the html output for the formatted money value |
| 124 | 124 | */ |
| 125 | - public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE ) { |
|
| 126 | - do_action( "get_template_part_{$slug}-{$name}", $slug, $name ); |
|
| 125 | + public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) { |
|
| 126 | + do_action("get_template_part_{$slug}-{$name}", $slug, $name); |
|
| 127 | 127 | $templates = array(); |
| 128 | 128 | $name = (string) $name; |
| 129 | - if ( $name != '' ) { |
|
| 129 | + if ($name != '') { |
|
| 130 | 130 | $templates[] = "{$slug}-{$name}.php"; |
| 131 | 131 | } |
| 132 | 132 | // allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' ); |
| 133 | - if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) { |
|
| 134 | - EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string ); |
|
| 133 | + if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) { |
|
| 134 | + EEH_Template::locate_template($templates, $template_args, TRUE, $return_string); |
|
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
@@ -182,26 +182,26 @@ discard block |
||
| 182 | 182 | * Used in places where you don't actually load the template, you just want to know if there's a custom version of it. |
| 183 | 183 | * @return mixed |
| 184 | 184 | */ |
| 185 | - public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) { |
|
| 185 | + public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) { |
|
| 186 | 186 | // first use WP locate_template to check for template in the current theme folder |
| 187 | - $template_path = locate_template( $templates ); |
|
| 187 | + $template_path = locate_template($templates); |
|
| 188 | 188 | |
| 189 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
| 189 | + if ($check_if_custom && ! empty($template_path)) |
|
| 190 | 190 | return TRUE; |
| 191 | 191 | |
| 192 | 192 | // not in the theme |
| 193 | - if ( empty( $template_path )) { |
|
| 193 | + if (empty($template_path)) { |
|
| 194 | 194 | // not even a template to look for ? |
| 195 | - if ( empty( $templates )) { |
|
| 195 | + if (empty($templates)) { |
|
| 196 | 196 | // get post_type |
| 197 | - $post_type = EE_Registry::instance()->REQ->get( 'post_type' ); |
|
| 197 | + $post_type = EE_Registry::instance()->REQ->get('post_type'); |
|
| 198 | 198 | // get array of EE Custom Post Types |
| 199 | 199 | $EE_CPTs = EE_Register_CPTs::get_CPTs(); |
| 200 | 200 | // build template name based on request |
| 201 | - if ( isset( $EE_CPTs[ $post_type ] )) { |
|
| 202 | - $archive_or_single = is_archive() ? 'archive' : ''; |
|
| 203 | - $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
| 204 | - $templates = $archive_or_single . '-' . $post_type . '.php'; |
|
| 201 | + if (isset($EE_CPTs[$post_type])) { |
|
| 202 | + $archive_or_single = is_archive() ? 'archive' : ''; |
|
| 203 | + $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
| 204 | + $templates = $archive_or_single.'-'.$post_type.'.php'; |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | // currently active EE template theme |
@@ -210,81 +210,81 @@ discard block |
||
| 210 | 210 | // array of paths to folders that may contain templates |
| 211 | 211 | $template_folder_paths = array( |
| 212 | 212 | // first check the /wp-content/uploads/espresso/templates/(current EE theme)/ folder for an EE theme template file |
| 213 | - EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, |
|
| 213 | + EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme, |
|
| 214 | 214 | // then in the root of the /wp-content/uploads/espresso/templates/ folder |
| 215 | 215 | EVENT_ESPRESSO_TEMPLATE_DIR |
| 216 | 216 | ); |
| 217 | 217 | |
| 218 | 218 | //add core plugin folders for checking only if we're not $check_if_custom |
| 219 | - if ( ! $check_if_custom ) { |
|
| 219 | + if ( ! $check_if_custom) { |
|
| 220 | 220 | $core_paths = array( |
| 221 | 221 | // in the /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin |
| 222 | - EE_PUBLIC . $current_theme, |
|
| 222 | + EE_PUBLIC.$current_theme, |
|
| 223 | 223 | // in the /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin |
| 224 | - EE_TEMPLATES . $current_theme, |
|
| 224 | + EE_TEMPLATES.$current_theme, |
|
| 225 | 225 | // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/ |
| 226 | 226 | EE_PLUGIN_DIR_PATH |
| 227 | 227 | ); |
| 228 | - $template_folder_paths = array_merge( $template_folder_paths, $core_paths ); |
|
| 228 | + $template_folder_paths = array_merge($template_folder_paths, $core_paths); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | // now filter that array |
| 232 | - $template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths ); |
|
| 233 | - $templates = is_array( $templates ) ? $templates : array( $templates ); |
|
| 234 | - $template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths ); |
|
| 232 | + $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths); |
|
| 233 | + $templates = is_array($templates) ? $templates : array($templates); |
|
| 234 | + $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths); |
|
| 235 | 235 | // array to hold all possible template paths |
| 236 | 236 | $full_template_paths = array(); |
| 237 | 237 | |
| 238 | 238 | // loop through $templates |
| 239 | - foreach ( $templates as $template ) { |
|
| 239 | + foreach ($templates as $template) { |
|
| 240 | 240 | // normalize directory separators |
| 241 | - $template = EEH_File::standardise_directory_separators( $template ); |
|
| 242 | - $file_name = basename( $template ); |
|
| 243 | - $template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) ); |
|
| 241 | + $template = EEH_File::standardise_directory_separators($template); |
|
| 242 | + $file_name = basename($template); |
|
| 243 | + $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1)); |
|
| 244 | 244 | // while looping through all template folder paths |
| 245 | - foreach ( $template_folder_paths as $template_folder_path ) { |
|
| 245 | + foreach ($template_folder_paths as $template_folder_path) { |
|
| 246 | 246 | // normalize directory separators |
| 247 | - $template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path ); |
|
| 247 | + $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path); |
|
| 248 | 248 | // determine if any common base path exists between the two paths |
| 249 | 249 | $common_base_path = EEH_Template::_find_common_base_path( |
| 250 | - array( $template_folder_path, $template_path_minus_file_name ) |
|
| 250 | + array($template_folder_path, $template_path_minus_file_name) |
|
| 251 | 251 | ); |
| 252 | - if ( $common_base_path !== '' ) { |
|
| 252 | + if ($common_base_path !== '') { |
|
| 253 | 253 | // both paths have a common base, so just tack the filename onto our search path |
| 254 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name; |
|
| 254 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name; |
|
| 255 | 255 | } else { |
| 256 | 256 | // no common base path, so let's just concatenate |
| 257 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template; |
|
| 257 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template; |
|
| 258 | 258 | } |
| 259 | 259 | // build up our template locations array by adding our resolved paths |
| 260 | 260 | $full_template_paths[] = $resolved_path; |
| 261 | 261 | } |
| 262 | 262 | // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first |
| 263 | - array_unshift( $full_template_paths, $template ); |
|
| 263 | + array_unshift($full_template_paths, $template); |
|
| 264 | 264 | // path to the directory of the current theme: /wp-content/themes/(current WP theme)/ |
| 265 | - array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name ); |
|
| 265 | + array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name); |
|
| 266 | 266 | } |
| 267 | 267 | // filter final array of full template paths |
| 268 | - $full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name ); |
|
| 268 | + $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name); |
|
| 269 | 269 | // now loop through our final array of template location paths and check each location |
| 270 | - foreach ( (array)$full_template_paths as $full_template_path ) { |
|
| 271 | - if ( is_readable( $full_template_path )) { |
|
| 272 | - $template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path ); |
|
| 270 | + foreach ((array) $full_template_paths as $full_template_path) { |
|
| 271 | + if (is_readable($full_template_path)) { |
|
| 272 | + $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path); |
|
| 273 | 273 | // hook that can be used to display the full template path that will be used |
| 274 | - do_action( 'AHEE__EEH_Template__locate_template__full_template_path', $template_path ); |
|
| 274 | + do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path); |
|
| 275 | 275 | break; |
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | // if we got it and you want to see it... |
| 280 | - if ( $template_path && $load && ! $check_if_custom ) { |
|
| 281 | - if ( $return_string ) { |
|
| 282 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
| 280 | + if ($template_path && $load && ! $check_if_custom) { |
|
| 281 | + if ($return_string) { |
|
| 282 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
| 283 | 283 | } else { |
| 284 | - EEH_Template::display_template( $template_path, $template_args, FALSE ); |
|
| 284 | + EEH_Template::display_template($template_path, $template_args, FALSE); |
|
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | - return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path; |
|
| 287 | + return $check_if_custom && ! empty($template_path) ? TRUE : $template_path; |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | |
@@ -297,21 +297,21 @@ discard block |
||
| 297 | 297 | * @param array $paths |
| 298 | 298 | * @return string |
| 299 | 299 | */ |
| 300 | - protected static function _find_common_base_path( $paths ) { |
|
| 300 | + protected static function _find_common_base_path($paths) { |
|
| 301 | 301 | $last_offset = 0; |
| 302 | 302 | $common_base_path = ''; |
| 303 | - while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) { |
|
| 303 | + while (($index = strpos($paths[0], DS, $last_offset)) !== false) { |
|
| 304 | 304 | $dir_length = $index - $last_offset + 1; |
| 305 | - $directory = substr( $paths[ 0 ], $last_offset, $dir_length ); |
|
| 306 | - foreach ( $paths as $path ) { |
|
| 307 | - if ( substr( $path, $last_offset, $dir_length ) != $directory ) { |
|
| 305 | + $directory = substr($paths[0], $last_offset, $dir_length); |
|
| 306 | + foreach ($paths as $path) { |
|
| 307 | + if (substr($path, $last_offset, $dir_length) != $directory) { |
|
| 308 | 308 | return $common_base_path; |
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | $common_base_path .= $directory; |
| 312 | 312 | $last_offset = $index + 1; |
| 313 | 313 | } |
| 314 | - return substr( $common_base_path, 0, -1 ); |
|
| 314 | + return substr($common_base_path, 0, -1); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | * @param boolean $return_string whether to send output immediately to screen, or capture and return as a string |
| 324 | 324 | * @return mixed string |
| 325 | 325 | */ |
| 326 | - public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) { |
|
| 326 | + public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) { |
|
| 327 | 327 | |
| 328 | 328 | /** |
| 329 | 329 | * These two filters are intended for last minute changes to templates being loaded and/or template arg |
@@ -334,26 +334,26 @@ discard block |
||
| 334 | 334 | * |
| 335 | 335 | * @since 4.6.0 |
| 336 | 336 | */ |
| 337 | - $template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path ); |
|
| 338 | - $template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args ); |
|
| 337 | + $template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path); |
|
| 338 | + $template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args); |
|
| 339 | 339 | |
| 340 | 340 | // you gimme nuttin - YOU GET NUTTIN !! |
| 341 | - if ( ! $template_path || ! is_readable( $template_path )) { |
|
| 341 | + if ( ! $template_path || ! is_readable($template_path)) { |
|
| 342 | 342 | return ''; |
| 343 | 343 | } |
| 344 | 344 | // if $template_args are not in an array, then make it so |
| 345 | - if ( ! is_array( $template_args ) && ! is_object( $template_args )) { |
|
| 346 | - $template_args = array( $template_args ); |
|
| 345 | + if ( ! is_array($template_args) && ! is_object($template_args)) { |
|
| 346 | + $template_args = array($template_args); |
|
| 347 | 347 | } |
| 348 | - extract( (array) $template_args); |
|
| 348 | + extract((array) $template_args); |
|
| 349 | 349 | |
| 350 | - if ( $return_string ) { |
|
| 350 | + if ($return_string) { |
|
| 351 | 351 | // because we want to return a string, we are going to capture the output |
| 352 | 352 | ob_start(); |
| 353 | - include( $template_path ); |
|
| 353 | + include($template_path); |
|
| 354 | 354 | return ob_get_clean(); |
| 355 | 355 | } else { |
| 356 | - include( $template_path ); |
|
| 356 | + include($template_path); |
|
| 357 | 357 | } |
| 358 | 358 | return ''; |
| 359 | 359 | } |
@@ -371,27 +371,27 @@ discard block |
||
| 371 | 371 | * @param string $suffix added to the end of the generated class |
| 372 | 372 | * @return string |
| 373 | 373 | */ |
| 374 | - public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
| 374 | + public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
| 375 | 375 | // in the beginning... |
| 376 | - $prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : ''; |
|
| 376 | + $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : ''; |
|
| 377 | 377 | // da muddle |
| 378 | 378 | $class = ''; |
| 379 | 379 | // the end |
| 380 | - $suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : ''; |
|
| 380 | + $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : ''; |
|
| 381 | 381 | // is the passed object an EE object ? |
| 382 | - if ( $object instanceof EE_Base_Class ) { |
|
| 382 | + if ($object instanceof EE_Base_Class) { |
|
| 383 | 383 | // grab the exact type of object |
| 384 | - $obj_class = get_class( $object ); |
|
| 384 | + $obj_class = get_class($object); |
|
| 385 | 385 | // depending on the type of object... |
| 386 | - switch ( $obj_class ) { |
|
| 386 | + switch ($obj_class) { |
|
| 387 | 387 | // no specifics just yet... |
| 388 | 388 | default : |
| 389 | - $class = strtolower( str_replace( '_', '-', $obj_class )); |
|
| 390 | - $class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : ''; |
|
| 389 | + $class = strtolower(str_replace('_', '-', $obj_class)); |
|
| 390 | + $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : ''; |
|
| 391 | 391 | |
| 392 | 392 | } |
| 393 | 393 | } |
| 394 | - return $prefix . $class . $suffix; |
|
| 394 | + return $prefix.$class.$suffix; |
|
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | |
@@ -407,54 +407,54 @@ discard block |
||
| 407 | 407 | * @param string $cur_code_span_class |
| 408 | 408 | * @return string the html output for the formatted money value |
| 409 | 409 | */ |
| 410 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) { |
|
| 410 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') { |
|
| 411 | 411 | // ensure amount was received |
| 412 | - if ( is_null( $amount ) ) { |
|
| 413 | - $msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' ); |
|
| 414 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 412 | + if (is_null($amount)) { |
|
| 413 | + $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso'); |
|
| 414 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 415 | 415 | return ''; |
| 416 | 416 | } |
| 417 | 417 | //ensure amount is float |
| 418 | - $amount = apply_filters( 'FHEE__EEH_Template__format_currency__raw_amount', (float) $amount ); |
|
| 419 | - $CNT_ISO = apply_filters( 'FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount ); |
|
| 418 | + $amount = apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float) $amount); |
|
| 419 | + $CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount); |
|
| 420 | 420 | // filter raw amount (allows 0.00 to be changed to "free" for example) |
| 421 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw ); |
|
| 421 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw); |
|
| 422 | 422 | // still a number or was amount converted to a string like "free" ? |
| 423 | - if ( is_float( $amount_formatted )) { |
|
| 423 | + if (is_float($amount_formatted)) { |
|
| 424 | 424 | // was a country ISO code passed ? if so generate currency config object for that country |
| 425 | - $mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL; |
|
| 425 | + $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL; |
|
| 426 | 426 | // verify results |
| 427 | - if ( ! $mny instanceof EE_Currency_Config ) { |
|
| 427 | + if ( ! $mny instanceof EE_Currency_Config) { |
|
| 428 | 428 | // set default config country currency settings |
| 429 | 429 | $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
| 430 | 430 | } |
| 431 | 431 | // format float |
| 432 | - $amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds ); |
|
| 432 | + $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds); |
|
| 433 | 433 | // add formatting ? |
| 434 | - if ( ! $return_raw ) { |
|
| 434 | + if ( ! $return_raw) { |
|
| 435 | 435 | // add currency sign |
| 436 | - if( $mny->sign_b4 ){ |
|
| 437 | - if( $amount >= 0 ){ |
|
| 438 | - $amount_formatted = $mny->sign . $amount_formatted; |
|
| 439 | - }else{ |
|
| 440 | - $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
|
| 436 | + if ($mny->sign_b4) { |
|
| 437 | + if ($amount >= 0) { |
|
| 438 | + $amount_formatted = $mny->sign.$amount_formatted; |
|
| 439 | + } else { |
|
| 440 | + $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted); |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | - }else{ |
|
| 444 | - $amount_formatted = $amount_formatted . $mny->sign; |
|
| 443 | + } else { |
|
| 444 | + $amount_formatted = $amount_formatted.$mny->sign; |
|
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | // filter to allow global setting of display_code |
| 448 | - $display_code = apply_filters( 'FHEE__EEH_Template__format_currency__display_code', $display_code ); |
|
| 448 | + $display_code = apply_filters('FHEE__EEH_Template__format_currency__display_code', $display_code); |
|
| 449 | 449 | |
| 450 | 450 | // add currency code ? |
| 451 | - $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted; |
|
| 451 | + $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted; |
|
| 452 | 452 | } |
| 453 | 453 | // filter results |
| 454 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw ); |
|
| 454 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw); |
|
| 455 | 455 | } |
| 456 | 456 | // clean up vars |
| 457 | - unset( $mny ); |
|
| 457 | + unset($mny); |
|
| 458 | 458 | // return formatted currency amount |
| 459 | 459 | return $amount_formatted; |
| 460 | 460 | } |
@@ -469,11 +469,11 @@ discard block |
||
| 469 | 469 | * @param string $schema 'UPPER', 'lower', or 'Sentence' |
| 470 | 470 | * @return string The localized label for the status id. |
| 471 | 471 | */ |
| 472 | - public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) { |
|
| 472 | + public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') { |
|
| 473 | 473 | /** @type EEM_Status $EEM_Status */ |
| 474 | - $EEM_Status = EE_Registry::instance()->load_model( 'Status' ); |
|
| 475 | - $status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema ); |
|
| 476 | - return $status[ $status_id ]; |
|
| 474 | + $EEM_Status = EE_Registry::instance()->load_model('Status'); |
|
| 475 | + $status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema); |
|
| 476 | + return $status[$status_id]; |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | |
@@ -486,9 +486,9 @@ discard block |
||
| 486 | 486 | * @param string $icon |
| 487 | 487 | * @return string the html output for the button |
| 488 | 488 | */ |
| 489 | - public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '' ) { |
|
| 490 | - $label = ! empty( $icon ) ? '<span class="' . $icon . '"></span>' . $label : $label; |
|
| 491 | - $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '">' . $label . '</a>'; |
|
| 489 | + public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '') { |
|
| 490 | + $label = ! empty($icon) ? '<span class="'.$icon.'"></span>'.$label : $label; |
|
| 491 | + $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'">'.$label.'</a>'; |
|
| 492 | 492 | return $button; |
| 493 | 493 | } |
| 494 | 494 | |
@@ -505,21 +505,21 @@ discard block |
||
| 505 | 505 | * @param bool|string $help_text (optional) send help text you want to use for the link if default not to be used |
| 506 | 506 | * @return string generated link |
| 507 | 507 | */ |
| 508 | - public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
|
| 508 | + public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) { |
|
| 509 | 509 | |
| 510 | - if ( ! $page ) |
|
| 511 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
| 510 | + if ( ! $page) |
|
| 511 | + $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page; |
|
| 512 | 512 | |
| 513 | - if ( ! $action ) |
|
| 514 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
| 513 | + if ( ! $action) |
|
| 514 | + $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action; |
|
| 515 | 515 | |
| 516 | 516 | $action = empty($action) ? 'default' : $action; |
| 517 | 517 | |
| 518 | 518 | |
| 519 | - $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id; |
|
| 520 | - $icon = !$icon_style ? ' dashicons-editor-help' : $icon_style; |
|
| 521 | - $help_text = !$help_text ? '' : $help_text; |
|
| 522 | - return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>'; |
|
| 519 | + $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id; |
|
| 520 | + $icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style; |
|
| 521 | + $help_text = ! $help_text ? '' : $help_text; |
|
| 522 | + return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>'; |
|
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | |
@@ -531,31 +531,31 @@ discard block |
||
| 531 | 531 | * @param EE_Help_Tour |
| 532 | 532 | * @return string html |
| 533 | 533 | */ |
| 534 | - public static function help_tour_stops_generator( EE_Help_Tour $tour ) { |
|
| 534 | + public static function help_tour_stops_generator(EE_Help_Tour $tour) { |
|
| 535 | 535 | $id = $tour->get_slug(); |
| 536 | 536 | $stops = $tour->get_stops(); |
| 537 | 537 | |
| 538 | - $content = '<ol style="display:none" id="' . $id . '">'; |
|
| 538 | + $content = '<ol style="display:none" id="'.$id.'">'; |
|
| 539 | 539 | |
| 540 | - foreach ( $stops as $stop ) { |
|
| 541 | - $data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : ''; |
|
| 542 | - $data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : ''; |
|
| 540 | + foreach ($stops as $stop) { |
|
| 541 | + $data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : ''; |
|
| 542 | + $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : ''; |
|
| 543 | 543 | |
| 544 | 544 | //if container is set to modal then let's make sure we set the options accordingly |
| 545 | - if ( empty( $data_id ) && empty( $data_class ) ) { |
|
| 545 | + if (empty($data_id) && empty($data_class)) { |
|
| 546 | 546 | $stop['options']['modal'] = true; |
| 547 | 547 | $stop['options']['expose'] = true; |
| 548 | 548 | } |
| 549 | 549 | |
| 550 | - $custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : ''; |
|
| 551 | - $button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : ''; |
|
| 550 | + $custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : ''; |
|
| 551 | + $button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : ''; |
|
| 552 | 552 | $inner_content = isset($stop['content']) ? $stop['content'] : ''; |
| 553 | 553 | |
| 554 | 554 | //options |
| 555 | - if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) { |
|
| 555 | + if (isset($stop['options']) && is_array($stop['options'])) { |
|
| 556 | 556 | $options = ' data-options="'; |
| 557 | - foreach ( $stop['options'] as $option => $value ) { |
|
| 558 | - $options .= $option . ':' . $value . ';'; |
|
| 557 | + foreach ($stop['options'] as $option => $value) { |
|
| 558 | + $options .= $option.':'.$value.';'; |
|
| 559 | 559 | } |
| 560 | 560 | $options .= '"'; |
| 561 | 561 | } else { |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | //let's put all together |
| 566 | - $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>'; |
|
| 566 | + $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>'; |
|
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | $content .= '</ol>'; |
@@ -584,31 +584,31 @@ discard block |
||
| 584 | 584 | * @throws EE_Error |
| 585 | 585 | * @return string html structure for status. |
| 586 | 586 | */ |
| 587 | - public static function status_legend( $status_array, $active_status = '' ) { |
|
| 588 | - if ( !is_array( $status_array ) ) |
|
| 589 | - throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
| 587 | + public static function status_legend($status_array, $active_status = '') { |
|
| 588 | + if ( ! is_array($status_array)) |
|
| 589 | + throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso')); |
|
| 590 | 590 | |
| 591 | 591 | $setup_array = array(); |
| 592 | - foreach ( $status_array as $item => $status ) { |
|
| 592 | + foreach ($status_array as $item => $status) { |
|
| 593 | 593 | $setup_array[$item] = array( |
| 594 | - 'class' => 'ee-status-legend ee-status-legend-' . $status, |
|
| 595 | - 'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ), |
|
| 594 | + 'class' => 'ee-status-legend ee-status-legend-'.$status, |
|
| 595 | + 'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'), |
|
| 596 | 596 | 'status' => $status |
| 597 | 597 | ); |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | - $content = '<div class="ee-list-table-legend-container">' . "\n"; |
|
| 601 | - $content .= '<h3>' . __('Status Legend', 'event_espresso') . '</h3>' . "\n"; |
|
| 602 | - $content .= '<dl class="ee-list-table-legend">' . "\n\t"; |
|
| 603 | - foreach ( $setup_array as $item => $details ) { |
|
| 600 | + $content = '<div class="ee-list-table-legend-container">'."\n"; |
|
| 601 | + $content .= '<h3>'.__('Status Legend', 'event_espresso').'</h3>'."\n"; |
|
| 602 | + $content .= '<dl class="ee-list-table-legend">'."\n\t"; |
|
| 603 | + foreach ($setup_array as $item => $details) { |
|
| 604 | 604 | $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : ''; |
| 605 | - $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t"; |
|
| 606 | - $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t"; |
|
| 607 | - $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t"; |
|
| 608 | - $content .= '</dt>' . "\n"; |
|
| 605 | + $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t"; |
|
| 606 | + $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t"; |
|
| 607 | + $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t"; |
|
| 608 | + $content .= '</dt>'."\n"; |
|
| 609 | 609 | } |
| 610 | - $content .= '</dl>' . "\n"; |
|
| 611 | - $content .= '</div>' . "\n"; |
|
| 610 | + $content .= '</dl>'."\n"; |
|
| 611 | + $content .= '</div>'."\n"; |
|
| 612 | 612 | return $content; |
| 613 | 613 | } |
| 614 | 614 | |
@@ -621,8 +621,8 @@ discard block |
||
| 621 | 621 | * @return string |
| 622 | 622 | */ |
| 623 | 623 | public static function layout_array_as_table($data) { |
| 624 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) { |
|
| 625 | - $data = (array)$data; |
|
| 624 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
| 625 | + $data = (array) $data; |
|
| 626 | 626 | } |
| 627 | 627 | ob_start(); |
| 628 | 628 | if (is_array($data)) { |
@@ -635,10 +635,10 @@ discard block |
||
| 635 | 635 | ?> |
| 636 | 636 | <tr> |
| 637 | 637 | <td> |
| 638 | - <?php echo $data_key;?> |
|
| 638 | + <?php echo $data_key; ?> |
|
| 639 | 639 | </td> |
| 640 | 640 | <td> |
| 641 | - <?php echo self::layout_array_as_table($data_values);?> |
|
| 641 | + <?php echo self::layout_array_as_table($data_values); ?> |
|
| 642 | 642 | </td> |
| 643 | 643 | </tr> |
| 644 | 644 | <?php |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | <ul> |
| 653 | 653 | <?php |
| 654 | 654 | foreach ($data as $datum) { |
| 655 | - echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>"; |
|
| 655 | + echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>"; |
|
| 656 | 656 | }?> |
| 657 | 657 | </ul> |
| 658 | 658 | <?php |
@@ -682,8 +682,8 @@ discard block |
||
| 682 | 682 | * |
| 683 | 683 | * @return string |
| 684 | 684 | */ |
| 685 | - public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
| 686 | - echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label ); |
|
| 685 | + public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
| 686 | + echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label); |
|
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | |
@@ -707,13 +707,13 @@ discard block |
||
| 707 | 707 | * ) |
| 708 | 708 | * @return string |
| 709 | 709 | */ |
| 710 | - public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
| 710 | + public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
| 711 | 711 | $page_links = array(); |
| 712 | 712 | $disable_first = $disable_last = ''; |
| 713 | 713 | $total_items = (int) $total_items; |
| 714 | 714 | $per_page = (int) $per_page; |
| 715 | 715 | $current = (int) $current; |
| 716 | - $paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name ); |
|
| 716 | + $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name); |
|
| 717 | 717 | |
| 718 | 718 | //filter items_label |
| 719 | 719 | $items_label = apply_filters( |
@@ -721,68 +721,68 @@ discard block |
||
| 721 | 721 | $items_label |
| 722 | 722 | ); |
| 723 | 723 | |
| 724 | - if ( empty( $items_label ) |
|
| 725 | - || ! is_array( $items_label ) |
|
| 726 | - || ! isset( $items_label['single'] ) |
|
| 727 | - || ! isset( $items_label['plural'] ) ) { |
|
| 724 | + if (empty($items_label) |
|
| 725 | + || ! is_array($items_label) |
|
| 726 | + || ! isset($items_label['single']) |
|
| 727 | + || ! isset($items_label['plural'])) { |
|
| 728 | 728 | $items_label = array( |
| 729 | - 'single' => __( '1 item', 'event_espresso' ), |
|
| 730 | - 'plural' => __( '%s items', 'event_espresso' ) |
|
| 729 | + 'single' => __('1 item', 'event_espresso'), |
|
| 730 | + 'plural' => __('%s items', 'event_espresso') |
|
| 731 | 731 | ); |
| 732 | 732 | } else { |
| 733 | 733 | $items_label = array( |
| 734 | - 'single' => '1 ' . esc_html( $items_label['single'] ), |
|
| 735 | - 'plural' => '%s ' . esc_html( $items_label['plural'] ) |
|
| 734 | + 'single' => '1 '.esc_html($items_label['single']), |
|
| 735 | + 'plural' => '%s '.esc_html($items_label['plural']) |
|
| 736 | 736 | ); |
| 737 | 737 | } |
| 738 | 738 | |
| 739 | - $total_pages = ceil( $total_items / $per_page ); |
|
| 739 | + $total_pages = ceil($total_items / $per_page); |
|
| 740 | 740 | |
| 741 | - if ( $total_pages <= 1 ) |
|
| 741 | + if ($total_pages <= 1) |
|
| 742 | 742 | return ''; |
| 743 | 743 | |
| 744 | - $item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single']; |
|
| 744 | + $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single']; |
|
| 745 | 745 | |
| 746 | - $output = '<span class="displaying-num">' . $item_label . '</span>'; |
|
| 746 | + $output = '<span class="displaying-num">'.$item_label.'</span>'; |
|
| 747 | 747 | |
| 748 | - if ( $current === 1 ) { |
|
| 748 | + if ($current === 1) { |
|
| 749 | 749 | $disable_first = ' disabled'; |
| 750 | 750 | } |
| 751 | - if ( $current == $total_pages ) { |
|
| 751 | + if ($current == $total_pages) { |
|
| 752 | 752 | $disable_last = ' disabled'; |
| 753 | 753 | } |
| 754 | 754 | |
| 755 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
| 756 | - 'first-page' . $disable_first, |
|
| 757 | - esc_attr__( 'Go to the first page' ), |
|
| 758 | - esc_url( remove_query_arg( $paged_arg_name, $url ) ), |
|
| 755 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
| 756 | + 'first-page'.$disable_first, |
|
| 757 | + esc_attr__('Go to the first page'), |
|
| 758 | + esc_url(remove_query_arg($paged_arg_name, $url)), |
|
| 759 | 759 | '«' |
| 760 | 760 | ); |
| 761 | 761 | |
| 762 | 762 | $page_links[] = sprintf( |
| 763 | 763 | '<a class="%s" title="%s" href="%s">%s</a>', |
| 764 | - 'prev-page' . $disable_first, |
|
| 765 | - esc_attr__( 'Go to the previous page' ), |
|
| 766 | - esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ), |
|
| 764 | + 'prev-page'.$disable_first, |
|
| 765 | + esc_attr__('Go to the previous page'), |
|
| 766 | + esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)), |
|
| 767 | 767 | '‹' |
| 768 | 768 | ); |
| 769 | 769 | |
| 770 | - if ( ! $show_num_field ) { |
|
| 770 | + if ( ! $show_num_field) { |
|
| 771 | 771 | $html_current_page = $current; |
| 772 | 772 | } else { |
| 773 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
| 774 | - esc_attr__( 'Current page' ), |
|
| 773 | + $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
| 774 | + esc_attr__('Current page'), |
|
| 775 | 775 | $current, |
| 776 | - strlen( $total_pages ) |
|
| 776 | + strlen($total_pages) |
|
| 777 | 777 | ); |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | $html_total_pages = sprintf( |
| 781 | 781 | '<span class="total-pages">%s</span>', |
| 782 | - number_format_i18n( $total_pages ) |
|
| 782 | + number_format_i18n($total_pages) |
|
| 783 | 783 | ); |
| 784 | 784 | $page_links[] = sprintf( |
| 785 | - _x( '%3$s%1$s of %2$s%4$s', 'paging' ), |
|
| 785 | + _x('%3$s%1$s of %2$s%4$s', 'paging'), |
|
| 786 | 786 | $html_current_page, |
| 787 | 787 | $html_total_pages, |
| 788 | 788 | '<span class="paging-input">', |
@@ -791,29 +791,29 @@ discard block |
||
| 791 | 791 | |
| 792 | 792 | $page_links[] = sprintf( |
| 793 | 793 | '<a class="%s" title="%s" href="%s">%s</a>', |
| 794 | - 'next-page' . $disable_last, |
|
| 795 | - esc_attr__( 'Go to the next page' ), |
|
| 796 | - esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ), |
|
| 794 | + 'next-page'.$disable_last, |
|
| 795 | + esc_attr__('Go to the next page'), |
|
| 796 | + esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)), |
|
| 797 | 797 | '›' |
| 798 | 798 | ); |
| 799 | 799 | |
| 800 | 800 | $page_links[] = sprintf( |
| 801 | 801 | '<a class="%s" title="%s" href="%s">%s</a>', |
| 802 | - 'last-page' . $disable_last, |
|
| 803 | - esc_attr__( 'Go to the last page' ), |
|
| 804 | - esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ), |
|
| 802 | + 'last-page'.$disable_last, |
|
| 803 | + esc_attr__('Go to the last page'), |
|
| 804 | + esc_url(add_query_arg($paged_arg_name, $total_pages, $url)), |
|
| 805 | 805 | '»' |
| 806 | 806 | ); |
| 807 | 807 | |
| 808 | - $output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>'; |
|
| 808 | + $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>'; |
|
| 809 | 809 | // set page class |
| 810 | - if ( $total_pages ) { |
|
| 810 | + if ($total_pages) { |
|
| 811 | 811 | $page_class = $total_pages < 2 ? ' one-page' : ''; |
| 812 | 812 | } else { |
| 813 | 813 | $page_class = ' no-pages'; |
| 814 | 814 | } |
| 815 | 815 | |
| 816 | - return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>'; |
|
| 816 | + return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>'; |
|
| 817 | 817 | } |
| 818 | 818 | |
| 819 | 819 | |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | //add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 ); |
| 830 | 830 | |
| 831 | 831 | |
| 832 | -if ( ! function_exists( 'espresso_pagination' ) ) { |
|
| 832 | +if ( ! function_exists('espresso_pagination')) { |
|
| 833 | 833 | /** |
| 834 | 834 | * espresso_pagination |
| 835 | 835 | * |
@@ -841,21 +841,21 @@ discard block |
||
| 841 | 841 | $big = 999999999; // need an unlikely integer |
| 842 | 842 | $pagination = paginate_links( |
| 843 | 843 | array( |
| 844 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
| 844 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
| 845 | 845 | 'format' => '?paged=%#%', |
| 846 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
| 846 | + 'current' => max(1, get_query_var('paged')), |
|
| 847 | 847 | 'total' => $wp_query->max_num_pages, |
| 848 | 848 | 'show_all' => true, |
| 849 | 849 | 'end_size' => 10, |
| 850 | 850 | 'mid_size' => 6, |
| 851 | 851 | 'prev_next' => true, |
| 852 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
| 853 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
| 852 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
| 853 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
| 854 | 854 | 'type' => 'plain', |
| 855 | 855 | 'add_args' => false, |
| 856 | 856 | 'add_fragment' => '' |
| 857 | 857 | ) |
| 858 | 858 | ); |
| 859 | - echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
| 859 | + echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
| 860 | 860 | } |
| 861 | 861 | } |
| 862 | 862 | \ No newline at end of file |
@@ -21,18 +21,18 @@ discard block |
||
| 21 | 21 | * @param array $ee_gmaps_opts array of attributes required for the map link generation |
| 22 | 22 | * @return string (link to map!) |
| 23 | 23 | */ |
| 24 | - public static function google_map( $ee_gmaps_opts ){ |
|
| 25 | - |
|
| 26 | - $ee_map_width = isset( $ee_gmaps_opts['ee_map_width'] ) && ! empty( $ee_gmaps_opts['ee_map_width'] ) ? $ee_gmaps_opts['ee_map_width'] : '300'; |
|
| 27 | - $ee_map_height = isset( $ee_gmaps_opts['ee_map_height'] ) && ! empty( $ee_gmaps_opts['ee_map_height'] ) ? $ee_gmaps_opts['ee_map_height'] : '185'; |
|
| 28 | - $ee_map_zoom = isset( $ee_gmaps_opts['ee_map_zoom'] ) && ! empty( $ee_gmaps_opts['ee_map_zoom'] ) ? $ee_gmaps_opts['ee_map_zoom'] : '12'; |
|
| 29 | - $ee_map_nav_display = isset( $ee_gmaps_opts['ee_map_nav_display'] ) && ! empty( $ee_gmaps_opts['ee_map_nav_display'] ) ? 'true' : 'false'; |
|
| 30 | - $ee_map_nav_size = isset( $ee_gmaps_opts['ee_map_nav_size'] ) && ! empty( $ee_gmaps_opts['ee_map_nav_size'] )? $ee_gmaps_opts['ee_map_nav_size'] : 'default'; |
|
| 31 | - $ee_map_type_control = isset( $ee_gmaps_opts['ee_map_type_control'] ) && ! empty( $ee_gmaps_opts['ee_map_type_control'] )? $ee_gmaps_opts['ee_map_type_control'] : 'default'; |
|
| 32 | - $static_url = isset( $ee_gmaps_opts['ee_static_url'] ) && ! empty( $ee_gmaps_opts['ee_static_url'] )? $ee_gmaps_opts['ee_static_url'] : FALSE; |
|
| 33 | - |
|
| 34 | - if( isset( $ee_gmaps_opts['ee_map_align'] ) && ! empty( $ee_gmaps_opts['ee_map_align'] )){ |
|
| 35 | - switch( $ee_gmaps_opts['ee_map_align'] ){ |
|
| 24 | + public static function google_map($ee_gmaps_opts) { |
|
| 25 | + |
|
| 26 | + $ee_map_width = isset($ee_gmaps_opts['ee_map_width']) && ! empty($ee_gmaps_opts['ee_map_width']) ? $ee_gmaps_opts['ee_map_width'] : '300'; |
|
| 27 | + $ee_map_height = isset($ee_gmaps_opts['ee_map_height']) && ! empty($ee_gmaps_opts['ee_map_height']) ? $ee_gmaps_opts['ee_map_height'] : '185'; |
|
| 28 | + $ee_map_zoom = isset($ee_gmaps_opts['ee_map_zoom']) && ! empty($ee_gmaps_opts['ee_map_zoom']) ? $ee_gmaps_opts['ee_map_zoom'] : '12'; |
|
| 29 | + $ee_map_nav_display = isset($ee_gmaps_opts['ee_map_nav_display']) && ! empty($ee_gmaps_opts['ee_map_nav_display']) ? 'true' : 'false'; |
|
| 30 | + $ee_map_nav_size = isset($ee_gmaps_opts['ee_map_nav_size']) && ! empty($ee_gmaps_opts['ee_map_nav_size']) ? $ee_gmaps_opts['ee_map_nav_size'] : 'default'; |
|
| 31 | + $ee_map_type_control = isset($ee_gmaps_opts['ee_map_type_control']) && ! empty($ee_gmaps_opts['ee_map_type_control']) ? $ee_gmaps_opts['ee_map_type_control'] : 'default'; |
|
| 32 | + $static_url = isset($ee_gmaps_opts['ee_static_url']) && ! empty($ee_gmaps_opts['ee_static_url']) ? $ee_gmaps_opts['ee_static_url'] : FALSE; |
|
| 33 | + |
|
| 34 | + if (isset($ee_gmaps_opts['ee_map_align']) && ! empty($ee_gmaps_opts['ee_map_align'])) { |
|
| 35 | + switch ($ee_gmaps_opts['ee_map_align']) { |
|
| 36 | 36 | case "left": |
| 37 | 37 | $map_align = 'ee-gmap-align-left left'; |
| 38 | 38 | break; |
@@ -53,18 +53,18 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | // Determine whether user has set a hardoded url to use and |
| 55 | 55 | // if so display a Google static iframe map else run V3 api |
| 56 | - if( $static_url ) { |
|
| 56 | + if ($static_url) { |
|
| 57 | 57 | |
| 58 | - $html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper ' . $map_align . '">'; |
|
| 59 | - $html .= '<iframe src="' . $static_url . '&output=embed" style="width: ' . $ee_map_width .'px; height: ' . $ee_map_height . 'px;" frameborder="0" scrolling="no">'; |
|
| 58 | + $html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper '.$map_align.'">'; |
|
| 59 | + $html .= '<iframe src="'.$static_url.'&output=embed" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;" frameborder="0" scrolling="no">'; |
|
| 60 | 60 | $html .= '</iframe>'; |
| 61 | - $html .= '<a href="' . $static_url . '">View Large map</a>'; |
|
| 61 | + $html .= '<a href="'.$static_url.'">View Large map</a>'; |
|
| 62 | 62 | $html .= '</div>'; |
| 63 | 63 | return $html; |
| 64 | 64 | |
| 65 | 65 | } else { |
| 66 | 66 | |
| 67 | - EEH_Maps::$gmap_vars[ $ee_gmaps_opts['map_ID'] ] = array( |
|
| 67 | + EEH_Maps::$gmap_vars[$ee_gmaps_opts['map_ID']] = array( |
|
| 68 | 68 | 'map_ID' => $ee_gmaps_opts['map_ID'], |
| 69 | 69 | 'ee_map_zoom' => $ee_map_zoom, |
| 70 | 70 | 'ee_map_nav_display' => $ee_map_nav_display, |
@@ -74,12 +74,12 @@ discard block |
||
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | 76 | $html = '<div class="ee-gmap-wrapper '.$map_align.';">'; |
| 77 | - $html .= '<div class="ee-gmap" id="map_canvas_' . $ee_gmaps_opts['map_ID'] .'" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;"></div>'; // |
|
| 77 | + $html .= '<div class="ee-gmap" id="map_canvas_'.$ee_gmaps_opts['map_ID'].'" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;"></div>'; // |
|
| 78 | 78 | $html .= '</div>'; |
| 79 | 79 | |
| 80 | - wp_enqueue_script( 'gmap_api' ); |
|
| 81 | - wp_enqueue_script( 'ee_gmap' ); |
|
| 82 | - add_action( 'wp_footer', array( 'EEH_Maps', 'footer_enqueue_script' )); |
|
| 80 | + wp_enqueue_script('gmap_api'); |
|
| 81 | + wp_enqueue_script('ee_gmap'); |
|
| 82 | + add_action('wp_footer', array('EEH_Maps', 'footer_enqueue_script')); |
|
| 83 | 83 | |
| 84 | 84 | return $html; |
| 85 | 85 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * @return void |
| 95 | 95 | */ |
| 96 | 96 | public static function footer_enqueue_script() { |
| 97 | - wp_localize_script( 'ee_gmap', 'ee_gmap_vars', EEH_Maps::$gmap_vars ); |
|
| 97 | + wp_localize_script('ee_gmap', 'ee_gmap_vars', EEH_Maps::$gmap_vars); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | public static function espresso_google_map_js() { |
| 106 | 106 | $api_url = sprintf( |
| 107 | 107 | "https://maps.googleapis.com/maps/api/js?key=%s", |
| 108 | - apply_filters( 'FHEE__EEH_Maps__espresso_google_maps_js__api_key', EE_Registry::instance()->CFG->map_settings->google_map_api_key ) |
|
| 108 | + apply_filters('FHEE__EEH_Maps__espresso_google_maps_js__api_key', EE_Registry::instance()->CFG->map_settings->google_map_api_key) |
|
| 109 | 109 | ); |
| 110 | - wp_register_script( 'gmap_api', $api_url, array('jquery'), NULL, TRUE ); |
|
| 111 | - wp_register_script( 'ee_gmap', plugin_dir_url(__FILE__) . 'assets/ee_gmap.js', array('gmap_api'), '1.0', TRUE ); |
|
| 110 | + wp_register_script('gmap_api', $api_url, array('jquery'), NULL, TRUE); |
|
| 111 | + wp_register_script('ee_gmap', plugin_dir_url(__FILE__).'assets/ee_gmap.js', array('gmap_api'), '1.0', TRUE); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @return string (link to map!) |
| 118 | 118 | */ |
| 119 | 119 | public static function google_map_link($atts) { |
| 120 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 120 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 121 | 121 | extract($atts); |
| 122 | 122 | /** @var string $address */ |
| 123 | 123 | /** @var string $city */ |
@@ -136,9 +136,9 @@ discard block |
||
| 136 | 136 | $id = isset($id) ? $id : 'not_set'; |
| 137 | 137 | $map_image_class = isset($map_image_class) ? $map_image_class : 'ee_google_map_view'; |
| 138 | 138 | |
| 139 | - $address_string = ($address != '' ? $address : '') . ($city != '' ? ',' . $city : '') . ($state != '' ? ',' . $state : '') . ($zip != '' ? ',' . $zip : '') . ($country != '' ? ',' . $country : ''); |
|
| 139 | + $address_string = ($address != '' ? $address : '').($city != '' ? ','.$city : '').($state != '' ? ','.$state : '').($zip != '' ? ','.$zip : '').($country != '' ? ','.$country : ''); |
|
| 140 | 140 | |
| 141 | - $google_map = htmlentities2('http://maps.google.com/maps?q=' . urlencode( $address_string )); |
|
| 141 | + $google_map = htmlentities2('http://maps.google.com/maps?q='.urlencode($address_string)); |
|
| 142 | 142 | |
| 143 | 143 | switch ($type) { |
| 144 | 144 | case 'text': |
@@ -153,12 +153,12 @@ discard block |
||
| 153 | 153 | case 'map': |
| 154 | 154 | $scheme = is_ssl() ? 'https://' : 'http://'; |
| 155 | 155 | |
| 156 | - $api_key = apply_filters( 'FHEE__EEH_Maps__espresso_google_maps_link__api_key', EE_Registry::instance()->CFG->map_settings->google_map_api_key ); |
|
| 156 | + $api_key = apply_filters('FHEE__EEH_Maps__espresso_google_maps_link__api_key', EE_Registry::instance()->CFG->map_settings->google_map_api_key); |
|
| 157 | 157 | |
| 158 | - return '<a class="a_map_image_link" href="' . $google_map . '" target="_blank">' . '<img class="map_image_link" id="venue_map_' . $id . '" ' . $map_image_class . ' src="' . htmlentities2( $scheme . 'maps.googleapis.com/maps/api/staticmap?center=' . urlencode( $address_string ) . '&zoom=14&size=' . $map_w . 'x' . $map_h . '&markers=color:green|label:|' . urlencode( $address_string ) . '&sensor=false&key=' . $api_key ) . '" /></a>'; |
|
| 158 | + return '<a class="a_map_image_link" href="'.$google_map.'" target="_blank">'.'<img class="map_image_link" id="venue_map_'.$id.'" '.$map_image_class.' src="'.htmlentities2($scheme.'maps.googleapis.com/maps/api/staticmap?center='.urlencode($address_string).'&zoom=14&size='.$map_w.'x'.$map_h.'&markers=color:green|label:|'.urlencode($address_string).'&sensor=false&key='.$api_key).'" /></a>'; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - return '<a href="' . $google_map . '" target="_blank">' . $text . '</a>'; |
|
| 161 | + return '<a href="'.$google_map.'" target="_blank">'.$text.'</a>'; |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | |
@@ -26,12 +26,12 @@ |
||
| 26 | 26 | <input type="text" id="ee-google-map-api-key" class="regular-text" name="google_map_api_key" value="<?php echo $map_settings->google_map_api_key; ?>" /> |
| 27 | 27 | <p class="description"> |
| 28 | 28 | <?php |
| 29 | - printf( |
|
| 30 | - __('An API key is now required to use the Google Maps API: %1$sclick here to get an API key%2$s', 'event_espresso'), |
|
| 31 | - '<a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend,static_maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">', |
|
| 32 | - '</a>' |
|
| 33 | - ); |
|
| 34 | - ?> |
|
| 29 | + printf( |
|
| 30 | + __('An API key is now required to use the Google Maps API: %1$sclick here to get an API key%2$s', 'event_espresso'), |
|
| 31 | + '<a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend,static_maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank">', |
|
| 32 | + '</a>' |
|
| 33 | + ); |
|
| 34 | + ?> |
|
| 35 | 35 | </p> |
| 36 | 36 | </td> |
| 37 | 37 | </tr> |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | </td> |
| 16 | 16 | </tr> |
| 17 | 17 | <?php |
| 18 | - if( apply_filters( 'FHEE__google_map__show_api_key_input', true ) ) { ?> |
|
| 18 | + if (apply_filters('FHEE__google_map__show_api_key_input', true)) { ?> |
|
| 19 | 19 | <tr> |
| 20 | 20 | <th> |
| 21 | 21 | <label for="ee-google-map-api-key"> |
@@ -110,19 +110,19 @@ discard block |
||
| 110 | 110 | <td> |
| 111 | 111 | <label for="event_details_control_type-default" class="ee-admin-radio-lbl"> |
| 112 | 112 | <?php $checked = $map_settings->event_details_control_type == 'default' ? 'checked="checked"' : ''; ?> |
| 113 | - <input id="event_details_control_type-default" type="radio" name="event_details_control_type" value="default"<?php echo $checked;?>/> |
|
| 113 | + <input id="event_details_control_type-default" type="radio" name="event_details_control_type" value="default"<?php echo $checked; ?>/> |
|
| 114 | 114 | <?php _e(' Default', 'event_espresso') ?> |
| 115 | 115 | </label> |
| 116 | 116 | |
| 117 | 117 | <label for="event_details_control_type-horizontal" class="ee-admin-radio-lbl"> |
| 118 | 118 | <?php $checked = $map_settings->event_details_control_type == 'horizontal' ? 'checked="checked"' : ''; ?> |
| 119 | - <input id="event_details_control_type-horizontal" type="radio" name="event_details_control_type" value="horizontal"<?php echo $checked;?>/> |
|
| 119 | + <input id="event_details_control_type-horizontal" type="radio" name="event_details_control_type" value="horizontal"<?php echo $checked; ?>/> |
|
| 120 | 120 | <?php _e(' Horizontal', 'event_espresso') ?> |
| 121 | 121 | </label> |
| 122 | 122 | |
| 123 | 123 | <label for="event_details_control_type-dropdown" class="ee-admin-radio-lbl"> |
| 124 | 124 | <?php $checked = $map_settings->event_details_control_type == 'dropdown' ? 'checked="checked"' : ''; ?> |
| 125 | - <input id="event_details_control_type-dropdown" type="radio" name="event_details_control_type" value="dropdown"<?php echo $checked;?>/> |
|
| 125 | + <input id="event_details_control_type-dropdown" type="radio" name="event_details_control_type" value="dropdown"<?php echo $checked; ?>/> |
|
| 126 | 126 | <?php _e(' Dropdown', 'event_espresso') ?> |
| 127 | 127 | </label> |
| 128 | 128 | </td> |
@@ -135,25 +135,25 @@ discard block |
||
| 135 | 135 | <td> |
| 136 | 136 | <label for="event_details_map_align-none" class="ee-admin-radio-lbl"> |
| 137 | 137 | <?php $checked = $map_settings->event_details_map_align == 'none' ? 'checked="checked"' : ''; ?> |
| 138 | - <input id="event_details_map_align-none" type="radio" name="event_details_map_align" value="none"<?php echo $checked;?>/> |
|
| 138 | + <input id="event_details_map_align-none" type="radio" name="event_details_map_align" value="none"<?php echo $checked; ?>/> |
|
| 139 | 139 | <?php _e(' None', 'event_espresso') ?> |
| 140 | 140 | </label> |
| 141 | 141 | |
| 142 | 142 | <label for="event_details_map_align-left" class="ee-admin-radio-lbl"> |
| 143 | 143 | <?php $checked = $map_settings->event_details_map_align == 'left' ? 'checked="checked"' : ''; ?> |
| 144 | - <input id="event_details_map_align-left" type="radio" name="event_details_map_align" value="left"<?php echo $checked;?>/> |
|
| 144 | + <input id="event_details_map_align-left" type="radio" name="event_details_map_align" value="left"<?php echo $checked; ?>/> |
|
| 145 | 145 | <?php _e(' Align Left', 'event_espresso') ?> |
| 146 | 146 | </label> |
| 147 | 147 | |
| 148 | 148 | <label for="event_details_map_align-center" class="ee-admin-radio-lbl"> |
| 149 | 149 | <?php $checked = $map_settings->event_details_map_align == 'center' ? 'checked="checked"' : ''; ?> |
| 150 | - <input id="event_details_map_align-center" type="radio" name="event_details_map_align" value="center"<?php echo $checked;?>/> |
|
| 150 | + <input id="event_details_map_align-center" type="radio" name="event_details_map_align" value="center"<?php echo $checked; ?>/> |
|
| 151 | 151 | <?php _e(' Align Center', 'event_espresso') ?> |
| 152 | 152 | </label> |
| 153 | 153 | |
| 154 | 154 | <label for="event_details_map_align-right" class="ee-admin-radio-lbl"> |
| 155 | 155 | <?php $checked = $map_settings->event_details_map_align == 'right' ? 'checked="checked"' : ''; ?> |
| 156 | - <input id="event_details_map_align-right" type="radio" name="event_details_map_align" value="right"<?php echo $checked;?>/> |
|
| 156 | + <input id="event_details_map_align-right" type="radio" name="event_details_map_align" value="right"<?php echo $checked; ?>/> |
|
| 157 | 157 | <?php _e(' Align Right', 'event_espresso') ?> |
| 158 | 158 | </label> |
| 159 | 159 | </td> |
@@ -228,19 +228,19 @@ discard block |
||
| 228 | 228 | <td> |
| 229 | 229 | <label for="event_list_control_type-default" class="ee-admin-radio-lbl"> |
| 230 | 230 | <?php $checked = $map_settings->event_list_control_type == 'default' ? 'checked="checked"' : ''; ?> |
| 231 | - <input id="event_list_control_type-default" type="radio" name="event_list_control_type" value="default"<?php echo $checked;?>/> |
|
| 231 | + <input id="event_list_control_type-default" type="radio" name="event_list_control_type" value="default"<?php echo $checked; ?>/> |
|
| 232 | 232 | <?php _e(' Default', 'event_espresso') ?> |
| 233 | 233 | </label> |
| 234 | 234 | |
| 235 | 235 | <label for="event_list_control_type-horizontal" class="ee-admin-radio-lbl"> |
| 236 | 236 | <?php $checked = $map_settings->event_list_control_type == 'horizontal' ? 'checked="checked"' : ''; ?> |
| 237 | - <input id="event_list_control_type-horizontal" type="radio" name="event_list_control_type" value="horizontal"<?php echo $checked;?>/> |
|
| 237 | + <input id="event_list_control_type-horizontal" type="radio" name="event_list_control_type" value="horizontal"<?php echo $checked; ?>/> |
|
| 238 | 238 | <?php _e(' Horizontal', 'event_espresso') ?> |
| 239 | 239 | </label> |
| 240 | 240 | |
| 241 | 241 | <label for="event_list_control_type-dropdown" class="ee-admin-radio-lbl"> |
| 242 | 242 | <?php $checked = $map_settings->event_list_control_type == 'dropdown' ? 'checked="checked"' : ''; ?> |
| 243 | - <input id="event_list_control_type-dropdown" type="radio" name="event_list_control_type" value="dropdown"<?php echo $checked;?>/> |
|
| 243 | + <input id="event_list_control_type-dropdown" type="radio" name="event_list_control_type" value="dropdown"<?php echo $checked; ?>/> |
|
| 244 | 244 | <?php _e(' Dropdown', 'event_espresso') ?> |
| 245 | 245 | </label> |
| 246 | 246 | |
@@ -254,25 +254,25 @@ discard block |
||
| 254 | 254 | <td> |
| 255 | 255 | <label for="event_list_map_align-none" class="ee-admin-radio-lbl"> |
| 256 | 256 | <?php $checked = $map_settings->event_list_map_align == 'none' ? 'checked="checked"' : ''; ?> |
| 257 | - <input id="event_list_map_align-none" type="radio" name="event_list_map_align" value="none"<?php echo $checked;?>/> |
|
| 257 | + <input id="event_list_map_align-none" type="radio" name="event_list_map_align" value="none"<?php echo $checked; ?>/> |
|
| 258 | 258 | <?php _e(' None', 'event_espresso') ?> |
| 259 | 259 | </label> |
| 260 | 260 | |
| 261 | 261 | <label for="event_list_map_align-left" class="ee-admin-radio-lbl"> |
| 262 | 262 | <?php $checked = $map_settings->event_list_map_align == 'left' ? 'checked="checked"' : ''; ?> |
| 263 | - <input id="event_list_map_align-left" type="radio" name="event_list_map_align" value="left"<?php echo $checked;?>/> |
|
| 263 | + <input id="event_list_map_align-left" type="radio" name="event_list_map_align" value="left"<?php echo $checked; ?>/> |
|
| 264 | 264 | <?php _e(' Align Left', 'event_espresso') ?> |
| 265 | 265 | </label> |
| 266 | 266 | |
| 267 | 267 | <label for="event_list_map_align-center" class="ee-admin-radio-lbl"> |
| 268 | 268 | <?php $checked = $map_settings->event_list_map_align == 'center' ? 'checked="checked"' : ''; ?> |
| 269 | - <input id="event_list_map_align-center" type="radio" name="event_list_map_align" value="center"<?php echo $checked;?>/> |
|
| 269 | + <input id="event_list_map_align-center" type="radio" name="event_list_map_align" value="center"<?php echo $checked; ?>/> |
|
| 270 | 270 | <?php _e(' Align Center', 'event_espresso') ?> |
| 271 | 271 | </label> |
| 272 | 272 | |
| 273 | 273 | <label for="event_list_map_align-right" class="ee-admin-radio-lbl"> |
| 274 | 274 | <?php $checked = $map_settings->event_list_map_align == 'right' ? 'checked="checked"' : ''; ?> |
| 275 | - <input id="event_list_map_align-right" type="radio" name="event_list_map_align" value="right"<?php echo $checked;?>/> |
|
| 275 | + <input id="event_list_map_align-right" type="radio" name="event_list_map_align" value="right"<?php echo $checked; ?>/> |
|
| 276 | 276 | <?php _e(' Align Right', 'event_espresso') ?> |
| 277 | 277 | </label> |
| 278 | 278 | |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | function __construct() { |
| 31 | 31 | parent::__construct( |
| 32 | 32 | 'ee-upcoming-events-widget', |
| 33 | - __( 'Event Espresso Upcoming Events', 'event_espresso' ), |
|
| 34 | - array( 'description' => __( 'A widget to display your upcoming events.', 'event_espresso' )), |
|
| 33 | + __('Event Espresso Upcoming Events', 'event_espresso'), |
|
| 34 | + array('description' => __('A widget to display your upcoming events.', 'event_espresso')), |
|
| 35 | 35 | array( |
| 36 | 36 | 'width' => 300, |
| 37 | 37 | 'height' => 350, |
@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | * @param array $instance Previously saved values from database. |
| 50 | 50 | * @return string|void |
| 51 | 51 | */ |
| 52 | - public function form( $instance ) { |
|
| 52 | + public function form($instance) { |
|
| 53 | 53 | |
| 54 | - EE_Registry::instance()->load_class( 'Question_Option', array(), FALSE, FALSE, TRUE ); |
|
| 54 | + EE_Registry::instance()->load_class('Question_Option', array(), FALSE, FALSE, TRUE); |
|
| 55 | 55 | // Set up some default widget settings. |
| 56 | 56 | $defaults = array( |
| 57 | 57 | 'title' => __('Upcoming Events', 'event_espresso'), |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | 'image_size' => 'medium' |
| 67 | 67 | ); |
| 68 | 68 | |
| 69 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
| 69 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
| 70 | 70 | // don't add HTML labels for EE_Form_Fields generated inputs |
| 71 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' ); |
|
| 71 | + add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
| 72 | 72 | $yes_no_values = array( |
| 73 | - EE_Question_Option::new_instance( array( 'QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))), |
|
| 74 | - EE_Question_Option::new_instance( array( 'QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso'))) |
|
| 73 | + EE_Question_Option::new_instance(array('QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))), |
|
| 74 | + EE_Question_Option::new_instance(array('QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso'))) |
|
| 75 | 75 | ); |
| 76 | 76 | |
| 77 | 77 | ?> |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | <label for="<?php echo $this->get_field_id('title'); ?>"> |
| 83 | 83 | <?php _e('Title:', 'event_espresso'); ?> |
| 84 | 84 | </label> |
| 85 | - <input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" type="text" /> |
|
| 85 | + <input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($instance['title']); ?>" type="text" /> |
|
| 86 | 86 | </p> |
| 87 | 87 | <p> |
| 88 | 88 | <label for="<?php echo $this->get_field_id('category_name'); ?>"> |
@@ -91,16 +91,16 @@ discard block |
||
| 91 | 91 | <?php |
| 92 | 92 | $event_categories = array(); |
| 93 | 93 | /** @type EEM_Term $EEM_Term */ |
| 94 | - $EEM_Term = EE_Registry::instance()->load_model( 'Term' ); |
|
| 95 | - $categories = $EEM_Term->get_all_ee_categories( TRUE ); |
|
| 96 | - if ( $categories ) { |
|
| 97 | - foreach ( $categories as $category ) { |
|
| 98 | - if ( $category instanceof EE_Term ) { |
|
| 99 | - $event_categories[] = EE_Question_Option::new_instance( array( 'QSO_value' => $category->get( 'slug' ), 'QSO_desc' => $category->get( 'name' ))); |
|
| 94 | + $EEM_Term = EE_Registry::instance()->load_model('Term'); |
|
| 95 | + $categories = $EEM_Term->get_all_ee_categories(TRUE); |
|
| 96 | + if ($categories) { |
|
| 97 | + foreach ($categories as $category) { |
|
| 98 | + if ($category instanceof EE_Term) { |
|
| 99 | + $event_categories[] = EE_Question_Option::new_instance(array('QSO_value' => $category->get('slug'), 'QSO_desc' => $category->get('name'))); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | - array_unshift( $event_categories, EE_Question_Option::new_instance( array( 'QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso')))); |
|
| 103 | + array_unshift($event_categories, EE_Question_Option::new_instance(array('QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso')))); |
|
| 104 | 104 | echo EEH_Form_Fields::select( |
| 105 | 105 | __('Event Category:', 'event_espresso'), |
| 106 | 106 | $instance['category_name'], |
@@ -137,16 +137,16 @@ discard block |
||
| 137 | 137 | <?php |
| 138 | 138 | $image_sizes = array(); |
| 139 | 139 | $sizes = get_intermediate_image_sizes(); |
| 140 | - if ( $sizes ) { |
|
| 140 | + if ($sizes) { |
|
| 141 | 141 | // loop thru images and create option objects out of them |
| 142 | - foreach ( $sizes as $image_size ) { |
|
| 143 | - $image_size = trim( $image_size ); |
|
| 142 | + foreach ($sizes as $image_size) { |
|
| 143 | + $image_size = trim($image_size); |
|
| 144 | 144 | // no big images plz |
| 145 | - if ( ! in_array( $image_size, array( 'large', 'post-thumbnail' ))) { |
|
| 146 | - $image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => $image_size, 'QSO_desc' => $image_size )); |
|
| 145 | + if ( ! in_array($image_size, array('large', 'post-thumbnail'))) { |
|
| 146 | + $image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => $image_size, 'QSO_desc' => $image_size)); |
|
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | - $image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => 'none', 'QSO_desc' => __('don\'t show images', 'event_espresso') )); |
|
| 149 | + $image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => 'none', 'QSO_desc' => __('don\'t show images', 'event_espresso'))); |
|
| 150 | 150 | } |
| 151 | 151 | echo EEH_Form_Fields::select( |
| 152 | 152 | __('Image Size:', 'event_espresso'), |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | <label for="<?php echo $this->get_field_id('date_limit'); ?>"> |
| 205 | 205 | <?php _e('Number of Dates to Display:', 'event_espresso'); ?> |
| 206 | 206 | </label> |
| 207 | - <input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr( $instance['date_limit'] ); ?>" size="3" type="text" /> |
|
| 207 | + <input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr($instance['date_limit']); ?>" size="3" type="text" /> |
|
| 208 | 208 | </p> |
| 209 | 209 | <p> |
| 210 | 210 | <label for="<?php echo $this->get_field_id('date_range'); ?>"> |
@@ -236,9 +236,9 @@ discard block |
||
| 236 | 236 | * |
| 237 | 237 | * @return array Updated safe values to be saved. |
| 238 | 238 | */ |
| 239 | - public function update( $new_instance, $old_instance ) { |
|
| 239 | + public function update($new_instance, $old_instance) { |
|
| 240 | 240 | $instance = $old_instance; |
| 241 | - $instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : ''; |
|
| 241 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
| 242 | 242 | $instance['category_name'] = $new_instance['category_name']; |
| 243 | 243 | $instance['show_expired'] = $new_instance['show_expired']; |
| 244 | 244 | $instance['limit'] = $new_instance['limit']; |
@@ -261,18 +261,18 @@ discard block |
||
| 261 | 261 | * @param array $args Widget arguments. |
| 262 | 262 | * @param array $instance Saved values from database. |
| 263 | 263 | */ |
| 264 | - public function widget( $args, $instance ) { |
|
| 264 | + public function widget($args, $instance) { |
|
| 265 | 265 | |
| 266 | 266 | global $post; |
| 267 | 267 | // make sure there is some kinda post object |
| 268 | - if ( $post instanceof WP_Post ) { |
|
| 268 | + if ($post instanceof WP_Post) { |
|
| 269 | 269 | $before_widget = ''; |
| 270 | 270 | $before_title = ''; |
| 271 | 271 | $after_title = ''; |
| 272 | 272 | $after_widget = ''; |
| 273 | 273 | // but NOT an events archives page, cuz that would be like two event lists on the same page |
| 274 | - $show_everywhere = isset( $instance['show_everywhere'] ) ? (bool) absint( $instance['show_everywhere'] ) : TRUE; |
|
| 275 | - if ( $show_everywhere || ! ( $post->post_type == 'espresso_events' && is_archive() )) { |
|
| 274 | + $show_everywhere = isset($instance['show_everywhere']) ? (bool) absint($instance['show_everywhere']) : TRUE; |
|
| 275 | + if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) { |
|
| 276 | 276 | // let's use some of the event helper functions' |
| 277 | 277 | // make separate vars out of attributes |
| 278 | 278 | |
@@ -291,81 +291,81 @@ discard block |
||
| 291 | 291 | // Before widget (defined by themes). |
| 292 | 292 | echo $before_widget; |
| 293 | 293 | // Display the widget title if one was input (before and after defined by themes). |
| 294 | - if ( ! empty( $title )) { |
|
| 295 | - echo $before_title . $title . $after_title; |
|
| 294 | + if ( ! empty($title)) { |
|
| 295 | + echo $before_title.$title.$after_title; |
|
| 296 | 296 | } |
| 297 | 297 | // grab widget settings |
| 298 | - $category = isset( $instance['category_name'] ) && ! empty( $instance['category_name'] ) ? $instance['category_name'] : FALSE; |
|
| 299 | - $show_expired = isset( $instance['show_expired'] ) ? (bool) absint( $instance['show_expired'] ) : FALSE; |
|
| 300 | - $image_size = isset( $instance['image_size'] ) && ! empty( $instance['image_size'] ) ? $instance['image_size'] : 'medium'; |
|
| 301 | - $show_desc = isset( $instance['show_desc'] ) ? (bool) absint( $instance['show_desc'] ) : TRUE; |
|
| 302 | - $show_dates = isset( $instance['show_dates'] ) ? (bool) absint( $instance['show_dates'] ) : TRUE; |
|
| 303 | - $date_limit = isset( $instance['date_limit'] ) && ! empty( $instance['date_limit'] ) ? $instance['date_limit'] : NULL; |
|
| 304 | - $date_range = isset( $instance['date_range'] ) && ! empty( $instance['date_range'] ) ? $instance['date_range'] : FALSE; |
|
| 298 | + $category = isset($instance['category_name']) && ! empty($instance['category_name']) ? $instance['category_name'] : FALSE; |
|
| 299 | + $show_expired = isset($instance['show_expired']) ? (bool) absint($instance['show_expired']) : FALSE; |
|
| 300 | + $image_size = isset($instance['image_size']) && ! empty($instance['image_size']) ? $instance['image_size'] : 'medium'; |
|
| 301 | + $show_desc = isset($instance['show_desc']) ? (bool) absint($instance['show_desc']) : TRUE; |
|
| 302 | + $show_dates = isset($instance['show_dates']) ? (bool) absint($instance['show_dates']) : TRUE; |
|
| 303 | + $date_limit = isset($instance['date_limit']) && ! empty($instance['date_limit']) ? $instance['date_limit'] : NULL; |
|
| 304 | + $date_range = isset($instance['date_range']) && ! empty($instance['date_range']) ? $instance['date_range'] : FALSE; |
|
| 305 | 305 | // start to build our where clause |
| 306 | 306 | $where = array( |
| 307 | 307 | // 'Datetime.DTT_is_primary' => 1, |
| 308 | 308 | 'status' => 'publish' |
| 309 | 309 | ); |
| 310 | 310 | // add category |
| 311 | - if ( $category ) { |
|
| 311 | + if ($category) { |
|
| 312 | 312 | $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
| 313 | 313 | $where['Term_Taxonomy.Term.slug'] = $category; |
| 314 | 314 | } |
| 315 | 315 | // if NOT expired then we want events that start today or in the future |
| 316 | - if ( ! $show_expired ) { |
|
| 317 | - $where['Datetime.DTT_EVT_end'] = array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ); |
|
| 316 | + if ( ! $show_expired) { |
|
| 317 | + $where['Datetime.DTT_EVT_end'] = array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')); |
|
| 318 | 318 | } |
| 319 | 319 | // run the query |
| 320 | - $events = EE_Registry::instance()->load_model( 'Event' )->get_all( array( |
|
| 320 | + $events = EE_Registry::instance()->load_model('Event')->get_all(array( |
|
| 321 | 321 | $where, |
| 322 | - 'limit' => $instance['limit'] > 0 ? '0,' . $instance['limit'] : '0,10', |
|
| 322 | + 'limit' => $instance['limit'] > 0 ? '0,'.$instance['limit'] : '0,10', |
|
| 323 | 323 | 'order_by' => 'Datetime.DTT_EVT_start', |
| 324 | 324 | 'order' => 'ASC', |
| 325 | 325 | 'group_by' => 'EVT_ID' |
| 326 | 326 | )); |
| 327 | 327 | |
| 328 | - if ( ! empty( $events )) { |
|
| 328 | + if ( ! empty($events)) { |
|
| 329 | 329 | echo '<ul class="ee-upcoming-events-widget-ul">'; |
| 330 | - foreach ( $events as $event ) { |
|
| 331 | - if ( $event instanceof EE_Event && ( !is_single() || $post->ID != $event->ID() ) ) { |
|
| 330 | + foreach ($events as $event) { |
|
| 331 | + if ($event instanceof EE_Event && ( ! is_single() || $post->ID != $event->ID())) { |
|
| 332 | 332 | //printr( $event, '$event <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
| 333 | - echo '<li id="ee-upcoming-events-widget-li-' . $event->ID() . '" class="ee-upcoming-events-widget-li">'; |
|
| 333 | + echo '<li id="ee-upcoming-events-widget-li-'.$event->ID().'" class="ee-upcoming-events-widget-li">'; |
|
| 334 | 334 | // how big is the event name ? |
| 335 | - $name_length = strlen( $event->name() ); |
|
| 336 | - switch( $name_length ) { |
|
| 335 | + $name_length = strlen($event->name()); |
|
| 336 | + switch ($name_length) { |
|
| 337 | 337 | case $name_length > 70 : |
| 338 | - $len_class = ' three-line'; |
|
| 338 | + $len_class = ' three-line'; |
|
| 339 | 339 | break; |
| 340 | 340 | case $name_length > 35 : |
| 341 | - $len_class = ' two-line'; |
|
| 341 | + $len_class = ' two-line'; |
|
| 342 | 342 | break; |
| 343 | 343 | default : |
| 344 | - $len_class = ' one-line'; |
|
| 344 | + $len_class = ' one-line'; |
|
| 345 | 345 | } |
| 346 | - $event_url = apply_filters( 'FHEE_EEW_Upcoming_Events__widget__event_url', $event->get_permalink(), $event ); |
|
| 347 | - echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a' . $len_class . '" href="' . $event_url . '">' . $event->name() . '</a></h5>'; |
|
| 348 | - if ( post_password_required( $event->ID() ) ) { |
|
| 349 | - $pswd_form = apply_filters( 'FHEE_EEW_Upcoming_Events__widget__password_form', get_the_password_form( $event->ID() ), $event ); |
|
| 346 | + $event_url = apply_filters('FHEE_EEW_Upcoming_Events__widget__event_url', $event->get_permalink(), $event); |
|
| 347 | + echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a'.$len_class.'" href="'.$event_url.'">'.$event->name().'</a></h5>'; |
|
| 348 | + if (post_password_required($event->ID())) { |
|
| 349 | + $pswd_form = apply_filters('FHEE_EEW_Upcoming_Events__widget__password_form', get_the_password_form($event->ID()), $event); |
|
| 350 | 350 | echo $pswd_form; |
| 351 | 351 | } else { |
| 352 | - if ( has_post_thumbnail( $event->ID() ) && $image_size != 'none' ) { |
|
| 353 | - echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="' . $event_url . '">' . get_the_post_thumbnail( $event->ID(), $image_size ) . '</a></div>'; |
|
| 352 | + if (has_post_thumbnail($event->ID()) && $image_size != 'none') { |
|
| 353 | + echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="'.$event_url.'">'.get_the_post_thumbnail($event->ID(), $image_size).'</a></div>'; |
|
| 354 | 354 | } |
| 355 | - $desc = $event->short_description( 25 ); |
|
| 356 | - if ( $show_dates ) { |
|
| 357 | - $date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', get_option( 'date_format' )); |
|
| 358 | - $time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', get_option( 'time_format' )); |
|
| 359 | - $single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', get_option( 'date_format' )); |
|
| 360 | - $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', get_option( 'time_format' )); |
|
| 361 | - if ( $date_range == TRUE ) { |
|
| 362 | - echo espresso_event_date_range( $date_format, $time_format, $single_date_format, $single_time_format, $event->ID() ); |
|
| 363 | - }else{ |
|
| 364 | - echo espresso_list_of_event_dates( $event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit ); |
|
| 355 | + $desc = $event->short_description(25); |
|
| 356 | + if ($show_dates) { |
|
| 357 | + $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', get_option('date_format')); |
|
| 358 | + $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', get_option('time_format')); |
|
| 359 | + $single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', get_option('date_format')); |
|
| 360 | + $single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', get_option('time_format')); |
|
| 361 | + if ($date_range == TRUE) { |
|
| 362 | + echo espresso_event_date_range($date_format, $time_format, $single_date_format, $single_time_format, $event->ID()); |
|
| 363 | + } else { |
|
| 364 | + echo espresso_list_of_event_dates($event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit); |
|
| 365 | 365 | } |
| 366 | 366 | } |
| 367 | - if ( $show_desc && $desc ) { |
|
| 368 | - echo '<p style="margin-top: .5em">' . $desc . '</p>'; |
|
| 367 | + if ($show_desc && $desc) { |
|
| 368 | + echo '<p style="margin-top: .5em">'.$desc.'</p>'; |
|
| 369 | 369 | } |
| 370 | 370 | } |
| 371 | 371 | echo '</li>'; |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | * @return string |
| 390 | 390 | */ |
| 391 | 391 | public function make_the_title_a_link($title) { |
| 392 | - return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
| 392 | + return '<a href="'.EEH_Event_View::event_archive_url().'">'.$title.'</a>'; |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | } |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * Event Espresso |
| 4 | 6 | * |
@@ -360,7 +362,7 @@ discard block |
||
| 360 | 362 | $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', get_option( 'time_format' )); |
| 361 | 363 | if ( $date_range == TRUE ) { |
| 362 | 364 | echo espresso_event_date_range( $date_format, $time_format, $single_date_format, $single_time_format, $event->ID() ); |
| 363 | - }else{ |
|
| 365 | + } else{ |
|
| 364 | 366 | echo espresso_list_of_event_dates( $event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit ); |
| 365 | 367 | } |
| 366 | 368 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 4 | 4 | exit('No direct script access allowed'); |
| 5 | 5 | |
| 6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * ------------------------------------------------------------------------ |
| 27 | 27 | */ |
| 28 | -class EE_PMT_Paypal_Pro extends EE_PMT_Base{ |
|
| 28 | +class EE_PMT_Paypal_Pro extends EE_PMT_Base { |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * @param EE_Payment_Method $pm_instance |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | require_once($this->file_folder().'EEG_Paypal_Pro.gateway.php'); |
| 36 | 36 | $this->_gateway = new EEG_Paypal_Pro(); |
| 37 | 37 | $this->_pretty_name = __("Paypal Pro", 'event_espresso'); |
| 38 | - $this->_default_description = __( 'Please provide the following billing information.', 'event_espresso' ); |
|
| 38 | + $this->_default_description = __('Please provide the following billing information.', 'event_espresso'); |
|
| 39 | 39 | $this->_requires_https = true; |
| 40 | 40 | parent::__construct($pm_instance); |
| 41 | 41 | } |
@@ -51,21 +51,21 @@ discard block |
||
| 51 | 51 | 'extra_meta_inputs'=>array( |
| 52 | 52 | // 'paypal_email'=>new EE_Email_Input(), not actually used |
| 53 | 53 | 'username'=>new EE_Text_Input(array( |
| 54 | - 'html_label_text'=> sprintf(__("Paypal API Username %s", "event_espresso"),$this->get_help_tab_link()), |
|
| 54 | + 'html_label_text'=> sprintf(__("Paypal API Username %s", "event_espresso"), $this->get_help_tab_link()), |
|
| 55 | 55 | 'required' => true |
| 56 | 56 | )), |
| 57 | 57 | 'password'=>new EE_Text_Input(array( |
| 58 | - 'html_label_text'=> sprintf(__("Paypal API Password %s", "event_espresso"),$this->get_help_tab_link()), |
|
| 58 | + 'html_label_text'=> sprintf(__("Paypal API Password %s", "event_espresso"), $this->get_help_tab_link()), |
|
| 59 | 59 | 'required' => true |
| 60 | 60 | )), |
| 61 | 61 | 'signature'=>new EE_Text_Input(array( |
| 62 | - 'html_label_text'=> sprintf(__("Paypal API Signature %s", "event_espresso"),$this->get_help_tab_link()), |
|
| 62 | + 'html_label_text'=> sprintf(__("Paypal API Signature %s", "event_espresso"), $this->get_help_tab_link()), |
|
| 63 | 63 | 'required' => true |
| 64 | 64 | )), |
| 65 | 65 | 'credit_card_types'=>new EE_Checkbox_Multi_Input( |
| 66 | 66 | $this->card_types_supported(), |
| 67 | 67 | array( |
| 68 | - 'html_label_text' => __( 'Card Types Supported', 'event_espresso' ), |
|
| 68 | + 'html_label_text' => __('Card Types Supported', 'event_espresso'), |
|
| 69 | 69 | 'required' => true )), |
| 70 | 70 | ) |
| 71 | 71 | ) |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | * @throws \EE_Error |
| 80 | 80 | * @return EE_Billing_Info_Form |
| 81 | 81 | */ |
| 82 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
| 83 | - $allowed_types = $this->_pm_instance->get_extra_meta( 'credit_card_types', TRUE ); |
|
| 82 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
| 83 | + $allowed_types = $this->_pm_instance->get_extra_meta('credit_card_types', TRUE); |
|
| 84 | 84 | //if allowed types is a string or empty array or null... |
| 85 | - if( empty( $allowed_types )) { |
|
| 85 | + if (empty($allowed_types)) { |
|
| 86 | 86 | $allowed_types = array(); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -93,26 +93,26 @@ discard block |
||
| 93 | 93 | // 'html_id'=> 'ee-Paypal_Pro-billing-form', |
| 94 | 94 | 'subsections'=>array( |
| 95 | 95 | 'credit_card'=>new EE_Credit_Card_Input( |
| 96 | - array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Card Number', 'event_espresso' )) |
|
| 96 | + array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Card Number', 'event_espresso')) |
|
| 97 | 97 | ), |
| 98 | 98 | 'credit_card_type'=>new EE_Select_Input( |
| 99 | 99 | //the options are set dynamically |
| 100 | - array_intersect_key( EE_PMT_Paypal_Pro::card_types_supported(), array_flip( $allowed_types )), |
|
| 101 | - array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Card Type', 'event_espresso' )) |
|
| 100 | + array_intersect_key(EE_PMT_Paypal_Pro::card_types_supported(), array_flip($allowed_types)), |
|
| 101 | + array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Card Type', 'event_espresso')) |
|
| 102 | 102 | ), |
| 103 | 103 | 'exp_month'=>new EE_Credit_Card_Month_Input( |
| 104 | - TRUE, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Expiry Month', 'event_espresso' ) ) |
|
| 104 | + TRUE, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Expiry Month', 'event_espresso')) |
|
| 105 | 105 | ), |
| 106 | 106 | 'exp_year'=>new EE_Credit_Card_Year_Input( |
| 107 | - array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'Expiry Year', 'event_espresso' ) ) |
|
| 107 | + array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('Expiry Year', 'event_espresso')) |
|
| 108 | 108 | ), |
| 109 | 109 | 'cvv'=>new EE_CVV_Input( |
| 110 | - array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __( 'CVV', 'event_espresso' ) ) |
|
| 110 | + array('required'=>TRUE, 'html_class' => 'ee-billing-qstn', 'html_label_text' => __('CVV', 'event_espresso')) |
|
| 111 | 111 | ), |
| 112 | 112 | ) |
| 113 | 113 | ) |
| 114 | 114 | ); |
| 115 | - return $this->apply_billing_form_debug_settings( $billing_form ); |
|
| 115 | + return $this->apply_billing_form_debug_settings($billing_form); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | |
@@ -124,19 +124,19 @@ discard block |
||
| 124 | 124 | * @param \EE_Billing_Info_Form $billing_form |
| 125 | 125 | * @return \EE_Billing_Info_Form |
| 126 | 126 | */ |
| 127 | - public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) { |
|
| 128 | - if ( $this->_pm_instance->debug_mode() ) { |
|
| 127 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) { |
|
| 128 | + if ($this->_pm_instance->debug_mode()) { |
|
| 129 | 129 | $billing_form->add_subsections( |
| 130 | - array( 'fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html() ), |
|
| 130 | + array('fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html()), |
|
| 131 | 131 | 'credit_card' |
| 132 | 132 | ); |
| 133 | 133 | $billing_form->add_subsections( |
| 134 | - array( 'debug_content' => new EE_Form_Section_HTML_From_Template( dirname(__FILE__).DS.'templates'.DS.'paypal_pro_debug_info.template.php' )), |
|
| 134 | + array('debug_content' => new EE_Form_Section_HTML_From_Template(dirname(__FILE__).DS.'templates'.DS.'paypal_pro_debug_info.template.php')), |
|
| 135 | 135 | 'first_name' |
| 136 | 136 | ); |
| 137 | - $billing_form->get_input( 'credit_card_type' )->set_default( 'Visa' ); |
|
| 138 | - $billing_form->get_input( 'exp_year' )->set_default( 2018); |
|
| 139 | - $billing_form->get_input( 'cvv' )->set_default( '115' ); |
|
| 137 | + $billing_form->get_input('credit_card_type')->set_default('Visa'); |
|
| 138 | + $billing_form->get_input('exp_year')->set_default(2018); |
|
| 139 | + $billing_form->get_input('cvv')->set_default('115'); |
|
| 140 | 140 | } |
| 141 | 141 | return $billing_form; |
| 142 | 142 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * Keys are their values, values are their pretty names. |
| 149 | 149 | * @return array |
| 150 | 150 | */ |
| 151 | - public static function card_types_supported(){ |
|
| 151 | + public static function card_types_supported() { |
|
| 152 | 152 | return array( |
| 153 | 153 | 'Visa'=> __("Visa", 'event_espresso'), |
| 154 | 154 | 'MasterCard'=> __("MasterCard", 'event_espresso'), |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | * @see EE_PMT_Base::help_tabs_config() |
| 165 | 165 | * @return array |
| 166 | 166 | */ |
| 167 | - public function help_tabs_config(){ |
|
| 167 | + public function help_tabs_config() { |
|
| 168 | 168 | return array( |
| 169 | 169 | $this->get_help_tab_name() => array( |
| 170 | 170 | 'title' => __('PayPal Pro Settings', 'event_espresso'), |
@@ -179,10 +179,10 @@ discard block |
||
| 179 | 179 | * @param EE_Billing_Info_Form $billing_form |
| 180 | 180 | * @return array |
| 181 | 181 | */ |
| 182 | - protected function _get_billing_values_from_form( $billing_form ){ |
|
| 183 | - $billing_values = parent::_get_billing_values_from_form( $billing_form ); |
|
| 184 | - $billing_values[ 'country' ] = $billing_form->get_input_value( 'country' ); |
|
| 185 | - $billing_values[ 'credit_card_type' ] = $billing_form->get_input_value( 'credit_card_type' ); |
|
| 182 | + protected function _get_billing_values_from_form($billing_form) { |
|
| 183 | + $billing_values = parent::_get_billing_values_from_form($billing_form); |
|
| 184 | + $billing_values['country'] = $billing_form->get_input_value('country'); |
|
| 185 | + $billing_values['credit_card_type'] = $billing_form->get_input_value('credit_card_type'); |
|
| 186 | 186 | return $billing_values; |
| 187 | 187 | } |
| 188 | 188 | |
@@ -3,35 +3,35 @@ |
||
| 3 | 3 | <br/> |
| 4 | 4 | <?php //echo EEH_Debug_Tools::printr( $event_attendees, 'event_attendees' ); ?> |
| 5 | 5 | <?php echo $attendee_notice; ?> |
| 6 | -<?php if ( !empty($attendees) ) : ?> |
|
| 6 | +<?php if ( ! empty($attendees)) : ?> |
|
| 7 | 7 | <div class="admin-primary-mbox-tbl-wrap"> |
| 8 | 8 | <table class="admin-primary-mbox-tbl"> |
| 9 | 9 | <thead> |
| 10 | 10 | <tr> |
| 11 | - <th class="jst-left"><?php _e( '#', 'event_espresso' );?></th> |
|
| 12 | - <th class="jst-left"><?php _e( 'Event Name', 'event_espresso' );?></th> |
|
| 13 | - <th class="jst-left"><?php _e( 'Attendee', 'event_espresso' );?></th> |
|
| 14 | - <th class="jst-rght"><?php _e( 'Price Paid', 'event_espresso' );?></th> |
|
| 15 | - <th class="jst-left"><?php _e( 'Email', 'event_espresso' );?></th> |
|
| 16 | - <th class="jst-left"><?php _e( 'Address', 'event_espresso' );?></th> |
|
| 17 | - <!--<th class="jst-cntr"><?php _e( 'Actions', 'event_espresso' );?></th>--> |
|
| 11 | + <th class="jst-left"><?php _e('#', 'event_espresso'); ?></th> |
|
| 12 | + <th class="jst-left"><?php _e('Event Name', 'event_espresso'); ?></th> |
|
| 13 | + <th class="jst-left"><?php _e('Attendee', 'event_espresso'); ?></th> |
|
| 14 | + <th class="jst-rght"><?php _e('Price Paid', 'event_espresso'); ?></th> |
|
| 15 | + <th class="jst-left"><?php _e('Email', 'event_espresso'); ?></th> |
|
| 16 | + <th class="jst-left"><?php _e('Address', 'event_espresso'); ?></th> |
|
| 17 | + <!--<th class="jst-cntr"><?php _e('Actions', 'event_espresso'); ?></th>--> |
|
| 18 | 18 | </tr> |
| 19 | 19 | </thead> |
| 20 | 20 | <tbody> |
| 21 | 21 | |
| 22 | - <?php foreach ( $attendees as $att_nmbr => $attendee ) : ?> |
|
| 22 | + <?php foreach ($attendees as $att_nmbr => $attendee) : ?> |
|
| 23 | 23 | |
| 24 | 24 | <tr> |
| 25 | - <td class="jst-left"><?php echo $att_nmbr;?></td> |
|
| 26 | - <td class="jst-left"><?php echo $attendee['event_name'];?></td> |
|
| 25 | + <td class="jst-left"><?php echo $att_nmbr; ?></td> |
|
| 26 | + <td class="jst-left"><?php echo $attendee['event_name']; ?></td> |
|
| 27 | 27 | <td class="jst-left"> |
| 28 | - <a href="<?php echo $attendee['att_link']; ?>" title="<?php esc_attr_e( 'View details for this attendee', 'event_espresso' );?>"> |
|
| 29 | - <?php echo $attendee['fname'] . ' ' . $attendee['lname'];?> |
|
| 28 | + <a href="<?php echo $attendee['att_link']; ?>" title="<?php esc_attr_e('View details for this attendee', 'event_espresso'); ?>"> |
|
| 29 | + <?php echo $attendee['fname'].' '.$attendee['lname']; ?> |
|
| 30 | 30 | </a> |
| 31 | 31 | </td> |
| 32 | - <td class="jst-rght"><?php echo $currency_sign . ' ' . number_format( $attendee['final_price'], 2 );?></td> |
|
| 33 | - <td class="jst-left"><?php echo $attendee['email'];?></td> |
|
| 34 | - <td class="jst-left"><?php echo $attendee['address'];?></td> |
|
| 32 | + <td class="jst-rght"><?php echo $currency_sign.' '.number_format($attendee['final_price'], 2); ?></td> |
|
| 33 | + <td class="jst-left"><?php echo $attendee['email']; ?></td> |
|
| 34 | + <td class="jst-left"><?php echo $attendee['address']; ?></td> |
|
| 35 | 35 | <!--<th class="jst-cntr">view</th>--> |
| 36 | 36 | </tr> |
| 37 | 37 | |