Completed
Branch FET-8209-allow-multiple-carts (f5b2f0)
by
unknown
108:40 queued 97:50
created
admin_pages/general_settings/General_Settings_Admin_Page.core.php 3 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
      *
599 599
      * @param    string $CNT_ISO
600 600
      *
601
-     * @return        mixed        string | array
601
+     * @return        string|null        string | array
602 602
      */
603 603
     public function display_country_settings($CNT_ISO = '')
604 604
     {
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
      *        delete_state
885 885
      *
886 886
      * @access    public
887
-     * @return        boolean | void
887
+     * @return        false|null | void
888 888
      */
889 889
     public function delete_state()
890 890
     {
@@ -1126,11 +1126,11 @@  discard block
 block discarded – undo
1126 1126
     /**
1127 1127
      * generates a dropdown of all parent pages - copied from WP core
1128 1128
      *
1129
-     * @param unknown_type $default
1130
-     * @param unknown_type $parent
1131
-     * @param unknown_type $level
1129
+     * @param integer $default
1130
+     * @param integer $parent
1131
+     * @param integer $level
1132 1132
      *
1133
-     * @return unknown
1133
+     * @return null|false
1134 1134
      */
1135 1135
     public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0)
1136 1136
     {
Please login to merge, or discard this patch.
Spacing   +41 added lines, -42 removed lines patch added patch discarded remove patch
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
         //scripts
242 242
         wp_enqueue_script('media-upload');
243 243
         wp_enqueue_script('thickbox');
244
-        wp_register_script('organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js',
244
+        wp_register_script('organization_settings', GEN_SET_ASSETS_URL.'your_organization_settings.js',
245 245
             array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, true);
246
-        wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
246
+        wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION);
247 247
         wp_enqueue_script('organization_settings');
248 248
         wp_enqueue_style('organization-css');
249 249
         $confirm_image_delete = array(
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
     public function load_scripts_styles_country_settings()
258 258
     {
259 259
         //scripts
260
-        wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js',
260
+        wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL.'gen_settings_countries.js',
261 261
             array('ee_admin_js'), EVENT_ESPRESSO_VERSION, true);
262
-        wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
262
+        wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION);
263 263
         wp_enqueue_script('gen_settings_countries');
264 264
         wp_enqueue_style('organization-css');
265 265
         
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
         $this->_set_add_edit_form_tags('update_espresso_page_settings');
307 307
         $this->_set_publish_post_box_vars(null, false, false, null, false);
308 308
         $this->_template_args['admin_page_content'] = EEH_Template::display_template(
309
-            GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php',
309
+            GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php',
310 310
             $this->_template_args,
311 311
             true
312 312
         );
@@ -429,13 +429,13 @@  discard block
 block discarded – undo
429 429
         add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
430 430
         
431 431
         //PUE verification stuff
432
-        $ver_option_key                                    = 'puvererr_' . basename(EE_PLUGIN_BASENAME);
432
+        $ver_option_key                                    = 'puvererr_'.basename(EE_PLUGIN_BASENAME);
433 433
         $verify_fail                                       = get_option($ver_option_key);
434 434
         $this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>';
435 435
         
436 436
         $this->_set_add_edit_form_tags('update_your_organization_settings');
437 437
         $this->_set_publish_post_box_vars(null, false, false, null, false);
438
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php',
438
+        $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'your_organization_settings.template.php',
439 439
             $this->_template_args, true);
440 440
         
441 441
         $this->display_admin_page_with_sidebar();
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
         
586 586
         $this->_set_add_edit_form_tags('update_country_settings');
587 587
         $this->_set_publish_post_box_vars(null, false, false, null, false);
588
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php',
588
+        $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'countries_settings.template.php',
589 589
             $this->_template_args, true);
590 590
         $this->display_admin_page_with_no_sidebar();
591 591
     }
@@ -615,65 +615,65 @@  discard block
 block discarded – undo
615 615
         add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
616 616
         $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);
617 617
         //EEH_Debug_Tools::printr( $country, '$country  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
618
-        $country_input_types            = array(
618
+        $country_input_types = array(
619 619
             'CNT_active'      => array(
620 620
                 'type'             => 'RADIO_BTN',
621
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
621
+                'input_name'       => 'cntry['.$CNT_ISO.']',
622 622
                 'class'            => '',
623 623
                 'options'          => $this->_yes_no_values,
624 624
                 'use_desc_4_label' => true
625 625
             ),
626 626
             'CNT_ISO'         => array(
627 627
                 'type'       => 'TEXT',
628
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
628
+                'input_name' => 'cntry['.$CNT_ISO.']',
629 629
                 'class'      => 'small-text'
630 630
             ),
631 631
             'CNT_ISO3'        => array(
632 632
                 'type'       => 'TEXT',
633
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
633
+                'input_name' => 'cntry['.$CNT_ISO.']',
634 634
                 'class'      => 'small-text'
635 635
             ),
636 636
             'RGN_ID'          => array(
637 637
                 'type'       => 'TEXT',
638
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
638
+                'input_name' => 'cntry['.$CNT_ISO.']',
639 639
                 'class'      => 'small-text'
640 640
             ),
641 641
             'CNT_name'        => array(
642 642
                 'type'       => 'TEXT',
643
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
643
+                'input_name' => 'cntry['.$CNT_ISO.']',
644 644
                 'class'      => 'regular-text'
645 645
             ),
646 646
             'CNT_cur_code'    => array(
647 647
                 'type'       => 'TEXT',
648
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
648
+                'input_name' => 'cntry['.$CNT_ISO.']',
649 649
                 'class'      => 'small-text'
650 650
             ),
651 651
             'CNT_cur_single'  => array(
652 652
                 'type'       => 'TEXT',
653
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
653
+                'input_name' => 'cntry['.$CNT_ISO.']',
654 654
                 'class'      => 'medium-text'
655 655
             ),
656 656
             'CNT_cur_plural'  => array(
657 657
                 'type'       => 'TEXT',
658
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
658
+                'input_name' => 'cntry['.$CNT_ISO.']',
659 659
                 'class'      => 'medium-text'
660 660
             ),
661 661
             'CNT_cur_sign'    => array(
662 662
                 'type'         => 'TEXT',
663
-                'input_name'   => 'cntry[' . $CNT_ISO . ']',
663
+                'input_name'   => 'cntry['.$CNT_ISO.']',
664 664
                 'class'        => 'small-text',
665 665
                 'htmlentities' => false
666 666
             ),
667 667
             'CNT_cur_sign_b4' => array(
668 668
                 'type'             => 'RADIO_BTN',
669
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
669
+                'input_name'       => 'cntry['.$CNT_ISO.']',
670 670
                 'class'            => '',
671 671
                 'options'          => $this->_yes_no_values,
672 672
                 'use_desc_4_label' => true
673 673
             ),
674 674
             'CNT_cur_dec_plc' => array(
675 675
                 'type'       => 'RADIO_BTN',
676
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
676
+                'input_name' => 'cntry['.$CNT_ISO.']',
677 677
                 'class'      => '',
678 678
                 'options'    => array(
679 679
                     array('id' => 0, 'text' => ''),
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
             ),
685 685
             'CNT_cur_dec_mrk' => array(
686 686
                 'type'             => 'RADIO_BTN',
687
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
687
+                'input_name'       => 'cntry['.$CNT_ISO.']',
688 688
                 'class'            => '',
689 689
                 'options'          => array(
690 690
                     array(
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
             ),
698 698
             'CNT_cur_thsnds'  => array(
699 699
                 'type'             => 'RADIO_BTN',
700
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
700
+                'input_name'       => 'cntry['.$CNT_ISO.']',
701 701
                 'class'            => '',
702 702
                 'options'          => array(
703 703
                     array(
@@ -710,12 +710,12 @@  discard block
 block discarded – undo
710 710
             ),
711 711
             'CNT_tel_code'    => array(
712 712
                 'type'       => 'TEXT',
713
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
713
+                'input_name' => 'cntry['.$CNT_ISO.']',
714 714
                 'class'      => 'small-text'
715 715
             ),
716 716
             'CNT_is_EU'       => array(
717 717
                 'type'             => 'RADIO_BTN',
718
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
718
+                'input_name'       => 'cntry['.$CNT_ISO.']',
719 719
                 'class'            => '',
720 720
                 'options'          => $this->_yes_no_values,
721 721
                 'use_desc_4_label' => true
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
         );
724 724
         $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country,
725 725
             $country_input_types);
726
-        $country_details_settings       = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php',
726
+        $country_details_settings       = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php',
727 727
             $this->_template_args, true);
728 728
         
729 729
         if (defined('DOING_AJAX')) {
@@ -773,20 +773,20 @@  discard block
 block discarded – undo
773 773
             foreach ($states as $STA_ID => $state) {
774 774
                 if ($state instanceof EE_State) {
775 775
                     //STA_abbrev 	STA_name 	STA_active
776
-                    $state_input_types                                           = array(
776
+                    $state_input_types = array(
777 777
                         'STA_abbrev' => array(
778 778
                             'type'       => 'TEXT',
779
-                            'input_name' => 'states[' . $STA_ID . ']',
779
+                            'input_name' => 'states['.$STA_ID.']',
780 780
                             'class'      => 'mid-text'
781 781
                         ),
782 782
                         'STA_name'   => array(
783 783
                             'type'       => 'TEXT',
784
-                            'input_name' => 'states[' . $STA_ID . ']',
784
+                            'input_name' => 'states['.$STA_ID.']',
785 785
                             'class'      => 'regular-text'
786 786
                         ),
787 787
                         'STA_active' => array(
788 788
                             'type'             => 'RADIO_BTN',
789
-                            'input_name'       => 'states[' . $STA_ID . ']',
789
+                            'input_name'       => 'states['.$STA_ID.']',
790 790
                             'options'          => $this->_yes_no_values,
791 791
                             'use_desc_4_label' => true
792 792
                         )
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
         $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'),
811 811
             GEN_SET_ADMIN_URL);
812 812
         
813
-        $state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php',
813
+        $state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php',
814 814
             $this->_template_args, true);
815 815
         
816 816
         if (defined('DOING_AJAX')) {
@@ -851,8 +851,7 @@  discard block
 block discarded – undo
851 851
                 __FILE__, __FUNCTION__, __LINE__);
852 852
             $success = false;
853 853
         }
854
-        $STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) :
855
-            false;
854
+        $STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) : false;
856 855
         if ( ! $STA_name) {
857 856
             EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__,
858 857
                 __FUNCTION__, __LINE__);
@@ -866,7 +865,7 @@  discard block
 block discarded – undo
866 865
                 'STA_name'   => $STA_name,
867 866
                 'STA_active' => true
868 867
             );
869
-            $success       = EEM_State::instance()->insert($cols_n_values);
868
+            $success = EEM_State::instance()->insert($cols_n_values);
870 869
             EE_Error::add_success(__('The State was added successfully.', 'event_espresso'));
871 870
         }
872 871
         
@@ -968,7 +967,7 @@  discard block
 block discarded – undo
968 967
                     'CNT_ISO'    => $CNT_ISO,
969 968
                     'STA_abbrev' => sanitize_text_field($state['STA_abbrev']),
970 969
                     'STA_name'   => sanitize_text_field($state['STA_name']),
971
-                    'STA_active' => (bool)absint($state['STA_active'])
970
+                    'STA_active' => (bool) absint($state['STA_active'])
972 971
                 );
973 972
                 // where values
974 973
                 $where_cols_n_values = array(array('STA_ID' => $STA_ID));
@@ -1004,7 +1003,7 @@  discard block
 block discarded – undo
1004 1003
         return '
1005 1004
 			<tr>
1006 1005
 				<th>
1007
-					' . $label . '
1006
+					' . $label.'
1008 1007
 				</th>';
1009 1008
     }
1010 1009
     
@@ -1022,7 +1021,7 @@  discard block
 block discarded – undo
1022 1021
     {
1023 1022
         return '
1024 1023
 				<td class="general-settings-country-input-td">
1025
-					' . $input . '
1024
+					' . $input.'
1026 1025
 				</td>
1027 1026
 			</tr>';
1028 1027
     }
@@ -1057,7 +1056,7 @@  discard block
 block discarded – undo
1057 1056
     {
1058 1057
         return '
1059 1058
 				<td class="general-settings-country-state-input-td">
1060
-					' . $input . '
1059
+					' . $input.'
1061 1060
 				</td>';
1062 1061
         
1063 1062
     }
@@ -1081,10 +1080,10 @@  discard block
 block discarded – undo
1081 1080
      */
1082 1081
     public static function edit_view_links($ee_page_id)
1083 1082
     {
1084
-        $links = '<a href="' . add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'),
1085
-                admin_url('post.php')) . '" >' . __('Edit', 'event_espresso') . '</a>';
1083
+        $links = '<a href="'.add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'),
1084
+                admin_url('post.php')).'" >'.__('Edit', 'event_espresso').'</a>';
1086 1085
         $links .= ' &nbsp;|&nbsp; ';
1087
-        $links .= '<a href="' . get_permalink($ee_page_id) . '" >' . __('View', 'event_espresso') . '</a>';
1086
+        $links .= '<a href="'.get_permalink($ee_page_id).'" >'.__('View', 'event_espresso').'</a>';
1088 1087
         
1089 1088
         return $links;
1090 1089
     }
@@ -1118,7 +1117,7 @@  discard block
 block discarded – undo
1118 1117
             $sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
1119 1118
         }
1120 1119
         
1121
-        return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
1120
+        return '<span style="color:'.$pg_colour.'; margin-right:2em;"><strong>'.$pg_status.'</strong></span><span style="color:'.$sc_colour.'"><strong>'.$sc_status.'</strong></span>';
1122 1121
         
1123 1122
     }
1124 1123
     
@@ -1147,7 +1146,7 @@  discard block
 block discarded – undo
1147 1146
                     $current = '';
1148 1147
                 }
1149 1148
                 
1150
-                echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>";
1149
+                echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad ".esc_html($item->post_title)."</option>";
1151 1150
                 parent_dropdown($default, $item->ID, $level + 1);
1152 1151
             }
1153 1152
         } else {
Please login to merge, or discard this patch.
Indentation   +1107 added lines, -1107 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 use EventEspresso\admin_pages\general_settings\AdminOptionsSettings;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('NO direct script access allowed');
5
+	exit('NO direct script access allowed');
6 6
 }
7 7
 
