WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/13/2010 07:55:28 AM (12 years ago)
Author:
nacin
Message:

Move deprecated pre-2.8 widget API to deprecated.php. Deprecate register_sidebar_widget, unregister_sidebar_widget, register_widget_control, unregister_widget_control, in favor of their wp_* counterparts. See #11388

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/deprecated.php

    r13096 r13098  
    21922192}
    21932193
     2194/**
     2195 * Register widget for sidebar with backwards compatibility.
     2196 *
     2197 * Allows $name to be an array that accepts either three elements to grab the
     2198 * first element and the third for the name or just uses the first element of
     2199 * the array for the name.
     2200 *
     2201 * Passes to {@link wp_register_sidebar_widget()} after argument list and
     2202 * backwards compatibility is complete.
     2203 *
     2204 * @since 2.2.0
     2205 * @deprecated 2.8.0
     2206 * @deprecated Use wp_register_sidebar_widget()
     2207 * @see wp_register_sidebar_widget()
     2208 *
     2209 * @param string|int $name Widget ID.
     2210 * @param callback $output_callback Run when widget is called.
     2211 * @param string $classname Classname widget option.
     2212 * @param mixed $params,... Widget parameters.
     2213 */
     2214function register_sidebar_widget($name, $output_callback, $classname = '') {
     2215    _deprecated_function( __FUNCTION__, '2.8', 'wp_register_sidebar_widget()' );
     2216    // Compat
     2217    if ( is_array($name) ) {
     2218        if ( count($name) == 3 )
     2219            $name = sprintf($name[0], $name[2]);
     2220        else
     2221            $name = $name[0];
     2222    }
     2223
     2224    $id = sanitize_title($name);
     2225    $options = array();
     2226    if ( !empty($classname) && is_string($classname) )
     2227        $options['classname'] = $classname;
     2228    $params = array_slice(func_get_args(), 2);
     2229    $args = array($id, $name, $output_callback, $options);
     2230    if ( !empty($params) )
     2231        $args = array_merge($args, $params);
     2232
     2233    call_user_func_array('wp_register_sidebar_widget', $args);
     2234}
     2235
     2236/**
     2237 * Alias of {@link wp_unregister_sidebar_widget()}.
     2238 *
     2239 * @since 2.2.0
     2240 * @deprecated 2.8.0
     2241 * @deprecated Use wp_unregister_sidebar_widget()
     2242 * @see wp_unregister_sidebar_widget()
     2243 *
     2244 * @param int|string $id Widget ID.
     2245 */
     2246function unregister_sidebar_widget($id) {
     2247    _deprecated_function( __FUNCTION__, '2.8', 'wp_unregister_sidebar_widget()' );
     2248    return wp_unregister_sidebar_widget($id);
     2249}
     2250
     2251/**
     2252 * Registers widget control callback for customizing options.
     2253 *
     2254 * Allows $name to be an array that accepts either three elements to grab the
     2255 * first element and the third for the name or just uses the first element of
     2256 * the array for the name.
     2257 *
     2258 * Passes to {@link wp_register_widget_control()} after the argument list has
     2259 * been compiled.
     2260 *
     2261 * @since 2.2.0
     2262 * @deprecated 2.8.0
     2263 * @deprecated Use wp_register_widget_control()
     2264 * @see wp_register_widget_control()
     2265 *
     2266 * @param int|string $name Sidebar ID.
     2267 * @param callback $control_callback Widget control callback to display and process form.
     2268 * @param int $width Widget width.
     2269 * @param int $height Widget height.
     2270 */
     2271function register_widget_control($name, $control_callback, $width = '', $height = '') {
     2272    _deprecated_function( __FUNCTION__, '2.8', 'wp_register_widget_control()' );
     2273    // Compat
     2274    if ( is_array($name) ) {
     2275        if ( count($name) == 3 )
     2276            $name = sprintf($name[0], $name[2]);
     2277        else
     2278            $name = $name[0];
     2279    }
     2280
     2281    $id = sanitize_title($name);
     2282    $options = array();
     2283    if ( !empty($width) )
     2284        $options['width'] = $width;
     2285    if ( !empty($height) )
     2286        $options['height'] = $height;
     2287    $params = array_slice(func_get_args(), 4);
     2288    $args = array($id, $name, $control_callback, $options);
     2289    if ( !empty($params) )
     2290        $args = array_merge($args, $params);
     2291
     2292    call_user_func_array('wp_register_widget_control', $args);
     2293}
     2294
     2295/**
     2296 * Alias of {@link wp_unregister_widget_control()}.
     2297 *
     2298 * @since 2.2.0
     2299 * @deprecated 2.8.0
     2300 * @deprecated Use wp_unregister_widget_control()
     2301 * @see wp_unregister_widget_control()
     2302 *
     2303 * @param int|string $id Widget ID.
     2304 */
     2305function unregister_widget_control($id) {
     2306    _deprecated_function( __FUNCTION__, '2.8', 'wp_unregister_widget_control()' );
     2307    return wp_unregister_widget_control($id);
     2308}
     2309
    21942310?>
Note: See TracChangeset for help on using the changeset viewer.