← All changes
|
admin/views/sp-framework/classes/widgets.class.php
+7
-19
2.3.6
→
2.2.10
View file →
| @@ -21,14 +21,8 @@ | ||
| 21 | 21 | 'fields' => array(), |
| 22 | 22 | 'class' => '', |
| 23 | 23 | ); |
| 24 | 24 | |
| 25 | - /** | |
| 26 | - * Constructor. | |
| 27 | - * | |
| 28 | - * @param string $key the key. | |
| 29 | - * @param array $params The parameters. | |
| 30 | - */ | |
| 31 | 25 | public function __construct( $key, $params ) { |
| 32 | 26 | |
| 33 | 27 | $widget_ops = array(); |
| 34 | 28 | $control_ops = array(); |
| @@ -35,14 +29,14 @@ | ||
| 35 | 29 | |
| 36 | 30 | $this->unique = $key; |
| 37 | 31 | $this->args = apply_filters( "spf_{$this->unique}_args", wp_parse_args( $params, $this->args ), $this ); |
| 38 | 32 | |
| 39 | - // Set control options. | |
| 33 | + // Set control options | |
| 40 | 34 | if ( ! empty( $this->args['width'] ) ) { |
| 41 | 35 | $control_ops['width'] = $this->args['width']; |
| 42 | 36 | } |
| 43 | 37 | |
| 44 | - // Set widget options. | |
| 38 | + // Set widget options | |
| 45 | 39 | if ( ! empty( $this->args['description'] ) ) { |
| 46 | 40 | $widget_ops['description'] = $this->args['description']; |
| 47 | 41 | } |
| 48 | 42 | |
| @@ -49,9 +43,9 @@ | ||
| 49 | 43 | if ( ! empty( $this->args['classname'] ) ) { |
| 50 | 44 | $widget_ops['classname'] = $this->args['classname']; |
| 51 | 45 | } |
| 52 | 46 | |
| 53 | - // Set filters. | |
| 47 | + // Set filters | |
| 54 | 48 | $widget_ops = apply_filters( "spf_{$this->unique}_widget_ops", $widget_ops, $this ); |
| 55 | 49 | $control_ops = apply_filters( "spf_{$this->unique}_control_ops", $control_ops, $this ); |
| 56 | 50 | |
| 57 | 51 | parent::__construct( $this->unique, $this->args['title'], $widget_ops, $control_ops ); |
| @@ -57,15 +51,9 @@ | ||
| 57 | 51 | parent::__construct( $this->unique, $this->args['title'], $widget_ops, $control_ops ); |
| 58 | 52 | |
| 59 | 53 | } |
| 60 | 54 | |
| 61 | - /** | |
| 62 | - * Register widget with WordPress. | |
| 63 | - * | |
| 64 | - * @param string $key The key. | |
| 65 | - * @param array $params The parameters. | |
| 66 | - * @return object | |
| 67 | - */ | |
| 55 | + // Register widget with WordPress. | |
| 68 | 56 | public static function instance( $key, $params = array() ) { |
| 69 | 57 | return new self( $key, $params ); |
| 70 | 58 | } |
| 71 | 59 | |
| @@ -106,10 +94,10 @@ | ||
| 106 | 94 | public function form( $instance ) { |
| 107 | 95 | |
| 108 | 96 | if ( ! empty( $this->args['fields'] ) ) { |
| 109 | 97 | |
| 110 | - $class = ( $this->args['class'] ) ? ' ' . $this->args['class'] : ''; | |
| 111 | - echo '<div class="spf spf-widgets spf-fields' . esc_attr( $class ) . '">'; | |
| 98 | + $class = ( $this->args['class'] ) ? ' '. $this->args['class'] : ''; | |
| 99 | + echo '<div class="spf spf-widgets spf-fields'. $class .'">'; | |
| 112 | 100 | |
| 113 | 101 | foreach ( $this->args['fields'] as $field ) { |
| 114 | 102 | |
| 115 | 103 | $field_value = ''; |
| @@ -119,9 +107,9 @@ | ||
| 119 | 107 | |
| 120 | 108 | $field_value = $this->get_default( $field, $instance ); |
| 121 | 109 | $field_unique = 'widget-' . $this->unique . '[' . $this->number . ']'; |
| 122 | 110 | |
| 123 | - if ( 'title' === $field['id'] ) { | |
| 111 | + if ( $field['id'] === 'title' ) { | |
| 124 | 112 | $field['attributes']['id'] = 'widget-' . $this->unique . '-' . $this->number . '-title'; |
| 125 | 113 | } |
| 126 | 114 | } |
| 127 | 115 | |