Make WordPress Core

Changeset 13098


Ignore:
Timestamp:
02/13/2010 07:55:28 AM (13 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

Location:
trunk/wp-includes
Files:
2 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?>
  • trunk/wp-includes/widgets.php

    r12680 r13098  
    11721172
    11731173/**
    1174  * Deprecated API
    1175  */
    1176 
    1177 /**
    1178  * Register widget for sidebar with backwards compatibility.
    1179  *
    1180  * Allows $name to be an array that accepts either three elements to grab the
    1181  * first element and the third for the name or just uses the first element of
    1182  * the array for the name.
    1183  *
    1184  * Passes to {@link wp_register_sidebar_widget()} after argument list and
    1185  * backwards compatibility is complete.
    1186  *
    1187  * @since 2.2.0
    1188  * @uses wp_register_sidebar_widget() Passes the compiled arguments.
    1189  *
    1190  * @param string|int $name Widget ID.
    1191  * @param callback $output_callback Run when widget is called.
    1192  * @param string $classname Classname widget option.
    1193  * @param mixed $params,... Widget parameters.
    1194  */
    1195 function register_sidebar_widget($name, $output_callback, $classname = '') {
    1196     // Compat
    1197     if ( is_array($name) ) {
    1198         if ( count($name) == 3 )
    1199             $name = sprintf($name[0], $name[2]);
    1200         else
    1201             $name = $name[0];
    1202     }
    1203 
    1204     $id = sanitize_title($name);
    1205     $options = array();
    1206     if ( !empty($classname) && is_string($classname) )
    1207         $options['classname'] = $classname;
    1208     $params = array_slice(func_get_args(), 2);
    1209     $args = array($id, $name, $output_callback, $options);
    1210     if ( !empty($params) )
    1211         $args = array_merge($args, $params);
    1212 
    1213     call_user_func_array('wp_register_sidebar_widget', $args);
    1214 }
    1215 
    1216 /**
    1217  * Alias of {@link wp_unregister_sidebar_widget()}.
    1218  *
    1219  * @see wp_unregister_sidebar_widget()
    1220  *
    1221  * @since 2.2.0
    1222  *
    1223  * @param int|string $id Widget ID.
    1224  */
    1225 function unregister_sidebar_widget($id) {
    1226     return wp_unregister_sidebar_widget($id);
    1227 }
    1228 
    1229 /**
    1230  * Registers widget control callback for customizing options.
    1231  *
    1232  * Allows $name to be an array that accepts either three elements to grab the
    1233  * first element and the third for the name or just uses the first element of
    1234  * the array for the name.
    1235  *
    1236  * Passes to {@link wp_register_widget_control()} after the argument list has
    1237  * been compiled.
    1238  *
    1239  * @since 2.2.0
    1240  *
    1241  * @param int|string $name Sidebar ID.
    1242  * @param callback $control_callback Widget control callback to display and process form.
    1243  * @param int $width Widget width.
    1244  * @param int $height Widget height.
    1245  */
    1246 function register_widget_control($name, $control_callback, $width = '', $height = '') {
    1247     // Compat
    1248     if ( is_array($name) ) {
    1249         if ( count($name) == 3 )
    1250             $name = sprintf($name[0], $name[2]);
    1251         else
    1252             $name = $name[0];
    1253     }
    1254 
    1255     $id = sanitize_title($name);
    1256     $options = array();
    1257     if ( !empty($width) )
    1258         $options['width'] = $width;
    1259     if ( !empty($height) )
    1260         $options['height'] = $height;
    1261     $params = array_slice(func_get_args(), 4);
    1262     $args = array($id, $name, $control_callback, $options);
    1263     if ( !empty($params) )
    1264         $args = array_merge($args, $params);
    1265 
    1266     call_user_func_array('wp_register_widget_control', $args);
    1267 }
    1268 
    1269 /**
    1270  * Alias of {@link wp_unregister_widget_control()}.
    1271  *
    1272  * @since 2.2.0
    1273  * @see wp_unregister_widget_control()
    1274  *
    1275  * @param int|string $id Widget ID.
    1276  */
    1277 function unregister_widget_control($id) {
    1278     return wp_unregister_widget_control($id);
    1279 }
    1280 
    1281 /**
    12821174 * Output an arbitrary widget as a template tag
    12831175 *
Note: See TracChangeset for help on using the changeset viewer.