8 8
 /**
@@ -22,1137 +22,1137 @@  discard block
 block discarded – undo
22 22
 {
23 23
 
24 24
 
25
-    /**
26
-     * _question_group
27
-     * holds the specific question group object for the question group details screen
28
-     * @var object
29
-     */
30
-    protected $_question_group;
31
-
32
-
33
-    public function __construct($routing = true)
34
-    {
35
-        parent::__construct($routing);
36
-    }
37
-
38
-
39
-    protected function _init_page_props()
40
-    {
41
-        $this->page_slug        = GEN_SET_PG_SLUG;
42
-        $this->page_label       = GEN_SET_LABEL;
43
-        $this->_admin_base_url  = GEN_SET_ADMIN_URL;
44
-        $this->_admin_base_path = GEN_SET_ADMIN;
45
-    }
46
-
47
-
48
-    protected function _ajax_hooks()
49
-    {
50
-        add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings'));
51
-        add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states'));
52
-        add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3);
53
-        add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state'));
54
-    }
55
-
56
-
57
-    protected function _define_page_props()
58
-    {
59
-        $this->_admin_page_title = GEN_SET_LABEL;
60
-        $this->_labels           = array(
61
-            'publishbox' => __('Update Settings', 'event_espresso')
62
-        );
63
-    }
64
-
65
-
66
-    protected function _set_page_routes()
67
-    {
68
-        $this->_page_routes = array(
69
-
70
-            'critical_pages'                => array(
71
-                'func'       => '_espresso_page_settings',
72
-                'capability' => 'manage_options'
73
-            ),
74
-            'update_espresso_page_settings' => array(
75
-                'func'       => '_update_espresso_page_settings',
76
-                'capability' => 'manage_options',
77
-                'noheader'   => true,
78
-            ),
79
-            'default'                       => array(
80
-                'func'       => '_your_organization_settings',
81
-                'capability' => 'manage_options',
82
-            ),
83
-
84
-            'update_your_organization_settings' => array(
85
-                'func'       => '_update_your_organization_settings',
86
-                'capability' => 'manage_options',
87
-                'noheader'   => true,
88
-            ),
89
-
90
-            'admin_option_settings' => array(
91
-                'func'       => '_admin_option_settings',
92
-                'capability' => 'manage_options',
93
-            ),
94
-
95
-            'update_admin_option_settings' => array(
96
-                'func'       => '_update_admin_option_settings',
97
-                'capability' => 'manage_options',
98
-                'noheader'   => true,
99
-            ),
100
-
101
-            'country_settings' => array(
102
-                'func'       => '_country_settings',
103
-                'capability' => 'manage_options'
104
-            ),
105
-
106
-            'update_country_settings' => array(
107
-                'func'       => '_update_country_settings',
108
-                'capability' => 'manage_options',
109
-                'noheader'   => true,
110
-            ),
111
-
112
-            'display_country_settings' => array(
113
-                'func'       => 'display_country_settings',
114
-                'capability' => 'manage_options',
115
-                'noheader'   => true,
116
-            ),
117
-
118
-            'add_new_state' => array(
119
-                'func'       => 'add_new_state',
120
-                'capability' => 'manage_options',
121
-                'noheader'   => true,
122
-            ),
123
-
124
-            'delete_state' => array(
125
-                'func'       => 'delete_state',
126
-                'capability' => 'manage_options',
127
-                'noheader'   => true,
128
-            )
129
-        );
130
-    }
131
-
132
-
133
-    protected function _set_page_config()
134
-    {
135
-        $this->_page_config = array(
136
-            'critical_pages'        => array(
137
-                'nav'           => array(
138
-                    'label' => __('Critical Pages', 'event_espresso'),
139
-                    'order' => 50
140
-                ),
141
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
142
-                'help_tabs'     => array(
143
-                    'general_settings_critical_pages_help_tab' => array(
144
-                        'title'    => __('Critical Pages', 'event_espresso'),
145
-                        'filename' => 'general_settings_critical_pages'
146
-                    )
147
-                ),
148
-                'help_tour'     => array('Critical_Pages_Help_Tour'),
149
-                'require_nonce' => false
150
-            ),
151
-            'default'               => array(
152
-                'nav'           => array(
153
-                    'label' => __('Your Organization', 'event_espresso'),
154
-                    'order' => 20
155
-                ),
156
-                'help_tabs'     => array(
157
-                    'general_settings_your_organization_help_tab' => array(
158
-                        'title'    => __('Your Organization', 'event_espresso'),
159
-                        'filename' => 'general_settings_your_organization'
160
-                    )
161
-                ),
162
-                'help_tour'     => array('Your_Organization_Help_Tour'),
163
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
164
-                'require_nonce' => false
165
-            ),
166
-            'admin_option_settings' => array(
167
-                'nav'           => array(
168
-                    'label' => __('Admin Options', 'event_espresso'),
169
-                    'order' => 60
170
-                ),
171
-                'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
172
-                'help_tabs'     => array(
173
-                    'general_settings_admin_options_help_tab' => array(
174
-                        'title'    => __('Admin Options', 'event_espresso'),
175
-                        'filename' => 'general_settings_admin_options'
176
-                    )
177
-                ),
178
-                'help_tour'     => array('Admin_Options_Help_Tour'),
179
-                'require_nonce' => false
180
-            ),
181
-            'country_settings'      => array(
182
-                'nav'           => array(
183
-                    'label' => __('Countries', 'event_espresso'),
184
-                    'order' => 70
185
-                ),
186
-                'help_tabs'     => array(
187
-                    'general_settings_countries_help_tab' => array(
188
-                        'title'    => __('Countries', 'event_espresso'),
189
-                        'filename' => 'general_settings_countries'
190
-                    )
191
-                ),
192
-                'help_tour'     => array('Countries_Help_Tour'),
193
-                'require_nonce' => false
194
-            )
195
-        );
196
-    }
197
-
198
-
199
-    protected function _add_screen_options()
200
-    {
201
-    }
202
-
203
-    protected function _add_feature_pointers()
204
-    {
205
-    }
206
-
207
-    public function load_scripts_styles()
208
-    {
209
-        //styles
210
-        wp_enqueue_style('espresso-ui-theme');
211
-        //scripts
212
-        wp_enqueue_script('ee_admin_js');
213
-    }
214
-
215
-    public function admin_init()
216
-    {
217
-        EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.',
218
-            'event_espresso');
219
-        EE_Registry::$i18n_js_strings['error_occurred']          = __('An error occurred! Please refresh the page and try again.',
220
-            'event_espresso');
221
-        EE_Registry::$i18n_js_strings['confirm_delete_state']    = __('Are you sure you want to delete this State / Province?',
222
-            'event_espresso');
223
-        $protocol                                                = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
224
-        EE_Registry::$i18n_js_strings['ajax_url']                = admin_url('admin-ajax.php?page=espresso_general_settings',
225
-            $protocol);
226
-    }
227
-
228
-    public function admin_notices()
229
-    {
230
-    }
231
-
232
-    public function admin_footer_scripts()
233
-    {
234
-    }
235
-
236
-
237
-    public function load_scripts_styles_default()
238
-    {
239
-        //styles
240
-        wp_enqueue_style('thickbox');
241
-        //scripts
242
-        wp_enqueue_script('media-upload');
243
-        wp_enqueue_script('thickbox');
244
-        wp_register_script('organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js',
245
-            array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, true);
246
-        wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
247
-        wp_enqueue_script('organization_settings');
248
-        wp_enqueue_style('organization-css');
249
-        $confirm_image_delete = array(
250
-            'text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.',
251
-                'event_espresso')
252
-        );
253
-        wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete);
254
-
255
-    }
256
-
257
-    public function load_scripts_styles_country_settings()
258
-    {
259
-        //scripts
260
-        wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js',
261
-            array('ee_admin_js'), EVENT_ESPRESSO_VERSION, true);
262
-        wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
263
-        wp_enqueue_script('gen_settings_countries');
264
-        wp_enqueue_style('organization-css');
265
-
266
-    }
267
-
268
-
269
-    /*************        Espresso Pages        *************/
270
-    /**
271
-     * _espresso_page_settings
272
-     *
273
-     * @throws \EE_Error
274
-     */
275
-    protected function _espresso_page_settings()
276
-    {
277
-        // Check to make sure all of the main pages are setup properly,
278
-        // if not create the default pages and display an admin notice
279
-        EEH_Activation::verify_default_pages_exist();
280
-        $this->_transient_garbage_collection();
281
-        $this->_template_args['values']             = $this->_yes_no_values;
282
-        $this->_template_args['reg_page_id']        = isset(EE_Registry::instance()->CFG->core->reg_page_id)
283
-            ? EE_Registry::instance()->CFG->core->reg_page_id
284
-            : null;
285
-        $this->_template_args['reg_page_obj']       = isset(EE_Registry::instance()->CFG->core->reg_page_id)
286
-            ? get_page(EE_Registry::instance()->CFG->core->reg_page_id)
287
-            : false;
288
-        $this->_template_args['txn_page_id']        = isset(EE_Registry::instance()->CFG->core->txn_page_id)
289
-            ? EE_Registry::instance()->CFG->core->txn_page_id
290
-            : null;
291
-        $this->_template_args['txn_page_obj']       = isset(EE_Registry::instance()->CFG->core->txn_page_id)
292
-            ? get_page(EE_Registry::instance()->CFG->core->txn_page_id)
293
-            : false;
294
-        $this->_template_args['thank_you_page_id']  = isset(EE_Registry::instance()->CFG->core->thank_you_page_id)
295
-            ? EE_Registry::instance()->CFG->core->thank_you_page_id
296
-            : null;
297
-        $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id)
298
-            ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id)
299
-            : false;
300
-        $this->_template_args['cancel_page_id']     = isset(EE_Registry::instance()->CFG->core->cancel_page_id)
301
-            ? EE_Registry::instance()->CFG->core->cancel_page_id
302
-            : null;
303
-        $this->_template_args['cancel_page_obj']    = isset(EE_Registry::instance()->CFG->core->cancel_page_id)
304
-            ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id)
305
-            : false;
306
-        $this->_set_add_edit_form_tags('update_espresso_page_settings');
307
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
308
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
309
-            GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php',
310
-            $this->_template_args,
311
-            true
312
-        );
313
-        $this->display_admin_page_with_sidebar();
314
-
315
-    }
316
-
317
-    protected function _update_espresso_page_settings()
318
-    {
319
-        // capture incoming request data && set page IDs
320
-        EE_Registry::instance()->CFG->core->reg_page_id = isset($this->_req_data['reg_page_id'])
321
-            ? absint($this->_req_data['reg_page_id'])
322
-            : EE_Registry::instance()->CFG->core->reg_page_id;
323
-        EE_Registry::instance()->CFG->core->txn_page_id = isset($this->_req_data['txn_page_id'])
324
-            ? absint($this->_req_data['txn_page_id'])
325
-            : EE_Registry::instance()->CFG->core->txn_page_id;
326
-        EE_Registry::instance()->CFG->core->thank_you_page_id = isset($this->_req_data['thank_you_page_id'])
327
-            ? absint($this->_req_data['thank_you_page_id'])
328
-            : EE_Registry::instance()->CFG->core->thank_you_page_id;
329
-        EE_Registry::instance()->CFG->core->cancel_page_id = isset($this->_req_data['cancel_page_id'])
330
-            ? absint($this->_req_data['cancel_page_id'])
331
-            : EE_Registry::instance()->CFG->core->cancel_page_id;
332
-
333
-        EE_Registry::instance()->CFG->core = apply_filters(
334
-            'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core',
335
-            EE_Registry::instance()->CFG->core,
336
-            $this->_req_data
337
-        );
338
-        $what = __('Critical Pages & Shortcodes', 'event_espresso');
339
-        $this->_redirect_after_action(
340
-            // success
341
-            $this->_update_espresso_configuration(
342
-                $what,
343
-                EE_Registry::instance()->CFG->core,
344
-                __FILE__,
345
-                __FUNCTION__,
346
-                __LINE__
347
-            ),
348
-            // what
349
-            $what
350
-            ,
351
-            // action desc
352
-            '',
353
-            // query args
354
-            array(
355
-                'action' => 'critical_pages'
356
-            ),
357
-            true
358
-        );
359
-
360
-    }
361
-
362
-
363
-    /*************        Your Organization        *************/
364
-
365
-
366
-    protected function _your_organization_settings()
367
-    {
368
-
369
-        $this->_template_args['site_license_key']       = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->get_pretty('site_license_key') : '';
370
-        $this->_template_args['organization_name']      = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : '';
371
-        $this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : '';
372
-        $this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : '';
373
-        $this->_template_args['organization_city']      = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : '';
374
-        $this->_template_args['organization_zip']       = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : '';
375
-        $this->_template_args['organization_email']     = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : '';
376
-        $this->_template_args['organization_phone']     = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : '';
377
-        $this->_template_args['organization_vat']       = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : '';
378
-        $this->_template_args['currency_sign']          = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$';
379
-        $this->_template_args['organization_logo_url']  = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : false;
380
-        $this->_template_args['organization_facebook']  = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : '';
381
-        $this->_template_args['organization_twitter']   = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : '';
382
-        $this->_template_args['organization_linkedin']  = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : '';
383
-        $this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : '';
384
-        $this->_template_args['organization_google']    = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : '';
385
-        $this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : '';
386
-        //UXIP settings
387
-        $this->_template_args['ee_ueip_optin'] = isset(EE_Registry::instance()->CFG->core->ee_ueip_optin) ? EE_Registry::instance()->CFG->core->get_pretty('ee_ueip_optin') : true;
388
-
389
-        $STA_ID                         = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;
390
-        $this->_template_args['states'] = new EE_Question_Form_Input(
391
-            EE_Question::new_instance(array(
392
-                'QST_ID'           => 0,
393
-                'QST_display_text' => __('State/Province', 'event_espresso'),
394
-                'QST_system'       => 'admin-state'
395
-            )),
396
-            EE_Answer::new_instance(array(
397
-                'ANS_ID'    => 0,
398
-                'ANS_value' => $STA_ID
399
-            )),
400
-            array(
401
-                'input_id'       => 'organization_state',
402
-                'input_name'     => 'organization_state',
403
-                'input_prefix'   => '',
404
-                'append_qstn_id' => false
405
-            )
406
-        );
407
-
408
-        $CNT_ISO                           = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
409
-        $this->_template_args['countries'] = new EE_Question_Form_Input(
410
-            EE_Question::new_instance(array(
411
-                'QST_ID'           => 0,
412
-                'QST_display_text' => __('Country', 'event_espresso'),
413
-                'QST_system'       => 'admin-country'
414
-            )),
415
-            EE_Answer::new_instance(array(
416
-                'ANS_ID'    => 0,
417
-                'ANS_value' => $CNT_ISO
418
-            )),
419
-            array(
420
-                'input_id'       => 'organization_country',
421
-                'input_name'     => 'organization_country',
422
-                'input_prefix'   => '',
423
-                'append_qstn_id' => false
424
-            )
425
-        );
426
-
427
-        add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
428
-        add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
429
-
430
-        //PUE verification stuff
431
-        $ver_option_key                                    = 'puvererr_' . basename(EE_PLUGIN_BASENAME);
432
-        $verify_fail                                       = get_option($ver_option_key);
433
-        $this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>';
434
-
435
-        $this->_set_add_edit_form_tags('update_your_organization_settings');
436
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
437
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php',
438
-            $this->_template_args, true);
439
-
440
-        $this->display_admin_page_with_sidebar();
441
-    }
442
-
443
-    protected function _update_your_organization_settings()
444
-    {
445
-        if (is_main_site()) {
446
-            EE_Registry::instance()->NET_CFG->core->site_license_key = isset($this->_req_data['site_license_key']) ? sanitize_text_field($this->_req_data['site_license_key']) : EE_Registry::instance()->NET_CFG->core->site_license_key;
447
-        }
448
-        EE_Registry::instance()->CFG->organization->name      = isset($this->_req_data['organization_name']) ? sanitize_text_field($this->_req_data['organization_name']) : EE_Registry::instance()->CFG->organization->name;
449
-        EE_Registry::instance()->CFG->organization->address_1 = isset($this->_req_data['organization_address_1']) ? sanitize_text_field($this->_req_data['organization_address_1']) : EE_Registry::instance()->CFG->organization->address_1;
450
-        EE_Registry::instance()->CFG->organization->address_2 = isset($this->_req_data['organization_address_2']) ? sanitize_text_field($this->_req_data['organization_address_2']) : EE_Registry::instance()->CFG->organization->address_2;
451
-        EE_Registry::instance()->CFG->organization->city      = isset($this->_req_data['organization_city']) ? sanitize_text_field($this->_req_data['organization_city']) : EE_Registry::instance()->CFG->organization->city;
452
-        EE_Registry::instance()->CFG->organization->STA_ID    = isset($this->_req_data['organization_state']) ? absint($this->_req_data['organization_state']) : EE_Registry::instance()->CFG->organization->STA_ID;
453
-        EE_Registry::instance()->CFG->organization->CNT_ISO   = isset($this->_req_data['organization_country']) ? sanitize_text_field($this->_req_data['organization_country']) : EE_Registry::instance()->CFG->organization->CNT_ISO;
454
-        EE_Registry::instance()->CFG->organization->zip       = isset($this->_req_data['organization_zip']) ? sanitize_text_field($this->_req_data['organization_zip']) : EE_Registry::instance()->CFG->organization->zip;
455
-        EE_Registry::instance()->CFG->organization->email     = isset($this->_req_data['organization_email']) ? sanitize_email($this->_req_data['organization_email']) : EE_Registry::instance()->CFG->organization->email;
456
-        EE_Registry::instance()->CFG->organization->vat       = isset($this->_req_data['organization_vat']) ? sanitize_text_field($this->_req_data['organization_vat']) : EE_Registry::instance()->CFG->organization->vat;
457
-        EE_Registry::instance()->CFG->organization->phone     = isset($this->_req_data['organization_phone']) ? sanitize_text_field($this->_req_data['organization_phone']) : EE_Registry::instance()->CFG->organization->phone;
458
-        EE_Registry::instance()->CFG->organization->logo_url  = isset($this->_req_data['organization_logo_url']) ? esc_url_raw($this->_req_data['organization_logo_url']) : EE_Registry::instance()->CFG->organization->logo_url;
459
-        EE_Registry::instance()->CFG->organization->facebook  = isset($this->_req_data['organization_facebook']) ? esc_url_raw($this->_req_data['organization_facebook']) : EE_Registry::instance()->CFG->organization->facebook;
460
-        EE_Registry::instance()->CFG->organization->twitter   = isset($this->_req_data['organization_twitter']) ? esc_url_raw($this->_req_data['organization_twitter']) : EE_Registry::instance()->CFG->organization->twitter;
461
-        EE_Registry::instance()->CFG->organization->linkedin  = isset($this->_req_data['organization_linkedin']) ? esc_url_raw($this->_req_data['organization_linkedin']) : EE_Registry::instance()->CFG->organization->linkedin;
462
-        EE_Registry::instance()->CFG->organization->pinterest = isset($this->_req_data['organization_pinterest']) ? esc_url_raw($this->_req_data['organization_pinterest']) : EE_Registry::instance()->CFG->organization->pinterest;
463
-        EE_Registry::instance()->CFG->organization->google    = isset($this->_req_data['organization_google']) ? esc_url_raw($this->_req_data['organization_google']) : EE_Registry::instance()->CFG->organization->google;
464
-        EE_Registry::instance()->CFG->organization->instagram = isset($this->_req_data['organization_instagram']) ? esc_url_raw($this->_req_data['organization_instagram']) : EE_Registry::instance()->CFG->organization->instagram;
465
-        EE_Registry::instance()->CFG->core->ee_ueip_optin     = isset($this->_req_data['ueip_optin']) && ! empty($this->_req_data['ueip_optin']) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin;
466
-
467
-        EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO);
468
-
469
-        EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG',
470
-            EE_Registry::instance()->CFG);
471
-
472
-        $what    = 'Your Organization Settings';
473
-        $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__,
474
-            __LINE__);
475
-
476
-        $this->_redirect_after_action($success, $what, 'updated', array('action' => 'default'));
477
-
478
-    }
479
-
480
-
481
-
482
-    /*************        Admin Options        *************/
483
-
484
-
485
-    /**
486
-     * _admin_option_settings
487
-     *
488
-     * @throws \EE_Error
489
-     * @throws \LogicException
490
-     */
491
-    protected function _admin_option_settings()
492
-    {
493
-        $this->_template_args['admin_page_content'] = '';
494
-        try {
495
-            $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
496
-            // still need this for the old school form in Extend_General_Settings_Admin_Page
497
-            $this->_template_args['values'] = $this->_yes_no_values;
498
-            // also need to account for the do_action that was in the old template
499
-            $admin_options_settings_form->setTemplateArgs($this->_template_args);
500
-            $this->_template_args['admin_page_content'] = $admin_options_settings_form->display();
501
-        } catch (Exception $e) {
502
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
503
-        }
504
-        $this->_set_add_edit_form_tags('update_admin_option_settings');
505
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
506
-        $this->display_admin_page_with_sidebar();
507
-    }
508
-
509
-
510
-    /**
511
-     * _update_admin_option_settings
512
-     *
513
-     * @throws \EE_Error
514
-     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
515
-     * @throws \EventEspresso\core\exceptions\InvalidFormSubmissionException
516
-     * @throws \InvalidArgumentException
517
-     * @throws \LogicException
518
-     */
519
-    protected function _update_admin_option_settings()
520
-    {
521
-        try {
522
-            $admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
523
-            $admin_options_settings_form->process($this->_req_data[$admin_options_settings_form->slug()]);
524
-            EE_Registry::instance()->CFG->admin = apply_filters(
525
-                'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin',
526
-                EE_Registry::instance()->CFG->admin
527
-            );
528
-        } catch (Exception $e) {
529
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
530
-        }
531
-        $this->_redirect_after_action(
532
-            apply_filters(
533
-                'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success',
534
-                $this->_update_espresso_configuration(
535
-                    'Admin Options',
536
-                    EE_Registry::instance()->CFG->admin,
537
-                    __FILE__, __FUNCTION__, __LINE__
538
-                )
539
-            ),
540
-            'Admin Options',
541
-            'updated',
542
-            array('action' => 'admin_option_settings')
543
-        );
544
-
545
-    }
546
-
547
-
548
-    /*************        Countries        *************/
549
-
550
-
551
-    protected function _country_settings()
552
-    {
553
-
554
-        $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
555
-        $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
556
-
557
-        //load field generator helper
558
-
559
-        $this->_template_args['values'] = $this->_yes_no_values;
560
-
561
-        $this->_template_args['countries'] = new EE_Question_Form_Input(
562
-            EE_Question::new_instance(array(
563
-                'QST_ID'           => 0,
564
-                'QST_display_text' => __('Select Country', 'event_espresso'),
565
-                'QST_system'       => 'admin-country'
566
-            )),
567
-            EE_Answer::new_instance(array(
568
-                'ANS_ID'    => 0,
569
-                'ANS_value' => $CNT_ISO
570
-            )),
571
-            array(
572
-                'input_id'       => 'country',
573
-                'input_name'     => 'country',
574
-                'input_prefix'   => '',
575
-                'append_qstn_id' => false
576
-            )
577
-        );
25
+	/**
26
+	 * _question_group
27
+	 * holds the specific question group object for the question group details screen
28
+	 * @var object
29
+	 */
30
+	protected $_question_group;
31
+
32
+
33
+	public function __construct($routing = true)
34
+	{
35
+		parent::__construct($routing);
36
+	}
37
+
38
+
39
+	protected function _init_page_props()
40
+	{
41
+		$this->page_slug        = GEN_SET_PG_SLUG;
42
+		$this->page_label       = GEN_SET_LABEL;
43
+		$this->_admin_base_url  = GEN_SET_ADMIN_URL;
44
+		$this->_admin_base_path = GEN_SET_ADMIN;
45
+	}
46
+
47
+
48
+	protected function _ajax_hooks()
49
+	{
50
+		add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings'));
51
+		add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states'));
52
+		add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3);
53
+		add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state'));
54
+	}
55
+
56
+
57
+	protected function _define_page_props()
58
+	{
59
+		$this->_admin_page_title = GEN_SET_LABEL;
60
+		$this->_labels           = array(
61
+			'publishbox' => __('Update Settings', 'event_espresso')
62
+		);
63
+	}
64
+
65
+
66
+	protected function _set_page_routes()
67
+	{
68
+		$this->_page_routes = array(
69
+
70
+			'critical_pages'                => array(
71
+				'func'       => '_espresso_page_settings',
72
+				'capability' => 'manage_options'
73
+			),
74
+			'update_espresso_page_settings' => array(
75
+				'func'       => '_update_espresso_page_settings',
76
+				'capability' => 'manage_options',
77
+				'noheader'   => true,
78
+			),
79
+			'default'                       => array(
80
+				'func'       => '_your_organization_settings',
81
+				'capability' => 'manage_options',
82
+			),
83
+
84
+			'update_your_organization_settings' => array(
85
+				'func'       => '_update_your_organization_settings',
86
+				'capability' => 'manage_options',
87
+				'noheader'   => true,
88
+			),
89
+
90
+			'admin_option_settings' => array(
91
+				'func'       => '_admin_option_settings',
92
+				'capability' => 'manage_options',
93
+			),
94
+
95
+			'update_admin_option_settings' => array(
96
+				'func'       => '_update_admin_option_settings',
97
+				'capability' => 'manage_options',
98
+				'noheader'   => true,
99
+			),
100
+
101
+			'country_settings' => array(
102
+				'func'       => '_country_settings',
103
+				'capability' => 'manage_options'
104
+			),
105
+
106
+			'update_country_settings' => array(
107
+				'func'       => '_update_country_settings',
108
+				'capability' => 'manage_options',
109
+				'noheader'   => true,
110
+			),
111
+
112
+			'display_country_settings' => array(
113
+				'func'       => 'display_country_settings',
114
+				'capability' => 'manage_options',
115
+				'noheader'   => true,
116
+			),
117
+
118
+			'add_new_state' => array(
119
+				'func'       => 'add_new_state',
120
+				'capability' => 'manage_options',
121
+				'noheader'   => true,
122
+			),
123
+
124
+			'delete_state' => array(
125
+				'func'       => 'delete_state',
126
+				'capability' => 'manage_options',
127
+				'noheader'   => true,
128
+			)
129
+		);
130
+	}
131
+
132
+
133
+	protected function _set_page_config()
134
+	{
135
+		$this->_page_config = array(
136
+			'critical_pages'        => array(
137
+				'nav'           => array(
138
+					'label' => __('Critical Pages', 'event_espresso'),
139
+					'order' => 50
140
+				),
141
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
142
+				'help_tabs'     => array(
143
+					'general_settings_critical_pages_help_tab' => array(
144
+						'title'    => __('Critical Pages', 'event_espresso'),
145
+						'filename' => 'general_settings_critical_pages'
146
+					)
147
+				),
148
+				'help_tour'     => array('Critical_Pages_Help_Tour'),
149
+				'require_nonce' => false
150
+			),
151
+			'default'               => array(
152
+				'nav'           => array(
153
+					'label' => __('Your Organization', 'event_espresso'),
154
+					'order' => 20
155
+				),
156
+				'help_tabs'     => array(
157
+					'general_settings_your_organization_help_tab' => array(
158
+						'title'    => __('Your Organization', 'event_espresso'),
159
+						'filename' => 'general_settings_your_organization'
160
+					)
161
+				),
162
+				'help_tour'     => array('Your_Organization_Help_Tour'),
163
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
164
+				'require_nonce' => false
165
+			),
166
+			'admin_option_settings' => array(
167
+				'nav'           => array(
168
+					'label' => __('Admin Options', 'event_espresso'),
169
+					'order' => 60
170
+				),
171
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
172
+				'help_tabs'     => array(
173
+					'general_settings_admin_options_help_tab' => array(
174
+						'title'    => __('Admin Options', 'event_espresso'),
175
+						'filename' => 'general_settings_admin_options'
176
+					)
177
+				),
178
+				'help_tour'     => array('Admin_Options_Help_Tour'),
179
+				'require_nonce' => false
180
+			),
181
+			'country_settings'      => array(
182
+				'nav'           => array(
183
+					'label' => __('Countries', 'event_espresso'),
184
+					'order' => 70
185
+				),
186
+				'help_tabs'     => array(
187
+					'general_settings_countries_help_tab' => array(
188
+						'title'    => __('Countries', 'event_espresso'),
189
+						'filename' => 'general_settings_countries'
190
+					)
191
+				),
192
+				'help_tour'     => array('Countries_Help_Tour'),
193
+				'require_nonce' => false
194
+			)
195
+		);
196
+	}
197
+
198
+
199
+	protected function _add_screen_options()
200
+	{
201
+	}
202
+
203
+	protected function _add_feature_pointers()
204
+	{
205
+	}
206
+
207
+	public function load_scripts_styles()
208
+	{
209
+		//styles
210
+		wp_enqueue_style('espresso-ui-theme');
211
+		//scripts
212
+		wp_enqueue_script('ee_admin_js');
213
+	}
214
+
215
+	public function admin_init()
216
+	{
217
+		EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.',
218
+			'event_espresso');
219
+		EE_Registry::$i18n_js_strings['error_occurred']          = __('An error occurred! Please refresh the page and try again.',
220
+			'event_espresso');
221
+		EE_Registry::$i18n_js_strings['confirm_delete_state']    = __('Are you sure you want to delete this State / Province?',
222
+			'event_espresso');
223
+		$protocol                                                = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
224
+		EE_Registry::$i18n_js_strings['ajax_url']                = admin_url('admin-ajax.php?page=espresso_general_settings',
225
+			$protocol);
226
+	}
227
+
228
+	public function admin_notices()
229
+	{
230
+	}
231
+
232
+	public function admin_footer_scripts()
233
+	{
234
+	}
235
+
236
+
237
+	public function load_scripts_styles_default()
238
+	{
239
+		//styles
240
+		wp_enqueue_style('thickbox');
241
+		//scripts
242
+		wp_enqueue_script('media-upload');
243
+		wp_enqueue_script('thickbox');
244
+		wp_register_script('organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js',
245
+			array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, true);
246
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
247
+		wp_enqueue_script('organization_settings');
248
+		wp_enqueue_style('organization-css');
249
+		$confirm_image_delete = array(
250
+			'text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.',
251
+				'event_espresso')
252
+		);
253
+		wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete);
254
+
255
+	}
256
+
257
+	public function load_scripts_styles_country_settings()
258
+	{
259
+		//scripts
260
+		wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js',
261
+			array('ee_admin_js'), EVENT_ESPRESSO_VERSION, true);
262
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION);
263
+		wp_enqueue_script('gen_settings_countries');
264
+		wp_enqueue_style('organization-css');
265
+
266
+	}
267
+
268
+
269
+	/*************        Espresso Pages        *************/
270
+	/**
271
+	 * _espresso_page_settings
272
+	 *
273
+	 * @throws \EE_Error
274
+	 */
275
+	protected function _espresso_page_settings()
276
+	{
277
+		// Check to make sure all of the main pages are setup properly,
278
+		// if not create the default pages and display an admin notice
279
+		EEH_Activation::verify_default_pages_exist();
280
+		$this->_transient_garbage_collection();
281
+		$this->_template_args['values']             = $this->_yes_no_values;
282
+		$this->_template_args['reg_page_id']        = isset(EE_Registry::instance()->CFG->core->reg_page_id)
283
+			? EE_Registry::instance()->CFG->core->reg_page_id
284
+			: null;
285
+		$this->_template_args['reg_page_obj']       = isset(EE_Registry::instance()->CFG->core->reg_page_id)
286
+			? get_page(EE_Registry::instance()->CFG->core->reg_page_id)
287
+			: false;
288
+		$this->_template_args['txn_page_id']        = isset(EE_Registry::instance()->CFG->core->txn_page_id)
289
+			? EE_Registry::instance()->CFG->core->txn_page_id
290
+			: null;
291
+		$this->_template_args['txn_page_obj']       = isset(EE_Registry::instance()->CFG->core->txn_page_id)
292
+			? get_page(EE_Registry::instance()->CFG->core->txn_page_id)
293
+			: false;
294
+		$this->_template_args['thank_you_page_id']  = isset(EE_Registry::instance()->CFG->core->thank_you_page_id)
295
+			? EE_Registry::instance()->CFG->core->thank_you_page_id
296
+			: null;
297
+		$this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id)
298
+			? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id)
299
+			: false;
300
+		$this->_template_args['cancel_page_id']     = isset(EE_Registry::instance()->CFG->core->cancel_page_id)
301
+			? EE_Registry::instance()->CFG->core->cancel_page_id
302
+			: null;
303
+		$this->_template_args['cancel_page_obj']    = isset(EE_Registry::instance()->CFG->core->cancel_page_id)
304
+			? get_page(EE_Registry::instance()->CFG->core->cancel_page_id)
305
+			: false;
306
+		$this->_set_add_edit_form_tags('update_espresso_page_settings');
307
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
308
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
309
+			GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php',
310
+			$this->_template_args,
311
+			true
312
+		);
313
+		$this->display_admin_page_with_sidebar();
314
+
315
+	}
316
+
317
+	protected function _update_espresso_page_settings()
318
+	{
319
+		// capture incoming request data && set page IDs
320
+		EE_Registry::instance()->CFG->core->reg_page_id = isset($this->_req_data['reg_page_id'])
321
+			? absint($this->_req_data['reg_page_id'])
322
+			: EE_Registry::instance()->CFG->core->reg_page_id;
323
+		EE_Registry::instance()->CFG->core->txn_page_id = isset($this->_req_data['txn_page_id'])
324
+			? absint($this->_req_data['txn_page_id'])
325
+			: EE_Registry::instance()->CFG->core->txn_page_id;
326
+		EE_Registry::instance()->CFG->core->thank_you_page_id = isset($this->_req_data['thank_you_page_id'])
327
+			? absint($this->_req_data['thank_you_page_id'])
328
+			: EE_Registry::instance()->CFG->core->thank_you_page_id;
329
+		EE_Registry::instance()->CFG->core->cancel_page_id = isset($this->_req_data['cancel_page_id'])
330
+			? absint($this->_req_data['cancel_page_id'])
331
+			: EE_Registry::instance()->CFG->core->cancel_page_id;
332
+
333
+		EE_Registry::instance()->CFG->core = apply_filters(
334
+			'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core',
335
+			EE_Registry::instance()->CFG->core,
336
+			$this->_req_data
337
+		);
338
+		$what = __('Critical Pages & Shortcodes', 'event_espresso');
339
+		$this->_redirect_after_action(
340
+			// success
341
+			$this->_update_espresso_configuration(
342
+				$what,
343
+				EE_Registry::instance()->CFG->core,
344
+				__FILE__,
345
+				__FUNCTION__,
346
+				__LINE__
347
+			),
348
+			// what
349
+			$what
350
+			,
351
+			// action desc
352
+			'',
353
+			// query args
354
+			array(
355
+				'action' => 'critical_pages'
356
+			),
357
+			true
358
+		);
359
+
360
+	}
361
+
362
+
363
+	/*************        Your Organization        *************/
364
+
365
+
366
+	protected function _your_organization_settings()
367
+	{
368
+
369
+		$this->_template_args['site_license_key']       = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->get_pretty('site_license_key') : '';
370
+		$this->_template_args['organization_name']      = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : '';
371
+		$this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : '';
372
+		$this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : '';
373
+		$this->_template_args['organization_city']      = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : '';
374
+		$this->_template_args['organization_zip']       = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : '';
375
+		$this->_template_args['organization_email']     = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : '';
376
+		$this->_template_args['organization_phone']     = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : '';
377
+		$this->_template_args['organization_vat']       = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : '';
378
+		$this->_template_args['currency_sign']          = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$';
379
+		$this->_template_args['organization_logo_url']  = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : false;
380
+		$this->_template_args['organization_facebook']  = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : '';
381
+		$this->_template_args['organization_twitter']   = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : '';
382
+		$this->_template_args['organization_linkedin']  = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : '';
383
+		$this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : '';
384
+		$this->_template_args['organization_google']    = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : '';
385
+		$this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : '';
386
+		//UXIP settings
387
+		$this->_template_args['ee_ueip_optin'] = isset(EE_Registry::instance()->CFG->core->ee_ueip_optin) ? EE_Registry::instance()->CFG->core->get_pretty('ee_ueip_optin') : true;
388
+
389
+		$STA_ID                         = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;
390
+		$this->_template_args['states'] = new EE_Question_Form_Input(
391
+			EE_Question::new_instance(array(
392
+				'QST_ID'           => 0,
393
+				'QST_display_text' => __('State/Province', 'event_espresso'),
394
+				'QST_system'       => 'admin-state'
395
+			)),
396
+			EE_Answer::new_instance(array(
397
+				'ANS_ID'    => 0,
398
+				'ANS_value' => $STA_ID
399
+			)),
400
+			array(
401
+				'input_id'       => 'organization_state',
402
+				'input_name'     => 'organization_state',
403
+				'input_prefix'   => '',
404
+				'append_qstn_id' => false
405
+			)
406
+		);
407
+
408
+		$CNT_ISO                           = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
409
+		$this->_template_args['countries'] = new EE_Question_Form_Input(
410
+			EE_Question::new_instance(array(
411
+				'QST_ID'           => 0,
412
+				'QST_display_text' => __('Country', 'event_espresso'),
413
+				'QST_system'       => 'admin-country'
414
+			)),
415
+			EE_Answer::new_instance(array(
416
+				'ANS_ID'    => 0,
417
+				'ANS_value' => $CNT_ISO
418
+			)),
419
+			array(
420
+				'input_id'       => 'organization_country',
421
+				'input_name'     => 'organization_country',
422
+				'input_prefix'   => '',
423
+				'append_qstn_id' => false
424
+			)
425
+		);
426
+
427
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
428
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
429
+
430
+		//PUE verification stuff
431
+		$ver_option_key                                    = 'puvererr_' . basename(EE_PLUGIN_BASENAME);
432
+		$verify_fail                                       = get_option($ver_option_key);
433
+		$this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>';
434
+
435
+		$this->_set_add_edit_form_tags('update_your_organization_settings');
436
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
437
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php',
438
+			$this->_template_args, true);
439
+
440
+		$this->display_admin_page_with_sidebar();
441
+	}
442
+
443
+	protected function _update_your_organization_settings()
444
+	{
445
+		if (is_main_site()) {
446
+			EE_Registry::instance()->NET_CFG->core->site_license_key = isset($this->_req_data['site_license_key']) ? sanitize_text_field($this->_req_data['site_license_key']) : EE_Registry::instance()->NET_CFG->core->site_license_key;
447
+		}
448
+		EE_Registry::instance()->CFG->organization->name      = isset($this->_req_data['organization_name']) ? sanitize_text_field($this->_req_data['organization_name']) : EE_Registry::instance()->CFG->organization->name;
449
+		EE_Registry::instance()->CFG->organization->address_1 = isset($this->_req_data['organization_address_1']) ? sanitize_text_field($this->_req_data['organization_address_1']) : EE_Registry::instance()->CFG->organization->address_1;
450
+		EE_Registry::instance()->CFG->organization->address_2 = isset($this->_req_data['organization_address_2']) ? sanitize_text_field($this->_req_data['organization_address_2']) : EE_Registry::instance()->CFG->organization->address_2;
451
+		EE_Registry::instance()->CFG->organization->city      = isset($this->_req_data['organization_city']) ? sanitize_text_field($this->_req_data['organization_city']) : EE_Registry::instance()->CFG->organization->city;
452
+		EE_Registry::instance()->CFG->organization->STA_ID    = isset($this->_req_data['organization_state']) ? absint($this->_req_data['organization_state']) : EE_Registry::instance()->CFG->organization->STA_ID;
453
+		EE_Registry::instance()->CFG->organization->CNT_ISO   = isset($this->_req_data['organization_country']) ? sanitize_text_field($this->_req_data['organization_country']) : EE_Registry::instance()->CFG->organization->CNT_ISO;
454
+		EE_Registry::instance()->CFG->organization->zip       = isset($this->_req_data['organization_zip']) ? sanitize_text_field($this->_req_data['organization_zip']) : EE_Registry::instance()->CFG->organization->zip;
455
+		EE_Registry::instance()->CFG->organization->email     = isset($this->_req_data['organization_email']) ? sanitize_email($this->_req_data['organization_email']) : EE_Registry::instance()->CFG->organization->email;
456
+		EE_Registry::instance()->CFG->organization->vat       = isset($this->_req_data['organization_vat']) ? sanitize_text_field($this->_req_data['organization_vat']) : EE_Registry::instance()->CFG->organization->vat;
457
+		EE_Registry::instance()->CFG->organization->phone     = isset($this->_req_data['organization_phone']) ? sanitize_text_field($this->_req_data['organization_phone']) : EE_Registry::instance()->CFG->organization->phone;
458
+		EE_Registry::instance()->CFG->organization->logo_url  = isset($this->_req_data['organization_logo_url']) ? esc_url_raw($this->_req_data['organization_logo_url']) : EE_Registry::instance()->CFG->organization->logo_url;
459
+		EE_Registry::instance()->CFG->organization->facebook  = isset($this->_req_data['organization_facebook']) ? esc_url_raw($this->_req_data['organization_facebook']) : EE_Registry::instance()->CFG->organization->facebook;
460
+		EE_Registry::instance()->CFG->organization->twitter   = isset($this->_req_data['organization_twitter']) ? esc_url_raw($this->_req_data['organization_twitter']) : EE_Registry::instance()->CFG->organization->twitter;
461
+		EE_Registry::instance()->CFG->organization->linkedin  = isset($this->_req_data['organization_linkedin']) ? esc_url_raw($this->_req_data['organization_linkedin']) : EE_Registry::instance()->CFG->organization->linkedin;
462
+		EE_Registry::instance()->CFG->organization->pinterest = isset($this->_req_data['organization_pinterest']) ? esc_url_raw($this->_req_data['organization_pinterest']) : EE_Registry::instance()->CFG->organization->pinterest;
463
+		EE_Registry::instance()->CFG->organization->google    = isset($this->_req_data['organization_google']) ? esc_url_raw($this->_req_data['organization_google']) : EE_Registry::instance()->CFG->organization->google;
464
+		EE_Registry::instance()->CFG->organization->instagram = isset($this->_req_data['organization_instagram']) ? esc_url_raw($this->_req_data['organization_instagram']) : EE_Registry::instance()->CFG->organization->instagram;
465
+		EE_Registry::instance()->CFG->core->ee_ueip_optin     = isset($this->_req_data['ueip_optin']) && ! empty($this->_req_data['ueip_optin']) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin;
466
+
467
+		EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO);
468
+
469
+		EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG',
470
+			EE_Registry::instance()->CFG);
471
+
472
+		$what    = 'Your Organization Settings';
473
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__,
474
+			__LINE__);
475
+
476
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'default'));
477
+
478
+	}
479
+
480
+
481
+
482
+	/*************        Admin Options        *************/
483
+
484
+
485
+	/**
486
+	 * _admin_option_settings
487
+	 *
488
+	 * @throws \EE_Error
489
+	 * @throws \LogicException
490
+	 */
491
+	protected function _admin_option_settings()
492
+	{
493
+		$this->_template_args['admin_page_content'] = '';
494
+		try {
495
+			$admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
496
+			// still need this for the old school form in Extend_General_Settings_Admin_Page
497
+			$this->_template_args['values'] = $this->_yes_no_values;
498
+			// also need to account for the do_action that was in the old template
499
+			$admin_options_settings_form->setTemplateArgs($this->_template_args);
500
+			$this->_template_args['admin_page_content'] = $admin_options_settings_form->display();
501
+		} catch (Exception $e) {
502
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
503
+		}
504
+		$this->_set_add_edit_form_tags('update_admin_option_settings');
505
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
506
+		$this->display_admin_page_with_sidebar();
507
+	}
508
+
509
+
510
+	/**
511
+	 * _update_admin_option_settings
512
+	 *
513
+	 * @throws \EE_Error
514
+	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
515
+	 * @throws \EventEspresso\core\exceptions\InvalidFormSubmissionException
516
+	 * @throws \InvalidArgumentException
517
+	 * @throws \LogicException
518
+	 */
519
+	protected function _update_admin_option_settings()
520
+	{
521
+		try {
522
+			$admin_options_settings_form = new AdminOptionsSettings(EE_Registry::instance());
523
+			$admin_options_settings_form->process($this->_req_data[$admin_options_settings_form->slug()]);
524
+			EE_Registry::instance()->CFG->admin = apply_filters(
525
+				'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin',
526
+				EE_Registry::instance()->CFG->admin
527
+			);
528
+		} catch (Exception $e) {
529
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
530
+		}
531
+		$this->_redirect_after_action(
532
+			apply_filters(
533
+				'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success',
534
+				$this->_update_espresso_configuration(
535
+					'Admin Options',
536
+					EE_Registry::instance()->CFG->admin,
537
+					__FILE__, __FUNCTION__, __LINE__
538
+				)
539
+			),
540
+			'Admin Options',
541
+			'updated',
542
+			array('action' => 'admin_option_settings')
543
+		);
544
+
545
+	}
546
+
547
+
548
+	/*************        Countries        *************/
549
+
550
+
551
+	protected function _country_settings()
552
+	{
553
+
554
+		$CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
555
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
556
+
557
+		//load field generator helper
558
+
559
+		$this->_template_args['values'] = $this->_yes_no_values;
560
+
561
+		$this->_template_args['countries'] = new EE_Question_Form_Input(
562
+			EE_Question::new_instance(array(
563
+				'QST_ID'           => 0,
564
+				'QST_display_text' => __('Select Country', 'event_espresso'),
565
+				'QST_system'       => 'admin-country'
566
+			)),
567
+			EE_Answer::new_instance(array(
568
+				'ANS_ID'    => 0,
569
+				'ANS_value' => $CNT_ISO
570
+			)),
571
+			array(
572
+				'input_id'       => 'country',
573
+				'input_name'     => 'country',
574
+				'input_prefix'   => '',
575
+				'append_qstn_id' => false
576
+			)
577
+		);
578 578
 //		EEH_Debug_Tools::printr( $this->_template_args['countries'], 'countries  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
579 579
 
580
-        add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
581
-        add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
582
-        $this->_template_args['country_details_settings'] = $this->display_country_settings();
583
-        $this->_template_args['country_states_settings']  = $this->display_country_states();
584
-
585
-        $this->_set_add_edit_form_tags('update_country_settings');
586
-        $this->_set_publish_post_box_vars(null, false, false, null, false);
587
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php',
588
-            $this->_template_args, true);
589
-        $this->display_admin_page_with_no_sidebar();
590
-    }
591
-
592
-
593
-    /**
594
-     *        display_country_settings
595
-     *
596
-     * @access    public
597
-     *
598
-     * @param    string $CNT_ISO
599
-     *
600
-     * @return        mixed        string | array
601
-     */
602
-    public function display_country_settings($CNT_ISO = '')
603
-    {
604
-
605
-        $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
606
-        if ( ! $CNT_ISO) {
607
-            return '';
608
-        }
609
-
610
-        // for ajax
611
-        remove_all_filters('FHEE__EEH_Form_Fields__label_html');
612
-        remove_all_filters('FHEE__EEH_Form_Fields__input_html');
613
-        add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
614
-        add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
615
-        $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);
616
-        //EEH_Debug_Tools::printr( $country, '$country  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
617
-        $country_input_types            = array(
618
-            'CNT_active'      => array(
619
-                'type'             => 'RADIO_BTN',
620
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
621
-                'class'            => '',
622
-                'options'          => $this->_yes_no_values,
623
-                'use_desc_4_label' => true
624
-            ),
625
-            'CNT_ISO'         => array(
626
-                'type'       => 'TEXT',
627
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
628
-                'class'      => 'small-text'
629
-            ),
630
-            'CNT_ISO3'        => array(
631
-                'type'       => 'TEXT',
632
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
633
-                'class'      => 'small-text'
634
-            ),
635
-            'RGN_ID'          => array(
636
-                'type'       => 'TEXT',
637
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
638
-                'class'      => 'small-text'
639
-            ),
640
-            'CNT_name'        => array(
641
-                'type'       => 'TEXT',
642
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
643
-                'class'      => 'regular-text'
644
-            ),
645
-            'CNT_cur_code'    => array(
646
-                'type'       => 'TEXT',
647
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
648
-                'class'      => 'small-text'
649
-            ),
650
-            'CNT_cur_single'  => array(
651
-                'type'       => 'TEXT',
652
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
653
-                'class'      => 'medium-text'
654
-            ),
655
-            'CNT_cur_plural'  => array(
656
-                'type'       => 'TEXT',
657
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
658
-                'class'      => 'medium-text'
659
-            ),
660
-            'CNT_cur_sign'    => array(
661
-                'type'         => 'TEXT',
662
-                'input_name'   => 'cntry[' . $CNT_ISO . ']',
663
-                'class'        => 'small-text',
664
-                'htmlentities' => false
665
-            ),
666
-            'CNT_cur_sign_b4' => array(
667
-                'type'             => 'RADIO_BTN',
668
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
669
-                'class'            => '',
670
-                'options'          => $this->_yes_no_values,
671
-                'use_desc_4_label' => true
672
-            ),
673
-            'CNT_cur_dec_plc' => array(
674
-                'type'       => 'RADIO_BTN',
675
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
676
-                'class'      => '',
677
-                'options'    => array(
678
-                    array('id' => 0, 'text' => ''),
679
-                    array('id' => 1, 'text' => ''),
680
-                    array('id' => 2, 'text' => ''),
681
-                    array('id' => 3, 'text' => '')
682
-                )
683
-            ),
684
-            'CNT_cur_dec_mrk' => array(
685
-                'type'             => 'RADIO_BTN',
686
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
687
-                'class'            => '',
688
-                'options'          => array(
689
-                    array(
690
-                        'id'   => ',',
691
-                        'text' => __(', (comma)', 'event_espresso')
692
-                    ),
693
-                    array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))
694
-                ),
695
-                'use_desc_4_label' => true
696
-            ),
697
-            'CNT_cur_thsnds'  => array(
698
-                'type'             => 'RADIO_BTN',
699
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
700
-                'class'            => '',
701
-                'options'          => array(
702
-                    array(
703
-                        'id'   => ',',
704
-                        'text' => __(', (comma)', 'event_espresso')
705
-                    ),
706
-                    array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))
707
-                ),
708
-                'use_desc_4_label' => true
709
-            ),
710
-            'CNT_tel_code'    => array(
711
-                'type'       => 'TEXT',
712
-                'input_name' => 'cntry[' . $CNT_ISO . ']',
713
-                'class'      => 'small-text'
714
-            ),
715
-            'CNT_is_EU'       => array(
716
-                'type'             => 'RADIO_BTN',
717
-                'input_name'       => 'cntry[' . $CNT_ISO . ']',
718
-                'class'            => '',
719
-                'options'          => $this->_yes_no_values,
720
-                'use_desc_4_label' => true
721
-            )
722
-        );
723
-        $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country,
724
-            $country_input_types);
725
-        $country_details_settings       = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php',
726
-            $this->_template_args, true);
727
-
728
-        if (defined('DOING_AJAX')) {
729
-            $notices = EE_Error::get_notices(false, false, false);
730
-            echo wp_json_encode(array(
731
-                'return_data' => $country_details_settings,
732
-                'success'     => $notices['success'],
733
-                'errors'      => $notices['errors']
734
-            ));
735
-            die();
736
-        } else {
737
-            return $country_details_settings;
738
-        }
739
-
740
-    }
741
-
742
-
743
-    /**
744
-     *        display_country_states
745
-     *
746
-     * @access    public
747
-     *
748
-     * @param    string $CNT_ISO
749
-     *
750
-     * @return        string
751
-     */
752
-    public function display_country_states($CNT_ISO = '')
753
-    {
754
-
755
-        $CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO;
756
-
757
-        if ( ! $CNT_ISO) {
758
-            return '';
759
-        }
760
-        // for ajax
761
-        remove_all_filters('FHEE__EEH_Form_Fields__label_html');
762
-        remove_all_filters('FHEE__EEH_Form_Fields__input_html');
763
-        add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2);
764
-        add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2);
765
-        $states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO));
580
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
581
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
582
+		$this->_template_args['country_details_settings'] = $this->display_country_settings();
583
+		$this->_template_args['country_states_settings']  = $this->display_country_states();
584
+
585
+		$this->_set_add_edit_form_tags('update_country_settings');
586
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
587
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php',
588
+			$this->_template_args, true);
589
+		$this->display_admin_page_with_no_sidebar();
590
+	}
591
+
592
+
593
+	/**
594
+	 *        display_country_settings
595
+	 *
596
+	 * @access    public
597
+	 *
598
+	 * @param    string $CNT_ISO
599
+	 *
600
+	 * @return        mixed        string | array
601
+	 */
602
+	public function display_country_settings($CNT_ISO = '')
603
+	{
604
+
605
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
606
+		if ( ! $CNT_ISO) {
607
+			return '';
608
+		}
609
+
610
+		// for ajax
611
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
612
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
613
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
614
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
615
+		$country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);
616
+		//EEH_Debug_Tools::printr( $country, '$country  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
617
+		$country_input_types            = array(
618
+			'CNT_active'      => array(
619
+				'type'             => 'RADIO_BTN',
620
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
621
+				'class'            => '',
622
+				'options'          => $this->_yes_no_values,
623
+				'use_desc_4_label' => true
624
+			),
625
+			'CNT_ISO'         => array(
626
+				'type'       => 'TEXT',
627
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
628
+				'class'      => 'small-text'
629
+			),
630
+			'CNT_ISO3'        => array(
631
+				'type'       => 'TEXT',
632
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
633
+				'class'      => 'small-text'
634
+			),
635
+			'RGN_ID'          => array(
636
+				'type'       => 'TEXT',
637
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
638
+				'class'      => 'small-text'
639
+			),
640
+			'CNT_name'        => array(
641
+				'type'       => 'TEXT',
642
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
643
+				'class'      => 'regular-text'
644
+			),
645
+			'CNT_cur_code'    => array(
646
+				'type'       => 'TEXT',
647
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
648
+				'class'      => 'small-text'
649
+			),
650
+			'CNT_cur_single'  => array(
651
+				'type'       => 'TEXT',
652
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
653
+				'class'      => 'medium-text'
654
+			),
655
+			'CNT_cur_plural'  => array(
656
+				'type'       => 'TEXT',
657
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
658
+				'class'      => 'medium-text'
659
+			),
660
+			'CNT_cur_sign'    => array(
661
+				'type'         => 'TEXT',
662
+				'input_name'   => 'cntry[' . $CNT_ISO . ']',
663
+				'class'        => 'small-text',
664
+				'htmlentities' => false
665
+			),
666
+			'CNT_cur_sign_b4' => array(
667
+				'type'             => 'RADIO_BTN',
668
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
669
+				'class'            => '',
670
+				'options'          => $this->_yes_no_values,
671
+				'use_desc_4_label' => true
672
+			),
673
+			'CNT_cur_dec_plc' => array(
674
+				'type'       => 'RADIO_BTN',
675
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
676
+				'class'      => '',
677
+				'options'    => array(
678
+					array('id' => 0, 'text' => ''),
679
+					array('id' => 1, 'text' => ''),
680
+					array('id' => 2, 'text' => ''),
681
+					array('id' => 3, 'text' => '')
682
+				)
683
+			),
684
+			'CNT_cur_dec_mrk' => array(
685
+				'type'             => 'RADIO_BTN',
686
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
687
+				'class'            => '',
688
+				'options'          => array(
689
+					array(
690
+						'id'   => ',',
691
+						'text' => __(', (comma)', 'event_espresso')
692
+					),
693
+					array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))
694
+				),
695
+				'use_desc_4_label' => true
696
+			),
697
+			'CNT_cur_thsnds'  => array(
698
+				'type'             => 'RADIO_BTN',
699
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
700
+				'class'            => '',
701
+				'options'          => array(
702
+					array(
703
+						'id'   => ',',
704
+						'text' => __(', (comma)', 'event_espresso')
705
+					),
706
+					array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))
707
+				),
708
+				'use_desc_4_label' => true
709
+			),
710
+			'CNT_tel_code'    => array(
711
+				'type'       => 'TEXT',
712
+				'input_name' => 'cntry[' . $CNT_ISO . ']',
713
+				'class'      => 'small-text'
714
+			),
715
+			'CNT_is_EU'       => array(
716
+				'type'             => 'RADIO_BTN',
717
+				'input_name'       => 'cntry[' . $CNT_ISO . ']',
718
+				'class'            => '',
719
+				'options'          => $this->_yes_no_values,
720
+				'use_desc_4_label' => true
721
+			)
722
+		);
723
+		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country,
724
+			$country_input_types);
725
+		$country_details_settings       = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php',
726
+			$this->_template_args, true);
727
+
728
+		if (defined('DOING_AJAX')) {
729
+			$notices = EE_Error::get_notices(false, false, false);
730
+			echo wp_json_encode(array(
731
+				'return_data' => $country_details_settings,
732
+				'success'     => $notices['success'],
733
+				'errors'      => $notices['errors']
734
+			));
735
+			die();
736
+		} else {
737
+			return $country_details_settings;
738
+		}
739
+
740
+	}
741
+
742
+
743
+	/**
744
+	 *        display_country_states
745
+	 *
746
+	 * @access    public
747
+	 *
748
+	 * @param    string $CNT_ISO
749
+	 *
750
+	 * @return        string
751
+	 */
752
+	public function display_country_states($CNT_ISO = '')
753
+	{
754
+
755
+		$CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO;
756
+
757
+		if ( ! $CNT_ISO) {
758
+			return '';
759
+		}
760
+		// for ajax
761
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
762
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
763
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2);
764
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2);
765
+		$states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO));
766 766
 
