@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | * @type string $reset_db_page_link |
17 | 17 | */ |
18 | 18 | |
19 | -if ( $show_backup_db_text ) { ?> |
|
20 | -<h1><span class="dashicons dashicons-migrate"></span><?php _e("Database Migration Manager", "event_espresso");?></h1> |
|
19 | +if ($show_backup_db_text) { ?> |
|
20 | +<h1><span class="dashicons dashicons-migrate"></span><?php _e("Database Migration Manager", "event_espresso"); ?></h1> |
|
21 | 21 | <?php } ?> |
22 | 22 | <div class="padding"> |
23 | 23 | <div id="migration-prep"> |
24 | 24 | |
25 | - <?php if ( $script_names ) { ?> |
|
25 | + <?php if ($script_names) { ?> |
|
26 | 26 | <h3 class="espresso-header"> |
27 | 27 | <span class="dashicons dashicons-flag ee-icon-size-22"></span> |
28 | 28 | <?php |
@@ -39,34 +39,34 @@ discard block |
||
39 | 39 | ?> |
40 | 40 | </h3> |
41 | 41 | <p> |
42 | - <?php echo apply_filters('FHEE__ee_migration_page__p_after_header',sprintf(__("Since you have already been using Event Espresso and have previous event and registration data in your database, you have the option to migrate, or copy over, this existing data into a format that is compatible with %s.", "event_espresso"),$next_db_state),$next_db_state);?> |
|
42 | + <?php echo apply_filters('FHEE__ee_migration_page__p_after_header', sprintf(__("Since you have already been using Event Espresso and have previous event and registration data in your database, you have the option to migrate, or copy over, this existing data into a format that is compatible with %s.", "event_espresso"), $next_db_state), $next_db_state); ?> |
|
43 | 43 | </p> |
44 | - <?php } elseif ( $show_most_recent_migration ) { ?> |
|
44 | + <?php } elseif ($show_most_recent_migration) { ?> |
|
45 | 45 | <h3 class="espresso-header"> |
46 | 46 | <span class="dashicons dashicons-awards ee-icon-size-22"></span> |
47 | - <?php echo apply_filters('FHEE__ee_migration_page__done_migration_header',sprintf(__('Congratulations! Your database is "up-to-date" and you are ready to begin using %s', "event_espresso"),$ultimate_db_state));?> |
|
47 | + <?php echo apply_filters('FHEE__ee_migration_page__done_migration_header', sprintf(__('Congratulations! Your database is "up-to-date" and you are ready to begin using %s', "event_espresso"), $ultimate_db_state)); ?> |
|
48 | 48 | </h3> |
49 | 49 | <p> |
50 | - <?php echo apply_filters('FHEE__ee_migration_page__p_after_done_migration_header',sprintf(__("Time to find out about all the great new features %s has to offer.", "event_espresso"),$ultimate_db_state));?> |
|
51 | - <b><a id="get-started-after-migrate" class="button-primary" href="<?php echo add_query_arg( array( 'page' => 'espresso_about' ), admin_url( 'admin.php' )); ?>"> |
|
52 | - <?php _e("Let's Get Started", "event_espresso");?> <span class="dashicons dashicons-arrow-right ee-icon-size-22" style="margin:0;"></span> |
|
50 | + <?php echo apply_filters('FHEE__ee_migration_page__p_after_done_migration_header', sprintf(__("Time to find out about all the great new features %s has to offer.", "event_espresso"), $ultimate_db_state)); ?> |
|
51 | + <b><a id="get-started-after-migrate" class="button-primary" href="<?php echo add_query_arg(array('page' => 'espresso_about'), admin_url('admin.php')); ?>"> |
|
52 | + <?php _e("Let's Get Started", "event_espresso"); ?> <span class="dashicons dashicons-arrow-right ee-icon-size-22" style="margin:0;"></span> |
|
53 | 53 | </a></b> |
54 | 54 | </p> |
55 | 55 | <?php } ?> |
56 | 56 | |
57 | 57 | |
58 | - <?php if ($show_backup_db_text){ ?> |
|
58 | + <?php if ($show_backup_db_text) { ?> |
|
59 | 59 | <div id="migration-options-dv"> |
60 | 60 | <h2> |
61 | 61 | <span class="dashicons dashicons-admin-tools"></span> |
62 | - <?php _e("Migration Options", "event_espresso");?> |
|
63 | - <span class="tiny-text lt-grey-text"> <?php _e(' to migrate or not to migrate?', "event_espresso");?></span> |
|
62 | + <?php _e("Migration Options", "event_espresso"); ?> |
|
63 | + <span class="tiny-text lt-grey-text"> <?php _e(' to migrate or not to migrate?', "event_espresso"); ?></span> |
|
64 | 64 | </h2> |
65 | 65 | <div class="ee-table-wrap"> |
66 | 66 | <table> |
67 | 67 | <tbody> |
68 | 68 | <tr> |
69 | - <td><h3><?php _e('1', 'event_espresso');?></h3></td> |
|
69 | + <td><h3><?php _e('1', 'event_espresso'); ?></h3></td> |
|
70 | 70 | <td> |
71 | 71 | <?php |
72 | 72 | echo apply_filters( |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | __('%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.', "event_espresso"), |
76 | 76 | '<strong>', |
77 | 77 | '</strong>', |
78 | - '<a id="migration-risks" class="" title="' . esc_attr__('click for more details', "event_espresso") . '">', |
|
78 | + '<a id="migration-risks" class="" title="'.esc_attr__('click for more details', "event_espresso").'">', |
|
79 | 79 | '</a>', |
80 | 80 | $current_db_state, |
81 | 81 | $next_db_state |
@@ -84,18 +84,18 @@ discard block |
||
84 | 84 | $next_db_state |
85 | 85 | ); |
86 | 86 | ?> |
87 | - <a id="display-migration-details" class="display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="migration-details" ><?php _e('click for more details', "event_espresso");?> +</a> |
|
88 | - <a id="hide-migration-details" class="hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="migration-details" style="display:none;" ><?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), ' ' ); ?></a> |
|
87 | + <a id="display-migration-details" class="display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="migration-details" ><?php _e('click for more details', "event_espresso"); ?> +</a> |
|
88 | + <a id="hide-migration-details" class="hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="migration-details" style="display:none;" ><?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '); ?></a> |
|
89 | 89 | </td> |
90 | 90 | <td> |
91 | - <a id="db-backed-up" class="toggle-migration-monitor button-primary"><?php echo apply_filters('FHEE__ee_migration_page__option_1_button_text',sprintf(__("Migrate My %s Data to %s", "event_espresso"),$current_db_state,$next_db_state),$current_db_state,$next_db_state);?></a> |
|
91 | + <a id="db-backed-up" class="toggle-migration-monitor button-primary"><?php echo apply_filters('FHEE__ee_migration_page__option_1_button_text', sprintf(__("Migrate My %s Data to %s", "event_espresso"), $current_db_state, $next_db_state), $current_db_state, $next_db_state); ?></a> |
|
92 | 92 | </td> |
93 | 93 | </tr> |
94 | 94 | <tr> |
95 | 95 | <td colspan="3" style="padding: 0"> |
96 | 96 | <div id="migration-details-dv" style="display: none; padding: 1em;"> |
97 | 97 | |
98 | - <span class="reminder-spn"><?php printf(__("%s Important: %s Before migrating, please back up your database and files.", "event_espresso"),"<b>","</b>");?></span> |
|
98 | + <span class="reminder-spn"><?php printf(__("%s Important: %s Before migrating, please back up your database and files.", "event_espresso"), "<b>", "</b>"); ?></span> |
|
99 | 99 | <p> |
100 | 100 | <?php |
101 | 101 | printf( |
@@ -111,27 +111,27 @@ discard block |
||
111 | 111 | ); |
112 | 112 | ?> |
113 | 113 | </p> |
114 | - <?php do_action('AHEE__ee_migration_page__option_1_extra_details');?> |
|
114 | + <?php do_action('AHEE__ee_migration_page__option_1_extra_details'); ?> |
|
115 | 115 | </div> |
116 | 116 | </td> |
117 | 117 | </tr> |
118 | 118 | <tr> |
119 | - <td><h3><?php _e('2', 'event_espresso');?></h3></td> |
|
119 | + <td><h3><?php _e('2', 'event_espresso'); ?></h3></td> |
|
120 | 120 | <td> |
121 | - <?php echo apply_filters( 'FHEE__ee_migration_page__option_2_main',sprintf(__('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.', "event_espresso"),$current_db_state,$next_db_state,$ultimate_db_state),$current_db_state,$next_db_state,$ultimate_db_state);?><br /> |
|
122 | - <span class="reminder-spn"><?php _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.', 'event_espresso' );?></span> |
|
123 | - <a id="display-no-migration-details" class="display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="no-migration-details"><?php _e('click for more details', "event_espresso");?> +</a> |
|
124 | - <a id="hide-no-migration-details" class="hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="no-migration-details" style="display:none;" ><?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), ' ' ); ?></a> |
|
121 | + <?php echo apply_filters('FHEE__ee_migration_page__option_2_main', sprintf(__('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.', "event_espresso"), $current_db_state, $next_db_state, $ultimate_db_state), $current_db_state, $next_db_state, $ultimate_db_state); ?><br /> |
|
122 | + <span class="reminder-spn"><?php _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.', 'event_espresso'); ?></span> |
|
123 | + <a id="display-no-migration-details" class="display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="no-migration-details"><?php _e('click for more details', "event_espresso"); ?> +</a> |
|
124 | + <a id="hide-no-migration-details" class="hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="no-migration-details" style="display:none;" ><?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '); ?></a> |
|
125 | 125 | </td> |
126 | 126 | <td> |
127 | - <a id="do-not-migrate" class="do-not-migrate button-primary" href="<?php echo $reset_db_page_link;?>"><?php echo apply_filters('FHEE__ee_migration_page__option_2_button_text',sprintf(__("Just Start %s and Delete Existing Data", "event_espresso"),$ultimate_db_state),$ultimate_db_state);?></a> |
|
127 | + <a id="do-not-migrate" class="do-not-migrate button-primary" href="<?php echo $reset_db_page_link; ?>"><?php echo apply_filters('FHEE__ee_migration_page__option_2_button_text', sprintf(__("Just Start %s and Delete Existing Data", "event_espresso"), $ultimate_db_state), $ultimate_db_state); ?></a> |
|
128 | 128 | </td> |
129 | 129 | </tr> |
130 | 130 | <tr> |
131 | 131 | <td colspan="3" style="padding: 0"> |
132 | 132 | <div id="no-migration-details-dv" style="display: none; padding: 1em;"> |
133 | 133 | <p> |
134 | - <?php echo apply_filters('FHEE__ee_migration_page__option_2_details',sprintf(__("If your existing Event and Registration Data is no longer relevant nor required, you can just start up %s without performing a data migration.", "event_espresso"),$ultimate_db_state),$ultimate_db_state);?> |
|
134 | + <?php echo apply_filters('FHEE__ee_migration_page__option_2_details', sprintf(__("If your existing Event and Registration Data is no longer relevant nor required, you can just start up %s without performing a data migration.", "event_espresso"), $ultimate_db_state), $ultimate_db_state); ?> |
|
135 | 135 | </p> |
136 | 136 | </div> |
137 | 137 | </td> |
@@ -139,20 +139,20 @@ discard block |
||
139 | 139 | </tbody> |
140 | 140 | </table> |
141 | 141 | </div> |
142 | - <?php do_action('AHEE__ee_migration_page__after_migration_options_table');?> |
|
142 | + <?php do_action('AHEE__ee_migration_page__after_migration_options_table'); ?> |
|
143 | 143 | </div> |
144 | 144 | <?php } ?> |
145 | 145 | |
146 | 146 | <?php |
147 | - if ( $show_most_recent_migration ) { |
|
148 | - if( $most_recent_migration && $most_recent_migration instanceof EE_Data_Migration_Script_Base ) { |
|
149 | - if( $most_recent_migration->can_continue() ) { |
|
147 | + if ($show_most_recent_migration) { |
|
148 | + if ($most_recent_migration && $most_recent_migration instanceof EE_Data_Migration_Script_Base) { |
|
149 | + if ($most_recent_migration->can_continue()) { |
|
150 | 150 | //tell the user they should continue their migration because it appears to be unfinished... well, assuming there were no errors ?> |
151 | 151 | <h3 class="espresso-header"> |
152 | 152 | <span class="dashicons dashicons-star-half ee-icon-size-22"></span> |
153 | - <?php printf(__("It appears that your previous Data Migration Task (%s) is incomplete, and should be resumed", "event_espresso"),$most_recent_migration->pretty_name());?> |
|
153 | + <?php printf(__("It appears that your previous Data Migration Task (%s) is incomplete, and should be resumed", "event_espresso"), $most_recent_migration->pretty_name()); ?> |
|
154 | 154 | </h3> |
155 | - <?php } elseif ( $most_recent_migration->is_broken() ) { |
|
155 | + <?php } elseif ($most_recent_migration->is_broken()) { |
|
156 | 156 | //tell the user the migration failed and they should notify EE?> |
157 | 157 | <h3 class="espresso-header"> |
158 | 158 | <span class="dashicons dashicons-no ee-icon-size-22"></span> |
@@ -161,19 +161,19 @@ discard block |
||
161 | 161 | <?php } |
162 | 162 | |
163 | 163 | //display errors or not of the most recent migration ran |
164 | - if ( $most_recent_migration->get_errors() ){ ?> |
|
164 | + if ($most_recent_migration->get_errors()) { ?> |
|
165 | 165 | <div class="ee-attention"> |
166 | - <strong><?php printf(__("Warnings occurred during your last migration (%s):",'event_espresso'),$most_recent_migration->pretty_name()) ?></strong> |
|
167 | - <a id="show-hide-migration-warnings" class="display-the-hidden"><?php _e("Show Warnings", 'event_espresso');?></a> |
|
166 | + <strong><?php printf(__("Warnings occurred during your last migration (%s):", 'event_espresso'), $most_recent_migration->pretty_name()) ?></strong> |
|
167 | + <a id="show-hide-migration-warnings" class="display-the-hidden"><?php _e("Show Warnings", 'event_espresso'); ?></a> |
|
168 | 168 | <ul class="migration-warnings" style="display:none"> |
169 | - <?php foreach($most_recent_migration->get_errors() as $error){ ?> |
|
170 | - <li><?php echo htmlentities( $error ) ?></li> |
|
169 | + <?php foreach ($most_recent_migration->get_errors() as $error) { ?> |
|
170 | + <li><?php echo htmlentities($error) ?></li> |
|
171 | 171 | <?php }?> |
172 | 172 | </ul> |
173 | 173 | </div> |
174 | 174 | <?php } else { |
175 | 175 | //there were no errors during the last migration, just say so?> |
176 | - <h2><?php printf(__("The last data migration task (%s) ran successfully without errors.", "event_espresso"),$most_recent_migration->pretty_name())?></h2> |
|
176 | + <h2><?php printf(__("The last data migration task (%s) ran successfully without errors.", "event_espresso"), $most_recent_migration->pretty_name())?></h2> |
|
177 | 177 | <?php } |
178 | 178 | } else { |
179 | 179 | } |
@@ -184,12 +184,12 @@ discard block |
||
184 | 184 | </div> |
185 | 185 | <!--end of #migration-prep--> |
186 | 186 | |
187 | - <?php if ($show_migration_progress){?> |
|
187 | + <?php if ($show_migration_progress) {?> |
|
188 | 188 | <div id='migration-monitor' <?php echo $show_backup_db_text ? "style='display:none'" : ''?>> |
189 | - <?php if( $show_backup_db_text){?> |
|
189 | + <?php if ($show_backup_db_text) {?> |
|
190 | 190 | <p> |
191 | 191 | <a class="toggle-migration-monitor small-text" style="cursor: pointer;"> |
192 | - <span class="dashicons dashicons-arrow-left-alt2" style="top:0;"></span><?php _e("return to previous screen", "event_espresso");?> |
|
192 | + <span class="dashicons dashicons-arrow-left-alt2" style="top:0;"></span><?php _e("return to previous screen", "event_espresso"); ?> |
|
193 | 193 | </a> |
194 | 194 | <br/> |
195 | 195 | |
@@ -198,33 +198,33 @@ discard block |
||
198 | 198 | <div id='progress-area'> |
199 | 199 | <h3 class="espresso-header"> |
200 | 200 | <?php |
201 | - echo sprintf( _n( |
|
201 | + echo sprintf(_n( |
|
202 | 202 | "In order to import all of your existing Event Espresso data, the following upgrade task needs to be performed:", |
203 | 203 | "In order to import all of your existing Event Espresso data, the following %s upgrade tasks need to be performed:", |
204 | 204 | count($script_names), |
205 | 205 | "event_espresso" |
206 | - ), count( $script_names ) );?> |
|
206 | + ), count($script_names)); ?> |
|
207 | 207 | </h3> |
208 | 208 | <ul style="list-style: inside;"> |
209 | - <?php foreach($script_names as $script_name){?> |
|
209 | + <?php foreach ($script_names as $script_name) {?> |
|
210 | 210 | <li style="margin: 0 0 1em 1em; line-height: 1.1em;"><?php echo $script_name?></li> |
211 | 211 | <?php }?> |
212 | 212 | </ul> |
213 | 213 | <br/> |
214 | 214 | <?php if (count($script_names) > 1) {?> |
215 | - <p><?php _e("Please note: after each task is completed you will need to continue the data migration, or report an error to Event Espresso.", "event_espresso");?></p> |
|
215 | + <p><?php _e("Please note: after each task is completed you will need to continue the data migration, or report an error to Event Espresso.", "event_espresso"); ?></p> |
|
216 | 216 | <?php }?> |
217 | 217 | |
218 | 218 | <div class="ee-attention"> |
219 | 219 | <p> |
220 | 220 | <span class="reminder-spn"> |
221 | - <strong><?php _e("Please Note:", "event_espresso");?></strong> |
|
221 | + <strong><?php _e("Please Note:", "event_espresso"); ?></strong> |
|
222 | 222 | </span> |
223 | 223 | <br/> |
224 | - <?php _e("Depending on the number of events and the complexity of the information in your database, this could take a few minutes.", "event_espresso");?> |
|
224 | + <?php _e("Depending on the number of events and the complexity of the information in your database, this could take a few minutes.", "event_espresso"); ?> |
|
225 | 225 | </p> |
226 | 226 | <p> |
227 | - <?php printf(__("%sPlease be patient and do NOT navigate away from this page once the migration has begun%s. If any issues arise due to existing malformed data, an itemized report will be made available to you after the migration has completed.", "event_espresso"),'<strong>', '</strong>' );?> |
|
227 | + <?php printf(__("%sPlease be patient and do NOT navigate away from this page once the migration has begun%s. If any issues arise due to existing malformed data, an itemized report will be made available to you after the migration has completed.", "event_espresso"), '<strong>', '</strong>'); ?> |
|
228 | 228 | </p> |
229 | 229 | <p> |
230 | 230 | <?php _e("Click the button below to begin the migration process.", "event_espresso") ?> |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | <!-- #progress-responsive --> |
240 | 240 | |
241 | 241 | <button id='start-migration' class='button-primary'> |
242 | - <?php echo $show_continue_current_migration_script ? __("Continue Migration", "event_espresso") : __("Begin Migration", "event_espresso");?> |
|
242 | + <?php echo $show_continue_current_migration_script ? __("Continue Migration", "event_espresso") : __("Begin Migration", "event_espresso"); ?> |
|
243 | 243 | </button> |
244 | 244 | <br class="clear"/> |
245 | 245 | |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | </div> |
256 | 256 | |
257 | 257 | <?php } |
258 | - if ( $show_maintenance_switch ) { |
|
258 | + if ($show_maintenance_switch) { |
|
259 | 259 | ?> |
260 | - <h2><span class="dashicons dashicons-admin-tools"></span><?php _e('Set Event Espresso Maintenance Mode', 'event_espresso');?></h2> |
|
260 | + <h2><span class="dashicons dashicons-admin-tools"></span><?php _e('Set Event Espresso Maintenance Mode', 'event_espresso'); ?></h2> |
|
261 | 261 | <form method='post' action='<?php echo $update_migration_script_page_link?>'> |
262 | 262 | <div class="ee-table-wrap"> |
263 | 263 | <table> |
@@ -266,9 +266,9 @@ discard block |
||
266 | 266 | <input type="radio" id="maintenance_mode_level_off" name="maintenance_mode_level" value="0" <?php echo EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_0_not_in_maintenance ? 'checked="checked"' : ''?>> |
267 | 267 | </td> |
268 | 268 | <th align="left"> |
269 | - <label for="maintenance_mode_level_off"><?php _e('Maintenance Mode OFF', 'event_espresso');?></label> |
|
269 | + <label for="maintenance_mode_level_off"><?php _e('Maintenance Mode OFF', 'event_espresso'); ?></label> |
|
270 | 270 | <p class='description' style="font-weight: normal;"> |
271 | - <?php _e("This is the normal operating mode for Event Espresso and allows all functionality to be viewed by all site visitors.", "event_espresso");?> |
|
271 | + <?php _e("This is the normal operating mode for Event Espresso and allows all functionality to be viewed by all site visitors.", "event_espresso"); ?> |
|
272 | 272 | </p> |
273 | 273 | </th> |
274 | 274 | </tr> |
@@ -281,14 +281,14 @@ discard block |
||
281 | 281 | <?php _e('Maintenance Mode ON', 'event_espresso')?> |
282 | 282 | </label> |
283 | 283 | <p class='description' style="font-weight: normal;"> |
284 | - <?php _e("This disables Event Espresso frontend functionality for all site visitors that are not administrators, and allows you to configure and/or test things on the frontend of your website before others can see.", "event_espresso");?> |
|
284 | + <?php _e("This disables Event Espresso frontend functionality for all site visitors that are not administrators, and allows you to configure and/or test things on the frontend of your website before others can see.", "event_espresso"); ?> |
|
285 | 285 | </p> |
286 | 286 | </th> |
287 | 287 | </tr> |
288 | 288 | </table> |
289 | 289 | </div> |
290 | 290 | <p> |
291 | - <input type='submit' class="button-primary" value='<?php _e("Update Maintenance Mode", "event_espresso");?>'> |
|
291 | + <input type='submit' class="button-primary" value='<?php _e("Update Maintenance Mode", "event_espresso"); ?>'> |
|
292 | 292 | </p> |
293 | 293 | </form> |
294 | 294 | <?php |
@@ -8,15 +8,15 @@ discard block |
||
8 | 8 | //(all other times it gets resurrected from a wordpress option) |
9 | 9 | $stages = glob(EE_CORE.'data_migration_scripts/4_1_0_stages/*'); |
10 | 10 | $class_to_filepath = array(); |
11 | -if ( ! empty( $stages ) ) { |
|
12 | - foreach($stages as $filepath){ |
|
11 | +if ( ! empty($stages)) { |
|
12 | + foreach ($stages as $filepath) { |
|
13 | 13 | $matches = array(); |
14 | - preg_match('~4_1_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
14 | + preg_match('~4_1_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
15 | 15 | $class_to_filepath[$matches[1]] = $filepath; |
16 | 16 | } |
17 | 17 | } |
18 | 18 | //give addons a chance to autoload their stages too |
19 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_1_0__autoloaded_stages',$class_to_filepath); |
|
19 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_1_0__autoloaded_stages', $class_to_filepath); |
|
20 | 20 | EEH_Autoloader::register_autoloader($class_to_filepath); |
21 | 21 | |
22 | 22 | /** |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * --a function named update_espresso_config() which saves the EE_Config object to the database |
35 | 35 | * --...and all its subclasses... really, you're best off copying the whole thin gwhen 4.1 is released into this file and wrapping its declaration in if( ! class_exists()){...} |
36 | 36 | */ |
37 | -class EE_DMS_Core_4_1_0 extends EE_Data_Migration_Script_Base{ |
|
37 | +class EE_DMS_Core_4_1_0 extends EE_Data_Migration_Script_Base { |
|
38 | 38 | |
39 | 39 | |
40 | 40 | |
@@ -67,26 +67,26 @@ discard block |
||
67 | 67 | * @global type $wpdb |
68 | 68 | * @return boolean |
69 | 69 | */ |
70 | - private function _checkin_table_exists(){ |
|
70 | + private function _checkin_table_exists() { |
|
71 | 71 | global $wpdb; |
72 | 72 | $results = $wpdb->get_results("SHOW TABLES LIKE '".$wpdb->prefix."events_attendee_checkin"."'"); |
73 | - if($results){ |
|
73 | + if ($results) { |
|
74 | 74 | return true; |
75 | - }else{ |
|
75 | + } else { |
|
76 | 76 | return false; |
77 | 77 | } |
78 | 78 | } |
79 | 79 | public function can_migrate_from_version($version_array) { |
80 | 80 | $version_string = $version_array['Core']; |
81 | - if($version_string < '4.0.0' && $version_string > '3.1.26' ){ |
|
81 | + if ($version_string < '4.0.0' && $version_string > '3.1.26') { |
|
82 | 82 | // echo "$version_string can be migrated fro"; |
83 | 83 | return true; |
84 | - }elseif( ! $version_string ){ |
|
84 | + }elseif ( ! $version_string) { |
|
85 | 85 | // echo "no version string provided: $version_string"; |
86 | 86 | //no version string provided... this must be pre 4.1 |
87 | 87 | //because since 4.1 we're |
88 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
89 | - }else{ |
|
88 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
89 | + } else { |
|
90 | 90 | // echo "$version_string doesnt apply"; |
91 | 91 | return false; |
92 | 92 | } |
@@ -96,15 +96,15 @@ discard block |
||
96 | 96 | } |
97 | 97 | public function schema_changes_before_migration() { |
98 | 98 | //relies on 4.1's EEH_Activation::create_table |
99 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
99 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
100 | 100 | |
101 | - $table_name='esp_answer'; |
|
102 | - $sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
101 | + $table_name = 'esp_answer'; |
|
102 | + $sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
103 | 103 | REG_ID INT UNSIGNED NOT NULL, |
104 | 104 | QST_ID INT UNSIGNED NOT NULL, |
105 | 105 | ANS_value TEXT NOT NULL, |
106 | 106 | PRIMARY KEY (ANS_ID)"; |
107 | - $this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
107 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
108 | 108 | |
109 | 109 | $table_name = 'esp_attendee_meta'; |
110 | 110 | $sql = "ATTM_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | CNT_is_EU TINYINT(1) DEFAULT '0', |
145 | 145 | CNT_active TINYINT(1) DEFAULT '0', |
146 | 146 | PRIMARY KEY (CNT_ISO)"; |
147 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
147 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
148 | 148 | |
149 | 149 | |
150 | 150 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | |
167 | 167 | |
168 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
168 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
169 | 169 | $table_name = 'esp_event_meta'; |
170 | 170 | $sql = " |
171 | 171 | EVTM_ID INT NOT NULL AUTO_INCREMENT, |
@@ -182,41 +182,41 @@ discard block |
||
182 | 182 | EVT_external_URL VARCHAR(200) NULL, |
183 | 183 | EVT_donations TINYINT(1) NULL, |
184 | 184 | PRIMARY KEY (EVTM_ID)"; |
185 | - $this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
185 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
186 | 186 | |
187 | 187 | |
188 | 188 | |
189 | - $table_name='esp_event_question_group'; |
|
190 | - $sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
189 | + $table_name = 'esp_event_question_group'; |
|
190 | + $sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
191 | 191 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
192 | 192 | QSG_ID INT UNSIGNED NOT NULL, |
193 | 193 | EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
194 | 194 | PRIMARY KEY (EQG_ID)"; |
195 | - $this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
195 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
196 | 196 | |
197 | 197 | |
198 | 198 | |
199 | - $table_name='esp_event_venue'; |
|
200 | - $sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
199 | + $table_name = 'esp_event_venue'; |
|
200 | + $sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
201 | 201 | EVT_ID BIGINT(20) UNSIGNED NOT NULL, |
202 | 202 | VNU_ID BIGINT(20) UNSIGNED NOT NULL, |
203 | 203 | EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
204 | 204 | PRIMARY KEY (EVV_ID)"; |
205 | - $this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
205 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
206 | 206 | |
207 | 207 | |
208 | 208 | |
209 | - $table_name='esp_extra_meta'; |
|
210 | - $sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
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 | - $this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
216 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
217 | 217 | |
218 | - $table_name='esp_line_item'; |
|
219 | - $sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
218 | + $table_name = 'esp_line_item'; |
|
219 | + $sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT, |
|
220 | 220 | LIN_code VARCHAR(245) NOT NULL DEFAULT '', |
221 | 221 | TXN_ID INT(11) DEFAULT NULL, |
222 | 222 | LIN_name VARCHAR(245) NOT NULL DEFAULT '', |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | OBJ_ID INT(11) DEFAULT NULL, |
233 | 233 | OBJ_type VARCHAR(45)DEFAULT NULL, |
234 | 234 | PRIMARY KEY (LIN_ID)"; |
235 | - $this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB' ); |
|
235 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
236 | 236 | |
237 | 237 | $table_name = 'esp_message_template'; |
238 | 238 | $sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | PRIMARY KEY (GRP_ID), |
260 | 260 | KEY EVT_ID (EVT_ID), |
261 | 261 | KEY MTP_user_id (MTP_user_id)"; |
262 | - $this->_table_is_new_in_this_version( $table_name, $sql, 'ENGINE=InnoDB'); |
|
262 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
263 | 263 | |
264 | 264 | |
265 | 265 | |
@@ -367,8 +367,8 @@ discard block |
||
367 | 367 | |
368 | 368 | |
369 | 369 | |
370 | - $table_name='esp_question'; |
|
371 | - $sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
370 | + $table_name = 'esp_question'; |
|
371 | + $sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
372 | 372 | QST_display_text TEXT NOT NULL, |
373 | 373 | QST_admin_label VARCHAR(255) NOT NULL, |
374 | 374 | QST_system VARCHAR(25) DEFAULT NULL, |
@@ -380,12 +380,12 @@ discard block |
||
380 | 380 | QST_wp_user BIGINT UNSIGNED NULL, |
381 | 381 | QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0, |
382 | 382 | PRIMARY KEY (QST_ID)'; |
383 | - $this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
383 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
384 | 384 | |
385 | - EEH_Activation::drop_index( 'esp_question_group', 'QSG_identifier_UNIQUE' ); |
|
385 | + EEH_Activation::drop_index('esp_question_group', 'QSG_identifier_UNIQUE'); |
|
386 | 386 | |
387 | 387 | $table_name = 'esp_question_group'; |
388 | - $sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
388 | + $sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
389 | 389 | QSG_name VARCHAR(255) NOT NULL, |
390 | 390 | QSG_identifier VARCHAR(100) NOT NULL, |
391 | 391 | QSG_desc TEXT NULL, |
@@ -396,27 +396,27 @@ discard block |
||
396 | 396 | QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
397 | 397 | PRIMARY KEY (QSG_ID), |
398 | 398 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)'; |
399 | - $this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
399 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
400 | 400 | |
401 | 401 | |
402 | 402 | |
403 | - $table_name='esp_question_group_question'; |
|
404 | - $sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
403 | + $table_name = 'esp_question_group_question'; |
|
404 | + $sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
405 | 405 | QSG_ID INT UNSIGNED NOT NULL, |
406 | 406 | QST_ID INT UNSIGNED NOT NULL, |
407 | 407 | PRIMARY KEY (QGQ_ID) "; |
408 | - $this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
408 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
409 | 409 | |
410 | 410 | |
411 | 411 | |
412 | - $table_name='esp_question_option'; |
|
413 | - $sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
412 | + $table_name = 'esp_question_option'; |
|
413 | + $sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, |
|
414 | 414 | QSO_value VARCHAR(255) NOT NULL, |
415 | 415 | QSO_desc TEXT NOT NULL, |
416 | 416 | QST_ID INT UNSIGNED NOT NULL, |
417 | 417 | QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, |
418 | 418 | PRIMARY KEY (QSO_ID)"; |
419 | - $this->_table_is_new_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
419 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
420 | 420 | |
421 | 421 | |
422 | 422 | |
@@ -449,8 +449,8 @@ discard block |
||
449 | 449 | |
450 | 450 | |
451 | 451 | |
452 | - $table_name='esp_checkin'; |
|
453 | - $sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
452 | + $table_name = 'esp_checkin'; |
|
453 | + $sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, |
|
454 | 454 | REG_ID INT(10) UNSIGNED NOT NULL, |
455 | 455 | DTT_ID INT(10) UNSIGNED NOT NULL, |
456 | 456 | CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1, |
@@ -557,12 +557,12 @@ discard block |
||
557 | 557 | |
558 | 558 | global $wpdb; |
559 | 559 | $state_table = $wpdb->prefix."esp_state"; |
560 | - if ( EEH_Activation::table_exists( $state_table ) ) { |
|
560 | + if (EEH_Activation::table_exists($state_table)) { |
|
561 | 561 | |
562 | - $SQL = "SELECT COUNT('STA_ID') FROM " . $state_table; |
|
562 | + $SQL = "SELECT COUNT('STA_ID') FROM ".$state_table; |
|
563 | 563 | $states = $wpdb->get_var($SQL); |
564 | - if ( ! $states ) { |
|
565 | - $SQL = "INSERT INTO " . $state_table . " |
|
564 | + if ( ! $states) { |
|
565 | + $SQL = "INSERT INTO ".$state_table." |
|
566 | 566 | (STA_ID, CNT_ISO, STA_abbrev, STA_name, STA_active) VALUES |
567 | 567 | (1, 'US', 'AK', 'Alaska', 1), |
568 | 568 | (2, 'US', 'AL', 'Alabama', 1), |
@@ -649,12 +649,12 @@ discard block |
||
649 | 649 | |
650 | 650 | global $wpdb; |
651 | 651 | $country_table = $wpdb->prefix."esp_country"; |
652 | - if ( EEH_Activation::table_exists( $country_table ) ) { |
|
652 | + if (EEH_Activation::table_exists($country_table)) { |
|
653 | 653 | |
654 | - $SQL = "SELECT COUNT('CNT_ISO') FROM " . $country_table; |
|
654 | + $SQL = "SELECT COUNT('CNT_ISO') FROM ".$country_table; |
|
655 | 655 | $countries = $wpdb->get_var($SQL); |
656 | - if ( ! $countries ) { |
|
657 | - $SQL = "INSERT INTO " . $country_table . " |
|
656 | + if ( ! $countries) { |
|
657 | + $SQL = "INSERT INTO ".$country_table." |
|
658 | 658 | (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) VALUES |
659 | 659 | ('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
660 | 660 | ('AE', 'ARE', 0, 'United Arab Emirates', 'AED', 'Dirham', 'Dirhams', 'د.إ', 1, 2, '+971', 0, 0), |
@@ -901,20 +901,20 @@ discard block |
||
901 | 901 | global $wpdb; |
902 | 902 | $price_type_table = $wpdb->prefix."esp_price_type"; |
903 | 903 | |
904 | - if ( EEH_Activation::table_exists( $price_type_table ) ) { |
|
904 | + if (EEH_Activation::table_exists($price_type_table)) { |
|
905 | 905 | |
906 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table; |
|
907 | - $price_types_exist = $wpdb->get_var( $SQL ); |
|
906 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table; |
|
907 | + $price_types_exist = $wpdb->get_var($SQL); |
|
908 | 908 | |
909 | - if ( ! $price_types_exist ) { |
|
909 | + if ( ! $price_types_exist) { |
|
910 | 910 | $SQL = "INSERT INTO $price_type_table ( PRT_ID, PRT_name, PBT_ID, PRT_is_percent, PRT_order, PRT_deleted ) VALUES |
911 | - (1, '" . __('Base Price', 'event_espresso') . "', 1, 0, 0, 0), |
|
912 | - (2, '" . __('Percent Discount', 'event_espresso') . "', 2, 1, 20, 0), |
|
913 | - (3, '" . __('Fixed Discount', 'event_espresso') . "', 2, 0, 30, 0), |
|
914 | - (4, '" . __('Percent Surcharge', 'event_espresso') . "', 3, 1, 40, 0), |
|
915 | - (5, '" . __('Fixed Surcharge', 'event_espresso') . "', 3, 0, 50, 0);"; |
|
916 | - $SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_price_types__SQL', $SQL ); |
|
917 | - $wpdb->query( $SQL ); |
|
911 | + (1, '".__('Base Price', 'event_espresso')."', 1, 0, 0, 0), |
|
912 | + (2, '" . __('Percent Discount', 'event_espresso')."', 2, 1, 20, 0), |
|
913 | + (3, '" . __('Fixed Discount', 'event_espresso')."', 2, 0, 30, 0), |
|
914 | + (4, '" . __('Percent Surcharge', 'event_espresso')."', 3, 1, 40, 0), |
|
915 | + (5, '" . __('Fixed Surcharge', 'event_espresso')."', 3, 0, 50, 0);"; |
|
916 | + $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_price_types__SQL', $SQL); |
|
917 | + $wpdb->query($SQL); |
|
918 | 918 | } |
919 | 919 | } |
920 | 920 | } |
@@ -934,16 +934,16 @@ discard block |
||
934 | 934 | global $wpdb; |
935 | 935 | $price_table = $wpdb->prefix."esp_price"; |
936 | 936 | |
937 | - if ( EEH_Activation::table_exists( $price_table ) ) { |
|
937 | + if (EEH_Activation::table_exists($price_table)) { |
|
938 | 938 | |
939 | - $SQL = 'SELECT COUNT(PRC_ID) FROM ' .$price_table; |
|
940 | - $prices_exist = $wpdb->get_var( $SQL ); |
|
939 | + $SQL = 'SELECT COUNT(PRC_ID) FROM '.$price_table; |
|
940 | + $prices_exist = $wpdb->get_var($SQL); |
|
941 | 941 | |
942 | - if ( ! $prices_exist ) { |
|
942 | + if ( ! $prices_exist) { |
|
943 | 943 | $SQL = "INSERT INTO $price_table |
944 | 944 | (PRC_ID, PRT_ID, PRC_amount, PRC_name, PRC_desc, PRC_is_default, PRC_overrides, PRC_order, PRC_deleted, PRC_parent ) VALUES |
945 | 945 | (1, 1, '0.00', 'Free Admission', '', 1, NULL, 0, 0, 0);"; |
946 | - $SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_prices__SQL', $SQL ); |
|
946 | + $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_prices__SQL', $SQL); |
|
947 | 947 | $wpdb->query($SQL); |
948 | 948 | } |
949 | 949 | } |
@@ -960,34 +960,34 @@ discard block |
||
960 | 960 | |
961 | 961 | global $wpdb; |
962 | 962 | $ticket_table = $wpdb->prefix."esp_ticket"; |
963 | - if ( EEH_Activation::table_exists( $ticket_table ) ) { |
|
963 | + if (EEH_Activation::table_exists($ticket_table)) { |
|
964 | 964 | |
965 | - $SQL = 'SELECT COUNT(TKT_ID) FROM ' . $ticket_table; |
|
965 | + $SQL = 'SELECT COUNT(TKT_ID) FROM '.$ticket_table; |
|
966 | 966 | $tickets_exist = $wpdb->get_var($SQL); |
967 | 967 | |
968 | - if ( ! $tickets_exist ) { |
|
968 | + if ( ! $tickets_exist) { |
|
969 | 969 | $SQL = "INSERT INTO $ticket_table |
970 | 970 | ( TKT_ID, TTM_ID, TKT_name, TKT_description, TKT_qty, TKT_sold, TKT_uses, 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 |
971 | - ( 1, 0, '" . __("Free Ticket", "event_espresso") . "', '', 100, 0, -1, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);"; |
|
972 | - $SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL ); |
|
971 | + ( 1, 0, '".__("Free Ticket", "event_espresso")."', '', 100, 0, -1, 0, -1, 0.00, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, 0, 1, 1, 0, 0);"; |
|
972 | + $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL', $SQL); |
|
973 | 973 | $wpdb->query($SQL); |
974 | 974 | } |
975 | 975 | } |
976 | 976 | $ticket_price_table = $wpdb->prefix."esp_ticket_price"; |
977 | 977 | |
978 | - if ( EEH_Activation::table_exists( $ticket_price_table ) ) { |
|
978 | + if (EEH_Activation::table_exists($ticket_price_table)) { |
|
979 | 979 | |
980 | - $SQL = 'SELECT COUNT(TKP_ID) FROM ' . $ticket_price_table; |
|
980 | + $SQL = 'SELECT COUNT(TKP_ID) FROM '.$ticket_price_table; |
|
981 | 981 | $ticket_prc_exist = $wpdb->get_var($SQL); |
982 | 982 | |
983 | - if ( ! $ticket_prc_exist ) { |
|
983 | + if ( ! $ticket_prc_exist) { |
|
984 | 984 | |
985 | 985 | $SQL = "INSERT INTO $ticket_price_table |
986 | 986 | ( TKP_ID, TKT_ID, PRC_ID ) VALUES |
987 | 987 | ( 1, 1, 1 ) |
988 | 988 | "; |
989 | 989 | |
990 | - $SQL = apply_filters( 'FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL ); |
|
990 | + $SQL = apply_filters('FHEE__EE_DMS_4_1_0__insert_default_tickets__SQL__ticket_price', $SQL); |
|
991 | 991 | $wpdb->query($SQL); |
992 | 992 | } |
993 | 993 | } |
@@ -1000,20 +1000,20 @@ discard block |
||
1000 | 1000 | * @param string $country_name |
1001 | 1001 | * @return array where keys are columns, values are column values |
1002 | 1002 | */ |
1003 | - public function get_or_create_country($country_name){ |
|
1004 | - if( ! $country_name ){ |
|
1003 | + public function get_or_create_country($country_name) { |
|
1004 | + if ( ! $country_name) { |
|
1005 | 1005 | throw new EE_Error(__("Could not get a country because country name is blank", "event_espresso")); |
1006 | 1006 | } |
1007 | 1007 | global $wpdb; |
1008 | 1008 | $country_table = $wpdb->prefix."esp_country"; |
1009 | - if(is_int($country_name)){ |
|
1009 | + if (is_int($country_name)) { |
|
1010 | 1010 | $country_name = $this->get_iso_from_3_1_country_id($country_name); |
1011 | 1011 | } |
1012 | 1012 | $country = $wpdb->get_row($wpdb->prepare("SELECT * FROM $country_table WHERE |
1013 | 1013 | CNT_ISO LIKE %s OR |
1014 | 1014 | CNT_ISO3 LIKE %s OR |
1015 | - CNT_name LIKE %s LIMIT 1",$country_name,$country_name,$country_name),ARRAY_A); |
|
1016 | - if( ! $country ){ |
|
1015 | + CNT_name LIKE %s LIMIT 1", $country_name, $country_name, $country_name), ARRAY_A); |
|
1016 | + if ( ! $country) { |
|
1017 | 1017 | //insert a new one then |
1018 | 1018 | $cols_n_values = array( |
1019 | 1019 | 'CNT_ISO'=> $this->_find_available_country_iso(2), |
@@ -1033,26 +1033,26 @@ discard block |
||
1033 | 1033 | 'CNT_active'=>true |
1034 | 1034 | ); |
1035 | 1035 | $data_types = array( |
1036 | - '%s',//CNT_ISO |
|
1037 | - '%s',//CNT_ISO3 |
|
1038 | - '%d',//RGN_ID |
|
1039 | - '%s',//CNT_name |
|
1040 | - '%s',//CNT_cur_code |
|
1041 | - '%s',//CNT_cur_single |
|
1042 | - '%s',//CNT_cur_plural |
|
1043 | - '%s',//CNT_cur_sign |
|
1044 | - '%d',//CNT_cur_sign_b4 |
|
1045 | - '%d',//CNT_cur_dec_plc |
|
1046 | - '%s',//CNT_cur_dec_mrk |
|
1047 | - '%s',//CNT_cur_thsnds |
|
1048 | - '%s',//CNT_tel_code |
|
1049 | - '%d',//CNT_is_EU |
|
1050 | - '%d',//CNT_active |
|
1036 | + '%s', //CNT_ISO |
|
1037 | + '%s', //CNT_ISO3 |
|
1038 | + '%d', //RGN_ID |
|
1039 | + '%s', //CNT_name |
|
1040 | + '%s', //CNT_cur_code |
|
1041 | + '%s', //CNT_cur_single |
|
1042 | + '%s', //CNT_cur_plural |
|
1043 | + '%s', //CNT_cur_sign |
|
1044 | + '%d', //CNT_cur_sign_b4 |
|
1045 | + '%d', //CNT_cur_dec_plc |
|
1046 | + '%s', //CNT_cur_dec_mrk |
|
1047 | + '%s', //CNT_cur_thsnds |
|
1048 | + '%s', //CNT_tel_code |
|
1049 | + '%d', //CNT_is_EU |
|
1050 | + '%d', //CNT_active |
|
1051 | 1051 | ); |
1052 | 1052 | $success = $wpdb->insert($country_table, |
1053 | 1053 | $cols_n_values, |
1054 | 1054 | $data_types); |
1055 | - if( ! $success){ |
|
1055 | + if ( ! $success) { |
|
1056 | 1056 | throw new EE_Error($this->_create_error_message_for_db_insertion('N/A', array('country_id'=>$country_name), $country_table, $cols_n_values, $data_types)); |
1057 | 1057 | } |
1058 | 1058 | $country = $cols_n_values; |
@@ -1064,18 +1064,18 @@ discard block |
||
1064 | 1064 | * @global type $wpdb |
1065 | 1065 | * @return string |
1066 | 1066 | */ |
1067 | - private function _find_available_country_iso($num_letters = 2){ |
|
1067 | + private function _find_available_country_iso($num_letters = 2) { |
|
1068 | 1068 | global $wpdb; |
1069 | 1069 | $country_table = $wpdb->prefix."esp_country"; |
1070 | 1070 | $attempts = 0; |
1071 | - do{ |
|
1071 | + do { |
|
1072 | 1072 | $current_iso = strtoupper(wp_generate_password($num_letters, false)); |
1073 | - $country_with_that_iso = $wpdb->get_var($wpdb->prepare("SELECT count(CNT_ISO) FROM ".$country_table." WHERE CNT_ISO=%s",$current_iso)); |
|
1073 | + $country_with_that_iso = $wpdb->get_var($wpdb->prepare("SELECT count(CNT_ISO) FROM ".$country_table." WHERE CNT_ISO=%s", $current_iso)); |
|
1074 | 1074 | $attempts++; |
1075 | 1075 | //keep going until we find an available country code, or we arbitrarily |
1076 | 1076 | //decide we've tried this enough. Somehow they have way too many countries |
1077 | 1077 | //(probably because they're mis-using the EE3 country_id like a custom question) |
1078 | - }while( intval($country_with_that_iso) && $attempts < 200 ); |
|
1078 | + }while (intval($country_with_that_iso) && $attempts < 200); |
|
1079 | 1079 | return $current_iso; |
1080 | 1080 | } |
1081 | 1081 | |
@@ -1086,14 +1086,14 @@ discard block |
||
1086 | 1086 | * @param string $state_name |
1087 | 1087 | * @return array where keys are columns, values are column values |
1088 | 1088 | */ |
1089 | - public function get_or_create_state($state_name,$country_name = ''){ |
|
1090 | - if( ! $state_name ){ |
|
1089 | + public function get_or_create_state($state_name, $country_name = '') { |
|
1090 | + if ( ! $state_name) { |
|
1091 | 1091 | throw new EE_Error(__("Could not get-or-create state because no state name was provided", "event_espresso")); |
1092 | 1092 | } |
1093 | - try{ |
|
1093 | + try { |
|
1094 | 1094 | $country = $this->get_or_create_country($country_name); |
1095 | 1095 | $country_iso = $country['CNT_ISO']; |
1096 | - }catch(EE_Error $e){ |
|
1096 | + } catch (EE_Error $e) { |
|
1097 | 1097 | $country_iso = $this->get_default_country_iso(); |
1098 | 1098 | } |
1099 | 1099 | global $wpdb; |
@@ -1101,24 +1101,24 @@ discard block |
||
1101 | 1101 | $state = $wpdb->get_row($wpdb->prepare("SELECT * FROM $state_table WHERE |
1102 | 1102 | (STA_abbrev LIKE %s OR |
1103 | 1103 | STA_name LIKE %s) AND |
1104 | - CNT_ISO LIKE %s LIMIT 1",$state_name,$state_name,$country_iso),ARRAY_A); |
|
1105 | - if ( ! $state){ |
|
1104 | + CNT_ISO LIKE %s LIMIT 1", $state_name, $state_name, $country_iso), ARRAY_A); |
|
1105 | + if ( ! $state) { |
|
1106 | 1106 | //insert a new one then |
1107 | 1107 | $cols_n_values = array( |
1108 | 1108 | 'CNT_ISO'=>$country_iso, |
1109 | - 'STA_abbrev'=>substr($state_name,0,6), |
|
1109 | + 'STA_abbrev'=>substr($state_name, 0, 6), |
|
1110 | 1110 | 'STA_name'=>$state_name, |
1111 | 1111 | 'STA_active'=>true |
1112 | 1112 | ); |
1113 | 1113 | $data_types = array( |
1114 | - '%s',//CNT_ISO |
|
1115 | - '%s',//STA_abbrev |
|
1116 | - '%s',//STA_name |
|
1117 | - '%d',//STA_active |
|
1114 | + '%s', //CNT_ISO |
|
1115 | + '%s', //STA_abbrev |
|
1116 | + '%s', //STA_name |
|
1117 | + '%d', //STA_active |
|
1118 | 1118 | ); |
1119 | - $success = $wpdb->insert($state_table,$cols_n_values,$data_types); |
|
1120 | - if ( ! $success ){ |
|
1121 | - throw new EE_Error($this->_create_error_message_for_db_insertion('N/A', array('state'=>$state_name,'country_id'=>$country_name), $state_table, $cols_n_values, $data_types)); |
|
1119 | + $success = $wpdb->insert($state_table, $cols_n_values, $data_types); |
|
1120 | + if ( ! $success) { |
|
1121 | + throw new EE_Error($this->_create_error_message_for_db_insertion('N/A', array('state'=>$state_name, 'country_id'=>$country_name), $state_table, $cols_n_values, $data_types)); |
|
1122 | 1122 | } |
1123 | 1123 | $state = $cols_n_values; |
1124 | 1124 | $state['STA_ID'] = $wpdb->insert_id; |
@@ -1131,21 +1131,21 @@ discard block |
||
1131 | 1131 | * @param type $timeString |
1132 | 1132 | * @return string in the php DATETIME format: "G:i" (24-hour format hour with leading zeros, a colon, and minutes with leading zeros) |
1133 | 1133 | */ |
1134 | - public function convertTimeFromAMPM($timeString){ |
|
1134 | + public function convertTimeFromAMPM($timeString) { |
|
1135 | 1135 | $matches = array(); |
1136 | - preg_match("~(\\d*):(\\d*)~",$timeString,$matches); |
|
1137 | - if( ! $matches || count($matches)<3){ |
|
1136 | + preg_match("~(\\d*):(\\d*)~", $timeString, $matches); |
|
1137 | + if ( ! $matches || count($matches) < 3) { |
|
1138 | 1138 | $hour = '00'; |
1139 | 1139 | $minutes = '00'; |
1140 | - }else{ |
|
1140 | + } else { |
|
1141 | 1141 | $hour = intval($matches[1]); |
1142 | 1142 | $minutes = $matches[2]; |
1143 | 1143 | } |
1144 | - if(strpos($timeString, 'PM') || strpos($timeString, 'pm')){ |
|
1144 | + if (strpos($timeString, 'PM') || strpos($timeString, 'pm')) { |
|
1145 | 1145 | $hour = intval($hour) + 12; |
1146 | 1146 | } |
1147 | - $hour = str_pad( "$hour", 2, '0',STR_PAD_LEFT); |
|
1148 | - $minutes = str_pad( "$minutes", 2, '0',STR_PAD_LEFT); |
|
1147 | + $hour = str_pad("$hour", 2, '0', STR_PAD_LEFT); |
|
1148 | + $minutes = str_pad("$minutes", 2, '0', STR_PAD_LEFT); |
|
1149 | 1149 | return "$hour:$minutes"; |
1150 | 1150 | } |
1151 | 1151 | |
@@ -1154,7 +1154,7 @@ discard block |
||
1154 | 1154 | * @param int $country_id |
1155 | 1155 | * @return string the country's ISO3 code |
1156 | 1156 | */ |
1157 | - public function get_iso_from_3_1_country_id($country_id){ |
|
1157 | + public function get_iso_from_3_1_country_id($country_id) { |
|
1158 | 1158 | $old_countries = array( |
1159 | 1159 | array(64, 'United States', 'US', 'USA', 1), |
1160 | 1160 | array(15, 'Australia', 'AU', 'AUS', 1), |
@@ -1380,9 +1380,9 @@ discard block |
||
1380 | 1380 | array(226, 'Zimbabwe', 'ZW', 'ZWE', 1)); |
1381 | 1381 | |
1382 | 1382 | $country_iso = 'US'; |
1383 | - foreach($old_countries as $country_array){ |
|
1383 | + foreach ($old_countries as $country_array) { |
|
1384 | 1384 | //note: index 0 is the 3.1 country ID |
1385 | - if($country_array[0] == $country_id){ |
|
1385 | + if ($country_array[0] == $country_id) { |
|
1386 | 1386 | //note: index 2 is the ISO |
1387 | 1387 | $country_iso = $country_array[2]; |
1388 | 1388 | break; |
@@ -1395,8 +1395,8 @@ discard block |
||
1395 | 1395 | * Gets the ISO3 for the |
1396 | 1396 | * @return string |
1397 | 1397 | */ |
1398 | - public function get_default_country_iso(){ |
|
1399 | - $old_org_options= get_option('events_organization_settings'); |
|
1398 | + public function get_default_country_iso() { |
|
1399 | + $old_org_options = get_option('events_organization_settings'); |
|
1400 | 1400 | $iso = $this->get_iso_from_3_1_country_id($old_org_options['organization_country']); |
1401 | 1401 | return $iso; |
1402 | 1402 | } |
@@ -1408,13 +1408,13 @@ discard block |
||
1408 | 1408 | * the event's DEFAULT payment status, or the attendee's payment status) required pre-approval. |
1409 | 1409 | * @return string STS_ID for use in 4.1 |
1410 | 1410 | */ |
1411 | - public function convert_3_1_payment_status_to_4_1_STS_ID($payment_status, $this_thing_required_pre_approval = false){ |
|
1411 | + public function convert_3_1_payment_status_to_4_1_STS_ID($payment_status, $this_thing_required_pre_approval = false) { |
|
1412 | 1412 | |
1413 | 1413 | //EE team can read the related discussion: https://app.asana.com/0/2400967562914/9418495544455 |
1414 | - if($this_thing_required_pre_approval){ |
|
1414 | + if ($this_thing_required_pre_approval) { |
|
1415 | 1415 | return 'RNA'; |
1416 | - }else{ |
|
1417 | - $mapping = $default_reg_stati_conversions=array( |
|
1416 | + } else { |
|
1417 | + $mapping = $default_reg_stati_conversions = array( |
|
1418 | 1418 | 'Completed'=>'RAP', |
1419 | 1419 | ''=>'RPP', |
1420 | 1420 | 'Incomplete'=>'RPP', |
@@ -1444,22 +1444,22 @@ discard block |
||
1444 | 1444 | * @param EE_Data_Migration_Script_Stage $migration_stage the stage which called this, where errors should be added |
1445 | 1445 | * @return boolean whether or not we had to do the big job of creating an image attachment |
1446 | 1446 | */ |
1447 | - public function convert_image_url_to_attachment_and_attach_to_post($guid,$new_cpt_id, EE_Data_Migration_Script_Stage $migration_stage){ |
|
1447 | + public function convert_image_url_to_attachment_and_attach_to_post($guid, $new_cpt_id, EE_Data_Migration_Script_Stage $migration_stage) { |
|
1448 | 1448 | $created_attachment_post = false; |
1449 | 1449 | $guid = $this->_get_original_guid($guid); |
1450 | - if($guid){ |
|
1450 | + if ($guid) { |
|
1451 | 1451 | //check for an existing attachment post with this guid |
1452 | 1452 | $attachment_post_id = $this->_get_image_attachment_id_by_GUID($guid); |
1453 | - if( ! $attachment_post_id){ |
|
1453 | + if ( ! $attachment_post_id) { |
|
1454 | 1454 | //post thumbnail with that GUID doesn't exist, we should create one |
1455 | 1455 | $attachment_post_id = $this->_create_image_attachment_from_GUID($guid, $migration_stage); |
1456 | 1456 | $created_attachment_post = true; |
1457 | 1457 | } |
1458 | 1458 | //double-check we actually have an attachment post |
1459 | - if( $attachment_post_id){ |
|
1460 | - update_post_meta($new_cpt_id,'_thumbnail_id',$attachment_post_id); |
|
1461 | - }else{ |
|
1462 | - $migration_stage->add_error(sprintf(__("Could not update event image %s for CPT with ID %d, but attachments post ID is %d", "event_espresso"),$guid,$new_cpt_id,$attachment_post_id)); |
|
1459 | + if ($attachment_post_id) { |
|
1460 | + update_post_meta($new_cpt_id, '_thumbnail_id', $attachment_post_id); |
|
1461 | + } else { |
|
1462 | + $migration_stage->add_error(sprintf(__("Could not update event image %s for CPT with ID %d, but attachments post ID is %d", "event_espresso"), $guid, $new_cpt_id, $attachment_post_id)); |
|
1463 | 1463 | } |
1464 | 1464 | } |
1465 | 1465 | return $created_attachment_post; |
@@ -1473,13 +1473,13 @@ discard block |
||
1473 | 1473 | * @param string $guid_in_old_event |
1474 | 1474 | * @return string either the original guid, or $guid_in_old_event if we couldn't figure out what the original was |
1475 | 1475 | */ |
1476 | - private function _get_original_guid($guid_in_old_event){ |
|
1477 | - $original_guid = preg_replace('~-\d*x\d*\.~','.',$guid_in_old_event,1); |
|
1476 | + private function _get_original_guid($guid_in_old_event) { |
|
1477 | + $original_guid = preg_replace('~-\d*x\d*\.~', '.', $guid_in_old_event, 1); |
|
1478 | 1478 | //do a head request to verify the file exists |
1479 | 1479 | $head_response = wp_remote_head($original_guid); |
1480 | - if( ! $head_response instanceof WP_Error && $head_response['response']['message'] == 'OK'){ |
|
1480 | + if ( ! $head_response instanceof WP_Error && $head_response['response']['message'] == 'OK') { |
|
1481 | 1481 | return $original_guid; |
1482 | - }else{ |
|
1482 | + } else { |
|
1483 | 1483 | return $guid_in_old_event; |
1484 | 1484 | } |
1485 | 1485 | } |
@@ -1491,32 +1491,32 @@ discard block |
||
1491 | 1491 | * @param EE_Data_Migration_Script_Stage $migration_stage |
1492 | 1492 | * @return int |
1493 | 1493 | */ |
1494 | - private function _create_image_attachment_from_GUID($guid, EE_Data_Migration_Script_Stage $migration_stage){ |
|
1495 | - if ( ! $guid){ |
|
1494 | + private function _create_image_attachment_from_GUID($guid, EE_Data_Migration_Script_Stage $migration_stage) { |
|
1495 | + if ( ! $guid) { |
|
1496 | 1496 | $migration_stage->add_error(sprintf(__("Cannot create image attachment for a blank GUID!", "event_espresso"))); |
1497 | 1497 | return 0; |
1498 | 1498 | } |
1499 | - $wp_filetype = wp_check_filetype(basename($guid), null ); |
|
1499 | + $wp_filetype = wp_check_filetype(basename($guid), null); |
|
1500 | 1500 | $wp_upload_dir = wp_upload_dir(); |
1501 | 1501 | //if the file is located remotely, download it to our uploads DIR, because wp_genereate_attachmnet_metadata needs the file to be local |
1502 | - if(strpos($guid,$wp_upload_dir['url']) === FALSE){ |
|
1502 | + if (strpos($guid, $wp_upload_dir['url']) === FALSE) { |
|
1503 | 1503 | //image is located remotely. download it and place it in the uploads directory |
1504 | - if( ! is_readable($guid)){ |
|
1505 | - $migration_stage->add_error(sprintf(__("Could not create image attachment from non-existent file: %s", "event_espresso"),$guid)); |
|
1504 | + if ( ! is_readable($guid)) { |
|
1505 | + $migration_stage->add_error(sprintf(__("Could not create image attachment from non-existent file: %s", "event_espresso"), $guid)); |
|
1506 | 1506 | return 0; |
1507 | 1507 | } |
1508 | - $contents= file_get_contents($guid); |
|
1509 | - if($contents === FALSE){ |
|
1510 | - $migration_stage->add_error(sprintf(__("Could not read image at %s, and therefore couldnt create an attachment post for it.", "event_espresso"),$guid)); |
|
1508 | + $contents = file_get_contents($guid); |
|
1509 | + if ($contents === FALSE) { |
|
1510 | + $migration_stage->add_error(sprintf(__("Could not read image at %s, and therefore couldnt create an attachment post for it.", "event_espresso"), $guid)); |
|
1511 | 1511 | return false; |
1512 | 1512 | } |
1513 | - $local_filepath = $wp_upload_dir['path'].DS.basename($guid); |
|
1513 | + $local_filepath = $wp_upload_dir['path'].DS.basename($guid); |
|
1514 | 1514 | $savefile = fopen($local_filepath, 'w'); |
1515 | 1515 | fwrite($savefile, $contents); |
1516 | 1516 | fclose($savefile); |
1517 | - $guid = str_replace($wp_upload_dir['path'],$wp_upload_dir['url'],$local_filepath); |
|
1518 | - }else{ |
|
1519 | - $local_filepath = str_replace($wp_upload_dir['url'],$wp_upload_dir['path'],$guid); |
|
1517 | + $guid = str_replace($wp_upload_dir['path'], $wp_upload_dir['url'], $local_filepath); |
|
1518 | + } else { |
|
1519 | + $local_filepath = str_replace($wp_upload_dir['url'], $wp_upload_dir['path'], $guid); |
|
1520 | 1520 | } |
1521 | 1521 | |
1522 | 1522 | $attachment = array( |
@@ -1526,24 +1526,24 @@ discard block |
||
1526 | 1526 | 'post_content' => '', |
1527 | 1527 | 'post_status' => 'inherit' |
1528 | 1528 | ); |
1529 | - $attach_id = wp_insert_attachment( $attachment, $guid ); |
|
1530 | - if( ! $attach_id ){ |
|
1531 | - $migration_stage->add_error(sprintf(__("Could not create image attachment post from image '%s'. Attachment data was %s.", "event_espresso"),$guid,$this->_json_encode($attachment))); |
|
1529 | + $attach_id = wp_insert_attachment($attachment, $guid); |
|
1530 | + if ( ! $attach_id) { |
|
1531 | + $migration_stage->add_error(sprintf(__("Could not create image attachment post from image '%s'. Attachment data was %s.", "event_espresso"), $guid, $this->_json_encode($attachment))); |
|
1532 | 1532 | return $attach_id; |
1533 | 1533 | } |
1534 | 1534 | |
1535 | 1535 | // you must first include the image.php file |
1536 | 1536 | // for the function wp_generate_attachment_metadata() to work |
1537 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
1537 | + require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
1538 | 1538 | |
1539 | - $attach_data = wp_generate_attachment_metadata( $attach_id, $local_filepath ); |
|
1540 | - if( ! $attach_data){ |
|
1541 | - $migration_stage->add_error(sprintf(__("Coudl not genereate attachment metadata for attachment post %d with filepath %s and GUID %s. Please check the file was downloaded properly.", "event_espresso"),$attach_id,$local_filepath,$guid)); |
|
1539 | + $attach_data = wp_generate_attachment_metadata($attach_id, $local_filepath); |
|
1540 | + if ( ! $attach_data) { |
|
1541 | + $migration_stage->add_error(sprintf(__("Coudl not genereate attachment metadata for attachment post %d with filepath %s and GUID %s. Please check the file was downloaded properly.", "event_espresso"), $attach_id, $local_filepath, $guid)); |
|
1542 | 1542 | return $attach_id; |
1543 | 1543 | } |
1544 | - $metadata_save_result = wp_update_attachment_metadata( $attach_id, $attach_data ); |
|
1545 | - if( ! $metadata_save_result ){ |
|
1546 | - $migration_stage->add_error(sprintf(__("Could not update attachment metadata for attachment %d with data %s", "event_espresso"),$attach_id,$this->_json_encode($attach_data))); |
|
1544 | + $metadata_save_result = wp_update_attachment_metadata($attach_id, $attach_data); |
|
1545 | + if ( ! $metadata_save_result) { |
|
1546 | + $migration_stage->add_error(sprintf(__("Could not update attachment metadata for attachment %d with data %s", "event_espresso"), $attach_id, $this->_json_encode($attach_data))); |
|
1547 | 1547 | } |
1548 | 1548 | return $attach_id; |
1549 | 1549 | } |
@@ -1555,9 +1555,9 @@ discard block |
||
1555 | 1555 | * @param string $guid |
1556 | 1556 | * @return int |
1557 | 1557 | */ |
1558 | - private function _get_image_attachment_id_by_GUID($guid){ |
|
1558 | + private function _get_image_attachment_id_by_GUID($guid) { |
|
1559 | 1559 | global $wpdb; |
1560 | - $attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid=%s LIMIT 1",$guid)); |
|
1560 | + $attachment_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid=%s LIMIT 1", $guid)); |
|
1561 | 1561 | return $attachment_id; |
1562 | 1562 | } |
1563 | 1563 | /** |
@@ -1569,20 +1569,20 @@ discard block |
||
1569 | 1569 | * @param string $timezone |
1570 | 1570 | * @return string |
1571 | 1571 | */ |
1572 | - public function convert_date_string_to_utc(EE_Data_Migration_Script_Stage $stage, $row_of_data, $DATETIME_string,$timezone = null){ |
|
1572 | + public function convert_date_string_to_utc(EE_Data_Migration_Script_Stage $stage, $row_of_data, $DATETIME_string, $timezone = null) { |
|
1573 | 1573 | $original_tz = $timezone; |
1574 | - if( ! $timezone){ |
|
1574 | + if ( ! $timezone) { |
|
1575 | 1575 | $timezone = $this->_get_wp_timezone(); |
1576 | 1576 | } |
1577 | - if( ! $timezone){ |
|
1578 | - $stage->add_error(sprintf(__("Could not find timezone given %s for %s", "event_espresso"),$original_tz,$row_of_data)); |
|
1577 | + if ( ! $timezone) { |
|
1578 | + $stage->add_error(sprintf(__("Could not find timezone given %s for %s", "event_espresso"), $original_tz, $row_of_data)); |
|
1579 | 1579 | $timezone = 'UTC'; |
1580 | 1580 | } |
1581 | - try{ |
|
1582 | - $date_obj = new DateTime( $DATETIME_string, new DateTimeZone( $timezone ) ); |
|
1581 | + try { |
|
1582 | + $date_obj = new DateTime($DATETIME_string, new DateTimeZone($timezone)); |
|
1583 | 1583 | $date_obj->setTimezone(new DateTimeZone('UTC')); |
1584 | - }catch(Exception $e){ |
|
1585 | - $stage->add_error(sprintf(__("Could not convert time string '%s' using timezone '%s' into a proper DATETIME. Using current time instead.", "event_espresso"),$DATETIME_string,$timezone)); |
|
1584 | + } catch (Exception $e) { |
|
1585 | + $stage->add_error(sprintf(__("Could not convert time string '%s' using timezone '%s' into a proper DATETIME. Using current time instead.", "event_espresso"), $DATETIME_string, $timezone)); |
|
1586 | 1586 | $date_obj = new DateTime(); |
1587 | 1587 | } |
1588 | 1588 | |
@@ -1593,14 +1593,14 @@ discard block |
||
1593 | 1593 | * Gets the DEFAULT timezone string from wordpress (even if they set a gmt offset) |
1594 | 1594 | * @return string |
1595 | 1595 | */ |
1596 | - private function _get_wp_timezone(){ |
|
1597 | - $timezone = empty( $timezone ) ? get_option('timezone_string') : $timezone; |
|
1596 | + private function _get_wp_timezone() { |
|
1597 | + $timezone = empty($timezone) ? get_option('timezone_string') : $timezone; |
|
1598 | 1598 | |
1599 | 1599 | //if timezone is STILL empty then let's get the GMT offset and then set the timezone_string using our converter |
1600 | - if ( empty( $timezone ) ) { |
|
1600 | + if (empty($timezone)) { |
|
1601 | 1601 | //let's get a the WordPress UTC offset |
1602 | 1602 | $offset = get_option('gmt_offset'); |
1603 | - $timezone = $this->timezone_convert_to_string_from_offset( $offset ); |
|
1603 | + $timezone = $this->timezone_convert_to_string_from_offset($offset); |
|
1604 | 1604 | } |
1605 | 1605 | return $timezone; |
1606 | 1606 | } |
@@ -1609,11 +1609,11 @@ discard block |
||
1609 | 1609 | * @param int $offset |
1610 | 1610 | * @return boolean |
1611 | 1611 | */ |
1612 | - private function timezone_convert_to_string_from_offset($offset){ |
|
1612 | + private function timezone_convert_to_string_from_offset($offset) { |
|
1613 | 1613 | //shamelessly taken from bottom comment at http://ca1.php.net/manual/en/function.timezone-name-from-abbr.php because timezone_name_from_abbr() did NOT work as expected - its not reliable |
1614 | 1614 | $offset *= 3600; // convert hour offset to seconds |
1615 | 1615 | $abbrarray = timezone_abbreviations_list(); |
1616 | - foreach ($abbrarray as $abbr){ |
|
1616 | + foreach ($abbrarray as $abbr) { |
|
1617 | 1617 | foreach ($abbr as $city) |
1618 | 1618 | { |
1619 | 1619 | if ($city['offset'] == $offset) |
@@ -1627,32 +1627,32 @@ discard block |
||
1627 | 1627 | return FALSE; |
1628 | 1628 | } |
1629 | 1629 | |
1630 | - public function migration_page_hooks(){ |
|
1631 | - add_filter('FHEE__ee_migration_page__header',array($this,'_migrate_page_hook_simplify_version_strings'),10,3); |
|
1632 | - add_filter('FHEE__ee_migration_page__p_after_header',array($this,'_migration_page_hook_simplify_next_db_state'),10,2); |
|
1633 | - add_filter('FHEE__ee_migration_page__option_1_main',array($this,'_migrate_page_hook_simplify_version_strings'),10,3); |
|
1634 | - add_filter('FHEE__ee_migration_page__option_1_button_text',array($this,'_migrate_page_hook_simplify_version_strings'),10,3); |
|
1635 | - add_action('AHEE__ee_migration_page__option_1_extra_details',array($this,'_migration_page_hook_option_1_extra_details'),10,3); |
|
1636 | - add_filter('FHEE__ee_migration_page__option_2_main',array($this,'_migrate_page_hook_simplify_version_strings'),10,4); |
|
1637 | - add_filter('FHEE__ee_migration_page__option_2_button_text',array($this,'_migration_page_hook_simplify_next_db_state'),10,2); |
|
1638 | - add_filter('FHEE__ee_migration_page__option_2_details',array($this,'_migration_page_hook_simplify_next_db_state'),10,2); |
|
1639 | - add_action('AHEE__ee_migration_page__after_migration_options_table',array($this,'_migration_page_hook_after_migration_options_table')); |
|
1640 | - add_filter('FHEE__ee_migration_page__done_migration_header',array($this,'_migration_page_hook_simplify_next_db_state'),10,2); |
|
1641 | - add_filter('FHEE__ee_migration_page__p_after_done_migration_header',array($this,'_migration_page_hook_simplify_next_db_state'),10,2); |
|
1630 | + public function migration_page_hooks() { |
|
1631 | + add_filter('FHEE__ee_migration_page__header', array($this, '_migrate_page_hook_simplify_version_strings'), 10, 3); |
|
1632 | + add_filter('FHEE__ee_migration_page__p_after_header', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2); |
|
1633 | + add_filter('FHEE__ee_migration_page__option_1_main', array($this, '_migrate_page_hook_simplify_version_strings'), 10, 3); |
|
1634 | + add_filter('FHEE__ee_migration_page__option_1_button_text', array($this, '_migrate_page_hook_simplify_version_strings'), 10, 3); |
|
1635 | + add_action('AHEE__ee_migration_page__option_1_extra_details', array($this, '_migration_page_hook_option_1_extra_details'), 10, 3); |
|
1636 | + add_filter('FHEE__ee_migration_page__option_2_main', array($this, '_migrate_page_hook_simplify_version_strings'), 10, 4); |
|
1637 | + add_filter('FHEE__ee_migration_page__option_2_button_text', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2); |
|
1638 | + add_filter('FHEE__ee_migration_page__option_2_details', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2); |
|
1639 | + add_action('AHEE__ee_migration_page__after_migration_options_table', array($this, '_migration_page_hook_after_migration_options_table')); |
|
1640 | + add_filter('FHEE__ee_migration_page__done_migration_header', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2); |
|
1641 | + add_filter('FHEE__ee_migration_page__p_after_done_migration_header', array($this, '_migration_page_hook_simplify_next_db_state'), 10, 2); |
|
1642 | 1642 | } |
1643 | 1643 | |
1644 | - public function _migrate_page_hook_simplify_version_strings($old_content,$current_db_state,$next_db_state,$ultimate_db_state = NULL){ |
|
1645 | - return str_replace(array($current_db_state,$next_db_state,$ultimate_db_state),array(__('EE3','event_espresso'),__('EE4','event_espresso'), __("EE4", 'event_espresso')),$old_content); |
|
1644 | + public function _migrate_page_hook_simplify_version_strings($old_content, $current_db_state, $next_db_state, $ultimate_db_state = NULL) { |
|
1645 | + return str_replace(array($current_db_state, $next_db_state, $ultimate_db_state), array(__('EE3', 'event_espresso'), __('EE4', 'event_espresso'), __("EE4", 'event_espresso')), $old_content); |
|
1646 | 1646 | } |
1647 | - public function _migration_page_hook_simplify_next_db_state($old_content,$next_db_state){ |
|
1648 | - return str_replace($next_db_state, __("EE4", 'event_espresso'),$old_content); |
|
1647 | + public function _migration_page_hook_simplify_next_db_state($old_content, $next_db_state) { |
|
1648 | + return str_replace($next_db_state, __("EE4", 'event_espresso'), $old_content); |
|
1649 | 1649 | } |
1650 | - public function _migration_page_hook_option_1_extra_details(){ |
|
1651 | - ?><p><?php printf(__("Note: many of your EE3 shortcodes will be changed to EE4 shortcodes during this migration (among many other things). Should you revert to EE3, then you should restore to your backup or manually change the EE4 shortcodes back to their EE3 equivalents", "event_espresso"));?></p><?php |
|
1650 | + public function _migration_page_hook_option_1_extra_details() { |
|
1651 | + ?><p><?php printf(__("Note: many of your EE3 shortcodes will be changed to EE4 shortcodes during this migration (among many other things). Should you revert to EE3, then you should restore to your backup or manually change the EE4 shortcodes back to their EE3 equivalents", "event_espresso")); ?></p><?php |
|
1652 | 1652 | } |
1653 | - public function _migration_page_hook_after_migration_options_table(){ |
|
1653 | + public function _migration_page_hook_after_migration_options_table() { |
|
1654 | 1654 | ?><p class="ee-attention"> |
1655 | - <strong><span class="reminder-spn"><?php _e("Important note to those using Event Espresso 3 addons: ", "event_espresso");?></span></strong><br/><?php _e("Unless an addon's description on our website explicitly states that it is compatible with EE4, you should consider it incompatible and know that it WILL NOT WORK correctly with this new version of Event Espresso 4 (EE4). As well, any data for incompatible addons will NOT BE MIGRATED until an updated EE4 compatible version of the addon is available. If you want, or need to keep using your EE3 addons, you should simply continue using EE3 until EE4 compatible versions of your addons become available. To continue using EE3 for now, just deactivate EE4 and reactivate EE3.", "event_espresso"); ?> |
|
1655 | + <strong><span class="reminder-spn"><?php _e("Important note to those using Event Espresso 3 addons: ", "event_espresso"); ?></span></strong><br/><?php _e("Unless an addon's description on our website explicitly states that it is compatible with EE4, you should consider it incompatible and know that it WILL NOT WORK correctly with this new version of Event Espresso 4 (EE4). As well, any data for incompatible addons will NOT BE MIGRATED until an updated EE4 compatible version of the addon is available. If you want, or need to keep using your EE3 addons, you should simply continue using EE3 until EE4 compatible versions of your addons become available. To continue using EE3 for now, just deactivate EE4 and reactivate EE3.", "event_espresso"); ?> |
|
1656 | 1656 | </p><?php |
1657 | 1657 | } |
1658 | 1658 | } |