Make WordPress Core

Ticket #16773: 16773.2.diff

File 16773.2.diff, 884 bytes (added by drebbits.web, 9 years ago)
  • wp-includes/class-wp-widget.php

     
    152152         *                                information on accepted arguments. Default empty array.
    153153         */
    154154        public function __construct( $id_base, $name, $widget_options = array(), $control_options = array() ) {
    155                 $this->id_base = empty($id_base) ? preg_replace( '/(wp_)?widget_/', '', strtolower(get_class($this)) ) : strtolower($id_base);
     155                $this->id_base = empty($id_base) ? preg_replace( '/(wp_)?widget_/', '', sanitize_key( get_class( $this ) ) ) : sanitize_key( $id_base );
    156156                $this->name = $name;
    157157                $this->option_name = 'widget_' . $this->id_base;
    158158                $this->widget_options = wp_parse_args( $widget_options, array('classname' => $this->option_name) );