<?php

$message = null;
// Call by URL with "fn" param
if (isset($_REQUEST['import_options'])) {
    $message = import_options();
}
if (isset($_REQUEST['reset_options'])) {
    $message = reset_options();
}
if (isset($_REQUEST['import_content'])) {
    $message = import_content();
}
function import_options()
{
    if ($_FILES['import_options_file']['name'] != "") {
        $upload_overrides = array('test_form' => false);
        $movefile = wp_handle_upload($_FILES['import_options_file'], $upload_overrides);
        if ($movefile) {
            $options = unserialize(base64_decode(file_get_contents($movefile['file'])));
            update_option(THEME_SLUG . '_options', $options);
            return __("Admin Options Imported", "theme_admin");
        } else {
        }
    }
}
function reset_options()
{
    delete_option(THEME_SLUG . '_options');
}
function import_content()
Example #2
0
function reset_theme_options()
{
    reset_options();
    die;
}