예제 #1
0
/**
 * save_tarski_options() - Saves a new set of Tarski options.
 * 
 * The primary request handler for the Tarski options system. Saves any updated
 * options and redirects to the options page.
 * 
 * @see tarskiupdate() which it replaces
 * @see delete_tarski_options()
 * @see restore_tarski_options()
 * @since 2.0
 */
function save_tarski_options()
{
    check_admin_referer('admin_post_tarski_options', '_wpnonce_tarski_options');
    if (!current_user_can('edit_themes')) {
        wp_die(__('You are not authorised to perform this operation.', 'tarski'));
    }
    $options = new Options();
    $options->tarski_options_get();
    $options->tarski_options_update();
    update_option('tarski_options', $options);
    wp_redirect(admin_url('themes.php?page=tarski-options&updated=true'));
}
예제 #2
0
/**
 * save_tarski_options() - Saves a new set of Tarski options.
 * 
 * If the Tarski Options page request includes a $_POST call
 * and it's been generated by hitting the 'submit' button, this
 * function will generate a new Options object, set its properties
 * to the existing set of options, and then save the new options
 * over the old ones. It then flushes the options so the Options
 * page, which executes after this function, will display the new
 * values rather than the old ones.
 * @see tarskiupdate() which it replaces
 * @since 2.0
 */
function save_tarski_options()
{
    $tarski_options = new Options();
    $tarski_options->tarski_options_get();
    if (ready_to_delete_options($tarski_options->deleted)) {
        delete_option('tarski_options');
        flush_tarski_options();
        return;
    }
    tarski_upgrade_and_flush_options();
    if (isset($_POST['submit'])) {
        $tarski_options->tarski_options_update();
        update_option('tarski_options', $tarski_options);
    }
    flush_tarski_options();
}