• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP next_widget_id_number函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中next_widget_id_number函数的典型用法代码示例。如果您正苦于以下问题:PHP next_widget_id_number函数的具体用法?PHP next_widget_id_number怎么用?PHP next_widget_id_number使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: wp_list_widgets

/**
 * Display list of the available widgets, either all or matching search.
 *
 * The search parameter are search terms separated by spaces.
 *
 * @since unknown
 *
 * @param string $show Optional, default is all. What to display, can be 'all', 'unused', or 'used'.
 * @param string $_search Optional. Search for widgets. Should be unsanitized.
 */
function wp_list_widgets()
{
    global $wp_registered_widgets, $sidebars_widgets, $wp_registered_widget_controls;
    $sort = $wp_registered_widgets;
    usort($sort, create_function('$a, $b', 'return strnatcasecmp( $a["name"], $b["name"] );'));
    $done = array();
    foreach ($sort as $widget) {
        if (in_array($widget['callback'], $done, true)) {
            // We already showed this multi-widget
            continue;
        }
        $sidebar = is_active_widget($widget['callback'], $widget['id'], false, false);
        $done[] = $widget['callback'];
        if (!isset($widget['params'][0])) {
            $widget['params'][0] = array();
        }
        $args = array('widget_id' => $widget['id'], 'widget_name' => $widget['name'], '_display' => 'template');
        if (isset($wp_registered_widget_controls[$widget['id']]['id_base']) && isset($widget['params'][0]['number'])) {
            $id_base = $wp_registered_widget_controls[$widget['id']]['id_base'];
            $args['_temp_id'] = "{$id_base}-__i__";
            $args['_multi_num'] = next_widget_id_number($id_base);
            $args['_add'] = 'multi';
        } else {
            $args['_add'] = 'single';
            if ($sidebar) {
                $args['_hide'] = '1';
            }
        }
        $args = wp_list_widget_controls_dynamic_sidebar(array(0 => $args, 1 => $widget['params'][0]));
        call_user_func_array('wp_widget_control', $args);
    }
}
开发者ID:alicam,项目名称:wordpress,代码行数:42,代码来源:widgets.php


示例2: widget_get_form

 function widget_get_form()
 {
     if (!wp_verify_nonce($_POST['tfb_load_nonce'], 'tfb_load_nonce')) {
         die(-1);
     }
     global $wp_widget_factory;
     require_once ABSPATH . 'wp-admin/includes/widgets.php';
     $widget_class = $_POST['load_class'];
     if ($widget_class == '') {
         die(-1);
     }
     $get_instance = isset($_POST['widget_instance']) ? $_POST['widget_instance'] : '';
     $instance = array();
     if (is_array($get_instance) && count($get_instance) > 0) {
         foreach ($get_instance as $k => $s) {
             $instance = $s;
         }
     }
     $widget = new $widget_class();
     $widget->number = next_widget_id_number($_POST['id_base']);
     ob_start();
     $widget->form($instance);
     $form = ob_get_clean();
     $widget->form = $form;
     echo $widget->form;
     echo '<br/>';
     die;
 }
开发者ID:rgrasiano,项目名称:viabasica-hering,代码行数:28,代码来源:module-widget.php


示例3: getNumber

 /**
  * Vrátí číslo (v podstatě ID) právě na základě ID property, resp. její číselné přípony
  * 
  * @author Martin Hlaváč
  * @link http://www.ktstudio.cz
  * 
  * @return int
  */
 public function getNumber()
 {
     $id = $this->getId();
     if (KT::issetAndNotEmpty($id)) {
         $parts = explode("-", $id);
         $parts = array_reverse($parts);
         $number = KT::tryGetInt($parts[0]);
         if (KT::isIdFormat($number)) {
             return $number;
         } else {
             return next_widget_id_number($this->getName());
         }
     }
     return 0;
 }
开发者ID:Nodonisko,项目名称:WP-Framework,代码行数:23,代码来源:kt_widget_base.inc.php


示例4: get_available_widgets

 /**
  * Build up an index of all available widgets for use in Backbone models.
  *
  * @since 3.9.0
  * @access public
  *
  * @global array $wp_registered_widgets
  * @global array $wp_registered_widget_controls
  * @staticvar array $available_widgets
  *
  * @see wp_list_widgets()
  *
  * @return array List of available widgets.
  */
 public function get_available_widgets()
 {
     static $available_widgets = array();
     if (!empty($available_widgets)) {
         return $available_widgets;
     }
     global $wp_registered_widgets, $wp_registered_widget_controls;
     require_once ABSPATH . '/wp-admin/includes/widgets.php';
     // for next_widget_id_number()
     $sort = $wp_registered_widgets;
     usort($sort, array($this, '_sort_name_callback'));
     $done = array();
     foreach ($sort as $widget) {
         if (in_array($widget['callback'], $done, true)) {
             // We already showed this multi-widget
             continue;
         }
         $sidebar = is_active_widget($widget['callback'], $widget['id'], false, false);
         $done[] = $widget['callback'];
         if (!isset($widget['params'][0])) {
             $widget['params'][0] = array();
         }
         $available_widget = $widget;
         unset($available_widget['callback']);
         // not serializable to JSON
         $args = array('widget_id' => $widget['id'], 'widget_name' => $widget['name'], '_display' => 'template');
         $is_disabled = false;
         $is_multi_widget = isset($wp_registered_widget_controls[$widget['id']]['id_base']) && isset($widget['params'][0]['number']);
         if ($is_multi_widget) {
             $id_base = $wp_registered_widget_controls[$widget['id']]['id_base'];
             $args['_temp_id'] = "{$id_base}-__i__";
             $args['_multi_num'] = next_widget_id_number($id_base);
             $args['_add'] = 'multi';
         } else {
             $args['_add'] = 'single';
             if ($sidebar && 'wp_inactive_widgets' !== $sidebar) {
                 $is_disabled = true;
             }
             $id_base = $widget['id'];
         }
         $list_widget_controls_args = wp_list_widget_controls_dynamic_sidebar(array(0 => $args, 1 => $widget['params'][0]));
         $control_tpl = $this->get_widget_control($list_widget_controls_args);
         // The properties here are mapped to the Backbone Widget model.
         $available_widget = array_merge($available_widget, array('temp_id' => isset($args['_temp_id']) ? $args['_temp_id'] : null, 'is_multi' => $is_multi_widget, 'control_tpl' => $control_tpl, 'multi_number' => $args['_add'] === 'multi' ? $args['_multi_num'] : false, 'is_disabled' => $is_disabled, 'id_base' => $id_base, 'transport' => 'refresh', 'width' => $wp_registered_widget_controls[$widget['id']]['width'], 'height' => $wp_registered_widget_controls[$widget['id']]['height'], 'is_wide' => $this->is_wide_widget($widget['id'])));
         $available_widgets[] = $available_widget;
     }
     return $available_widgets;
 }
开发者ID:nxty2011,项目名称:WordPress,代码行数:62,代码来源:class-wp-customize-widgets.php


示例5: _add_widget

 /**
  * Adds a widget to WordPress. First creates a new widget instance, then
  * adds the widget instance to the mega menu widget sidebar area.
  *
  * @since 1.0.0
  * @param string $id_base
  * @param int $menu_item_id
  * @param string $title
  */
 public function _add_widget($id_base, $menu_item_id, $title, $total_cols)
 {
     require_once ABSPATH . 'wp-admin/includes/widgets.php';
     $next_id = next_widget_id_number($id_base);
     $this->add_widget_instance($id_base, $next_id, $menu_item_id);
     $widget_id = $this->add_widget_to_sidebar($id_base, $next_id);
     $return = $this->get_widget_html($title, $widget_id, 4, $total_cols);
     return array('content' => $return, 'id' => $widget_id);
 }
开发者ID:xav335,项目名称:sfnettoyage,代码行数:18,代码来源:class-cherry-mega-menu-widget-manager.php


示例6: add_widget

 /**
  * Adds a widget to WordPress. First creates a new widget instance, then
  * adds the widget instance to the mega menu widget sidebar area.
  *
  * @since 1.0
  * @param string $id_base
  * @param int $menu_item_id
  * @param string $title
  */
 public function add_widget($id_base, $menu_item_id, $title)
 {
     require_once ABSPATH . 'wp-admin/includes/widgets.php';
     $next_id = next_widget_id_number($id_base);
     $this->add_widget_instance($id_base, $next_id, $menu_item_id);
     $widget_id = $this->add_widget_to_sidebar($id_base, $next_id);
     $return = '<div class="widget" data-columns="2" id="' . $widget_id . '" data-widget-id="' . $widget_id . '">';
     $return .= '    <div class="widget-top">';
     $return .= '        <div class="widget-title-action">';
     $return .= '            <a class="widget-option widget-contract"></a>';
     $return .= '            <a class="widget-option widget-expand"></a>';
     $return .= '            <a class="widget-option widget-action"></a>';
     $return .= '        </div>';
     $return .= '        <div class="widget-title">';
     $return .= '            <h4>' . $title . '</h4>';
     $return .= '        </div>';
     $return .= '    </div>';
     $return .= '    <div class="widget-inner"></div>';
     $return .= '</div>';
     return $return;
 }
开发者ID:hoaint,项目名称:junhee,代码行数:30,代码来源:widget-manager.class.php