767 767
 //			echo '<h4>$CNT_ISO : ' . $CNT_ISO . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
768 768
 //			global $wpdb;
769 769
 //			echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
770 770
 //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
771
-        if ($states) {
772
-            foreach ($states as $STA_ID => $state) {
773
-                if ($state instanceof EE_State) {
774
-                    //STA_abbrev 	STA_name 	STA_active
775
-                    $state_input_types                                           = array(
776
-                        'STA_abbrev' => array(
777
-                            'type'       => 'TEXT',
778
-                            'input_name' => 'states[' . $STA_ID . ']',
779
-                            'class'      => 'mid-text'
780
-                        ),
781
-                        'STA_name'   => array(
782
-                            'type'       => 'TEXT',
783
-                            'input_name' => 'states[' . $STA_ID . ']',
784
-                            'class'      => 'regular-text'
785
-                        ),
786
-                        'STA_active' => array(
787
-                            'type'             => 'RADIO_BTN',
788
-                            'input_name'       => 'states[' . $STA_ID . ']',
789
-                            'options'          => $this->_yes_no_values,
790
-                            'use_desc_4_label' => true
791
-                        )
792
-                    );
793
-                    $this->_template_args['states'][$STA_ID]['inputs']           = EE_Question_Form_Input::generate_question_form_inputs_for_object($state,
794
-                        $state_input_types);
795
-                    $query_args                                                  = array(
796
-                        'action'     => 'delete_state',
797
-                        'STA_ID'     => $STA_ID,
798
-                        'CNT_ISO'    => $CNT_ISO,
799
-                        'STA_abbrev' => $state->abbrev()
800
-                    );
801
-                    $this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args,
802
-                        GEN_SET_ADMIN_URL);
803
-                }
804
-            }
805
-        } else {
806
-            $this->_template_args['states'] = false;
807
-        }
771
+		if ($states) {
772
+			foreach ($states as $STA_ID => $state) {
773
+				if ($state instanceof EE_State) {
774
+					//STA_abbrev 	STA_name 	STA_active
775
+					$state_input_types                                           = array(
776
+						'STA_abbrev' => array(
777
+							'type'       => 'TEXT',
778
+							'input_name' => 'states[' . $STA_ID . ']',
779
+							'class'      => 'mid-text'
780
+						),
781
+						'STA_name'   => array(
782
+							'type'       => 'TEXT',
783
+							'input_name' => 'states[' . $STA_ID . ']',
784
+							'class'      => 'regular-text'
785
+						),
786
+						'STA_active' => array(
787
+							'type'             => 'RADIO_BTN',
788
+							'input_name'       => 'states[' . $STA_ID . ']',
789
+							'options'          => $this->_yes_no_values,
790
+							'use_desc_4_label' => true
791
+						)
792
+					);
793
+					$this->_template_args['states'][$STA_ID]['inputs']           = EE_Question_Form_Input::generate_question_form_inputs_for_object($state,
794
+						$state_input_types);
795
+					$query_args                                                  = array(
796
+						'action'     => 'delete_state',
797
+						'STA_ID'     => $STA_ID,
798
+						'CNT_ISO'    => $CNT_ISO,
799
+						'STA_abbrev' => $state->abbrev()
800
+					);
801
+					$this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args,
802
+						GEN_SET_ADMIN_URL);
803
+				}
804
+			}
805
+		} else {
806
+			$this->_template_args['states'] = false;
807
+		}
808 808
 //		EEH_Debug_Tools::printr( $this->_template_args['states'], 'states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
809
-        $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'),
810
-            GEN_SET_ADMIN_URL);
811
-
812
-        $state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php',
813
-            $this->_template_args, true);
814
-
815
-        if (defined('DOING_AJAX')) {
816
-            $notices = EE_Error::get_notices(false, false, false);
817
-            echo wp_json_encode(array(
818
-                'return_data' => $state_details_settings,
819
-                'success'     => $notices['success'],
820
-                'errors'      => $notices['errors']
821
-            ));
822
-            die();
823
-        } else {
824
-            return $state_details_settings;
825
-        }
826
-
827
-    }
828
-
829
-
830
-    /**
831
-     *        add_new_state
832
-     *
833
-     * @access    public
834
-     * @return        void
835
-     */
836
-    public function add_new_state()
837
-    {
838
-
839
-        $success = true;
840
-
841
-        $CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : false;
842
-        if ( ! $CNT_ISO) {
843
-            EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.',
844
-                'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
845
-            $success = false;
846
-        }
847
-        $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : false;
848
-        if ( ! $STA_abbrev) {
849
-            EE_Error::add_error(__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'),
850
-                __FILE__, __FUNCTION__, __LINE__);
851
-            $success = false;
852
-        }
853
-        $STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) :
854
-            false;
855
-        if ( ! $STA_name) {
856
-            EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__,
857
-                __FUNCTION__, __LINE__);
858
-            $success = false;
859
-        }
860
-
861
-        if ($success) {
862
-            $cols_n_values = array(
863
-                'CNT_ISO'    => $CNT_ISO,
864
-                'STA_abbrev' => $STA_abbrev,
865
-                'STA_name'   => $STA_name,
866
-                'STA_active' => true
867
-            );
868
-            $success       = EEM_State::instance()->insert($cols_n_values);
869
-            EE_Error::add_success(__('The State was added successfully.', 'event_espresso'));
870
-        }
871
-
872
-        if (defined('DOING_AJAX')) {
873
-            $notices = EE_Error::get_notices(false, false, false);
874
-            echo wp_json_encode(array_merge($notices, array('return_data' => $CNT_ISO)));
875
-            die();
876
-        } else {
877
-            $this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings'));
878
-        }
879
-    }
880
-
881
-
882
-    /**
883
-     *        delete_state
884
-     *
885
-     * @access    public
886
-     * @return        boolean | void
887
-     */
888
-    public function delete_state()
889
-    {
890
-        $CNT_ISO    = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : false;
891
-        $STA_ID     = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : false;
892
-        $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : false;
893
-        if ( ! $STA_ID) {
894
-            EE_Error::add_error(__('No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__,
895
-                __FUNCTION__, __LINE__);
896
-
897
-            return false;
898
-        }
899
-        $success = EEM_State::instance()->delete_by_ID($STA_ID);
900
-        if ($success !== false) {
901
-            do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID,
902
-                array('STA_abbrev' => $STA_abbrev));
903
-            EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso'));
904
-        }
905
-        if (defined('DOING_AJAX')) {
906
-            $notices                = EE_Error::get_notices(false, false);
907
-            $notices['return_data'] = true;
908
-            echo wp_json_encode($notices);
909
-            die();
910
-        } else {
911
-            $this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings'));
912
-        }
913
-    }
914
-
915
-
916
-    /**
917
-     *        _update_country_settings
918
-     *
919
-     * @access    protected
920
-     * @return        void
921
-     */
922
-    protected function _update_country_settings()
923
-    {
809
+		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'),
810
+			GEN_SET_ADMIN_URL);
811
+
812
+		$state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php',
813
+			$this->_template_args, true);
814
+
815
+		if (defined('DOING_AJAX')) {
816
+			$notices = EE_Error::get_notices(false, false, false);
817
+			echo wp_json_encode(array(
818
+				'return_data' => $state_details_settings,
819
+				'success'     => $notices['success'],
820
+				'errors'      => $notices['errors']
821
+			));
822
+			die();
823
+		} else {
824
+			return $state_details_settings;
825
+		}
826
+
827
+	}
828
+
829
+
830
+	/**
831
+	 *        add_new_state
832
+	 *
833
+	 * @access    public
834
+	 * @return        void
835
+	 */
836
+	public function add_new_state()
837
+	{
838
+
839
+		$success = true;
840
+
841
+		$CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : false;
842
+		if ( ! $CNT_ISO) {
843
+			EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.',
844
+				'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
845
+			$success = false;
846
+		}
847
+		$STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : false;
848
+		if ( ! $STA_abbrev) {
849
+			EE_Error::add_error(__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'),
850
+				__FILE__, __FUNCTION__, __LINE__);
851
+			$success = false;
852
+		}
853
+		$STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) :
854
+			false;
855
+		if ( ! $STA_name) {
856
+			EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__,
857
+				__FUNCTION__, __LINE__);
858
+			$success = false;
859
+		}
860
+
861
+		if ($success) {
862
+			$cols_n_values = array(
863
+				'CNT_ISO'    => $CNT_ISO,
864
+				'STA_abbrev' => $STA_abbrev,
865
+				'STA_name'   => $STA_name,
866
+				'STA_active' => true
867
+			);
868
+			$success       = EEM_State::instance()->insert($cols_n_values);
869
+			EE_Error::add_success(__('The State was added successfully.', 'event_espresso'));
870
+		}
871
+
872
+		if (defined('DOING_AJAX')) {
873
+			$notices = EE_Error::get_notices(false, false, false);
874
+			echo wp_json_encode(array_merge($notices, array('return_data' => $CNT_ISO)));
875
+			die();
876
+		} else {
877
+			$this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings'));
878
+		}
879
+	}
880
+
881
+
882
+	/**
883
+	 *        delete_state
884
+	 *
885
+	 * @access    public
886
+	 * @return        boolean | void
887
+	 */
888
+	public function delete_state()
889
+	{
890
+		$CNT_ISO    = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : false;
891
+		$STA_ID     = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : false;
892
+		$STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : false;
893
+		if ( ! $STA_ID) {
894
+			EE_Error::add_error(__('No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__,
895
+				__FUNCTION__, __LINE__);
896
+
897
+			return false;
898
+		}
899
+		$success = EEM_State::instance()->delete_by_ID($STA_ID);
900
+		if ($success !== false) {
901
+			do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID,
902
+				array('STA_abbrev' => $STA_abbrev));
903
+			EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso'));
904
+		}
905
+		if (defined('DOING_AJAX')) {
906
+			$notices                = EE_Error::get_notices(false, false);
907
+			$notices['return_data'] = true;
908
+			echo wp_json_encode($notices);
909
+			die();
910
+		} else {
911
+			$this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings'));
912
+		}
913
+	}
914
+
915
+
916
+	/**
917
+	 *        _update_country_settings
918
+	 *
919
+	 * @access    protected
920
+	 * @return        void
921
+	 */
922
+	protected function _update_country_settings()
923
+	{
924 924
 //		EEH_Debug_Tools::printr( $this->_req_data, '$this->_req_data  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
925
-        // grab the country ISO code
926
-        $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : false;
927
-        if ( ! $CNT_ISO) {
928
-            EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.',
929
-                'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
930
-
931
-            return;
932
-        }
933
-        $cols_n_values                    = array();
934
-        $cols_n_values['CNT_ISO3']        = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])) : false;
935
-        $cols_n_values['RGN_ID']          = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : null;
936
-        $cols_n_values['CNT_name']        = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) : null;
937
-        $cols_n_values['CNT_cur_code']    = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])) : 'USD';
938
-        $cols_n_values['CNT_cur_single']  = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) : 'dollar';
939
-        $cols_n_values['CNT_cur_plural']  = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) : 'dollars';
940
-        $cols_n_values['CNT_cur_sign']    = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) : '$';
941
-        $cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) : true;
942
-        $cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) : 2;
943
-        $cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) : '.';
944
-        $cols_n_values['CNT_cur_thsnds']  = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) : ',';
945
-        $cols_n_values['CNT_tel_code']    = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) : null;
946
-        $cols_n_values['CNT_is_EU']       = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) : false;
947
-        $cols_n_values['CNT_active']      = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : false;
948
-        // allow filtering of country data
949
-        $cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values',
950
-            $cols_n_values);
951
-        //EEH_Debug_Tools::printr( $cols_n_values, '$cols_n_values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
952
-        // where values
953
-        $where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO));
954
-        // run the update
955
-        $success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values);
925
+		// grab the country ISO code
926
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : false;
927
+		if ( ! $CNT_ISO) {
928
+			EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.',
929
+				'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
930
+
931
+			return;
932
+		}
933
+		$cols_n_values                    = array();
934
+		$cols_n_values['CNT_ISO3']        = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])) : false;
935
+		$cols_n_values['RGN_ID']          = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : null;
936
+		$cols_n_values['CNT_name']        = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) : null;
937
+		$cols_n_values['CNT_cur_code']    = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])) : 'USD';
938
+		$cols_n_values['CNT_cur_single']  = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) : 'dollar';
939
+		$cols_n_values['CNT_cur_plural']  = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) : 'dollars';
940
+		$cols_n_values['CNT_cur_sign']    = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) : '$';
941
+		$cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) : true;
942
+		$cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) : 2;
943
+		$cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) : '.';
944
+		$cols_n_values['CNT_cur_thsnds']  = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) : ',';
945
+		$cols_n_values['CNT_tel_code']    = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) : null;
946
+		$cols_n_values['CNT_is_EU']       = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) : false;
947
+		$cols_n_values['CNT_active']      = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : false;
948
+		// allow filtering of country data
949
+		$cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values',
950
+			$cols_n_values);
951
+		//EEH_Debug_Tools::printr( $cols_n_values, '$cols_n_values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
952
+		// where values
953
+		$where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO));
954
+		// run the update
955
+		$success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values);
956 956
 //		global $wpdb;
957 957
 //		echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
958 958
 //		echo '<h4>$success : ' . $success . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
959
-        if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== false) {
960
-            // allow filtering of states data
961
-            $states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states',
962
-                $this->_req_data['states']);
959
+		if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== false) {
960
+			// allow filtering of states data
961
+			$states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states',
962
+				$this->_req_data['states']);
963 963
 //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
964
-            // loop thru state data ( looks like : states[75][STA_name] )
965
-            foreach ($states as $STA_ID => $state) {
966
-                $cols_n_values = array(
967
-                    'CNT_ISO'    => $CNT_ISO,
968
-                    'STA_abbrev' => sanitize_text_field($state['STA_abbrev']),
969
-                    'STA_name'   => sanitize_text_field($state['STA_name']),
970
-                    'STA_active' => (bool)absint($state['STA_active'])
971
-                );
972
-                // where values
973
-                $where_cols_n_values = array(array('STA_ID' => $STA_ID));
974
-                // run the update
975
-                $success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values);
976
-                if ($success !== false) {
977
-                    do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO,
978
-                        $STA_ID, $cols_n_values);
979
-                }
980
-            }
981
-        }
982
-        // check if country being edited matches org option country, and if so, then  update EE_Config with new settings
983
-        if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) {
984
-            EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO);
985
-            EE_Registry::instance()->CFG->update_espresso_config();
986
-        }
987
-        $this->_redirect_after_action($success, 'Countries', 'updated',
988
-            array('action' => 'country_settings', 'country' => $CNT_ISO));
989
-    }
990
-
991
-
992
-    /**
993
-     *        form_form_field_label_wrap
994
-     *
995
-     * @access        public
996
-     *
997
-     * @param        string $label
998
-     *
999
-     * @return        string
1000
-     */
1001
-    public function country_form_field_label_wrap($label, $required_text)
1002
-    {
1003
-        return '
964
+			// loop thru state data ( looks like : states[75][STA_name] )
965
+			foreach ($states as $STA_ID => $state) {
966
+				$cols_n_values = array(
967
+					'CNT_ISO'    => $CNT_ISO,
968
+					'STA_abbrev' => sanitize_text_field($state['STA_abbrev']),
969
+					'STA_name'   => sanitize_text_field($state['STA_name']),
970
+					'STA_active' => (bool)absint($state['STA_active'])
971
+				);
972
+				// where values
973
+				$where_cols_n_values = array(array('STA_ID' => $STA_ID));
974
+				// run the update
975
+				$success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values);
976
+				if ($success !== false) {
977
+					do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO,
978
+						$STA_ID, $cols_n_values);
979
+				}
980
+			}
981
+		}
982
+		// check if country being edited matches org option country, and if so, then  update EE_Config with new settings
983
+		if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) {
984
+			EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO);
985
+			EE_Registry::instance()->CFG->update_espresso_config();
986
+		}
987
+		$this->_redirect_after_action($success, 'Countries', 'updated',
988
+			array('action' => 'country_settings', 'country' => $CNT_ISO));
989
+	}
990
+
991
+
992
+	/**
993
+	 *        form_form_field_label_wrap
994
+	 *
995
+	 * @access        public
996
+	 *
997
+	 * @param        string $label
998
+	 *
999
+	 * @return        string
1000
+	 */
1001
+	public function country_form_field_label_wrap($label, $required_text)
1002
+	{
1003
+		return '
1004 1004
 			<tr>
1005 1005
 				<th>
1006 1006
 					' . $label . '
1007 1007
 				</th>';
1008
-    }
1009
-
1010
-
1011
-    /**
1012
-     *        form_form_field_input__wrap
1013
-     *
1014
-     * @access        public
1015
-     *
1016
-     * @param        string $label
1017
-     *
1018
-     * @return        string
1019
-     */
1020
-    public function country_form_field_input__wrap($input, $label)
1021
-    {
1022
-        return '
1008
+	}
1009
+
1010
+
1011
+	/**
1012
+	 *        form_form_field_input__wrap
1013
+	 *
1014
+	 * @access        public
1015
+	 *
1016
+	 * @param        string $label
1017
+	 *
1018
+	 * @return        string
1019
+	 */
1020
+	public function country_form_field_input__wrap($input, $label)
1021
+	{
1022
+		return '
1023 1023
 				<td class="general-settings-country-input-td">
1024 1024
 					' . $input . '
1025 1025
 				</td>
1026 1026
 			</tr>';
1027
-    }
1028
-
1029
-
1030
-    /**
1031
-     *        form_form_field_label_wrap
1032
-     *
1033
-     * @access        public
1034
-     *
1035
-     * @param        string $label
1036
-     * @param        string $required_text
1037
-     *
1038
-     * @return        string
1039
-     */
1040
-    public function state_form_field_label_wrap($label, $required_text)
1041
-    {
1042
-        return $required_text;
1043
-    }
1044
-
1045
-
1046
-    /**
1047
-     *        form_form_field_input__wrap
1048
-     *
1049
-     * @access        public
1050
-     *
1051
-     * @param        string $label
1052
-     *
1053
-     * @return        string
1054
-     */
1055
-    public function state_form_field_input__wrap($input, $label)
1056
-    {
1057
-        return '
1027
+	}
1028
+
1029
+
1030
+	/**
1031
+	 *        form_form_field_label_wrap
1032
+	 *
1033
+	 * @access        public
1034
+	 *
1035
+	 * @param        string $label
1036
+	 * @param        string $required_text
1037
+	 *
1038
+	 * @return        string
1039
+	 */
1040
+	public function state_form_field_label_wrap($label, $required_text)
1041
+	{
1042
+		return $required_text;
1043
+	}
1044
+
1045
+
1046
+	/**
1047
+	 *        form_form_field_input__wrap
1048
+	 *
1049
+	 * @access        public
1050
+	 *
1051
+	 * @param        string $label
1052
+	 *
1053
+	 * @return        string
1054
+	 */
1055
+	public function state_form_field_input__wrap($input, $label)
1056
+	{
1057
+		return '
1058 1058
 				<td class="general-settings-country-state-input-td">
1059 1059
 					' . $input . '
1060 1060
 				</td>';
1061 1061
 
1062
-    }
1063
-
1064
-
1065
-
1066
-
1067
-
1068
-
1069
-    /***********/
1070
-
1071
-
1072
-    /**
1073
-     * displays edit and view links for critical EE pages
1074
-     *
1075
-     * @access public
1076
-     *
1077
-     * @param int $ee_page_id
1078
-     *
1079
-     * @return string
1080
-     */
1081
-    public static function edit_view_links($ee_page_id)
1082
-    {
1083
-        $links = '<a href="' . add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'),
1084
-                admin_url('post.php')) . '" >' . __('Edit', 'event_espresso') . '</a>';
1085
-        $links .= ' &nbsp;|&nbsp; ';
1086
-        $links .= '<a href="' . get_permalink($ee_page_id) . '" >' . __('View', 'event_espresso') . '</a>';
1087
-
1088
-        return $links;
1089
-    }
1090
-
1091
-
1092
-    /**
1093
-     * displays page and shortcode status for critical EE pages
1094
-     *
1095
-     * @param WP page object $ee_page
1096
-     *
1097
-     * @return string
1098
-     */
1099
-    public static function page_and_shortcode_status($ee_page, $shortcode)
1100
-    {
1101
-
1102
-        // page status
1103
-        if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') {
1104
-            $pg_colour = 'green';
1105
-            $pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), '&nbsp;', '&nbsp;');
1106
-        } else {
1107
-            $pg_colour = 'red';
1108
-            $pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;');
1109
-        }
1110
-
1111
-        // shortcode status
1112
-        if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== false) {
1113
-            $sc_colour = 'green';
1114
-            $sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), '&nbsp;');
1115
-        } else {
1116
-            $sc_colour = 'red';
1117
-            $sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
1118
-        }
1119
-
1120
-        return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
1121
-
1122
-    }
1123
-
1124
-
1125
-    /**
1126
-     * generates a dropdown of all parent pages - copied from WP core
1127
-     *
1128
-     * @param unknown_type $default
1129
-     * @param unknown_type $parent
1130
-     * @param unknown_type $level
1131
-     *
1132
-     * @return unknown
1133
-     */
1134
-    public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0)
1135
-    {
1136
-        global $wpdb;
1137
-        $items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order",
1138
-            $parent));
1139
-
1140
-        if ($items) {
1141
-            foreach ($items as $item) {
1142
-                $pad = str_repeat('&nbsp;', $level * 3);
1143
-                if ($item->ID == $default) {
1144
-                    $current = ' selected="selected"';
1145
-                } else {
1146
-                    $current = '';
1147
-                }
1148
-
1149
-                echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>";
1150
-                parent_dropdown($default, $item->ID, $level + 1);
1151
-            }
1152
-        } else {
1153
-            return false;
1154
-        }
1155
-    }
1062
+	}
1063
+
1064
+
1065
+
1066
+
1067
+
1068
+
1069
+	/***********/
1070
+
1071
+
1072
+	/**
1073
+	 * displays edit and view links for critical EE pages
1074
+	 *
1075
+	 * @access public
1076
+	 *
1077
+	 * @param int $ee_page_id
1078
+	 *
1079
+	 * @return string
1080
+	 */
1081
+	public static function edit_view_links($ee_page_id)
1082
+	{
1083
+		$links = '<a href="' . add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'),
1084
+				admin_url('post.php')) . '" >' . __('Edit', 'event_espresso') . '</a>';
1085
+		$links .= ' &nbsp;|&nbsp; ';
1086
+		$links .= '<a href="' . get_permalink($ee_page_id) . '" >' . __('View', 'event_espresso') . '</a>';
1087
+
1088
+		return $links;
1089
+	}
1090
+
1091
+
1092
+	/**
1093
+	 * displays page and shortcode status for critical EE pages
1094
+	 *
1095
+	 * @param WP page object $ee_page
1096
+	 *
1097
+	 * @return string
1098
+	 */
1099
+	public static function page_and_shortcode_status($ee_page, $shortcode)
1100
+	{
1101
+
1102
+		// page status
1103
+		if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') {
1104
+			$pg_colour = 'green';
1105
+			$pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), '&nbsp;', '&nbsp;');
1106
+		} else {
1107
+			$pg_colour = 'red';
1108
+			$pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;');
1109
+		}
1110
+
1111
+		// shortcode status
1112
+		if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== false) {
1113
+			$sc_colour = 'green';
1114
+			$sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), '&nbsp;');
1115
+		} else {
1116
+			$sc_colour = 'red';
1117
+			$sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
1118
+		}
1119
+
1120
+		return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
1121
+
1122
+	}
1123
+
1124
+
1125
+	/**
1126
+	 * generates a dropdown of all parent pages - copied from WP core
1127
+	 *
1128
+	 * @param unknown_type $default
1129
+	 * @param unknown_type $parent
1130
+	 * @param unknown_type $level
1131
+	 *
1132
+	 * @return unknown
1133
+	 */
1134
+	public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0)
1135
+	{
1136
+		global $wpdb;
1137
+		$items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order",
1138
+			$parent));
1139
+
1140
+		if ($items) {
1141
+			foreach ($items as $item) {
1142
+				$pad = str_repeat('&nbsp;', $level * 3);
1143
+				if ($item->ID == $default) {
1144
+					$current = ' selected="selected"';
1145
+				} else {
1146
+					$current = '';
1147
+				}
1148
+
1149
+				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>";
1150
+				parent_dropdown($default, $item->ID, $level + 1);
1151
+			}
1152
+		} else {
1153
+			return false;
1154
+		}
1155
+	}
1156 1156
 
1157 1157
 
1158 1158
 } //ends Forms_Admin_Page class
