Exemplo n.º 1
0
function arras_admin()
{
    global $arras_options;
    $notices = '';
    // store notices here so that options_page.php will echo it out later
    if (isset($_GET['page']) && $_GET['page'] == 'arras-options') {
        //print_r($_POST);
        if (isset($_REQUEST['save'])) {
            $arras_options->save_options();
            arras_update_options();
            $notices = '<div class="updated"><p>' . __('Your settings have been saved to the database.', 'arras') . '</p></div>';
        }
        if (isset($_REQUEST['reset'])) {
            delete_option('arras_options');
            arras_flush_options();
            $notices = '<div class="updated"><p>' . __('Your settings have been reverted to the defaults.', 'arras') . '</p></div>';
        }
        if (isset($_REQUEST['clearcache'])) {
            $cache_location = get_template_directory() . '/library/cache';
            if (!($dh = @opendir($cache_location))) {
                return false;
            }
            while (false !== ($obj = readdir($dh))) {
                if ($obj == '.' || $obj == '..') {
                    continue;
                }
                @unlink(trailingslashit($cache_location) . $obj);
            }
            closedir($dh);
            $notices = '<div class="updated"><p>' . __('Thumbnail cache has been cleared.', 'arras') . '</p></div>';
        }
        $nonce = wp_create_nonce('arras-admin');
        // create nonce token for security
        include 'templates/options_page.php';
    }
}
Exemplo n.º 2
0
function arras_posttax()
{
    global $arras_options, $notices;
    if (isset($_GET['page']) && $_GET['page'] == 'arras-posttax') {
        if (isset($_REQUEST['save'])) {
            if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'posttype') {
                $arras_options->save_posttypes();
                arras_update_options();
                do_action('arras_admin_posttype_save');
                $notices = '<div class="updated fade"><p>' . __('Your settings have been saved to the database.', 'arras') . '</p></div>';
            }
            if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'taxonomy') {
                $arras_options->save_taxonomies();
                arras_update_options();
                do_action('arras_admin_taxonomy_save');
                $notices = '<div class="updated fade"><p>' . __('Your settings have been saved to the database.', 'arras') . '</p></div>';
            }
        }
        if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'taxonomy') {
            include 'templates/taxonomy_page.php';
        } else {
            include 'templates/posttype_page.php';
        }
    }
}
Exemplo n.º 3
0
function arras_upgrade_options()
{
    global $arras_options, $arras_custom_bg_options;
    $custom_thumbs = $arras_options->custom_thumbs;
    if (isset($arras_options->featured_thumb_w)) {
        $custom_thumbs['node-based-thumb']['w'] = $arras_options->featured_thumb_w;
    }
    if (isset($arras_options->featured_thumb_h)) {
        $custom_thumbs['node-based-thumb']['h'] = $arras_options->featured_thumb_h;
    }
    if (isset($arras_options->news_thumb_w)) {
        $custom_thumbs['quick-preview-thumb']['w'] = $arras_options->news_thumb_w;
    }
    if (isset($arras_options->news_thumb_h)) {
        $custom_thumbs['quick-preview-thumb']['h'] = $arras_options->news_thumb_h;
    }
    $arras_options->custom_thumbs = $custom_thumbs;
    $arras_options->version = ARRAS_VERSION;
    arras_update_options();
}