Ticket #12133: 12133.2.diff
File 12133.2.diff, 1.1 KB (added by , 9 years ago) |
---|
-
src/wp-includes/class-wp-widget.php
181 181 * @return string Name attribute for $field_name 182 182 */ 183 183 public function get_field_name($field_name) { 184 return 'widget-' . $this->id_base . '[' . $this->number . '][' . $field_name . ']'; 184 if ( false === $pos = strpos( $field_name, '[' ) ) { 185 return 'widget-' . $this->id_base . '[' . $this->number . '][' . $field_name . ']'; 186 } else { 187 return 'widget-' . $this->id_base . '[' . $this->number . '][' . substr_replace( $field_name, '][', $pos, strlen( '[' ) ); 188 } 185 189 } 186 190 187 191 /** … … 197 201 * @return string ID attribute for `$field_name`. 198 202 */ 199 203 public function get_field_id( $field_name ) { 200 return 'widget-' . $this->id_base . '-' . $this->number . '-' . $field_name;204 return 'widget-' . $this->id_base . '-' . $this->number . '-' . trim( str_replace( array( '[]', '[', ']' ), array( '', '-', '' ), $field_name ), '-' ); 201 205 } 202 206 203 207 /**