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 -47 4.0.82.2.10 View file →
@@ -1,39 +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 - exit; // Exit if accessed directly.
11 -}
12 -
13 10 if ( ! class_exists( 'SP_PC_Widget' ) ) {
14 - /**
15 - *
16 - * Widgets Class
17 - *
18 - * @since 1.0.0
19 - * @version 1.0.0
20 - */
21 11 class SP_PC_Widget extends WP_Widget {
22 12
23 - /**
24 - * Unique ID/Name
25 - *
26 - * @var string
27 - */
13 + // constants.
28 14 public $unique = '';
29 -
30 - /**
31 - * Arguments.
32 - *
33 - * @var array
34 - */
35 - public $args = array(
15 + public $args = array(
36 16 'title' => '',
37 17 'classname' => '',
38 18 'description' => '',
39 19 'width' => '',
@@ -41,14 +21,8 @@
41 21 'fields' => array(),
42 22 'class' => '',
43 23 );
44 24
45 - /**
46 - * Constructor.
47 - *
48 - * @param string $key the key.
49 - * @param array $params The parameters.
50 - */
51 25 public function __construct( $key, $params ) {
52 26
53 27 $widget_ops = array();
54 28 $control_ops = array();
@@ -55,14 +29,14 @@
55 29
56 30 $this->unique = $key;
57 31 $this->args = apply_filters( "spf_{$this->unique}_args", wp_parse_args( $params, $this->args ), $this );
58 32
59 - // Set control options.
33 + // Set control options
60 34 if ( ! empty( $this->args['width'] ) ) {
61 35 $control_ops['width'] = $this->args['width'];
62 36 }
63 37
64 - // Set widget options.
38 + // Set widget options
65 39 if ( ! empty( $this->args['description'] ) ) {
66 40 $widget_ops['description'] = $this->args['description'];
67 41 }
68 42
@@ -69,9 +43,9 @@
69 43 if ( ! empty( $this->args['classname'] ) ) {
70 44 $widget_ops['classname'] = $this->args['classname'];
71 45 }
72 46
73 - // Set filters.
47 + // Set filters
74 48 $widget_ops = apply_filters( "spf_{$this->unique}_widget_ops", $widget_ops, $this );
75 49 $control_ops = apply_filters( "spf_{$this->unique}_control_ops", $control_ops, $this );
76 50
77 51 parent::__construct( $this->unique, $this->args['title'], $widget_ops, $control_ops );
@@ -77,15 +51,9 @@
77 51 parent::__construct( $this->unique, $this->args['title'], $widget_ops, $control_ops );
78 52
79 53 }
80 54
81 - /**
82 - * Register widget with WordPress.
83 - *
84 - * @param string $key The key.
85 - * @param array $params The parameters.
86 - * @return object
87 - */
55 + // Register widget with WordPress.
88 56 public static function instance( $key, $params = array() ) {
89 57 return new self( $key, $params );
90 58 }
91 59
@@ -126,10 +94,10 @@
126 94 public function form( $instance ) {
127 95
128 96 if ( ! empty( $this->args['fields'] ) ) {
129 97
130 - $class = ( $this->args['class'] ) ? ' ' . $this->args['class'] : '';
131 - 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 .'">';
132 100
133 101 foreach ( $this->args['fields'] as $field ) {
134 102
135 103 $field_value = '';
@@ -139,9 +107,9 @@
139 107
140 108 $field_value = $this->get_default( $field, $instance );
141 109 $field_unique = 'widget-' . $this->unique . '[' . $this->number . ']';
142 110
143 - if ( 'title' === $field['id'] ) {
111 + if ( $field['id'] === 'title' ) {
144 112 $field['attributes']['id'] = 'widget-' . $this->unique . '-' . $this->number . '-title';
145 113 }
146 114 }
147 115