當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Options::default_options方法代碼示例

本文整理匯總了PHP中Options::default_options方法的典型用法代碼示例。如果您正苦於以下問題:PHP Options::default_options方法的具體用法?PHP Options::default_options怎麽用?PHP Options::default_options使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Options的用法示例。


在下文中一共展示了Options::default_options方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: thesis_upgrade_options

function thesis_upgrade_options()
{
    // Retrieve Thesis Options and Thesis Options defaults
    $thesis_options = new Options();
    $thesis_options->get_options();
    $default_options = new Options();
    $default_options->default_options();
    // Retrieve Design Options and Design Options defaults
    $design_options = new Design();
    $design_options->get_design_options();
    $default_design_options = new Design();
    $default_design_options->default_design_options();
    // Begin code to upgrade all Thesis Options to the newest data structures
    if (isset($thesis_options->multimedia_box)) {
        $multimedia_box = $thesis_options->multimedia_box;
    }
    if (isset($design_options->home_layout)) {
        if ($design_options->home_layout) {
            $features = $design_options->teasers;
            unset($design_options->teasers);
        } else {
            $features = get_option('posts_per_page');
        }
    }
    foreach ($default_options as $option_name => $value) {
        if (!isset($thesis_options->{$option_name})) {
            $thesis_options->{$option_name} = $default_options->{$option_name};
        }
    }
    // Document head
    if (isset($thesis_options->title_home_name)) {
        $thesis_options->head['title']['title'] = (bool) $thesis_options->title_home_name;
    }
    if (isset($thesis_options->title_home_tagline)) {
        $thesis_options->head['title']['tagline'] = (bool) $thesis_options->title_home_tagline;
    }
    if (isset($thesis_options->title_tagline_first)) {
        $thesis_options->head['title']['tagline_first'] = (bool) $thesis_options->title_tagline_first;
    }
    if (isset($thesis_options->title_branded)) {
        $thesis_options->head['title']['branded'] = (bool) $thesis_options->title_branded;
    }
    if (isset($thesis_options->title_separator)) {
        $thesis_options->head['title']['separator'] = $thesis_options->title_separator;
    }
    if (isset($thesis_options->show_version)) {
        $thesis_options->head['version'] = $thesis_options->show_version;
    } elseif (isset($thesis_options->head['meta']['version'])) {
        $thesis_options->head['version'] = (bool) $thesis_options->head['meta']['version'];
    }
    if (isset($thesis_options->tags_noindex)) {
        $thesis_options->head['noindex']['tag'] = (bool) $thesis_options->tags_noindex;
    } elseif (is_array($thesis_options->head['meta']['noindex'])) {
        $thesis_options->head['noindex'] = $thesis_options->head['meta']['noindex'];
    }
    // Home Page options
    if (isset($thesis_options->meta_description)) {
        $thesis_options->home['meta']['description'] = $thesis_options->meta_description;
    } elseif (isset($thesis_options->head['meta']['description'])) {
        $thesis_options->home['meta']['description'] = $thesis_options->head['meta']['description'];
    }
    if (isset($thesis_options->meta_keywords)) {
        $thesis_options->home['meta']['keywords'] = $thesis_options->meta_keywords;
    } elseif (isset($thesis_options->head['meta']['keywords'])) {
        $thesis_options->home['meta']['keywords'] = $thesis_options->head['meta']['keywords'];
    }
    if (isset($design_options->layout['home'])) {
        if ($design_options->layout['home'] == 'teasers') {
            $thesis_options->home['features'] = $design_options->teasers['features'] ? $design_options->teasers['features'] : 2;
            unset($design_options->teasers['features']);
        } else {
            $thesis_options->home['features'] = get_option('posts_per_page');
        }
        foreach ($design_options->layout as $layout_var => $value) {
            if ($layout_var != 'home') {
                $new_layout[$layout_var] = $value;
            }
        }
        if ($new_layout) {
            $design_options->layout = $new_layout;
        }
    } elseif (isset($features)) {
        $thesis_options->home['features'] = $features;
    }
    // New $head array
    if (isset($thesis_options->head['meta'])) {
        $new_head['title'] = $thesis_options->head['title'];
        $new_head['noindex'] = $thesis_options->head['noindex'];
        $new_head['canonical'] = $thesis_options->head['canonical'];
        $new_head['version'] = $thesis_options->head['version'];
        $thesis_options->head = $new_head;
    }
    // Display options
    if (isset($thesis_options->show_title)) {
        $thesis_options->display['header']['title'] = (bool) $thesis_options->show_title;
    }
    if (isset($thesis_options->show_tagline)) {
        $thesis_options->display['header']['tagline'] = (bool) $thesis_options->show_tagline;
    }
    if (isset($thesis_options->show_author)) {
//.........這裏部分代碼省略.........
開發者ID:billerby,項目名稱:Surdeg,代碼行數:101,代碼來源:options.php

示例2: arras_flush_options

function arras_flush_options()
{
    global $arras_options;
    $arras_options = new Options();
    $arras_options->get_options();
    if (!get_option('arras_options')) {
        $arras_options->default_options();
    }
}
開發者ID:alx,項目名稱:Tetalab,代碼行數:9,代碼來源:options.php

示例3: thesis_upgrade_design_options

function thesis_upgrade_design_options()
{
    // Retrieve Design Options and Design Options defaults
    $design_options = new Design();
    $design_options->get_design_options();
    $default_design_options = new Design();
    $default_design_options->default_design_options();
    // Retrieve Thesis Options and Thesis Options defaults
    $thesis_options = new Options();
    $thesis_options->get_options();
    $default_options = new Options();
    $default_options->default_options();
    if (isset($design_options->teasers) && !is_array($design_options->teasers)) {
        unset($design_options->teasers);
    }
    if (isset($design_options->feature_box_condition)) {
        $feature_box = $design_options->feature_box;
        unset($design_options->feature_box);
    }
    if (isset($thesis_options->multimedia_box)) {
        $multimedia_box = $thesis_options->multimedia_box;
    }
    // Ubiquitous options upgrade code
    foreach ($default_design_options as $option_name => $value) {
        if (!isset($design_options->{$option_name})) {
            $design_options->{$option_name} = $value;
        }
    }
    // 1.6b niceness
    if (!isset($design_options->nav['link']['parent'])) {
        $design_options->nav['link']['parent'] = $default_design_options->nav['link']['parent'];
    }
    if (!isset($design_options->nav['background']['parent'])) {
        $design_options->nav['background']['parent'] = $default_design_options->nav['background']['parent'];
    }
    // Version-specific upgrade code
    if (isset($design_options->font_sizes)) {
        foreach ($design_options->fonts as $area => $family) {
            $design_options->fonts['families'][$area] = $family ? $family : false;
        }
        foreach ($design_options->font_sizes as $area => $size) {
            $design_options->fonts['sizes'][$area] = $size;
        }
    }
    if (isset($design_options->num_columns)) {
        $design_options->layout['columns'] = $design_options->num_columns;
    }
    if (isset($design_options->widths)) {
        $design_options->layout['widths']['content'] = $design_options->widths['content'] ? $design_options->widths['content'] : 480;
        $design_options->layout['widths']['sidebar_1'] = $design_options->widths['sidebar_1'] ? $design_options->widths['sidebar_1'] : 195;
        $design_options->layout['widths']['sidebar_2'] = $design_options->widths['sidebar_2'] ? $design_options->widths['sidebar_2'] : 195;
    }
    if (isset($design_options->column_order)) {
        $design_options->layout['order'] = $design_options->column_order;
    }
    if (isset($design_options->html_framework)) {
        $design_options->layout['framework'] = $design_options->html_framework ? $design_options->html_framework : 'page';
    }
    if (isset($design_options->page_padding)) {
        $design_options->layout['page_padding'] = $design_options->page_padding;
    }
    if (isset($design_options->teaser_options) && isset($design_options->teaser_content)) {
        foreach ($design_options->teaser_content as $teaser_area) {
            $new_teaser_options[$teaser_area]['name'] = $design_options->teasers['options'][$teaser_area]['name'];
            $new_teaser_options[$teaser_area]['show'] = (bool) $design_options->teaser_options[$teaser_area];
        }
        if ($new_teaser_options) {
            $design_options->teasers['options'] = $new_teaser_options;
        }
    }
    if (isset($design_options->teaser_date)) {
        $design_options->teasers['date']['format'] = $design_options->teaser_date ? $design_options->teaser_date : 'standard';
    }
    if (isset($design_options->teaser_date_custom)) {
        $design_options->teasers['date']['custom'] = $design_options->teaser_date_custom ? $design_options->teaser_date_custom : 'F j, Y';
    }
    if (isset($design_options->teaser_font_sizes)) {
        foreach ($design_options->teaser_font_sizes as $teaser_area => $size) {
            $design_options->teasers['font_sizes'][$teaser_area] = $size;
        }
    }
    if (isset($design_options->teaser_link_text)) {
        $design_options->teasers['link_text'] = $design_options->teaser_link_text ? $design_options->teaser_link_text : false;
    }
    if (isset($feature_box)) {
        $design_options->feature_box['position'] = $feature_box;
        if (isset($design_options->feature_box_condition)) {
            $design_options->feature_box['status'] = $design_options->feature_box_condition;
        }
        if (isset($design_options->feature_box_after_post)) {
            $design_options->feature_box['after_post'] = $design_options->feature_box_after_post;
        }
    }
    // Multimedia box
    if (isset($multimedia_box) && is_array($multimedia_box)) {
        foreach ($multimedia_box as $item => $value) {
            $design_options->multimedia_box[$item] = $value;
        }
    } elseif (isset($multimedia_box)) {
        $design_options->multimedia_box['status'] = $multimedia_box;
//.........這裏部分代碼省略.........
開發者ID:billerby,項目名稱:Surdeg,代碼行數:101,代碼來源:design.php


注:本文中的Options::default_options方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。