Advertisement
Guest User

fix for class WP_Widget

a guest
Dec 3rd, 2012
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.38 KB | None | 0 0
  1.     // Functions you'll need to call.
  2.  
  3.     /**
  4.      * PHP5 constructor
  5.      *
  6.      * @param string $id_base Optional Base ID for the widget, lower case,
  7.      * if left empty a portion of the widget's class name will be used. Has to be unique.
  8.      * @param string $name Name for the widget displayed on the configuration page.
  9.      * @param array $widget_options Optional Passed to wp_register_sidebar_widget()
  10.      *   - description: shown on the configuration page
  11.      *   - classname
  12.      * @param array $control_options Optional Passed to wp_register_widget_control()
  13.      *   - width: required if more than 250px
  14.      *   - height: currently not used but may be needed in the future
  15.      */
  16.     function __construct( $id_base = false, $name, $widget_options = array(), $control_options = array() ) {
  17.         $this->id_base = empty($id_base) ? preg_replace( '/(wp_)?widget_/', '', strtolower(get_class($this)) ) : strtolower($id_base);
  18.         $this->name = $name;
  19.         $this->option_name = 'widget_' . $this->id_base;
  20.         $this->widget_options = wp_parse_args( $widget_options, array('classname' => $this->option_name) );
  21.         $this->control_options = wp_parse_args( $control_options, array('id_base' => $this->id_base) );
  22.     }
  23.  
  24.     /**
  25.      * PHP4 constructor
  26.      */
  27.     function WP_Widget( $id_base = false, $name, $widget_options = array(), $control_options = array() ) {
  28.         WP_Widget::__construct( $id_base, $name, $widget_options, $control_options );
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement