function woo_pi_manage_form()
 {
     $tab = false;
     if (isset($_GET['tab'])) {
         $tab = sanitize_text_field($_GET['tab']);
     } else {
         if (woo_pi_get_option('skip_overview', false)) {
             // If Skip Overview is set then jump to Export screen
             $tab = 'import';
         }
     }
     $url = add_query_arg('page', 'woo_pi');
     include_once WOO_PI_PATH . 'templates/admin/tabs.php';
 }
Exemple #2
0
function woo_pi_delete_file()
{
    global $import;
    switch ($import->delete_file) {
        case '1':
            // Delete CSV from /wp-content/uploads/
            if ($file = woo_pi_get_option('csv')) {
                if (file_exists($file)) {
                    @unlink($file);
                }
            }
            if ($import->advanced_log) {
                $import->log .= "<br /><br />" . __('Temporary CSV deleted', 'woo_pi');
            }
            break;
        case '0':
        default:
            // Add CSV to Past Imports
            if ($file = woo_pi_get_option('csv')) {
                woo_pi_add_past_import($file);
            }
            break;
    }
    woo_pi_update_option('csv', '');
}
Exemple #3
0
function woo_pi_add_past_import($file = '')
{
    global $import;
    $upload_dir = wp_upload_dir();
    if (!empty($file)) {
        if (file_exists($file)) {
            if ($past_imports = woo_pi_get_option('past_imports')) {
                $past_imports = maybe_unserialize($past_imports);
            } else {
                $past_imports = array();
            }
            if (is_array($past_imports) && !woo_pi_array_search($past_imports, 'filename', $file)) {
                $past_imports[] = array('filename' => $file, 'date' => current_time('mysql'));
                woo_pi_update_option('past_imports', $past_imports);
                if ($import->advanced_log) {
                    $import->log .= "<br /><br />" . sprintf(__('Added %s to Past Imports', 'woo_pi'), basename($file));
                }
            } else {
                if ($import->advanced_log) {
                    $import->log .= "<br /><br />" . sprintf(__('%s already appears in Past Imports', 'woo_pi'), basename($file));
                }
            }
        }
    }
}