Ticket #8441: widget_setup.patch
File widget_setup.patch, 6.3 KB (added by scribu, 3 years ago) |
---|
-
wp-includes/default-widgets.php
? 14 14 */? 15 15 class WP_Widget_Pages extends WP_Widget {? 16 16 ? 17 ? function WP_Widget_Pages() {? 18 ? $widget_ops = array('classname' => 'widget_pages', 'description' => __( "Your blog's WordPress Pages") );? 19 ? $this->WP_Widget('pages', __('Pages'), $widget_ops);? ? 17 function setup() {? ? 18 $this->name = __('Pages');? ? 19 $this->id_base = 'pages';? ? 20 $this->widget_options = array('classname' => 'widget_pages', 'description' => __( "Your blog's WordPress Pages") );? 20 21 }? 21 22 ? 22 23 function widget( $args, $instance ) {? ? ? ? 90 91 */? 91 92 class WP_Widget_Links extends WP_Widget {? 92 93 ? 93 ? function WP_Widget_Links() {? 94 ? $widget_ops = array('description' => __( "Your blogroll" ) );? 95 ? $this->WP_Widget('links', __('Links'), $widget_ops);? ? 94 function setup() {? ? 95 $this->name = __('Links');? ? 96 $this->id_base = 'links';? ? 97 $this->widget_options = array('description' => __( "Your blogroll" ) );? 96 98 }? 97 99 ? 98 100 function widget( $args, $instance ) {? ? ? ? 150 152 */? 151 153 class WP_Widget_Search extends WP_Widget {? 152 154 ? 153 ? function WP_Widget_Search() {? 154 ? $widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your blog") );? 155 ? $this->WP_Widget('search', __('Search'), $widget_ops);? ? 155 function setup() {? ? 156 $this->name = __('Search');? ? 157 $this->id_base = 'search';? ? 158 $this->widget_options = array('classname' => 'widget_search', 'description' => __( "A search form for your blog") );? 156 159 }? 157 160 ? 158 161 function widget( $args, $instance ) {? ? ? ? 173 176 */? 174 177 class WP_Widget_Archives extends WP_Widget {? 175 178 ? 176 ? function WP_Widget_Archives() {? 177 ? $widget_ops = array('classname' => 'widget_archive', 'description' => __( "A monthly archive of your blog's posts") );? 178 ? $this->WP_Widget('archives', __('Archives'), $widget_ops);? ? 179 function setup() {? ? 180 $this->name = __('Archives');? ? 181 $this->id_base = 'archives';? ? 182 $this->widget_options = array('classname' => 'widget_archive', 'description' => __( "A monthly archive of your blog's posts") );? 179 183 }? 180 184 ? 181 185 function widget( $args, $instance ) {? ? ? ? 237 241 */? 238 242 class WP_Widget_Meta extends WP_Widget {? 239 243 ? 240 ? function WP_Widget_Meta() {? 241 ? $widget_ops = array('classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") );? 242 ? $this->WP_Widget('meta', __('Meta'), $widget_ops);? ? 244 function setup() {? ? 245 $this->name = __('Meta');? ? 246 $this->id_base = 'meta';? ? 247 $this->widget_options = array('classname' => 'widget_meta', 'description' => __( "Log in/out, admin, feed and WordPress links") );? 243 248 }? 244 249 ? 245 250 function widget( $args, $instance ) {? ? ? ? 284 289 */? 285 290 class WP_Widget_Calendar extends WP_Widget {? 286 291 ? 287 ? function WP_Widget_Calendar() {? 288 ? $widget_ops = array('classname' => 'widget_calendar', 'description' => __( "A calendar of your blog's posts") );? 289 ? $this->WP_Widget('calendar', __('Calendar'), $widget_ops);? ? 292 function setup() {? ? 293 $this->name = __('Calendar');? ? 294 $this->id_base = 'calendar';? ? 295 $this->widget_options = array('classname' => 'widget_calendar', 'description' => __( "A calendar of your blog's posts") );? 290 296 }? 291 297 ? 292 298 function widget( $args, $instance ) {? ? ? ? 322 328 */? 323 329 class WP_Widget_Text extends WP_Widget {? 324 330 ? 325 ? function WP_Widget_Text() {?326 ? $ widget_ops = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML'));?327 ? $ control_ops = array('width' => 400, 'height' => 350);?328 ? $this-> WP_Widget('text', __('Text'), $widget_ops, $control_ops);?? 331 function setup() {? ? 332 $this->name = __('Text');? ? 333 $this->id_base = 'text';? ? 334 $this->widget_options = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML'));? 329 335 }? 330 336 ? 331 337 function widget( $args, $instance ) {? ? ? ? 367 373 */? 368 374 class WP_Widget_Categories extends WP_Widget {? 369 375 ? 370 ? function WP_Widget_Categories() {? 371 ? $widget_ops = array( 'classname' => 'widget_categories', 'description' => __( "A list or dropdown of categories" ) );? 372 ? $this->WP_Widget('categories', __('Categories'), $widget_ops);? ? 376 function setup() {? ? 377 $this->name = __('Categories');? ? 378 $this->id_base = 'categories';? ? 379 $this->widget_options = array( 'classname' => 'widget_categories', 'description' => __( "A list or dropdown of categories" ) );? 373 380 }? 374 381 ? 375 382 function widget( $args, $instance ) {? -
wp-includes/widgets.php
? 34 34 ? 35 35 // Member functions that you must over-ride.? 36 36 ? ? 37 /** Set up widget variables:? ? 38 * Mandatory are $id_base and $name? ? 39 */? ? 40 function setup() {? ? 41 die('function WP_Widget::setup() must be over-ridden in a sub-class.');? ? 42 }? ? 43 ? 37 44 /** Echo the widget content.? 38 45 * ? 39 46 * Subclasses should over-ride this function to generate their widget code.? ? ? ? 71 78 /**? 72 79 * PHP4 constructor? 73 80 */? 74 ? function WP_Widget( $id_base, $name, $widget_options = array(), $control_options = array()) {?75 ? $this->__construct( $id_base, $name, $widget_options, $control_options);?? 81 function WP_Widget() {? ? 82 $this->__construct();? 76 83 }? 77 84 ? 78 85 /**? ? ? ? 84 91 * - width? 85 92 * - height? 86 93 */? 87 ? function __construct( $id_base, $name, $widget_options = array(), $control_options = array() ) {? 88 ? $this->id_base = $id_base;? 89 ? $this->name = $name;? 90 ? $this->option_name = 'widget_' . $id_base;? 91 ? $this->widget_options = wp_parse_args( $widget_options, array('classname' => $this->option_name) );? 92 ? $this->control_options = wp_parse_args( $control_options, array('id_base' => $this->id_base) );? ? 94 function __construct() {? ? 95 $this->setup();? 93 96 ? ? 97 if ( empty($this->id_base) )? ? 98 trigger_error("No id_base defined", E_USER_ERROR);? ? 99 ? ? 100 if ( empty($this->name) )? ? 101 return trigger_error("No name defined", E_USER_ERROR);? ? 102 ? ? 103 $this->option_name = 'widget_' . $this->id_base;? ? 104 $this->widget_options = wp_parse_args( $this->widget_options, array('classname' => $this->option_name) );? ? 105 $this->control_options = wp_parse_args( $this->control_options, array('id_base' => $this->id_base) );? ? 106 ? 94 107 //add_action( 'widgets_init', array( &$this, '_register' ) );? 95 108 }? 96 109 ? ? ? ? 1072 1085 */? 1073 1086 function unregister_widget_control($id) {? 1074 1087 return wp_unregister_widget_control($id);? 1075 ? }? 1076 ? No newline at end of file? ? 1088 }?