示例7: get_widget_form

 /**
  * Generates the widget form
  *
  * @since 1.0
  * @return string
  */
 function get_widget_form($widget, $name, $options = array())
 {
     global $wp_widget_factory;
     require_once ABSPATH . 'wp-admin/includes/widgets.php';
     if (!is_array($options)) {
         $options = array();
     }
     $options = array_merge($options, array('number' => next_widget_id_number(0)));
     ob_start();
     $wp_widget_factory->widgets[$widget]->form($options);
     do_action_ref_array('in_widget_form', array($wp_widget_factory->widgets[$widget], null, $options));
     $form = ob_get_clean();
     $base_name = 'widget-' . $wp_widget_factory->widgets[$widget]->id_base . '\\[' . $wp_widget_factory->widgets[$widget]->number . '\\]';
     $form = preg_replace("/{$base_name}/", $name, $form);
     return $form;
 }
开发者ID:jhostetter,项目名称:wp_intern_themes,代码行数:22,代码来源:module.php


示例8: importTheme


//.........这里部分代码省略.........
                    $properties = unserialize($property);
                    if (count($properties) != 0) {
                        $classql = "REPLACE INTO {$classtable} (`container`,`user_class`,`hidephone`,`hidetablet`,`hidedesktop`,`layout_id`) VALUES ('{$container}','" . $properties["user_class"] . "','" . $properties["hidephone"] . "','" . $properties["hidetablet"] . "','" . $properties["hidedesktop"] . "','" . $properties["layout_id"] . "')";
                        $wpdb->query($classql);
                    }
                }
            }
            // Insert row Column CSS
            foreach ($row['col'] as $colid => $colcss) {
                $column = 'col-' . $layoutid . '-' . $colid;
                foreach ($colcss as $element => $property) {
                    if ($element != 'custom_classes') {
                        $properties = serialize($property);
                        $colsql = "INSERT INTO {$ctable} VALUES ('','{$column}','{$layoutid}','{$element}','{$properties}')";
                        $wpdb->query($colsql);
                    } else {
                        $properties = unserialize($property);
                        if (count($properties) != 0) {
                            $classql = "REPLACE INTO {$classtable} (`container`,`user_class`,`hidephone`,`hidetablet`,`hidedesktop`,`layout_id`) VALUES ('{$column}','" . $properties["user_class"] . "','" . $properties["hidephone"] . "','" . $properties["hidetablet"] . "','" . $property["hidedesktop"] . "','" . $properties["layout_id"] . "')";
                            $wpdb->query($classql);
                        }
                    }
                }
            }
            //Import the widgets
            foreach ($row["widgets"] as $sidebar => $widgets) {
                foreach ($widgets as $widget) {
                    $option = $widget['widget_name'];
                    $id_base = $widget['id_base'];
                    if (isset($messedids[$option])) {
                        $nextid = $messedids[$option] + 1;
                        $messedids[$option] = $nextid;
                    } else {
                        $nextid = next_widget_id_number($widget['id_base']);
                        $messedids[$option] = $nextid;
                    }
                    $warray = get_option($option);
                    unset($widget['widget_name']);
                    unset($widget['id_base']);
                    $warray[$nextid] = $widget;
                    update_option($option, $warray);
                    $ultimatum_sidebars_widgets = get_option('ultimatum_sidebars_widgets');
                    $ultimatum_sidebars_widgets['sidebar-' . $rowid . '-' . $sidebar][] = $id_base . '-' . $nextid;
                    update_option('ultimatum_sidebars_widgets', $ultimatum_sidebars_widgets);
                    unset($warray);
                }
            }
            // Widget import Done :)
        }
        // GENERATE Layout specific CSS
        // Save the CSS
        $file = THEME_CACHE_DIR . '/layout_' . $prel . $layoutid . '.css';
        $query = "SELECT * FROM {$ctable} WHERE layout_id='{$layoutid}'";
        $res = $wpdb->get_results($query, ARRAY_A);
        $css = '';
        foreach ($res as $fetch) {
            if ($fetch["element"] == 'general') {
                if ($fetch["container"] != 'body') {
                    if (eregi('col-', $fetch["container"])) {
                        $el = '#' . $fetch["container"] . ' .colwrapper';
                    } else {
                        $el = '#' . $fetch["container"];
                    }
                } else {
                    $el = $fetch["container"];
                }
开发者ID:shieldsdesignstudio,项目名称:forefield,代码行数:67,代码来源:index.php


示例9: add_widget

 /**
  * Adds a widget to WordPress. First creates a new widget instance, then
  * adds the widget instance to the mega menu widget sidebar area.
  *
  * @since 1.0
  * @param string $id_base
  * @param int $menu_item_id
  */
 public function add_widget($id_base, $menu_item_id)
 {
     require_once ABSPATH . 'wp-admin/includes/widgets.php';
     $next_id = next_widget_id_number($id_base);
     $this->add_widget_instance($id_base, $next_id, $menu_item_id);
     $widget_id = $this->add_widget_to_sidebar($id_base, $next_id);
     return $widget_id;
 }
开发者ID:localyeva,项目名称:evablog,代码行数:16,代码来源:widget-manager.class.php


示例10: add_widget

 /**
  * Adds a widget to WordPress. First creates a new widget instance, then
  * adds the widget instance to the mega menu widget sidebar area.
  *
  * @since 1.0
  * @param string $id_base
  * @param int $menu_item_id
  * @param string $title
  */
 public function add_widget($id_base, $menu_item_id, $title)
 {
     require_once ABSPATH . 'wp-admin/includes/widgets.php';
     $next_id = next_widget_id_number($id_base);
     $this->add_widget_instance($id_base, $next_id, $menu_item_id);
     $widget_id = $this->add_widget_to_sidebar($id_base, $next_id);
     $return = '<div class="widget" title="' . esc_attr($title) . '" data-columns="2" id="' . $widget_id . '" data-type="widget" data-id="' . $widget_id . '">';
     $return .= '    <div class="widget-top">';
     $return .= '        <div class="widget-title-action">';
     $return .= '            <a class="widget-option widget-contract" title="' . esc_attr(__("Contract", "megamenu")) . '"></a>';
     $return .= '            <span class="widget-cols"><span class="widget-num-cols">2</span><span class="widget-of">/</span><span class="widget-total-cols">X</span></span>';
     $return .= '            <a class="widget-option widget-expand" title="' . esc_attr(__("Expand", "megamenu")) . '"></a>';
     $return .= '            <a class="widget-option widget-action" title="' . esc_attr(__("Edit", "megamenu")) . '"></a>';
     $return .= '        </div>';
     $return .= '        <div class="widget-title">';
     $return .= '            <h4>' . esc_html($title) . '</h4>';
     $return .= '        </div>';
     $return .= '    </div>';
     $return .= '    <div class="widget-inner"></div>';
     $return .= '</div>';
     return $return;
 }
开发者ID:taeche,项目名称:SoDoEx,代码行数:31,代码来源:widget-manager.class.php


示例11: install_default_content

 /**
  * Install default content when theme is activated.
  *
  * Set the 'PC_INSTALL_DEFAULT_CONTENT' and 'PC_INSTALL_CONTENT_PROMPT' constants
  * to control how this appears to the user.
  *
  * @since 0.1.0
  */
 public static function install_default_content($theme_options_url)
 {
     /* Create default content, and configure menus, widgets etc. */
     /* Add some default pages. */
     $pages = array(array('title' => 'Blog', 'content' => '', 'template' => 'blog-page.php'), array('title' => 'About Us', 'content' => 'Some information all about us.', 'template' => ''), array('title' => 'Sitemap', 'content' => '', 'template' => 'sitemap-page.php'), array('title' => 'Contact Us', 'content' => 'Please use the contact form below for all enquiries. We will respond to your message as soon as possible.', 'template' => 'contact-page.php'));
     /* Create some new theme pages. */
     self::create_theme_pages($pages);
     /* Create nav menu if it doesn't already exist and add some pages. */
     self::create_new_theme_nav_menu($pages);
     /* Define the multi number for each widget type here, then increment for each additional widget added of the same type. */
     global $pc_info_box_multi_number;
     $pc_info_box_multi_number = next_widget_id_number('pc_info_widget_' . PC_THEME_NAME_SLUG);
     /* Add an Info Box widget to the header widget area. */
     $info_box_widget = array('widget_area' => 'header-widget-area', 'widget_name' => 'Info Box', 'default_settings' => array('title' => 'Header Info Box', 'info_description' => '', 'phone_number' => '(949) 867-5307', 'facebook_id' => 'PressCoders', 'twitter_id' => 'presscoders', 'youtube_id' => 'PressCoders', 'flickr_id' => '', 'googleplus_id' => 'http://plus.google.com', 'linkedin_id' => 'http://www.linkedin.com', 'rss_id' => 'http://www.presscoders.com', 'custom_id_1' => '', 'custom_img_1' => '', 'show_search' => ''));
     self::add_default_widget($info_box_widget, true);
     /* Install extra content if demo site active. */
     if (PC_INSTALL_DEMO_CONTENT && method_exists('PC_TS_Utility', 'theme_demo_default_content')) {
         /* Install theme specific demo content if class method has been declared. */
         PC_TS_Utility::theme_demo_default_content();
     }
     /* Render theme activation message. */
     self::theme_activation_message($theme_options_url);
 }
开发者ID:2030449c,项目名称:farkol,代码行数:31,代码来源:utility.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP nextendIsJoomla函数代码示例发布时间:2022-05-15
下一篇:
PHP next_posts_link函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap