/** * Actions on the final step */ private function wc_setup_ready_actions() { WC_Admin_Notices::remove_notice('install'); if (isset($_GET['wc_tracker_optin']) && isset($_GET['wc_tracker_nonce']) && wp_verify_nonce($_GET['wc_tracker_nonce'], 'wc_tracker_optin')) { update_option('woocommerce_allow_tracking', 'yes'); WC_Tracker::send_tracking_data(true); } elseif (isset($_GET['wc_tracker_optout']) && isset($_GET['wc_tracker_nonce']) && wp_verify_nonce($_GET['wc_tracker_nonce'], 'wc_tracker_optout')) { update_option('woocommerce_allow_tracking', 'no'); } }
{ $override_data = array(); $template_paths = apply_filters('woocommerce_template_overrides_scan_paths', array('WooCommerce' => WC()->plugin_path() . '/templates/')); $scanned_files = array(); require_once WC()->plugin_path() . '/includes/admin/class-wc-admin-status.php'; foreach ($template_paths as $plugin_name => $template_path) { $scanned_files[$plugin_name] = WC_Admin_Status::scan_template_files($template_path); } foreach ($scanned_files as $plugin_name => $files) { foreach ($files as $file) { if (file_exists(get_stylesheet_directory() . '/' . $file)) { $theme_file = get_stylesheet_directory() . '/' . $file; } elseif (file_exists(get_stylesheet_directory() . '/woocommerce/' . $file)) { $theme_file = get_stylesheet_directory() . '/woocommerce/' . $file; } elseif (file_exists(get_template_directory() . '/' . $file)) { $theme_file = get_template_directory() . '/' . $file; } elseif (file_exists(get_template_directory() . '/woocommerce/' . $file)) { $theme_file = get_template_directory() . '/woocommerce/' . $file; } else { $theme_file = false; } if ($theme_file !== false) { $override_data[] = basename($theme_file); } } } return $override_data; } } WC_Tracker::init();
/** * Handle opt in or out actions based on notice selection * @return void */ public function check_optin_action() { if (!isset($_GET['wc_tracker_optin']) || !isset($_GET['wc_tracker_nonce']) || !wp_verify_nonce($_GET['wc_tracker_nonce'], 'wc_tracker_optin')) { return; } // Enable tracking update_option('woocommerce_allow_tracking', 'yes'); // Remove notice self::remove_notice('tracking'); // Trigger the first track WC_Tracker::send_tracking_data(true); }
/** * Handle saving, deleting and refreshing of the master key & info in the admin. * Also handles tracking optin. */ public function handle_master_key() { // If we're not where we want to be (the 'woothemes-helper' page), then get out quick. if (!isset($_GET['page']) || 'woothemes-helper' != $_GET['page']) { return; } // Token $token = isset($_GET['key']) ? sanitize_text_field($_GET['key']) : false; if ($token) { check_admin_referer('wth_connect'); update_option('woothemes_helper_master_key', $token); if (class_exists('WC_Tracker')) { update_option('woocommerce_allow_tracking', 'yes'); WC_Tracker::send_tracking_data(true); } } // Refresh - delete local transients for master key info and helper updates if (isset($_GET['refresh']) && $_GET['refresh'] == true) { check_admin_referer('wth_refresh_token'); delete_transient('wth_master_key_info'); delete_transient('woothemes_helper_updates'); } // Token deleting if (isset($_GET['delete_wth_token']) && $_GET['delete_wth_token'] == true) { // delete remotely $this->api->delete_master_key_request(get_option('woothemes_helper_master_key')); // delete locally delete_option('woothemes_helper_master_key'); delete_transient('wth_master_key_info'); } }