Example #1
0
function spyropress_ui_export($option_name)
{
    global $spyropress;
    $data = '';
    if (isset($spyropress->options[$option_name . $spyropress->lang])) {
        $data = $spyropress->options[$option_name . $spyropress->lang];
        $data = spyropress_encode($data);
    }
    $item['label'] = __('Export Options', 'spyropress');
    $item['desc'] = __('Here you can download or copy/paste into a blank file your theme current option settings. Keep this safe as you can use it as backup should anything go wrong. Or you can use it to restore your settings on this site (or any other site).', 'spyropress');
    echo '<div class="section section-export section-full">';
    build_heading($item, false);
    build_description($item);
    echo '<div class="controls">';
    echo '<textarea class="field" name="export_options" id="export_options" rows="10">' . $data . '</textarea>';
    echo '</div>';
    echo '<input type="hidden" name="download_what" value="' . $option_name . '" />';
    wp_nonce_field('export_settings_file_form', 'export_settings_file_nonce');
    printf('<input type="submit" name="download_theme_options" value="%1$s" class="button-green export-options" />', __('Download Options', 'spyropress'));
    echo '</div>';
}
        <p>If you have made changes to the theme files, you will need to compare your changed files to the new files and merge them together.</p>', 'spyropress'), $theme_name, str_replace(site_url(), '', get_template_directory_uri()));
        ?>

        
        <form method="post" enctype="multipart/form-data" id="spyropress_form">
            <?php 
        wp_nonce_field('spyropress-update');
        ?>

            <input type="submit" class="button-large button-green" value="<?php 
        esc_attr_e('Update Now', 'spyropress');
        ?>
" />
            <input type="hidden" name="spyropress_updater" value="framework" />
            <input type="hidden" name="spyropress_ftp_cred" value="<?php 
        echo esc_attr(spyropress_encode($_POST));
        ?>
" />
        </form>
    <?php 
    }
    // END ELSE
    ?>

    <br />
    <div class="spyropress-changelog clear">
        <div class="row-fluid">
            <div class="span6">
                <h2><strong><?php 
    _e('Theme Changelog', 'spyropress');
    ?>
function spyropress_generate_option_export($option_name = '')
{
    global $spyropress;
    $data = $spyropress->options[$option_name . $spyropress->lang];
    $data = spyropress_encode($data);
    // generating file name
    $blogname = str_replace(" ", "", get_option('blogname'));
    $date = date("m-d-Y");
    $json_name = $blogname . "-" . $date;
    //ob_clean();
    header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
    header("Pragma: no-cache ");
    header("Content-Description: File Transfer");
    header('Content-Disposition: attachment; filename="' . $json_name . '.txt"');
    header("Content-Type: application/octet-stream");
    header("Content-Transfer-Encoding: binary");
    echo $data;
    die;
}