1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
<?php
if ( ! defined( 'ABSPATH' ) ) exit;
if ( !class_exists('Wcap_Import_Lite_to_Pro' ) ) {
class Wcap_Import_Lite_to_Pro {
public static function wcap_show_import_data () {
ob_start();
Wcap_Import_Lite_to_Pro::wcap_get_import_data();
}
public static function wcap_get_import_data () {
$wcap_version = Wcap_Common::wcap_get_version();
?>
<div class="wrap about-wrap">
<h2><?php printf( __( 'Welcome to Abandoned Cart Pro for WooCommerce v%s', 'woocommerce-ac' ), $wcap_version ); ?></h2>
<?php
Wcap_Import_Lite_to_Pro::wcap_display_information_of_lite_active();
?>
<div id = "wcap_import_yes_no" class = "wcap_import_yes_no" >
<?php
Wcap_Import_Lite_to_Pro::wcap_display_yes_button();
Wcap_Import_Lite_to_Pro::wcap_display_no_button();
?>
</div>
</div>
<?php
}
public static function wcap_display_information_of_lite_active () {
?>
<div>
<p><?php _e( 'We have noticed that you are using the Lite version of the Abandoned Cart plugin on your store. Thus, before activating the Pro version, you should choose if you want to import the Lite version data in Pro. We fully understand the importance of data captured in the Lite version of the plugin & hence would like to give you an option to choose what you want to do with that data.', 'woocommerce-ac' ); ?></p>
<p><?php _e( 'You can import all your data by clicking on the <strong>Yes </strong> button below. In the next step, you will be asked to select what data you want to import before beginning the actual process of import.', 'woocommerce-ac' ); ?></p>
<p><?php _e( 'If you don\'t wish to import the data from the Lite version of the plugin, then please click on the <strong>No </strong>button below. Selecting <strong>No </strong>would deactivate the Lite version & keep the Pro version active.', 'woocommerce-ac' ); ?></p>
<div id = "wcap_import_checkboxes" class = "wcap_import_checkboxes" style="display: none">
<p><?php _e( 'You can choose what data you want to import from Lite plugin using the options below:', 'woocommerce-ac' ); ?></p>
<table>
<tr>
<td>
<?php _e( 'Abandoned Carts:', 'woocommerce-ac' ); ?>
</td>
<td>
 <input type="checkbox" name="wcap_abandoned_cart_import" value = "wcap_abandoned_cart_import" id = "wcap_abandoned_cart_import" checked>
</td>
</tr>
<tr>
<td>
<?php _e( 'Settings:', 'woocommerce-ac' ); ?>
</td>
<td>
 <input type="checkbox" name="wcap_settings_import" id = "wcap_settings_import" value ="wcap_settings_import" checked>
</td>
</tr>
<tr>
<td>
<?php _e( 'Email templates:', 'woocommerce-ac' ); ?>
</td>
<td>
 <input type="checkbox" name="wcap_email_template_import" value ="wcap_email_template_import" id = "wcap_email_template_import" checked>
</td>
</tr>
</table>
<h5>
<?php _e( '<strong>Note: Once the import is complete, we will not send any abandoned cart reminder emails from Pro version to the carts which were imported from the Lite plugin. After data is imported, the Lite version will be deactivated & Pro version will remain active.</strong>', 'woocommerce-ac' ); ?>
</h5>
<?php
Wcap_Import_Lite_to_Pro::wcap_display_import_button();
Wcap_Import_Lite_to_Pro::wcap_display_no_button();
?>
</div>
</div>
<?php
}
public static function wcap_display_yes_button () {
?>
<input type="submit" name="submit" id="wcap-import-yes" class="button button-primary wcap-import-yes" value="Yes" />
<?php
}
public static function wcap_display_no_button () {
?>
<input type="submit" name="submit" id="wcap-import-no" class="button button-primary wcap-import-no" value="No" />
<?php
}
public static function wcap_display_import_button () {
?>
<input type="submit" name="submit" id="wcap-import-now" class="button button-primary wcap-import-now" value="Import data" />
<?php
}
public static function wcap_admin_init () {
$woocommerce_ac_plugin_version = get_option( 'woocommerce_ac_db_version' );
$wcap_is_import_page_displayed = get_option( 'wcap_import_page_displayed' );
$wcap_is_lite_data_imported = get_option( 'wcap_lite_data_imported' );
if ( ( $wcap_is_import_page_displayed != 'yes' || '' != $wcap_is_import_page_displayed ) && false === $wcap_is_import_page_displayed ) {
update_option( 'wcap_import_page_displayed', 'yes' );
wp_safe_redirect( admin_url( 'admin.php?page=wcap-update' ) );
exit;
}
if ( !isset( $_GET ['page'] ) || ( isset( $_GET ['page'] ) && 'wcap-update' != $_GET ['page'] ) ) {
if ( $wcap_is_import_page_displayed == 'yes' && in_array( 'woocommerce-abandoned-cart/woocommerce-ac.php', (array) get_option( 'active_plugins', array() ) ) ) {
$wcap_lite_plugin_path = ( dirname( dirname ( WCAP_PLUGIN_FILE ) ) ) . '/woocommerce-abandoned-cart/woocommerce-ac.php';
deactivate_plugins( $wcap_lite_plugin_path );
}
}
}
public static function wcap_admin_menus() {
$woocommerce_ac_plugin_version = get_option( 'woocommerce_ac_db_version' );
if ( empty( $_GET['page'] ) ) {
return;
}
$wcap_update_page_name = __( 'About Abandoned Cart Pro for WooCommerce', 'woocommerce-ac' );
$wcap_welcome_page_title = __( 'Welcome to Abandoned Cart Pro for WooCommerce', 'woocommerce-ac' );
add_dashboard_page( $wcap_welcome_page_title, '', 'manage_options', 'wcap-update', array( 'Wcap_Import_Lite_to_Pro' , 'wcap_show_import_data') );
}
}
}