WordPress.org

Make WordPress Core

Changeset 5360


Ignore:
Timestamp:
05/01/2007 01:13:06 AM (11 years ago)
Author:
rob1n
Message:

Move widget stuff around. see #4169

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/wp-includes/default-filters.php

    r5337 r5360  
    174174add_action('mce_options', '_mce_set_direction');
    175175add_action('init', 'smilies_init', 5);
    176 add_action('init', 'wp_widgets_init', 1);
     176
     177add_action( 'plugins_loaded', 'wp_load_widgets', 0 );
     178
    177179?>
  • branches/2.2/wp-includes/functions.php

    r5289 r5360  
    14691469}
    14701470
     1471function wp_load_widgets() {
     1472    require_once ABSPATH . WPINC . '/widgets.php';
     1473}
     1474
    14711475?>
  • branches/2.2/wp-includes/widgets.php

    r5359 r5360  
    11<?php
     2
     3/*
     4    Check if another widget plugin is active. If this is so,
     5    then bail out.
     6*/
     7
     8if ( function_exists( 'dynamic_sidebars' ) ) {
     9    return;
     10}
    211
    312/* Global Variables */
     13
     14global $wp_registered_sidebars, $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_styles, $wp_registered_widget_defaults;
    415
    516$wp_registered_sidebars = array();
     
    1122/* Template tags & API functions */
    1223
    13 if ( !function_exists( 'register_sidebars' ) ):
    1424function register_sidebars($number = 1, $args = array()) {
    1525    $number = (int) $number;
     
    3242    }
    3343}
    34 endif;
    35 
    36 if ( !function_exists( 'register_sidebar' ) ):
     44
    3745function register_sidebar($args = array()) {
    3846    global $wp_registered_sidebars;
     
    5866    return $sidebar['id'];
    5967}
    60 endif;
    61 
    62 if ( !function_exists( 'unregister_sidebar' ) ):
     68
    6369function unregister_sidebar( $name ) {
    6470    global $wp_registered_sidebars;
     
    6773        unset( $wp_registered_sidebars[$name] );
    6874}
    69 endif;
    70 
    71 if ( !function_exists( 'register_sidebar_widget' ) ):
     75
    7276function register_sidebar_widget($name, $output_callback, $classname = '', $id = '') {
    7377    global $wp_registered_widgets, $wp_register_widget_defaults;
     
    101105        $wp_registered_widgets[$id] = $widget;
    102106}
    103 endif;
    104 
    105 if ( !function_exists( 'unregister_sidebar_widget' ) ):
     107
    106108function unregister_sidebar_widget($id) {
    107109    $id = sanitize_title($id);
     
    109111    unregister_widget_control($id);
    110112}
    111 endif;
    112 
    113 if ( !function_exists( 'register_widget_control' ) ):
     113
    114114function register_widget_control($name, $control_callback, $width = 300, $height = 200, $id = '') {
    115115    global $wp_registered_widget_controls, $wp_register_widget_defaults;
     
    143143        );
    144144}
    145 endif;
    146 
    147 if ( !function_exists( 'unregister_widget_control' ) ):
     145
    148146function unregister_widget_control($id) {
    149147    $id = sanitize_title($id);
    150148    return register_widget_control($id, '');
    151149}
    152 endif;
    153 
    154 if ( !function_exists( 'dynamic_sidebar' ) ):
     150
    155151function dynamic_sidebar($index = 1) {
    156152    global $wp_registered_sidebars, $wp_registered_widgets;
     
    186182    return $did_one;
    187183}
    188 endif;
    189 
    190 if ( !function_exists( 'is_active_widget' ) ):
     184
    191185function is_active_widget($callback) {
    192186    global $wp_registered_widgets;
     
    201195    return false;
    202196}
    203 endif;
    204 
    205 if ( !function_exists( 'is_dynamic_sidebar' ) ):
     197
    206198function is_dynamic_sidebar() {
    207199    global $wp_registered_widgets, $wp_registered_sidebars;
     
    216208    return false;
    217209}
    218 endif;
    219210
    220211/* Internal Functions */
     
    910901}
    911902
    912 ?>
     903add_action('init', 'wp_widgets_init', 1);
     904
     905?>
  • branches/2.2/wp-settings.php

    r5337 r5360  
    169169require (ABSPATH . WPINC . '/deprecated.php');
    170170require (ABSPATH . WPINC . '/script-loader.php');
    171 require (ABSPATH . WPINC . '/widgets.php');
    172171
    173172if (strpos($_SERVER['PHP_SELF'], 'install.php') === false) {
  • trunk/wp-includes/default-filters.php

    r5336 r5360  
    174174add_action('mce_options', '_mce_set_direction');
    175175add_action('init', 'smilies_init', 5);
    176 add_action('init', 'wp_widgets_init', 1);
     176
     177add_action( 'plugins_loaded', 'wp_load_widgets', 0 );
     178
    177179?>
  • trunk/wp-includes/functions.php

    r5308 r5360  
    15031503}
    15041504
     1505function wp_load_widgets() {
     1506    require_once ABSPATH . WPINC . '/widgets.php';
     1507}
     1508
    15051509?>
  • trunk/wp-includes/widgets.php

    r5358 r5360  
    11<?php
     2
     3/*
     4    Check if another widget plugin is active. If this is so,
     5    then bail out.
     6*/
     7
     8if ( function_exists( 'dynamic_sidebars' ) ) {
     9    return;
     10}
    211
    312/* Global Variables */
     13
     14global $wp_registered_sidebars, $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_styles, $wp_registered_widget_defaults;
    415
    516$wp_registered_sidebars = array();
     
    1122/* Template tags & API functions */
    1223
    13 if ( !function_exists( 'register_sidebars' ) ):
    1424function register_sidebars($number = 1, $args = array()) {
    1525    $number = (int) $number;
     
    3242    }
    3343}
    34 endif;
    35 
    36 if ( !function_exists( 'register_sidebar' ) ):
     44
    3745function register_sidebar($args = array()) {
    3846    global $wp_registered_sidebars;
     
    5866    return $sidebar['id'];
    5967}
    60 endif;
    61 
    62 if ( !function_exists( 'unregister_sidebar' ) ):
     68
    6369function unregister_sidebar( $name ) {
    6470    global $wp_registered_sidebars;
     
    6773        unset( $wp_registered_sidebars[$name] );
    6874}
    69 endif;
    70 
    71 if ( !function_exists( 'register_sidebar_widget' ) ):
     75
    7276function register_sidebar_widget($name, $output_callback, $classname = '', $id = '') {
    7377    global $wp_registered_widgets, $wp_register_widget_defaults;
     
    101105        $wp_registered_widgets[$id] = $widget;
    102106}
    103 endif;
    104 
    105 if ( !function_exists( 'unregister_sidebar_widget' ) ):
     107
    106108function unregister_sidebar_widget($id) {
    107109    $id = sanitize_title($id);
     
    109111    unregister_widget_control($id);
    110112}
    111 endif;
    112 
    113 if ( !function_exists( 'register_widget_control' ) ):
     113
    114114function register_widget_control($name, $control_callback, $width = 300, $height = 200, $id = '') {
    115115    global $wp_registered_widget_controls, $wp_register_widget_defaults;
     
    143143        );
    144144}
    145 endif;
    146 
    147 if ( !function_exists( 'unregister_widget_control' ) ):
     145
    148146function unregister_widget_control($id) {
    149147    $id = sanitize_title($id);
    150148    return register_widget_control($id, '');
    151149}
    152 endif;
    153 
    154 if ( !function_exists( 'dynamic_sidebar' ) ):
     150
    155151function dynamic_sidebar($index = 1) {
    156152    global $wp_registered_sidebars, $wp_registered_widgets;
     
    186182    return $did_one;
    187183}
    188 endif;
    189 
    190 if ( !function_exists( 'is_active_widget' ) ):
     184
    191185function is_active_widget($callback) {
    192186    global $wp_registered_widgets;
     
    201195    return false;
    202196}
    203 endif;
    204 
    205 if ( !function_exists( 'is_dynamic_sidebar' ) ):
     197
    206198function is_dynamic_sidebar() {
    207199    global $wp_registered_widgets, $wp_registered_sidebars;
     
    216208    return false;
    217209}
    218 endif;
    219210
    220211/* Internal Functions */
     
    910901}
    911902
    912 ?>
     903add_action('init', 'wp_widgets_init', 1);
     904
     905?>
  • trunk/wp-settings.php

    r5336 r5360  
    169169require (ABSPATH . WPINC . '/deprecated.php');
    170170require (ABSPATH . WPINC . '/script-loader.php');
    171 require (ABSPATH . WPINC . '/widgets.php');
    172171
    173172if (strpos($_SERVER['PHP_SELF'], 'install.php') === false) {
Note: See TracChangeset for help on using the changeset viewer.