예제 #1
0
/**
 * 
 */
function digressit_theme_options_page_form()
{
    if ($_POST && is_admin()) {
        if ($_GET['page'] == 'digressit.php' && isset($_POST['reset']) && $_POST['reset'] == 'Reset Options') {
            delete_option('digressit');
            activate_digressit();
        } elseif ($_GET['page'] == 'digressit.php' && isset($_POST['update-digressit-options'])) {
            $digressit_options = get_option('digressit');
            $_POST['digressit_enabled_for_posts'] = $_POST['digressit_enabled_for_posts'] ? 1 : 0;
            $_POST['digressit_enabled_for_pages'] = $_POST['digressit_enabled_for_pages'] ? 1 : 0;
            $_POST['digressit_enabled_for_digressit_type'] = $_POST['digressit_enabled_for_digressit_type'] ? 1 : 0;
            foreach ($_POST as $key => $value) {
                $digressit_options[$key] = $value;
            }
            delete_option('digressit');
            add_option('digressit', $digressit_options);
        }
    }
}
예제 #2
0
/**
 * Check to see if this revision requires an reset of options. 
 * @todo This function should be a bit smarter
 *
 */
function digressit_init()
{
    global $digressit_options;
    $digressit_options = get_option('digressit');
    //something went wrong. reset settings.
    if (count($digressit_options) < 15) {
        activate_digressit();
    }
    /* upgrade to latest Digress.it 3.2 */
    //	var_dump($digressit_options['version']);
    if ($digressit_options['version'] != DIGRESSIT_VERSION) {
        $digressit_options['enable_dropdown_menu'] = 0;
        $digressit_options['enable_citation_button'] = 0;
        $digressit_options['keyboard_navigation'] = 0;
        $digressit_options['digressit_enabled_for_pages'] = 0;
        $digressit_options['digressit_enabled_for_posts'] = 1;
        $digressit_options['digressit_enabled_for_digressit_type'] = 0;
        $digressit_options['discrete_digressit_content_parser'] = 'separate';
        $digressit_options['version'] = DIGRESSIT_VERSION;
        update_option('digressit', $digressit_options);
    }
}