当前位置: 首页>>代码示例>>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;未经允许,请勿转载。