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 187 188 189 190 191 192 193 194 195
<?php
if (!defined('ABSPATH')) {
exit;
}
if ( !class_exists('Wcap_Menu' ) ) {
class Wcap_Menu {
public static function wcap_admin_menu() {
$page = add_submenu_page( 'woocommerce', __( 'Abandoned Carts', 'woocommerce-ac' ), __( 'Abandoned Carts', 'woocommerce-ac' ), 'manage_woocommerce', 'woocommerce_ac_page', array( 'Wcap_Menu', 'wcap_menu_page' ) );
}
public static function wcap_menu_page() {
if ( is_user_logged_in() ) {
Wcap_Common::wcap_check_user_can_manage_woocommerce();
?>
<div class="wrap">
<h2>
<?php _e( 'WooCommerce - Abandon Cart', 'woocommerce-ac' ); ?>
</h2>
<?php
$action = Wcap_Common::wcap_get_action();
$mode = Wcap_Common::wcap_get_mode();
$action_two = Wcap_Common::wcap_get_action_two();
$section = Wcap_Common::wcap_get_section();
Wcap_Actions::wcap_perform_action( $action, $action_two );
$wcap_get_notice_action = Wcap_Common::wcap_get_notice_action();
if ( '' != $wcap_get_notice_action ){
Wcap_Display_Notices::wcap_display_notice( $wcap_get_notice_action );
}
if ( isset( $_POST ['mode'] ) && 'manual_email' == $_POST ['mode'] && isset( $_POST ['Submit'] ) && 'Send Email' == $_POST ['Submit'] ) {
Wcap_Send_Manual_Email::wcap_create_and_send_manual_email ();
}
do_action ('wcap_display_message');
Wcap_Menu::wcap_display_tabs();
do_action ( 'wcap_crm_data' );
do_action ( 'wcap_add_tab_content' );
if ( 'emailsettings' == $action ) {
Wcap_Email_Settings::wcap_display_email_setting();
} elseif ( 'wcap_dashboard' == $action || '' == $action ) {
Wcap_Dashboard::wcap_display_dashboard();
} elseif ( 'listcart' == $action && ( !isset($_GET['action_details']) )
&& ( !isset($_GET['wcap_download']) || 'wcap.csv' != $_GET['wcap_download'] )
&& ( !isset($_GET['wcap_download']) || 'wcap.print' != $_GET['wcap_download'] )
) {
Wcap_Abandoned_Cart_List::wcap_display_abandoned_cart_list();
} else if ( 'listcart' == $action && ( isset($_GET['wcap_download']) && 'wcap.csv' == $_GET['wcap_download'] ) ) {
$old_data = ob_get_clean ();
$wcap_csv = Wcap_Print_And_CSV::wcap_generate_csv_report();
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=wcap_cart_report.csv");
header("Pragma: no-cache");
header("Expires: 0");
echo "\xEF\xBB\xBF";
echo $wcap_csv;
exit;
} elseif ( 'cart_recovery' == $action && ( 'emailtemplates' == $section ) && ( 'edittemplate' != $mode && 'addnewtemplate' != $mode && 'copytemplate' != $mode && 'wcap_manual_email' != $mode ) ) {
Wcap_Email_Template_List::wcap_display_email_template_list ( $action, $section, $mode );
} elseif( 'cart_recovery' == $action && 'sms' == $section ) {
Wcap_SMS::display_sms_list();
} elseif ( 'stats' == $action || '' == $action ) {
Wcap_Recovered_Order_List::wcap_display_recovered_list();
} elseif ( 'emailstats' == $action ) {
Wcap_Eent_Email_List::wcap_display_sent_emails_list();
}
if ( 'cart_recovery' == $action && ( 'emailtemplates' == $section ) && ( 'addnewtemplate' == $mode || 'edittemplate' == $mode || 'copytemplate' == $mode ) ) {
Wcap_Email_Template_Fields::wcap_display_email_template_fields();
} else if ( 'cart_recovery' == $action && 'emailtemplates' == $section && 'wcap_manual_email' == $mode ) {
WCAP_Manual_Email::wcap_display_manual_email_template();
} elseif ( $action == 'report' ) {
Wcap_Product_Report_List::wcap_display_product_report_list();
} else if ( 'adv_settings' == $action ) {
Wcap_Adv_settings::wcap_display_adv_settings();
}
echo( "</table>" );
}
}
public static function wcap_display_tabs() {
$action = Wcap_Common::wcap_get_action();
$active_wcap_dashboard = "";
$active_listcart = "";
$active_cart_recovery = "";
$active_settings = "";
$active_stats = "";
$active_adv_settings = "";
switch( $action ) {
case 'wcap_dashboard':
case '':
$active_wcap_dashboard = "nav-tab-active";
break;
case 'listcart':
$active_listcart = "nav-tab-active";
break;
case 'cart_recovery':
$active_cart_recovery = "nav-tab-active";
break;
case 'sms':
$active_sms = "nav-tab-active";
break;
case 'emailsettings':
$active_settings = "nav-tab-active";
break;
case 'stats':
$active_stats = "nav-tab-active";
break;
case 'emailstats':
$active_emailstats = "nav-tab-active";
break;
case 'report':
$active_report = "nav-tab-active";
break;
case 'adv_settings':
$active_adv_settings = "nav-tab-active";
break;
}
?>
<div style="background-image: url( '<?php echo plugins_url(); ?>/woocommerce-abandon-cart-pro/assets/images/ac_tab_icon.png' ) !important;" class="icon32">
<br>
</div>
<h2 class="nav-tab-wrapper woo-nav-tab-wrapper">
<a href="admin.php?page=woocommerce_ac_page&action=wcap_dashboard" class="nav-tab <?php echo $active_wcap_dashboard; ?>"> <?php _e( 'Dashboard', 'woocommerce-ac' );?> </a>
<a href="admin.php?page=woocommerce_ac_page&action=listcart" class="nav-tab <?php echo $active_listcart; ?>"> <?php _e( 'Abandoned Orders', 'woocommerce-ac' );?> </a>
<a href="admin.php?page=woocommerce_ac_page&action=cart_recovery" class="nav-tab <?php echo $active_cart_recovery; ?>"> <?php _e( 'Cart Recovery', 'woocommerce-ac' );?> </a>
<a href="admin.php?page=woocommerce_ac_page&action=emailsettings" class="nav-tab <?php echo $active_settings; ?>"> <?php _e( 'Settings', 'woocommerce-ac' );?> </a>
<a href="admin.php?page=woocommerce_ac_page&action=stats" class="nav-tab <?php echo $active_stats; ?>"> <?php _e( 'Recovered Orders', 'woocommerce-ac' );?> </a>
<a href="admin.php?page=woocommerce_ac_page&action=emailstats" class="nav-tab <?php if( isset( $active_emailstats ) ) echo $active_emailstats; ?>"> <?php _e( 'Sent Emails', 'woocommerce-ac' );?> </a>
<a href="admin.php?page=woocommerce_ac_page&action=report" class="nav-tab <?php if( isset( $active_report ) ) echo $active_report; ?>"> <?php _e( 'Product Report', 'woocommerce-ac' );?> </a>
<a href="admin.php?page=woocommerce_ac_page&action=adv_settings" class="nav-tab <?php echo $active_adv_settings; ?>"> <?php _e( 'Advanced Settings', 'woocommerce-ac' );?> </a>
<?php
do_action ('wcap_add_settings_tab');
do_action ( 'wcap_add_tabs' );
if ( has_action( 'wcap_add_tabs' ) ) {
if ( isset( $_GET['action'] ) && 'wcap_crm' == $_GET['action'] ) {
settings_errors();
}
}
?>
</h2>
<?php
}
}
}