Please login to merge, or discard this patch.
help_tours/Registration_Form_Question_Groups_Help_Tour.class.php 2 patches
Indentation   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
-    exit('NO direct script access allowed');
3
+	exit('NO direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -18,130 +18,130 @@  discard block
 block discarded – undo
18 18
 class Registration_Form_Question_Groups_Help_Tour extends EE_Help_Tour
19 19
 {
20 20
     
21
-    protected function _set_tour_properties()
22
-    {
23
-        $this->_label = __('Question Groups Tour', 'event_espresso');
24
-        $this->_slug  = $this->_is_caf ? 'question-groups-caf-overview-joyride' : 'question-groups-overview-joyride';
25
-    }
21
+	protected function _set_tour_properties()
22
+	{
23
+		$this->_label = __('Question Groups Tour', 'event_espresso');
24
+		$this->_slug  = $this->_is_caf ? 'question-groups-caf-overview-joyride' : 'question-groups-overview-joyride';
25
+	}
26 26
     
27 27
     
28
-    protected function _set_tour_stops()
29
-    {
30
-        $this->_stops = array(
31
-            10 => array(
32
-                'content' => $this->_start(),
33
-            )
34
-        );
28
+	protected function _set_tour_stops()
29
+	{
30
+		$this->_stops = array(
31
+			10 => array(
32
+				'content' => $this->_start(),
33
+			)
34
+		);
35 35
         
36
-        if ($this->_is_caf) {
37
-            $this->_stops[20] = array(
38
-                'id'      => 'name',
39
-                'content' => $this->_name_stop(),
40
-                'options' => array(
41
-                    'tipLocation'    => 'top',
42
-                    'tipAdjustmentY' => -30,
43
-                    'tipAdjustmentX' => 25
44
-                )
45
-            );
46
-            $this->_stops[30] = array(
47
-                'id'      => 'description',
48
-                'content' => $this->_description_stop(),
49
-                'options' => array(
50
-                    'tipLocation'    => 'top',
51
-                    'tipAdjustmentY' => -30,
52
-                    'tipAdjustmentX' => 20
53
-                )
54
-            );
55
-            $this->_stops[40] = array(
56
-                'id'      => 'show_group_name',
57
-                'content' => $this->_show_group_name_stop(),
58
-                'options' => array(
59
-                    'tipLocation'    => 'top',
60
-                    'tipAdjustmentY' => -30,
61
-                    'tipAdjustmentX' => 20
62
-                )
63
-            );
64
-            $this->_stops[50] = array(
65
-                'id'      => 'show_group_desc',
66
-                'content' => $this->_show_group_description_stop(),
67
-                'options' => array(
68
-                    'tipLocation'    => 'top',
69
-                    'tipAdjustmentY' => -30,
70
-                    'tipAdjustmentX' => 20
71
-                )
72
-            );
73
-            $this->_stops[60] = array(
74
-                'class'   => 'bulkactions',
75
-                'content' => $this->_bulk_actions_stop(),
76
-                'options' => array(
77
-                    'tipLocation'    => 'left',
78
-                    'tipAdjustmentY' => -50,
79
-                    'tipAdjustmentX' => -80
80
-                )
81
-            );
82
-            $this->_stops[70] = array(
83
-                'id'      => 'add-new-question-group',
84
-                'content' => $this->_add_new_question_group_stop(),
85
-                'options' => array(
86
-                    'tipLocation'    => 'right',
87
-                    'tipAdjustmentY' => -50,
88
-                    'tipAdjustmentX' => 15
89
-                )
90
-            );
91
-        }
92
-    }
36
+		if ($this->_is_caf) {
37
+			$this->_stops[20] = array(
38
+				'id'      => 'name',
39
+				'content' => $this->_name_stop(),
40
+				'options' => array(
41
+					'tipLocation'    => 'top',
42
+					'tipAdjustmentY' => -30,
43
+					'tipAdjustmentX' => 25
44
+				)
45
+			);
46
+			$this->_stops[30] = array(
47
+				'id'      => 'description',
48
+				'content' => $this->_description_stop(),
49
+				'options' => array(
50
+					'tipLocation'    => 'top',
51
+					'tipAdjustmentY' => -30,
52
+					'tipAdjustmentX' => 20
53
+				)
54
+			);
55
+			$this->_stops[40] = array(
56
+				'id'      => 'show_group_name',
57
+				'content' => $this->_show_group_name_stop(),
58
+				'options' => array(
59
+					'tipLocation'    => 'top',
60
+					'tipAdjustmentY' => -30,
61
+					'tipAdjustmentX' => 20
62
+				)
63
+			);
64
+			$this->_stops[50] = array(
65
+				'id'      => 'show_group_desc',
66
+				'content' => $this->_show_group_description_stop(),
67
+				'options' => array(
68
+					'tipLocation'    => 'top',
69
+					'tipAdjustmentY' => -30,
70
+					'tipAdjustmentX' => 20
71
+				)
72
+			);
73
+			$this->_stops[60] = array(
74
+				'class'   => 'bulkactions',
75
+				'content' => $this->_bulk_actions_stop(),
76
+				'options' => array(
77
+					'tipLocation'    => 'left',
78
+					'tipAdjustmentY' => -50,
79
+					'tipAdjustmentX' => -80
80
+				)
81
+			);
82
+			$this->_stops[70] = array(
83
+				'id'      => 'add-new-question-group',
84
+				'content' => $this->_add_new_question_group_stop(),
85
+				'options' => array(
86
+					'tipLocation'    => 'right',
87
+					'tipAdjustmentY' => -50,
88
+					'tipAdjustmentX' => 15
89
+				)
90
+			);
91
+		}
92
+	}
93 93
     
94 94
     
95
-    protected function _start()
96
-    {
97
-        $content = '<h3>' . __('Question Groups', 'event_espresso') . '</h3>';
98
-        if ($this->_is_caf) {
99
-            $content .= '<p>' . __('This tour of the Question Groups page will go over different areas of the screen to help you understand what they are used for.',
100
-                    'event_espresso') . '</p>';
101
-        } else {
102
-            $content .= '<p>' . __('Sorry, Event Espresso Decaf does not have this feature. Please purchase a support license to get access to this feature.',
103
-                    'event_espresso') . '</p>';
104
-        }
95
+	protected function _start()
96
+	{
97
+		$content = '<h3>' . __('Question Groups', 'event_espresso') . '</h3>';
98
+		if ($this->_is_caf) {
99
+			$content .= '<p>' . __('This tour of the Question Groups page will go over different areas of the screen to help you understand what they are used for.',
100
+					'event_espresso') . '</p>';
101
+		} else {
102
+			$content .= '<p>' . __('Sorry, Event Espresso Decaf does not have this feature. Please purchase a support license to get access to this feature.',
103
+					'event_espresso') . '</p>';
104
+		}
105 105
         
106
-        return $content;
107
-    }
106
+		return $content;
107
+	}
108 108
     
109
-    protected function _name_stop()
110
-    {
111
-        return '<p>' . __('View available questions groups. You can reorder your questions by dragging and dropping them.',
112
-            'event_espresso') . '</p>';
113
-    }
109
+	protected function _name_stop()
110
+	{
111
+		return '<p>' . __('View available questions groups. You can reorder your questions by dragging and dropping them.',
112
+			'event_espresso') . '</p>';
113
+	}
114 114
     
115
-    protected function _description_stop()
116
-    {
117
-        return '<p>' . __('View the question group description.', 'event_espresso') . '</p>';
118
-    }
115
+	protected function _description_stop()
116
+	{
117
+		return '<p>' . __('View the question group description.', 'event_espresso') . '</p>';
118
+	}
119 119
     
120
-    protected function _show_group_name_stop()
121
-    {
122
-        return '<p>' . __('View if the name of the question group should be shown to customers.',
123
-            'event_espresso') . '</p>';
124
-    }
120
+	protected function _show_group_name_stop()
121
+	{
122
+		return '<p>' . __('View if the name of the question group should be shown to customers.',
123
+			'event_espresso') . '</p>';
124
+	}
125 125
     
126
-    protected function _show_group_description_stop()
127
-    {
128
-        return '<p>' . __('View if the description of the question group should be shown to customers.',
129
-            'event_espresso') . '</p>';
130
-    }
126
+	protected function _show_group_description_stop()
127
+	{
128
+		return '<p>' . __('View if the description of the question group should be shown to customers.',
129
+			'event_espresso') . '</p>';
130
+	}
131 131
     
132
-    protected function _bulk_actions_stop()
133
-    {
134
-        return '<p>' . __('Perform bulk actions to multiple question groups.', 'event_espresso') . '</p>';
135
-    }
132
+	protected function _bulk_actions_stop()
133
+	{
134
+		return '<p>' . __('Perform bulk actions to multiple question groups.', 'event_espresso') . '</p>';
135
+	}
136 136
     
137
-    protected function _search_stop()
138
-    {
139
-        return '<p>' . __('Search through questions. The following sources will be searched: question group name and question group description.',
140
-            'event_espresso') . '</p>';
141
-    }
137
+	protected function _search_stop()
138
+	{
139
+		return '<p>' . __('Search through questions. The following sources will be searched: question group name and question group description.',
140
+			'event_espresso') . '</p>';
141
+	}
142 142
     
143
-    protected function _add_new_question_group_stop()
144
-    {
145
-        return '<p>' . __('Click here to create a new question group.', 'event_espresso') . '</p>';
146
-    }
143
+	protected function _add_new_question_group_stop()
144
+	{
145
+		return '<p>' . __('Click here to create a new question group.', 'event_espresso') . '</p>';
146
+	}
147 147
 }
148 148
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
     
95 95
     protected function _start()
96 96
     {
97
-        $content = '<h3>' . __('Question Groups', 'event_espresso') . '</h3>';
97
+        $content = '<h3>'.__('Question Groups', 'event_espresso').'</h3>';
98 98
         if ($this->_is_caf) {
99
-            $content .= '<p>' . __('This tour of the Question Groups page will go over different areas of the screen to help you understand what they are used for.',
100
-                    'event_espresso') . '</p>';
99
+            $content .= '<p>'.__('This tour of the Question Groups page will go over different areas of the screen to help you understand what they are used for.',
100
+                    'event_espresso').'</p>';
101 101
         } else {
102
-            $content .= '<p>' . __('Sorry, Event Espresso Decaf does not have this feature. Please purchase a support license to get access to this feature.',
103
-                    'event_espresso') . '</p>';
102
+            $content .= '<p>'.__('Sorry, Event Espresso Decaf does not have this feature. Please purchase a support license to get access to this feature.',
103
+                    'event_espresso').'</p>';
104 104
         }
105 105
         
106 106
         return $content;
@@ -108,40 +108,40 @@  discard block
 block discarded – undo
108 108
     
109 109
     protected function _name_stop()
110 110
     {
111
-        return '<p>' . __('View available questions groups. You can reorder your questions by dragging and dropping them.',
112
-            'event_espresso') . '</p>';
111
+        return '<p>'.__('View available questions groups. You can reorder your questions by dragging and dropping them.',
112
+            'event_espresso').'</p>';
113 113
     }
114 114
     
115 115
     protected function _description_stop()
116 116
     {
117
-        return '<p>' . __('View the question group description.', 'event_espresso') . '</p>';
117
+        return '<p>'.__('View the question group description.', 'event_espresso').'</p>';
118 118
     }
119 119
     
120 120
     protected function _show_group_name_stop()
121 121
     {
122
-        return '<p>' . __('View if the name of the question group should be shown to customers.',
123
-            'event_espresso') . '</p>';
122
+        return '<p>'.__('View if the name of the question group should be shown to customers.',
123
+            'event_espresso').'</p>';
124 124
     }
125 125
     
126 126
     protected function _show_group_description_stop()
127 127
     {
128
-        return '<p>' . __('View if the description of the question group should be shown to customers.',
129
-            'event_espresso') . '</p>';
128
+        return '<p>'.__('View if the description of the question group should be shown to customers.',
129
+            'event_espresso').'</p>';
130 130
     }
131 131
     
132 132
     protected function _bulk_actions_stop()
133 133
     {
134
-        return '<p>' . __('Perform bulk actions to multiple question groups.', 'event_espresso') . '</p>';
134
+        return '<p>'.__('Perform bulk actions to multiple question groups.', 'event_espresso').'</p>';
135 135
     }
136 136
     
137 137
     protected function _search_stop()
138 138
     {
139
-        return '<p>' . __('Search through questions. The following sources will be searched: question group name and question group description.',
140
-            'event_espresso') . '</p>';
139
+        return '<p>'.__('Search through questions. The following sources will be searched: question group name and question group description.',
140
+            'event_espresso').'</p>';
141 141
     }
142 142
     
143 143
     protected function _add_new_question_group_stop()
144 144
     {
145
-        return '<p>' . __('Click here to create a new question group.', 'event_espresso') . '</p>';
145
+        return '<p>'.__('Click here to create a new question group.', 'event_espresso').'</p>';
146 146
     }
147 147
 }
148 148
\ No newline at end of file
Please login to merge, or discard this patch.
general_settings/help_tours/Your_Organization_Help_Tour.class.php 2 patches
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
-    exit('NO direct script access allowed');
3
+	exit('NO direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -18,121 +18,121 @@  discard block
 block discarded – undo
18 18
 class Your_Organization_Help_Tour extends EE_Help_Tour
19 19
 {
20 20
     
21
-    protected function _set_tour_properties()
22
-    {
23
-        $this->_label = __('Your Organization Tour', 'event_espresso');
24
-        $this->_slug  = 'your-organization-joyride';
25
-    }
21
+	protected function _set_tour_properties()
22
+	{
23
+		$this->_label = __('Your Organization Tour', 'event_espresso');
24
+		$this->_slug  = 'your-organization-joyride';
25
+	}
26 26
     
27 27
     
28
-    protected function _set_tour_stops()
29
-    {
30
-        $this->_stops = array(
31
-            10 => array(
32
-                'content' => $this->_start(),
33
-            ),
34
-            30 => array(
35
-                'id'      => 'contact_info_h4',
36
-                'content' => $this->_contact_information_stop(),
37
-                'options' => array(
38
-                    'tipLocation'    => 'left',
39
-                    'tipAdjustmentY' => -50,
40
-                    'tipAdjustmentX' => 15
41
-                )
42
-            ),
43
-            40 => array(
44
-                'id'      => 'upload_image',
45
-                'content' => $this->_upload_image_stop(),
46
-                'options' => array(
47
-                    'tipLocation'    => 'right',
48
-                    'tipAdjustmentY' => -50,
49
-                    'tipAdjustmentX' => 15
50
-                )
51
-            ),
52
-            50 => array(
53
-                'id'      => 'organization_facebook',
54
-                'content' => $this->_organization_facebook_stop(),
55
-                'options' => array(
56
-                    'tipLocation'    => 'right',
57
-                    'tipAdjustmentY' => -50,
58
-                    'tipAdjustmentX' => 15
59
-                )
60
-            ),
61
-            60 => array(
62
-                'id'      => 'ueip_optin',
63
-                'content' => $this->_ueip_option_stop(),
64
-                'options' => array(
65
-                    'tipLocation'    => 'right',
66
-                    'tipAdjustmentY' => -50,
67
-                    'tipAdjustmentX' => 15
68
-                )
69
-            ),
70
-            70 => array(
71
-                'id'      => 'espresso_major_buttons_wrapper',
72
-                'content' => $this->_end_tour_stop(),
73
-                'options' => array(
74
-                    'tipLocation'    => 'right',
75
-                    'tipAdjustmentY' => -50,
76
-                    'tipAdjustmentX' => 185
77
-                )
78
-            )
79
-        );
28
+	protected function _set_tour_stops()
29
+	{
30
+		$this->_stops = array(
31
+			10 => array(
32
+				'content' => $this->_start(),
33
+			),
34
+			30 => array(
35
+				'id'      => 'contact_info_h4',
36
+				'content' => $this->_contact_information_stop(),
37
+				'options' => array(
38
+					'tipLocation'    => 'left',
39
+					'tipAdjustmentY' => -50,
40
+					'tipAdjustmentX' => 15
41
+				)
42
+			),
43
+			40 => array(
44
+				'id'      => 'upload_image',
45
+				'content' => $this->_upload_image_stop(),
46
+				'options' => array(
47
+					'tipLocation'    => 'right',
48
+					'tipAdjustmentY' => -50,
49
+					'tipAdjustmentX' => 15
50
+				)
51
+			),
52
+			50 => array(
53
+				'id'      => 'organization_facebook',
54
+				'content' => $this->_organization_facebook_stop(),
55
+				'options' => array(
56
+					'tipLocation'    => 'right',
57
+					'tipAdjustmentY' => -50,
58
+					'tipAdjustmentX' => 15
59
+				)
60
+			),
61
+			60 => array(
62
+				'id'      => 'ueip_optin',
63
+				'content' => $this->_ueip_option_stop(),
64
+				'options' => array(
65
+					'tipLocation'    => 'right',
66
+					'tipAdjustmentY' => -50,
67
+					'tipAdjustmentX' => 15
68
+				)
69
+			),
70
+			70 => array(
71
+				'id'      => 'espresso_major_buttons_wrapper',
72
+				'content' => $this->_end_tour_stop(),
73
+				'options' => array(
74
+					'tipLocation'    => 'right',
75
+					'tipAdjustmentY' => -50,
76
+					'tipAdjustmentX' => 185
77
+				)
78
+			)
79
+		);
80 80
         
81
-        if (is_main_site()) {
82
-            $this->_stops[20] = array(
83
-                'id' => 'site_license_key',
84
-                'content' => $this->_site_license_key_stop(),
85
-                'options' => array(
86
-                    'tipLocation' => 'right',
87
-                    'tipAdjustmentY' => -50,
88
-                    'tipAdjustmentX' => 15
89
-                )
90
-            );
91
-        }
92
-        ksort( $this->_stops );
93
-    }
81
+		if (is_main_site()) {
82
+			$this->_stops[20] = array(
83
+				'id' => 'site_license_key',
84
+				'content' => $this->_site_license_key_stop(),
85
+				'options' => array(
86
+					'tipLocation' => 'right',
87
+					'tipAdjustmentY' => -50,
88
+					'tipAdjustmentX' => 15
89
+				)
90
+			);
91
+		}
92
+		ksort( $this->_stops );
93
+	}
94 94
     
95 95
     
96
-    protected function _start()
97
-    {
98
-        $content = '<h3>' . __('Organization Settings', 'event_espresso') . '</h3>';
99
-        $content .= '<p>' . __('This tour of the Your Organization page will go over different areas of the screen to help you understand what they are used for.',
100
-                'event_espresso') . '</p>';
96
+	protected function _start()
97
+	{
98
+		$content = '<h3>' . __('Organization Settings', 'event_espresso') . '</h3>';
99
+		$content .= '<p>' . __('This tour of the Your Organization page will go over different areas of the screen to help you understand what they are used for.',
100
+				'event_espresso') . '</p>';
101 101
         
102
-        return $content;
103
-    }
102
+		return $content;
103
+	}
104 104
     
105
-    protected function _site_license_key_stop()
106
-    {
107
-        return '<p>' . __('Enter your support license key here to enable one-click updates.',
108
-            'event_espresso') . '</p>';
109
-    }
105
+	protected function _site_license_key_stop()
106
+	{
107
+		return '<p>' . __('Enter your support license key here to enable one-click updates.',
108
+			'event_espresso') . '</p>';
109
+	}
110 110
     
111
-    protected function _contact_information_stop()
112
-    {
113
-        return '<p>' . __('You can change your business / organization information below. Be sure to keep this information updated as it is used in other areas of the site. Adjusting the country option here will update your currency settings. More options are available in the Countries tab.',
114
-            'event_espresso') . '</p>';
115
-    }
111
+	protected function _contact_information_stop()
112
+	{
113
+		return '<p>' . __('You can change your business / organization information below. Be sure to keep this information updated as it is used in other areas of the site. Adjusting the country option here will update your currency settings. More options are available in the Countries tab.',
114
+			'event_espresso') . '</p>';
115
+	}
116 116
     
117
-    protected function _upload_image_stop()
118
-    {
119
-        return '<p>' . __('Add a logo. This can be used for invoices and tickets.', 'event_espresso') . '</p>';
120
-    }
117
+	protected function _upload_image_stop()
118
+	{
119
+		return '<p>' . __('Add a logo. This can be used for invoices and tickets.', 'event_espresso') . '</p>';
120
+	}
121 121
     
122
-    protected function _organization_facebook_stop()
123
-    {
124
-        return '<p>' . __('Add links to various social media networks.', 'event_espresso') . '</p>';
125
-    }
122
+	protected function _organization_facebook_stop()
123
+	{
124
+		return '<p>' . __('Add links to various social media networks.', 'event_espresso') . '</p>';
125
+	}
126 126
     
127
-    protected function _ueip_option_stop()
128
-    {
129
-        return '<p>' . __('Help us to help you! Sign up to the User eXperience Improvement Program and send us anonymous data that will help us improve Event Espresso.',
130
-            'event_espresso') . '</p>';
131
-    }
127
+	protected function _ueip_option_stop()
128
+	{
129
+		return '<p>' . __('Help us to help you! Sign up to the User eXperience Improvement Program and send us anonymous data that will help us improve Event Espresso.',
130
+			'event_espresso') . '</p>';
131
+	}
132 132
     
133
-    protected function _end_tour_stop()
134
-    {
135
-        return '<p>' . __('You are almost done updating Your Organization information. Click on the Save button to save changes and then go to the Payment Methods screen so you can setup a payment gateway.',
136
-            'event_espresso') . '</p>';
137
-    }
133
+	protected function _end_tour_stop()
134
+	{
135
+		return '<p>' . __('You are almost done updating Your Organization information. Click on the Save button to save changes and then go to the Payment Methods screen so you can setup a payment gateway.',
136
+			'event_espresso') . '</p>';
137
+	}
138 138
 }
139 139
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -89,50 +89,50 @@
 block discarded – undo
89 89
                 )
90 90
             );
91 91
         }
92
-        ksort( $this->_stops );
92
+        ksort($this->_stops);
93 93
     }
94 94
     
95 95
     
96 96
     protected function _start()
97 97
     {
98
-        $content = '<h3>' . __('Organization Settings', 'event_espresso') . '</h3>';
99
-        $content .= '<p>' . __('This tour of the Your Organization page will go over different areas of the screen to help you understand what they are used for.',
100
-                'event_espresso') . '</p>';
98
+        $content = '<h3>'.__('Organization Settings', 'event_espresso').'</h3>';
99
+        $content .= '<p>'.__('This tour of the Your Organization page will go over different areas of the screen to help you understand what they are used for.',
100
+                'event_espresso').'</p>';
101 101
         
102 102
         return $content;
103 103
     }
104 104
     
105 105
     protected function _site_license_key_stop()
106 106
     {
107
-        return '<p>' . __('Enter your support license key here to enable one-click updates.',
108
-            'event_espresso') . '</p>';
107
+        return '<p>'.__('Enter your support license key here to enable one-click updates.',
108
+            'event_espresso').'</p>';
109 109
     }
110 110
     
111 111
     protected function _contact_information_stop()
112 112
     {
113
-        return '<p>' . __('You can change your business / organization information below. Be sure to keep this information updated as it is used in other areas of the site. Adjusting the country option here will update your currency settings. More options are available in the Countries tab.',
114
-            'event_espresso') . '</p>';
113
+        return '<p>'.__('You can change your business / organization information below. Be sure to keep this information updated as it is used in other areas of the site. Adjusting the country option here will update your currency settings. More options are available in the Countries tab.',
114
+            'event_espresso').'</p>';
115 115
     }
116 116
     
117 117
     protected function _upload_image_stop()
118 118
     {
119
-        return '<p>' . __('Add a logo. This can be used for invoices and tickets.', 'event_espresso') . '</p>';
119
+        return '<p>'.__('Add a logo. This can be used for invoices and tickets.', 'event_espresso').'</p>';
120 120
     }
121 121
     
122 122
     protected function _organization_facebook_stop()
123 123
     {
124
-        return '<p>' . __('Add links to various social media networks.', 'event_espresso') . '</p>';
124
+        return '<p>'.__('Add links to various social media networks.', 'event_espresso').'</p>';
125 125
     }
126 126
     
127 127
     protected function _ueip_option_stop()
128 128
     {
129
-        return '<p>' . __('Help us to help you! Sign up to the User eXperience Improvement Program and send us anonymous data that will help us improve Event Espresso.',
130
-            'event_espresso') . '</p>';
129
+        return '<p>'.__('Help us to help you! Sign up to the User eXperience Improvement Program and send us anonymous data that will help us improve Event Espresso.',
130
+            'event_espresso').'</p>';
131 131
     }
132 132
     
133 133
     protected function _end_tour_stop()
134 134
     {
135
-        return '<p>' . __('You are almost done updating Your Organization information. Click on the Save button to save changes and then go to the Payment Methods screen so you can setup a payment gateway.',
136
-            'event_espresso') . '</p>';
135
+        return '<p>'.__('You are almost done updating Your Organization information. Click on the Save button to save changes and then go to the Payment Methods screen so you can setup a payment gateway.',
136
+            'event_espresso').'</p>';
137 137
     }
138 138
 }
139 139
\ No newline at end of file
Please login to merge, or discard this patch.
admin_pages/maintenance/templates/migration_options_from_ee3.template.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         <span class="dashicons dashicons-admin-tools"></span>
27 27
         <?php esc_html_e("Migration Options", "event_espresso"); ?>
28 28
         <span class="tiny-text lt-grey-text"> &nbsp; <?php esc_html_e(' to migrate or not to migrate?',
29
-                    "event_espresso"); ?></span>
29
+					"event_espresso"); ?></span>
30 30
     </h2>
31 31
     <div class="ee-table-wrap">
32 32
         <table>
@@ -35,24 +35,24 @@  discard block
 block discarded – undo
35 35
                 <td><h3><?php esc_html_e('1', 'event_espresso'); ?></h3></td>
36 36
                 <td>
37 37
                     <?php
38
-                    echo apply_filters(
39
-                            'FHEE__ee_migration_page__option_1_main',
40
-                            sprintf(
41
-                                    esc_html__('%1$sYes. I have backed up my database%2$s, %3$sunderstand the risks involved%4$s, and am ready to migrate my existing %5$s data to %6$s.',
42
-                                            "event_espresso"),
43
-                                    '<strong>',
44
-                                    '</strong>',
45
-                                    '<a id="migration-risks" class="" title="'
46
-                                    . esc_attr__('click for more details', "event_espresso")
47
-                                    . '">',
48
-                                    '</a>',
49
-                                    $current_db_state,
50
-                                    $next_db_state
51
-                            ),
52
-                            $current_db_state,
53
-                            $next_db_state
54
-                    );
55
-                    ?>
38
+					echo apply_filters(
39
+							'FHEE__ee_migration_page__option_1_main',
40
+							sprintf(
41
+									esc_html__('%1$sYes. I have backed up my database%2$s, %3$sunderstand the risks involved%4$s, and am ready to migrate my existing %5$s data to %6$s.',
42
+											"event_espresso"),
43
+									'<strong>',
44
+									'</strong>',
45
+									'<a id="migration-risks" class="" title="'
46
+									. esc_attr__('click for more details', "event_espresso")
47
+									. '">',
48
+									'</a>',
49
+									$current_db_state,
50
+									$next_db_state
51
+							),
52
+							$current_db_state,
53
+							$next_db_state
54
+					);
55
+					?>
56 56
                     <a id="display-migration-details"
57 57
                        class="display-the-hidden lt-grey-text smaller-text hide-if-no-js"
58 58
                        rel="migration-details"><?php esc_html_e('click for more details', "event_espresso"); ?>
@@ -61,37 +61,37 @@  discard block
 block discarded – undo
61 61
                        class="hide-the-displayed lt-grey-text smaller-text hide-if-no-js"
62 62
                        rel="migration-details"
63 63
                        style="display:none;"><?php echo sprintf(esc_html__('hide%1$sdetails%1$s-',
64
-                                'event_espresso'), '&nbsp;'); ?></a>
64
+								'event_espresso'), '&nbsp;'); ?></a>
65 65
                 </td>
66 66
                 <td>
67 67
                     <a id="db-backed-up"
68 68
                        class="toggle-migration-monitor button-primary"><?php echo apply_filters('FHEE__ee_migration_page__option_1_button_text',
69
-                                sprintf(esc_html__("Migrate My %s Data to %s", "event_espresso"), $current_db_state,
70
-                                        $next_db_state), $current_db_state, $next_db_state); ?></a>
69
+								sprintf(esc_html__("Migrate My %s Data to %s", "event_espresso"), $current_db_state,
70
+										$next_db_state), $current_db_state, $next_db_state); ?></a>
71 71
                 </td>
72 72
             </tr>
73 73
             <tr>
74 74
                 <td colspan="3" style="padding: 0">
75 75
                     <div id="migration-details-dv" style="display: none; padding: 1em;">
76 76
 <span class="reminder-spn"><?php printf(esc_html__("%s Important: %s Before migrating, please back up your database and files.",
77
-            "event_espresso"), "<b>", "</b>"); ?></span>
77
+			"event_espresso"), "<b>", "</b>"); ?></span>
78 78
                         <p>
79 79
                             <?php
80
-                            printf(
81
-                                    esc_html__('%1$sNot sure how to backup your existing data?%2$s Here is %3$sWordPress\'s explanation%7$s, and here\'s %6$sour explanation%7$s.%8$sYou can also search the WordPress plugin database for %4$s database backup plugins %7$s,%8$sor have one of our dedicated support technicians help you by purchasing a %5$sPriority Support Token%7$s.',
82
-                                            "event_espresso"),
83
-                                    '<b>',
84
-                                    '</b>',
85
-                                    "<a href='http://codex.wordpress.org/Backing_Up_Your_Database'>",
86
-                                    "<a href='"
87
-                                    . admin_url('plugin-install.php?tab=search&type=term&s=database+backup&plugin-search-input=Search+Plugins')
88
-                                    . "'>",
89
-                                    "<a href='http://eventespresso.com/product/priority-support-tokens/'>",
90
-                                    '<a href="http://eventespresso.com/wiki/how-to-back-up-your-site/">',
91
-                                    "</a>",
92
-                                    '<br/>'
93
-                            );
94
-                            ?>
80
+							printf(
81
+									esc_html__('%1$sNot sure how to backup your existing data?%2$s Here is %3$sWordPress\'s explanation%7$s, and here\'s %6$sour explanation%7$s.%8$sYou can also search the WordPress plugin database for %4$s database backup plugins %7$s,%8$sor have one of our dedicated support technicians help you by purchasing a %5$sPriority Support Token%7$s.',
82
+											"event_espresso"),
83
+									'<b>',
84
+									'</b>',
85
+									"<a href='http://codex.wordpress.org/Backing_Up_Your_Database'>",
86
+									"<a href='"
87
+									. admin_url('plugin-install.php?tab=search&type=term&s=database+backup&plugin-search-input=Search+Plugins')
88
+									. "'>",
89
+									"<a href='http://eventespresso.com/product/priority-support-tokens/'>",
90
+									'<a href="http://eventespresso.com/wiki/how-to-back-up-your-site/">',
91
+									"</a>",
92
+									'<br/>'
93
+							);
94
+							?>
95 95
                         </p>
96 96
                         <?php do_action('AHEE__ee_migration_page__option_1_extra_details'); ?>
97 97
                     </div>
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
                 <td><h3><?php esc_html_e('2', 'event_espresso'); ?></h3></td>
102 102
                 <td>
103 103
                     <?php echo apply_filters('FHEE__ee_migration_page__option_2_main',
104
-                            sprintf(esc_html__('I do NOT want to migrate my %1$s data to %2$s at this time and just want to use %3$s without migrating data.',
105
-                                    "event_espresso"), $current_db_state, $next_db_state,
106
-                                    $ultimate_db_state), $current_db_state, $next_db_state,
107
-                            $ultimate_db_state); ?><br/>
104
+							sprintf(esc_html__('I do NOT want to migrate my %1$s data to %2$s at this time and just want to use %3$s without migrating data.',
105
+									"event_espresso"), $current_db_state, $next_db_state,
106
+									$ultimate_db_state), $current_db_state, $next_db_state,
107
+							$ultimate_db_state); ?><br/>
108 108
                     <span class="reminder-spn"><?php esc_html_e('Please Note: In order to avoid errors, any existing Event Espresso data (events, ticket, registrations, etc) in your db will be erased! Regular WP data will NOT be affected.',
109
-                                'event_espresso'); ?></span>
109
+								'event_espresso'); ?></span>
110 110
                     <a id="display-no-migration-details"
111 111
                        class="display-the-hidden lt-grey-text smaller-text hide-if-no-js"
112 112
                        rel="no-migration-details"><?php esc_html_e('click for more details', "event_espresso"); ?>
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
                        class="hide-the-displayed lt-grey-text smaller-text hide-if-no-js"
116 116
                        rel="no-migration-details"
117 117
                        style="display:none;"><?php echo sprintf(esc_html__('hide%1$sdetails%1$s-',
118
-                                'event_espresso'), '&nbsp;'); ?></a>
118
+								'event_espresso'), '&nbsp;'); ?></a>
119 119
                 </td>
120 120
                 <td>
121 121
                     <a id="do-not-migrate" class="do-not-migrate button-primary"
122 122
                        href="<?php echo $reset_db_page_link; ?>"><?php echo apply_filters('FHEE__ee_migration_page__option_2_button_text',
123
-                                sprintf(esc_html__("Just Start %s and Delete Existing Data", "event_espresso"),
124
-                                        $ultimate_db_state), $ultimate_db_state); ?></a>
123
+								sprintf(esc_html__("Just Start %s and Delete Existing Data", "event_espresso"),
124
+										$ultimate_db_state), $ultimate_db_state); ?></a>
125 125
                 </td>
126 126
             </tr>
127 127
             <tr>
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
                     <div id="no-migration-details-dv" style="display: none; padding: 1em;">
130 130
                         <p>
131 131
                             <?php echo apply_filters('FHEE__ee_migration_page__option_2_details',
132
-                                    sprintf(esc_html__("If your existing Event and Registration Data is no longer relevant nor required, you can just start up %s without performing a data migration.",
133
-                                            "event_espresso"), $ultimate_db_state), $ultimate_db_state); ?>
132
+									sprintf(esc_html__("If your existing Event and Registration Data is no longer relevant nor required, you can just start up %s without performing a data migration.",
133
+											"event_espresso"), $ultimate_db_state), $ultimate_db_state); ?>
134 134
                         </p>
135 135
                     </div>
136 136
                 </td>
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_2_0.dms.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 //unfortunately, this needs to be done upon INCLUSION of this file,
13 13
 //instead of construction, because it only gets constructed on first page load
14 14
 //(all other times it gets resurrected from a wordpress option)
15
-$stages = glob(EE_CORE . 'data_migration_scripts/4_2_0_stages/*');
15
+$stages = glob(EE_CORE.'data_migration_scripts/4_2_0_stages/*');
16 16
 $class_to_filepath = array();
17 17
 if ( ! empty($stages)) {
18 18
     foreach ($stages as $filepath) {
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 //			echo "no version string provided: $version_string";
62 62
             //no version string provided... this must be pre 4.1
63 63
             //because since 4.1 we're
64
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
64
+            return false; //changed mind. dont want people thinking they should migrate yet because they cant
65 65
         } else {
66 66
 //			echo "$version_string doesnt apply";
67 67
             return false;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     public function schema_changes_before_migration()
81 81
     {
82 82
         //relies on 4.1's EEH_Activation::create_table
83
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
83
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
84 84
         $table_name = 'esp_answer';
85 85
         $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
86 86
 					REG_ID INT UNSIGNED NOT NULL,
Please login to merge, or discard this patch.
Indentation   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 $stages = glob(EE_CORE . 'data_migration_scripts/4_2_0_stages/*');
16 16
 $class_to_filepath = array();
17 17
 if ( ! empty($stages)) {
18
-    foreach ($stages as $filepath) {
19
-        $matches = array();
20
-        preg_match('~4_2_0_stages/(.*).dmsstage.php~', $filepath, $matches);
21
-        $class_to_filepath[$matches[1]] = $filepath;
22
-    }
18
+	foreach ($stages as $filepath) {
19
+		$matches = array();
20
+		preg_match('~4_2_0_stages/(.*).dmsstage.php~', $filepath, $matches);
21
+		$class_to_filepath[$matches[1]] = $filepath;
22
+	}
23 23
 }
24 24
 //give addons a chance to autoload their stages too
25 25
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_2_0__autoloaded_stages', $class_to_filepath);
@@ -32,57 +32,57 @@  discard block
 block discarded – undo
32 32
 
33 33
 
34 34
 
35
-    /**
36
-     * EE_DMS_Core_4_2_0 constructor.
37
-     *
38
-     * @param TableManager  $table_manager
39
-     * @param TableAnalysis $table_analysis
40
-     */
41
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
42
-    {
43
-        $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.2.0", "event_espresso");
44
-        $this->_priority = 10;
45
-        $this->_migration_stages = array(
46
-            new EE_DMS_4_2_0_question_group_questions(),
47
-            new EE_DMS_4_2_0_datetime_fields(),
48
-        );
49
-        parent::__construct($table_manager, $table_analysis);
50
-    }
35
+	/**
36
+	 * EE_DMS_Core_4_2_0 constructor.
37
+	 *
38
+	 * @param TableManager  $table_manager
39
+	 * @param TableAnalysis $table_analysis
40
+	 */
41
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
42
+	{
43
+		$this->_pretty_name = esc_html__("Data Update to Event Espresso 4.2.0", "event_espresso");
44
+		$this->_priority = 10;
45
+		$this->_migration_stages = array(
46
+			new EE_DMS_4_2_0_question_group_questions(),
47
+			new EE_DMS_4_2_0_datetime_fields(),
48
+		);
49
+		parent::__construct($table_manager, $table_analysis);
50
+	}
51 51
 
52 52
 
53 53
 
54
-    public function can_migrate_from_version($version_array)
55
-    {
56
-        $version_string = $version_array['Core'];
57
-        if (version_compare($version_string, '4.2.0', '<=') && version_compare($version_string, '4.1.0', '>=')) {
54
+	public function can_migrate_from_version($version_array)
55
+	{
56
+		$version_string = $version_array['Core'];
57
+		if (version_compare($version_string, '4.2.0', '<=') && version_compare($version_string, '4.1.0', '>=')) {
58 58
 //			echo "$version_string can be migrated fro";
59
-            return true;
60
-        } elseif ( ! $version_string) {
59
+			return true;
60
+		} elseif ( ! $version_string) {
61 61
 //			echo "no version string provided: $version_string";
62
-            //no version string provided... this must be pre 4.1
63
-            //because since 4.1 we're
64
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
65
-        } else {
62
+			//no version string provided... this must be pre 4.1
63
+			//because since 4.1 we're
64
+			return false;//changed mind. dont want people thinking they should migrate yet because they cant
65
+		} else {
66 66
 //			echo "$version_string doesnt apply";
67
-            return false;
68
-        }
69
-    }
67
+			return false;
68
+		}
69
+	}
70 70
 
71 71
 
72 72
 
73
-    public function schema_changes_before_migration()
74
-    {
75
-        //relies on 4.1's EEH_Activation::create_table
76
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
77
-        $table_name = 'esp_answer';
78
-        $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
73
+	public function schema_changes_before_migration()
74
+	{
75
+		//relies on 4.1's EEH_Activation::create_table
76
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
77
+		$table_name = 'esp_answer';
78
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
79 79
 					REG_ID INT UNSIGNED NOT NULL,
80 80
 					QST_ID INT UNSIGNED NOT NULL,
81 81
 					ANS_value TEXT NOT NULL,
82 82
 					PRIMARY KEY  (ANS_ID)";
83
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
84
-        $table_name = 'esp_attendee_meta';
85
-        $sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
83
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
84
+		$table_name = 'esp_attendee_meta';
85
+		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
86 86
 						ATT_ID BIGINT(20) UNSIGNED NOT NULL,
87 87
 						ATT_fname VARCHAR(45) NOT NULL,
88 88
 						ATT_lname VARCHAR(45) NOT	NULL,
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 								KEY ATT_fname (ATT_fname),
99 99
 								KEY ATT_lname (ATT_lname),
100 100
 								KEY ATT_email (ATT_email)";
101
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
102
-        $table_name = 'esp_country';
103
-        $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
101
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
102
+		$table_name = 'esp_country';
103
+		$sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
104 104
 					  CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL,
105 105
 					  RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL,
106 106
 					  CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL,
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
117 117
 					  CNT_active TINYINT(1) DEFAULT '0',
118 118
 					  PRIMARY KEY  (CNT_ISO)";
119
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
120
-        $table_name = 'esp_datetime';
121
-        $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
119
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
120
+		$table_name = 'esp_datetime';
121
+		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
122 122
 				  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
123 123
 				  DTT_name VARCHAR(255) NOT NULL DEFAULT '',
124 124
 				  DTT_description TEXT NOT NULL,
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
 						PRIMARY KEY  (DTT_ID),
134 134
 						KEY EVT_ID (EVT_ID),
135 135
 						KEY DTT_is_primary (DTT_is_primary)";
136
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
137
-        $table_name = 'esp_event_meta';
138
-        $sql = "
136
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
137
+		$table_name = 'esp_event_meta';
138
+		$sql = "
139 139
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
140 140
 			EVT_ID BIGINT(20) UNSIGNED NOT NULL,
141 141
 			EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -150,31 +150,31 @@  discard block
 block discarded – undo
150 150
 			EVT_external_URL VARCHAR(200) NULL,
151 151
 			EVT_donations TINYINT(1) NULL,
152 152
 			PRIMARY KEY  (EVTM_ID)";
153
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
154
-        $table_name = 'esp_event_question_group';
155
-        $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
153
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
154
+		$table_name = 'esp_event_question_group';
155
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
156 156
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
157 157
 					QSG_ID INT UNSIGNED NOT NULL,
158 158
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
159 159
 					PRIMARY KEY  (EQG_ID)";
160
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
161
-        $table_name = 'esp_event_venue';
162
-        $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
160
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
161
+		$table_name = 'esp_event_venue';
162
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
163 163
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
164 164
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
165 165
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
166 166
 				PRIMARY KEY  (EVV_ID)";
167
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
168
-        $table_name = 'esp_extra_meta';
169
-        $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
167
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
168
+		$table_name = 'esp_extra_meta';
169
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
170 170
 				OBJ_ID INT(11) DEFAULT NULL,
171 171
 				EXM_type VARCHAR(45) DEFAULT NULL,
172 172
 				EXM_key VARCHAR(45) DEFAULT NULL,
173 173
 				EXM_value TEXT,
174 174
 				PRIMARY KEY  (EXM_ID)";
175
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
176
-        $table_name = 'esp_line_item';
177
-        $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
175
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
176
+		$table_name = 'esp_line_item';
177
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
178 178
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
179 179
 				TXN_ID INT(11) DEFAULT NULL,
180 180
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -190,18 +190,18 @@  discard block
 block discarded – undo
190 190
 				OBJ_ID INT(11) DEFAULT NULL,
191 191
 				OBJ_type VARCHAR(45)DEFAULT NULL,
192 192
 				PRIMARY KEY  (LIN_ID)";
193
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
194
-        $table_name = 'esp_message_template';
195
-        $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
193
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
194
+		$table_name = 'esp_message_template';
195
+		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
196 196
 					GRP_ID INT(10) UNSIGNED NOT NULL,
197 197
 					MTP_context VARCHAR(50) NOT NULL,
198 198
 					MTP_template_field VARCHAR(30) NOT NULL,
199 199
 					MTP_content TEXT NOT NULL,
200 200
 					PRIMARY KEY  (MTP_ID),
201 201
 					KEY GRP_ID (GRP_ID)";
202
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
203
-        $table_name = 'esp_message_template_group';
204
-        $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
202
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
203
+		$table_name = 'esp_message_template_group';
204
+		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
205 205
 					EVT_ID BIGINT(20) UNSIGNED DEFAULT NULL,
206 206
 					MTP_user_id INT(10) NOT NULL DEFAULT '1',
207 207
 					MTP_messenger VARCHAR(30) NOT NULL,
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
 					PRIMARY KEY  (GRP_ID),
214 214
 					KEY EVT_ID (EVT_ID),
215 215
 					KEY MTP_user_id (MTP_user_id)";
216
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
217
-        $table_name = 'esp_payment';
218
-        $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
216
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
217
+		$table_name = 'esp_payment';
218
+		$sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
219 219
 					TXN_ID INT(10) UNSIGNED DEFAULT NULL,
220 220
 					STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL,
221 221
 					PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
 					PRIMARY KEY  (PAY_ID),
232 232
 					KEY TXN_ID (TXN_ID),
233 233
 					KEY PAY_timestamp (PAY_timestamp)";
234
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
235
-        $table_name = "esp_ticket";
236
-        $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
234
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
235
+		$table_name = "esp_ticket";
236
+		$sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
237 237
 					  TTM_ID INT(10) UNSIGNED NOT NULL,
238 238
 					  TKT_name VARCHAR(245) NOT NULL DEFAULT '',
239 239
 					  TKT_description TEXT NOT NULL,
@@ -252,28 +252,28 @@  discard block
 block discarded – undo
252 252
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
253 253
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
254 254
 					  PRIMARY KEY  (TKT_ID)";
255
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
256
-        $table_name = "esp_ticket_price";
257
-        $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
255
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
256
+		$table_name = "esp_ticket_price";
257
+		$sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
258 258
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
259 259
 					  PRC_ID INT(10) UNSIGNED NOT NULL,
260 260
 					  PRIMARY KEY  (TKP_ID)";
261
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
262
-        $table_name = "esp_datetime_ticket";
263
-        $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
261
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
262
+		$table_name = "esp_datetime_ticket";
263
+		$sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
264 264
 					  DTT_ID INT(10) UNSIGNED NOT NULL,
265 265
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
266 266
 					  PRIMARY KEY  (DTK_ID)";
267
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
268
-        $table_name = "esp_ticket_template";
269
-        $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
267
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
268
+		$table_name = "esp_ticket_template";
269
+		$sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
270 270
 					  TTM_name VARCHAR(45) NOT NULL,
271 271
 					  TTM_description TEXT,
272 272
 					  TTM_file VARCHAR(45),
273 273
 					  PRIMARY KEY  (TTM_ID)";
274
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
275
-        $table_name = "esp_price";
276
-        $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
274
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
275
+		$table_name = "esp_price";
276
+		$sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
277 277
 					  PRT_ID TINYINT(3) UNSIGNED NOT NULL,
278 278
 					  PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
279 279
 					  PRC_name VARCHAR(245) NOT NULL,
@@ -284,9 +284,9 @@  discard block
 block discarded – undo
284 284
 					  PRC_order TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
285 285
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
286 286
 					  PRIMARY KEY  (PRC_ID)";
287
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
288
-        $table_name = "esp_price_type";
289
-        $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
287
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
288
+		$table_name = "esp_price_type";
289
+		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
290 290
 				  PRT_name VARCHAR(45) NOT NULL,
291 291
 				  PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
292 292
 				  PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0',
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
 				  PRT_deleted TINYINT(1) NOT NULL DEFAULT '0',
295 295
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
296 296
 				  PRIMARY KEY  (PRT_ID)";
297
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
298
-        $table_name = 'esp_question';
299
-        $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
297
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
298
+		$table_name = 'esp_question';
299
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
300 300
 					QST_display_text TEXT NOT NULL,
301 301
 					QST_admin_label VARCHAR(255) NOT NULL,
302 302
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
 					QST_wp_user BIGINT UNSIGNED NULL,
309 309
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
310 310
 					PRIMARY KEY  (QST_ID)';
311
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
312
-        $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
313
-        $table_name = 'esp_question_group';
314
-        $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
311
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
312
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
313
+		$table_name = 'esp_question_group';
314
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
315 315
 					QSG_name VARCHAR(255) NOT NULL,
316 316
 					QSG_identifier VARCHAR(100) NOT NULL,
317 317
 					QSG_desc TEXT NULL,
@@ -322,24 +322,24 @@  discard block
 block discarded – undo
322 322
 					QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
323 323
 					PRIMARY KEY  (QSG_ID),
324 324
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
325
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
326
-        $table_name = 'esp_question_group_question';
327
-        $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
325
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
326
+		$table_name = 'esp_question_group_question';
327
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
328 328
 					QSG_ID INT UNSIGNED NOT NULL,
329 329
 					QST_ID INT UNSIGNED NOT NULL,
330 330
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
331 331
 					PRIMARY KEY  (QGQ_ID) ";
332
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
333
-        $table_name = 'esp_question_option';
334
-        $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
332
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
333
+		$table_name = 'esp_question_option';
334
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
335 335
 					QSO_value VARCHAR(255) NOT NULL,
336 336
 					QSO_desc TEXT NOT NULL,
337 337
 					QST_ID INT UNSIGNED NOT NULL,
338 338
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
339 339
 					PRIMARY KEY  (QSO_ID)";
340
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
341
-        $table_name = 'esp_registration';
342
-        $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
340
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
341
+		$table_name = 'esp_registration';
342
+		$sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
343 343
 					  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
344 344
 					  ATT_ID BIGINT(20) UNSIGNED NOT NULL,
345 345
 					  TXN_ID INT(10) UNSIGNED NOT NULL,
@@ -362,25 +362,25 @@  discard block
 block discarded – undo
362 362
 					  KEY STS_ID (STS_ID),
363 363
 					  KEY REG_url_link (REG_url_link),
364 364
 					  KEY REG_code (REG_code)";
365
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
366
-        $table_name = 'esp_checkin';
367
-        $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
365
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
366
+		$table_name = 'esp_checkin';
367
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
368 368
 					REG_ID INT(10) UNSIGNED NOT NULL,
369 369
 					DTT_ID INT(10) UNSIGNED NOT NULL,
370 370
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
371 371
 					CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
372 372
 					PRIMARY KEY  (CHK_ID)";
373
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
374
-        $table_name = 'esp_state';
375
-        $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
373
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
374
+		$table_name = 'esp_state';
375
+		$sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
376 376
 					  CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
377 377
 					  STA_abbrev VARCHAR(6) COLLATE utf8_bin NOT NULL,
378 378
 					  STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL,
379 379
 					  STA_active TINYINT(1) DEFAULT '1',
380 380
 					  PRIMARY KEY  (STA_ID)";
381
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
382
-        $table_name = 'esp_status';
383
-        $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
381
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
382
+		$table_name = 'esp_status';
383
+		$sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
384 384
 					  STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL,
385 385
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
386 386
 					  STS_can_edit TINYINT(1) NOT NULL DEFAULT 0,
@@ -388,9 +388,9 @@  discard block
 block discarded – undo
388 388
 					  STS_open TINYINT(1) NOT NULL DEFAULT 1,
389 389
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
390 390
 					  KEY STS_type (STS_type)";
391
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
392
-        $table_name = 'esp_transaction';
393
-        $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
391
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
392
+		$table_name = 'esp_transaction';
393
+		$sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
394 394
 					  TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
395 395
 					  TXN_total DECIMAL(10,3) DEFAULT '0.00',
396 396
 					  TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00',
@@ -400,9 +400,9 @@  discard block
 block discarded – undo
400 400
 					  PRIMARY KEY  (TXN_ID),
401 401
 					  KEY TXN_timestamp (TXN_timestamp),
402 402
 					  KEY STS_ID (STS_ID)";
403
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
404
-        $table_name = 'esp_venue_meta';
405
-        $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
403
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
404
+		$table_name = 'esp_venue_meta';
405
+		$sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
406 406
 			VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
407 407
 			VNU_address VARCHAR(255) DEFAULT NULL,
408 408
 			VNU_address2 VARCHAR(255) DEFAULT NULL,
@@ -420,38 +420,38 @@  discard block
 block discarded – undo
420 420
 			PRIMARY KEY  (VNUM_ID),
421 421
 			KEY STA_ID (STA_ID),
422 422
 			KEY CNT_ISO (CNT_ISO)";
423
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
424
-        $script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
425
-        //setting up the DEFAULT stats and countries is also essential for the data migrations to run
426
-        //(because many need to convert old string states to foreign keys into the states table)
427
-        $script_with_defaults->insert_default_states();
428
-        $script_with_defaults->insert_default_countries();
429
-        //setting up DEFAULT prices, price types, and tickets is also essential for the price migrations
430
-        $script_with_defaults->insert_default_price_types();
431
-        $script_with_defaults->insert_default_prices();
432
-        $script_with_defaults->insert_default_tickets();
433
-        //setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
434
-        EE_Config::instance()->update_espresso_config(false, true);
435
-        return true;
436
-    }
423
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
424
+		$script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
425
+		//setting up the DEFAULT stats and countries is also essential for the data migrations to run
426
+		//(because many need to convert old string states to foreign keys into the states table)
427
+		$script_with_defaults->insert_default_states();
428
+		$script_with_defaults->insert_default_countries();
429
+		//setting up DEFAULT prices, price types, and tickets is also essential for the price migrations
430
+		$script_with_defaults->insert_default_price_types();
431
+		$script_with_defaults->insert_default_prices();
432
+		$script_with_defaults->insert_default_tickets();
433
+		//setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
434
+		EE_Config::instance()->update_espresso_config(false, true);
435
+		return true;
436
+	}
437 437
 
438 438
 
439 439
 
440
-    /**
441
-     * We COULD clean up the esp_question.QST_order field here. We'll leave it for now
442
-     *
443
-     * @return boolean
444
-     */
445
-    public function schema_changes_after_migration()
446
-    {
447
-        return true;
448
-    }
440
+	/**
441
+	 * We COULD clean up the esp_question.QST_order field here. We'll leave it for now
442
+	 *
443
+	 * @return boolean
444
+	 */
445
+	public function schema_changes_after_migration()
446
+	{
447
+		return true;
448
+	}
449 449
 
450 450
 
451 451
 
452
-    public function migration_page_hooks()
453
-    {
454
-    }
452
+	public function migration_page_hooks()
453
+	{
454
+	}
455 455
 }
456 456
 
457 457
 
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_3_0.dms.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 //unfortunately, this needs to be done upon INCLUSION of this file,
12 12
 //instead of construction, because it only gets constructed on first page load
13 13
 //(all other times it gets resurrected from a wordpress option)
14
-$stages = glob(EE_CORE . 'data_migration_scripts/4_3_0_stages/*');
14
+$stages = glob(EE_CORE.'data_migration_scripts/4_3_0_stages/*');
15 15
 $class_to_filepath = array();
16 16
 if ( ! empty($stages)) {
17 17
     foreach ($stages as $filepath) {
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         } elseif ( ! $version_string) {
61 61
 //			echo "no version string provided: $version_string";
62 62
             //no version string provided... this must be pre 4.2
63
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
63
+            return false; //changed mind. dont want people thinking they should migrate yet because they cant
64 64
         } else {
65 65
 //			echo "$version_string doesnt apply";
66 66
             return false;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     public function schema_changes_before_migration()
80 80
     {
81 81
         //relies on 4.1's EEH_Activation::create_table
82
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
82
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
83 83
         $table_name = 'esp_answer';
84 84
         $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
85 85
 					REG_ID INT UNSIGNED NOT NULL,
@@ -482,9 +482,9 @@  discard block
 block discarded – undo
482 482
     public function insert_default_tickets()
483 483
     {
484 484
         global $wpdb;
485
-        $ticket_table = $wpdb->prefix . "esp_ticket";
485
+        $ticket_table = $wpdb->prefix."esp_ticket";
486 486
         if ($this->_get_table_analysis()->tableExists($ticket_table)) {
487
-            $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
487
+            $SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table;
488 488
             $tickets_exist = $wpdb->get_var($SQL);
489 489
             if ( ! $tickets_exist) {
490 490
                 $SQL = "INSERT INTO $ticket_table
@@ -496,9 +496,9 @@  discard block
 block discarded – undo
496 496
                 $wpdb->query($SQL);
497 497
             }
498 498
         }
499
-        $ticket_price_table = $wpdb->prefix . "esp_ticket_price";
499
+        $ticket_price_table = $wpdb->prefix."esp_ticket_price";
500 500
         if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
501
-            $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
501
+            $SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table;
502 502
             $ticket_prc_exist = $wpdb->get_var($SQL);
503 503
             if ( ! $ticket_prc_exist) {
504 504
                 $SQL = "INSERT INTO $ticket_price_table
Please login to merge, or discard this patch.
Indentation   +193 added lines, -193 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
 $stages = glob(EE_CORE . 'data_migration_scripts/4_3_0_stages/*');
15 15
 $class_to_filepath = array();
16 16
 if ( ! empty($stages)) {
17
-    foreach ($stages as $filepath) {
18
-        $matches = array();
19
-        preg_match('~4_3_0_stages/(.*).dmsstage.php~', $filepath, $matches);
20
-        $class_to_filepath[$matches[1]] = $filepath;
21
-    }
17
+	foreach ($stages as $filepath) {
18
+		$matches = array();
19
+		preg_match('~4_3_0_stages/(.*).dmsstage.php~', $filepath, $matches);
20
+		$class_to_filepath[$matches[1]] = $filepath;
21
+	}
22 22
 }
23 23
 //give addons a chance to autoload their stages too
24 24
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_3_0__autoloaded_stages', $class_to_filepath);
@@ -31,56 +31,56 @@  discard block
 block discarded – undo
31 31
 
32 32
 
33 33
 
34
-    /**
35
-     * EE_DMS_Core_4_3_0 constructor.
36
-     *
37
-     * @param TableManager  $table_manager
38
-     * @param TableAnalysis $table_analysis
39
-     */
40
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
41
-    {
42
-        $this->_pretty_name = __("Data Update to Event Espresso 4.3.0", "event_espresso");
43
-        $this->_priority = 10;
44
-        $this->_migration_stages = array(
45
-            new EE_DMS_4_3_0_question_option_order(),
46
-            new EE_DMS_4_3_0_event_message_templates(),
47
-        );
48
-        parent::__construct($table_manager, $table_analysis);
49
-    }
34
+	/**
35
+	 * EE_DMS_Core_4_3_0 constructor.
36
+	 *
37
+	 * @param TableManager  $table_manager
38
+	 * @param TableAnalysis $table_analysis
39
+	 */
40
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
41
+	{
42
+		$this->_pretty_name = __("Data Update to Event Espresso 4.3.0", "event_espresso");
43
+		$this->_priority = 10;
44
+		$this->_migration_stages = array(
45
+			new EE_DMS_4_3_0_question_option_order(),
46
+			new EE_DMS_4_3_0_event_message_templates(),
47
+		);
48
+		parent::__construct($table_manager, $table_analysis);
49
+	}
50 50
 
51 51
 
52 52
 
53
-    public function can_migrate_from_version($version_array)
54
-    {
55
-        $version_string = $version_array['Core'];
56
-        if (version_compare($version_string, '4.3.0', '<=') && version_compare($version_string, '4.2.0', '>=')) {
53
+	public function can_migrate_from_version($version_array)
54
+	{
55
+		$version_string = $version_array['Core'];
56
+		if (version_compare($version_string, '4.3.0', '<=') && version_compare($version_string, '4.2.0', '>=')) {
57 57
 //			echo "$version_string can be migrated fro";
58
-            return true;
59
-        } elseif ( ! $version_string) {
58
+			return true;
59
+		} elseif ( ! $version_string) {
60 60
 //			echo "no version string provided: $version_string";
61
-            //no version string provided... this must be pre 4.2
62
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
63
-        } else {
61
+			//no version string provided... this must be pre 4.2
62
+			return false;//changed mind. dont want people thinking they should migrate yet because they cant
63
+		} else {
64 64
 //			echo "$version_string doesnt apply";
65
-            return false;
66
-        }
67
-    }
65
+			return false;
66
+		}
67
+	}
68 68
 
69 69
 
70 70
 
71
-    public function schema_changes_before_migration()
72
-    {
73
-        //relies on 4.1's EEH_Activation::create_table
74
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
75
-        $table_name = 'esp_answer';
76
-        $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
71
+	public function schema_changes_before_migration()
72
+	{
73
+		//relies on 4.1's EEH_Activation::create_table
74
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
75
+		$table_name = 'esp_answer';
76
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
77 77
 					REG_ID INT UNSIGNED NOT NULL,
78 78
 					QST_ID INT UNSIGNED NOT NULL,
79 79
 					ANS_value TEXT NOT NULL,
80 80
 					PRIMARY KEY  (ANS_ID)";
81
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
82
-        $table_name = 'esp_attendee_meta';
83
-        $sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
81
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
82
+		$table_name = 'esp_attendee_meta';
83
+		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
84 84
 						ATT_ID BIGINT(20) UNSIGNED NOT NULL,
85 85
 						ATT_fname VARCHAR(45) NOT NULL,
86 86
 						ATT_lname VARCHAR(45) NOT	NULL,
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
 								KEY ATT_fname (ATT_fname),
97 97
 								KEY ATT_lname (ATT_lname),
98 98
 								KEY ATT_email (ATT_email)";
99
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
100
-        $table_name = 'esp_country';
101
-        $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
99
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
100
+		$table_name = 'esp_country';
101
+		$sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
102 102
 					  CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL,
103 103
 					  RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL,
104 104
 					  CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL,
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
115 115
 					  CNT_active TINYINT(1) DEFAULT '0',
116 116
 					  PRIMARY KEY  (CNT_ISO)";
117
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
118
-        $table_name = 'esp_datetime';
119
-        $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
117
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
118
+		$table_name = 'esp_datetime';
119
+		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
120 120
 				  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
121 121
 				  DTT_name VARCHAR(255) NOT NULL DEFAULT '',
122 122
 				  DTT_description TEXT NOT NULL,
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
 						PRIMARY KEY  (DTT_ID),
132 132
 						KEY EVT_ID (EVT_ID),
133 133
 						KEY DTT_is_primary (DTT_is_primary)";
134
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
135
-        $table_name = 'esp_event_meta';
136
-        $sql = "
134
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
135
+		$table_name = 'esp_event_meta';
136
+		$sql = "
137 137
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
138 138
 			EVT_ID BIGINT(20) UNSIGNED NOT NULL,
139 139
 			EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -148,31 +148,31 @@  discard block
 block discarded – undo
148 148
 			EVT_external_URL VARCHAR(200) NULL,
149 149
 			EVT_donations TINYINT(1) NULL,
150 150
 			PRIMARY KEY  (EVTM_ID)";
151
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
152
-        $table_name = 'esp_event_question_group';
153
-        $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
151
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
152
+		$table_name = 'esp_event_question_group';
153
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
154 154
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
155 155
 					QSG_ID INT UNSIGNED NOT NULL,
156 156
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
157 157
 					PRIMARY KEY  (EQG_ID)";
158
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
159
-        $table_name = 'esp_event_venue';
160
-        $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
158
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
159
+		$table_name = 'esp_event_venue';
160
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
161 161
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
162 162
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
163 163
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
164 164
 				PRIMARY KEY  (EVV_ID)";
165
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
166
-        $table_name = 'esp_extra_meta';
167
-        $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
165
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
166
+		$table_name = 'esp_extra_meta';
167
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
168 168
 				OBJ_ID INT(11) DEFAULT NULL,
169 169
 				EXM_type VARCHAR(45) DEFAULT NULL,
170 170
 				EXM_key VARCHAR(45) DEFAULT NULL,
171 171
 				EXM_value TEXT,
172 172
 				PRIMARY KEY  (EXM_ID)";
173
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
174
-        $table_name = 'esp_line_item';
175
-        $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
173
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
174
+		$table_name = 'esp_line_item';
175
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
176 176
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
177 177
 				TXN_ID INT(11) DEFAULT NULL,
178 178
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -188,19 +188,19 @@  discard block
 block discarded – undo
188 188
 				OBJ_ID INT(11) DEFAULT NULL,
189 189
 				OBJ_type VARCHAR(45)DEFAULT NULL,
190 190
 				PRIMARY KEY  (LIN_ID)";
191
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
192
-        $table_name = 'esp_message_template';
193
-        $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
191
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
192
+		$table_name = 'esp_message_template';
193
+		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
194 194
 					GRP_ID INT(10) UNSIGNED NOT NULL,
195 195
 					MTP_context VARCHAR(50) NOT NULL,
196 196
 					MTP_template_field VARCHAR(30) NOT NULL,
197 197
 					MTP_content TEXT NOT NULL,
198 198
 					PRIMARY KEY  (MTP_ID),
199 199
 					KEY GRP_ID (GRP_ID)";
200
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
201
-        $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
202
-        $table_name = 'esp_message_template_group';
203
-        $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
200
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
201
+		$this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
202
+		$table_name = 'esp_message_template_group';
203
+		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
204 204
 					MTP_user_id INT(10) NOT NULL DEFAULT '1',
205 205
 					MTP_name VARCHAR(245) NOT NULL DEFAULT '',
206 206
 					MTP_description VARCHAR(245) NOT NULL DEFAULT '',
@@ -212,17 +212,17 @@  discard block
 block discarded – undo
212 212
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
213 213
 					PRIMARY KEY  (GRP_ID),
214 214
 					KEY MTP_user_id (MTP_user_id)";
215
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
216
-        $table_name = 'esp_event_message_template';
217
-        $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
215
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
216
+		$table_name = 'esp_event_message_template';
217
+		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
218 218
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
219 219
 					GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0,
220 220
 					PRIMARY KEY  (EMT_ID),
221 221
 					KEY EVT_ID (EVT_ID),
222 222
 					KEY GRP_ID (GRP_ID)";
223
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
224
-        $table_name = 'esp_payment';
225
-        $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
223
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
224
+		$table_name = 'esp_payment';
225
+		$sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
226 226
 					TXN_ID INT(10) UNSIGNED DEFAULT NULL,
227 227
 					STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL,
228 228
 					PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
 					PRIMARY KEY  (PAY_ID),
239 239
 					KEY TXN_ID (TXN_ID),
240 240
 					KEY PAY_timestamp (PAY_timestamp)";
241
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
242
-        $table_name = "esp_ticket";
243
-        $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
241
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
242
+		$table_name = "esp_ticket";
243
+		$sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
244 244
 					  TTM_ID INT(10) UNSIGNED NOT NULL,
245 245
 					  TKT_name VARCHAR(245) NOT NULL DEFAULT '',
246 246
 					  TKT_description TEXT NOT NULL,
@@ -260,28 +260,28 @@  discard block
 block discarded – undo
260 260
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
261 261
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
262 262
 					  PRIMARY KEY  (TKT_ID)";
263
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
264
-        $table_name = "esp_ticket_price";
265
-        $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
263
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
264
+		$table_name = "esp_ticket_price";
265
+		$sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
266 266
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
267 267
 					  PRC_ID INT(10) UNSIGNED NOT NULL,
268 268
 					  PRIMARY KEY  (TKP_ID)";
269
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
270
-        $table_name = "esp_datetime_ticket";
271
-        $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
269
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
270
+		$table_name = "esp_datetime_ticket";
271
+		$sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
272 272
 					  DTT_ID INT(10) UNSIGNED NOT NULL,
273 273
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
274 274
 					  PRIMARY KEY  (DTK_ID)";
275
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
276
-        $table_name = "esp_ticket_template";
277
-        $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
275
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
276
+		$table_name = "esp_ticket_template";
277
+		$sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
278 278
 					  TTM_name VARCHAR(45) NOT NULL,
279 279
 					  TTM_description TEXT,
280 280
 					  TTM_file VARCHAR(45),
281 281
 					  PRIMARY KEY  (TTM_ID)";
282
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
283
-        $table_name = "esp_price";
284
-        $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
282
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
283
+		$table_name = "esp_price";
284
+		$sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
285 285
 					  PRT_ID TINYINT(3) UNSIGNED NOT NULL,
286 286
 					  PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
287 287
 					  PRC_name VARCHAR(245) NOT NULL,
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
 					  PRC_order TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
293 293
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
294 294
 					  PRIMARY KEY  (PRC_ID)";
295
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
296
-        $table_name = "esp_price_type";
297
-        $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
295
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
296
+		$table_name = "esp_price_type";
297
+		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
298 298
 				  PRT_name VARCHAR(45) NOT NULL,
299 299
 				  PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
300 300
 				  PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0',
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
 				  PRT_deleted TINYINT(1) NOT NULL DEFAULT '0',
303 303
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
304 304
 				  PRIMARY KEY  (PRT_ID)";
305
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
306
-        $table_name = 'esp_question';
307
-        $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
305
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
306
+		$table_name = 'esp_question';
307
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
308 308
 					QST_display_text TEXT NOT NULL,
309 309
 					QST_admin_label VARCHAR(255) NOT NULL,
310 310
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
 					QST_wp_user BIGINT UNSIGNED NULL,
317 317
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
318 318
 					PRIMARY KEY  (QST_ID)';
319
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
320
-        $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
321
-        $table_name = 'esp_question_group';
322
-        $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
319
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
320
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
321
+		$table_name = 'esp_question_group';
322
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
323 323
 					QSG_name VARCHAR(255) NOT NULL,
324 324
 					QSG_identifier VARCHAR(100) NOT NULL,
325 325
 					QSG_desc TEXT NULL,
@@ -330,25 +330,25 @@  discard block
 block discarded – undo
330 330
 					QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
331 331
 					PRIMARY KEY  (QSG_ID),
332 332
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
333
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
334
-        $table_name = 'esp_question_group_question';
335
-        $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
333
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
334
+		$table_name = 'esp_question_group_question';
335
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
336 336
 					QSG_ID INT UNSIGNED NOT NULL,
337 337
 					QST_ID INT UNSIGNED NOT NULL,
338 338
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
339 339
 					PRIMARY KEY  (QGQ_ID) ";
340
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
341
-        $table_name = 'esp_question_option';
342
-        $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
340
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
341
+		$table_name = 'esp_question_option';
342
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
343 343
 					QSO_value VARCHAR(255) NOT NULL,
344 344
 					QSO_desc TEXT NOT NULL,
345 345
 					QST_ID INT UNSIGNED NOT NULL,
346 346
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
347 347
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
348 348
 					PRIMARY KEY  (QSO_ID)";
349
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
350
-        $table_name = 'esp_registration';
351
-        $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
349
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
350
+		$table_name = 'esp_registration';
351
+		$sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
352 352
 					  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
353 353
 					  ATT_ID BIGINT(20) UNSIGNED NOT NULL,
354 354
 					  TXN_ID INT(10) UNSIGNED NOT NULL,
@@ -371,25 +371,25 @@  discard block
 block discarded – undo
371 371
 					  KEY STS_ID (STS_ID),
372 372
 					  KEY REG_url_link (REG_url_link),
373 373
 					  KEY REG_code (REG_code)";
374
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
375
-        $table_name = 'esp_checkin';
376
-        $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
374
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
375
+		$table_name = 'esp_checkin';
376
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
377 377
 					REG_ID INT(10) UNSIGNED NOT NULL,
378 378
 					DTT_ID INT(10) UNSIGNED NOT NULL,
379 379
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
380 380
 					CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
381 381
 					PRIMARY KEY  (CHK_ID)";
382
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
383
-        $table_name = 'esp_state';
384
-        $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
382
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
383
+		$table_name = 'esp_state';
384
+		$sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
385 385
 					  CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
386 386
 					  STA_abbrev VARCHAR(6) COLLATE utf8_bin NOT NULL,
387 387
 					  STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL,
388 388
 					  STA_active TINYINT(1) DEFAULT '1',
389 389
 					  PRIMARY KEY  (STA_ID)";
390
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
391
-        $table_name = 'esp_status';
392
-        $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
390
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
391
+		$table_name = 'esp_status';
392
+		$sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
393 393
 					  STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL,
394 394
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
395 395
 					  STS_can_edit TINYINT(1) NOT NULL DEFAULT 0,
@@ -397,9 +397,9 @@  discard block
 block discarded – undo
397 397
 					  STS_open TINYINT(1) NOT NULL DEFAULT 1,
398 398
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
399 399
 					  KEY STS_type (STS_type)";
400
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
401
-        $table_name = 'esp_transaction';
402
-        $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
400
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
401
+		$table_name = 'esp_transaction';
402
+		$sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
403 403
 					  TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
404 404
 					  TXN_total DECIMAL(10,3) DEFAULT '0.00',
405 405
 					  TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00',
@@ -409,9 +409,9 @@  discard block
 block discarded – undo
409 409
 					  PRIMARY KEY  (TXN_ID),
410 410
 					  KEY TXN_timestamp (TXN_timestamp),
411 411
 					  KEY STS_ID (STS_ID)";
412
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
413
-        $table_name = 'esp_venue_meta';
414
-        $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
412
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
413
+		$table_name = 'esp_venue_meta';
414
+		$sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
415 415
 			VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
416 416
 			VNU_address VARCHAR(255) DEFAULT NULL,
417 417
 			VNU_address2 VARCHAR(255) DEFAULT NULL,
@@ -429,79 +429,79 @@  discard block
 block discarded – undo
429 429
 			PRIMARY KEY  (VNUM_ID),
430 430
 			KEY STA_ID (STA_ID),
431 431
 			KEY CNT_ISO (CNT_ISO)";
432
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
433
-        $script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
434
-        //setting up the DEFAULT stats and countries is also essential for the data migrations to run
435
-        //(because many need to convert old string states to foreign keys into the states table)
436
-        $script_with_defaults->insert_default_states();
437
-        $script_with_defaults->insert_default_countries();
438
-        //setting up DEFAULT prices, price types, and tickets is also essential for the price migrations
439
-        $script_with_defaults->insert_default_price_types();
440
-        $script_with_defaults->insert_default_prices();
441
-        //but the schema on the tickets table has changed since 4.1, so use our DEFAULT ticket method instead of 4.1's
442
-        $this->insert_default_tickets();
443
-        //setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
444
-        EE_Config::instance()->update_espresso_config(false, true);
445
-        return true;
446
-    }
447
-
448
-
449
-
450
-    /**
451
-     * @return boolean
452
-     */
453
-    public function schema_changes_after_migration()
454
-    {
455
-        return true;
456
-    }
457
-
458
-
459
-
460
-    public function migration_page_hooks()
461
-    {
462
-    }
463
-
464
-
465
-
466
-    /**
467
-     * insert DEFAULT ticket
468
-     * Almost identical to EE_DMS_Core_4_1_0::insert_default_tickets, except is aware of the TKT_required field
469
-     *
470
-     * @access public
471
-     * @static
472
-     * @return void
473
-     */
474
-    public function insert_default_tickets()
475
-    {
476
-        global $wpdb;
477
-        $ticket_table = $wpdb->prefix . "esp_ticket";
478
-        if ($this->_get_table_analysis()->tableExists($ticket_table)) {
479
-            $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
480
-            $tickets_exist = $wpdb->get_var($SQL);
481
-            if ( ! $tickets_exist) {
482
-                $SQL = "INSERT INTO $ticket_table
432
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
433
+		$script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
434
+		//setting up the DEFAULT stats and countries is also essential for the data migrations to run
435
+		//(because many need to convert old string states to foreign keys into the states table)
436
+		$script_with_defaults->insert_default_states();
437
+		$script_with_defaults->insert_default_countries();
438
+		//setting up DEFAULT prices, price types, and tickets is also essential for the price migrations
439
+		$script_with_defaults->insert_default_price_types();
440
+		$script_with_defaults->insert_default_prices();
441
+		//but the schema on the tickets table has changed since 4.1, so use our DEFAULT ticket method instead of 4.1's
442
+		$this->insert_default_tickets();
443
+		//setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
444
+		EE_Config::instance()->update_espresso_config(false, true);
445
+		return true;
446
+	}
447
+
448
+
449
+
450
+	/**
451
+	 * @return boolean
452
+	 */
453
+	public function schema_changes_after_migration()
454
+	{
455
+		return true;
456
+	}
457
+
458
+
459
+
460
+	public function migration_page_hooks()
461
+	{
462
+	}
463
+
464
+
465
+
466
+	/**
467
+	 * insert DEFAULT ticket
468
+	 * Almost identical to EE_DMS_Core_4_1_0::insert_default_tickets, except is aware of the TKT_required field
469
+	 *
470
+	 * @access public
471
+	 * @static
472
+	 * @return void
473
+	 */
474
+	public function insert_default_tickets()
475
+	{
476
+		global $wpdb;
477
+		$ticket_table = $wpdb->prefix . "esp_ticket";
478
+		if ($this->_get_table_analysis()->tableExists($ticket_table)) {
479
+			$SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
480
+			$tickets_exist = $wpdb->get_var($SQL);
481
+			if ( ! $tickets_exist) {
482
+				$SQL = "INSERT INTO $ticket_table
483 483
 					( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_required, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_deleted ) VALUES
484 484
 					( 1, 0, '"
485
-                       . __("Free Ticket", "event_espresso")
486
-                       . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);";
487
-                $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL);
488
-                $wpdb->query($SQL);
489
-            }
490
-        }
491
-        $ticket_price_table = $wpdb->prefix . "esp_ticket_price";
492
-        if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
493
-            $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
494
-            $ticket_prc_exist = $wpdb->get_var($SQL);
495
-            if ( ! $ticket_prc_exist) {
496
-                $SQL = "INSERT INTO $ticket_price_table
485
+					   . __("Free Ticket", "event_espresso")
486
+					   . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);";
487
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL);
488
+				$wpdb->query($SQL);
489
+			}
490
+		}
491
+		$ticket_price_table = $wpdb->prefix . "esp_ticket_price";
492
+		if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
493
+			$SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
494
+			$ticket_prc_exist = $wpdb->get_var($SQL);
495
+			if ( ! $ticket_prc_exist) {
496
+				$SQL = "INSERT INTO $ticket_price_table
497 497
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
498 498
 				( 1, 1, 1 )
499 499
 				";
500
-                $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL);
501
-                $wpdb->query($SQL);
502
-            }
503
-        }
504
-    }
500
+				$SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL);
501
+				$wpdb->query($SQL);
502
+			}
503
+		}
504
+	}
505 505
 
506 506
 }
507 507
 
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_6_0.dms.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 //unfortunately, this needs to be done upon INCLUSION of this file,
12 12
 //instead of construction, because it only gets constructed on first page load
13 13
 //(all other times it gets resurrected from a wordpress option)
14
-$stages = glob(EE_CORE . 'data_migration_scripts/4_6_0_stages/*');
14
+$stages = glob(EE_CORE.'data_migration_scripts/4_6_0_stages/*');
15 15
 $class_to_filepath = array();
