PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 2.2.10
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v2.2.10
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
← All changes | admin/views/sp-framework/classes/widgets.class.php +15 -46 2.4.202.2.10 View file →
@@ -1,38 +1,19 @@
1 -<?php
1 +<?php if ( ! defined( 'ABSPATH' ) ) {
2 + die; } // Cannot access directly.
2 3 /**
3 - * The widget class of the plugin.
4 4 *
5 - * @package Smart_Post_Show
6 - * @subpackage Smart_Post_Show/views/sp-framework/classes
5 + * Widgets Class
6 + *
7 + * @since 1.0.0
8 + * @version 1.0.0
7 9 */
8 -
9 -if ( ! defined( 'ABSPATH' ) ) {
10 - die; } // Cannot access directly.
11 -
12 10 if ( ! class_exists( 'SP_PC_Widget' ) ) {
13 - /**
14 - *
15 - * Widgets Class
16 - *
17 - * @since 1.0.0
18 - * @version 1.0.0
19 - */
20 11 class SP_PC_Widget extends WP_Widget {
21 12
22 - /**
23 - * Unique ID/Name
24 - *
25 - * @var string
26 - */
13 + // constants.
27 14 public $unique = '';
28 -
29 - /**
30 - * Arguments.
31 - *
32 - * @var array
33 - */
34 - public $args = array(
15 + public $args = array(
35 16 'title' => '',
36 17 'classname' => '',
37 18 'description' => '',
38 19 'width' => '',
@@ -40,14 +21,8 @@
40 21 'fields' => array(),
41 22 'class' => '',
42 23 );
43 24
44 - /**
45 - * Constructor.
46 - *
47 - * @param string $key the key.
48 - * @param array $params The parameters.
49 - */
50 25 public function __construct( $key, $params ) {
51 26
52 27 $widget_ops = array();
53 28 $control_ops = array();
@@ -54,14 +29,14 @@
54 29
55 30 $this->unique = $key;
56 31 $this->args = apply_filters( "spf_{$this->unique}_args", wp_parse_args( $params, $this->args ), $this );
57 32
58 - // Set control options.
33 + // Set control options
59 34 if ( ! empty( $this->args['width'] ) ) {
60 35 $control_ops['width'] = $this->args['width'];
61 36 }
62 37
63 - // Set widget options.
38 + // Set widget options
64 39 if ( ! empty( $this->args['description'] ) ) {
65 40 $widget_ops['description'] = $this->args['description'];
66 41 }
67 42
@@ -68,9 +43,9 @@
68 43 if ( ! empty( $this->args['classname'] ) ) {
69 44 $widget_ops['classname'] = $this->args['classname'];
70 45 }
71 46
72 - // Set filters.
47 + // Set filters
73 48 $widget_ops = apply_filters( "spf_{$this->unique}_widget_ops", $widget_ops, $this );
74 49 $control_ops = apply_filters( "spf_{$this->unique}_control_ops", $control_ops, $this );
75 50
76 51 parent::__construct( $this->unique, $this->args['title'], $widget_ops, $control_ops );
@@ -76,15 +51,9 @@
76 51 parent::__construct( $this->unique, $this->args['title'], $widget_ops, $control_ops );
77 52
78 53 }
79 54
80 - /**
81 - * Register widget with WordPress.
82 - *
83 - * @param string $key The key.
84 - * @param array $params The parameters.
85 - * @return object
86 - */
55 + // Register widget with WordPress.
87 56 public static function instance( $key, $params = array() ) {
88 57 return new self( $key, $params );
89 58 }
90 59
@@ -125,10 +94,10 @@
125 94 public function form( $instance ) {
126 95
127 96 if ( ! empty( $this->args['fields'] ) ) {
128 97
129 - $class = ( $this->args['class'] ) ? ' ' . $this->args['class'] : '';
130 - 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 .'">';
131 100
132 101 foreach ( $this->args['fields'] as $field ) {
133 102
134 103 $field_value = '';
@@ -138,9 +107,9 @@
138 107
139 108 $field_value = $this->get_default( $field, $instance );
140 109 $field_unique = 'widget-' . $this->unique . '[' . $this->number . ']';
141 110
142 - if ( 'title' === $field['id'] ) {
111 + if ( $field['id'] === 'title' ) {
143 112 $field['attributes']['id'] = 'widget-' . $this->unique . '-' . $this->number . '-title';
144 113 }
145 114 }
146 115