本文整理汇总了PHP中wp_convert_widget_settings函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_convert_widget_settings函数的具体用法?PHP wp_convert_widget_settings怎么用?PHP wp_convert_widget_settings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_convert_widget_settings函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: skLegacy_updateWidget
/**
* Function to update sk into the new widget.
*/
function skLegacy_updateWidget()
{
$options = get_option('widget_sk');
$add = 1;
$data = array('title' => $options['title'], 'items' => $options['items'], 'rss' => $options['rss']);
//Update the widget data
update_option('sk_options', $options);
// old format, conver if single widget
$settings = wp_convert_widget_settings('sk', 'widget_sk', $options);
//Update the widgets in the sidebar
$pos = 0;
//The position where the widget is
$sidebars_widgets = get_option('sidebars_widgets');
foreach ((array) $sidebars_widgets as $index => $sidebar) {
if (is_array($sidebar)) {
$count = 0;
//New counter
foreach ($sidebar as $i => $name) {
//Check if the widget has the name from the old one
if ($name == 'schreikasten') {
//We found something, set the data
$sb_pos = $index;
$pos = $index;
$changed = true;
}
$count++;
}
//If we found the widget, move all the widgets after the one where we are
//searching, then add the new widgets
if ($changed) {
$sidebar = $sidebars_widgets[$sb_pos];
//How many widgets do we have in this sidebar?
$size = count($sidebar);
//Add from end to begin
$aux = 0;
$sidebar_aux = array();
for ($i = 0; $i < $size; $i++) {
if ($i == $pos) {
for ($j = 2; $j < $add + 2; $j++) {
$sidebar_aux[$count] = "sk-{$j}";
$count++;
}
} else {
$sidebar_aux[$count] = $sidebar[$i];
$count++;
}
}
//Update the sidebars_widgets
$sidebars_widgets[$sb_pos] = $sidebar_aux;
update_option('sidebars_widgets', $sidebars_widgets);
$changed = false;
}
}
}
}
开发者ID:sontv1003,项目名称:vtcacademy,代码行数:58,代码来源:legacy.php
示例2: get_settings
function get_settings()
{
$settings = get_option($this->option_name);
if (false === $settings && isset($this->alt_option_name)) {
$settings = get_option($this->alt_option_name);
}
if (!is_array($settings)) {
$settings = array();
}
if (!empty($settings) && !array_key_exists('_multiwidget', $settings)) {
// old format, convert if single widget
$settings = wp_convert_widget_settings($this->id_base, $this->option_name, $settings);
}
unset($settings['_multiwidget'], $settings['__i__']);
return $settings;
}
开发者ID:CarterNelms,项目名称:www.engineeredcomfort.net,代码行数:16,代码来源:widgets.php
示例3: get_settings
/**
* Get the settings for all instances of the widget class.
*
* @since 2.8.0
* @access public
*
* @return array Multi-dimensional array of widget instance settings.
*/
public function get_settings()
{
$settings = get_option($this->option_name);
if (false === $settings && isset($this->alt_option_name)) {
$settings = get_option($this->alt_option_name);
}
if (!is_array($settings) && !($settings instanceof ArrayObject || $settings instanceof ArrayIterator)) {
$settings = array();
}
if (!empty($settings) && !isset($settings['_multiwidget'])) {
// Old format, convert if single widget.
$settings = wp_convert_widget_settings($this->id_base, $this->option_name, $settings);
}
unset($settings['_multiwidget'], $settings['__i__']);
return $settings;
}
开发者ID:robertoperata,项目名称:nic.perata.it,代码行数:24,代码来源:widgets.php
示例4: get_settings
/**
* Retrieves the settings for all instances of the widget class.
*
* @since 2.8.0
* @access public
*
* @return array Multi-dimensional array of widget instance settings.
*/
public function get_settings()
{
$settings = get_option($this->option_name);
if (false === $settings) {
if (isset($this->alt_option_name)) {
$settings = get_option($this->alt_option_name);
} else {
// Save an option so it can be autoloaded next time.
$this->save_settings(array());
}
}
if (!is_array($settings) && !($settings instanceof ArrayObject || $settings instanceof ArrayIterator)) {
$settings = array();
}
if (!empty($settings) && !isset($settings['_multiwidget'])) {
// Old format, convert if single widget.
$settings = wp_convert_widget_settings($this->id_base, $this->option_name, $settings);
}
unset($settings['_multiwidget'], $settings['__i__']);
return $settings;
}
开发者ID:ntwb,项目名称:wordpress-travis,代码行数:29,代码来源:class-wp-widget.php
示例5: simple_section_nav_activate
function simple_section_nav_activate()
{
if (get_option('ssn_sortby') === false) {
return false;
}
//if not upgrading, leave
$show_all = get_option('ssn_show_all') ? 1 : 0;
$exclude = str_replace(" ", "", get_option('ssn_exclude'));
$hide_on_excluded = get_option('ssn_hide_on_excluded') ? 1 : 0;
$show_on_home = get_option('ssn_show_on_home') ? 1 : 0;
$show_empty = get_option('ssn_show_empty') ? 1 : 0;
$a_heading = get_option('ssn_a_heading') ? 1 : 0;
$settings = array('show_all' => $show_all, 'exclude' => $exclude, 'hide_on_excluded' => $hide_on_excluded, 'show_on_home' => $show_on_home, 'show_empty' => $show_empty, 'sort_by' => get_option('ssn_sortby'), 'a_heading' => $a_heading);
wp_convert_widget_settings('simple-section-nav', 'widget_simple-section-nav', $settings);
//delete old settings ... done supporting 1.x
delete_option('ssn_show_all');
delete_option('ssn_exclude');
delete_option('ssn_hide_on_excluded');
delete_option('ssn_show_on_home');
delete_option('ssn_show_empty');
delete_option('ssn_sortby');
delete_option('ssn_a_heading');
}
开发者ID:rtgibbons,项目名称:bya.org,代码行数:23,代码来源:simple_section_nav.php
注:本文中的wp_convert_widget_settings函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论