16 16
 foreach ($stages as $filepath) {
17 17
     $matches = array();
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         } elseif ( ! $version_string) {
75 75
 //			echo "no version string provided: $version_string";
76 76
             //no version string provided... this must be pre 4.3
77
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
77
+            return false; //changed mind. dont want people thinking they should migrate yet because they cant
78 78
         } else {
79 79
 //			echo "$version_string doesnt apply";
80 80
             return false;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     public function schema_changes_before_migration()
100 100
     {
101 101
         //relies on 4.1's EEH_Activation::create_table
102
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
102
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
103 103
         $table_name = 'esp_answer';
104 104
         $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
105 105
 					REG_ID INT UNSIGNED NOT NULL,
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
     public function add_default_admin_only_payments()
547 547
     {
548 548
         global $wpdb;
549
-        $table_name = $wpdb->prefix . "esp_payment_method";
549
+        $table_name = $wpdb->prefix."esp_payment_method";
550 550
         $user_id = EEH_Activation::get_default_creator_id();
551 551
         if ($this->_get_table_analysis()->tableExists($table_name)) {
552 552
             $SQL = "SELECT COUNT( * ) FROM $table_name";
@@ -585,13 +585,13 @@  discard block
 block discarded – undo
585 585
                         $table_name,
586 586
                         $values,
587 587
                         array(
588
-                            '%s',//PMD_type
589
-                            '%s',//PMD_name
590
-                            '%s',//PMD_admin_name
591
-                            '%s',//PMD_admin_desc
592
-                            '%s',//PMD_slug
593
-                            '%d',//PMD_wp_user
594
-                            '%s',//PMD_scope
588
+                            '%s', //PMD_type
589
+                            '%s', //PMD_name
590
+                            '%s', //PMD_admin_name
591
+                            '%s', //PMD_admin_desc
592
+                            '%s', //PMD_slug
593
+                            '%d', //PMD_wp_user
594
+                            '%s', //PMD_scope
595 595
                         )
596 596
                     );
597 597
                     if ( ! $success) {
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
     public function insert_default_currencies()
615 615
     {
616 616
         global $wpdb;
617
-        $currency_table = $wpdb->prefix . "esp_currency";
617
+        $currency_table = $wpdb->prefix."esp_currency";
618 618
         if ($this->_get_table_analysis()->tableExists($currency_table)) {
619 619
             $SQL = "SELECT COUNT('CUR_code') FROM $currency_table";
620 620
             $countries = $wpdb->get_var($SQL);
Please login to merge, or discard this patch.
Indentation   +270 added lines, -270 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
 $stages = glob(EE_CORE . 'data_migration_scripts/4_6_0_stages/*');
15 15
 $class_to_filepath = array();
16 16
 foreach ($stages as $filepath) {
17
-    $matches = array();
18
-    preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches);
19
-    $class_to_filepath[$matches[1]] = $filepath;
17
+	$matches = array();
18
+	preg_match('~4_6_0_stages/(.*).dmsstage.php~', $filepath, $matches);
19
+	$class_to_filepath[$matches[1]] = $filepath;
20 20
 }
21 21
 //give addons a chance to autoload their stages too
22 22
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_6_0__autoloaded_stages', $class_to_filepath);
@@ -35,70 +35,70 @@  discard block
 block discarded – undo
35 35
 class EE_DMS_Core_4_6_0 extends EE_Data_Migration_Script_Base
36 36
 {
37 37
 
38
-    /**
39
-     * return EE_DMS_Core_4_6_0
40
-     *
41
-     * @param TableManager  $table_manager
42
-     * @param TableAnalysis $table_analysis
43
-     */
44
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
45
-    {
46
-        $this->_pretty_name = __("Data Update to Event Espresso 4.6.0", "event_espresso");
47
-        $this->_priority = 10;
48
-        $this->_migration_stages = array(
49
-            new EE_DMS_4_6_0_gateways(),
50
-            new EE_DMS_4_6_0_payment_method_currencies(),
51
-            new EE_DMS_4_6_0_question_types(),
52
-            new EE_DMS_4_6_0_country_system_question(),
53
-            new EE_DMS_4_6_0_state_system_question(),
54
-            new EE_DMS_4_6_0_billing_info(),
55
-            new EE_DMS_4_6_0_transactions(),
56
-            new EE_DMS_4_6_0_payments(),
57
-            new EE_DMS_4_6_0_invoice_settings(),
58
-        );
59
-        parent::__construct($table_manager, $table_analysis);
60
-    }
61
-
62
-
63
-
64
-    /**
65
-     * @param array $version_array
66
-     * @return bool
67
-     */
68
-    public function can_migrate_from_version($version_array)
69
-    {
70
-        $version_string = $version_array['Core'];
71
-        if (version_compare($version_string, '4.6.0', '<=') && version_compare($version_string, '4.5.0', '>=')) {
38
+	/**
39
+	 * return EE_DMS_Core_4_6_0
40
+	 *
41
+	 * @param TableManager  $table_manager
42
+	 * @param TableAnalysis $table_analysis
43
+	 */
44
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
45
+	{
46
+		$this->_pretty_name = __("Data Update to Event Espresso 4.6.0", "event_espresso");
47
+		$this->_priority = 10;
48
+		$this->_migration_stages = array(
49
+			new EE_DMS_4_6_0_gateways(),
50
+			new EE_DMS_4_6_0_payment_method_currencies(),
51
+			new EE_DMS_4_6_0_question_types(),
52
+			new EE_DMS_4_6_0_country_system_question(),
53
+			new EE_DMS_4_6_0_state_system_question(),
54
+			new EE_DMS_4_6_0_billing_info(),
55
+			new EE_DMS_4_6_0_transactions(),
56
+			new EE_DMS_4_6_0_payments(),
57
+			new EE_DMS_4_6_0_invoice_settings(),
58
+		);
59
+		parent::__construct($table_manager, $table_analysis);
60
+	}
61
+
62
+
63
+
64
+	/**
65
+	 * @param array $version_array
66
+	 * @return bool
67
+	 */
68
+	public function can_migrate_from_version($version_array)
69
+	{
70
+		$version_string = $version_array['Core'];
71
+		if (version_compare($version_string, '4.6.0', '<=') && version_compare($version_string, '4.5.0', '>=')) {
72 72
 //			echo "$version_string can be migrated from";
73
-            return true;
74
-        } elseif ( ! $version_string) {
73
+			return true;
74
+		} elseif ( ! $version_string) {
75 75
 //			echo "no version string provided: $version_string";
76
-            //no version string provided... this must be pre 4.3
77
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
78
-        } else {
76
+			//no version string provided... this must be pre 4.3
77
+			return false;//changed mind. dont want people thinking they should migrate yet because they cant
78
+		} else {
79 79
 //			echo "$version_string doesnt apply";
80
-            return false;
81
-        }
82
-    }
80
+			return false;
81
+		}
82
+	}
83 83
 
84 84
 
85 85
 
86
-    /**
87
-     * @return bool
88
-     */
89
-    public function schema_changes_before_migration()
90
-    {
91
-        //relies on 4.1's EEH_Activation::create_table
92
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
93
-        $table_name = 'esp_answer';
94
-        $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
86
+	/**
87
+	 * @return bool
88
+	 */
89
+	public function schema_changes_before_migration()
90
+	{
91
+		//relies on 4.1's EEH_Activation::create_table
92
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
93
+		$table_name = 'esp_answer';
94
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
95 95
 					REG_ID INT UNSIGNED NOT NULL,
96 96
 					QST_ID INT UNSIGNED NOT NULL,
97 97
 					ANS_value TEXT NOT NULL,
98 98
 					PRIMARY KEY  (ANS_ID)";
99
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
100
-        $table_name = 'esp_attendee_meta';
101
-        $sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
99
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
100
+		$table_name = 'esp_attendee_meta';
101
+		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
102 102
 						ATT_ID BIGINT(20) UNSIGNED NOT NULL,
103 103
 						ATT_fname VARCHAR(45) NOT NULL,
104 104
 						ATT_lname VARCHAR(45) NOT	NULL,
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 								KEY ATT_fname (ATT_fname),
115 115
 								KEY ATT_lname (ATT_lname),
116 116
 								KEY ATT_email (ATT_email)";
117
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
118
-        $table_name = 'esp_country';
119
-        $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
117
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
118
+		$table_name = 'esp_country';
119
+		$sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
120 120
 					  CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL,
121 121
 					  RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL,
122 122
 					  CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL,
@@ -132,24 +132,24 @@  discard block
 block discarded – undo
132 132
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
133 133
 					  CNT_active TINYINT(1) DEFAULT '0',
134 134
 					  PRIMARY KEY  (CNT_ISO)";
135
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
136
-        $table_name = 'esp_currency';
137
-        $sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
135
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
136
+		$table_name = 'esp_currency';
137
+		$sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
138 138
 				CUR_single VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollar',
139 139
 				CUR_plural VARCHAR(45) COLLATE utf8_bin DEFAULT 'dollars',
140 140
 				CUR_sign VARCHAR(45) COLLATE utf8_bin DEFAULT '$',
141 141
 				CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2',
142 142
 				CUR_active TINYINT(1) DEFAULT '0',
143 143
 				PRIMARY KEY  (CUR_code)";
144
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
145
-        $table_name = 'esp_currency_payment_method';
146
-        $sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT,
144
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
145
+		$table_name = 'esp_currency_payment_method';
146
+		$sql = "CPM_ID INT(11) NOT NULL AUTO_INCREMENT,
147 147
 				CUR_code  VARCHAR(6) COLLATE utf8_bin NOT NULL,
148 148
 				PMD_ID INT(11) NOT NULL,
149 149
 				PRIMARY KEY  (CPM_ID)";
150
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
151
-        $table_name = 'esp_datetime';
152
-        $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
150
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
151
+		$table_name = 'esp_datetime';
152
+		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
153 153
 				  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
154 154
 				  DTT_name VARCHAR(255) NOT NULL DEFAULT '',
155 155
 				  DTT_description TEXT NOT NULL,
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 						PRIMARY KEY  (DTT_ID),
165 165
 						KEY EVT_ID (EVT_ID),
166 166
 						KEY DTT_is_primary (DTT_is_primary)";
167
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
168
-        $table_name = 'esp_event_meta';
169
-        $sql = "
167
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
168
+		$table_name = 'esp_event_meta';
169
+		$sql = "
170 170
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
171 171
 			EVT_ID BIGINT(20) UNSIGNED NOT NULL,
172 172
 			EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -181,31 +181,31 @@  discard block
 block discarded – undo
181 181
 			EVT_external_URL VARCHAR(200) NULL,
182 182
 			EVT_donations TINYINT(1) NULL,
183 183
 			PRIMARY KEY  (EVTM_ID)";
184
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
185
-        $table_name = 'esp_event_question_group';
186
-        $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
184
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
185
+		$table_name = 'esp_event_question_group';
186
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
187 187
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
188 188
 					QSG_ID INT UNSIGNED NOT NULL,
189 189
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
190 190
 					PRIMARY KEY  (EQG_ID)";
191
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
192
-        $table_name = 'esp_event_venue';
193
-        $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
191
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
192
+		$table_name = 'esp_event_venue';
193
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
194 194
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
195 195
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
196 196
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
197 197
 				PRIMARY KEY  (EVV_ID)";
198
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
199
-        $table_name = 'esp_extra_meta';
200
-        $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
198
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
199
+		$table_name = 'esp_extra_meta';
200
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
201 201
 				OBJ_ID INT(11) DEFAULT NULL,
202 202
 				EXM_type VARCHAR(45) DEFAULT NULL,
203 203
 				EXM_key VARCHAR(45) DEFAULT NULL,
204 204
 				EXM_value TEXT,
205 205
 				PRIMARY KEY  (EXM_ID)";
206
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
207
-        $table_name = 'esp_line_item';
208
-        $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
206
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
207
+		$table_name = 'esp_line_item';
208
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
209 209
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
210 210
 				TXN_ID INT(11) DEFAULT NULL,
211 211
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
 				OBJ_ID INT(11) DEFAULT NULL,
222 222
 				OBJ_type VARCHAR(45)DEFAULT NULL,
223 223
 				PRIMARY KEY  (LIN_ID)";
224
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
225
-        $table_name = 'esp_log';
226
-        $sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
224
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
225
+		$table_name = 'esp_log';
226
+		$sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
227 227
 				LOG_time DATETIME DEFAULT NULL,
228 228
 				OBJ_ID VARCHAR(45) DEFAULT NULL,
229 229
 				OBJ_type VARCHAR(45) DEFAULT NULL,
@@ -231,19 +231,19 @@  discard block
 block discarded – undo
231 231
 				LOG_message TEXT,
232 232
 				LOG_wp_user INT(11) DEFAULT NULL,
233 233
 				PRIMARY KEY  (LOG_ID)";
234
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
235
-        $table_name = 'esp_message_template';
236
-        $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
234
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
235
+		$table_name = 'esp_message_template';
236
+		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
237 237
 					GRP_ID INT(10) UNSIGNED NOT NULL,
238 238
 					MTP_context VARCHAR(50) NOT NULL,
239 239
 					MTP_template_field VARCHAR(30) NOT NULL,
240 240
 					MTP_content TEXT NOT NULL,
241 241
 					PRIMARY KEY  (MTP_ID),
242 242
 					KEY GRP_ID (GRP_ID)";
243
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
244
-        $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
245
-        $table_name = 'esp_message_template_group';
246
-        $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
243
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
244
+		$this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
245
+		$table_name = 'esp_message_template_group';
246
+		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
247 247
 					MTP_user_id INT(10) NOT NULL DEFAULT '1',
248 248
 					MTP_name VARCHAR(245) NOT NULL DEFAULT '',
249 249
 					MTP_description VARCHAR(245) NOT NULL DEFAULT '',
@@ -255,17 +255,17 @@  discard block
 block discarded – undo
255 255
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
256 256
 					PRIMARY KEY  (GRP_ID),
257 257
 					KEY MTP_user_id (MTP_user_id)";
258
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
259
-        $table_name = 'esp_event_message_template';
260
-        $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
258
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
259
+		$table_name = 'esp_event_message_template';
260
+		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
261 261
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
262 262
 					GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0,
263 263
 					PRIMARY KEY  (EMT_ID),
264 264
 					KEY EVT_ID (EVT_ID),
265 265
 					KEY GRP_ID (GRP_ID)";
266
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
267
-        $table_name = 'esp_payment';
268
-        $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
266
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
267
+		$table_name = 'esp_payment';
268
+		$sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
269 269
 					TXN_ID INT(10) UNSIGNED DEFAULT NULL,
270 270
 					STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL,
271 271
 					PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
 					PRIMARY KEY  (PAY_ID),
283 283
 					KEY TXN_ID (TXN_ID),
284 284
 					KEY PAY_timestamp (PAY_timestamp)";
285
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
286
-        $table_name = 'esp_payment_method';
287
-        $sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT,
285
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
286
+		$table_name = 'esp_payment_method';
287
+		$sql = "PMD_ID INT(11) NOT NULL AUTO_INCREMENT,
288 288
 				PMD_type VARCHAR(124) DEFAULT NULL,
289 289
 				PMD_name VARCHAR(255) DEFAULT NULL,
290 290
 				PMD_desc TEXT,
@@ -299,28 +299,28 @@  discard block
 block discarded – undo
299 299
 				PMD_scope VARCHAR(255) NULL DEFAULT 'frontend',
300 300
 				PRIMARY KEY  (PMD_ID),
301 301
 				UNIQUE KEY PMD_slug_UNIQUE (PMD_slug)";
302
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
303
-        $table_name = "esp_ticket_price";
304
-        $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
302
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
303
+		$table_name = "esp_ticket_price";
304
+		$sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
305 305
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
306 306
 					  PRC_ID INT(10) UNSIGNED NOT NULL,
307 307
 					  PRIMARY KEY  (TKP_ID)";
308
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
309
-        $table_name = "esp_datetime_ticket";
310
-        $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
308
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
309
+		$table_name = "esp_datetime_ticket";
310
+		$sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
311 311
 					  DTT_ID INT(10) UNSIGNED NOT NULL,
312 312
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
313 313
 					  PRIMARY KEY  (DTK_ID)";
314
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
315
-        $table_name = "esp_ticket_template";
316
-        $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
314
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
315
+		$table_name = "esp_ticket_template";
316
+		$sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
317 317
 					  TTM_name VARCHAR(45) NOT NULL,
318 318
 					  TTM_description TEXT,
319 319
 					  TTM_file VARCHAR(45),
320 320
 					  PRIMARY KEY  (TTM_ID)";
321
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
322
-        $table_name = 'esp_question';
323
-        $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
321
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
322
+		$table_name = 'esp_question';
323
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
324 324
 					QST_display_text TEXT NOT NULL,
325 325
 					QST_admin_label VARCHAR(255) NOT NULL,
326 326
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -332,25 +332,25 @@  discard block
 block discarded – undo
332 332
 					QST_wp_user BIGINT UNSIGNED NULL,
333 333
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
334 334
 					PRIMARY KEY  (QST_ID)';
335
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
336
-        $table_name = 'esp_question_group_question';
337
-        $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
335
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
336
+		$table_name = 'esp_question_group_question';
337
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
338 338
 					QSG_ID INT UNSIGNED NOT NULL,
339 339
 					QST_ID INT UNSIGNED NOT NULL,
340 340
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
341 341
 					PRIMARY KEY  (QGQ_ID) ";
342
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
343
-        $table_name = 'esp_question_option';
344
-        $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
342
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
343
+		$table_name = 'esp_question_option';
344
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
345 345
 					QSO_value VARCHAR(255) NOT NULL,
346 346
 					QSO_desc TEXT NOT NULL,
347 347
 					QST_ID INT UNSIGNED NOT NULL,
348 348
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
349 349
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
350 350
 					PRIMARY KEY  (QSO_ID)";
351
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
352
-        $table_name = 'esp_registration';
353
-        $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
351
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
352
+		$table_name = 'esp_registration';
353
+		$sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
354 354
 					  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
355 355
 					  ATT_ID BIGINT(20) UNSIGNED NOT NULL,
356 356
 					  TXN_ID INT(10) UNSIGNED NOT NULL,
@@ -373,25 +373,25 @@  discard block
 block discarded – undo
373 373
 					  KEY STS_ID (STS_ID),
374 374
 					  KEY REG_url_link (REG_url_link),
375 375
 					  KEY REG_code (REG_code)";
376
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
377
-        $table_name = 'esp_checkin';
378
-        $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
376
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
377
+		$table_name = 'esp_checkin';
378
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
379 379
 					REG_ID INT(10) UNSIGNED NOT NULL,
380 380
 					DTT_ID INT(10) UNSIGNED NOT NULL,
381 381
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
382 382
 					CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
383 383
 					PRIMARY KEY  (CHK_ID)";
384
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
385
-        $table_name = 'esp_state';
386
-        $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
384
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
385
+		$table_name = 'esp_state';
386
+		$sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
387 387
 					  CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
388 388
 					  STA_abbrev VARCHAR(24) COLLATE utf8_bin NOT NULL,
389 389
 					  STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL,
390 390
 					  STA_active TINYINT(1) DEFAULT '1',
391 391
 					  PRIMARY KEY  (STA_ID)";
392
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
393
-        $table_name = 'esp_status';
394
-        $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
392
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
393
+		$table_name = 'esp_status';
394
+		$sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
395 395
 					  STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL,
396 396
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
397 397
 					  STS_can_edit TINYINT(1) NOT NULL DEFAULT 0,
@@ -399,9 +399,9 @@  discard block
 block discarded – undo
399 399
 					  STS_open TINYINT(1) NOT NULL DEFAULT 1,
400 400
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
401 401
 					  KEY STS_type (STS_type)";
402
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
403
-        $table_name = 'esp_transaction';
404
-        $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
402
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
403
+		$table_name = 'esp_transaction';
404
+		$sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
405 405
 					  TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
406 406
 					  TXN_total DECIMAL(10,3) DEFAULT '0.00',
407 407
 					  TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00',
@@ -413,9 +413,9 @@  discard block
 block discarded – undo
413 413
 					  PRIMARY KEY  (TXN_ID),
414 414
 					  KEY TXN_timestamp (TXN_timestamp),
415 415
 					  KEY STS_ID (STS_ID)";
416
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
417
-        $table_name = 'esp_venue_meta';
418
-        $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
416
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
417
+		$table_name = 'esp_venue_meta';
418
+		$sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
419 419
 			VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
420 420
 			VNU_address VARCHAR(255) DEFAULT NULL,
421 421
 			VNU_address2 VARCHAR(255) DEFAULT NULL,
@@ -433,10 +433,10 @@  discard block
 block discarded – undo
433 433
 			PRIMARY KEY  (VNUM_ID),
434 434
 			KEY STA_ID (STA_ID),
435 435
 			KEY CNT_ISO (CNT_ISO)";
436
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
437
-        //modified tables
438
-        $table_name = "esp_price";
439
-        $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
436
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
437
+		//modified tables
438
+		$table_name = "esp_price";
439
+		$sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
440 440
 					  PRT_ID TINYINT(3) UNSIGNED NOT NULL,
441 441
 					  PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
442 442
 					  PRC_name VARCHAR(245) NOT NULL,
@@ -448,9 +448,9 @@  discard block
 block discarded – undo
448 448
 					  PRC_wp_user BIGINT UNSIGNED NULL,
449 449
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
450 450
 					  PRIMARY KEY  (PRC_ID)";
451
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
452
-        $table_name = "esp_price_type";
453
-        $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
451
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
452
+		$table_name = "esp_price_type";
453
+		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
454 454
 				  PRT_name VARCHAR(45) NOT NULL,
455 455
 				  PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
456 456
 				  PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0',
@@ -459,9 +459,9 @@  discard block
 block discarded – undo
459 459
 				  PRT_deleted TINYINT(1) NOT NULL DEFAULT '0',
460 460
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
461 461
 				  PRIMARY KEY  (PRT_ID)";
462
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
463
-        $table_name = "esp_ticket";
464
-        $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
462
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
463
+		$table_name = "esp_ticket";
464
+		$sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
465 465
 					  TTM_ID INT(10) UNSIGNED NOT NULL,
466 466
 					  TKT_name VARCHAR(245) NOT NULL DEFAULT '',
467 467
 					  TKT_description TEXT NOT NULL,
@@ -482,10 +482,10 @@  discard block
 block discarded – undo
482 482
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
483 483
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
484 484
 					  PRIMARY KEY  (TKT_ID)";
485
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
486
-        $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
487
-        $table_name = 'esp_question_group';
488
-        $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
485
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
486
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
487
+		$table_name = 'esp_question_group';
488
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
489 489
 					QSG_name VARCHAR(255) NOT NULL,
490 490
 					QSG_identifier VARCHAR(100) NOT NULL,
491 491
 					QSG_desc TEXT NULL,
@@ -497,119 +497,119 @@  discard block
 block discarded – undo
497 497
 					QSG_wp_user BIGINT UNSIGNED NULL,
498 498
 					PRIMARY KEY  (QSG_ID),
499 499
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
500
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
501
-        /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
502
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
503
-        //(because many need to convert old string states to foreign keys into the states table)
504
-        $script_4_1_defaults->insert_default_states();
505
-        $script_4_1_defaults->insert_default_countries();
506
-        /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
507
-        $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
508
-        $script_4_5_defaults->insert_default_price_types();
509
-        $script_4_5_defaults->insert_default_prices();
510
-        $script_4_5_defaults->insert_default_tickets();
511
-        //setting up the config wp option pretty well counts as a 'schema change', or at least should happen here
512
-        EE_Config::instance()->update_espresso_config(false, true);
513
-        $this->add_default_admin_only_payments();
514
-        $this->insert_default_currencies();
515
-        return true;
516
-    }
517
-
518
-
519
-
520
-    /**
521
-     * @return boolean
522
-     */
523
-    public function schema_changes_after_migration()
524
-    {
525
-        return true;
526
-    }
527
-
528
-
529
-
530
-    public function migration_page_hooks()
531
-    {
532
-    }
533
-
534
-
535
-
536
-    public function add_default_admin_only_payments()
537
-    {
538
-        global $wpdb;
539
-        $table_name = $wpdb->prefix . "esp_payment_method";
540
-        $user_id = EEH_Activation::get_default_creator_id();
541
-        if ($this->_get_table_analysis()->tableExists($table_name)) {
542
-            $SQL = "SELECT COUNT( * ) FROM $table_name";
543
-            $existing_payment_methods = $wpdb->get_var($SQL);
544
-            $default_admin_only_payment_methods = apply_filters(
545
-                'FHEE__EEH_Activation__add_default_admin_only_payments__default_admin_only_payment_methods',
546
-                array(
547
-                    __("Bank", 'event_espresso')        => __("Bank Draft", 'event_espresso'),
548
-                    __("Cash", 'event_espresso')        => __("Cash Delivered Physically", 'event_espresso'),
549
-                    __("Check", 'event_espresso')       => __("Paper Check", 'event_espresso'),
550
-                    __("Credit Card", 'event_espresso') => __("Offline Credit Card Payment", 'event_espresso'),
551
-                    __("Debit Card", 'event_espresso')  => __("Offline Debit Payment", 'event_espresso'),
552
-                    __("Invoice", 'event_espresso')     => __("Invoice received with monies included",
553
-                        'event_espresso'),
554
-                    __("Money Order", 'event_espresso') => '',
555
-                    __("Paypal", 'event_espresso')      => __("Paypal eCheck, Invoice, etc", 'event_espresso'),
556
-                    __('Other', 'event_espresso')       => __('Other method of payment', 'event_espresso'),
557
-                ));
558
-            //make sure we hae payment method records for the following
559
-            //so admins can record payments for them from the admin page
560
-            foreach ($default_admin_only_payment_methods as $nicename => $description) {
561
-                $slug = sanitize_key($nicename);
562
-                //check that such a payment method exists
563
-                $exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug));
564
-                if ( ! $exists) {
565
-                    $values = array(
566
-                        'PMD_type'       => 'Admin_Only',
567
-                        'PMD_name'       => $nicename,
568
-                        'PMD_admin_name' => $nicename,
569
-                        'PMD_admin_desc' => $description,
570
-                        'PMD_slug'       => $slug,
571
-                        'PMD_wp_user'    => $user_id,
572
-                        'PMD_scope'      => serialize(array('ADMIN')),
573
-                    );
574
-                    $success = $wpdb->insert(
575
-                        $table_name,
576
-                        $values,
577
-                        array(
578
-                            '%s',//PMD_type
579
-                            '%s',//PMD_name
580
-                            '%s',//PMD_admin_name
581
-                            '%s',//PMD_admin_desc
582
-                            '%s',//PMD_slug
583
-                            '%d',//PMD_wp_user
584
-                            '%s',//PMD_scope
585
-                        )
586
-                    );
587
-                    if ( ! $success) {
588
-                        $this->add_error(sprintf(__("Could not insert new admin-only payment method with values %s during migration",
589
-                            "event_espresso"), $this->_json_encode($values)));
590
-                    }
591
-                }
592
-            }
593
-        }
594
-    }
595
-
596
-
597
-
598
-    /**
599
-     * insert_default_countries
600
-     *
601
-     * @static
602
-     * @return void
603
-     */
604
-    public function insert_default_currencies()
605
-    {
606
-        global $wpdb;
607
-        $currency_table = $wpdb->prefix . "esp_currency";
608
-        if ($this->_get_table_analysis()->tableExists($currency_table)) {
609
-            $SQL = "SELECT COUNT('CUR_code') FROM $currency_table";
610
-            $countries = $wpdb->get_var($SQL);
611
-            if ( ! $countries) {
612
-                $SQL = "INSERT INTO $currency_table
500
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
501
+		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
502
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
503
+		//(because many need to convert old string states to foreign keys into the states table)
504
+		$script_4_1_defaults->insert_default_states();
505
+		$script_4_1_defaults->insert_default_countries();
506
+		/** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
507
+		$script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
508
+		$script_4_5_defaults->insert_default_price_types();
509
+		$script_4_5_defaults->insert_default_prices();
510
+		$script_4_5_defaults->insert_default_tickets();
511
+		//setting up the config wp option pretty well counts as a 'schema change', or at least should happen here
512
+		EE_Config::instance()->update_espresso_config(false, true);
513
+		$this->add_default_admin_only_payments();
514
+		$this->insert_default_currencies();
515
+		return true;
516
+	}
517
+
518
+
519
+
520
+	/**
521
+	 * @return boolean
522
+	 */
523
+	public function schema_changes_after_migration()
524
+	{
525
+		return true;
526
+	}
527
+
528
+
529
+
530
+	public function migration_page_hooks()
531
+	{
532
+	}
533
+
534
+
535
+
536
+	public function add_default_admin_only_payments()
537
+	{
538
+		global $wpdb;
539
+		$table_name = $wpdb->prefix . "esp_payment_method";
540
+		$user_id = EEH_Activation::get_default_creator_id();
541
+		if ($this->_get_table_analysis()->tableExists($table_name)) {
542
+			$SQL = "SELECT COUNT( * ) FROM $table_name";
543
+			$existing_payment_methods = $wpdb->get_var($SQL);
544
+			$default_admin_only_payment_methods = apply_filters(
545
+				'FHEE__EEH_Activation__add_default_admin_only_payments__default_admin_only_payment_methods',
546
+				array(
547
+					__("Bank", 'event_espresso')        => __("Bank Draft", 'event_espresso'),
548
+					__("Cash", 'event_espresso')        => __("Cash Delivered Physically", 'event_espresso'),
549
+					__("Check", 'event_espresso')       => __("Paper Check", 'event_espresso'),
550
+					__("Credit Card", 'event_espresso') => __("Offline Credit Card Payment", 'event_espresso'),
551
+					__("Debit Card", 'event_espresso')  => __("Offline Debit Payment", 'event_espresso'),
552
+					__("Invoice", 'event_espresso')     => __("Invoice received with monies included",
553
+						'event_espresso'),
554
+					__("Money Order", 'event_espresso') => '',
555
+					__("Paypal", 'event_espresso')      => __("Paypal eCheck, Invoice, etc", 'event_espresso'),
556
+					__('Other', 'event_espresso')       => __('Other method of payment', 'event_espresso'),
557
+				));
558
+			//make sure we hae payment method records for the following
559
+			//so admins can record payments for them from the admin page
560
+			foreach ($default_admin_only_payment_methods as $nicename => $description) {
561
+				$slug = sanitize_key($nicename);
562
+				//check that such a payment method exists
563
+				$exists = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $table_name WHERE PMD_slug = %s", $slug));
564
+				if ( ! $exists) {
565
+					$values = array(
566
+						'PMD_type'       => 'Admin_Only',
567
+						'PMD_name'       => $nicename,
568
+						'PMD_admin_name' => $nicename,
569
+						'PMD_admin_desc' => $description,
570
+						'PMD_slug'       => $slug,
571
+						'PMD_wp_user'    => $user_id,
572
+						'PMD_scope'      => serialize(array('ADMIN')),
573
+					);
574
+					$success = $wpdb->insert(
575
+						$table_name,
576
+						$values,
577
+						array(
578
+							'%s',//PMD_type
579
+							'%s',//PMD_name
580
+							'%s',//PMD_admin_name
581
+							'%s',//PMD_admin_desc
582
+							'%s',//PMD_slug
583
+							'%d',//PMD_wp_user
584
+							'%s',//PMD_scope
585
+						)
586
+					);
587
+					if ( ! $success) {
588
+						$this->add_error(sprintf(__("Could not insert new admin-only payment method with values %s during migration",
589
+							"event_espresso"), $this->_json_encode($values)));
590
+					}
591
+				}
592
+			}
593
+		}
594
+	}
595
+
596
+
597
+
598
+	/**
599
+	 * insert_default_countries
600
+	 *
601
+	 * @static
602
+	 * @return void
603
+	 */
604
+	public function insert_default_currencies()
605
+	{
606
+		global $wpdb;
607
+		$currency_table = $wpdb->prefix . "esp_currency";
608
+		if ($this->_get_table_analysis()->tableExists($currency_table)) {
609
+			$SQL = "SELECT COUNT('CUR_code') FROM $currency_table";
610
+			$countries = $wpdb->get_var($SQL);
611
+			if ( ! $countries) {
612
+				$SQL = "INSERT INTO $currency_table
613 613
 				( CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active) VALUES
614 614
 				( 'EUR',  'Euro',  'Euros',  '€',  2,1),
615 615
 				( 'AED',  'Dirham',  'Dirhams', 'د.إ',2,1),
@@ -763,10 +763,10 @@  discard block
 block discarded – undo
763 763
 				( 'ZAR',  'Rand',  'Rands',  'R',  2,1),
764 764
 				( 'ZMK',  'Kwacha',  'Kwachas',  '',  2,1),
765 765
 				( 'ZWD', 'Dollar', 'Dollars', 'Z$', 2,1);";
766
-                $wpdb->query($SQL);
767
-            }
768
-        }
769
-    }
766
+				$wpdb->query($SQL);
767
+			}
768
+		}
769
+	}
770 770
 
771 771
 }
772 772
 
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_8_0.dms.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 //unfortunately, this needs to be done upon INCLUSION of this file,
15 15
 //instead of construction, because it only gets constructed on first page load
16 16
 //(all other times it gets resurrected from a wordpress option)
17
-$stages = glob(EE_CORE . 'data_migration_scripts/4_8_0_stages/*');
17
+$stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*');
18 18
 $class_to_filepath = array();
19 19
 foreach ($stages as $filepath) {
20 20
     $matches = array();
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         } elseif ( ! $version_string) {
76 76
 //			echo "no version string provided: $version_string";
77 77
             //no version string provided... this must be pre 4.3
78
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
78
+            return false; //changed mind. dont want people thinking they should migrate yet because they cant
79 79
         } else {
80 80
 //			echo "$version_string doesnt apply";
81 81
             return false;
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function schema_changes_before_migration()
101 101
     {
102
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
102
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
103 103
         $now_in_mysql = current_time('mysql', true);
104
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
104
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
105 105
         $table_name = 'esp_answer';
106 106
         $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
107 107
 					REG_ID int(10) unsigned NOT NULL,
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
             ),
698 698
         );
699 699
         global $wpdb;
700
-        $country_table = $wpdb->prefix . "esp_country";
700
+        $country_table = $wpdb->prefix."esp_country";
701 701
         $country_format = array(
702 702
             "CNT_ISO"         => '%s',
703 703
             "CNT_ISO3"        => '%s',
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
             array('RSD', 'Dinar', 'Dinars', '', 3, 1),
744 744
         );
745 745
         global $wpdb;
746
-        $currency_table = $wpdb->prefix . "esp_currency";
746
+        $currency_table = $wpdb->prefix."esp_currency";
747 747
         $currency_format = array(
748 748
             "CUR_code"    => '%s',
749 749
             "CUR_single"  => '%s',
Please login to merge, or discard this patch.
Indentation   +355 added lines, -355 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 $stages = glob(EE_CORE . 'data_migration_scripts/4_8_0_stages/*');
18 18
 $class_to_filepath = array();
19 19
 foreach ($stages as $filepath) {
20
-    $matches = array();
21
-    preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches);
22
-    $class_to_filepath[$matches[1]] = $filepath;
20
+	$matches = array();
21
+	preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches);
22
+	$class_to_filepath[$matches[1]] = $filepath;
23 23
 }
24 24
 //give addons a chance to autoload their stages too
25 25
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath);
@@ -38,71 +38,71 @@  discard block
 block discarded – undo
38 38
 class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base
39 39
 {
40 40
 
41
-    /**
42
-     * return EE_DMS_Core_4_8_0
43
-     *
44
-     * @param TableManager  $table_manager
45
-     * @param TableAnalysis $table_analysis
46
-     */
47
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
48
-    {
49
-        $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.8.0", "event_espresso");
50
-        $this->_priority = 10;
51
-        $this->_migration_stages = array(
52
-            new EE_DMS_4_8_0_pretax_totals(),
53
-            new EE_DMS_4_8_0_event_subtotals(),
54
-        );
55
-        parent::__construct($table_manager, $table_analysis);
56
-    }
41
+	/**
42
+	 * return EE_DMS_Core_4_8_0
43
+	 *
44
+	 * @param TableManager  $table_manager
45
+	 * @param TableAnalysis $table_analysis
46
+	 */
47
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
48
+	{
49
+		$this->_pretty_name = esc_html__("Data Update to Event Espresso 4.8.0", "event_espresso");
50
+		$this->_priority = 10;
51
+		$this->_migration_stages = array(
52
+			new EE_DMS_4_8_0_pretax_totals(),
53
+			new EE_DMS_4_8_0_event_subtotals(),
54
+		);
55
+		parent::__construct($table_manager, $table_analysis);
56
+	}
57 57
 
58 58
 
59 59
 
60
-    /**
61
-     * Because this is being done at basically the same time as the MER-ready branch
62
-     * of core, it's possible people might have installed MEr-ready branch first,
63
-     * and then this one, in which case we still want to perform this migration,
64
-     * even though the version might not have increased
65
-     *
66
-     * @param array $version_array
67
-     * @return bool
68
-     */
69
-    public function can_migrate_from_version($version_array)
70
-    {
71
-        $version_string = $version_array['Core'];
72
-        if (version_compare($version_string, '4.8.0', '<=') && version_compare($version_string, '4.7.0', '>=')) {
60
+	/**
61
+	 * Because this is being done at basically the same time as the MER-ready branch
62
+	 * of core, it's possible people might have installed MEr-ready branch first,
63
+	 * and then this one, in which case we still want to perform this migration,
64
+	 * even though the version might not have increased
65
+	 *
66
+	 * @param array $version_array
67
+	 * @return bool
68
+	 */
69
+	public function can_migrate_from_version($version_array)
70
+	{
71
+		$version_string = $version_array['Core'];
72
+		if (version_compare($version_string, '4.8.0', '<=') && version_compare($version_string, '4.7.0', '>=')) {
73 73
 //			echo "$version_string can be migrated from";
74
-            return true;
75
-        } elseif ( ! $version_string) {
74
+			return true;
75
+		} elseif ( ! $version_string) {
76 76
 //			echo "no version string provided: $version_string";
77
-            //no version string provided... this must be pre 4.3
78
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
79
-        } else {
77
+			//no version string provided... this must be pre 4.3
78
+			return false;//changed mind. dont want people thinking they should migrate yet because they cant
79
+		} else {
80 80
 //			echo "$version_string doesnt apply";
81
-            return false;
82
-        }
83
-    }
81
+			return false;
82
+		}
83
+	}
84 84
 
85 85
 
86 86
 
87
-    /**
88
-     * @return bool
89
-     */
90
-    public function schema_changes_before_migration()
91
-    {
92
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
93
-        $now_in_mysql = current_time('mysql', true);
94
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
95
-        $table_name = 'esp_answer';
96
-        $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
87
+	/**
88
+	 * @return bool
89
+	 */
90
+	public function schema_changes_before_migration()
91
+	{
92
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
93
+		$now_in_mysql = current_time('mysql', true);
94
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
95
+		$table_name = 'esp_answer';
96
+		$sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
97 97
 					REG_ID int(10) unsigned NOT NULL,
98 98
 					QST_ID int(10) unsigned NOT NULL,
99 99
 					ANS_value text NOT NULL,
100 100
 					PRIMARY KEY  (ANS_ID),
101 101
 					KEY REG_ID (REG_ID),
102 102
 					KEY QST_ID (QST_ID)";
103
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
104
-        $table_name = 'esp_attendee_meta';
105
-        $sql = "ATTM_ID int(10) unsigned NOT	NULL AUTO_INCREMENT,
103
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
104
+		$table_name = 'esp_attendee_meta';
105
+		$sql = "ATTM_ID int(10) unsigned NOT	NULL AUTO_INCREMENT,
106 106
 						ATT_ID bigint(20) unsigned NOT NULL,
107 107
 						ATT_fname varchar(45) NOT NULL,
108 108
 						ATT_lname varchar(45) NOT	NULL,
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 								KEY ATT_email (ATT_email),
120 120
 								KEY ATT_lname (ATT_lname),
121 121
 								KEY ATT_fname (ATT_fname)";
122
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
123
-        $table_name = 'esp_country';
124
-        $sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL,
122
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
123
+		$table_name = 'esp_country';
124
+		$sql = "CNT_ISO varchar(2) collate utf8_bin NOT NULL,
125 125
 					  CNT_ISO3 varchar(3) collate utf8_bin NOT NULL,
126 126
 					  RGN_ID tinyint(3) unsigned DEFAULT NULL,
127 127
 					  CNT_name varchar(45) collate utf8_bin NOT NULL,
@@ -137,25 +137,25 @@  discard block
 block discarded – undo
137 137
 					  CNT_is_EU tinyint(1) DEFAULT '0',
138 138
 					  CNT_active tinyint(1) DEFAULT '0',
139 139
 					  PRIMARY KEY  (CNT_ISO)";
140
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
141
-        $table_name = 'esp_currency';
142
-        $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL,
140
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
141
+		$table_name = 'esp_currency';
142
+		$sql = "CUR_code varchar(6) collate utf8_bin NOT NULL,
143 143
 				CUR_single varchar(45) collate utf8_bin DEFAULT 'dollar',
144 144
 				CUR_plural varchar(45) collate utf8_bin DEFAULT 'dollars',
145 145
 				CUR_sign varchar(45) collate utf8_bin DEFAULT '$',
146 146
 				CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2',
147 147
 				CUR_active tinyint(1) DEFAULT '0',
148 148
 				PRIMARY KEY  (CUR_code)";
149
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
150
-        $table_name = 'esp_currency_payment_method';
151
-        $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT,
149
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
150
+		$table_name = 'esp_currency_payment_method';
151
+		$sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT,
152 152
 				CUR_code varchar(6) collate utf8_bin NOT NULL,
153 153
 				PMD_ID int(11) NOT NULL,
154 154
 				PRIMARY KEY  (CPM_ID),
155 155
 				KEY PMD_ID (PMD_ID)";
156
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
157
-        $table_name = 'esp_datetime';
158
-        $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
156
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
157
+		$table_name = 'esp_datetime';
158
+		$sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
159 159
 				  EVT_ID bigint(20) unsigned NOT NULL,
160 160
 				  DTT_name varchar(255) NOT NULL DEFAULT '',
161 161
 				  DTT_description text NOT NULL,
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
 						KEY DTT_EVT_start (DTT_EVT_start),
172 172
 						KEY EVT_ID (EVT_ID),
173 173
 						KEY DTT_is_primary (DTT_is_primary)";
174
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
175
-        $table_name = 'esp_event_meta';
176
-        $sql = "
174
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
175
+		$table_name = 'esp_event_meta';
176
+		$sql = "
177 177
 			EVTM_ID int(10) NOT NULL AUTO_INCREMENT,
178 178
 			EVT_ID bigint(20) unsigned NOT NULL,
179 179
 			EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1,
@@ -189,34 +189,34 @@  discard block
 block discarded – undo
189 189
 			EVT_donations tinyint(1) NULL,
190 190
 			PRIMARY KEY  (EVTM_ID),
191 191
 			KEY EVT_ID (EVT_ID)";
192
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
193
-        $table_name = 'esp_event_question_group';
194
-        $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
192
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
193
+		$table_name = 'esp_event_question_group';
194
+		$sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
195 195
 					EVT_ID bigint(20) unsigned NOT NULL,
196 196
 					QSG_ID int(10) unsigned NOT NULL,
197 197
 					EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
198 198
 					PRIMARY KEY  (EQG_ID),
199 199
 					KEY EVT_ID (EVT_ID),
200 200
 					KEY QSG_ID (QSG_ID)";
201
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
202
-        $table_name = 'esp_event_venue';
203
-        $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
201
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
202
+		$table_name = 'esp_event_venue';
203
+		$sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT,
204 204
 				EVT_ID bigint(20) unsigned NOT NULL,
205 205
 				VNU_ID bigint(20) unsigned NOT NULL,
206 206
 				EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0,
207 207
 				PRIMARY KEY  (EVV_ID)";
208
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
209
-        $table_name = 'esp_extra_meta';
210
-        $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
208
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
209
+		$table_name = 'esp_extra_meta';
210
+		$sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT,
211 211
 				OBJ_ID int(11) DEFAULT NULL,
212 212
 				EXM_type varchar(45) DEFAULT NULL,
213 213
 				EXM_key varchar(45) DEFAULT NULL,
214 214
 				EXM_value text,
215 215
 				PRIMARY KEY  (EXM_ID),
216 216
 				KEY EXM_type (EXM_type,OBJ_ID,EXM_key)";
217
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
218
-        $table_name = 'esp_extra_join';
219
-        $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
217
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
218
+		$table_name = 'esp_extra_join';
219
+		$sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT,
220 220
 				EXJ_first_model_id varchar(6) NOT NULL,
221 221
 				EXJ_first_model_name varchar(20) NOT NULL,
222 222
 				EXJ_second_model_id varchar(6) NOT NULL,
@@ -224,9 +224,9 @@  discard block
 block discarded – undo
224 224
 				PRIMARY KEY  (EXJ_ID),
225 225
 				KEY first_model (EXJ_first_model_name,EXJ_first_model_id),
226 226
 				KEY second_model (EXJ_second_model_name,EXJ_second_model_id)";
227
-        $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
228
-        $table_name = 'esp_line_item';
229
-        $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
227
+		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
228
+		$table_name = 'esp_line_item';
229
+		$sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT,
230 230
 				LIN_code varchar(245) NOT NULL DEFAULT '',
231 231
 				TXN_ID int(11) DEFAULT NULL,
232 232
 				LIN_name varchar(245) NOT NULL DEFAULT '',
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
 				PRIMARY KEY  (LIN_ID),
246 246
 				KEY LIN_code (LIN_code(191)),
247 247
 				KEY TXN_ID (TXN_ID)";
248
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
249
-        $table_name = 'esp_log';
250
-        $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
248
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
249
+		$table_name = 'esp_log';
250
+		$sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT,
251 251
 				LOG_time datetime DEFAULT NULL,
252 252
 				OBJ_ID varchar(45) DEFAULT NULL,
253 253
 				OBJ_type varchar(45) DEFAULT NULL,
@@ -258,18 +258,18 @@  discard block
 block discarded – undo
258 258
 				KEY LOG_time (LOG_time),
259 259
 				KEY OBJ (OBJ_type,OBJ_ID),
260 260
 				KEY LOG_type (LOG_type)";
261
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
262
-        $table_name = 'esp_message_template';
263
-        $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
261
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
262
+		$table_name = 'esp_message_template';
263
+		$sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
264 264
 					GRP_ID int(10) unsigned NOT NULL,
265 265
 					MTP_context varchar(50) NOT NULL,
266 266
 					MTP_template_field varchar(30) NOT NULL,
267 267
 					MTP_content text NOT NULL,
268 268
 					PRIMARY KEY  (MTP_ID),
269 269
 					KEY GRP_ID (GRP_ID)";
270
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
271
-        $table_name = 'esp_message_template_group';
272
-        $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
270
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
271
+		$table_name = 'esp_message_template_group';
272
+		$sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
273 273
 					MTP_user_id int(10) NOT NULL DEFAULT '1',
274 274
 					MTP_name varchar(245) NOT NULL DEFAULT '',
275 275
 					MTP_description varchar(245) NOT NULL DEFAULT '',
@@ -281,17 +281,17 @@  discard block
 block discarded – undo
281 281
 					MTP_is_active tinyint(1) NOT NULL DEFAULT '1',
282 282
 					PRIMARY KEY  (GRP_ID),
283 283
 					KEY MTP_user_id (MTP_user_id)";
284
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
285
-        $table_name = 'esp_event_message_template';
286
-        $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
284
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
285
+		$table_name = 'esp_event_message_template';
286
+		$sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
287 287
 					EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0,
288 288
 					GRP_ID int(10) unsigned NOT NULL DEFAULT 0,
289 289
 					PRIMARY KEY  (EMT_ID),
290 290
 					KEY EVT_ID (EVT_ID),
291 291
 					KEY GRP_ID (GRP_ID)";
292
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
293
-        $table_name = 'esp_payment';
294
-        $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
292
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
293
+		$table_name = 'esp_payment';
294
+		$sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
295 295
 					TXN_ID int(10) unsigned DEFAULT NULL,
296 296
 					STS_ID varchar(3) collate utf8_bin DEFAULT NULL,
297 297
 					PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -308,9 +308,9 @@  discard block
 block discarded – undo
308 308
 					PRIMARY KEY  (PAY_ID),
309 309
 					KEY PAY_timestamp (PAY_timestamp),
310 310
 					KEY TXN_ID (TXN_ID)";
311
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
312
-        $table_name = 'esp_payment_method';
313
-        $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT,
311
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
312
+		$table_name = 'esp_payment_method';
313
+		$sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT,
314 314
 				PMD_type varchar(124) DEFAULT NULL,
315 315
 				PMD_name varchar(255) DEFAULT NULL,
316 316
 				PMD_desc text,
@@ -326,32 +326,32 @@  discard block
 block discarded – undo
326 326
 				PRIMARY KEY  (PMD_ID),
327 327
 				UNIQUE KEY PMD_slug_UNIQUE (PMD_slug),
328 328
 				KEY PMD_type (PMD_type)";
329
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
330
-        $table_name = "esp_ticket_price";
331
-        $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
329
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
330
+		$table_name = "esp_ticket_price";
331
+		$sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
332 332
 					  TKT_ID int(10) unsigned NOT NULL,
333 333
 					  PRC_ID int(10) unsigned NOT NULL,
334 334
 					  PRIMARY KEY  (TKP_ID),
335 335
 					  KEY TKT_ID (TKT_ID),
336 336
 					  KEY PRC_ID (PRC_ID)";
337
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
338
-        $table_name = "esp_datetime_ticket";
339
-        $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
337
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
338
+		$table_name = "esp_datetime_ticket";
339
+		$sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
340 340
 					  DTT_ID int(10) unsigned NOT NULL,
341 341
 					  TKT_ID int(10) unsigned NOT NULL,
342 342
 					  PRIMARY KEY  (DTK_ID),
343 343
 					  KEY DTT_ID (DTT_ID),
344 344
 					  KEY TKT_ID (TKT_ID)";
345
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
346
-        $table_name = "esp_ticket_template";
347
-        $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
345
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
346
+		$table_name = "esp_ticket_template";
347
+		$sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
348 348
 					  TTM_name varchar(45) NOT NULL,
349 349
 					  TTM_description text,
350 350
 					  TTM_file varchar(45),
351 351
 					  PRIMARY KEY  (TTM_ID)";
352
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
353
-        $table_name = 'esp_question';
354
-        $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
352
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
353
+		$table_name = 'esp_question';
354
+		$sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
355 355
 					QST_display_text text NOT NULL,
356 356
 					QST_admin_label varchar(255) NOT NULL,
357 357
 					QST_system varchar(25) NOT NULL DEFAULT "",
@@ -365,18 +365,18 @@  discard block
 block discarded – undo
365 365
 					QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0,
366 366
 					PRIMARY KEY  (QST_ID),
367 367
 					KEY QST_order (QST_order)';
368
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
369
-        $table_name = 'esp_question_group_question';
370
-        $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
368
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
369
+		$table_name = 'esp_question_group_question';
370
+		$sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
371 371
 					QSG_ID int(10) unsigned NOT NULL,
372 372
 					QST_ID int(10) unsigned NOT NULL,
373 373
 					QGQ_order int(10) unsigned NOT NULL DEFAULT 0,
374 374
 					PRIMARY KEY  (QGQ_ID),
375 375
 					KEY QST_ID (QST_ID),
376 376
 					KEY QSG_ID_order (QSG_ID,QGQ_order)";
377
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
378
-        $table_name = 'esp_question_option';
379
-        $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
377
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
378
+		$table_name = 'esp_question_option';
379
+		$sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
380 380
 					QSO_value varchar(255) NOT NULL,
381 381
 					QSO_desc text NOT NULL,
382 382
 					QST_ID int(10) unsigned NOT NULL,
@@ -386,9 +386,9 @@  discard block
 block discarded – undo
386 386
 					PRIMARY KEY  (QSO_ID),
387 387
 					KEY QST_ID (QST_ID),
388 388
 					KEY QSO_order (QSO_order)";
389
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
390
-        $table_name = 'esp_registration';
391
-        $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
389
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
390
+		$table_name = 'esp_registration';
391
+		$sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
392 392
 					  EVT_ID bigint(20) unsigned NOT NULL,
393 393
 					  ATT_ID bigint(20) unsigned NOT NULL,
394 394
 					  TXN_ID int(10) unsigned NOT NULL,
@@ -412,18 +412,18 @@  discard block
 block discarded – undo
412 412
 					  KEY TKT_ID (TKT_ID),
413 413
 					  KEY EVT_ID (EVT_ID),
414 414
 					  KEY STS_ID (STS_ID)";
415
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
416
-        $table_name = 'esp_registration_payment';
417
-        $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
415
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
416
+		$table_name = 'esp_registration_payment';
417
+		$sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
418 418
 					  REG_ID int(10) unsigned NOT NULL,
419 419
 					  PAY_ID int(10) unsigned NULL,
420 420
 					  RPY_amount decimal(10,3) NOT NULL DEFAULT '0.00',
421 421
 					  PRIMARY KEY  (RPY_ID),
422 422
 					  KEY REG_ID (REG_ID),
423 423
 					  KEY PAY_ID (PAY_ID)";
424
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
425
-        $table_name = 'esp_checkin';
426
-        $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
424
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
425
+		$table_name = 'esp_checkin';
426
+		$sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
427 427
 					REG_ID int(10) unsigned NOT NULL,
428 428
 					DTT_ID int(10) unsigned NOT NULL,
429 429
 					CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1,
@@ -431,9 +431,9 @@  discard block
 block discarded – undo
431 431
 					PRIMARY KEY  (CHK_ID),
432 432
 					KEY REG_ID (REG_ID),
433 433
 					KEY DTT_ID (DTT_ID)";
434
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
435
-        $table_name = 'esp_state';
436
-        $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT,
434
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
435
+		$table_name = 'esp_state';
436
+		$sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT,
437 437
 					  CNT_ISO varchar(2) collate utf8_bin NOT NULL,
438 438
 					  STA_abbrev varchar(24) collate utf8_bin NOT NULL,
439 439
 					  STA_name varchar(100) collate utf8_bin NOT NULL,
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
 					  PRIMARY KEY  (STA_ID),
442 442
 					  KEY STA_abbrev (STA_abbrev),
443 443
 					  KEY CNT_ISO (CNT_ISO)";
444
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
445
-        $table_name = 'esp_status';
446
-        $sql = "STS_ID varchar(3) NOT NULL,
444
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
445
+		$table_name = 'esp_status';
446
+		$sql = "STS_ID varchar(3) NOT NULL,
447 447
 					  STS_code varchar(45) NOT NULL,
448 448
 					  STS_type varchar(45) NOT NULL,
449 449
 					  STS_can_edit tinyint(1) NOT NULL DEFAULT 0,
@@ -451,9 +451,9 @@  discard block
 block discarded – undo
451 451
 					  STS_open tinyint(1) NOT NULL DEFAULT 1,
452 452
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
453 453
 					  KEY STS_type (STS_type)";
454
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
455
-        $table_name = 'esp_transaction';
456
-        $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
454
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
455
+		$table_name = 'esp_transaction';
456
+		$sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
457 457
 					  TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
458 458
 					  TXN_total decimal(10,3) DEFAULT '0.00',
459 459
 					  TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00',
@@ -465,9 +465,9 @@  discard block
 block discarded – undo
465 465
 					  PRIMARY KEY  (TXN_ID),
466 466
 					  KEY TXN_timestamp (TXN_timestamp),
467 467
 					  KEY STS_ID (STS_ID)";
468
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
469
-        $table_name = 'esp_venue_meta';
470
-        $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT,
468
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
469
+		$table_name = 'esp_venue_meta';
470
+		$sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT,
471 471
 			VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0,
472 472
 			VNU_address varchar(255) DEFAULT NULL,
473 473
 			VNU_address2 varchar(255) DEFAULT NULL,
@@ -486,10 +486,10 @@  discard block
 block discarded – undo
486 486
 			KEY VNU_ID (VNU_ID),
487 487
 			KEY STA_ID (STA_ID),
488 488
 			KEY CNT_ISO (CNT_ISO)";
489
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
490
-        //modified tables
491
-        $table_name = "esp_price";
492
-        $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
489
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
490
+		//modified tables
491
+		$table_name = "esp_price";
492
+		$sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
493 493
 					  PRT_ID tinyint(3) unsigned NOT NULL,
494 494
 					  PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00',
495 495
 					  PRC_name varchar(245) NOT NULL,
@@ -502,9 +502,9 @@  discard block
 block discarded – undo
502 502
 					  PRC_parent int(10) unsigned DEFAULT 0,
503 503
 					  PRIMARY KEY  (PRC_ID),
504 504
 					  KEY PRT_ID (PRT_ID)";
505
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
506
-        $table_name = "esp_price_type";
507
-        $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
505
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
506
+		$table_name = "esp_price_type";
507
+		$sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
508 508
 				  PRT_name varchar(45) NOT NULL,
509 509
 				  PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1',
510 510
 				  PRT_is_percent tinyint(1) NOT NULL DEFAULT '0',
@@ -513,9 +513,9 @@  discard block
 block discarded – undo
513 513
 				  PRT_deleted tinyint(1) NOT NULL DEFAULT '0',
514 514
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
515 515
 				  PRIMARY KEY  (PRT_ID)";
516
-        $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
517
-        $table_name = "esp_ticket";
518
-        $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
516
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB ');
517
+		$table_name = "esp_ticket";
518
+		$sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
519 519
 					  TTM_ID int(10) unsigned NOT NULL,
520 520
 					  TKT_name varchar(245) NOT NULL DEFAULT '',
521 521
 					  TKT_description text NOT NULL,
@@ -537,9 +537,9 @@  discard block
 block discarded – undo
537 537
 					  TKT_deleted tinyint(1) NOT NULL DEFAULT '0',
538 538
 					  PRIMARY KEY  (TKT_ID),
539 539
 					  KEY TKT_start_date (TKT_start_date)";
540
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
541
-        $table_name = 'esp_question_group';
542
-        $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
540
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
541
+		$table_name = 'esp_question_group';
542
+		$sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT,
543 543
 					QSG_name varchar(255) NOT NULL,
544 544
 					QSG_identifier varchar(100) NOT NULL,
545 545
 					QSG_desc text NULL,
@@ -552,221 +552,221 @@  discard block
 block discarded – undo
552 552
 					PRIMARY KEY  (QSG_ID),
553 553
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
554 554
 					KEY QSG_order (QSG_order)';
555
-        $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
556
-        /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
557
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
558
-        //(because many need to convert old string states to foreign keys into the states table)
559
-        $script_4_1_defaults->insert_default_states();
560
-        $script_4_1_defaults->insert_default_countries();
561
-        /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
562
-        $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
563
-        $script_4_5_defaults->insert_default_price_types();
564
-        $script_4_5_defaults->insert_default_prices();
565
-        $script_4_5_defaults->insert_default_tickets();
566
-        /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
567
-        $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
568
-        $script_4_6_defaults->add_default_admin_only_payments();
569
-        $script_4_6_defaults->insert_default_currencies();
570
-        $this->verify_new_countries();
571
-        $this->verify_new_currencies();
572
-        return true;
573
-    }
555
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
556
+		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
557
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
558
+		//(because many need to convert old string states to foreign keys into the states table)
559
+		$script_4_1_defaults->insert_default_states();
560
+		$script_4_1_defaults->insert_default_countries();
561
+		/** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */
562
+		$script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0');
563
+		$script_4_5_defaults->insert_default_price_types();
564
+		$script_4_5_defaults->insert_default_prices();
565
+		$script_4_5_defaults->insert_default_tickets();
566
+		/** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */
567
+		$script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0');
568
+		$script_4_6_defaults->add_default_admin_only_payments();
569
+		$script_4_6_defaults->insert_default_currencies();
570
+		$this->verify_new_countries();
571
+		$this->verify_new_currencies();
572
+		return true;
573
+	}
574 574
 
575 575
 
576 576
 
577
-    /**
578
-     * @return boolean
579
-     */
580
-    public function schema_changes_after_migration()
581
-    {
582
-        $this->fix_non_default_taxes();
583
-        //this is actually the same as the last DMS
584
-        /** @var EE_DMS_Core_4_7_0 $script_4_7_defaults */
585
-        $script_4_7_defaults = EE_Registry::instance()->load_dms('Core_4_7_0');
586
-        return $script_4_7_defaults->schema_changes_after_migration();
587
-    }
577
+	/**
578
+	 * @return boolean
579
+	 */
580
+	public function schema_changes_after_migration()
581
+	{
582
+		$this->fix_non_default_taxes();
583
+		//this is actually the same as the last DMS
584
+		/** @var EE_DMS_Core_4_7_0 $script_4_7_defaults */
585
+		$script_4_7_defaults = EE_Registry::instance()->load_dms('Core_4_7_0');
586
+		return $script_4_7_defaults->schema_changes_after_migration();
587
+	}
588 588
 
589 589
 
590 590
 
591
-    public function migration_page_hooks()
592
-    {
593
-    }
591
+	public function migration_page_hooks()
592
+	{
593
+	}
594 594
 
595 595
 
596 596
 
597
-    /**
598
-     * verifies each of the new countries exists that somehow we missed in 4.1
599
-     */
600
-    public function verify_new_countries()
601
-    {
602
-        //a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028
603
-        //how many decimal places? https://en.wikipedia.org/wiki/ISO_4217
604
-        //currency symbols: http://www.xe.com/symbols.php
605
-        //CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active
606
-        //('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
607
-        $newer_countries = array(
608
-            array('AX', 'ALA', 0, '&#197;land Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0),
609
-            array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
610
-            array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0),
611
-            array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0),
612
-            array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
613
-            array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
614
-            array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
615
-            array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0),
616
-            array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0),
617
-            array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0),
618
-            array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0),
619
-            array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0),
620
-            array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0),
621
-            array(
622
-                'BQ',
623
-                'BES',
624
-                0,
625
-                'Bonaire, Saint Eustatius and Saba',
626
-                'USD',
627
-                'Dollar',
628
-                'Dollars',
629
-                '$',
630
-                1,
631
-                2,
632
-                '+599',
633
-                0,
634
-                0,
635
-            ),
636
-            array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0),
637
-            array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0),
638
-            array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0),
639
-            array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0),
640
-            array(
641
-                'HM',
642
-                'HMD',
643
-                0,
644
-                'Heard Island and McDonald Islands',
645
-                'AUD',
646
-                'Dollar',
647
-                'Dollars',
648
-                '$',
649
-                1,
650
-                2,
651
-                '+891',
652
-                0,
653
-                0,
654
-            ),
655
-            array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0),
656
-            array(
657
-                'GS',
658
-                'SGS',
659
-                0,
660
-                'South Georgia and the South Sandwich Islands',
661
-                'GBP',
662
-                'Pound',
663
-                'Pounds',
664
-                '£',
665
-                1,
666
-                2,
667
-                '+500',
668
-                0,
669
-                0,
670
-            ),
671
-            array('TL', 'TLS', 0, 'Timor-Leste', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+670', 0, 0),
672
-            array('TF', 'ATF', 0, 'French Southern Territories', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+262', 0, 0),
673
-            array(
674
-                'UM',
675
-                'UMI',
676
-                0,
677
-                'United States Minor Outlying Islands',
678
-                'USD',
679
-                'Dollar',
680
-                'Dollars',
681
-                '$',
682
-                1,
683
-                2,
684
-                '+1',
685
-                0,
686
-                0,
687
-            ),
688
-        );
689
-        global $wpdb;
690
-        $country_table = $wpdb->prefix . "esp_country";
691
-        $country_format = array(
692
-            "CNT_ISO"         => '%s',
693
-            "CNT_ISO3"        => '%s',
694
-            "RGN_ID"          => '%d',
695
-            "CNT_name"        => '%s',
696
-            "CNT_cur_code"    => '%s',
697
-            "CNT_cur_single"  => '%s',
698
-            "CNT_cur_plural"  => '%s',
699
-            "CNT_cur_sign"    => '%s',
700
-            "CNT_cur_sign_b4" => '%d',
701
-            "CNT_cur_dec_plc" => '%d',
702
-            "CNT_tel_code"    => '%s',
703
-            "CNT_is_EU"       => '%d',
704
-            "CNT_active"      => '%d',
705
-        );
706
-        if ($this->_get_table_analysis()->tableExists($country_table)) {
707
-            foreach ($newer_countries as $country) {
708
-                $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1";
709
-                $countries = $wpdb->get_var($SQL);
710
-                if ( ! $countries) {
711
-                    $wpdb->insert($country_table,
712
-                        array_combine(array_keys($country_format), $country),
713
-                        $country_format
714
-                    );
715
-                }
716
-            }
717
-        }
718
-    }
597
+	/**
598
+	 * verifies each of the new countries exists that somehow we missed in 4.1
599
+	 */
600
+	public function verify_new_countries()
601
+	{
602
+		//a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028
603
+		//how many decimal places? https://en.wikipedia.org/wiki/ISO_4217
604
+		//currency symbols: http://www.xe.com/symbols.php
605
+		//CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active
606
+		//('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
607
+		$newer_countries = array(
608
+			array('AX', 'ALA', 0, '&#197;land Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0),
609
+			array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
610
+			array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0),
611
+			array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0),
612
+			array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
613
+			array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
614
+			array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
615
+			array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0),
616
+			array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+381', 1, 0),
617
+			array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0),
618
+			array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0),
619
+			array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+383', 0, 0),
620
+			array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0),
621
+			array(
622
+				'BQ',
623
+				'BES',
624
+				0,
625
+				'Bonaire, Saint Eustatius and Saba',
626
+				'USD',
627
+				'Dollar',
628
+				'Dollars',
629
+				'$',
630
+				1,
631
+				2,
632
+				'+599',
633
+				0,
634
+				0,
635
+			),
636
+			array('BV', 'BVT', 0, 'Bouvet Island', 'NOK', 'Krone', 'Krones', 'kr', 1, 2, '+47', 0, 0),
637
+			array('IO', 'IOT', 0, 'British Indian Ocean Territory', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+246', 0, 0),
638
+			array('CX', 'CXR', 0, 'Christmas Island', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+61', 0, 0),
639
+			array('CC', 'CCK', 0, 'Cocos (Keeling) Islands', 'AUD', 'Dollar', 'Dollars', '$', 1, 2, '+891', 0, 0),
640
+			array(
641
+				'HM',
642
+				'HMD',
643
+				0,
644
+				'Heard Island and McDonald Islands',
645
+				'AUD',
646
+				'Dollar',
647
+				'Dollars',
648
+				'$',
649
+				1,
650
+				2,
651
+				'+891',
652
+				0,
653
+				0,
654
+			),
655
+			array('PS', 'PSE', 0, 'Palestinian Territory', 'ILS', 'Shekel', 'Shekels', '₪', 1, 2, '+970', 0, 0),
656
+			array(
657
+				'GS',
658
+				'SGS',
659
+				0,
660
+				'South Georgia and the South Sandwich Islands',
661
+				'GBP',
662
+				'Pound',
663
+				'Pounds',
664
+				'£',
665
+				1,
666
+				2,
667
+				'+500',
668
+				0,
669
+				0,
670
+			),
671
+			array('TL', 'TLS', 0, 'Timor-Leste', 'USD', 'Dollar', 'Dollars', '$', 1, 2, '+670', 0, 0),
672
+			array('TF', 'ATF', 0, 'French Southern Territories', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+262', 0, 0),
673
+			array(
674
+				'UM',
675
+				'UMI',
676
+				0,
677
+				'United States Minor Outlying Islands',
678
+				'USD',
679
+				'Dollar',
680
+				'Dollars',
681
+				'$',
682
+				1,
683
+				2,
684
+				'+1',
685
+				0,
686
+				0,
687
+			),
688
+		);
689
+		global $wpdb;
690
+		$country_table = $wpdb->prefix . "esp_country";
691
+		$country_format = array(
692
+			"CNT_ISO"         => '%s',
693
+			"CNT_ISO3"        => '%s',
694
+			"RGN_ID"          => '%d',
695
+			"CNT_name"        => '%s',
696
+			"CNT_cur_code"    => '%s',
697
+			"CNT_cur_single"  => '%s',
698
+			"CNT_cur_plural"  => '%s',
699
+			"CNT_cur_sign"    => '%s',
700
+			"CNT_cur_sign_b4" => '%d',
701
+			"CNT_cur_dec_plc" => '%d',
702
+			"CNT_tel_code"    => '%s',
703
+			"CNT_is_EU"       => '%d',
704
+			"CNT_active"      => '%d',
705
+		);
706
+		if ($this->_get_table_analysis()->tableExists($country_table)) {
707
+			foreach ($newer_countries as $country) {
708
+				$SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1";
709
+				$countries = $wpdb->get_var($SQL);
710
+				if ( ! $countries) {
711
+					$wpdb->insert($country_table,
712
+						array_combine(array_keys($country_format), $country),
713
+						$country_format
714
+					);
715
+				}
716
+			}
717
+		}
718
+	}
719 719
 
720 720
 
721 721
 
722
-    /**
723
-     * verifies each of the new currencies exists that somehow we missed in 4.6
724
-     */
725
-    public function verify_new_currencies()
726
-    {
727
-        //a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028
728
-        //how many decimal places? https://en.wikipedia.org/wiki/ISO_4217
729
-        //currency symbols: http://www.xe.com/symbols.php
730
-        // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active
731
-        //( 'EUR',  'Euro',  'Euros',  '€',  2,1),
732
-        $newer_currencies = array(
733
-            array('RSD', 'Dinar', 'Dinars', '', 3, 1),
734
-        );
735
-        global $wpdb;
736
-        $currency_table = $wpdb->prefix . "esp_currency";
737
-        $currency_format = array(
738
-            "CUR_code"    => '%s',
739
-            "CUR_single"  => '%s',
740
-            "CUR_plural"  => '%s',
741
-            "CUR_sign"    => '%s',
742
-            "CUR_dec_plc" => '%d',
743
-            "CUR_active"  => '%d',
744
-        );
745
-        if ($this->_get_table_analysis()->tableExists($currency_table)) {
746
-            foreach ($newer_currencies as $currency) {
747
-                $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1";
748
-                $countries = $wpdb->get_var($SQL);
749
-                if ( ! $countries) {
750
-                    $wpdb->insert($currency_table,
751
-                        array_combine(array_keys($currency_format), $currency),
752
-                        $currency_format
753
-                    );
754
-                }
755
-            }
756
-        }
757
-    }
722
+	/**
723
+	 * verifies each of the new currencies exists that somehow we missed in 4.6
724
+	 */
725
+	public function verify_new_currencies()
726
+	{
727
+		//a list of countries (and specifically some which were missed in another list):https://gist.github.com/adhipg/1600028
728
+		//how many decimal places? https://en.wikipedia.org/wiki/ISO_4217
729
+		//currency symbols: http://www.xe.com/symbols.php
730
+		// CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active
731
+		//( 'EUR',  'Euro',  'Euros',  '€',  2,1),
732
+		$newer_currencies = array(
733
+			array('RSD', 'Dinar', 'Dinars', '', 3, 1),
734
+		);
735
+		global $wpdb;
736
+		$currency_table = $wpdb->prefix . "esp_currency";
737
+		$currency_format = array(
738
+			"CUR_code"    => '%s',
739
+			"CUR_single"  => '%s',
740
+			"CUR_plural"  => '%s',
741
+			"CUR_sign"    => '%s',
742
+			"CUR_dec_plc" => '%d',
743
+			"CUR_active"  => '%d',
744
+		);
745
+		if ($this->_get_table_analysis()->tableExists($currency_table)) {
746
+			foreach ($newer_currencies as $currency) {
747
+				$SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1";
748
+				$countries = $wpdb->get_var($SQL);
749
+				if ( ! $countries) {
750
+					$wpdb->insert($currency_table,
751
+						array_combine(array_keys($currency_format), $currency),
752
+						$currency_format
753
+					);
754
+				}
755
+			}
756
+		}
757
+	}
758 758
 
759 759
 
760 760
 
761
-    /**
762
-     * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731
763
-     * which should just be a temporary issue for folks who installed 4.8.0-4.8.5;
764
-     * we should be able to stop doing this in 4.9
765
-     */
766
-    public function fix_non_default_taxes()
767
-    {
768
-        global $wpdb;
769
-        $query = $wpdb->prepare("UPDATE
761
+	/**
762
+	 * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731
763
+	 * which should just be a temporary issue for folks who installed 4.8.0-4.8.5;
764
+	 * we should be able to stop doing this in 4.9
765
+	 */
766
+	public function fix_non_default_taxes()
767
+	{
768
+		global $wpdb;
769
+		$query = $wpdb->prepare("UPDATE
770 770
 				{$wpdb->prefix}esp_price p INNER JOIN
771 771
 				{$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID
772 772
 			SET
@@ -775,6 +775,6 @@  discard block
 block discarded – undo
775 775
 				p.PRC_is_default = 0 AND
776 776
 				pt.PBT_ID = %d
777 777
 					", EEM_Price_Type::base_type_tax);
778
-        $wpdb->query($query);
779
-    }
778
+		$wpdb->query($query);
779
+	}
780 780
 }
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_5_0.dms.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 //unfortunately, this needs to be done upon INCLUSION of this file,
14 14
 //instead of construction, because it only gets constructed on first page load
15 15
 //(all other times it gets resurrected from a wordpress option)
16
-$stages = glob(EE_CORE . 'data_migration_scripts/4_5_0_stages/*');
16
+$stages = glob(EE_CORE.'data_migration_scripts/4_5_0_stages/*');
17 17
 $class_to_filepath = array();
18 18
 foreach ($stages as $filepath) {
19 19
     $matches = array();
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         } elseif ( ! $version_string) {
63 63
 //			echo "no version string provided: $version_string";
64 64
             //no version string provided... this must be pre 4.3
65
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
65
+            return false; //changed mind. dont want people thinking they should migrate yet because they cant
66 66
         } else {
67 67
 //			echo "$version_string doesnt apply";
68 68
             return false;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     public function schema_changes_before_migration()
82 82
     {
83 83
         //relies on 4.1's EEH_Activation::create_table
84
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
84
+        require_once(EE_HELPERS.'EEH_Activation.helper.php');
85 85
         $table_name = 'esp_answer';
86 86
         $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
87 87
 					REG_ID INT UNSIGNED NOT NULL,
@@ -486,18 +486,18 @@  discard block
 block discarded – undo
486 486
     public function insert_default_price_types()
487 487
     {
488 488
         global $wpdb;
489
-        $price_type_table = $wpdb->prefix . "esp_price_type";
489
+        $price_type_table = $wpdb->prefix."esp_price_type";
490 490
         if ($this->_get_table_analysis()->tableExists($price_type_table)) {
491
-            $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
491
+            $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table;
492 492
             $price_types_exist = $wpdb->get_var($SQL);
493 493
             if ( ! $price_types_exist) {
494 494
                 $user_id = EEH_Activation::get_default_creator_id();
495 495
                 $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES
496
-							(1, '" . __('Base Price', 'event_espresso') . "', 1,  0, 0, $user_id, 0),
497
-							(2, '" . __('Percent Discount', 'event_espresso') . "', 2,  1, 20, $user_id, 0),
498
-							(3, '" . __('Dollar Discount', 'event_espresso') . "', 2,  0, 30, $user_id, 0),
499
-							(4, '" . __('Percent Surcharge', 'event_espresso') . "', 3,  1, 40, $user_id,  0),
500
-							(5, '" . __('Dollar Surcharge', 'event_espresso') . "', 3,  0, 50, $user_id, 0);";
496
+							(1, '".__('Base Price', 'event_espresso')."', 1,  0, 0, $user_id, 0),
497
+							(2, '".__('Percent Discount', 'event_espresso')."', 2,  1, 20, $user_id, 0),
498
+							(3, '".__('Dollar Discount', 'event_espresso')."', 2,  0, 30, $user_id, 0),
499
+							(4, '".__('Percent Surcharge', 'event_espresso')."', 3,  1, 40, $user_id,  0),
500
+							(5, '".__('Dollar Surcharge', 'event_espresso')."', 3,  0, 50, $user_id, 0);";
501 501
                 $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL);
502 502
                 $wpdb->query($SQL);
503 503
             }
@@ -518,9 +518,9 @@  discard block
 block discarded – undo
518 518
     public function insert_default_prices()
519 519
     {
520 520
         global $wpdb;
521
-        $price_table = $wpdb->prefix . "esp_price";
521
+        $price_table = $wpdb->prefix."esp_price";
522 522
         if ($this->_get_table_analysis()->tableExists($price_table)) {
523
-            $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table;
523
+            $SQL = 'SELECT COUNT(PRC_ID) FROM '.$price_table;
524 524
             $prices_exist = $wpdb->get_var($SQL);
525 525
             if ( ! $prices_exist) {
526 526
                 $user_id = EEH_Activation::get_default_creator_id();
@@ -545,9 +545,9 @@  discard block
 block discarded – undo
545 545
     public function insert_default_tickets()
546 546
     {
547 547
         global $wpdb;
548
-        $ticket_table = $wpdb->prefix . "esp_ticket";
548
+        $ticket_table = $wpdb->prefix."esp_ticket";
549 549
         if ($this->_get_table_analysis()->tableExists($ticket_table)) {
550
-            $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
550
+            $SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table;
551 551
             $tickets_exist = $wpdb->get_var($SQL);
552 552
             if ( ! $tickets_exist) {
553 553
                 $user_id = EEH_Activation::get_default_creator_id();
@@ -560,9 +560,9 @@  discard block
 block discarded – undo
560 560
                 $wpdb->query($SQL);
561 561
             }
562 562
         }
563
-        $ticket_price_table = $wpdb->prefix . "esp_ticket_price";
563
+        $ticket_price_table = $wpdb->prefix."esp_ticket_price";
564 564
         if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
565
-            $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
565
+            $SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table;
566 566
             $ticket_prc_exist = $wpdb->get_var($SQL);
567 567
             if ( ! $ticket_prc_exist) {
568 568
                 $SQL = "INSERT INTO $ticket_price_table
Please login to merge, or discard this patch.
Indentation   +247 added lines, -247 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 $stages = glob(EE_CORE . 'data_migration_scripts/4_5_0_stages/*');
17 17
 $class_to_filepath = array();
18 18
 foreach ($stages as $filepath) {
19
-    $matches = array();
20
-    preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches);
21
-    $class_to_filepath[$matches[1]] = $filepath;
19
+	$matches = array();
20
+	preg_match('~4_5_0_stages/(.*).dmsstage.php~', $filepath, $matches);
21
+	$class_to_filepath[$matches[1]] = $filepath;
22 22
 }
23 23
 //give addons a chance to autoload their stages too
24 24
 $class_to_filepath = apply_filters('FHEE__EE_DMS_4_5_0__autoloaded_stages', $class_to_filepath);
@@ -31,59 +31,59 @@  discard block
 block discarded – undo
31 31
 
32 32
 
33 33
 
34
-    /**
35
-     * EE_DMS_Core_4_5_0 constructor.
36
-     *
37
-     * @param TableManager  $table_manager
38
-     * @param TableAnalysis $table_analysis
39
-     */
40
-    public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
41
-    {
42
-        $this->_pretty_name = __("Data Update to Event Espresso 4.5.0", "event_espresso");
43
-        $this->_priority = 10;
44
-        $this->_migration_stages = array(
45
-            new EE_DMS_4_5_0_update_wp_user_for_tickets(),
46
-            new EE_DMS_4_5_0_update_wp_user_for_prices(),
47
-            new EE_DMS_4_5_0_update_wp_user_for_price_types(),
48
-            new EE_DMS_4_5_0_update_wp_user_for_question_groups(),
49
-            new EE_DMS_4_5_0_invoice_settings(),
50
-        );
51
-        parent::__construct($table_manager, $table_analysis);
52
-    }
53
-
54
-
55
-
56
-    public function can_migrate_from_version($version_array)
57
-    {
58
-        $version_string = $version_array['Core'];
59
-        if (version_compare($version_string, '4.5.0', '<=') && version_compare($version_string, '4.3.0', '>=')) {
34
+	/**
35
+	 * EE_DMS_Core_4_5_0 constructor.
36
+	 *
37
+	 * @param TableManager  $table_manager
38
+	 * @param TableAnalysis $table_analysis
39
+	 */
40
+	public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null)
41
+	{
42
+		$this->_pretty_name = __("Data Update to Event Espresso 4.5.0", "event_espresso");
43
+		$this->_priority = 10;
44
+		$this->_migration_stages = array(
45
+			new EE_DMS_4_5_0_update_wp_user_for_tickets(),
46
+			new EE_DMS_4_5_0_update_wp_user_for_prices(),
47
+			new EE_DMS_4_5_0_update_wp_user_for_price_types(),
48
+			new EE_DMS_4_5_0_update_wp_user_for_question_groups(),
49
+			new EE_DMS_4_5_0_invoice_settings(),
50
+		);
51
+		parent::__construct($table_manager, $table_analysis);
52
+	}
53
+
54
+
55
+
56
+	public function can_migrate_from_version($version_array)
57
+	{
58
+		$version_string = $version_array['Core'];
59
+		if (version_compare($version_string, '4.5.0', '<=') && version_compare($version_string, '4.3.0', '>=')) {
60 60
 //			echo "$version_string can be migrated from";
61
-            return true;
62
-        } elseif ( ! $version_string) {
61
+			return true;
62
+		} elseif ( ! $version_string) {
63 63
 //			echo "no version string provided: $version_string";
64
-            //no version string provided... this must be pre 4.3
65
-            return false;//changed mind. dont want people thinking they should migrate yet because they cant
66
-        } else {
64
+			//no version string provided... this must be pre 4.3
65
+			return false;//changed mind. dont want people thinking they should migrate yet because they cant
66
+		} else {
67 67
 //			echo "$version_string doesnt apply";
68
-            return false;
69
-        }
70
-    }
68
+			return false;
69
+		}
70
+	}
71 71
 
72 72
 
73 73
 
74
-    public function schema_changes_before_migration()
75
-    {
76
-        //relies on 4.1's EEH_Activation::create_table
77
-        require_once(EE_HELPERS . 'EEH_Activation.helper.php');
78
-        $table_name = 'esp_answer';
79
-        $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
74
+	public function schema_changes_before_migration()
75
+	{
76
+		//relies on 4.1's EEH_Activation::create_table
77
+		require_once(EE_HELPERS . 'EEH_Activation.helper.php');
78
+		$table_name = 'esp_answer';
79
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
80 80
 					REG_ID INT UNSIGNED NOT NULL,
81 81
 					QST_ID INT UNSIGNED NOT NULL,
82 82
 					ANS_value TEXT NOT NULL,
83 83
 					PRIMARY KEY  (ANS_ID)";
84
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
85
-        $table_name = 'esp_attendee_meta';
86
-        $sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
84
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
85
+		$table_name = 'esp_attendee_meta';
86
+		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
87 87
 						ATT_ID BIGINT(20) UNSIGNED NOT NULL,
88 88
 						ATT_fname VARCHAR(45) NOT NULL,
89 89
 						ATT_lname VARCHAR(45) NOT	NULL,
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 								KEY ATT_fname (ATT_fname),
100 100
 								KEY ATT_lname (ATT_lname),
101 101
 								KEY ATT_email (ATT_email)";
102
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
103
-        $table_name = 'esp_country';
104
-        $sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
102
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
103
+		$table_name = 'esp_country';
104
+		$sql = "CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
105 105
 					  CNT_ISO3 VARCHAR(3) COLLATE utf8_bin NOT NULL,
106 106
 					  RGN_ID TINYINT(3) UNSIGNED DEFAULT NULL,
107 107
 					  CNT_name VARCHAR(45) COLLATE utf8_bin NOT NULL,
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
118 118
 					  CNT_active TINYINT(1) DEFAULT '0',
119 119
 					  PRIMARY KEY  (CNT_ISO)";
120
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
121
-        $table_name = 'esp_datetime';
122
-        $sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
120
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
121
+		$table_name = 'esp_datetime';
122
+		$sql = "DTT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
123 123
 				  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
124 124
 				  DTT_name VARCHAR(255) NOT NULL DEFAULT '',
125 125
 				  DTT_description TEXT NOT NULL,
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
 						PRIMARY KEY  (DTT_ID),
135 135
 						KEY EVT_ID (EVT_ID),
136 136
 						KEY DTT_is_primary (DTT_is_primary)";
137
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
138
-        $table_name = 'esp_event_meta';
139
-        $sql = "
137
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
138
+		$table_name = 'esp_event_meta';
139
+		$sql = "
140 140
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
141 141
 			EVT_ID BIGINT(20) UNSIGNED NOT NULL,
142 142
 			EVT_display_desc TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -151,31 +151,31 @@  discard block
 block discarded – undo
151 151
 			EVT_external_URL VARCHAR(200) NULL,
152 152
 			EVT_donations TINYINT(1) NULL,
153 153
 			PRIMARY KEY  (EVTM_ID)";
154
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
155
-        $table_name = 'esp_event_question_group';
156
-        $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
154
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
155
+		$table_name = 'esp_event_question_group';
156
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
157 157
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
158 158
 					QSG_ID INT UNSIGNED NOT NULL,
159 159
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
160 160
 					PRIMARY KEY  (EQG_ID)";
161
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
162
-        $table_name = 'esp_event_venue';
163
-        $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
161
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
162
+		$table_name = 'esp_event_venue';
163
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
164 164
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
165 165
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
166 166
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
167 167
 				PRIMARY KEY  (EVV_ID)";
168
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
169
-        $table_name = 'esp_extra_meta';
170
-        $sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
168
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
169
+		$table_name = 'esp_extra_meta';
170
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
171 171
 				OBJ_ID INT(11) DEFAULT NULL,
172 172
 				EXM_type VARCHAR(45) DEFAULT NULL,
173 173
 				EXM_key VARCHAR(45) DEFAULT NULL,
174 174
 				EXM_value TEXT,
175 175
 				PRIMARY KEY  (EXM_ID)";
176
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
177
-        $table_name = 'esp_line_item';
178
-        $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
176
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
177
+		$table_name = 'esp_line_item';
178
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
179 179
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
180 180
 				TXN_ID INT(11) DEFAULT NULL,
181 181
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -191,19 +191,19 @@  discard block
 block discarded – undo
191 191
 				OBJ_ID INT(11) DEFAULT NULL,
192 192
 				OBJ_type VARCHAR(45)DEFAULT NULL,
193 193
 				PRIMARY KEY  (LIN_ID)";
194
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
195
-        $table_name = 'esp_message_template';
196
-        $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
194
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
195
+		$table_name = 'esp_message_template';
196
+		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
197 197
 					GRP_ID INT(10) UNSIGNED NOT NULL,
198 198
 					MTP_context VARCHAR(50) NOT NULL,
199 199
 					MTP_template_field VARCHAR(30) NOT NULL,
200 200
 					MTP_content TEXT NOT NULL,
201 201
 					PRIMARY KEY  (MTP_ID),
202 202
 					KEY GRP_ID (GRP_ID)";
203
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
204
-        $this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
205
-        $table_name = 'esp_message_template_group';
206
-        $sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
203
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
204
+		$this->_get_table_manager()->dropIndex('esp_message_template_group', 'EVT_ID');
205
+		$table_name = 'esp_message_template_group';
206
+		$sql = "GRP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
207 207
 					MTP_user_id INT(10) NOT NULL DEFAULT '1',
208 208
 					MTP_name VARCHAR(245) NOT NULL DEFAULT '',
209 209
 					MTP_description VARCHAR(245) NOT NULL DEFAULT '',
@@ -215,17 +215,17 @@  discard block
 block discarded – undo
215 215
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
216 216
 					PRIMARY KEY  (GRP_ID),
217 217
 					KEY MTP_user_id (MTP_user_id)";
218
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
219
-        $table_name = 'esp_event_message_template';
220
-        $sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
218
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
219
+		$table_name = 'esp_event_message_template';
220
+		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
221 221
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
222 222
 					GRP_ID INT(10) UNSIGNED NOT NULL DEFAULT 0,
223 223
 					PRIMARY KEY  (EMT_ID),
224 224
 					KEY EVT_ID (EVT_ID),
225 225
 					KEY GRP_ID (GRP_ID)";
226
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
227
-        $table_name = 'esp_payment';
228
-        $sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
226
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
227
+		$table_name = 'esp_payment';
228
+		$sql = "PAY_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
229 229
 					TXN_ID INT(10) UNSIGNED DEFAULT NULL,
230 230
 					STS_ID VARCHAR(3) COLLATE utf8_bin DEFAULT NULL,
231 231
 					PAY_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -241,28 +241,28 @@  discard block
 block discarded – undo
241 241
 					PRIMARY KEY  (PAY_ID),
242 242
 					KEY TXN_ID (TXN_ID),
243 243
 					KEY PAY_timestamp (PAY_timestamp)";
244
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
245
-        $table_name = "esp_ticket_price";
246
-        $sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
244
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
245
+		$table_name = "esp_ticket_price";
246
+		$sql = "TKP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
247 247
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
248 248
 					  PRC_ID INT(10) UNSIGNED NOT NULL,
249 249
 					  PRIMARY KEY  (TKP_ID)";
250
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
251
-        $table_name = "esp_datetime_ticket";
252
-        $sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
250
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
251
+		$table_name = "esp_datetime_ticket";
252
+		$sql = "DTK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
253 253
 					  DTT_ID INT(10) UNSIGNED NOT NULL,
254 254
 					  TKT_ID INT(10) UNSIGNED NOT NULL,
255 255
 					  PRIMARY KEY  (DTK_ID)";
256
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
257
-        $table_name = "esp_ticket_template";
258
-        $sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
256
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
257
+		$table_name = "esp_ticket_template";
258
+		$sql = "TTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
259 259
 					  TTM_name VARCHAR(45) NOT NULL,
260 260
 					  TTM_description TEXT,
261 261
 					  TTM_file VARCHAR(45),
262 262
 					  PRIMARY KEY  (TTM_ID)";
263
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
264
-        $table_name = 'esp_question';
265
-        $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
263
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
264
+		$table_name = 'esp_question';
265
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
266 266
 					QST_display_text TEXT NOT NULL,
267 267
 					QST_admin_label VARCHAR(255) NOT NULL,
268 268
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -274,25 +274,25 @@  discard block
 block discarded – undo
274 274
 					QST_wp_user BIGINT UNSIGNED NULL,
275 275
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
276 276
 					PRIMARY KEY  (QST_ID)';
277
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
278
-        $table_name = 'esp_question_group_question';
279
-        $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
277
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
278
+		$table_name = 'esp_question_group_question';
279
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
280 280
 					QSG_ID INT UNSIGNED NOT NULL,
281 281
 					QST_ID INT UNSIGNED NOT NULL,
282 282
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
283 283
 					PRIMARY KEY  (QGQ_ID) ";
284
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
285
-        $table_name = 'esp_question_option';
286
-        $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
284
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
285
+		$table_name = 'esp_question_option';
286
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
287 287
 					QSO_value VARCHAR(255) NOT NULL,
288 288
 					QSO_desc TEXT NOT NULL,
289 289
 					QST_ID INT UNSIGNED NOT NULL,
290 290
 					QSO_order INT UNSIGNED NOT NULL DEFAULT 0,
291 291
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
292 292
 					PRIMARY KEY  (QSO_ID)";
293
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
294
-        $table_name = 'esp_registration';
295
-        $sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
293
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
294
+		$table_name = 'esp_registration';
295
+		$sql = "REG_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
296 296
 					  EVT_ID BIGINT(20) UNSIGNED NOT NULL,
297 297
 					  ATT_ID BIGINT(20) UNSIGNED NOT NULL,
298 298
 					  TXN_ID INT(10) UNSIGNED NOT NULL,
@@ -315,25 +315,25 @@  discard block
 block discarded – undo
315 315
 					  KEY STS_ID (STS_ID),
316 316
 					  KEY REG_url_link (REG_url_link),
317 317
 					  KEY REG_code (REG_code)";
318
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
319
-        $table_name = 'esp_checkin';
320
-        $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
318
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
319
+		$table_name = 'esp_checkin';
320
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
321 321
 					REG_ID INT(10) UNSIGNED NOT NULL,
322 322
 					DTT_ID INT(10) UNSIGNED NOT NULL,
323 323
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
324 324
 					CHK_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
325 325
 					PRIMARY KEY  (CHK_ID)";
326
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
327
-        $table_name = 'esp_state';
328
-        $sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
326
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
327
+		$table_name = 'esp_state';
328
+		$sql = "STA_ID smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
329 329
 					  CNT_ISO VARCHAR(2) COLLATE utf8_bin NOT NULL,
330 330
 					  STA_abbrev VARCHAR(6) COLLATE utf8_bin NOT NULL,
331 331
 					  STA_name VARCHAR(100) COLLATE utf8_bin NOT NULL,
332 332
 					  STA_active TINYINT(1) DEFAULT '1',
333 333
 					  PRIMARY KEY  (STA_ID)";
334
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
335
-        $table_name = 'esp_status';
336
-        $sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
334
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
335
+		$table_name = 'esp_status';
336
+		$sql = "STS_ID VARCHAR(3) COLLATE utf8_bin NOT NULL,
337 337
 					  STS_code VARCHAR(45) COLLATE utf8_bin NOT NULL,
338 338
 					  STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL,
339 339
 					  STS_can_edit TINYINT(1) NOT NULL DEFAULT 0,
@@ -341,9 +341,9 @@  discard block
 block discarded – undo
341 341
 					  STS_open TINYINT(1) NOT NULL DEFAULT 1,
342 342
 					  UNIQUE KEY STS_ID_UNIQUE (STS_ID),
343 343
 					  KEY STS_type (STS_type)";
344
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
345
-        $table_name = 'esp_transaction';
346
-        $sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
344
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
345
+		$table_name = 'esp_transaction';
346
+		$sql = "TXN_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
347 347
 					  TXN_timestamp DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
348 348
 					  TXN_total DECIMAL(10,3) DEFAULT '0.00',
349 349
 					  TXN_paid DECIMAL(10,3) NOT NULL DEFAULT '0.00',
@@ -354,9 +354,9 @@  discard block
 block discarded – undo
354 354
 					  PRIMARY KEY  (TXN_ID),
355 355
 					  KEY TXN_timestamp (TXN_timestamp),
356 356
 					  KEY STS_ID (STS_ID)";
357
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
358
-        $table_name = 'esp_venue_meta';
359
-        $sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
357
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
358
+		$table_name = 'esp_venue_meta';
359
+		$sql = "VNUM_ID INT(11) NOT NULL AUTO_INCREMENT,
360 360
 			VNU_ID BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
361 361
 			VNU_address VARCHAR(255) DEFAULT NULL,
362 362
 			VNU_address2 VARCHAR(255) DEFAULT NULL,
@@ -374,10 +374,10 @@  discard block
 block discarded – undo
374 374
 			PRIMARY KEY  (VNUM_ID),
375 375
 			KEY STA_ID (STA_ID),
376 376
 			KEY CNT_ISO (CNT_ISO)";
377
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
378
-        //modified tables
379
-        $table_name = "esp_price";
380
-        $sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
377
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
378
+		//modified tables
379
+		$table_name = "esp_price";
380
+		$sql = "PRC_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
381 381
 					  PRT_ID TINYINT(3) UNSIGNED NOT NULL,
382 382
 					  PRC_amount DECIMAL(10,3) NOT NULL DEFAULT '0.00',
383 383
 					  PRC_name VARCHAR(245) NOT NULL,
@@ -389,9 +389,9 @@  discard block
 block discarded – undo
389 389
 					  PRC_wp_user BIGINT UNSIGNED NULL,
390 390
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
391 391
 					  PRIMARY KEY  (PRC_ID)";
392
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
393
-        $table_name = "esp_price_type";
394
-        $sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
392
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
393
+		$table_name = "esp_price_type";
394
+		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
395 395
 				  PRT_name VARCHAR(45) NOT NULL,
396 396
 				  PBT_ID TINYINT(3) UNSIGNED NOT NULL DEFAULT '1',
397 397
 				  PRT_is_percent TINYINT(1) NOT NULL DEFAULT '0',
@@ -400,9 +400,9 @@  discard block
 block discarded – undo
400 400
 				  PRT_deleted TINYINT(1) NOT NULL DEFAULT '0',
401 401
 				  UNIQUE KEY PRT_name_UNIQUE (PRT_name),
402 402
 				  PRIMARY KEY  (PRT_ID)";
403
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
404
-        $table_name = "esp_ticket";
405
-        $sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
403
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB ');
404
+		$table_name = "esp_ticket";
405
+		$sql = "TKT_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
406 406
 					  TTM_ID INT(10) UNSIGNED NOT NULL,
407 407
 					  TKT_name VARCHAR(245) NOT NULL DEFAULT '',
408 408
 					  TKT_description TEXT NOT NULL,
@@ -423,10 +423,10 @@  discard block
 block discarded – undo
423 423
 					  TKT_parent INT(10) UNSIGNED DEFAULT '0',
424 424
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
425 425
 					  PRIMARY KEY  (TKT_ID)";
426
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
427
-        $this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
428
-        $table_name = 'esp_question_group';
429
-        $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
426
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
427
+		$this->_get_table_manager()->dropIndex('esp_question_group', 'QSG_identifier_UNIQUE');
428
+		$table_name = 'esp_question_group';
429
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
430 430
 					QSG_name VARCHAR(255) NOT NULL,
431 431
 					QSG_identifier VARCHAR(100) NOT NULL,
432 432
 					QSG_desc TEXT NULL,
@@ -438,135 +438,135 @@  discard block
 block discarded – undo
438 438
 					QSG_wp_user BIGINT UNSIGNED NULL,
439 439
 					PRIMARY KEY  (QSG_ID),
440 440
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
441
-        $this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
442
-        $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
443
-        //(because many need to convert old string states to foreign keys into the states table)
444
-        $script_4_1_defaults->insert_default_states();
445
-        $script_4_1_defaults->insert_default_countries();
446
-        //schema on price, price_types and tickets has changed so use the DEFAULT method in here instead of 4.1's and later.
447
-        $this->insert_default_price_types();
448
-        $this->insert_default_prices();
449
-        $this->insert_default_tickets();
450
-        //setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
451
-        EE_Config::instance()->update_espresso_config(false, true);
452
-        return true;
453
-    }
454
-
455
-
456
-
457
-    /**
458
-     * @return boolean
459
-     */
460
-    public function schema_changes_after_migration()
461
-    {
462
-        return true;
463
-    }
464
-
465
-
466
-
467
-    public function migration_page_hooks()
468
-    {
469
-    }
470
-
471
-
472
-
473
-    /**
474
-     * insert_default_price_types
475
-     *
476
-     * @since 4.5.0
477
-     * @return void
478
-     */
479
-    public function insert_default_price_types()
480
-    {
481
-        global $wpdb;
482
-        $price_type_table = $wpdb->prefix . "esp_price_type";
483
-        if ($this->_get_table_analysis()->tableExists($price_type_table)) {
484
-            $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
485
-            $price_types_exist = $wpdb->get_var($SQL);
486
-            if ( ! $price_types_exist) {
487
-                $user_id = EEH_Activation::get_default_creator_id();
488
-                $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES
441
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
442
+		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
443
+		//(because many need to convert old string states to foreign keys into the states table)
444
+		$script_4_1_defaults->insert_default_states();
445
+		$script_4_1_defaults->insert_default_countries();
446
+		//schema on price, price_types and tickets has changed so use the DEFAULT method in here instead of 4.1's and later.
447
+		$this->insert_default_price_types();
448
+		$this->insert_default_prices();
449
+		$this->insert_default_tickets();
450
+		//setting up the config wp option pretty well counts as a 'schema change', or at least should happen ehre
451
+		EE_Config::instance()->update_espresso_config(false, true);
452
+		return true;
453
+	}
454
+
455
+
456
+
457
+	/**
458
+	 * @return boolean
459
+	 */
460
+	public function schema_changes_after_migration()
461
+	{
462
+		return true;
463
+	}
464
+
465
+
466
+
467
+	public function migration_page_hooks()
468
+	{
469
+	}
470
+
471
+
472
+
473
+	/**
474
+	 * insert_default_price_types
475
+	 *
476
+	 * @since 4.5.0
477
+	 * @return void
478
+	 */
479
+	public function insert_default_price_types()
480
+	{
481
+		global $wpdb;
482
+		$price_type_table = $wpdb->prefix . "esp_price_type";
483
+		if ($this->_get_table_analysis()->tableExists($price_type_table)) {
484
+			$SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table;
485
+			$price_types_exist = $wpdb->get_var($SQL);
486
+			if ( ! $price_types_exist) {
487
+				$user_id = EEH_Activation::get_default_creator_id();
488
+				$SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_wp_user, PRT_deleted ) VALUES
489 489
 							(1, '" . __('Base Price', 'event_espresso') . "', 1,  0, 0, $user_id, 0),
490 490
 							(2, '" . __('Percent Discount', 'event_espresso') . "', 2,  1, 20, $user_id, 0),
491 491
 							(3, '" . __('Dollar Discount', 'event_espresso') . "', 2,  0, 30, $user_id, 0),
492 492
 							(4, '" . __('Percent Surcharge', 'event_espresso') . "', 3,  1, 40, $user_id,  0),
493 493
 							(5, '" . __('Dollar Surcharge', 'event_espresso') . "', 3,  0, 50, $user_id, 0);";
494
-                $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL);
495
-                $wpdb->query($SQL);
496
-            }
497
-        }
498
-    }
499
-
500
-
501
-
502
-    /**
503
-     * insert DEFAULT prices.
504
-     *  If we're INSTALLING 4.x CAF, then we add a few extra DEFAULT prices
505
-     * when EEH_Activaion's initialize_db_content is called via  ahook in
506
-     * EE_Brewing_regular
507
-     *
508
-     * @since 4.5.0
509
-     * @return void
510
-     */
511
-    public function insert_default_prices()
512
-    {
513
-        global $wpdb;
514
-        $price_table = $wpdb->prefix . "esp_price";
515
-        if ($this->_get_table_analysis()->tableExists($price_table)) {
516
-            $SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table;
517
-            $prices_exist = $wpdb->get_var($SQL);
518
-            if ( ! $prices_exist) {
519
-                $user_id = EEH_Activation::get_default_creator_id();
520
-                $SQL = "INSERT INTO $price_table
494
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_price_types__SQL', $SQL);
495
+				$wpdb->query($SQL);
496
+			}
497
+		}
498
+	}
499
+
500
+
501
+
502
+	/**
503
+	 * insert DEFAULT prices.
504
+	 *  If we're INSTALLING 4.x CAF, then we add a few extra DEFAULT prices
505
+	 * when EEH_Activaion's initialize_db_content is called via  ahook in
506
+	 * EE_Brewing_regular
507
+	 *
508
+	 * @since 4.5.0
509
+	 * @return void
510
+	 */
511
+	public function insert_default_prices()
512
+	{
513
+		global $wpdb;
514
+		$price_table = $wpdb->prefix . "esp_price";
515
+		if ($this->_get_table_analysis()->tableExists($price_table)) {
516
+			$SQL = 'SELECT COUNT(PRC_ID) FROM ' . $price_table;
517
+			$prices_exist = $wpdb->get_var($SQL);
518
+			if ( ! $prices_exist) {
519
+				$user_id = EEH_Activation::get_default_creator_id();
520
+				$SQL = "INSERT INTO $price_table
521 521
 							(PRC_ID, PRT_ID, PRC_amount, PRC_name, PRC_desc,  PRC_is_default, PRC_overrides, PRC_wp_user, PRC_order, PRC_deleted, PRC_parent ) VALUES
522 522
 							(1, 1, '0.00', 'Free Admission', '', 1, NULL, $user_id, 0, 0, 0);";
523
-                $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL);
524
-                $wpdb->query($SQL);
525
-            }
526
-        }
527
-    }
528
-
529
-
530
-
531
-    /**
532
-     * insert DEFAULT ticket
533
-     * Almost identical to EE_DMS_Core_4_3_0::insert_default_tickets, except is aware of the TKT_wp_user field
534
-     *
535
-     * @since 4.5.0
536
-     * @return void
537
-     */
538
-    public function insert_default_tickets()
539
-    {
540
-        global $wpdb;
541
-        $ticket_table = $wpdb->prefix . "esp_ticket";
542
-        if ($this->_get_table_analysis()->tableExists($ticket_table)) {
543
-            $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
544
-            $tickets_exist = $wpdb->get_var($SQL);
545
-            if ( ! $tickets_exist) {
546
-                $user_id = EEH_Activation::get_default_creator_id();
547
-                $SQL = "INSERT INTO $ticket_table
523
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_prices__SQL', $SQL);
524
+				$wpdb->query($SQL);
525
+			}
526
+		}
527
+	}
528
+
529
+
530
+
531
+	/**
532
+	 * insert DEFAULT ticket
533
+	 * Almost identical to EE_DMS_Core_4_3_0::insert_default_tickets, except is aware of the TKT_wp_user field
534
+	 *
535
+	 * @since 4.5.0
536
+	 * @return void
537
+	 */
538
+	public function insert_default_tickets()
539
+	{
540
+		global $wpdb;
541
+		$ticket_table = $wpdb->prefix . "esp_ticket";
542
+		if ($this->_get_table_analysis()->tableExists($ticket_table)) {
543
+			$SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table;
544
+			$tickets_exist = $wpdb->get_var($SQL);
545
+			if ( ! $tickets_exist) {
546
+				$user_id = EEH_Activation::get_default_creator_id();
547
+				$SQL = "INSERT INTO $ticket_table
548 548
 					( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, TKT_required, TKT_min, TKT_max, TKT_price, TKT_start_date, TKT_end_date, TKT_taxable, TKT_order, TKT_row, TKT_is_default, TKT_parent, TKT_wp_user, TKT_deleted ) VALUES
549 549
 					( 1, 0, '"
550
-                       . __("Free Ticket", "event_espresso")
551
-                       . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, $user_id, 0);";
552
-                $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL);
553
-                $wpdb->query($SQL);
554
-            }
555
-        }
556
-        $ticket_price_table = $wpdb->prefix . "esp_ticket_price";
557
-        if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
558
-            $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
559
-            $ticket_prc_exist = $wpdb->get_var($SQL);
560
-            if ( ! $ticket_prc_exist) {
561
-                $SQL = "INSERT INTO $ticket_price_table
550
+					   . __("Free Ticket", "event_espresso")
551
+					   . "', '', 100, 0, -1, 0, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, $user_id, 0);";
552
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL', $SQL);
553
+				$wpdb->query($SQL);
554
+			}
555
+		}
556
+		$ticket_price_table = $wpdb->prefix . "esp_ticket_price";
557
+		if ($this->_get_table_analysis()->tableExists($ticket_price_table)) {
558
+			$SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table;
559
+			$ticket_prc_exist = $wpdb->get_var($SQL);
560
+			if ( ! $ticket_prc_exist) {
561
+				$SQL = "INSERT INTO $ticket_price_table
562 562
 				( TKP_ID, TKT_ID, PRC_ID ) VALUES
563 563
 				( 1, 1, 1 )
564 564
 				";
565
-                $SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL);
566
-                $wpdb->query($SQL);
567
-            }
568
-        }
569
-    }
565
+				$SQL = apply_filters('FHEE__EE_DMS_4_5_0__insert_default_tickets__SQL__ticket_price', $SQL);
566
+				$wpdb->query($SQL);
567
+			}
568
+		}
569
+	}
570 570
 
571 571
 }
572 572
 
Please login to merge, or discard this patch.