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/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.