当前位置: 首页>>代码示例>>PHP>>正文


PHP Options::tarski_options_get方法代码示例

本文整理汇总了PHP中Options::tarski_options_get方法的典型用法代码示例。如果您正苦于以下问题:PHP Options::tarski_options_get方法的具体用法?PHP Options::tarski_options_get怎么用?PHP Options::tarski_options_get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Options的用法示例。


在下文中一共展示了Options::tarski_options_get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update_tarski_option

/**
 * update_tarski_option() - Updates the given Tarski option with a new value.
 * 
 * This function can be used either to update a particular option
 * with a new value, or to delete that option altogether by setting
 * $drop to true.
 * @since 1.4
 * @param string $option
 * @param string $value
 * @param boolean $drop
 * @global object $tarski_options
 */
function update_tarski_option($option, $value)
{
    $tarski_options = new Options();
    $tarski_options->tarski_options_get();
    if (empty($value)) {
        unset($tarski_options->{$option});
    } else {
        $tarski_options->{$option} = $value;
    }
    update_option('tarski_options', $tarski_options);
    flush_tarski_options();
}
开发者ID:nihad,项目名称:tarski,代码行数:24,代码来源:options.php

示例2: tarski_upgrade

/**
 * function tarski_upgrade() - Upgrades Tarski's options where appropriate.
 * 
 * Tarski preferences sometimes change between versions, and need to
 * be updated. This function does not determine whether an update is
 * needed, it merely perfoms it. It's also self-contained, so it
 * won't update the global $tarski_options object either.
 * @since 2.1
 * @uses tarski_upgrade_special()
 * @uses tarski_upgrade_widgets()
 */
function tarski_upgrade()
{
    // Get existing options
    $options = new Options();
    $options->tarski_options_get();
    // Get our defaults, so we can merge them in
    $defaults = new Options();
    $defaults->tarski_options_defaults();
    // Update the options version so we don't run this code more than once
    $options->installed = theme_version('current');
    // Handle special cases first
    tarski_upgrade_special($options, $defaults);
    // Upgrade old display options to use widgets instead
    tarski_upgrade_widgets($options, $defaults);
    // Conform our options to the expected values, types, and defaults
    foreach ($options as $name => $value) {
        if (!isset($defaults->{$name})) {
            // Get rid of options which no longer exist
            unset($options->{$name});
        } elseif (!isset($options->{$name})) {
            // Use the default if we don't have this option
            $options->{$name} = $defaults->{$name};
        } elseif (is_array($options->{$name}) && !is_array($defaults->{$name})) {
            // If our option is an array and the default is not, implode using " " as a separator
            $options->{$name} = implode(" ", $options->{$name});
        } elseif (!is_array($options->{$name}) && is_array($defaults->{$name})) {
            // If our option is a scalar and the default is an array, wrap our option in an array
            $options->{$name} = array($options->{$name});
        }
    }
    // Save our upgraded options
    update_option('tarski_options', $options);
}
开发者ID:nihad,项目名称:tarski,代码行数:44,代码来源:admin_helper.php


注:本文中的Options::tarski_options_get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。