Passed
Push — master ( 877d43...e9e8ae )
by Brian
06:03
created
vendor/ayecode/wp-super-duper/map.php 2 patches
Indentation   +226 added lines, -226 removed lines patch added patch discarded remove patch
@@ -3,238 +3,238 @@
 block discarded – undo
3 3
 class SD_Map extends WP_Super_Duper {
4 4
 
5 5
 
6
-	public $arguments;
7
-
8
-	/**
9
-	 * Sets up the widgets name etc
10
-	 */
11
-	public function __construct() {
12
-
13
-		$options = array(
14
-			'textdomain'     => 'super-duper',
15
-			// textdomain of the plugin/theme (used to prefix the Gutenberg block)
16
-			'block-icon'     => 'admin-site',
17
-			// Dash icon name for the block: https://developer.wordpress.org/resource/dashicons/#arrow-right
18
-			'block-category' => 'widgets',
19
-			// the category for the block, 'common', 'formatting', 'layout', 'widgets', 'embed'.
20
-			'block-keywords' => "['map','super','google']",
21
-			// used in the block search, MAX 3
22
-			'block-output'   => array( // the block visual output elements as an array
23
-				array(
24
-					'element'         => 'p',
25
-					'content'         => __( 'A Google API key is required to use this block, we recommend installing our plugin which makes it easy and sets it globally, or you can set a key in the block settings sidebar: ', 'super-duper' ),
26
-					//'element_require' => '"1"=='.get_option( 'rgmk_google_map_api_key', '"0"') ? '"0"' : '"1"',
27
-					'element_require' => get_option( 'rgmk_google_map_api_key', false ) ? '1==0' : '1==1 && [%api_key%]==""',
28
-				),
29
-				array(
30
-					'element'         => 'a',
31
-					'content'         => __( 'API KEY for Google Maps', 'super-duper' ),
32
-					'element_require' => get_option( 'rgmk_google_map_api_key', false ) ? '1==0' : '1==1 && [%api_key%]==""',
33
-					'href'            => 'https://wordpress.org/plugins/api-key-for-google-maps/',
34
-				),
35
-				array(
36
-					'element'         => 'img',
37
-					'class'           => '[%className%]',
38
-					//'content' => 'Hello: [%after_text%]' // block properties can be added by wrapping them in [%name%]
39
-					'element_require' => '[%type%]=="image"',
40
-					'src'             => get_option( 'rgmk_google_map_api_key', false ) ? "https://maps.googleapis.com/maps/api/staticmap?center=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&size=[%static_width%]x[%static_height%]&key=" . get_option( 'rgmk_google_map_api_key' ) : "https://maps.googleapis.com/maps/api/staticmap?center=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&size=[%static_width%]x[%static_height%]&key=[%api_key%]"
41
-				),
42
-				array(
43
-					'element' => 'div',
44
-					'class'   => 'sd-map-iframe-cover',
45
-					'style'   => '{overflow:"hidden", position:"relative"}',
46
-					array(
47
-						'element'         => 'iframe',
48
-						'title'           => __( 'Placeholderx', 'super-duper' ),
49
-						'class'           => '[%className%]',
50
-						'width'           => '[%width%]',
51
-						'height'          => '[%height%]',
52
-						'frameborder'     => '0',
53
-						'allowfullscreen' => 'true',
54
-						'style'           => '{border:0}',
55
-						'element_require' => '[%type%]!="image"',
56
-						'src'             => get_option( 'rgmk_google_map_api_key', false ) ? "https://www.google.com/maps/embed/v1/[%type%]?q=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&key=" . get_option( 'rgmk_google_map_api_key' ) : "https://www.google.com/maps/embed/v1/[%type%]?q=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&key=[%api_key%]"
57
-					),
58
-				),
59
-				array(
60
-					'element'         => 'style',
61
-					'content'         => '.sd-map-iframe-cover:hover:before {background: #4a4a4a88; content: "' . __( "Click here, Settings are in the block settings sidebar", "super-duper" ) . '";} .sd-map-iframe-cover:before{cursor: pointer; content: ""; width: 100%; height: 100%; position: absolute; top: 0; bottom: 0;padding-top: 33%; text-align: center;  color: #fff; font-size: 20px; font-weight: bold;}',
62
-					'element_require' => '[%type%]!="image"',
63
-				),
64
-			),
65
-			'class_name'     => __CLASS__,
66
-			// The calling class name
67
-			'base_id'        => 'sd_map',
68
-			// this is used as the widget id and the shortcode id.
69
-			'name'           => __( 'Map', 'super-duper' ),
70
-			// the name of the widget/block
71
-			'widget_ops'     => array(
72
-				'classname'   => 'sd-map-class',
73
-				// widget class
74
-				'description' => esc_html__( 'This is an example that will take a text parameter and output it after `Hello:`.', 'hello-world' ),
75
-				// widget description
76
-				'output'      => array( $this, 'output' )
77
-			),
78
-			'arguments'      => array( // these are the arguments that will be used in the widget, shortcode and block settings.
79
-				'type'          => array(
80
-					'title'    => __( 'Map Type:', 'geodirectory' ),
81
-					'desc'     => __( 'Select the map type to use.', 'geodirectory' ),
82
-					'type'     => 'select',
83
-					'options'  => array(
84
-						"image" => __( 'Static Image', 'geodirectory' ),
85
-						"place" => __( 'Place', 'geodirectory' ),
6
+    public $arguments;
7
+
8
+    /**
9
+     * Sets up the widgets name etc
10
+     */
11
+    public function __construct() {
12
+
13
+        $options = array(
14
+            'textdomain'     => 'super-duper',
15
+            // textdomain of the plugin/theme (used to prefix the Gutenberg block)
16
+            'block-icon'     => 'admin-site',
17
+            // Dash icon name for the block: https://developer.wordpress.org/resource/dashicons/#arrow-right
18
+            'block-category' => 'widgets',
19
+            // the category for the block, 'common', 'formatting', 'layout', 'widgets', 'embed'.
20
+            'block-keywords' => "['map','super','google']",
21
+            // used in the block search, MAX 3
22
+            'block-output'   => array( // the block visual output elements as an array
23
+                array(
24
+                    'element'         => 'p',
25
+                    'content'         => __( 'A Google API key is required to use this block, we recommend installing our plugin which makes it easy and sets it globally, or you can set a key in the block settings sidebar: ', 'super-duper' ),
26
+                    //'element_require' => '"1"=='.get_option( 'rgmk_google_map_api_key', '"0"') ? '"0"' : '"1"',
27
+                    'element_require' => get_option( 'rgmk_google_map_api_key', false ) ? '1==0' : '1==1 && [%api_key%]==""',
28
+                ),
29
+                array(
30
+                    'element'         => 'a',
31
+                    'content'         => __( 'API KEY for Google Maps', 'super-duper' ),
32
+                    'element_require' => get_option( 'rgmk_google_map_api_key', false ) ? '1==0' : '1==1 && [%api_key%]==""',
33
+                    'href'            => 'https://wordpress.org/plugins/api-key-for-google-maps/',
34
+                ),
35
+                array(
36
+                    'element'         => 'img',
37
+                    'class'           => '[%className%]',
38
+                    //'content' => 'Hello: [%after_text%]' // block properties can be added by wrapping them in [%name%]
39
+                    'element_require' => '[%type%]=="image"',
40
+                    'src'             => get_option( 'rgmk_google_map_api_key', false ) ? "https://maps.googleapis.com/maps/api/staticmap?center=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&size=[%static_width%]x[%static_height%]&key=" . get_option( 'rgmk_google_map_api_key' ) : "https://maps.googleapis.com/maps/api/staticmap?center=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&size=[%static_width%]x[%static_height%]&key=[%api_key%]"
41
+                ),
42
+                array(
43
+                    'element' => 'div',
44
+                    'class'   => 'sd-map-iframe-cover',
45
+                    'style'   => '{overflow:"hidden", position:"relative"}',
46
+                    array(
47
+                        'element'         => 'iframe',
48
+                        'title'           => __( 'Placeholderx', 'super-duper' ),
49
+                        'class'           => '[%className%]',
50
+                        'width'           => '[%width%]',
51
+                        'height'          => '[%height%]',
52
+                        'frameborder'     => '0',
53
+                        'allowfullscreen' => 'true',
54
+                        'style'           => '{border:0}',
55
+                        'element_require' => '[%type%]!="image"',
56
+                        'src'             => get_option( 'rgmk_google_map_api_key', false ) ? "https://www.google.com/maps/embed/v1/[%type%]?q=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&key=" . get_option( 'rgmk_google_map_api_key' ) : "https://www.google.com/maps/embed/v1/[%type%]?q=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&key=[%api_key%]"
57
+                    ),
58
+                ),
59
+                array(
60
+                    'element'         => 'style',
61
+                    'content'         => '.sd-map-iframe-cover:hover:before {background: #4a4a4a88; content: "' . __( "Click here, Settings are in the block settings sidebar", "super-duper" ) . '";} .sd-map-iframe-cover:before{cursor: pointer; content: ""; width: 100%; height: 100%; position: absolute; top: 0; bottom: 0;padding-top: 33%; text-align: center;  color: #fff; font-size: 20px; font-weight: bold;}',
62
+                    'element_require' => '[%type%]!="image"',
63
+                ),
64
+            ),
65
+            'class_name'     => __CLASS__,
66
+            // The calling class name
67
+            'base_id'        => 'sd_map',
68
+            // this is used as the widget id and the shortcode id.
69
+            'name'           => __( 'Map', 'super-duper' ),
70
+            // the name of the widget/block
71
+            'widget_ops'     => array(
72
+                'classname'   => 'sd-map-class',
73
+                // widget class
74
+                'description' => esc_html__( 'This is an example that will take a text parameter and output it after `Hello:`.', 'hello-world' ),
75
+                // widget description
76
+                'output'      => array( $this, 'output' )
77
+            ),
78
+            'arguments'      => array( // these are the arguments that will be used in the widget, shortcode and block settings.
79
+                'type'          => array(
80
+                    'title'    => __( 'Map Type:', 'geodirectory' ),
81
+                    'desc'     => __( 'Select the map type to use.', 'geodirectory' ),
82
+                    'type'     => 'select',
83
+                    'options'  => array(
84
+                        "image" => __( 'Static Image', 'geodirectory' ),
85
+                        "place" => __( 'Place', 'geodirectory' ),
86 86
 //						"directions" => __('Directions', 'geodirectory'),
87 87
 //						"search" => __('Search', 'geodirectory'),
88 88
 //						"view" => __('View', 'geodirectory'),
89 89
 //						"streetview" => __('Streetview', 'geodirectory'),
90
-					),
91
-					'default'  => 'image',
92
-					'desc_tip' => true,
93
-					'advanced' => false
94
-				),
95
-				'location'      => array(
96
-					'type'        => 'text',
97
-					'title'       => __( 'Location:', 'geodirectory' ),
98
-					'desc'        => __( 'Enter the location to show on the map, place, city, zip code or GPS.', 'geodirectory' ),
99
-					'placeholder' => 'Place, city, zip code or GPS',
100
-					'desc_tip'    => true,
101
-					'default'     => 'Ireland',
102
-					'advanced'    => false
103
-				),
104
-				'static_width'  => array(
105
-					'type'              => 'number',
106
-					'title'             => __( 'Width:', 'geodirectory' ),
107
-					'desc'              => __( 'This is the width of the map, for static maps you can only use px values.', 'geodirectory' ),
108
-					'placeholder'       => '600',
109
-					'desc_tip'          => true,
110
-					'default'           => '600',
111
-					'custom_attributes' => array(
112
-						'max' => '2000',
113
-						'min' => '100',
114
-					),
115
-					'element_require'   => '[%type%]=="image"',
116
-					'advanced'          => false
117
-				),
118
-				'static_height' => array(
119
-					'type'              => 'number',
120
-					'title'             => __( 'Height:', 'geodirectory' ),
121
-					'desc'              => __( 'This is the height of the map, for static maps you can only use px values.', 'geodirectory' ),
122
-					'placeholder'       => '400',
123
-					'desc_tip'          => true,
124
-					'default'           => '400',
125
-					'custom_attributes' => array(
126
-						'max'      => '2000',
127
-						'min'      => '100',
128
-						'required' => 'required',
129
-					),
130
-					'element_require'   => '[%type%]=="image"',
131
-					'advanced'          => false
132
-				),
133
-				'width'         => array(
134
-					'type'            => 'text',
135
-					'title'           => __( 'Width:', 'geodirectory' ),
136
-					'desc'            => __( 'This is the width of the map, you can use % or px here.', 'geodirectory' ),
137
-					'placeholder'     => '100%',
138
-					'desc_tip'        => true,
139
-					'default'         => '100%',
140
-					'element_require' => '[%type%]!="image"',
141
-					'advanced'        => false
142
-				),
143
-				'height'        => array(
144
-					'type'            => 'text',
145
-					'title'           => __( 'Height:', 'geodirectory' ),
146
-					'desc'            => __( 'This is the height of the map, you can use %, px or vh here.', 'geodirectory' ),
147
-					'placeholder'     => '425px',
148
-					'desc_tip'        => true,
149
-					'default'         => '425px',
150
-					'element_require' => '[%type%]!="image"',
151
-					'advanced'        => false
152
-				),
153
-				'maptype'       => array(
154
-					'type'     => 'select',
155
-					'title'    => __( 'Mapview:', 'geodirectory' ),
156
-					'desc'     => __( 'This is the type of map view that will be used by default.', 'geodirectory' ),
157
-					'options'  => array(
158
-						"roadmap"   => __( 'Road Map', 'geodirectory' ),
159
-						"satellite" => __( 'Satellite Map', 'geodirectory' ),
90
+                    ),
91
+                    'default'  => 'image',
92
+                    'desc_tip' => true,
93
+                    'advanced' => false
94
+                ),
95
+                'location'      => array(
96
+                    'type'        => 'text',
97
+                    'title'       => __( 'Location:', 'geodirectory' ),
98
+                    'desc'        => __( 'Enter the location to show on the map, place, city, zip code or GPS.', 'geodirectory' ),
99
+                    'placeholder' => 'Place, city, zip code or GPS',
100
+                    'desc_tip'    => true,
101
+                    'default'     => 'Ireland',
102
+                    'advanced'    => false
103
+                ),
104
+                'static_width'  => array(
105
+                    'type'              => 'number',
106
+                    'title'             => __( 'Width:', 'geodirectory' ),
107
+                    'desc'              => __( 'This is the width of the map, for static maps you can only use px values.', 'geodirectory' ),
108
+                    'placeholder'       => '600',
109
+                    'desc_tip'          => true,
110
+                    'default'           => '600',
111
+                    'custom_attributes' => array(
112
+                        'max' => '2000',
113
+                        'min' => '100',
114
+                    ),
115
+                    'element_require'   => '[%type%]=="image"',
116
+                    'advanced'          => false
117
+                ),
118
+                'static_height' => array(
119
+                    'type'              => 'number',
120
+                    'title'             => __( 'Height:', 'geodirectory' ),
121
+                    'desc'              => __( 'This is the height of the map, for static maps you can only use px values.', 'geodirectory' ),
122
+                    'placeholder'       => '400',
123
+                    'desc_tip'          => true,
124
+                    'default'           => '400',
125
+                    'custom_attributes' => array(
126
+                        'max'      => '2000',
127
+                        'min'      => '100',
128
+                        'required' => 'required',
129
+                    ),
130
+                    'element_require'   => '[%type%]=="image"',
131
+                    'advanced'          => false
132
+                ),
133
+                'width'         => array(
134
+                    'type'            => 'text',
135
+                    'title'           => __( 'Width:', 'geodirectory' ),
136
+                    'desc'            => __( 'This is the width of the map, you can use % or px here.', 'geodirectory' ),
137
+                    'placeholder'     => '100%',
138
+                    'desc_tip'        => true,
139
+                    'default'         => '100%',
140
+                    'element_require' => '[%type%]!="image"',
141
+                    'advanced'        => false
142
+                ),
143
+                'height'        => array(
144
+                    'type'            => 'text',
145
+                    'title'           => __( 'Height:', 'geodirectory' ),
146
+                    'desc'            => __( 'This is the height of the map, you can use %, px or vh here.', 'geodirectory' ),
147
+                    'placeholder'     => '425px',
148
+                    'desc_tip'        => true,
149
+                    'default'         => '425px',
150
+                    'element_require' => '[%type%]!="image"',
151
+                    'advanced'        => false
152
+                ),
153
+                'maptype'       => array(
154
+                    'type'     => 'select',
155
+                    'title'    => __( 'Mapview:', 'geodirectory' ),
156
+                    'desc'     => __( 'This is the type of map view that will be used by default.', 'geodirectory' ),
157
+                    'options'  => array(
158
+                        "roadmap"   => __( 'Road Map', 'geodirectory' ),
159
+                        "satellite" => __( 'Satellite Map', 'geodirectory' ),
160 160
 //						"hybrid"    => __( 'Hybrid Map', 'geodirectory' ),
161 161
 //						"terrain"   => __( 'Terrain Map', 'geodirectory' ),
162
-					),
163
-					'desc_tip' => true,
164
-					'default'  => 'roadmap',
165
-					'advanced' => true
166
-				),
167
-				'zoom'          => array(
168
-					'type'        => 'select',
169
-					'title'       => __( 'Zoom level:', 'geodirectory' ),
170
-					'desc'        => __( 'This is the zoom level of the map, `auto` is recommended.', 'geodirectory' ),
171
-					'options'     => range( 1, 19 ),
172
-					'placeholder' => '',
173
-					'desc_tip'    => true,
174
-					'default'     => '7',
175
-					'advanced'    => true
176
-				),
177
-				'api_key'       => array(
178
-					'type'            => 'text',
179
-					'title'           => __( 'Api Key:', 'geodirectory' ),
180
-					'desc'            => __( 'Enter your Google maps API key here.', 'geodirectory' ),
181
-					'placeholder'     => '',
182
-					'desc_tip'        => true,
183
-					'default'         => '',
184
-					'element_require' => get_option( 'rgmk_google_map_api_key', false ) ? '1==0' : '1==1',
185
-					'advanced'        => false
186
-				),
187
-			)
188
-		);
189
-
190
-		parent::__construct( $options );
191
-	}
192
-
193
-
194
-	/**
195
-	 * This is the output function for the widget, shortcode and block (front end).
196
-	 *
197
-	 * @param array $args The arguments values.
198
-	 * @param array $widget_args The widget arguments when used.
199
-	 * @param string $content The shortcode content argument
200
-	 *
201
-	 * @return string
202
-	 */
203
-	public function output( $args = array(), $widget_args = array(), $content = '' ) {
204
-
205
-		// options
206
-		$defaults = array(
207
-			'type'          => 'image', // image, place
208
-			'location'      => 'Ireland',
209
-			'static_width'  => '600',
210
-			'static_height' => '400',
211
-			'width'         => '100%',
212
-			'height'        => '425px',
213
-			'maptype'       => 'roadmap',
214
-			'zoom'          => '7',
215
-			'api_key'       => 'AIzaSyBK3ZcmK0ljxl5agNyJNQh_G24Thq1btuE',
216
-		);
217
-
218
-		/**
219
-		 * Parse incoming $args into an array and merge it with $defaults
220
-		 */
221
-		$args = wp_parse_args( $args, $defaults );
222
-
223
-		$output = '';
224
-
225
-
226
-		// check if we have a global API key
227
-		$args['api_key'] = get_option( 'rgmk_google_map_api_key', false ) ? get_option( 'rgmk_google_map_api_key' ) : $args['api_key'];
228
-
229
-		if ( $args['type'] == 'image' ) {
230
-			$output .= "<img src='https://maps.googleapis.com/maps/api/staticmap?center=" . esc_attr( $args['location'] ) . "&maptype=" . esc_attr( $args['maptype'] ) . "&zoom=" . esc_attr( $args['zoom'] ) . "&size=" . esc_attr( $args['static_width'] ) . "x" . esc_attr( $args['static_height'] ) . "&key=" . esc_attr( $args['api_key'] ) . "' />";
231
-		} else {
232
-			$output .= "<iframe width='" . esc_attr( $args['width'] ) . "' height='" . esc_attr( $args['height'] ) . "' frameborder='0' allowfullscreen style='border:0;' src='https://www.google.com/maps/embed/v1/" . esc_attr( $args['type'] ) . "?q=" . esc_attr( $args['location'] ) . "&maptype=" . esc_attr( $args['maptype'] ) . "&zoom=" . esc_attr( $args['zoom'] ) . "&key=" . esc_attr( $args['api_key'] ) . "' ></iframe> ";
233
-		}
234
-
235
-		return $output;
236
-
237
-	}
162
+                    ),
163
+                    'desc_tip' => true,
164
+                    'default'  => 'roadmap',
165
+                    'advanced' => true
166
+                ),
167
+                'zoom'          => array(
168
+                    'type'        => 'select',
169
+                    'title'       => __( 'Zoom level:', 'geodirectory' ),
170
+                    'desc'        => __( 'This is the zoom level of the map, `auto` is recommended.', 'geodirectory' ),
171
+                    'options'     => range( 1, 19 ),
172
+                    'placeholder' => '',
173
+                    'desc_tip'    => true,
174
+                    'default'     => '7',
175
+                    'advanced'    => true
176
+                ),
177
+                'api_key'       => array(
178
+                    'type'            => 'text',
179
+                    'title'           => __( 'Api Key:', 'geodirectory' ),
180
+                    'desc'            => __( 'Enter your Google maps API key here.', 'geodirectory' ),
181
+                    'placeholder'     => '',
182
+                    'desc_tip'        => true,
183
+                    'default'         => '',
184
+                    'element_require' => get_option( 'rgmk_google_map_api_key', false ) ? '1==0' : '1==1',
185
+                    'advanced'        => false
186
+                ),
187
+            )
188
+        );
189
+
190
+        parent::__construct( $options );
191
+    }
192
+
193
+
194
+    /**
195
+     * This is the output function for the widget, shortcode and block (front end).
196
+     *
197
+     * @param array $args The arguments values.
198
+     * @param array $widget_args The widget arguments when used.
199
+     * @param string $content The shortcode content argument
200
+     *
201
+     * @return string
202
+     */
203
+    public function output( $args = array(), $widget_args = array(), $content = '' ) {
204
+
205
+        // options
206
+        $defaults = array(
207
+            'type'          => 'image', // image, place
208
+            'location'      => 'Ireland',
209
+            'static_width'  => '600',
210
+            'static_height' => '400',
211
+            'width'         => '100%',
212
+            'height'        => '425px',
213
+            'maptype'       => 'roadmap',
214
+            'zoom'          => '7',
215
+            'api_key'       => 'AIzaSyBK3ZcmK0ljxl5agNyJNQh_G24Thq1btuE',
216
+        );
217
+
218
+        /**
219
+         * Parse incoming $args into an array and merge it with $defaults
220
+         */
221
+        $args = wp_parse_args( $args, $defaults );
222
+
223
+        $output = '';
224
+
225
+
226
+        // check if we have a global API key
227
+        $args['api_key'] = get_option( 'rgmk_google_map_api_key', false ) ? get_option( 'rgmk_google_map_api_key' ) : $args['api_key'];
228
+
229
+        if ( $args['type'] == 'image' ) {
230
+            $output .= "<img src='https://maps.googleapis.com/maps/api/staticmap?center=" . esc_attr( $args['location'] ) . "&maptype=" . esc_attr( $args['maptype'] ) . "&zoom=" . esc_attr( $args['zoom'] ) . "&size=" . esc_attr( $args['static_width'] ) . "x" . esc_attr( $args['static_height'] ) . "&key=" . esc_attr( $args['api_key'] ) . "' />";
231
+        } else {
232
+            $output .= "<iframe width='" . esc_attr( $args['width'] ) . "' height='" . esc_attr( $args['height'] ) . "' frameborder='0' allowfullscreen style='border:0;' src='https://www.google.com/maps/embed/v1/" . esc_attr( $args['type'] ) . "?q=" . esc_attr( $args['location'] ) . "&maptype=" . esc_attr( $args['maptype'] ) . "&zoom=" . esc_attr( $args['zoom'] ) . "&key=" . esc_attr( $args['api_key'] ) . "' ></iframe> ";
233
+        }
234
+
235
+        return $output;
236
+
237
+    }
238 238
 
239 239
 }
240 240
 
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
 			'block-output'   => array( // the block visual output elements as an array
23 23
 				array(
24 24
 					'element'         => 'p',
25
-					'content'         => __( 'A Google API key is required to use this block, we recommend installing our plugin which makes it easy and sets it globally, or you can set a key in the block settings sidebar: ', 'super-duper' ),
25
+					'content'         => __('A Google API key is required to use this block, we recommend installing our plugin which makes it easy and sets it globally, or you can set a key in the block settings sidebar: ', 'super-duper'),
26 26
 					//'element_require' => '"1"=='.get_option( 'rgmk_google_map_api_key', '"0"') ? '"0"' : '"1"',
27
-					'element_require' => get_option( 'rgmk_google_map_api_key', false ) ? '1==0' : '1==1 && [%api_key%]==""',
27
+					'element_require' => get_option('rgmk_google_map_api_key', false) ? '1==0' : '1==1 && [%api_key%]==""',
28 28
 				),
29 29
 				array(
30 30
 					'element'         => 'a',
31
-					'content'         => __( 'API KEY for Google Maps', 'super-duper' ),
32
-					'element_require' => get_option( 'rgmk_google_map_api_key', false ) ? '1==0' : '1==1 && [%api_key%]==""',
31
+					'content'         => __('API KEY for Google Maps', 'super-duper'),
32
+					'element_require' => get_option('rgmk_google_map_api_key', false) ? '1==0' : '1==1 && [%api_key%]==""',
33 33
 					'href'            => 'https://wordpress.org/plugins/api-key-for-google-maps/',
34 34
 				),
35 35
 				array(
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 					'class'           => '[%className%]',
38 38
 					//'content' => 'Hello: [%after_text%]' // block properties can be added by wrapping them in [%name%]
39 39
 					'element_require' => '[%type%]=="image"',
40
-					'src'             => get_option( 'rgmk_google_map_api_key', false ) ? "https://maps.googleapis.com/maps/api/staticmap?center=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&size=[%static_width%]x[%static_height%]&key=" . get_option( 'rgmk_google_map_api_key' ) : "https://maps.googleapis.com/maps/api/staticmap?center=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&size=[%static_width%]x[%static_height%]&key=[%api_key%]"
40
+					'src'             => get_option('rgmk_google_map_api_key', false) ? "https://maps.googleapis.com/maps/api/staticmap?center=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&size=[%static_width%]x[%static_height%]&key=" . get_option('rgmk_google_map_api_key') : "https://maps.googleapis.com/maps/api/staticmap?center=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&size=[%static_width%]x[%static_height%]&key=[%api_key%]"
41 41
 				),
42 42
 				array(
43 43
 					'element' => 'div',
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 					'style'   => '{overflow:"hidden", position:"relative"}',
46 46
 					array(
47 47
 						'element'         => 'iframe',
48
-						'title'           => __( 'Placeholderx', 'super-duper' ),
48
+						'title'           => __('Placeholderx', 'super-duper'),
49 49
 						'class'           => '[%className%]',
50 50
 						'width'           => '[%width%]',
51 51
 						'height'          => '[%height%]',
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 						'allowfullscreen' => 'true',
54 54
 						'style'           => '{border:0}',
55 55
 						'element_require' => '[%type%]!="image"',
56
-						'src'             => get_option( 'rgmk_google_map_api_key', false ) ? "https://www.google.com/maps/embed/v1/[%type%]?q=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&key=" . get_option( 'rgmk_google_map_api_key' ) : "https://www.google.com/maps/embed/v1/[%type%]?q=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&key=[%api_key%]"
56
+						'src'             => get_option('rgmk_google_map_api_key', false) ? "https://www.google.com/maps/embed/v1/[%type%]?q=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&key=" . get_option('rgmk_google_map_api_key') : "https://www.google.com/maps/embed/v1/[%type%]?q=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&key=[%api_key%]"
57 57
 					),
58 58
 				),
59 59
 				array(
60 60
 					'element'         => 'style',
61
-					'content'         => '.sd-map-iframe-cover:hover:before {background: #4a4a4a88; content: "' . __( "Click here, Settings are in the block settings sidebar", "super-duper" ) . '";} .sd-map-iframe-cover:before{cursor: pointer; content: ""; width: 100%; height: 100%; position: absolute; top: 0; bottom: 0;padding-top: 33%; text-align: center;  color: #fff; font-size: 20px; font-weight: bold;}',
61
+					'content'         => '.sd-map-iframe-cover:hover:before {background: #4a4a4a88; content: "' . __("Click here, Settings are in the block settings sidebar", "super-duper") . '";} .sd-map-iframe-cover:before{cursor: pointer; content: ""; width: 100%; height: 100%; position: absolute; top: 0; bottom: 0;padding-top: 33%; text-align: center;  color: #fff; font-size: 20px; font-weight: bold;}',
62 62
 					'element_require' => '[%type%]!="image"',
63 63
 				),
64 64
 			),
@@ -66,23 +66,23 @@  discard block
 block discarded – undo
66 66
 			// The calling class name
67 67
 			'base_id'        => 'sd_map',
68 68
 			// this is used as the widget id and the shortcode id.
69
-			'name'           => __( 'Map', 'super-duper' ),
69
+			'name'           => __('Map', 'super-duper'),
70 70
 			// the name of the widget/block
71 71
 			'widget_ops'     => array(
72 72
 				'classname'   => 'sd-map-class',
73 73
 				// widget class
74
-				'description' => esc_html__( 'This is an example that will take a text parameter and output it after `Hello:`.', 'hello-world' ),
74
+				'description' => esc_html__('This is an example that will take a text parameter and output it after `Hello:`.', 'hello-world'),
75 75
 				// widget description
76
-				'output'      => array( $this, 'output' )
76
+				'output'      => array($this, 'output')
77 77
 			),
78 78
 			'arguments'      => array( // these are the arguments that will be used in the widget, shortcode and block settings.
79 79
 				'type'          => array(
80
-					'title'    => __( 'Map Type:', 'geodirectory' ),
81
-					'desc'     => __( 'Select the map type to use.', 'geodirectory' ),
80
+					'title'    => __('Map Type:', 'geodirectory'),
81
+					'desc'     => __('Select the map type to use.', 'geodirectory'),
82 82
 					'type'     => 'select',
83 83
 					'options'  => array(
84
-						"image" => __( 'Static Image', 'geodirectory' ),
85
-						"place" => __( 'Place', 'geodirectory' ),
84
+						"image" => __('Static Image', 'geodirectory'),
85
+						"place" => __('Place', 'geodirectory'),
86 86
 //						"directions" => __('Directions', 'geodirectory'),
87 87
 //						"search" => __('Search', 'geodirectory'),
88 88
 //						"view" => __('View', 'geodirectory'),
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 				),
95 95
 				'location'      => array(
96 96
 					'type'        => 'text',
97
-					'title'       => __( 'Location:', 'geodirectory' ),
98
-					'desc'        => __( 'Enter the location to show on the map, place, city, zip code or GPS.', 'geodirectory' ),
97
+					'title'       => __('Location:', 'geodirectory'),
98
+					'desc'        => __('Enter the location to show on the map, place, city, zip code or GPS.', 'geodirectory'),
99 99
 					'placeholder' => 'Place, city, zip code or GPS',
100 100
 					'desc_tip'    => true,
101 101
 					'default'     => 'Ireland',
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 				),
104 104
 				'static_width'  => array(
105 105
 					'type'              => 'number',
106
-					'title'             => __( 'Width:', 'geodirectory' ),
107
-					'desc'              => __( 'This is the width of the map, for static maps you can only use px values.', 'geodirectory' ),
106
+					'title'             => __('Width:', 'geodirectory'),
107
+					'desc'              => __('This is the width of the map, for static maps you can only use px values.', 'geodirectory'),
108 108
 					'placeholder'       => '600',
109 109
 					'desc_tip'          => true,
110 110
 					'default'           => '600',
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 				),
118 118
 				'static_height' => array(
119 119
 					'type'              => 'number',
120
-					'title'             => __( 'Height:', 'geodirectory' ),
121
-					'desc'              => __( 'This is the height of the map, for static maps you can only use px values.', 'geodirectory' ),
120
+					'title'             => __('Height:', 'geodirectory'),
121
+					'desc'              => __('This is the height of the map, for static maps you can only use px values.', 'geodirectory'),
122 122
 					'placeholder'       => '400',
123 123
 					'desc_tip'          => true,
124 124
 					'default'           => '400',
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 				),
133 133
 				'width'         => array(
134 134
 					'type'            => 'text',
135
-					'title'           => __( 'Width:', 'geodirectory' ),
136
-					'desc'            => __( 'This is the width of the map, you can use % or px here.', 'geodirectory' ),
135
+					'title'           => __('Width:', 'geodirectory'),
136
+					'desc'            => __('This is the width of the map, you can use % or px here.', 'geodirectory'),
137 137
 					'placeholder'     => '100%',
138 138
 					'desc_tip'        => true,
139 139
 					'default'         => '100%',
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 				),
143 143
 				'height'        => array(
144 144
 					'type'            => 'text',
145
-					'title'           => __( 'Height:', 'geodirectory' ),
146
-					'desc'            => __( 'This is the height of the map, you can use %, px or vh here.', 'geodirectory' ),
145
+					'title'           => __('Height:', 'geodirectory'),
146
+					'desc'            => __('This is the height of the map, you can use %, px or vh here.', 'geodirectory'),
147 147
 					'placeholder'     => '425px',
148 148
 					'desc_tip'        => true,
149 149
 					'default'         => '425px',
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
 				),
153 153
 				'maptype'       => array(
154 154
 					'type'     => 'select',
155
-					'title'    => __( 'Mapview:', 'geodirectory' ),
156
-					'desc'     => __( 'This is the type of map view that will be used by default.', 'geodirectory' ),
155
+					'title'    => __('Mapview:', 'geodirectory'),
156
+					'desc'     => __('This is the type of map view that will be used by default.', 'geodirectory'),
157 157
 					'options'  => array(
158
-						"roadmap"   => __( 'Road Map', 'geodirectory' ),
159
-						"satellite" => __( 'Satellite Map', 'geodirectory' ),
158
+						"roadmap"   => __('Road Map', 'geodirectory'),
159
+						"satellite" => __('Satellite Map', 'geodirectory'),
160 160
 //						"hybrid"    => __( 'Hybrid Map', 'geodirectory' ),
161 161
 //						"terrain"   => __( 'Terrain Map', 'geodirectory' ),
162 162
 					),
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 				),
167 167
 				'zoom'          => array(
168 168
 					'type'        => 'select',
169
-					'title'       => __( 'Zoom level:', 'geodirectory' ),
170
-					'desc'        => __( 'This is the zoom level of the map, `auto` is recommended.', 'geodirectory' ),
171
-					'options'     => range( 1, 19 ),
169
+					'title'       => __('Zoom level:', 'geodirectory'),
170
+					'desc'        => __('This is the zoom level of the map, `auto` is recommended.', 'geodirectory'),
171
+					'options'     => range(1, 19),
172 172
 					'placeholder' => '',
173 173
 					'desc_tip'    => true,
174 174
 					'default'     => '7',
@@ -176,18 +176,18 @@  discard block
 block discarded – undo
176 176
 				),
177 177
 				'api_key'       => array(
178 178
 					'type'            => 'text',
179
-					'title'           => __( 'Api Key:', 'geodirectory' ),
180
-					'desc'            => __( 'Enter your Google maps API key here.', 'geodirectory' ),
179
+					'title'           => __('Api Key:', 'geodirectory'),
180
+					'desc'            => __('Enter your Google maps API key here.', 'geodirectory'),
181 181
 					'placeholder'     => '',
182 182
 					'desc_tip'        => true,
183 183
 					'default'         => '',
184
-					'element_require' => get_option( 'rgmk_google_map_api_key', false ) ? '1==0' : '1==1',
184
+					'element_require' => get_option('rgmk_google_map_api_key', false) ? '1==0' : '1==1',
185 185
 					'advanced'        => false
186 186
 				),
187 187
 			)
188 188
 		);
189 189
 
190
-		parent::__construct( $options );
190
+		parent::__construct($options);
191 191
 	}
192 192
 
193 193
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @return string
202 202
 	 */
203
-	public function output( $args = array(), $widget_args = array(), $content = '' ) {
203
+	public function output($args = array(), $widget_args = array(), $content = '') {
204 204
 
205 205
 		// options
206 206
 		$defaults = array(
@@ -218,18 +218,18 @@  discard block
 block discarded – undo
218 218
 		/**
219 219
 		 * Parse incoming $args into an array and merge it with $defaults
220 220
 		 */
221
-		$args = wp_parse_args( $args, $defaults );
221
+		$args = wp_parse_args($args, $defaults);
222 222
 
223 223
 		$output = '';
224 224
 
225 225
 
226 226
 		// check if we have a global API key
227
-		$args['api_key'] = get_option( 'rgmk_google_map_api_key', false ) ? get_option( 'rgmk_google_map_api_key' ) : $args['api_key'];
227
+		$args['api_key'] = get_option('rgmk_google_map_api_key', false) ? get_option('rgmk_google_map_api_key') : $args['api_key'];
228 228
 
229
-		if ( $args['type'] == 'image' ) {
230
-			$output .= "<img src='https://maps.googleapis.com/maps/api/staticmap?center=" . esc_attr( $args['location'] ) . "&maptype=" . esc_attr( $args['maptype'] ) . "&zoom=" . esc_attr( $args['zoom'] ) . "&size=" . esc_attr( $args['static_width'] ) . "x" . esc_attr( $args['static_height'] ) . "&key=" . esc_attr( $args['api_key'] ) . "' />";
229
+		if ($args['type'] == 'image') {
230
+			$output .= "<img src='https://maps.googleapis.com/maps/api/staticmap?center=" . esc_attr($args['location']) . "&maptype=" . esc_attr($args['maptype']) . "&zoom=" . esc_attr($args['zoom']) . "&size=" . esc_attr($args['static_width']) . "x" . esc_attr($args['static_height']) . "&key=" . esc_attr($args['api_key']) . "' />";
231 231
 		} else {
232
-			$output .= "<iframe width='" . esc_attr( $args['width'] ) . "' height='" . esc_attr( $args['height'] ) . "' frameborder='0' allowfullscreen style='border:0;' src='https://www.google.com/maps/embed/v1/" . esc_attr( $args['type'] ) . "?q=" . esc_attr( $args['location'] ) . "&maptype=" . esc_attr( $args['maptype'] ) . "&zoom=" . esc_attr( $args['zoom'] ) . "&key=" . esc_attr( $args['api_key'] ) . "' ></iframe> ";
232
+			$output .= "<iframe width='" . esc_attr($args['width']) . "' height='" . esc_attr($args['height']) . "' frameborder='0' allowfullscreen style='border:0;' src='https://www.google.com/maps/embed/v1/" . esc_attr($args['type']) . "?q=" . esc_attr($args['location']) . "&maptype=" . esc_attr($args['maptype']) . "&zoom=" . esc_attr($args['zoom']) . "&key=" . esc_attr($args['api_key']) . "' ></iframe> ";
233 233
 		}
234 234
 
235 235
 		return $output;
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/sd-functions.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -11,18 +11,18 @@  discard block
 block discarded – undo
11 11
  * @return mixed|void
12 12
  */
13 13
 function sd_pagenow_exclude() {
14
-	return apply_filters( 'sd_pagenow_exclude', array(
15
-		'upload.php',
16
-		'edit-comments.php',
17
-		'edit-tags.php',
18
-		'index.php',
19
-		'media-new.php',
20
-		'options-discussion.php',
21
-		'options-writing.php',
22
-		'edit.php',
23
-		'themes.php',
24
-		'users.php',
25
-	) );
14
+    return apply_filters( 'sd_pagenow_exclude', array(
15
+        'upload.php',
16
+        'edit-comments.php',
17
+        'edit-tags.php',
18
+        'index.php',
19
+        'media-new.php',
20
+        'options-discussion.php',
21
+        'options-writing.php',
22
+        'edit.php',
23
+        'themes.php',
24
+        'users.php',
25
+    ) );
26 26
 }
27 27
 
28 28
 
@@ -34,5 +34,5 @@  discard block
 block discarded – undo
34 34
  * @return mixed|void
35 35
  */
36 36
 function sd_widget_exclude() {
37
-	return apply_filters( 'sd_widget_exclude', array() );
37
+    return apply_filters( 'sd_widget_exclude', array() );
38 38
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @return mixed|void
12 12
  */
13 13
 function sd_pagenow_exclude() {
14
-	return apply_filters( 'sd_pagenow_exclude', array(
14
+	return apply_filters('sd_pagenow_exclude', array(
15 15
 		'upload.php',
16 16
 		'edit-comments.php',
17 17
 		'edit-tags.php',
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		'edit.php',
23 23
 		'themes.php',
24 24
 		'users.php',
25
-	) );
25
+	));
26 26
 }
27 27
 
28 28
 
@@ -34,5 +34,5 @@  discard block
 block discarded – undo
34 34
  * @return mixed|void
35 35
  */
36 36
 function sd_widget_exclude() {
37
-	return apply_filters( 'sd_widget_exclude', array() );
37
+	return apply_filters('sd_widget_exclude', array());
38 38
 }
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/sd-plugin.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,21 +14,21 @@
 block discarded – undo
14 14
  * Tested up to: 5.8
15 15
  */
16 16
 
17
-if ( ! defined( 'ABSPATH' ) ) {
17
+if (!defined('ABSPATH')) {
18 18
 	exit;
19 19
 }
20 20
 
21
-if ( ! class_exists( 'WP_Super_Duper' ) ) {
21
+if (!class_exists('WP_Super_Duper')) {
22 22
 	// include the class if needed
23
-	include_once( dirname( __FILE__ ) . "/wp-super-duper.php" );
23
+	include_once(dirname(__FILE__) . "/wp-super-duper.php");
24 24
 }
25 25
 
26 26
 /*
27 27
  * Hello world example.
28 28
  */
29
-include_once( dirname( __FILE__ ) . "/hello-world.php" );
29
+include_once(dirname(__FILE__) . "/hello-world.php");
30 30
 
31 31
 /*
32 32
  * Map example.
33 33
  */
34
-include_once( dirname( __FILE__ ) . "/map.php" );
35 34
\ No newline at end of file
35
+include_once(dirname(__FILE__) . "/map.php");
36 36
\ No newline at end of file
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/wp-super-duper.php 3 patches
Indentation   +1238 added lines, -1238 removed lines patch added patch discarded remove patch
@@ -10,294 +10,294 @@  discard block
 block discarded – undo
10 10
 // Ensure the class is only loaded once.
11 11
 if ( ! class_exists( 'WP_Super_Duper' ) ) {
12 12
 
13
-	/**
14
-	 *
15
-	 * A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress.
16
-	 *
17
-	 * View hello-world.php for example usage
18
-	 *
19
-	 * @since 1.0.0
20
-	 * @since 1.0.16 change log moved to file change-log.txt - CHANGED
21
-	 * @since 2.0.0 shortcode, widget and blocks moved into separate files - CHANGED
22
-	 * @version 2.0.0
23
-	 */
24
-	abstract class WP_Super_Duper {
25
-	
26
-		public $version = "2.0.0";
27
-		public $font_awesome_icon_version = "5.11.2";
28
-		public $block_code;
29
-		public $options;
30
-		public $base_id;
31
-		public $number;
32
-		public $settings_hash;
33
-		public $arguments = array();
34
-		public $instance = array();
35
-	
36
-		// prevent SDv1 errors if register_widget() function used
37
-		public $id_base;
38
-	
39
-		/**
40
-		 * @var array Contains an array of output types instances.
41
-		 */
42
-		public $output_types = array();
43
-	
44
-		/**
45
-		 * The relative url to the current folder.
46
-		 *
47
-		 * @var string
48
-		 */
49
-		public $url = '';
50
-	
51
-		/**
52
-		 * Take the array options and use them to build.
53
-		 */
54
-		public function __construct( $options ) {
55
-			global $sd_widgets;
56
-	
57
-			$sd_widgets[ $options['base_id'] ] = array(
58
-				'name'       => $options['name'],
59
-				'class_name' => $options['class_name']
60
-			);
61
-			$this->base_id   = $options['base_id'];
62
-	
63
-			// Lets filter the options before we do anything.
64
-			$options = apply_filters( 'wp_super_duper_options', $options, $this );
65
-			$options = apply_filters( "wp_super_duper_options_{$this->base_id}", $options, $this );
66
-			$options = $this->add_name_from_key( $options );
67
-	
68
-			// Set args.
69
-			$this->options   = $options;
70
-			$this->base_id   = $options['base_id'];
71
-			$this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array();
72
-	
73
-			// Load output types.
74
-			$this->load_output_types();
75
-	
76
-			// add generator text to admin head
77
-			add_action( 'admin_head', array( $this, 'generator' ) );
78
-	
79
-			add_action( 'admin_init', array( __CLASS__, 'load_widgets_setting' ) );
80
-	
81
-			add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
82
-	
83
-			do_action( 'wp_super_duper_widget_init', $options, $this );
84
-	
85
-		}
86
-	
87
-		/**
88
-		 * Set the name from the argument key.
89
-		 *
90
-		 * @param array $options
91
-		 * @param bool $arguments
92
-		 *
93
-		 * @return mixed
94
-		 */
95
-		protected function add_name_from_key( $options, $arguments = false ) {
96
-			if ( ! empty( $options['arguments'] ) ) {
97
-				foreach ( $options['arguments'] as $key => $val ) {
98
-					$options['arguments'][ $key ]['name'] = $key;
99
-				}
100
-			} elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
101
-				foreach ( $options as $key => $val ) {
102
-					$options[ $key ]['name'] = $key;
103
-				}
104
-			}
105
-	
106
-			return $options;
107
-		}
108
-	
109
-		/**
110
-		 * Output the version in the admin header.
111
-		 */
112
-		public function load_output_types() {
113
-	
114
-			$allowed_types = $this->get_output_types();
115
-			$output_types  = array( 'block', 'shortcode', 'widget' );
116
-	
117
-			// Check if this is being overidden by the widget.
118
-			$args = $this->get_arguments();
119
-			if ( isset( $args['output_types'] ) && is_array( $args['output_types'] ) ) {
120
-				$output_types  = $args['output_types'] ;
121
-			}
122
-	
123
-			if ( isset( $this->options['output_types'] ) && is_array( $this->options['output_types'] ) ) {
124
-				$output_types  = $this->options['output_types'] ;
125
-			}
126
-	
127
-			// Load each output type.
128
-			foreach ( $output_types as $output_type ) {
129
-	
130
-				// Ensure this is an allowed type.
131
-				if ( ! isset( $allowed_types[ $output_type ] ) ) {
132
-					continue;
133
-				}
134
-	
135
-				// If the class does not exist, try loading it.
136
-				if ( ! class_exists( $allowed_types[ $output_type ] ) ) {
137
-	
138
-					if ( file_exists( plugin_dir_path( __FILE__ ) . "type/$output_type.php" ) ) {
139
-						require_once( plugin_dir_path( __FILE__ ) . "type/$output_type.php" );
140
-					} else {
141
-						continue;
142
-					}
143
-	
144
-				}
145
-	
146
-				$output_class                       = $allowed_types[ $output_type ];
147
-				$this->output_types[ $output_type ] = new $output_class( $this );
148
-			}
149
-	
150
-		}
151
-	
152
-		/**
153
-		 * Retrieves an array of available SD types.
154
-		 *
155
-		 * @return array
156
-		 */
157
-		protected function get_output_types() {
158
-	
159
-			// Output type id and class.
160
-			$types = array(
161
-				'block'     => 'WP_Super_Duper_Block',
162
-				'shortcode' => 'WP_Super_Duper_Shortcode',
163
-				'widget'    => 'WP_Super_Duper_Widget',
164
-			);
165
-	
166
-			// Maybe disable widgets.
167
-			$disable_widget   = get_option( 'sd_load_widgets', 'auto' );
168
-	
169
-			if ( 'auto' === $disable_widget ) {
170
-				if ( !$this->widgets_required() ) {
171
-					unset( $types['widget'] );
172
-				}
173
-			}
174
-	
175
-			if ( 'no' === $disable_widget ) {
176
-				unset( $types['widget'] );
177
-			}
178
-	
179
-			return apply_filters( 'super_duper_types', $types, $this );
180
-		}
181
-	
182
-		/**
183
-		 * Check if we are required to load widgets.
184
-		 *
185
-		 * @return mixed|void
186
-		 */
187
-		protected function widgets_required(){
188
-			global $wp_version;
189
-	
190
-			$required = false;
191
-	
192
-	
193
-			// check wp version
194
-			if( version_compare( $wp_version, '5.8', '<' ) ){
195
-				$required = true;
196
-			}
197
-	
198
-			// Page builders that require widgets
199
-			if(
200
-			!$required && (
201
-			defined( 'ELEMENTOR_VERSION' ) // elementor
202
-			|| class_exists( 'Fusion_Element' ) // Fusion Builder (avada)
203
-			|| class_exists( 'SiteOrigin_Panels' ) // SiteOrigin Page builder
204
-			|| defined( 'WPB_VC_VERSION' ) // WPBakery page builder
205
-			|| defined( 'CT_VERSION' ) // Oxygen Builder
206
-			|| defined( 'FL_BUILDER_VERSION' ) // Beaver Builder
207
-			|| defined( 'FL_THEME_BUILDER_VERSION' ) // Beaver Themer
208
-			)
209
-			){
210
-				$required = true;
211
-			}
212
-	
213
-			// Theme has active widgets
214
-			if( !$required && !empty( $this->has_active_widgets() )  ){
215
-				$required = true;
216
-			}
217
-	
218
-	
219
-			return apply_filters( 'sd_widgets_required' , $required );
220
-		}
221
-	
222
-		/**
223
-		 * Check if the current site has any active old style widgets.
224
-		 *
225
-		 * @return bool
226
-		 */
227
-		protected function has_active_widgets(){
228
-			global $sd_has_active_widgets;
229
-	
230
-			// have we already done this?
231
-			if(!is_null($sd_has_active_widgets)){
232
-				return $sd_has_active_widgets;
233
-			}
234
-	
235
-			$result = false;
236
-			$sidebars_widgets = get_option('sidebars_widgets');
237
-	
238
-			if(is_array($sidebars_widgets)){
239
-	
240
-				foreach ($sidebars_widgets as $key => $value) {
241
-	
242
-	
243
-	
244
-					if( $key != 'wp_inactive_widgets' ) {
245
-	
246
-						if(!empty($value) && is_array($value)){
247
-							foreach($value as $widget){
248
-								if($widget && substr( $widget, 0, 6 ) !== "block-"){
249
-									$result = true;
250
-								}
251
-							}
252
-						}
253
-	
254
-					}
255
-				}
256
-			}
257
-	
258
-			$sd_has_active_widgets = $result;
259
-	
260
-			return $result;
261
-		}
262
-	
263
-		/**
264
-		 * Get arguments in super duper.
265
-		 *
266
-		 * @since 1.0.0
267
-		 *
268
-		 * @return array Get arguments.
269
-		 */
270
-		public function get_arguments() {
271
-			if ( empty( $this->arguments ) ) {
272
-				$this->arguments = $this->set_arguments();
273
-			}
274
-	
275
-			$this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
276
-			$this->arguments = $this->add_name_from_key( $this->arguments, true );
277
-	
278
-			return $this->arguments;
279
-		}
280
-	
281
-		/**
282
-		 * Set arguments in super duper.
283
-		 *
284
-		 * @since 1.0.0
285
-		 *
286
-		 * @return array Set arguments.
287
-		 */
288
-		public function set_arguments() {
289
-			return $this->arguments;
290
-		}
291
-	
292
-		/**
293
-		 * Makes SD work with the siteOrigin page builder.
294
-		 *
295
-		 * @since 1.0.6
296
-		 * @return mixed
297
-		 */
298
-		public static function siteorigin_js() {
299
-			ob_start();
300
-			?>
13
+    /**
14
+     *
15
+     * A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress.
16
+     *
17
+     * View hello-world.php for example usage
18
+     *
19
+     * @since 1.0.0
20
+     * @since 1.0.16 change log moved to file change-log.txt - CHANGED
21
+     * @since 2.0.0 shortcode, widget and blocks moved into separate files - CHANGED
22
+     * @version 2.0.0
23
+     */
24
+    abstract class WP_Super_Duper {
25
+	
26
+        public $version = "2.0.0";
27
+        public $font_awesome_icon_version = "5.11.2";
28
+        public $block_code;
29
+        public $options;
30
+        public $base_id;
31
+        public $number;
32
+        public $settings_hash;
33
+        public $arguments = array();
34
+        public $instance = array();
35
+	
36
+        // prevent SDv1 errors if register_widget() function used
37
+        public $id_base;
38
+	
39
+        /**
40
+         * @var array Contains an array of output types instances.
41
+         */
42
+        public $output_types = array();
43
+	
44
+        /**
45
+         * The relative url to the current folder.
46
+         *
47
+         * @var string
48
+         */
49
+        public $url = '';
50
+	
51
+        /**
52
+         * Take the array options and use them to build.
53
+         */
54
+        public function __construct( $options ) {
55
+            global $sd_widgets;
56
+	
57
+            $sd_widgets[ $options['base_id'] ] = array(
58
+                'name'       => $options['name'],
59
+                'class_name' => $options['class_name']
60
+            );
61
+            $this->base_id   = $options['base_id'];
62
+	
63
+            // Lets filter the options before we do anything.
64
+            $options = apply_filters( 'wp_super_duper_options', $options, $this );
65
+            $options = apply_filters( "wp_super_duper_options_{$this->base_id}", $options, $this );
66
+            $options = $this->add_name_from_key( $options );
67
+	
68
+            // Set args.
69
+            $this->options   = $options;
70
+            $this->base_id   = $options['base_id'];
71
+            $this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array();
72
+	
73
+            // Load output types.
74
+            $this->load_output_types();
75
+	
76
+            // add generator text to admin head
77
+            add_action( 'admin_head', array( $this, 'generator' ) );
78
+	
79
+            add_action( 'admin_init', array( __CLASS__, 'load_widgets_setting' ) );
80
+	
81
+            add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
82
+	
83
+            do_action( 'wp_super_duper_widget_init', $options, $this );
84
+	
85
+        }
86
+	
87
+        /**
88
+         * Set the name from the argument key.
89
+         *
90
+         * @param array $options
91
+         * @param bool $arguments
92
+         *
93
+         * @return mixed
94
+         */
95
+        protected function add_name_from_key( $options, $arguments = false ) {
96
+            if ( ! empty( $options['arguments'] ) ) {
97
+                foreach ( $options['arguments'] as $key => $val ) {
98
+                    $options['arguments'][ $key ]['name'] = $key;
99
+                }
100
+            } elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
101
+                foreach ( $options as $key => $val ) {
102
+                    $options[ $key ]['name'] = $key;
103
+                }
104
+            }
105
+	
106
+            return $options;
107
+        }
108
+	
109
+        /**
110
+         * Output the version in the admin header.
111
+         */
112
+        public function load_output_types() {
113
+	
114
+            $allowed_types = $this->get_output_types();
115
+            $output_types  = array( 'block', 'shortcode', 'widget' );
116
+	
117
+            // Check if this is being overidden by the widget.
118
+            $args = $this->get_arguments();
119
+            if ( isset( $args['output_types'] ) && is_array( $args['output_types'] ) ) {
120
+                $output_types  = $args['output_types'] ;
121
+            }
122
+	
123
+            if ( isset( $this->options['output_types'] ) && is_array( $this->options['output_types'] ) ) {
124
+                $output_types  = $this->options['output_types'] ;
125
+            }
126
+	
127
+            // Load each output type.
128
+            foreach ( $output_types as $output_type ) {
129
+	
130
+                // Ensure this is an allowed type.
131
+                if ( ! isset( $allowed_types[ $output_type ] ) ) {
132
+                    continue;
133
+                }
134
+	
135
+                // If the class does not exist, try loading it.
136
+                if ( ! class_exists( $allowed_types[ $output_type ] ) ) {
137
+	
138
+                    if ( file_exists( plugin_dir_path( __FILE__ ) . "type/$output_type.php" ) ) {
139
+                        require_once( plugin_dir_path( __FILE__ ) . "type/$output_type.php" );
140
+                    } else {
141
+                        continue;
142
+                    }
143
+	
144
+                }
145
+	
146
+                $output_class                       = $allowed_types[ $output_type ];
147
+                $this->output_types[ $output_type ] = new $output_class( $this );
148
+            }
149
+	
150
+        }
151
+	
152
+        /**
153
+         * Retrieves an array of available SD types.
154
+         *
155
+         * @return array
156
+         */
157
+        protected function get_output_types() {
158
+	
159
+            // Output type id and class.
160
+            $types = array(
161
+                'block'     => 'WP_Super_Duper_Block',
162
+                'shortcode' => 'WP_Super_Duper_Shortcode',
163
+                'widget'    => 'WP_Super_Duper_Widget',
164
+            );
165
+	
166
+            // Maybe disable widgets.
167
+            $disable_widget   = get_option( 'sd_load_widgets', 'auto' );
168
+	
169
+            if ( 'auto' === $disable_widget ) {
170
+                if ( !$this->widgets_required() ) {
171
+                    unset( $types['widget'] );
172
+                }
173
+            }
174
+	
175
+            if ( 'no' === $disable_widget ) {
176
+                unset( $types['widget'] );
177
+            }
178
+	
179
+            return apply_filters( 'super_duper_types', $types, $this );
180
+        }
181
+	
182
+        /**
183
+         * Check if we are required to load widgets.
184
+         *
185
+         * @return mixed|void
186
+         */
187
+        protected function widgets_required(){
188
+            global $wp_version;
189
+	
190
+            $required = false;
191
+	
192
+	
193
+            // check wp version
194
+            if( version_compare( $wp_version, '5.8', '<' ) ){
195
+                $required = true;
196
+            }
197
+	
198
+            // Page builders that require widgets
199
+            if(
200
+            !$required && (
201
+            defined( 'ELEMENTOR_VERSION' ) // elementor
202
+            || class_exists( 'Fusion_Element' ) // Fusion Builder (avada)
203
+            || class_exists( 'SiteOrigin_Panels' ) // SiteOrigin Page builder
204
+            || defined( 'WPB_VC_VERSION' ) // WPBakery page builder
205
+            || defined( 'CT_VERSION' ) // Oxygen Builder
206
+            || defined( 'FL_BUILDER_VERSION' ) // Beaver Builder
207
+            || defined( 'FL_THEME_BUILDER_VERSION' ) // Beaver Themer
208
+            )
209
+            ){
210
+                $required = true;
211
+            }
212
+	
213
+            // Theme has active widgets
214
+            if( !$required && !empty( $this->has_active_widgets() )  ){
215
+                $required = true;
216
+            }
217
+	
218
+	
219
+            return apply_filters( 'sd_widgets_required' , $required );
220
+        }
221
+	
222
+        /**
223
+         * Check if the current site has any active old style widgets.
224
+         *
225
+         * @return bool
226
+         */
227
+        protected function has_active_widgets(){
228
+            global $sd_has_active_widgets;
229
+	
230
+            // have we already done this?
231
+            if(!is_null($sd_has_active_widgets)){
232
+                return $sd_has_active_widgets;
233
+            }
234
+	
235
+            $result = false;
236
+            $sidebars_widgets = get_option('sidebars_widgets');
237
+	
238
+            if(is_array($sidebars_widgets)){
239
+	
240
+                foreach ($sidebars_widgets as $key => $value) {
241
+	
242
+	
243
+	
244
+                    if( $key != 'wp_inactive_widgets' ) {
245
+	
246
+                        if(!empty($value) && is_array($value)){
247
+                            foreach($value as $widget){
248
+                                if($widget && substr( $widget, 0, 6 ) !== "block-"){
249
+                                    $result = true;
250
+                                }
251
+                            }
252
+                        }
253
+	
254
+                    }
255
+                }
256
+            }
257
+	
258
+            $sd_has_active_widgets = $result;
259
+	
260
+            return $result;
261
+        }
262
+	
263
+        /**
264
+         * Get arguments in super duper.
265
+         *
266
+         * @since 1.0.0
267
+         *
268
+         * @return array Get arguments.
269
+         */
270
+        public function get_arguments() {
271
+            if ( empty( $this->arguments ) ) {
272
+                $this->arguments = $this->set_arguments();
273
+            }
274
+	
275
+            $this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
276
+            $this->arguments = $this->add_name_from_key( $this->arguments, true );
277
+	
278
+            return $this->arguments;
279
+        }
280
+	
281
+        /**
282
+         * Set arguments in super duper.
283
+         *
284
+         * @since 1.0.0
285
+         *
286
+         * @return array Set arguments.
287
+         */
288
+        public function set_arguments() {
289
+            return $this->arguments;
290
+        }
291
+	
292
+        /**
293
+         * Makes SD work with the siteOrigin page builder.
294
+         *
295
+         * @since 1.0.6
296
+         * @return mixed
297
+         */
298
+        public static function siteorigin_js() {
299
+            ob_start();
300
+            ?>
301 301
 			<script>
302 302
 				/**
303 303
 				 * Check a form to see what items should be shown or hidden.
@@ -375,50 +375,50 @@  discard block
 block discarded – undo
375 375
 				});
376 376
 			</script>
377 377
 			<?php
378
-			$output = ob_get_clean();
378
+            $output = ob_get_clean();
379 379
 	
380
-			/*
380
+            /*
381 381
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
382 382
 			 */
383
-			return str_replace( array(
384
-				'<script>',
385
-				'</script>'
386
-			), '', $output );
387
-		}
388
-	
389
-		/**
390
-		 * A function to ge the shortcode builder picker html.
391
-		 *
392
-		 * @param string $editor_id
393
-		 *
394
-		 * @return string
395
-		 */
396
-		public static function get_picker( $editor_id = '' ) {
397
-	
398
-			ob_start();
399
-			if ( isset( $_POST['editor_id'] ) ) {
400
-				$editor_id = esc_attr( $_POST['editor_id'] );
401
-			} elseif ( isset( $_REQUEST['et_fb'] ) ) {
402
-				$editor_id = 'main_content_content_vb_tiny_mce';
403
-			}
404
-	
405
-			global $sd_widgets;
406
-			?>
383
+            return str_replace( array(
384
+                '<script>',
385
+                '</script>'
386
+            ), '', $output );
387
+        }
388
+	
389
+        /**
390
+         * A function to ge the shortcode builder picker html.
391
+         *
392
+         * @param string $editor_id
393
+         *
394
+         * @return string
395
+         */
396
+        public static function get_picker( $editor_id = '' ) {
397
+	
398
+            ob_start();
399
+            if ( isset( $_POST['editor_id'] ) ) {
400
+                $editor_id = esc_attr( $_POST['editor_id'] );
401
+            } elseif ( isset( $_REQUEST['et_fb'] ) ) {
402
+                $editor_id = 'main_content_content_vb_tiny_mce';
403
+            }
404
+	
405
+            global $sd_widgets;
406
+            ?>
407 407
 	
408 408
 			<div class="sd-shortcode-left-wrap">
409 409
 				<?php
410
-				ksort( $sd_widgets );
411
-				//				print_r($sd_widgets);exit;
412
-				if ( ! empty( $sd_widgets ) ) {
413
-					echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
414
-					echo "<option>" . __( 'Select shortcode' ) . "</option>";
415
-					foreach ( $sd_widgets as $shortcode => $class ) {
416
-						echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
417
-					}
418
-					echo "</select>";
419
-	
420
-				}
421
-				?>
410
+                ksort( $sd_widgets );
411
+                //				print_r($sd_widgets);exit;
412
+                if ( ! empty( $sd_widgets ) ) {
413
+                    echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
414
+                    echo "<option>" . __( 'Select shortcode' ) . "</option>";
415
+                    foreach ( $sd_widgets as $shortcode => $class ) {
416
+                        echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
417
+                    }
418
+                    echo "</select>";
419
+	
420
+                }
421
+                ?>
422 422
 				<div class="sd-shortcode-settings"></div>
423 423
 	
424 424
 			</div>
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
 					<?php if ( $editor_id != '' ) { ?>
430 430
 						<button class="button sd-insert-shortcode-button"
431 431
 								onclick="sd_insert_shortcode(<?php if ( ! empty( $editor_id ) ) {
432
-									echo "'" . $editor_id . "'";
433
-								} ?>)"><?php _e( 'Insert shortcode' ); ?></button>
432
+                                    echo "'" . $editor_id . "'";
433
+                                } ?>)"><?php _e( 'Insert shortcode' ); ?></button>
434 434
 					<?php } ?>
435 435
 					<button class="button"
436 436
 							onclick="sd_copy_to_clipboard()"><?php _e( 'Copy shortcode' ); ?></button>
@@ -438,44 +438,44 @@  discard block
 block discarded – undo
438 438
 			</div>
439 439
 			<?php
440 440
 	
441
-			$html = ob_get_clean();
441
+            $html = ob_get_clean();
442 442
 	
443
-			if ( wp_doing_ajax() ) {
444
-				echo $html;
445
-				$should_die = true;
443
+            if ( wp_doing_ajax() ) {
444
+                echo $html;
445
+                $should_die = true;
446 446
 	
447
-				// some builder get the editor via ajax so we should not die on those occasions
448
-				$dont_die = array(
449
-					'parent_tag',// WP Bakery
450
-					'avia_request' // enfold
451
-				);
447
+                // some builder get the editor via ajax so we should not die on those occasions
448
+                $dont_die = array(
449
+                    'parent_tag',// WP Bakery
450
+                    'avia_request' // enfold
451
+                );
452 452
 	
453
-				foreach ( $dont_die as $request ) {
454
-					if ( isset( $_REQUEST[ $request ] ) ) {
455
-						$should_die = false;
456
-					}
457
-				}
453
+                foreach ( $dont_die as $request ) {
454
+                    if ( isset( $_REQUEST[ $request ] ) ) {
455
+                        $should_die = false;
456
+                    }
457
+                }
458 458
 	
459
-				if ( $should_die ) {
460
-					wp_die();
461
-				}
459
+                if ( $should_die ) {
460
+                    wp_die();
461
+                }
462 462
 	
463
-			} else {
464
-				return $html;
465
-			}
463
+            } else {
464
+                return $html;
465
+            }
466 466
 	
467
-			return '';
467
+            return '';
468 468
 	
469
-		}
469
+        }
470 470
 	
471
-		/**
472
-		 * Returns the JS used to render the widget/shortcode settings form.
473
-		 *
474
-		 * @return string
475
-		 */
476
-		public static function widget_js() {
477
-			ob_start();
478
-			?>
471
+        /**
472
+         * Returns the JS used to render the widget/shortcode settings form.
473
+         *
474
+         * @return string
475
+         */
476
+        public static function widget_js() {
477
+            ob_start();
478
+            ?>
479 479
 			<script>
480 480
 	
481 481
 				/**
@@ -633,28 +633,28 @@  discard block
 block discarded – undo
633 633
 			</script>
634 634
 	
635 635
 			<?php
636
-				$output = ob_get_clean();
636
+                $output = ob_get_clean();
637 637
 	
638
-				/*
638
+                /*
639 639
 				* We only add the <script> tags for code highlighting, so we strip them from the output.
640 640
 				*/
641 641
 	
642
-				return str_replace( array(
643
-					'<script>',
644
-					'</script>'
645
-				), '', $output );
646
-		}
647
-	
648
-		/**
649
-		 * Returns the CSS used to render the widget/shortcode settings form.
650
-		 *
651
-		 * @param bool $advanced If we should include advanced CSS.
652
-		 *
653
-		 * @return mixed
654
-		 */
655
-		public static function widget_css( $advanced = true ) {
656
-			ob_start();
657
-			?>
642
+                return str_replace( array(
643
+                    '<script>',
644
+                    '</script>'
645
+                ), '', $output );
646
+        }
647
+	
648
+        /**
649
+         * Returns the CSS used to render the widget/shortcode settings form.
650
+         *
651
+         * @param bool $advanced If we should include advanced CSS.
652
+         *
653
+         * @return mixed
654
+         */
655
+        public static function widget_css( $advanced = true ) {
656
+            ob_start();
657
+            ?>
658 658
 	
659 659
 			<style>
660 660
 				<?php if ( $advanced ) : ?>
@@ -695,45 +695,45 @@  discard block
 block discarded – undo
695 695
 			</style>
696 696
 	
697 697
 			<?php
698
-				$output = ob_get_clean();
698
+                $output = ob_get_clean();
699 699
 	
700
-				/*
700
+                /*
701 701
 				* We only add the <script> tags for code highlighting, so we strip them from the output.
702 702
 				*/
703 703
 	
704
-				return str_replace( array(
705
-					'<style>',
706
-					'</style>'
707
-				), '', $output );
708
-		}
709
-	
710
-		/**
711
-		 * Registers the widgets loading settings.
712
-		 */
713
-		public static function load_widgets_setting() {
714
-			register_setting( 'general', 'sd_load_widgets', 'esc_attr' );
715
-	
716
-			add_settings_field(
717
-				'sd_load_widgets',
718
-				'<label for="sd_load_widgets">' . __( 'Load Super Duper Widgets' ) . '</label>',
719
-				'WP_Super_Duper::load_widgets_setting_html',
720
-				'general'
721
-			);
722
-	
723
-		}
724
-	
725
-		/**
726
-		 * Displays the widgets settings HTML.
727
-		 */
728
-		public static function load_widgets_setting_html() {
729
-			$available_options = array(
730
-				'yes'  => __( 'Yes' ),
731
-				'no'   => __( 'No' ),
732
-				'auto' => __( 'Auto' ),
733
-			);
734
-			$selected_option   = get_option( 'sd_load_widgets', 'auto' );
735
-	
736
-			?>
704
+                return str_replace( array(
705
+                    '<style>',
706
+                    '</style>'
707
+                ), '', $output );
708
+        }
709
+	
710
+        /**
711
+         * Registers the widgets loading settings.
712
+         */
713
+        public static function load_widgets_setting() {
714
+            register_setting( 'general', 'sd_load_widgets', 'esc_attr' );
715
+	
716
+            add_settings_field(
717
+                'sd_load_widgets',
718
+                '<label for="sd_load_widgets">' . __( 'Load Super Duper Widgets' ) . '</label>',
719
+                'WP_Super_Duper::load_widgets_setting_html',
720
+                'general'
721
+            );
722
+	
723
+        }
724
+	
725
+        /**
726
+         * Displays the widgets settings HTML.
727
+         */
728
+        public static function load_widgets_setting_html() {
729
+            $available_options = array(
730
+                'yes'  => __( 'Yes' ),
731
+                'no'   => __( 'No' ),
732
+                'auto' => __( 'Auto' ),
733
+            );
734
+            $selected_option   = get_option( 'sd_load_widgets', 'auto' );
735
+	
736
+            ?>
737 737
 				<select name="sd_load_widgets" id="sd_load_widgets">
738 738
 					<?php foreach ( $available_options as $key => $label ) : ?>
739 739
 						<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $selected_option ); ?>><?php echo esc_html( $label ); ?></option>
@@ -741,558 +741,558 @@  discard block
 block discarded – undo
741 741
 				</select>
742 742
 				<p class="description"><?php _e( 'This option allows you to disable Super Duper widgets and instead only load the blocks and shortcodes.' ); ?></p>
743 743
 			<?php
744
-		}
745
-	
746
-		/**
747
-		 * prevent SDv1 errors if register_widget() function used
748
-		 */
749
-		public function _register(){
750
-			// backwards compatibility
751
-		}
752
-	
753
-		/**
754
-		 * Output the version in the admin header.
755
-		 */
756
-		public function generator() {
757
-	
758
-			// We want to set this once.
759
-			if ( empty( $GLOBALS['SD_SET_GENERATOR'] ) ) {
760
-				echo '<meta name="generator" content="WP Super Duper v' . $this->version . '" />';
761
-				$GLOBALS['SD_SET_GENERATOR'] = 1;
762
-			}
763
-	
764
-		}
765
-	
766
-		/**
767
-		 * This is the main output class for all 3 items, widget, shortcode and block, it is extended in the calling class.
768
-		 *
769
-		 * @param array $args
770
-		 * @param array $widget_args
771
-		 * @param string $content
772
-		 */
773
-		public function output( $args = array(), $widget_args = array(), $content = '' ) {
774
-			echo call_user_func( $this->options['widget_ops']['output'], $args, $widget_args, $content );
775
-		}
776
-	
777
-		/**
778
-		 * Placeholder text to show if output is empty and we are on a preview/builder page.
779
-		 *
780
-		 * @param string $name
781
-		 *
782
-		 * @return string
783
-		 */
784
-		public function preview_placeholder_text( $name = '' ) {
785
-			return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf( __( 'Placeholder for: %s' ), $name ) . "</div>";
786
-		}
787
-	
788
-		/**
789
-		 * Sometimes booleans values can be turned to strings, so we fix that.
790
-		 *
791
-		 * @param $options
792
-		 *
793
-		 * @return mixed
794
-		 */
795
-		public function string_to_bool( $options ) {
796
-			// convert bool strings to booleans
797
-			foreach ( $options as $key => $val ) {
798
-				if ( $val == 'false' ) {
799
-					$options[ $key ] = false;
800
-				} elseif ( $val == 'true' ) {
801
-					$options[ $key ] = true;
802
-				}
803
-			}
804
-	
805
-			return $options;
806
-		}
807
-	
808
-		/**
809
-		 * Get the argument values that are also filterable.
810
-		 *
811
-		 * @param $instance
812
-		 *
813
-		 * @since 1.0.12 Don't set checkbox default value if the value is empty.
814
-		 *
815
-		 * @return array
816
-		 */
817
-		public function argument_values( $instance ) {
818
-			$argument_values = array();
819
-	
820
-			// set widget instance
821
-			$this->instance = $instance;
822
-	
823
-			if ( empty( $this->arguments ) ) {
824
-				$this->arguments = $this->get_arguments();
825
-			}
826
-	
827
-			if ( ! empty( $this->arguments ) ) {
828
-				foreach ( $this->arguments as $key => $args ) {
829
-					// set the input name from the key
830
-					$args['name'] = $key;
831
-					//
832
-					$argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
833
-					if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
834
-						// don't set default for an empty checkbox
835
-					} elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
836
-						$argument_values[ $key ] = $args['default'];
837
-					}
838
-				}
839
-			}
840
-	
841
-			return $argument_values;
842
-		}
843
-	
844
-		/**
845
-		 * Get the url path to the current folder.
846
-		 *
847
-		 * @return string
848
-		 */
849
-		public function get_url() {
850
-			$url = $this->url;
851
-	
852
-			if ( ! $url ) {
853
-				// check if we are inside a plugin
854
-				$file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
855
-	
856
-				$dir_parts = explode( "/wp-content/", $file_dir );
857
-				$url_parts = explode( "/wp-content/", plugins_url() );
858
-	
859
-				if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
860
-					$url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
861
-					$this->url = $url;
862
-				}
863
-			}
864
-	
865
-			return $url;
866
-		}
867
-	
868
-		/**
869
-		 * General function to check if we are in a preview situation.
870
-		 *
871
-		 * @since 1.0.6
872
-		 * @return bool
873
-		 */
874
-		public function is_preview() {
875
-			return $this->is_divi_preview() || $this->is_elementor_preview() || $this->is_beaver_preview() || $this->is_siteorigin_preview() || $this->is_cornerstone_preview() || $this->is_fusion_preview() || $this->is_oxygen_preview() || $this->is_block_content_call();
876
-		}
877
-	
878
-		/**
879
-		 * Tests if the current output is inside a Divi preview.
880
-		 *
881
-		 * @since 1.0.6
882
-		 * @return bool
883
-		 */
884
-		public function is_divi_preview() {
885
-			$result = false;
886
-			if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
887
-				$result = true;
888
-			}
889
-	
890
-			return $result;
891
-		}
892
-	
893
-		/**
894
-		 * Tests if the current output is inside a elementor preview.
895
-		 *
896
-		 * @since 1.0.4
897
-		 * @return bool
898
-		 */
899
-		public function is_elementor_preview() {
900
-			$result = false;
901
-			if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
902
-				$result = true;
903
-			}
904
-	
905
-			return $result;
906
-		}
907
-	
908
-		/**
909
-		 * Tests if the current output is inside a Beaver builder preview.
910
-		 *
911
-		 * @since 1.0.6
912
-		 * @return bool
913
-		 */
914
-		public function is_beaver_preview() {
915
-			$result = false;
916
-			if ( isset( $_REQUEST['fl_builder'] ) ) {
917
-				$result = true;
918
-			}
919
-	
920
-			return $result;
921
-		}
922
-	
923
-		/**
924
-		 * Tests if the current output is inside a siteorigin builder preview.
925
-		 *
926
-		 * @since 1.0.6
927
-		 * @return bool
928
-		 */
929
-		public function is_siteorigin_preview() {
930
-			$result = false;
931
-			if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
932
-				$result = true;
933
-			}
934
-	
935
-			return $result;
936
-		}
937
-	
938
-		/**
939
-		 * Tests if the current output is inside a cornerstone builder preview.
940
-		 *
941
-		 * @since 1.0.8
942
-		 * @return bool
943
-		 */
944
-		public function is_cornerstone_preview() {
945
-			$result = false;
946
-			if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
947
-				$result = true;
948
-			}
949
-	
950
-			return $result;
951
-		}
952
-	
953
-		/**
954
-		 * Tests if the current output is inside a fusion builder preview.
955
-		 *
956
-		 * @since 1.1.0
957
-		 * @return bool
958
-		 */
959
-		public function is_fusion_preview() {
960
-			$result = false;
961
-			if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
962
-				$result = true;
963
-			}
964
-	
965
-			return $result;
966
-		}
967
-	
968
-		/**
969
-		 * Tests if the current output is inside a Oxygen builder preview.
970
-		 *
971
-		 * @since 1.0.18
972
-		 * @return bool
973
-		 */
974
-		public function is_oxygen_preview() {
975
-			$result = false;
976
-			if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
977
-				$result = true;
978
-			}
979
-	
980
-			return $result;
981
-		}
982
-	
983
-		/**
984
-		* Checks if the current call is a ajax call to get the block content.
985
-		*
986
-		* This can be used in your widget to return different content as the block content.
987
-		*
988
-		* @since 1.0.3
989
-		* @return bool
990
-		*/
991
-		public function is_block_content_call() {
992
-			$result = false;
993
-			if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
994
-				$result = true;
995
-			}
996
-	
997
-			return $result;
998
-		}
999
-	
1000
-		/**
1001
-		 * Outputs the options form inputs for the widget/shortcode.
1002
-		 *
1003
-		 * @param array $instance The widget options.
1004
-		 */
1005
-		public function form( $instance ) {
1006
-	
1007
-			// Set widget instance.
1008
-			$this->instance = $instance;
1009
-	
1010
-			// Set it as a SD widget.
1011
-			echo $this->widget_advanced_toggle();
1012
-	
1013
-			// Display description.
1014
-			printf( '<p>%s</p>', esc_html( $this->options['widget_ops']['description'] ) );
1015
-	
1016
-			// Prepare arguments.
1017
-			$arguments_raw = $this->get_arguments();
1018
-	
1019
-		if ( is_array( $arguments_raw ) ) {
1020
-	
1021
-			$arguments = $this->group_arguments( $arguments_raw );
1022
-	
1023
-			// Do we have sections?
1024
-			if ( $arguments != $arguments_raw ) {
1025
-	
1026
-					$panel_count = 0;
1027
-					foreach ( $arguments as $key => $args ) {
1028
-	
1029
-						$hide       = $panel_count ? ' style="display:none;" ' : '';
1030
-						$icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
1031
-						echo "<button onclick='jQuery(this).find(\"i\").toggleClass(\"fas fa-chevron-up fas fa-chevron-down\");jQuery(this).next().slideToggle();' type='button' class='sd-toggle-group-button sd-input-group-toggle" . sanitize_title_with_dashes( $key ) . "'>" . esc_attr( $key ) . " <i style='float:right;' class='" . esc_attr( $icon_class ) . "'></i></button>";
1032
-						echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
1033
-	
1034
-						foreach ( $args as $k => $a ) {
1035
-	
1036
-							$this->widget_inputs_row_start($k, $a);
1037
-							$this->widget_inputs( $a, $instance );
1038
-							$this->widget_inputs_row_end($k, $a);
1039
-	
1040
-						}
1041
-	
1042
-						echo "</div>";
1043
-	
1044
-						$panel_count ++;
1045
-	
1046
-					}
1047
-	
1048
-				} else {
1049
-	
1050
-					foreach ( $arguments as $key => $args ) {
1051
-						$this->widget_inputs_row_start($key, $args);
1052
-						$this->widget_inputs( $args, $instance );
1053
-						$this->widget_inputs_row_end($key, $args);
1054
-					}
1055
-	
1056
-				}
1057
-	
1058
-			}
1059
-		}
1060
-	
1061
-		/**
1062
-		 * Get the hidden input that when added makes the advanced button show on widget settings.
1063
-		 *
1064
-		 * @return string
1065
-		 */
1066
-		public function widget_advanced_toggle() {
1067
-	
1068
-			return sprintf(
1069
-				'<input type="hidden"  class="sd-show-advanced" value="%s" />',
1070
-				(int) $this->block_show_advanced()
1071
-			);
1072
-	
1073
-		}
1074
-	
1075
-		/**
1076
-		 * Check if we need to show advanced options.
1077
-		 *
1078
-		 * @return bool
1079
-		 */
1080
-		public function block_show_advanced() {
1081
-			$show      = false;
1082
-			$arguments = $this->get_arguments();
1083
-	
1084
-			if ( ! empty( $arguments ) ) {
1085
-				foreach ( $arguments as $argument ) {
1086
-					if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1087
-						$show = true;
1088
-						break; // no need to continue if we know we have it
1089
-					}
1090
-				}
1091
-			}
1092
-	
1093
-			return $show;
1094
-		}
1095
-	
1096
-		/**
1097
-		 * Groups widget arguments.
1098
-		 *
1099
-		 * @param array $arguments
1100
-		 *
1101
-		 * @return array
1102
-		 */
1103
-		public function group_arguments( $arguments ) {
1104
-	
1105
-			if ( ! empty( $arguments ) ) {
1106
-				$temp_arguments = array();
1107
-				$general        = __( "General" );
1108
-				$add_sections   = false;
1109
-				foreach ( $arguments as $key => $args ) {
1110
-					if ( isset( $args['group'] ) ) {
1111
-						$temp_arguments[ $args['group'] ][ $key ] = $args;
1112
-						$add_sections                             = true;
1113
-					} else {
1114
-						$temp_arguments[ $general ][ $key ] = $args;
1115
-					}
1116
-				}
1117
-	
1118
-				// only add sections if more than one
1119
-				if ( $add_sections ) {
1120
-					$arguments = $temp_arguments;
1121
-				}
1122
-			}
1123
-	
1124
-			return $arguments;
1125
-		}
1126
-	
1127
-		public function widget_inputs_row_start($key, $args){
1128
-			if(!empty($args['row'])){
1129
-				// maybe open
1130
-				if(!empty($args['row']['open'])){
1131
-					?>
744
+        }
745
+	
746
+        /**
747
+         * prevent SDv1 errors if register_widget() function used
748
+         */
749
+        public function _register(){
750
+            // backwards compatibility
751
+        }
752
+	
753
+        /**
754
+         * Output the version in the admin header.
755
+         */
756
+        public function generator() {
757
+	
758
+            // We want to set this once.
759
+            if ( empty( $GLOBALS['SD_SET_GENERATOR'] ) ) {
760
+                echo '<meta name="generator" content="WP Super Duper v' . $this->version . '" />';
761
+                $GLOBALS['SD_SET_GENERATOR'] = 1;
762
+            }
763
+	
764
+        }
765
+	
766
+        /**
767
+         * This is the main output class for all 3 items, widget, shortcode and block, it is extended in the calling class.
768
+         *
769
+         * @param array $args
770
+         * @param array $widget_args
771
+         * @param string $content
772
+         */
773
+        public function output( $args = array(), $widget_args = array(), $content = '' ) {
774
+            echo call_user_func( $this->options['widget_ops']['output'], $args, $widget_args, $content );
775
+        }
776
+	
777
+        /**
778
+         * Placeholder text to show if output is empty and we are on a preview/builder page.
779
+         *
780
+         * @param string $name
781
+         *
782
+         * @return string
783
+         */
784
+        public function preview_placeholder_text( $name = '' ) {
785
+            return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf( __( 'Placeholder for: %s' ), $name ) . "</div>";
786
+        }
787
+	
788
+        /**
789
+         * Sometimes booleans values can be turned to strings, so we fix that.
790
+         *
791
+         * @param $options
792
+         *
793
+         * @return mixed
794
+         */
795
+        public function string_to_bool( $options ) {
796
+            // convert bool strings to booleans
797
+            foreach ( $options as $key => $val ) {
798
+                if ( $val == 'false' ) {
799
+                    $options[ $key ] = false;
800
+                } elseif ( $val == 'true' ) {
801
+                    $options[ $key ] = true;
802
+                }
803
+            }
804
+	
805
+            return $options;
806
+        }
807
+	
808
+        /**
809
+         * Get the argument values that are also filterable.
810
+         *
811
+         * @param $instance
812
+         *
813
+         * @since 1.0.12 Don't set checkbox default value if the value is empty.
814
+         *
815
+         * @return array
816
+         */
817
+        public function argument_values( $instance ) {
818
+            $argument_values = array();
819
+	
820
+            // set widget instance
821
+            $this->instance = $instance;
822
+	
823
+            if ( empty( $this->arguments ) ) {
824
+                $this->arguments = $this->get_arguments();
825
+            }
826
+	
827
+            if ( ! empty( $this->arguments ) ) {
828
+                foreach ( $this->arguments as $key => $args ) {
829
+                    // set the input name from the key
830
+                    $args['name'] = $key;
831
+                    //
832
+                    $argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
833
+                    if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
834
+                        // don't set default for an empty checkbox
835
+                    } elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
836
+                        $argument_values[ $key ] = $args['default'];
837
+                    }
838
+                }
839
+            }
840
+	
841
+            return $argument_values;
842
+        }
843
+	
844
+        /**
845
+         * Get the url path to the current folder.
846
+         *
847
+         * @return string
848
+         */
849
+        public function get_url() {
850
+            $url = $this->url;
851
+	
852
+            if ( ! $url ) {
853
+                // check if we are inside a plugin
854
+                $file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
855
+	
856
+                $dir_parts = explode( "/wp-content/", $file_dir );
857
+                $url_parts = explode( "/wp-content/", plugins_url() );
858
+	
859
+                if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
860
+                    $url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
861
+                    $this->url = $url;
862
+                }
863
+            }
864
+	
865
+            return $url;
866
+        }
867
+	
868
+        /**
869
+         * General function to check if we are in a preview situation.
870
+         *
871
+         * @since 1.0.6
872
+         * @return bool
873
+         */
874
+        public function is_preview() {
875
+            return $this->is_divi_preview() || $this->is_elementor_preview() || $this->is_beaver_preview() || $this->is_siteorigin_preview() || $this->is_cornerstone_preview() || $this->is_fusion_preview() || $this->is_oxygen_preview() || $this->is_block_content_call();
876
+        }
877
+	
878
+        /**
879
+         * Tests if the current output is inside a Divi preview.
880
+         *
881
+         * @since 1.0.6
882
+         * @return bool
883
+         */
884
+        public function is_divi_preview() {
885
+            $result = false;
886
+            if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
887
+                $result = true;
888
+            }
889
+	
890
+            return $result;
891
+        }
892
+	
893
+        /**
894
+         * Tests if the current output is inside a elementor preview.
895
+         *
896
+         * @since 1.0.4
897
+         * @return bool
898
+         */
899
+        public function is_elementor_preview() {
900
+            $result = false;
901
+            if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
902
+                $result = true;
903
+            }
904
+	
905
+            return $result;
906
+        }
907
+	
908
+        /**
909
+         * Tests if the current output is inside a Beaver builder preview.
910
+         *
911
+         * @since 1.0.6
912
+         * @return bool
913
+         */
914
+        public function is_beaver_preview() {
915
+            $result = false;
916
+            if ( isset( $_REQUEST['fl_builder'] ) ) {
917
+                $result = true;
918
+            }
919
+	
920
+            return $result;
921
+        }
922
+	
923
+        /**
924
+         * Tests if the current output is inside a siteorigin builder preview.
925
+         *
926
+         * @since 1.0.6
927
+         * @return bool
928
+         */
929
+        public function is_siteorigin_preview() {
930
+            $result = false;
931
+            if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
932
+                $result = true;
933
+            }
934
+	
935
+            return $result;
936
+        }
937
+	
938
+        /**
939
+         * Tests if the current output is inside a cornerstone builder preview.
940
+         *
941
+         * @since 1.0.8
942
+         * @return bool
943
+         */
944
+        public function is_cornerstone_preview() {
945
+            $result = false;
946
+            if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
947
+                $result = true;
948
+            }
949
+	
950
+            return $result;
951
+        }
952
+	
953
+        /**
954
+         * Tests if the current output is inside a fusion builder preview.
955
+         *
956
+         * @since 1.1.0
957
+         * @return bool
958
+         */
959
+        public function is_fusion_preview() {
960
+            $result = false;
961
+            if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
962
+                $result = true;
963
+            }
964
+	
965
+            return $result;
966
+        }
967
+	
968
+        /**
969
+         * Tests if the current output is inside a Oxygen builder preview.
970
+         *
971
+         * @since 1.0.18
972
+         * @return bool
973
+         */
974
+        public function is_oxygen_preview() {
975
+            $result = false;
976
+            if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
977
+                $result = true;
978
+            }
979
+	
980
+            return $result;
981
+        }
982
+	
983
+        /**
984
+         * Checks if the current call is a ajax call to get the block content.
985
+         *
986
+         * This can be used in your widget to return different content as the block content.
987
+         *
988
+         * @since 1.0.3
989
+         * @return bool
990
+         */
991
+        public function is_block_content_call() {
992
+            $result = false;
993
+            if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
994
+                $result = true;
995
+            }
996
+	
997
+            return $result;
998
+        }
999
+	
1000
+        /**
1001
+         * Outputs the options form inputs for the widget/shortcode.
1002
+         *
1003
+         * @param array $instance The widget options.
1004
+         */
1005
+        public function form( $instance ) {
1006
+	
1007
+            // Set widget instance.
1008
+            $this->instance = $instance;
1009
+	
1010
+            // Set it as a SD widget.
1011
+            echo $this->widget_advanced_toggle();
1012
+	
1013
+            // Display description.
1014
+            printf( '<p>%s</p>', esc_html( $this->options['widget_ops']['description'] ) );
1015
+	
1016
+            // Prepare arguments.
1017
+            $arguments_raw = $this->get_arguments();
1018
+	
1019
+        if ( is_array( $arguments_raw ) ) {
1020
+	
1021
+            $arguments = $this->group_arguments( $arguments_raw );
1022
+	
1023
+            // Do we have sections?
1024
+            if ( $arguments != $arguments_raw ) {
1025
+	
1026
+                    $panel_count = 0;
1027
+                    foreach ( $arguments as $key => $args ) {
1028
+	
1029
+                        $hide       = $panel_count ? ' style="display:none;" ' : '';
1030
+                        $icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
1031
+                        echo "<button onclick='jQuery(this).find(\"i\").toggleClass(\"fas fa-chevron-up fas fa-chevron-down\");jQuery(this).next().slideToggle();' type='button' class='sd-toggle-group-button sd-input-group-toggle" . sanitize_title_with_dashes( $key ) . "'>" . esc_attr( $key ) . " <i style='float:right;' class='" . esc_attr( $icon_class ) . "'></i></button>";
1032
+                        echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
1033
+	
1034
+                        foreach ( $args as $k => $a ) {
1035
+	
1036
+                            $this->widget_inputs_row_start($k, $a);
1037
+                            $this->widget_inputs( $a, $instance );
1038
+                            $this->widget_inputs_row_end($k, $a);
1039
+	
1040
+                        }
1041
+	
1042
+                        echo "</div>";
1043
+	
1044
+                        $panel_count ++;
1045
+	
1046
+                    }
1047
+	
1048
+                } else {
1049
+	
1050
+                    foreach ( $arguments as $key => $args ) {
1051
+                        $this->widget_inputs_row_start($key, $args);
1052
+                        $this->widget_inputs( $args, $instance );
1053
+                        $this->widget_inputs_row_end($key, $args);
1054
+                    }
1055
+	
1056
+                }
1057
+	
1058
+            }
1059
+        }
1060
+	
1061
+        /**
1062
+         * Get the hidden input that when added makes the advanced button show on widget settings.
1063
+         *
1064
+         * @return string
1065
+         */
1066
+        public function widget_advanced_toggle() {
1067
+	
1068
+            return sprintf(
1069
+                '<input type="hidden"  class="sd-show-advanced" value="%s" />',
1070
+                (int) $this->block_show_advanced()
1071
+            );
1072
+	
1073
+        }
1074
+	
1075
+        /**
1076
+         * Check if we need to show advanced options.
1077
+         *
1078
+         * @return bool
1079
+         */
1080
+        public function block_show_advanced() {
1081
+            $show      = false;
1082
+            $arguments = $this->get_arguments();
1083
+	
1084
+            if ( ! empty( $arguments ) ) {
1085
+                foreach ( $arguments as $argument ) {
1086
+                    if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1087
+                        $show = true;
1088
+                        break; // no need to continue if we know we have it
1089
+                    }
1090
+                }
1091
+            }
1092
+	
1093
+            return $show;
1094
+        }
1095
+	
1096
+        /**
1097
+         * Groups widget arguments.
1098
+         *
1099
+         * @param array $arguments
1100
+         *
1101
+         * @return array
1102
+         */
1103
+        public function group_arguments( $arguments ) {
1104
+	
1105
+            if ( ! empty( $arguments ) ) {
1106
+                $temp_arguments = array();
1107
+                $general        = __( "General" );
1108
+                $add_sections   = false;
1109
+                foreach ( $arguments as $key => $args ) {
1110
+                    if ( isset( $args['group'] ) ) {
1111
+                        $temp_arguments[ $args['group'] ][ $key ] = $args;
1112
+                        $add_sections                             = true;
1113
+                    } else {
1114
+                        $temp_arguments[ $general ][ $key ] = $args;
1115
+                    }
1116
+                }
1117
+	
1118
+                // only add sections if more than one
1119
+                if ( $add_sections ) {
1120
+                    $arguments = $temp_arguments;
1121
+                }
1122
+            }
1123
+	
1124
+            return $arguments;
1125
+        }
1126
+	
1127
+        public function widget_inputs_row_start($key, $args){
1128
+            if(!empty($args['row'])){
1129
+                // maybe open
1130
+                if(!empty($args['row']['open'])){
1131
+                    ?>
1132 1132
 					<div class='bsui sd-argument ' data-argument='<?php echo esc_attr( $args['row']['key'] ); ?>' data-element_require='<?php if ( !empty($args['row']['element_require'])) {
1133
-						echo $this->convert_element_require( $args['row']['element_require'] );
1134
-					} ?>'>
1133
+                        echo $this->convert_element_require( $args['row']['element_require'] );
1134
+                    } ?>'>
1135 1135
 					<?php if(!empty($args['row']['title'])){ ?>
1136 1136
 					<label class="mb-0 "><?php echo esc_attr( $args['row']['title'] ); ?><?php echo $this->widget_field_desc( $args['row'] ); ?></label>
1137 1137
 					<?php }?>
1138 1138
 					<div class='row <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>'>
1139 1139
 					<div class='col pr-2'>
1140 1140
 					<?php
1141
-				}elseif(!empty($args['row']['close'])){
1142
-					echo "<div class='col pl-0'>";
1143
-				}else{
1144
-					echo "<div class='col pl-0 pr-2'>";
1145
-				}
1146
-			}
1147
-		}
1148
-	
1149
-		/**
1150
-		 * Convert require element.
1151
-		 *
1152
-		 * @since 1.0.0
1153
-		 *
1154
-		 * @param string $input Input element.
1155
-		 *
1156
-		 * @return string $output
1157
-		 */
1158
-		public function convert_element_require( $input ) {
1159
-	
1160
-			$input = str_replace( "'", '"', $input );// we only want double quotes
1161
-	
1162
-			$output = esc_attr( str_replace( array( "[%", "%]" ), array(
1163
-				"jQuery(form).find('[data-argument=\"",
1164
-				"\"]').find('input,select,textarea').val()"
1165
-			), $input ) );
1166
-	
1167
-			return $output;
1168
-		}
1169
-	
1170
-		/**
1171
-		 * Get the widget input description html.
1172
-		 *
1173
-		 * @param $args
1174
-		 *
1175
-		 * @return string
1176
-		 * @todo, need to make its own tooltip script
1177
-		 */
1178
-		public function widget_field_desc( $args ) {
1179
-	
1180
-			$description = '';
1181
-			if ( isset( $args['desc'] ) && $args['desc'] ) {
1182
-				if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
1183
-					$description = $this->desc_tip( $args['desc'] );
1184
-				} else {
1185
-					$description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
1186
-				}
1187
-			}
1188
-	
1189
-			return $description;
1190
-		}
1191
-	
1192
-		/**
1193
-		 * Get the tool tip html.
1194
-		 *
1195
-		 * @param $tip
1196
-		 * @param bool $allow_html
1197
-		 *
1198
-		 * @return string
1199
-		 */
1200
-		public function desc_tip( $tip, $allow_html = false ) {
1201
-			if ( $allow_html ) {
1202
-				$tip = $this->sanitize_tooltip( $tip );
1203
-			} else {
1204
-				$tip = esc_attr( $tip );
1205
-			}
1206
-	
1207
-			return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
1208
-		}
1209
-	
1210
-		/**
1211
-		 * Sanitize a string destined to be a tooltip.
1212
-		 *
1213
-		 * @param string $var
1214
-		 *
1215
-		 * @return string
1216
-		 */
1217
-		public function sanitize_tooltip( $var ) {
1218
-			return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
1219
-				'br'     => array(),
1220
-				'em'     => array(),
1221
-				'strong' => array(),
1222
-				'small'  => array(),
1223
-				'span'   => array(),
1224
-				'ul'     => array(),
1225
-				'li'     => array(),
1226
-				'ol'     => array(),
1227
-				'p'      => array(),
1228
-			) ) );
1229
-		}
1230
-	
1231
-		/**
1232
-		 * Builds the inputs for the widget options.
1233
-		 *
1234
-		 * @param $args
1235
-		 * @param $instance
1236
-		 */
1237
-		public function widget_inputs( $args, $instance ) {
1238
-	
1239
-			$class             = "";
1240
-			$element_require   = "";
1241
-			$custom_attributes = "";
1242
-	
1243
-			// get value
1244
-			if ( isset( $instance[ $args['name'] ] ) ) {
1245
-				$value = $instance[ $args['name'] ];
1246
-			} elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
1247
-				$value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
1248
-			} else {
1249
-				$value = '';
1250
-			}
1251
-	
1252
-			// get placeholder
1253
-			if ( ! empty( $args['placeholder'] ) ) {
1254
-				$placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
1255
-			} else {
1256
-				$placeholder = '';
1257
-			}
1258
-	
1259
-			// get if advanced
1260
-			if ( isset( $args['advanced'] ) && $args['advanced'] ) {
1261
-				$class .= " sd-advanced-setting ";
1262
-			}
1263
-	
1264
-			// element_require
1265
-			if ( isset( $args['element_require'] ) && $args['element_require'] ) {
1266
-				$element_require = $args['element_require'];
1267
-			}
1268
-	
1269
-			// custom_attributes
1270
-			if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
1271
-				$custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
1272
-			}
1273
-	
1274
-	
1275
-			// before wrapper
1276
-			?>
1141
+                }elseif(!empty($args['row']['close'])){
1142
+                    echo "<div class='col pl-0'>";
1143
+                }else{
1144
+                    echo "<div class='col pl-0 pr-2'>";
1145
+                }
1146
+            }
1147
+        }
1148
+	
1149
+        /**
1150
+         * Convert require element.
1151
+         *
1152
+         * @since 1.0.0
1153
+         *
1154
+         * @param string $input Input element.
1155
+         *
1156
+         * @return string $output
1157
+         */
1158
+        public function convert_element_require( $input ) {
1159
+	
1160
+            $input = str_replace( "'", '"', $input );// we only want double quotes
1161
+	
1162
+            $output = esc_attr( str_replace( array( "[%", "%]" ), array(
1163
+                "jQuery(form).find('[data-argument=\"",
1164
+                "\"]').find('input,select,textarea').val()"
1165
+            ), $input ) );
1166
+	
1167
+            return $output;
1168
+        }
1169
+	
1170
+        /**
1171
+         * Get the widget input description html.
1172
+         *
1173
+         * @param $args
1174
+         *
1175
+         * @return string
1176
+         * @todo, need to make its own tooltip script
1177
+         */
1178
+        public function widget_field_desc( $args ) {
1179
+	
1180
+            $description = '';
1181
+            if ( isset( $args['desc'] ) && $args['desc'] ) {
1182
+                if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
1183
+                    $description = $this->desc_tip( $args['desc'] );
1184
+                } else {
1185
+                    $description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
1186
+                }
1187
+            }
1188
+	
1189
+            return $description;
1190
+        }
1191
+	
1192
+        /**
1193
+         * Get the tool tip html.
1194
+         *
1195
+         * @param $tip
1196
+         * @param bool $allow_html
1197
+         *
1198
+         * @return string
1199
+         */
1200
+        public function desc_tip( $tip, $allow_html = false ) {
1201
+            if ( $allow_html ) {
1202
+                $tip = $this->sanitize_tooltip( $tip );
1203
+            } else {
1204
+                $tip = esc_attr( $tip );
1205
+            }
1206
+	
1207
+            return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
1208
+        }
1209
+	
1210
+        /**
1211
+         * Sanitize a string destined to be a tooltip.
1212
+         *
1213
+         * @param string $var
1214
+         *
1215
+         * @return string
1216
+         */
1217
+        public function sanitize_tooltip( $var ) {
1218
+            return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
1219
+                'br'     => array(),
1220
+                'em'     => array(),
1221
+                'strong' => array(),
1222
+                'small'  => array(),
1223
+                'span'   => array(),
1224
+                'ul'     => array(),
1225
+                'li'     => array(),
1226
+                'ol'     => array(),
1227
+                'p'      => array(),
1228
+            ) ) );
1229
+        }
1230
+	
1231
+        /**
1232
+         * Builds the inputs for the widget options.
1233
+         *
1234
+         * @param $args
1235
+         * @param $instance
1236
+         */
1237
+        public function widget_inputs( $args, $instance ) {
1238
+	
1239
+            $class             = "";
1240
+            $element_require   = "";
1241
+            $custom_attributes = "";
1242
+	
1243
+            // get value
1244
+            if ( isset( $instance[ $args['name'] ] ) ) {
1245
+                $value = $instance[ $args['name'] ];
1246
+            } elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
1247
+                $value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
1248
+            } else {
1249
+                $value = '';
1250
+            }
1251
+	
1252
+            // get placeholder
1253
+            if ( ! empty( $args['placeholder'] ) ) {
1254
+                $placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
1255
+            } else {
1256
+                $placeholder = '';
1257
+            }
1258
+	
1259
+            // get if advanced
1260
+            if ( isset( $args['advanced'] ) && $args['advanced'] ) {
1261
+                $class .= " sd-advanced-setting ";
1262
+            }
1263
+	
1264
+            // element_require
1265
+            if ( isset( $args['element_require'] ) && $args['element_require'] ) {
1266
+                $element_require = $args['element_require'];
1267
+            }
1268
+	
1269
+            // custom_attributes
1270
+            if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
1271
+                $custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
1272
+            }
1273
+	
1274
+	
1275
+            // before wrapper
1276
+            ?>
1277 1277
 			<p class="sd-argument <?php echo esc_attr( $class ); ?>"
1278 1278
 			data-argument='<?php echo esc_attr( $args['name'] ); ?>'
1279 1279
 			data-element_require='<?php if ( $element_require ) {
1280
-				echo $this->convert_element_require( $element_require );
1281
-			} ?>'
1280
+                echo $this->convert_element_require( $element_require );
1281
+            } ?>'
1282 1282
 			>
1283 1283
 			<?php
1284 1284
 	
1285 1285
 	
1286
-			switch ( $args['type'] ) {
1287
-				//array('text','password','number','email','tel','url','color')
1288
-				case "text":
1289
-				case "password":
1290
-				case "number":
1291
-				case "email":
1292
-				case "tel":
1293
-				case "url":
1294
-				case "color":
1295
-					?>
1286
+            switch ( $args['type'] ) {
1287
+                //array('text','password','number','email','tel','url','color')
1288
+                case "text":
1289
+                case "password":
1290
+                case "number":
1291
+                case "email":
1292
+                case "tel":
1293
+                case "url":
1294
+                case "color":
1295
+                    ?>
1296 1296
 					<label
1297 1297
 						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label>
1298 1298
 					<input <?php echo $placeholder; ?> class="widefat"
@@ -1303,47 +1303,47 @@  discard block
 block discarded – undo
1303 1303
 													   value="<?php echo esc_attr( $value ); ?>">
1304 1304
 					<?php
1305 1305
 	
1306
-					break;
1307
-				case "select":
1308
-					$multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
1309
-					if ( $multiple ) {
1310
-						if ( empty( $value ) ) {
1311
-							$value = array();
1312
-						}
1313
-					}
1314
-					?>
1306
+                    break;
1307
+                case "select":
1308
+                    $multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
1309
+                    if ( $multiple ) {
1310
+                        if ( empty( $value ) ) {
1311
+                            $value = array();
1312
+                        }
1313
+                    }
1314
+                    ?>
1315 1315
 					<label
1316 1316
 						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
1317 1317
 					<select <?php echo $placeholder; ?> class="widefat"
1318 1318
 						<?php echo $custom_attributes; ?>
1319 1319
 														id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
1320 1320
 														name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) );
1321
-														if ( $multiple ) {
1322
-															echo "[]";
1323
-														} ?>"
1321
+                                                        if ( $multiple ) {
1322
+                                                            echo "[]";
1323
+                                                        } ?>"
1324 1324
 						<?php if ( $multiple ) {
1325
-							echo "multiple";
1326
-						} //@todo not implemented yet due to gutenberg not supporting it
1327
-						?>
1325
+                            echo "multiple";
1326
+                        } //@todo not implemented yet due to gutenberg not supporting it
1327
+                        ?>
1328 1328
 					>
1329 1329
 						<?php
1330 1330
 	
1331
-						if ( ! empty( $args['options'] ) ) {
1332
-							foreach ( $args['options'] as $val => $label ) {
1333
-								if ( $multiple ) {
1334
-									$selected = in_array( $val, $value ) ? 'selected="selected"' : '';
1335
-								} else {
1336
-									$selected = selected( $value, $val, false );
1337
-								}
1338
-								echo "<option value='$val' " . $selected . ">$label</option>";
1339
-							}
1340
-						}
1341
-						?>
1331
+                        if ( ! empty( $args['options'] ) ) {
1332
+                            foreach ( $args['options'] as $val => $label ) {
1333
+                                if ( $multiple ) {
1334
+                                    $selected = in_array( $val, $value ) ? 'selected="selected"' : '';
1335
+                                } else {
1336
+                                    $selected = selected( $value, $val, false );
1337
+                                }
1338
+                                echo "<option value='$val' " . $selected . ">$label</option>";
1339
+                            }
1340
+                        }
1341
+                        ?>
1342 1342
 					</select>
1343 1343
 					<?php
1344
-					break;
1345
-				case "checkbox":
1346
-					?>
1344
+                    break;
1345
+                case "checkbox":
1346
+                    ?>
1347 1347
 					<input <?php echo $placeholder; ?>
1348 1348
 						<?php checked( 1, $value, true ) ?>
1349 1349
 						<?php echo $custom_attributes; ?>
@@ -1353,9 +1353,9 @@  discard block
 block discarded – undo
1353 1353
 					<label
1354 1354
 						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label>
1355 1355
 					<?php
1356
-					break;
1357
-				case "textarea":
1358
-					?>
1356
+                    break;
1357
+                case "textarea":
1358
+                    ?>
1359 1359
 					<label
1360 1360
 						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
1361 1361
 					<textarea <?php echo $placeholder; ?> class="widefat"
@@ -1365,218 +1365,218 @@  discard block
 block discarded – undo
1365 1365
 					><?php echo esc_attr( $value ); ?></textarea>
1366 1366
 					<?php
1367 1367
 	
1368
-					break;
1369
-				case "hidden":
1370
-					?>
1368
+                    break;
1369
+                case "hidden":
1370
+                    ?>
1371 1371
 					<input id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
1372 1372
 						   name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="hidden"
1373 1373
 						   value="<?php echo esc_attr( $value ); ?>">
1374 1374
 					<?php
1375
-					break;
1376
-				default:
1377
-					echo "No input type found!"; // @todo we need to add more input types.
1378
-			}
1375
+                    break;
1376
+                default:
1377
+                    echo "No input type found!"; // @todo we need to add more input types.
1378
+            }
1379 1379
 	
1380
-			// after wrapper
1381
-			?>
1380
+            // after wrapper
1381
+            ?>
1382 1382
 			</p>
1383 1383
 			<?php
1384
-		}
1385
-	
1386
-		/**
1387
-		 * Convert an array of attributes to JS object or HTML attributes string.
1388
-		 *
1389
-		 * @todo there is prob a faster way to do this, also we could add some validation here.
1390
-		 *
1391
-		 * @param $attributes
1392
-		 *
1393
-		 * @return string
1394
-		 */
1395
-		public function array_to_attributes( $attributes, $html = false ) {
1396
-	
1397
-			if ( ! is_array( $attributes ) ) {
1398
-				return '';
1399
-			}
1400
-	
1401
-			$output = '';
1402
-			foreach ( $attributes as $name => $value ) {
1403
-	
1404
-				if ( $html ) {
1405
-	
1406
-					if ( true === $value ) {
1407
-						$output .= esc_html( $name ) . ' ';
1408
-					} else if ( false !== $value ) {
1409
-						$output .= sprintf( '%s="%s" ', esc_html( $name ), trim( esc_attr( $value ) ) );
1410
-					}
1411
-	
1412
-				} else {
1413
-					$output .= sprintf( "'%s': '%s',", esc_js( $name ), is_bool( $value ) ? $value : trim( esc_js( $value ) ) );
1414
-				}
1415
-	
1416
-			}
1417
-	
1418
-			return $output;
1419
-		}
1420
-	
1421
-		/**
1422
-		 * Constructs id attributes for use in WP_Widget::form() fields.
1423
-		 *
1424
-		 * This function should be used in form() methods to create id attributes
1425
-		 * for fields to be saved by WP_Widget::update().
1426
-		 *
1427
-		 * @since 2.8.0
1428
-		 * @since 4.4.0 Array format field IDs are now accepted.
1429
-		 *
1430
-		 * @param string $field_name Field name.
1431
-		 *
1432
-		 * @return string ID attribute for `$field_name`.
1433
-		 */
1434
-		public function get_field_id( $field_name ) {
1435
-	
1436
-			$field_name = str_replace( array( '[]', '[', ']' ), array( '', '-', '' ), $field_name );
1437
-			$field_name = trim( $field_name, '-' );
1438
-	
1439
-			return 'widget-' . $this->base_id . '-' . $this->get_number() . '-' . $field_name;
1440
-		}
1441
-	
1442
-		/**
1443
-		 * Returns the instance number.
1444
-		 *
1445
-		 * @return int
1446
-		 */
1447
-		public function get_number() {
1448
-			static $number = 1;
1449
-	
1450
-			if ( isset( $this->output_types['widget'] ) ) {
1451
-				return $this->output_types['widget']->number;
1452
-			}
1453
-	
1454
-			if ( empty( $this->number ) ) {
1455
-				$this->number = $number;
1456
-				$number ++;
1457
-			}
1458
-	
1459
-			return $this->number;
1460
-		}
1461
-	
1462
-		/**
1463
-		 * Get the widget input title html.
1464
-		 *
1465
-		 * @param $args
1466
-		 *
1467
-		 * @return string
1468
-		 */
1469
-		public function widget_field_title( $args ) {
1470
-	
1471
-			$title = '';
1472
-			if ( isset( $args['title'] ) && $args['title'] ) {
1473
-				if ( isset( $args['icon'] ) && $args['icon'] ) {
1474
-					$title = $this->get_widget_icon( $args['icon'], $args['title']  );
1475
-				} else {
1476
-					$title = esc_attr($args['title']);
1477
-				}
1478
-			}
1479
-	
1480
-			return $title;
1481
-		}
1482
-	
1483
-		/**
1484
-		 * Retrieves the icon to use for widgets / blocks.
1485
-		 *
1486
-		 * @return array
1487
-		 */
1488
-		public function get_widget_icon( $icon = 'box-top', $title = '' ) {
1489
-			if($icon=='box-top'){
1490
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
1491
-			}elseif($icon=='box-right'){
1492
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
1493
-			}elseif($icon=='box-bottom'){
1494
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
1495
-			}elseif($icon=='box-left'){
1496
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
1497
-			}
1498
-		}
1499
-	
1500
-		/**
1501
-		 * Constructs name attributes for use in form() fields
1502
-		 *
1503
-		 * This function should be used in form() methods to create name attributes for fields
1504
-		 * to be saved by update()
1505
-		 *
1506
-		 * @since 2.8.0
1507
-		 * @since 4.4.0 Array format field names are now accepted.
1508
-		 *
1509
-		 * @param string $field_name Field name.
1510
-		 *
1511
-		 * @return string Name attribute for `$field_name`.
1512
-		 */
1513
-		public function get_field_name( $field_name ) {
1514
-			$pos = strpos( $field_name, '[' );
1515
-	
1516
-			if ( false !== $pos ) {
1517
-				// Replace the first occurrence of '[' with ']['.
1518
-				$field_name = '[' . substr_replace( $field_name, '][', $pos, strlen( '[' ) );
1519
-			} else {
1520
-				$field_name = '[' . $field_name . ']';
1521
-			}
1522
-	
1523
-			return 'widget-' . $this->base_id . '[' . $this->get_number() . ']' . $field_name;
1524
-		}
1525
-	
1526
-		public function widget_inputs_row_end($key, $args){
1527
-			if(!empty($args['row'])){
1528
-				// maybe close
1529
-				if(!empty($args['row']['close'])){
1530
-					echo "</div></div>";
1531
-				}
1532
-	
1533
-				echo "</div>";
1534
-			}
1535
-		}
1536
-	
1537
-		/**
1538
-		 * Generate and return inline styles from CSS rules that will match the unique class of the instance.
1539
-		 *
1540
-		 * @param array $rules
1541
-		 *
1542
-		 * @since 1.0.20
1543
-		 * @return string
1544
-		 */
1545
-		public function get_instance_style($rules = array()){
1546
-			$css = '';
1547
-	
1548
-			if(!empty($rules)){
1549
-				$rules = array_unique($rules);
1550
-				$instance_hash = $this->get_instance_hash();
1551
-				$css .= "<style>";
1552
-				foreach($rules as $rule){
1553
-					$css .= ".sdel-$instance_hash $rule";
1554
-				}
1555
-				$css .= "</style>";
1556
-			}
1557
-	
1558
-			return $css;
1559
-		}
1560
-	
1561
-		/**
1562
-		 * Get an instance hash that will be unique to the type and settings.
1563
-		 *
1564
-		 * @since 1.0.20
1565
-		 * @return string
1566
-		 */
1567
-		public function get_instance_hash(){
1568
-			$instance_string = $this->base_id . serialize( $this->instance );
1569
-			return hash( 'crc32b', $instance_string );
1570
-		}
1571
-	
1572
-		/**
1573
-		 * Get the conditional fields JavaScript.
1574
-		 *
1575
-		 * @return mixed
1576
-		 */
1577
-		public function conditional_fields_js() {
1578
-			ob_start();
1579
-			?>
1384
+        }
1385
+	
1386
+        /**
1387
+         * Convert an array of attributes to JS object or HTML attributes string.
1388
+         *
1389
+         * @todo there is prob a faster way to do this, also we could add some validation here.
1390
+         *
1391
+         * @param $attributes
1392
+         *
1393
+         * @return string
1394
+         */
1395
+        public function array_to_attributes( $attributes, $html = false ) {
1396
+	
1397
+            if ( ! is_array( $attributes ) ) {
1398
+                return '';
1399
+            }
1400
+	
1401
+            $output = '';
1402
+            foreach ( $attributes as $name => $value ) {
1403
+	
1404
+                if ( $html ) {
1405
+	
1406
+                    if ( true === $value ) {
1407
+                        $output .= esc_html( $name ) . ' ';
1408
+                    } else if ( false !== $value ) {
1409
+                        $output .= sprintf( '%s="%s" ', esc_html( $name ), trim( esc_attr( $value ) ) );
1410
+                    }
1411
+	
1412
+                } else {
1413
+                    $output .= sprintf( "'%s': '%s',", esc_js( $name ), is_bool( $value ) ? $value : trim( esc_js( $value ) ) );
1414
+                }
1415
+	
1416
+            }
1417
+	
1418
+            return $output;
1419
+        }
1420
+	
1421
+        /**
1422
+         * Constructs id attributes for use in WP_Widget::form() fields.
1423
+         *
1424
+         * This function should be used in form() methods to create id attributes
1425
+         * for fields to be saved by WP_Widget::update().
1426
+         *
1427
+         * @since 2.8.0
1428
+         * @since 4.4.0 Array format field IDs are now accepted.
1429
+         *
1430
+         * @param string $field_name Field name.
1431
+         *
1432
+         * @return string ID attribute for `$field_name`.
1433
+         */
1434
+        public function get_field_id( $field_name ) {
1435
+	
1436
+            $field_name = str_replace( array( '[]', '[', ']' ), array( '', '-', '' ), $field_name );
1437
+            $field_name = trim( $field_name, '-' );
1438
+	
1439
+            return 'widget-' . $this->base_id . '-' . $this->get_number() . '-' . $field_name;
1440
+        }
1441
+	
1442
+        /**
1443
+         * Returns the instance number.
1444
+         *
1445
+         * @return int
1446
+         */
1447
+        public function get_number() {
1448
+            static $number = 1;
1449
+	
1450
+            if ( isset( $this->output_types['widget'] ) ) {
1451
+                return $this->output_types['widget']->number;
1452
+            }
1453
+	
1454
+            if ( empty( $this->number ) ) {
1455
+                $this->number = $number;
1456
+                $number ++;
1457
+            }
1458
+	
1459
+            return $this->number;
1460
+        }
1461
+	
1462
+        /**
1463
+         * Get the widget input title html.
1464
+         *
1465
+         * @param $args
1466
+         *
1467
+         * @return string
1468
+         */
1469
+        public function widget_field_title( $args ) {
1470
+	
1471
+            $title = '';
1472
+            if ( isset( $args['title'] ) && $args['title'] ) {
1473
+                if ( isset( $args['icon'] ) && $args['icon'] ) {
1474
+                    $title = $this->get_widget_icon( $args['icon'], $args['title']  );
1475
+                } else {
1476
+                    $title = esc_attr($args['title']);
1477
+                }
1478
+            }
1479
+	
1480
+            return $title;
1481
+        }
1482
+	
1483
+        /**
1484
+         * Retrieves the icon to use for widgets / blocks.
1485
+         *
1486
+         * @return array
1487
+         */
1488
+        public function get_widget_icon( $icon = 'box-top', $title = '' ) {
1489
+            if($icon=='box-top'){
1490
+                return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
1491
+            }elseif($icon=='box-right'){
1492
+                return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
1493
+            }elseif($icon=='box-bottom'){
1494
+                return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
1495
+            }elseif($icon=='box-left'){
1496
+                return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
1497
+            }
1498
+        }
1499
+	
1500
+        /**
1501
+         * Constructs name attributes for use in form() fields
1502
+         *
1503
+         * This function should be used in form() methods to create name attributes for fields
1504
+         * to be saved by update()
1505
+         *
1506
+         * @since 2.8.0
1507
+         * @since 4.4.0 Array format field names are now accepted.
1508
+         *
1509
+         * @param string $field_name Field name.
1510
+         *
1511
+         * @return string Name attribute for `$field_name`.
1512
+         */
1513
+        public function get_field_name( $field_name ) {
1514
+            $pos = strpos( $field_name, '[' );
1515
+	
1516
+            if ( false !== $pos ) {
1517
+                // Replace the first occurrence of '[' with ']['.
1518
+                $field_name = '[' . substr_replace( $field_name, '][', $pos, strlen( '[' ) );
1519
+            } else {
1520
+                $field_name = '[' . $field_name . ']';
1521
+            }
1522
+	
1523
+            return 'widget-' . $this->base_id . '[' . $this->get_number() . ']' . $field_name;
1524
+        }
1525
+	
1526
+        public function widget_inputs_row_end($key, $args){
1527
+            if(!empty($args['row'])){
1528
+                // maybe close
1529
+                if(!empty($args['row']['close'])){
1530
+                    echo "</div></div>";
1531
+                }
1532
+	
1533
+                echo "</div>";
1534
+            }
1535
+        }
1536
+	
1537
+        /**
1538
+         * Generate and return inline styles from CSS rules that will match the unique class of the instance.
1539
+         *
1540
+         * @param array $rules
1541
+         *
1542
+         * @since 1.0.20
1543
+         * @return string
1544
+         */
1545
+        public function get_instance_style($rules = array()){
1546
+            $css = '';
1547
+	
1548
+            if(!empty($rules)){
1549
+                $rules = array_unique($rules);
1550
+                $instance_hash = $this->get_instance_hash();
1551
+                $css .= "<style>";
1552
+                foreach($rules as $rule){
1553
+                    $css .= ".sdel-$instance_hash $rule";
1554
+                }
1555
+                $css .= "</style>";
1556
+            }
1557
+	
1558
+            return $css;
1559
+        }
1560
+	
1561
+        /**
1562
+         * Get an instance hash that will be unique to the type and settings.
1563
+         *
1564
+         * @since 1.0.20
1565
+         * @return string
1566
+         */
1567
+        public function get_instance_hash(){
1568
+            $instance_string = $this->base_id . serialize( $this->instance );
1569
+            return hash( 'crc32b', $instance_string );
1570
+        }
1571
+	
1572
+        /**
1573
+         * Get the conditional fields JavaScript.
1574
+         *
1575
+         * @return mixed
1576
+         */
1577
+        public function conditional_fields_js() {
1578
+            ob_start();
1579
+            ?>
1580 1580
 			<script>
1581 1581
 			/**
1582 1582
 			* Conditional Fields
@@ -2078,57 +2078,57 @@  discard block
 block discarded – undo
2078 2078
 			<?php do_action( 'wp_super_duper_conditional_fields_js', $this ); ?>
2079 2079
 			</script>
2080 2080
 						<?php
2081
-						$output = ob_get_clean();
2082
-	
2083
-						return str_replace( array( '<script>', '</script>' ), '', trim( $output ) );
2084
-			}
2085
-	
2086
-		/**
2087
-		 * Output the super title.
2088
-		 *
2089
-		 * @param $args
2090
-		 * @param array $instance
2091
-		 *
2092
-		 * @return string
2093
-		 */
2094
-		public function output_title( $args, $instance = array() ) {
2095
-			$output = '';
2096
-	
2097
-			if ( ! empty( $instance['title'] ) ) {
2098
-				/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
2099
-				$title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->base_id );
2100
-	
2101
-				if ( empty( $instance['widget_title_tag'] ) ) {
2102
-					$output = $args['before_title'] . $title . $args['after_title'];
2103
-				} else {
2104
-					$title_tag = esc_attr( $instance['widget_title_tag'] );
2105
-	
2106
-					// classes
2107
-					$title_classes = array();
2108
-					$title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
2109
-					$title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
2110
-					$title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
2111
-					$title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
2112
-					$title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
2113
-					$title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
2114
-					$title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
2115
-					$title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
2116
-					$title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
2117
-					$title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
2118
-					$title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
2119
-					$title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
2120
-					$title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
2121
-					$title_classes   = array_filter( $title_classes );
2122
-	
2123
-					$class  = ! empty( $title_classes ) ? implode( ' ', $title_classes ) : '';
2124
-					$output = "<$title_tag class='$class' >$title</$title_tag>";
2125
-				}
2126
-	
2127
-			}
2128
-	
2129
-			return $output;
2130
-		}
2131
-	
2132
-	}
2081
+                        $output = ob_get_clean();
2082
+	
2083
+                        return str_replace( array( '<script>', '</script>' ), '', trim( $output ) );
2084
+            }
2085
+	
2086
+        /**
2087
+         * Output the super title.
2088
+         *
2089
+         * @param $args
2090
+         * @param array $instance
2091
+         *
2092
+         * @return string
2093
+         */
2094
+        public function output_title( $args, $instance = array() ) {
2095
+            $output = '';
2096
+	
2097
+            if ( ! empty( $instance['title'] ) ) {
2098
+                /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
2099
+                $title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->base_id );
2100
+	
2101
+                if ( empty( $instance['widget_title_tag'] ) ) {
2102
+                    $output = $args['before_title'] . $title . $args['after_title'];
2103
+                } else {
2104
+                    $title_tag = esc_attr( $instance['widget_title_tag'] );
2105
+	
2106
+                    // classes
2107
+                    $title_classes = array();
2108
+                    $title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
2109
+                    $title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
2110
+                    $title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
2111
+                    $title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
2112
+                    $title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
2113
+                    $title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
2114
+                    $title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
2115
+                    $title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
2116
+                    $title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
2117
+                    $title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
2118
+                    $title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
2119
+                    $title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
2120
+                    $title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
2121
+                    $title_classes   = array_filter( $title_classes );
2122
+	
2123
+                    $class  = ! empty( $title_classes ) ? implode( ' ', $title_classes ) : '';
2124
+                    $output = "<$title_tag class='$class' >$title</$title_tag>";
2125
+                }
2126
+	
2127
+            }
2128
+	
2129
+            return $output;
2130
+        }
2131
+	
2132
+    }
2133 2133
 
2134 2134
 }
Please login to merge, or discard this patch.
Spacing   +293 added lines, -293 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@  discard block
 block discarded – undo
5 5
  * @since 1.0.0
6 6
  */
7 7
 
8
-defined( 'ABSPATH' ) || exit;
8
+defined('ABSPATH') || exit;
9 9
 
10 10
 // Ensure the class is only loaded once.
11
-if ( ! class_exists( 'WP_Super_Duper' ) ) {
11
+if (!class_exists('WP_Super_Duper')) {
12 12
 
13 13
 	/**
14 14
 	 *
@@ -51,36 +51,36 @@  discard block
 block discarded – undo
51 51
 		/**
52 52
 		 * Take the array options and use them to build.
53 53
 		 */
54
-		public function __construct( $options ) {
54
+		public function __construct($options) {
55 55
 			global $sd_widgets;
56 56
 	
57
-			$sd_widgets[ $options['base_id'] ] = array(
57
+			$sd_widgets[$options['base_id']] = array(
58 58
 				'name'       => $options['name'],
59 59
 				'class_name' => $options['class_name']
60 60
 			);
61
-			$this->base_id   = $options['base_id'];
61
+			$this->base_id = $options['base_id'];
62 62
 	
63 63
 			// Lets filter the options before we do anything.
64
-			$options = apply_filters( 'wp_super_duper_options', $options, $this );
65
-			$options = apply_filters( "wp_super_duper_options_{$this->base_id}", $options, $this );
66
-			$options = $this->add_name_from_key( $options );
64
+			$options = apply_filters('wp_super_duper_options', $options, $this);
65
+			$options = apply_filters("wp_super_duper_options_{$this->base_id}", $options, $this);
66
+			$options = $this->add_name_from_key($options);
67 67
 	
68 68
 			// Set args.
69 69
 			$this->options   = $options;
70 70
 			$this->base_id   = $options['base_id'];
71
-			$this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array();
71
+			$this->arguments = isset($options['arguments']) ? $options['arguments'] : array();
72 72
 	
73 73
 			// Load output types.
74 74
 			$this->load_output_types();
75 75
 	
76 76
 			// add generator text to admin head
77
-			add_action( 'admin_head', array( $this, 'generator' ) );
77
+			add_action('admin_head', array($this, 'generator'));
78 78
 	
79
-			add_action( 'admin_init', array( __CLASS__, 'load_widgets_setting' ) );
79
+			add_action('admin_init', array(__CLASS__, 'load_widgets_setting'));
80 80
 	
81
-			add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
81
+			add_action('wp_ajax_super_duper_get_picker', array(__CLASS__, 'get_picker'));
82 82
 	
83
-			do_action( 'wp_super_duper_widget_init', $options, $this );
83
+			do_action('wp_super_duper_widget_init', $options, $this);
84 84
 	
85 85
 		}
86 86
 	
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
 		 *
93 93
 		 * @return mixed
94 94
 		 */
95
-		protected function add_name_from_key( $options, $arguments = false ) {
96
-			if ( ! empty( $options['arguments'] ) ) {
97
-				foreach ( $options['arguments'] as $key => $val ) {
98
-					$options['arguments'][ $key ]['name'] = $key;
95
+		protected function add_name_from_key($options, $arguments = false) {
96
+			if (!empty($options['arguments'])) {
97
+				foreach ($options['arguments'] as $key => $val) {
98
+					$options['arguments'][$key]['name'] = $key;
99 99
 				}
100
-			} elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
101
-				foreach ( $options as $key => $val ) {
102
-					$options[ $key ]['name'] = $key;
100
+			} elseif ($arguments && is_array($options) && !empty($options)) {
101
+				foreach ($options as $key => $val) {
102
+					$options[$key]['name'] = $key;
103 103
 				}
104 104
 			}
105 105
 	
@@ -112,39 +112,39 @@  discard block
 block discarded – undo
112 112
 		public function load_output_types() {
113 113
 	
114 114
 			$allowed_types = $this->get_output_types();
115
-			$output_types  = array( 'block', 'shortcode', 'widget' );
115
+			$output_types  = array('block', 'shortcode', 'widget');
116 116
 	
117 117
 			// Check if this is being overidden by the widget.
118 118
 			$args = $this->get_arguments();
119
-			if ( isset( $args['output_types'] ) && is_array( $args['output_types'] ) ) {
120
-				$output_types  = $args['output_types'] ;
119
+			if (isset($args['output_types']) && is_array($args['output_types'])) {
120
+				$output_types = $args['output_types'];
121 121
 			}
122 122
 	
123
-			if ( isset( $this->options['output_types'] ) && is_array( $this->options['output_types'] ) ) {
124
-				$output_types  = $this->options['output_types'] ;
123
+			if (isset($this->options['output_types']) && is_array($this->options['output_types'])) {
124
+				$output_types = $this->options['output_types'];
125 125
 			}
126 126
 	
127 127
 			// Load each output type.
128
-			foreach ( $output_types as $output_type ) {
128
+			foreach ($output_types as $output_type) {
129 129
 	
130 130
 				// Ensure this is an allowed type.
131
-				if ( ! isset( $allowed_types[ $output_type ] ) ) {
131
+				if (!isset($allowed_types[$output_type])) {
132 132
 					continue;
133 133
 				}
134 134
 	
135 135
 				// If the class does not exist, try loading it.
136
-				if ( ! class_exists( $allowed_types[ $output_type ] ) ) {
136
+				if (!class_exists($allowed_types[$output_type])) {
137 137
 	
138
-					if ( file_exists( plugin_dir_path( __FILE__ ) . "type/$output_type.php" ) ) {
139
-						require_once( plugin_dir_path( __FILE__ ) . "type/$output_type.php" );
138
+					if (file_exists(plugin_dir_path(__FILE__) . "type/$output_type.php")) {
139
+						require_once(plugin_dir_path(__FILE__) . "type/$output_type.php");
140 140
 					} else {
141 141
 						continue;
142 142
 					}
143 143
 	
144 144
 				}
145 145
 	
146
-				$output_class                       = $allowed_types[ $output_type ];
147
-				$this->output_types[ $output_type ] = new $output_class( $this );
146
+				$output_class                       = $allowed_types[$output_type];
147
+				$this->output_types[$output_type] = new $output_class($this);
148 148
 			}
149 149
 	
150 150
 		}
@@ -164,19 +164,19 @@  discard block
 block discarded – undo
164 164
 			);
165 165
 	
166 166
 			// Maybe disable widgets.
167
-			$disable_widget   = get_option( 'sd_load_widgets', 'auto' );
167
+			$disable_widget = get_option('sd_load_widgets', 'auto');
168 168
 	
169
-			if ( 'auto' === $disable_widget ) {
170
-				if ( !$this->widgets_required() ) {
171
-					unset( $types['widget'] );
169
+			if ('auto' === $disable_widget) {
170
+				if (!$this->widgets_required()) {
171
+					unset($types['widget']);
172 172
 				}
173 173
 			}
174 174
 	
175
-			if ( 'no' === $disable_widget ) {
176
-				unset( $types['widget'] );
175
+			if ('no' === $disable_widget) {
176
+				unset($types['widget']);
177 177
 			}
178 178
 	
179
-			return apply_filters( 'super_duper_types', $types, $this );
179
+			return apply_filters('super_duper_types', $types, $this);
180 180
 		}
181 181
 	
182 182
 		/**
@@ -184,39 +184,39 @@  discard block
 block discarded – undo
184 184
 		 *
185 185
 		 * @return mixed|void
186 186
 		 */
187
-		protected function widgets_required(){
187
+		protected function widgets_required() {
188 188
 			global $wp_version;
189 189
 	
190 190
 			$required = false;
191 191
 	
192 192
 	
193 193
 			// check wp version
194
-			if( version_compare( $wp_version, '5.8', '<' ) ){
194
+			if (version_compare($wp_version, '5.8', '<')) {
195 195
 				$required = true;
196 196
 			}
197 197
 	
198 198
 			// Page builders that require widgets
199
-			if(
199
+			if (
200 200
 			!$required && (
201
-			defined( 'ELEMENTOR_VERSION' ) // elementor
202
-			|| class_exists( 'Fusion_Element' ) // Fusion Builder (avada)
203
-			|| class_exists( 'SiteOrigin_Panels' ) // SiteOrigin Page builder
204
-			|| defined( 'WPB_VC_VERSION' ) // WPBakery page builder
205
-			|| defined( 'CT_VERSION' ) // Oxygen Builder
206
-			|| defined( 'FL_BUILDER_VERSION' ) // Beaver Builder
207
-			|| defined( 'FL_THEME_BUILDER_VERSION' ) // Beaver Themer
201
+			defined('ELEMENTOR_VERSION') // elementor
202
+			|| class_exists('Fusion_Element') // Fusion Builder (avada)
203
+			|| class_exists('SiteOrigin_Panels') // SiteOrigin Page builder
204
+			|| defined('WPB_VC_VERSION') // WPBakery page builder
205
+			|| defined('CT_VERSION') // Oxygen Builder
206
+			|| defined('FL_BUILDER_VERSION') // Beaver Builder
207
+			|| defined('FL_THEME_BUILDER_VERSION') // Beaver Themer
208 208
 			)
209
-			){
209
+			) {
210 210
 				$required = true;
211 211
 			}
212 212
 	
213 213
 			// Theme has active widgets
214
-			if( !$required && !empty( $this->has_active_widgets() )  ){
214
+			if (!$required && !empty($this->has_active_widgets())) {
215 215
 				$required = true;
216 216
 			}
217 217
 	
218 218
 	
219
-			return apply_filters( 'sd_widgets_required' , $required );
219
+			return apply_filters('sd_widgets_required', $required);
220 220
 		}
221 221
 	
222 222
 		/**
@@ -224,28 +224,28 @@  discard block
 block discarded – undo
224 224
 		 *
225 225
 		 * @return bool
226 226
 		 */
227
-		protected function has_active_widgets(){
227
+		protected function has_active_widgets() {
228 228
 			global $sd_has_active_widgets;
229 229
 	
230 230
 			// have we already done this?
231
-			if(!is_null($sd_has_active_widgets)){
231
+			if (!is_null($sd_has_active_widgets)) {
232 232
 				return $sd_has_active_widgets;
233 233
 			}
234 234
 	
235 235
 			$result = false;
236 236
 			$sidebars_widgets = get_option('sidebars_widgets');
237 237
 	
238
-			if(is_array($sidebars_widgets)){
238
+			if (is_array($sidebars_widgets)) {
239 239
 	
240 240
 				foreach ($sidebars_widgets as $key => $value) {
241 241
 	
242 242
 	
243 243
 	
244
-					if( $key != 'wp_inactive_widgets' ) {
244
+					if ($key != 'wp_inactive_widgets') {
245 245
 	
246
-						if(!empty($value) && is_array($value)){
247
-							foreach($value as $widget){
248
-								if($widget && substr( $widget, 0, 6 ) !== "block-"){
246
+						if (!empty($value) && is_array($value)) {
247
+							foreach ($value as $widget) {
248
+								if ($widget && substr($widget, 0, 6) !== "block-") {
249 249
 									$result = true;
250 250
 								}
251 251
 							}
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
 		 * @return array Get arguments.
269 269
 		 */
270 270
 		public function get_arguments() {
271
-			if ( empty( $this->arguments ) ) {
271
+			if (empty($this->arguments)) {
272 272
 				$this->arguments = $this->set_arguments();
273 273
 			}
274 274
 	
275
-			$this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
276
-			$this->arguments = $this->add_name_from_key( $this->arguments, true );
275
+			$this->arguments = apply_filters('wp_super_duper_arguments', $this->arguments, $this->options, $this->instance);
276
+			$this->arguments = $this->add_name_from_key($this->arguments, true);
277 277
 	
278 278
 			return $this->arguments;
279 279
 		}
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 						jQuery($this).data('sd-widget-enabled', true);
345 345
 					}
346 346
 	
347
-					var $button = '<button title="<?php _e( 'Advanced Settings' );?>" class="button button-primary right sd-advanced-button" onclick="sd_so_toggle_advanced(this);return false;"><i class="fas fa-sliders-h" aria-hidden="true"></i></button>';
347
+					var $button = '<button title="<?php _e('Advanced Settings'); ?>" class="button button-primary right sd-advanced-button" onclick="sd_so_toggle_advanced(this);return false;"><i class="fas fa-sliders-h" aria-hidden="true"></i></button>';
348 348
 					var form = jQuery($this).parents('' + $selector + '');
349 349
 	
350 350
 					if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) {
@@ -380,10 +380,10 @@  discard block
 block discarded – undo
380 380
 			/*
381 381
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
382 382
 			 */
383
-			return str_replace( array(
383
+			return str_replace(array(
384 384
 				'<script>',
385 385
 				'</script>'
386
-			), '', $output );
386
+			), '', $output);
387 387
 		}
388 388
 	
389 389
 		/**
@@ -393,12 +393,12 @@  discard block
 block discarded – undo
393 393
 		 *
394 394
 		 * @return string
395 395
 		 */
396
-		public static function get_picker( $editor_id = '' ) {
396
+		public static function get_picker($editor_id = '') {
397 397
 	
398 398
 			ob_start();
399
-			if ( isset( $_POST['editor_id'] ) ) {
400
-				$editor_id = esc_attr( $_POST['editor_id'] );
401
-			} elseif ( isset( $_REQUEST['et_fb'] ) ) {
399
+			if (isset($_POST['editor_id'])) {
400
+				$editor_id = esc_attr($_POST['editor_id']);
401
+			} elseif (isset($_REQUEST['et_fb'])) {
402 402
 				$editor_id = 'main_content_content_vb_tiny_mce';
403 403
 			}
404 404
 	
@@ -407,13 +407,13 @@  discard block
 block discarded – undo
407 407
 	
408 408
 			<div class="sd-shortcode-left-wrap">
409 409
 				<?php
410
-				ksort( $sd_widgets );
410
+				ksort($sd_widgets);
411 411
 				//				print_r($sd_widgets);exit;
412
-				if ( ! empty( $sd_widgets ) ) {
412
+				if (!empty($sd_widgets)) {
413 413
 					echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
414
-					echo "<option>" . __( 'Select shortcode' ) . "</option>";
415
-					foreach ( $sd_widgets as $shortcode => $class ) {
416
-						echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
414
+					echo "<option>" . __('Select shortcode') . "</option>";
415
+					foreach ($sd_widgets as $shortcode => $class) {
416
+						echo "<option value='" . esc_attr($shortcode) . "'>" . esc_attr($shortcode) . " (" . esc_attr($class['name']) . ")</option>";
417 417
 					}
418 418
 					echo "</select>";
419 419
 	
@@ -426,37 +426,37 @@  discard block
 block discarded – undo
426 426
 			<div class="sd-shortcode-right-wrap">
427 427
 				<textarea id='sd-shortcode-output' disabled></textarea>
428 428
 				<div id='sd-shortcode-output-actions'>
429
-					<?php if ( $editor_id != '' ) { ?>
429
+					<?php if ($editor_id != '') { ?>
430 430
 						<button class="button sd-insert-shortcode-button"
431
-								onclick="sd_insert_shortcode(<?php if ( ! empty( $editor_id ) ) {
431
+								onclick="sd_insert_shortcode(<?php if (!empty($editor_id)) {
432 432
 									echo "'" . $editor_id . "'";
433
-								} ?>)"><?php _e( 'Insert shortcode' ); ?></button>
433
+								} ?>)"><?php _e('Insert shortcode'); ?></button>
434 434
 					<?php } ?>
435 435
 					<button class="button"
436
-							onclick="sd_copy_to_clipboard()"><?php _e( 'Copy shortcode' ); ?></button>
436
+							onclick="sd_copy_to_clipboard()"><?php _e('Copy shortcode'); ?></button>
437 437
 				</div>
438 438
 			</div>
439 439
 			<?php
440 440
 	
441 441
 			$html = ob_get_clean();
442 442
 	
443
-			if ( wp_doing_ajax() ) {
443
+			if (wp_doing_ajax()) {
444 444
 				echo $html;
445 445
 				$should_die = true;
446 446
 	
447 447
 				// some builder get the editor via ajax so we should not die on those occasions
448 448
 				$dont_die = array(
449
-					'parent_tag',// WP Bakery
449
+					'parent_tag', // WP Bakery
450 450
 					'avia_request' // enfold
451 451
 				);
452 452
 	
453
-				foreach ( $dont_die as $request ) {
454
-					if ( isset( $_REQUEST[ $request ] ) ) {
453
+				foreach ($dont_die as $request) {
454
+					if (isset($_REQUEST[$request])) {
455 455
 						$should_die = false;
456 456
 					}
457 457
 				}
458 458
 	
459
-				if ( $should_die ) {
459
+				if ($should_die) {
460 460
 					wp_die();
461 461
 				}
462 462
 	
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 						jQuery($this).data('sd-widget-enabled', true);
536 536
 					}
537 537
 	
538
-					var $button = '<button title="<?php _e( 'Advanced Settings' );?>" style="line-height: 28px;" class="button button-primary right sd-advanced-button" onclick="sd_toggle_advanced(this);return false;"><span class="dashicons dashicons-admin-settings" style="width: 28px;font-size: 28px;"></span></button>';
538
+					var $button = '<button title="<?php _e('Advanced Settings'); ?>" style="line-height: 28px;" class="button button-primary right sd-advanced-button" onclick="sd_toggle_advanced(this);return false;"><span class="dashicons dashicons-admin-settings" style="width: 28px;font-size: 28px;"></span></button>';
539 539
 					var form = jQuery($this).parents('' + $selector + '');
540 540
 	
541 541
 					if (jQuery($this).val() == '1' && jQuery(form).find('.sd-advanced-button').length == 0) {
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
 						});
630 630
 	
631 631
 					}
632
-					<?php do_action( 'wp_super_duper_widget_js' ); ?>
632
+					<?php do_action('wp_super_duper_widget_js'); ?>
633 633
 			</script>
634 634
 	
635 635
 			<?php
@@ -639,10 +639,10 @@  discard block
 block discarded – undo
639 639
 				* We only add the <script> tags for code highlighting, so we strip them from the output.
640 640
 				*/
641 641
 	
642
-				return str_replace( array(
642
+				return str_replace(array(
643 643
 					'<script>',
644 644
 					'</script>'
645
-				), '', $output );
645
+				), '', $output);
646 646
 		}
647 647
 	
648 648
 		/**
@@ -652,12 +652,12 @@  discard block
 block discarded – undo
652 652
 		 *
653 653
 		 * @return mixed
654 654
 		 */
655
-		public static function widget_css( $advanced = true ) {
655
+		public static function widget_css($advanced = true) {
656 656
 			ob_start();
657 657
 			?>
658 658
 	
659 659
 			<style>
660
-				<?php if ( $advanced ) : ?>
660
+				<?php if ($advanced) : ?>
661 661
 					.sd-advanced-setting {
662 662
 						display: none;
663 663
 					}
@@ -701,21 +701,21 @@  discard block
 block discarded – undo
701 701
 				* We only add the <script> tags for code highlighting, so we strip them from the output.
702 702
 				*/
703 703
 	
704
-				return str_replace( array(
704
+				return str_replace(array(
705 705
 					'<style>',
706 706
 					'</style>'
707
-				), '', $output );
707
+				), '', $output);
708 708
 		}
709 709
 	
710 710
 		/**
711 711
 		 * Registers the widgets loading settings.
712 712
 		 */
713 713
 		public static function load_widgets_setting() {
714
-			register_setting( 'general', 'sd_load_widgets', 'esc_attr' );
714
+			register_setting('general', 'sd_load_widgets', 'esc_attr');
715 715
 	
716 716
 			add_settings_field(
717 717
 				'sd_load_widgets',
718
-				'<label for="sd_load_widgets">' . __( 'Load Super Duper Widgets' ) . '</label>',
718
+				'<label for="sd_load_widgets">' . __('Load Super Duper Widgets') . '</label>',
719 719
 				'WP_Super_Duper::load_widgets_setting_html',
720 720
 				'general'
721 721
 			);
@@ -727,26 +727,26 @@  discard block
 block discarded – undo
727 727
 		 */
728 728
 		public static function load_widgets_setting_html() {
729 729
 			$available_options = array(
730
-				'yes'  => __( 'Yes' ),
731
-				'no'   => __( 'No' ),
732
-				'auto' => __( 'Auto' ),
730
+				'yes'  => __('Yes'),
731
+				'no'   => __('No'),
732
+				'auto' => __('Auto'),
733 733
 			);
734
-			$selected_option   = get_option( 'sd_load_widgets', 'auto' );
734
+			$selected_option = get_option('sd_load_widgets', 'auto');
735 735
 	
736 736
 			?>
737 737
 				<select name="sd_load_widgets" id="sd_load_widgets">
738
-					<?php foreach ( $available_options as $key => $label ) : ?>
739
-						<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $selected_option ); ?>><?php echo esc_html( $label ); ?></option>
738
+					<?php foreach ($available_options as $key => $label) : ?>
739
+						<option value="<?php echo esc_attr($key); ?>" <?php selected($key, $selected_option); ?>><?php echo esc_html($label); ?></option>
740 740
 					<?php endforeach; ?>
741 741
 				</select>
742
-				<p class="description"><?php _e( 'This option allows you to disable Super Duper widgets and instead only load the blocks and shortcodes.' ); ?></p>
742
+				<p class="description"><?php _e('This option allows you to disable Super Duper widgets and instead only load the blocks and shortcodes.'); ?></p>
743 743
 			<?php
744 744
 		}
745 745
 	
746 746
 		/**
747 747
 		 * prevent SDv1 errors if register_widget() function used
748 748
 		 */
749
-		public function _register(){
749
+		public function _register() {
750 750
 			// backwards compatibility
751 751
 		}
752 752
 	
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 		public function generator() {
757 757
 	
758 758
 			// We want to set this once.
759
-			if ( empty( $GLOBALS['SD_SET_GENERATOR'] ) ) {
759
+			if (empty($GLOBALS['SD_SET_GENERATOR'])) {
760 760
 				echo '<meta name="generator" content="WP Super Duper v' . $this->version . '" />';
761 761
 				$GLOBALS['SD_SET_GENERATOR'] = 1;
762 762
 			}
@@ -770,8 +770,8 @@  discard block
 block discarded – undo
770 770
 		 * @param array $widget_args
771 771
 		 * @param string $content
772 772
 		 */
773
-		public function output( $args = array(), $widget_args = array(), $content = '' ) {
774
-			echo call_user_func( $this->options['widget_ops']['output'], $args, $widget_args, $content );
773
+		public function output($args = array(), $widget_args = array(), $content = '') {
774
+			echo call_user_func($this->options['widget_ops']['output'], $args, $widget_args, $content);
775 775
 		}
776 776
 	
777 777
 		/**
@@ -781,8 +781,8 @@  discard block
 block discarded – undo
781 781
 		 *
782 782
 		 * @return string
783 783
 		 */
784
-		public function preview_placeholder_text( $name = '' ) {
785
-			return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf( __( 'Placeholder for: %s' ), $name ) . "</div>";
784
+		public function preview_placeholder_text($name = '') {
785
+			return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf(__('Placeholder for: %s'), $name) . "</div>";
786 786
 		}
787 787
 	
788 788
 		/**
@@ -792,13 +792,13 @@  discard block
 block discarded – undo
792 792
 		 *
793 793
 		 * @return mixed
794 794
 		 */
795
-		public function string_to_bool( $options ) {
795
+		public function string_to_bool($options) {
796 796
 			// convert bool strings to booleans
797
-			foreach ( $options as $key => $val ) {
798
-				if ( $val == 'false' ) {
799
-					$options[ $key ] = false;
800
-				} elseif ( $val == 'true' ) {
801
-					$options[ $key ] = true;
797
+			foreach ($options as $key => $val) {
798
+				if ($val == 'false') {
799
+					$options[$key] = false;
800
+				} elseif ($val == 'true') {
801
+					$options[$key] = true;
802 802
 				}
803 803
 			}
804 804
 	
@@ -814,26 +814,26 @@  discard block
 block discarded – undo
814 814
 		 *
815 815
 		 * @return array
816 816
 		 */
817
-		public function argument_values( $instance ) {
817
+		public function argument_values($instance) {
818 818
 			$argument_values = array();
819 819
 	
820 820
 			// set widget instance
821 821
 			$this->instance = $instance;
822 822
 	
823
-			if ( empty( $this->arguments ) ) {
823
+			if (empty($this->arguments)) {
824 824
 				$this->arguments = $this->get_arguments();
825 825
 			}
826 826
 	
827
-			if ( ! empty( $this->arguments ) ) {
828
-				foreach ( $this->arguments as $key => $args ) {
827
+			if (!empty($this->arguments)) {
828
+				foreach ($this->arguments as $key => $args) {
829 829
 					// set the input name from the key
830 830
 					$args['name'] = $key;
831 831
 					//
832
-					$argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
833
-					if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
832
+					$argument_values[$key] = isset($instance[$key]) ? $instance[$key] : '';
833
+					if ($args['type'] == 'checkbox' && $argument_values[$key] == '') {
834 834
 						// don't set default for an empty checkbox
835
-					} elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
836
-						$argument_values[ $key ] = $args['default'];
835
+					} elseif ($argument_values[$key] == '' && isset($args['default'])) {
836
+						$argument_values[$key] = $args['default'];
837 837
 					}
838 838
 				}
839 839
 			}
@@ -849,15 +849,15 @@  discard block
 block discarded – undo
849 849
 		public function get_url() {
850 850
 			$url = $this->url;
851 851
 	
852
-			if ( ! $url ) {
852
+			if (!$url) {
853 853
 				// check if we are inside a plugin
854
-				$file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
854
+				$file_dir = str_replace("/includes", "", dirname(__FILE__));
855 855
 	
856
-				$dir_parts = explode( "/wp-content/", $file_dir );
857
-				$url_parts = explode( "/wp-content/", plugins_url() );
856
+				$dir_parts = explode("/wp-content/", $file_dir);
857
+				$url_parts = explode("/wp-content/", plugins_url());
858 858
 	
859
-				if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
860
-					$url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
859
+				if (!empty($url_parts[0]) && !empty($dir_parts[1])) {
860
+					$url       = trailingslashit($url_parts[0] . "/wp-content/" . $dir_parts[1]);
861 861
 					$this->url = $url;
862 862
 				}
863 863
 			}
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
 		 */
884 884
 		public function is_divi_preview() {
885 885
 			$result = false;
886
-			if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
886
+			if (isset($_REQUEST['et_fb']) || isset($_REQUEST['et_pb_preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor')) {
887 887
 				$result = true;
888 888
 			}
889 889
 	
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
 		 */
899 899
 		public function is_elementor_preview() {
900 900
 			$result = false;
901
-			if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
901
+			if (isset($_REQUEST['elementor-preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor_ajax')) {
902 902
 				$result = true;
903 903
 			}
904 904
 	
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 		 */
914 914
 		public function is_beaver_preview() {
915 915
 			$result = false;
916
-			if ( isset( $_REQUEST['fl_builder'] ) ) {
916
+			if (isset($_REQUEST['fl_builder'])) {
917 917
 				$result = true;
918 918
 			}
919 919
 	
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
 		 */
929 929
 		public function is_siteorigin_preview() {
930 930
 			$result = false;
931
-			if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
931
+			if (!empty($_REQUEST['siteorigin_panels_live_editor'])) {
932 932
 				$result = true;
933 933
 			}
934 934
 	
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
 		 */
944 944
 		public function is_cornerstone_preview() {
945 945
 			$result = false;
946
-			if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
946
+			if (!empty($_REQUEST['cornerstone_preview']) || basename($_SERVER['REQUEST_URI']) == 'cornerstone-endpoint') {
947 947
 				$result = true;
948 948
 			}
949 949
 	
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
 		 */
959 959
 		public function is_fusion_preview() {
960 960
 			$result = false;
961
-			if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
961
+			if (!empty($_REQUEST['fb-edit']) || !empty($_REQUEST['fusion_load_nonce'])) {
962 962
 				$result = true;
963 963
 			}
964 964
 	
@@ -973,7 +973,7 @@  discard block
 block discarded – undo
973 973
 		 */
974 974
 		public function is_oxygen_preview() {
975 975
 			$result = false;
976
-			if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
976
+			if (!empty($_REQUEST['ct_builder']) || (!empty($_REQUEST['action']) && (substr($_REQUEST['action'], 0, 11) === "oxy_render_" || substr($_REQUEST['action'], 0, 10) === "ct_render_"))) {
977 977
 				$result = true;
978 978
 			}
979 979
 	
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
 		*/
991 991
 		public function is_block_content_call() {
992 992
 			$result = false;
993
-			if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
993
+			if (wp_doing_ajax() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'super_duper_output_shortcode') {
994 994
 				$result = true;
995 995
 			}
996 996
 	
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 		 *
1003 1003
 		 * @param array $instance The widget options.
1004 1004
 		 */
1005
-		public function form( $instance ) {
1005
+		public function form($instance) {
1006 1006
 	
1007 1007
 			// Set widget instance.
1008 1008
 			$this->instance = $instance;
@@ -1011,45 +1011,45 @@  discard block
 block discarded – undo
1011 1011
 			echo $this->widget_advanced_toggle();
1012 1012
 	
1013 1013
 			// Display description.
1014
-			printf( '<p>%s</p>', esc_html( $this->options['widget_ops']['description'] ) );
1014
+			printf('<p>%s</p>', esc_html($this->options['widget_ops']['description']));
1015 1015
 	
1016 1016
 			// Prepare arguments.
1017 1017
 			$arguments_raw = $this->get_arguments();
1018 1018
 	
1019
-		if ( is_array( $arguments_raw ) ) {
1019
+		if (is_array($arguments_raw)) {
1020 1020
 	
1021
-			$arguments = $this->group_arguments( $arguments_raw );
1021
+			$arguments = $this->group_arguments($arguments_raw);
1022 1022
 	
1023 1023
 			// Do we have sections?
1024
-			if ( $arguments != $arguments_raw ) {
1024
+			if ($arguments != $arguments_raw) {
1025 1025
 	
1026 1026
 					$panel_count = 0;
1027
-					foreach ( $arguments as $key => $args ) {
1027
+					foreach ($arguments as $key => $args) {
1028 1028
 	
1029 1029
 						$hide       = $panel_count ? ' style="display:none;" ' : '';
1030 1030
 						$icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
1031
-						echo "<button onclick='jQuery(this).find(\"i\").toggleClass(\"fas fa-chevron-up fas fa-chevron-down\");jQuery(this).next().slideToggle();' type='button' class='sd-toggle-group-button sd-input-group-toggle" . sanitize_title_with_dashes( $key ) . "'>" . esc_attr( $key ) . " <i style='float:right;' class='" . esc_attr( $icon_class ) . "'></i></button>";
1032
-						echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
1031
+						echo "<button onclick='jQuery(this).find(\"i\").toggleClass(\"fas fa-chevron-up fas fa-chevron-down\");jQuery(this).next().slideToggle();' type='button' class='sd-toggle-group-button sd-input-group-toggle" . sanitize_title_with_dashes($key) . "'>" . esc_attr($key) . " <i style='float:right;' class='" . esc_attr($icon_class) . "'></i></button>";
1032
+						echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes($key) . "' $hide>";
1033 1033
 	
1034
-						foreach ( $args as $k => $a ) {
1034
+						foreach ($args as $k => $a) {
1035 1035
 	
1036 1036
 							$this->widget_inputs_row_start($k, $a);
1037
-							$this->widget_inputs( $a, $instance );
1037
+							$this->widget_inputs($a, $instance);
1038 1038
 							$this->widget_inputs_row_end($k, $a);
1039 1039
 	
1040 1040
 						}
1041 1041
 	
1042 1042
 						echo "</div>";
1043 1043
 	
1044
-						$panel_count ++;
1044
+						$panel_count++;
1045 1045
 	
1046 1046
 					}
1047 1047
 	
1048 1048
 				} else {
1049 1049
 	
1050
-					foreach ( $arguments as $key => $args ) {
1050
+					foreach ($arguments as $key => $args) {
1051 1051
 						$this->widget_inputs_row_start($key, $args);
1052
-						$this->widget_inputs( $args, $instance );
1052
+						$this->widget_inputs($args, $instance);
1053 1053
 						$this->widget_inputs_row_end($key, $args);
1054 1054
 					}
1055 1055
 	
@@ -1081,9 +1081,9 @@  discard block
 block discarded – undo
1081 1081
 			$show      = false;
1082 1082
 			$arguments = $this->get_arguments();
1083 1083
 	
1084
-			if ( ! empty( $arguments ) ) {
1085
-				foreach ( $arguments as $argument ) {
1086
-					if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1084
+			if (!empty($arguments)) {
1085
+				foreach ($arguments as $argument) {
1086
+					if (isset($argument['advanced']) && $argument['advanced']) {
1087 1087
 						$show = true;
1088 1088
 						break; // no need to continue if we know we have it
1089 1089
 					}
@@ -1100,23 +1100,23 @@  discard block
 block discarded – undo
1100 1100
 		 *
1101 1101
 		 * @return array
1102 1102
 		 */
1103
-		public function group_arguments( $arguments ) {
1103
+		public function group_arguments($arguments) {
1104 1104
 	
1105
-			if ( ! empty( $arguments ) ) {
1105
+			if (!empty($arguments)) {
1106 1106
 				$temp_arguments = array();
1107
-				$general        = __( "General" );
1107
+				$general        = __("General");
1108 1108
 				$add_sections   = false;
1109
-				foreach ( $arguments as $key => $args ) {
1110
-					if ( isset( $args['group'] ) ) {
1111
-						$temp_arguments[ $args['group'] ][ $key ] = $args;
1109
+				foreach ($arguments as $key => $args) {
1110
+					if (isset($args['group'])) {
1111
+						$temp_arguments[$args['group']][$key] = $args;
1112 1112
 						$add_sections                             = true;
1113 1113
 					} else {
1114
-						$temp_arguments[ $general ][ $key ] = $args;
1114
+						$temp_arguments[$general][$key] = $args;
1115 1115
 					}
1116 1116
 				}
1117 1117
 	
1118 1118
 				// only add sections if more than one
1119
-				if ( $add_sections ) {
1119
+				if ($add_sections) {
1120 1120
 					$arguments = $temp_arguments;
1121 1121
 				}
1122 1122
 			}
@@ -1124,23 +1124,23 @@  discard block
 block discarded – undo
1124 1124
 			return $arguments;
1125 1125
 		}
1126 1126
 	
1127
-		public function widget_inputs_row_start($key, $args){
1128
-			if(!empty($args['row'])){
1127
+		public function widget_inputs_row_start($key, $args) {
1128
+			if (!empty($args['row'])) {
1129 1129
 				// maybe open
1130
-				if(!empty($args['row']['open'])){
1130
+				if (!empty($args['row']['open'])) {
1131 1131
 					?>
1132
-					<div class='bsui sd-argument ' data-argument='<?php echo esc_attr( $args['row']['key'] ); ?>' data-element_require='<?php if ( !empty($args['row']['element_require'])) {
1133
-						echo $this->convert_element_require( $args['row']['element_require'] );
1132
+					<div class='bsui sd-argument ' data-argument='<?php echo esc_attr($args['row']['key']); ?>' data-element_require='<?php if (!empty($args['row']['element_require'])) {
1133
+						echo $this->convert_element_require($args['row']['element_require']);
1134 1134
 					} ?>'>
1135
-					<?php if(!empty($args['row']['title'])){ ?>
1136
-					<label class="mb-0 "><?php echo esc_attr( $args['row']['title'] ); ?><?php echo $this->widget_field_desc( $args['row'] ); ?></label>
1135
+					<?php if (!empty($args['row']['title'])) { ?>
1136
+					<label class="mb-0 "><?php echo esc_attr($args['row']['title']); ?><?php echo $this->widget_field_desc($args['row']); ?></label>
1137 1137
 					<?php }?>
1138
-					<div class='row <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>'>
1138
+					<div class='row <?php if (!empty($args['row']['class'])) { echo esc_attr($args['row']['class']); } ?>'>
1139 1139
 					<div class='col pr-2'>
1140 1140
 					<?php
1141
-				}elseif(!empty($args['row']['close'])){
1141
+				}elseif (!empty($args['row']['close'])) {
1142 1142
 					echo "<div class='col pl-0'>";
1143
-				}else{
1143
+				} else {
1144 1144
 					echo "<div class='col pl-0 pr-2'>";
1145 1145
 				}
1146 1146
 			}
@@ -1155,14 +1155,14 @@  discard block
 block discarded – undo
1155 1155
 		 *
1156 1156
 		 * @return string $output
1157 1157
 		 */
1158
-		public function convert_element_require( $input ) {
1158
+		public function convert_element_require($input) {
1159 1159
 	
1160
-			$input = str_replace( "'", '"', $input );// we only want double quotes
1160
+			$input = str_replace("'", '"', $input); // we only want double quotes
1161 1161
 	
1162
-			$output = esc_attr( str_replace( array( "[%", "%]" ), array(
1162
+			$output = esc_attr(str_replace(array("[%", "%]"), array(
1163 1163
 				"jQuery(form).find('[data-argument=\"",
1164 1164
 				"\"]').find('input,select,textarea').val()"
1165
-			), $input ) );
1165
+			), $input));
1166 1166
 	
1167 1167
 			return $output;
1168 1168
 		}
@@ -1175,14 +1175,14 @@  discard block
 block discarded – undo
1175 1175
 		 * @return string
1176 1176
 		 * @todo, need to make its own tooltip script
1177 1177
 		 */
1178
-		public function widget_field_desc( $args ) {
1178
+		public function widget_field_desc($args) {
1179 1179
 	
1180 1180
 			$description = '';
1181
-			if ( isset( $args['desc'] ) && $args['desc'] ) {
1182
-				if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
1183
-					$description = $this->desc_tip( $args['desc'] );
1181
+			if (isset($args['desc']) && $args['desc']) {
1182
+				if (isset($args['desc_tip']) && $args['desc_tip']) {
1183
+					$description = $this->desc_tip($args['desc']);
1184 1184
 				} else {
1185
-					$description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
1185
+					$description = '<span class="description">' . wp_kses_post($args['desc']) . '</span>';
1186 1186
 				}
1187 1187
 			}
1188 1188
 	
@@ -1197,11 +1197,11 @@  discard block
 block discarded – undo
1197 1197
 		 *
1198 1198
 		 * @return string
1199 1199
 		 */
1200
-		public function desc_tip( $tip, $allow_html = false ) {
1201
-			if ( $allow_html ) {
1202
-				$tip = $this->sanitize_tooltip( $tip );
1200
+		public function desc_tip($tip, $allow_html = false) {
1201
+			if ($allow_html) {
1202
+				$tip = $this->sanitize_tooltip($tip);
1203 1203
 			} else {
1204
-				$tip = esc_attr( $tip );
1204
+				$tip = esc_attr($tip);
1205 1205
 			}
1206 1206
 	
1207 1207
 			return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
@@ -1214,8 +1214,8 @@  discard block
 block discarded – undo
1214 1214
 		 *
1215 1215
 		 * @return string
1216 1216
 		 */
1217
-		public function sanitize_tooltip( $var ) {
1218
-			return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
1217
+		public function sanitize_tooltip($var) {
1218
+			return htmlspecialchars(wp_kses(html_entity_decode($var), array(
1219 1219
 				'br'     => array(),
1220 1220
 				'em'     => array(),
1221 1221
 				'strong' => array(),
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
 				'li'     => array(),
1226 1226
 				'ol'     => array(),
1227 1227
 				'p'      => array(),
1228
-			) ) );
1228
+			)));
1229 1229
 		}
1230 1230
 	
1231 1231
 		/**
@@ -1234,56 +1234,56 @@  discard block
 block discarded – undo
1234 1234
 		 * @param $args
1235 1235
 		 * @param $instance
1236 1236
 		 */
1237
-		public function widget_inputs( $args, $instance ) {
1237
+		public function widget_inputs($args, $instance) {
1238 1238
 	
1239 1239
 			$class             = "";
1240 1240
 			$element_require   = "";
1241 1241
 			$custom_attributes = "";
1242 1242
 	
1243 1243
 			// get value
1244
-			if ( isset( $instance[ $args['name'] ] ) ) {
1245
-				$value = $instance[ $args['name'] ];
1246
-			} elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
1247
-				$value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
1244
+			if (isset($instance[$args['name']])) {
1245
+				$value = $instance[$args['name']];
1246
+			} elseif (!isset($instance[$args['name']]) && !empty($args['default'])) {
1247
+				$value = is_array($args['default']) ? array_map("esc_html", $args['default']) : esc_html($args['default']);
1248 1248
 			} else {
1249 1249
 				$value = '';
1250 1250
 			}
1251 1251
 	
1252 1252
 			// get placeholder
1253
-			if ( ! empty( $args['placeholder'] ) ) {
1254
-				$placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
1253
+			if (!empty($args['placeholder'])) {
1254
+				$placeholder = "placeholder='" . esc_html($args['placeholder']) . "'";
1255 1255
 			} else {
1256 1256
 				$placeholder = '';
1257 1257
 			}
1258 1258
 	
1259 1259
 			// get if advanced
1260
-			if ( isset( $args['advanced'] ) && $args['advanced'] ) {
1260
+			if (isset($args['advanced']) && $args['advanced']) {
1261 1261
 				$class .= " sd-advanced-setting ";
1262 1262
 			}
1263 1263
 	
1264 1264
 			// element_require
1265
-			if ( isset( $args['element_require'] ) && $args['element_require'] ) {
1265
+			if (isset($args['element_require']) && $args['element_require']) {
1266 1266
 				$element_require = $args['element_require'];
1267 1267
 			}
1268 1268
 	
1269 1269
 			// custom_attributes
1270
-			if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
1271
-				$custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
1270
+			if (isset($args['custom_attributes']) && $args['custom_attributes']) {
1271
+				$custom_attributes = $this->array_to_attributes($args['custom_attributes'], true);
1272 1272
 			}
1273 1273
 	
1274 1274
 	
1275 1275
 			// before wrapper
1276 1276
 			?>
1277
-			<p class="sd-argument <?php echo esc_attr( $class ); ?>"
1278
-			data-argument='<?php echo esc_attr( $args['name'] ); ?>'
1279
-			data-element_require='<?php if ( $element_require ) {
1280
-				echo $this->convert_element_require( $element_require );
1277
+			<p class="sd-argument <?php echo esc_attr($class); ?>"
1278
+			data-argument='<?php echo esc_attr($args['name']); ?>'
1279
+			data-element_require='<?php if ($element_require) {
1280
+				echo $this->convert_element_require($element_require);
1281 1281
 			} ?>'
1282 1282
 			>
1283 1283
 			<?php
1284 1284
 	
1285 1285
 	
1286
-			switch ( $args['type'] ) {
1286
+			switch ($args['type']) {
1287 1287
 				//array('text','password','number','email','tel','url','color')
1288 1288
 				case "text":
1289 1289
 				case "password":
@@ -1294,46 +1294,46 @@  discard block
 block discarded – undo
1294 1294
 				case "color":
1295 1295
 					?>
1296 1296
 					<label
1297
-						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label>
1297
+						for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label>
1298 1298
 					<input <?php echo $placeholder; ?> class="widefat"
1299 1299
 						<?php echo $custom_attributes; ?>
1300
-													   id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
1301
-													   name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>"
1302
-													   type="<?php echo esc_attr( $args['type'] ); ?>"
1303
-													   value="<?php echo esc_attr( $value ); ?>">
1300
+													   id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
1301
+													   name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>"
1302
+													   type="<?php echo esc_attr($args['type']); ?>"
1303
+													   value="<?php echo esc_attr($value); ?>">
1304 1304
 					<?php
1305 1305
 	
1306 1306
 					break;
1307 1307
 				case "select":
1308
-					$multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
1309
-					if ( $multiple ) {
1310
-						if ( empty( $value ) ) {
1308
+					$multiple = isset($args['multiple']) && $args['multiple'] ? true : false;
1309
+					if ($multiple) {
1310
+						if (empty($value)) {
1311 1311
 							$value = array();
1312 1312
 						}
1313 1313
 					}
1314 1314
 					?>
1315 1315
 					<label
1316
-						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
1316
+						for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label>
1317 1317
 					<select <?php echo $placeholder; ?> class="widefat"
1318 1318
 						<?php echo $custom_attributes; ?>
1319
-														id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
1320
-														name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) );
1321
-														if ( $multiple ) {
1319
+														id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
1320
+														name="<?php echo esc_attr($this->get_field_name($args['name']));
1321
+														if ($multiple) {
1322 1322
 															echo "[]";
1323 1323
 														} ?>"
1324
-						<?php if ( $multiple ) {
1324
+						<?php if ($multiple) {
1325 1325
 							echo "multiple";
1326 1326
 						} //@todo not implemented yet due to gutenberg not supporting it
1327 1327
 						?>
1328 1328
 					>
1329 1329
 						<?php
1330 1330
 	
1331
-						if ( ! empty( $args['options'] ) ) {
1332
-							foreach ( $args['options'] as $val => $label ) {
1333
-								if ( $multiple ) {
1334
-									$selected = in_array( $val, $value ) ? 'selected="selected"' : '';
1331
+						if (!empty($args['options'])) {
1332
+							foreach ($args['options'] as $val => $label) {
1333
+								if ($multiple) {
1334
+									$selected = in_array($val, $value) ? 'selected="selected"' : '';
1335 1335
 								} else {
1336
-									$selected = selected( $value, $val, false );
1336
+									$selected = selected($value, $val, false);
1337 1337
 								}
1338 1338
 								echo "<option value='$val' " . $selected . ">$label</option>";
1339 1339
 							}
@@ -1345,32 +1345,32 @@  discard block
 block discarded – undo
1345 1345
 				case "checkbox":
1346 1346
 					?>
1347 1347
 					<input <?php echo $placeholder; ?>
1348
-						<?php checked( 1, $value, true ) ?>
1348
+						<?php checked(1, $value, true) ?>
1349 1349
 						<?php echo $custom_attributes; ?>
1350
-						class="widefat" id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
1351
-						name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="checkbox"
1350
+						class="widefat" id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
1351
+						name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="checkbox"
1352 1352
 						value="1">
1353 1353
 					<label
1354
-						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label>
1354
+						for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label>
1355 1355
 					<?php
1356 1356
 					break;
1357 1357
 				case "textarea":
1358 1358
 					?>
1359 1359
 					<label
1360
-						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
1360
+						for="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"><?php echo $this->widget_field_title($args); ?><?php echo $this->widget_field_desc($args); ?></label>
1361 1361
 					<textarea <?php echo $placeholder; ?> class="widefat"
1362 1362
 						<?php echo $custom_attributes; ?>
1363
-														  id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
1364
-														  name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>"
1365
-					><?php echo esc_attr( $value ); ?></textarea>
1363
+														  id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
1364
+														  name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>"
1365
+					><?php echo esc_attr($value); ?></textarea>
1366 1366
 					<?php
1367 1367
 	
1368 1368
 					break;
1369 1369
 				case "hidden":
1370 1370
 					?>
1371
-					<input id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
1372
-						   name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="hidden"
1373
-						   value="<?php echo esc_attr( $value ); ?>">
1371
+					<input id="<?php echo esc_attr($this->get_field_id($args['name'])); ?>"
1372
+						   name="<?php echo esc_attr($this->get_field_name($args['name'])); ?>" type="hidden"
1373
+						   value="<?php echo esc_attr($value); ?>">
1374 1374
 					<?php
1375 1375
 					break;
1376 1376
 				default:
@@ -1392,25 +1392,25 @@  discard block
 block discarded – undo
1392 1392
 		 *
1393 1393
 		 * @return string
1394 1394
 		 */
1395
-		public function array_to_attributes( $attributes, $html = false ) {
1395
+		public function array_to_attributes($attributes, $html = false) {
1396 1396
 	
1397
-			if ( ! is_array( $attributes ) ) {
1397
+			if (!is_array($attributes)) {
1398 1398
 				return '';
1399 1399
 			}
1400 1400
 	
1401 1401
 			$output = '';
1402
-			foreach ( $attributes as $name => $value ) {
1402
+			foreach ($attributes as $name => $value) {
1403 1403
 	
1404
-				if ( $html ) {
1404
+				if ($html) {
1405 1405
 	
1406
-					if ( true === $value ) {
1407
-						$output .= esc_html( $name ) . ' ';
1408
-					} else if ( false !== $value ) {
1409
-						$output .= sprintf( '%s="%s" ', esc_html( $name ), trim( esc_attr( $value ) ) );
1406
+					if (true === $value) {
1407
+						$output .= esc_html($name) . ' ';
1408
+					} else if (false !== $value) {
1409
+						$output .= sprintf('%s="%s" ', esc_html($name), trim(esc_attr($value)));
1410 1410
 					}
1411 1411
 	
1412 1412
 				} else {
1413
-					$output .= sprintf( "'%s': '%s',", esc_js( $name ), is_bool( $value ) ? $value : trim( esc_js( $value ) ) );
1413
+					$output .= sprintf("'%s': '%s',", esc_js($name), is_bool($value) ? $value : trim(esc_js($value)));
1414 1414
 				}
1415 1415
 	
1416 1416
 			}
@@ -1431,10 +1431,10 @@  discard block
 block discarded – undo
1431 1431
 		 *
1432 1432
 		 * @return string ID attribute for `$field_name`.
1433 1433
 		 */
1434
-		public function get_field_id( $field_name ) {
1434
+		public function get_field_id($field_name) {
1435 1435
 	
1436
-			$field_name = str_replace( array( '[]', '[', ']' ), array( '', '-', '' ), $field_name );
1437
-			$field_name = trim( $field_name, '-' );
1436
+			$field_name = str_replace(array('[]', '[', ']'), array('', '-', ''), $field_name);
1437
+			$field_name = trim($field_name, '-');
1438 1438
 	
1439 1439
 			return 'widget-' . $this->base_id . '-' . $this->get_number() . '-' . $field_name;
1440 1440
 		}
@@ -1447,13 +1447,13 @@  discard block
 block discarded – undo
1447 1447
 		public function get_number() {
1448 1448
 			static $number = 1;
1449 1449
 	
1450
-			if ( isset( $this->output_types['widget'] ) ) {
1450
+			if (isset($this->output_types['widget'])) {
1451 1451
 				return $this->output_types['widget']->number;
1452 1452
 			}
1453 1453
 	
1454
-			if ( empty( $this->number ) ) {
1454
+			if (empty($this->number)) {
1455 1455
 				$this->number = $number;
1456
-				$number ++;
1456
+				$number++;
1457 1457
 			}
1458 1458
 	
1459 1459
 			return $this->number;
@@ -1466,12 +1466,12 @@  discard block
 block discarded – undo
1466 1466
 		 *
1467 1467
 		 * @return string
1468 1468
 		 */
1469
-		public function widget_field_title( $args ) {
1469
+		public function widget_field_title($args) {
1470 1470
 	
1471 1471
 			$title = '';
1472
-			if ( isset( $args['title'] ) && $args['title'] ) {
1473
-				if ( isset( $args['icon'] ) && $args['icon'] ) {
1474
-					$title = $this->get_widget_icon( $args['icon'], $args['title']  );
1472
+			if (isset($args['title']) && $args['title']) {
1473
+				if (isset($args['icon']) && $args['icon']) {
1474
+					$title = $this->get_widget_icon($args['icon'], $args['title']);
1475 1475
 				} else {
1476 1476
 					$title = esc_attr($args['title']);
1477 1477
 				}
@@ -1485,15 +1485,15 @@  discard block
 block discarded – undo
1485 1485
 		 *
1486 1486
 		 * @return array
1487 1487
 		 */
1488
-		public function get_widget_icon( $icon = 'box-top', $title = '' ) {
1489
-			if($icon=='box-top'){
1490
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
1491
-			}elseif($icon=='box-right'){
1492
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
1493
-			}elseif($icon=='box-bottom'){
1494
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
1495
-			}elseif($icon=='box-left'){
1496
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
1488
+		public function get_widget_icon($icon = 'box-top', $title = '') {
1489
+			if ($icon == 'box-top') {
1490
+				return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
1491
+			}elseif ($icon == 'box-right') {
1492
+				return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
1493
+			}elseif ($icon == 'box-bottom') {
1494
+				return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
1495
+			}elseif ($icon == 'box-left') {
1496
+				return '<svg title="' . esc_attr($title) . '" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
1497 1497
 			}
1498 1498
 		}
1499 1499
 	
@@ -1510,12 +1510,12 @@  discard block
 block discarded – undo
1510 1510
 		 *
1511 1511
 		 * @return string Name attribute for `$field_name`.
1512 1512
 		 */
1513
-		public function get_field_name( $field_name ) {
1514
-			$pos = strpos( $field_name, '[' );
1513
+		public function get_field_name($field_name) {
1514
+			$pos = strpos($field_name, '[');
1515 1515
 	
1516
-			if ( false !== $pos ) {
1516
+			if (false !== $pos) {
1517 1517
 				// Replace the first occurrence of '[' with ']['.
1518
-				$field_name = '[' . substr_replace( $field_name, '][', $pos, strlen( '[' ) );
1518
+				$field_name = '[' . substr_replace($field_name, '][', $pos, strlen('['));
1519 1519
 			} else {
1520 1520
 				$field_name = '[' . $field_name . ']';
1521 1521
 			}
@@ -1523,10 +1523,10 @@  discard block
 block discarded – undo
1523 1523
 			return 'widget-' . $this->base_id . '[' . $this->get_number() . ']' . $field_name;
1524 1524
 		}
1525 1525
 	
1526
-		public function widget_inputs_row_end($key, $args){
1527
-			if(!empty($args['row'])){
1526
+		public function widget_inputs_row_end($key, $args) {
1527
+			if (!empty($args['row'])) {
1528 1528
 				// maybe close
1529
-				if(!empty($args['row']['close'])){
1529
+				if (!empty($args['row']['close'])) {
1530 1530
 					echo "</div></div>";
1531 1531
 				}
1532 1532
 	
@@ -1542,14 +1542,14 @@  discard block
 block discarded – undo
1542 1542
 		 * @since 1.0.20
1543 1543
 		 * @return string
1544 1544
 		 */
1545
-		public function get_instance_style($rules = array()){
1545
+		public function get_instance_style($rules = array()) {
1546 1546
 			$css = '';
1547 1547
 	
1548
-			if(!empty($rules)){
1548
+			if (!empty($rules)) {
1549 1549
 				$rules = array_unique($rules);
1550 1550
 				$instance_hash = $this->get_instance_hash();
1551 1551
 				$css .= "<style>";
1552
-				foreach($rules as $rule){
1552
+				foreach ($rules as $rule) {
1553 1553
 					$css .= ".sdel-$instance_hash $rule";
1554 1554
 				}
1555 1555
 				$css .= "</style>";
@@ -1564,9 +1564,9 @@  discard block
 block discarded – undo
1564 1564
 		 * @since 1.0.20
1565 1565
 		 * @return string
1566 1566
 		 */
1567
-		public function get_instance_hash(){
1568
-			$instance_string = $this->base_id . serialize( $this->instance );
1569
-			return hash( 'crc32b', $instance_string );
1567
+		public function get_instance_hash() {
1568
+			$instance_string = $this->base_id . serialize($this->instance);
1569
+			return hash('crc32b', $instance_string);
1570 1570
 		}
1571 1571
 	
1572 1572
 		/**
@@ -2075,12 +2075,12 @@  discard block
 block discarded – undo
2075 2075
 					}
2076 2076
 				});
2077 2077
 			}
2078
-			<?php do_action( 'wp_super_duper_conditional_fields_js', $this ); ?>
2078
+			<?php do_action('wp_super_duper_conditional_fields_js', $this); ?>
2079 2079
 			</script>
2080 2080
 						<?php
2081 2081
 						$output = ob_get_clean();
2082 2082
 	
2083
-						return str_replace( array( '<script>', '</script>' ), '', trim( $output ) );
2083
+						return str_replace(array('<script>', '</script>'), '', trim($output));
2084 2084
 			}
2085 2085
 	
2086 2086
 		/**
@@ -2091,36 +2091,36 @@  discard block
 block discarded – undo
2091 2091
 		 *
2092 2092
 		 * @return string
2093 2093
 		 */
2094
-		public function output_title( $args, $instance = array() ) {
2094
+		public function output_title($args, $instance = array()) {
2095 2095
 			$output = '';
2096 2096
 	
2097
-			if ( ! empty( $instance['title'] ) ) {
2097
+			if (!empty($instance['title'])) {
2098 2098
 				/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
2099
-				$title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->base_id );
2099
+				$title = apply_filters('widget_title', $instance['title'], $instance, $this->base_id);
2100 2100
 	
2101
-				if ( empty( $instance['widget_title_tag'] ) ) {
2101
+				if (empty($instance['widget_title_tag'])) {
2102 2102
 					$output = $args['before_title'] . $title . $args['after_title'];
2103 2103
 				} else {
2104
-					$title_tag = esc_attr( $instance['widget_title_tag'] );
2104
+					$title_tag = esc_attr($instance['widget_title_tag']);
2105 2105
 	
2106 2106
 					// classes
2107 2107
 					$title_classes = array();
2108
-					$title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
2109
-					$title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
2110
-					$title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
2111
-					$title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
2112
-					$title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
2113
-					$title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
2114
-					$title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
2115
-					$title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
2116
-					$title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
2117
-					$title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
2118
-					$title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
2119
-					$title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
2120
-					$title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
2121
-					$title_classes   = array_filter( $title_classes );
2122
-	
2123
-					$class  = ! empty( $title_classes ) ? implode( ' ', $title_classes ) : '';
2108
+					$title_classes[] = !empty($instance['widget_title_size_class']) ? sanitize_html_class($instance['widget_title_size_class']) : '';
2109
+					$title_classes[] = !empty($instance['widget_title_align_class']) ? sanitize_html_class($instance['widget_title_align_class']) : '';
2110
+					$title_classes[] = !empty($instance['widget_title_color_class']) ? "text-" . sanitize_html_class($instance['widget_title_color_class']) : '';
2111
+					$title_classes[] = !empty($instance['widget_title_border_class']) ? sanitize_html_class($instance['widget_title_border_class']) : '';
2112
+					$title_classes[] = !empty($instance['widget_title_border_color_class']) ? "border-" . sanitize_html_class($instance['widget_title_border_color_class']) : '';
2113
+					$title_classes[] = !empty($instance['widget_title_mt_class']) ? "mt-" . absint($instance['widget_title_mt_class']) : '';
2114
+					$title_classes[] = !empty($instance['widget_title_mr_class']) ? "mr-" . absint($instance['widget_title_mr_class']) : '';
2115
+					$title_classes[] = !empty($instance['widget_title_mb_class']) ? "mb-" . absint($instance['widget_title_mb_class']) : '';
2116
+					$title_classes[] = !empty($instance['widget_title_ml_class']) ? "ml-" . absint($instance['widget_title_ml_class']) : '';
2117
+					$title_classes[] = !empty($instance['widget_title_pt_class']) ? "pt-" . absint($instance['widget_title_pt_class']) : '';
2118
+					$title_classes[] = !empty($instance['widget_title_pr_class']) ? "pr-" . absint($instance['widget_title_pr_class']) : '';
2119
+					$title_classes[] = !empty($instance['widget_title_pb_class']) ? "pb-" . absint($instance['widget_title_pb_class']) : '';
2120
+					$title_classes[] = !empty($instance['widget_title_pl_class']) ? "pl-" . absint($instance['widget_title_pl_class']) : '';
2121
+					$title_classes   = array_filter($title_classes);
2122
+	
2123
+					$class  = !empty($title_classes) ? implode(' ', $title_classes) : '';
2124 2124
 					$output = "<$title_tag class='$class' >$title</$title_tag>";
2125 2125
 				}
2126 2126
 	
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1138,9 +1138,9 @@  discard block
 block discarded – undo
1138 1138
 					<div class='row <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>'>
1139 1139
 					<div class='col pr-2'>
1140 1140
 					<?php
1141
-				}elseif(!empty($args['row']['close'])){
1141
+				} elseif(!empty($args['row']['close'])){
1142 1142
 					echo "<div class='col pl-0'>";
1143
-				}else{
1143
+				} else{
1144 1144
 					echo "<div class='col pl-0 pr-2'>";
1145 1145
 				}
1146 1146
 			}
@@ -1488,11 +1488,11 @@  discard block
 block discarded – undo
1488 1488
 		public function get_widget_icon( $icon = 'box-top', $title = '' ) {
1489 1489
 			if($icon=='box-top'){
1490 1490
 				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
1491
-			}elseif($icon=='box-right'){
1491
+			} elseif($icon=='box-right'){
1492 1492
 				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
1493
-			}elseif($icon=='box-bottom'){
1493
+			} elseif($icon=='box-bottom'){
1494 1494
 				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
1495
-			}elseif($icon=='box-left'){
1495
+			} elseif($icon=='box-left'){
1496 1496
 				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
1497 1497
 			}
1498 1498
 		}
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/type/block.php 3 patches
Indentation   +546 added lines, -546 removed lines patch added patch discarded remove patch
@@ -17,103 +17,103 @@  discard block
 block discarded – undo
17 17
  */
18 18
 class WP_Super_Duper_Block {
19 19
 
20
-	/**
21
-	 * @var WP_Super_Duper
22
-	 */
23
-	protected $sd;
24
-
25
-	/**
26
-	 * Class constructor.
27
-	 *
28
-	 * @param WP_Super_Duper $super_duper
29
-	 */
30
-	public function __construct( $super_duper ) {
31
-
32
-		$this->sd = $super_duper;
33
-
34
-		// Process the SD shortcode preview.
35
-		add_action( 'wp_ajax_super_duper_output_shortcode', array( __CLASS__, 'render_shortcode' ) );
36
-		add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
37
-		add_action( 'admin_footer-post.php', array( $this, 'enqueue_editor_assets' ) );
38
-		add_action( 'admin_footer-post-new.php', array( $this, 'enqueue_editor_assets' ) );
39
-	}
40
-
41
-	/**
42
-	 * Render the shortcode via ajax so we can return it to Gutenberg.
43
-	 *
44
-	 * @since 1.0.0
45
-	 */
46
-	public static function render_shortcode() {
47
-
48
-		// Verify nonce.
49
-		check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
50
-
51
-		// And permissions.
52
-		if ( ! current_user_can( 'manage_options' ) ) {
53
-			wp_die();
54
-		}
55
-
56
-		// Ensure a shortcode is provided.
57
-		if ( empty( $_POST['shortcode'] ) ) {
58
-			wp_die();
59
-		}
60
-
61
-		// We might need the $post value here so lets set it.
62
-		if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
63
-			$post_obj = get_post( absint( $_POST['post_id'] ) );
64
-			if ( ! empty( $post_obj ) && empty( $post ) ) {
65
-				global $post;
66
-				$post = $post_obj;
67
-			}
68
-		}
69
-
70
-		// Prepare args.
71
-		$shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
72
-		$attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
73
-		$attributes       = '';
74
-
75
-		// Convert attributes array into a string.
76
-		if ( ! empty( $attributes_array ) ) {
77
-			foreach ( $attributes_array as $key => $value ) {
78
-				if ( is_array( $value ) ) {
79
-					$value = implode( ',', $value );
80
-				}
81
-				$key   = sanitize_title_with_dashes( $key );
82
-				$value = wp_slash( $value );
83
-				$attributes .= " $key='$value' ";
84
-			}
85
-		}
86
-
87
-		echo do_shortcode( "[$shortcode_name $attributes]" );
88
-		exit;
89
-
90
-	}
91
-
92
-	/**
93
-	 * Add the dynamic block code inline when the wp-block in enqueued.
94
-	 */
95
-	public function register_block() {
96
-		wp_add_inline_script( 'wp-blocks', $this->block() );
97
-		if ( class_exists( 'SiteOrigin_Panels' ) ) {
98
-			wp_add_inline_script( 'wp-blocks', WP_Super_Duper::siteorigin_js() );
99
-		}
100
-	}
101
-
102
-	/**
103
-	 * Output the JS for building the dynamic Guntenberg block.
104
-	 *
105
-	 * @since 1.0.4 Added block_wrap property which will set the block wrapping output element ie: div, span, p or empty for no wrap.
106
-	 * @since 1.0.9 Save numbers as numbers and not strings.
107
-	 * @since 1.1.0 Font Awesome classes can be used for icons.
108
-	 * @return mixed
109
-	 */
110
-	public function block() {
111
-		ob_start();
112
-
113
-		$block_name    = str_replace( '_', '-', sanitize_title_with_dashes( $this->sd->options['textdomain'] ) . '/' . sanitize_title_with_dashes( $this->sd->options['class_name'] ) );
114
-		$show_advanced = $this->sd->block_show_advanced();
115
-		$id            = $this->sd->base_id . '-' . $this->sd->get_number();
116
-		?>
20
+    /**
21
+     * @var WP_Super_Duper
22
+     */
23
+    protected $sd;
24
+
25
+    /**
26
+     * Class constructor.
27
+     *
28
+     * @param WP_Super_Duper $super_duper
29
+     */
30
+    public function __construct( $super_duper ) {
31
+
32
+        $this->sd = $super_duper;
33
+
34
+        // Process the SD shortcode preview.
35
+        add_action( 'wp_ajax_super_duper_output_shortcode', array( __CLASS__, 'render_shortcode' ) );
36
+        add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
37
+        add_action( 'admin_footer-post.php', array( $this, 'enqueue_editor_assets' ) );
38
+        add_action( 'admin_footer-post-new.php', array( $this, 'enqueue_editor_assets' ) );
39
+    }
40
+
41
+    /**
42
+     * Render the shortcode via ajax so we can return it to Gutenberg.
43
+     *
44
+     * @since 1.0.0
45
+     */
46
+    public static function render_shortcode() {
47
+
48
+        // Verify nonce.
49
+        check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
50
+
51
+        // And permissions.
52
+        if ( ! current_user_can( 'manage_options' ) ) {
53
+            wp_die();
54
+        }
55
+
56
+        // Ensure a shortcode is provided.
57
+        if ( empty( $_POST['shortcode'] ) ) {
58
+            wp_die();
59
+        }
60
+
61
+        // We might need the $post value here so lets set it.
62
+        if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
63
+            $post_obj = get_post( absint( $_POST['post_id'] ) );
64
+            if ( ! empty( $post_obj ) && empty( $post ) ) {
65
+                global $post;
66
+                $post = $post_obj;
67
+            }
68
+        }
69
+
70
+        // Prepare args.
71
+        $shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
72
+        $attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
73
+        $attributes       = '';
74
+
75
+        // Convert attributes array into a string.
76
+        if ( ! empty( $attributes_array ) ) {
77
+            foreach ( $attributes_array as $key => $value ) {
78
+                if ( is_array( $value ) ) {
79
+                    $value = implode( ',', $value );
80
+                }
81
+                $key   = sanitize_title_with_dashes( $key );
82
+                $value = wp_slash( $value );
83
+                $attributes .= " $key='$value' ";
84
+            }
85
+        }
86
+
87
+        echo do_shortcode( "[$shortcode_name $attributes]" );
88
+        exit;
89
+
90
+    }
91
+
92
+    /**
93
+     * Add the dynamic block code inline when the wp-block in enqueued.
94
+     */
95
+    public function register_block() {
96
+        wp_add_inline_script( 'wp-blocks', $this->block() );
97
+        if ( class_exists( 'SiteOrigin_Panels' ) ) {
98
+            wp_add_inline_script( 'wp-blocks', WP_Super_Duper::siteorigin_js() );
99
+        }
100
+    }
101
+
102
+    /**
103
+     * Output the JS for building the dynamic Guntenberg block.
104
+     *
105
+     * @since 1.0.4 Added block_wrap property which will set the block wrapping output element ie: div, span, p or empty for no wrap.
106
+     * @since 1.0.9 Save numbers as numbers and not strings.
107
+     * @since 1.1.0 Font Awesome classes can be used for icons.
108
+     * @return mixed
109
+     */
110
+    public function block() {
111
+        ob_start();
112
+
113
+        $block_name    = str_replace( '_', '-', sanitize_title_with_dashes( $this->sd->options['textdomain'] ) . '/' . sanitize_title_with_dashes( $this->sd->options['class_name'] ) );
114
+        $show_advanced = $this->sd->block_show_advanced();
115
+        $id            = $this->sd->base_id . '-' . $this->sd->get_number();
116
+        ?>
117 117
 		<script>
118 118
 			/**
119 119
 			 * BLOCK: Basic
@@ -136,10 +136,10 @@  discard block
 block discarded – undo
136 136
 
137 137
 				var term_query_type = '';
138 138
 				var post_type_rest_slugs = <?php if ( ! empty( $this->sd->arguments ) && isset( $this->sd->arguments['post_type']['onchange_rest']['values'] ) ) {
139
-					echo "[" . json_encode( $this->sd->arguments['post_type']['onchange_rest']['values'] ) . "]";
140
-				} else {
141
-					echo "[]";
142
-				} ?>;
139
+                    echo "[" . json_encode( $this->sd->arguments['post_type']['onchange_rest']['values'] ) . "]";
140
+                } else {
141
+                    echo "[]";
142
+                } ?>;
143 143
 				const taxonomies_<?php echo str_replace( "-", "_", $id );?> = [{label: "Please wait", value: 0}];
144 144
 				const sort_by_<?php echo str_replace( "-", "_", $id );?> = [{label: "Please wait", value: 0}];
145 145
 
@@ -161,89 +161,89 @@  discard block
 block discarded – undo
161 161
 					icon: <?php echo $this->get_block_icon( $this->sd->options['block-icon'] );?>,//'<?php echo isset( $this->sd->options['block-icon'] ) ? esc_attr( $this->sd->options['block-icon'] ) : 'shield-alt';?>', // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
162 162
 					supports: {
163 163
 						<?php
164
-						if ( isset( $this->sd->options['block-supports'] ) ) {
165
-							echo $this->sd->array_to_attributes( $this->sd->options['block-supports'] );
166
-						}
167
-						?>
164
+                        if ( isset( $this->sd->options['block-supports'] ) ) {
165
+                            echo $this->sd->array_to_attributes( $this->sd->options['block-supports'] );
166
+                        }
167
+                        ?>
168 168
 					},
169 169
 					category: '<?php echo isset( $this->sd->options['block-category'] ) ? esc_attr( $this->sd->options['block-category'] ) : 'common';?>', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
170 170
 					<?php if ( isset( $this->sd->options['block-keywords'] ) ) {
171
-					echo "keywords : " . $this->sd->options['block-keywords'] . ",";
172
-				}?>
171
+                    echo "keywords : " . $this->sd->options['block-keywords'] . ",";
172
+                }?>
173 173
 
174 174
 					<?php
175 175
 
176
-					// maybe set no_wrap
177
-					$no_wrap = isset( $this->sd->options['no_wrap'] ) && $this->sd->options['no_wrap'] ? true : false;
178
-					if ( isset( $this->sd->arguments['no_wrap'] ) && $this->sd->arguments['no_wrap'] ) {
179
-						$no_wrap = true;
180
-					}
181
-					if ( $no_wrap ) {
182
-						$this->sd->options['block-wrap'] = '';
183
-					}
184
-
185
-					$show_alignment = false;
186
-
187
-					if ( ! empty( $this->sd->arguments ) ) {
188
-						echo "attributes : {";
189
-
190
-						if ( $show_advanced ) {
191
-							echo "show_advanced: {";
192
-							echo "	type: 'boolean',";
193
-							echo "  default: false,";
194
-							echo "},";
195
-						}
196
-
197
-						// block wrap element
198
-						if ( ! empty( $this->sd->options['block-wrap'] ) ) { //@todo we should validate this?
199
-							echo "block_wrap: {";
200
-							echo "	type: 'string',";
201
-							echo "  default: '" . esc_attr( $this->sd->options['block-wrap'] ) . "',";
202
-							echo "},";
203
-						}
204
-
205
-						foreach ( $this->sd->arguments as $key => $args ) {
206
-
207
-							// set if we should show alignment
208
-							if ( $key == 'alignment' ) {
209
-								$show_alignment = true;
210
-							}
211
-
212
-							$extra = '';
213
-
214
-							if ( $args['type'] == 'checkbox' ) {
215
-								$type    = 'boolean';
216
-								$default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false';
217
-							} elseif ( $args['type'] == 'number' ) {
218
-								$type    = 'number';
219
-								$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
220
-							} elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
221
-								$type = 'array';
222
-								if ( isset( $args['default'] ) && is_array( $args['default'] ) ) {
223
-									$default = ! empty( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]";
224
-								} else {
225
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
226
-								}
227
-							} elseif ( $args['type'] == 'multiselect' ) {
228
-								$type    = 'array';
229
-								$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
230
-							} else {
231
-								$type    = 'string';
232
-								$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
233
-							}
234
-							echo str_replace( '-','__', $key ) . " : {";
235
-							echo "type : '$type',";
236
-							echo "default : $default,";
237
-							echo "},";
238
-						}
239
-
240
-						echo "content : {type : 'string',default: 'Please select the attributes in the block settings'},";
241
-						echo "className: { type: 'string', default: '' },";
242
-						echo "},";
243
-
244
-					}
245
-
246
-					?>
176
+                    // maybe set no_wrap
177
+                    $no_wrap = isset( $this->sd->options['no_wrap'] ) && $this->sd->options['no_wrap'] ? true : false;
178
+                    if ( isset( $this->sd->arguments['no_wrap'] ) && $this->sd->arguments['no_wrap'] ) {
179
+                        $no_wrap = true;
180
+                    }
181
+                    if ( $no_wrap ) {
182
+                        $this->sd->options['block-wrap'] = '';
183
+                    }
184
+
185
+                    $show_alignment = false;
186
+
187
+                    if ( ! empty( $this->sd->arguments ) ) {
188
+                        echo "attributes : {";
189
+
190
+                        if ( $show_advanced ) {
191
+                            echo "show_advanced: {";
192
+                            echo "	type: 'boolean',";
193
+                            echo "  default: false,";
194
+                            echo "},";
195
+                        }
196
+
197
+                        // block wrap element
198
+                        if ( ! empty( $this->sd->options['block-wrap'] ) ) { //@todo we should validate this?
199
+                            echo "block_wrap: {";
200
+                            echo "	type: 'string',";
201
+                            echo "  default: '" . esc_attr( $this->sd->options['block-wrap'] ) . "',";
202
+                            echo "},";
203
+                        }
204
+
205
+                        foreach ( $this->sd->arguments as $key => $args ) {
206
+
207
+                            // set if we should show alignment
208
+                            if ( $key == 'alignment' ) {
209
+                                $show_alignment = true;
210
+                            }
211
+
212
+                            $extra = '';
213
+
214
+                            if ( $args['type'] == 'checkbox' ) {
215
+                                $type    = 'boolean';
216
+                                $default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false';
217
+                            } elseif ( $args['type'] == 'number' ) {
218
+                                $type    = 'number';
219
+                                $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
220
+                            } elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
221
+                                $type = 'array';
222
+                                if ( isset( $args['default'] ) && is_array( $args['default'] ) ) {
223
+                                    $default = ! empty( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]";
224
+                                } else {
225
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
226
+                                }
227
+                            } elseif ( $args['type'] == 'multiselect' ) {
228
+                                $type    = 'array';
229
+                                $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
230
+                            } else {
231
+                                $type    = 'string';
232
+                                $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
233
+                            }
234
+                            echo str_replace( '-','__', $key ) . " : {";
235
+                            echo "type : '$type',";
236
+                            echo "default : $default,";
237
+                            echo "},";
238
+                        }
239
+
240
+                        echo "content : {type : 'string',default: 'Please select the attributes in the block settings'},";
241
+                        echo "className: { type: 'string', default: '' },";
242
+                        echo "},";
243
+
244
+                    }
245
+
246
+                    ?>
247 247
 
248 248
 					// The "edit" property must be a valid function.
249 249
 					edit: function (props) {
@@ -251,9 +251,9 @@  discard block
 block discarded – undo
251 251
 
252 252
 						var $value = '';
253 253
 						<?php
254
-						// if we have a post_type and a category then link them
255
-						if( isset( $this->sd->arguments['post_type'] ) && isset( $this->sd->arguments['category'] ) && ! empty( $this->sd->arguments['category']['post_type_linked'] ) ){
256
-						?>
254
+                        // if we have a post_type and a category then link them
255
+                        if( isset( $this->sd->arguments['post_type'] ) && isset( $this->sd->arguments['category'] ) && ! empty( $this->sd->arguments['category']['post_type_linked'] ) ){
256
+                        ?>
257 257
 						if (typeof(prev_attributes[props.id]) != 'undefined') {
258 258
 							$pt = props.attributes.post_type;
259 259
 							if (post_type_rest_slugs.length) {
@@ -270,10 +270,10 @@  discard block
 block discarded – undo
270 270
 							if ($value && 'post_type' in prev_attributes[props.id] && 'category' in prev_attributes[props.id] && run) {
271 271
 								wp.apiFetch({
272 272
 									path: "<?php if ( isset( $this->sd->arguments['post_type']['onchange_rest']['path'] ) ) {
273
-										echo $this->sd->arguments['post_type']['onchange_rest']['path'];
274
-									} else {
275
-										'/wp/v2/"+$value+"/categories/?per_page=100';
276
-									} ?>"
273
+                                        echo $this->sd->arguments['post_type']['onchange_rest']['path'];
274
+                                    } else {
275
+                                        '/wp/v2/"+$value+"/categories/?per_page=100';
276
+                                    } ?>"
277 277
 								}).then(terms => {
278 278
 									while (taxonomies_<?php echo str_replace( "-", "_", $id );?>.length
279 279
 							)
@@ -348,10 +348,10 @@  discard block
 block discarded – undo
348 348
 									'shortcode': '<?php echo $this->sd->options['base_id'];?>',
349 349
 									'attributes': props.attributes,
350 350
 									'post_id': <?php global $post; if ( isset( $post->ID ) ) {
351
-									echo $post->ID;
352
-								} else {
353
-									echo '0';
354
-								}?>,
351
+                                    echo $post->ID;
352
+                                } else {
353
+                                    echo '0';
354
+                                }?>,
355 355
 									'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
356 356
 								};
357 357
 
@@ -403,10 +403,10 @@  discard block
 block discarded – undo
403 403
 
404 404
 								<?php
405 405
 
406
-								if(! empty( $this->sd->arguments )){
406
+                                if(! empty( $this->sd->arguments )){
407 407
 
408
-								if ( $show_advanced ) {
409
-								?>
408
+                                if ( $show_advanced ) {
409
+                                ?>
410 410
 								el('div', {
411 411
 										style: {'padding-left': '16px', 'padding-right': '16px'}
412 412
 									},
@@ -424,78 +424,78 @@  discard block
 block discarded – undo
424 424
 								,
425 425
 								<?php
426 426
 
427
-								}
427
+                                }
428 428
 
429
-								$arguments = $this->sd->group_arguments( $this->sd->arguments );
429
+                                $arguments = $this->sd->group_arguments( $this->sd->arguments );
430 430
 
431
-								// Do we have sections?
432
-								$has_sections = $arguments == $this->sd->arguments ? false : true;
431
+                                // Do we have sections?
432
+                                $has_sections = $arguments == $this->sd->arguments ? false : true;
433 433
 
434 434
 
435
-								if($has_sections){
436
-								$panel_count = 0;
437
-								foreach($arguments as $key => $args){
438
-								?>
435
+                                if($has_sections){
436
+                                $panel_count = 0;
437
+                                foreach($arguments as $key => $args){
438
+                                ?>
439 439
 								el(wp.components.PanelBody, {
440 440
 										title: '<?php esc_attr_e( $key ); ?>',
441 441
 										initialOpen: <?php if ( $panel_count ) {
442
-										echo "false";
443
-									} else {
444
-										echo "true";
445
-									}?>
442
+                                        echo "false";
443
+                                    } else {
444
+                                        echo "true";
445
+                                    }?>
446 446
 									},
447 447
 									<?php
448 448
 
449
-									foreach ( $args as $k => $a ) {
450
-										$k = str_replace('-','__', $k);
451
-										$this->block_row_start( $k, $a );
452
-										$this->build_block_arguments( $k, $a );
453
-										$this->block_row_end( $k, $a );
454
-									}
455
-									?>
449
+                                    foreach ( $args as $k => $a ) {
450
+                                        $k = str_replace('-','__', $k);
451
+                                        $this->block_row_start( $k, $a );
452
+                                        $this->build_block_arguments( $k, $a );
453
+                                        $this->block_row_end( $k, $a );
454
+                                    }
455
+                                    ?>
456 456
 								),
457 457
 								<?php
458
-								$panel_count ++;
458
+                                $panel_count ++;
459 459
 
460
-								}
461
-								}else {
462
-								?>
460
+                                }
461
+                                }else {
462
+                                ?>
463 463
 								el(wp.components.PanelBody, {
464 464
 										title: '<?php esc_attr_e( "Settings" ); ?>',
465 465
 										initialOpen: true
466 466
 									},
467 467
 									<?php
468
-									foreach ( $this->sd->arguments as $key => $args ) {
469
-										$key = str_replace('-','__', $key);
470
-										$this->block_row_start( $key, $args );
471
-										$this->build_block_arguments( $key, $args );
472
-										$this->block_row_end( $key, $args );
473
-									}
474
-									?>
468
+                                    foreach ( $this->sd->arguments as $key => $args ) {
469
+                                        $key = str_replace('-','__', $key);
470
+                                        $this->block_row_start( $key, $args );
471
+                                        $this->build_block_arguments( $key, $args );
472
+                                        $this->block_row_end( $key, $args );
473
+                                    }
474
+                                    ?>
475 475
 								),
476 476
 								<?php
477
-								}
477
+                                }
478 478
 
479
-								}
480
-								?>
479
+                                }
480
+                                ?>
481 481
 
482 482
 							),
483 483
 
484 484
 							<?php
485
-							// If the user sets block-output array then build it
486
-							if ( ! empty( $this->sd->options['block-output'] ) ) {
487
-							$this->block_element( $this->sd->options['block-output'] );
488
-						}else{
489
-							// if no block-output is set then we try and get the shortcode html output via ajax.
490
-							?>
485
+                            // If the user sets block-output array then build it
486
+                            if ( ! empty( $this->sd->options['block-output'] ) ) {
487
+                            $this->block_element( $this->sd->options['block-output'] );
488
+                        }else{
489
+                            // if no block-output is set then we try and get the shortcode html output via ajax.
490
+                            ?>
491 491
 							el('div', {
492 492
 								dangerouslySetInnerHTML: {__html: onChangeContent()},
493 493
 								className: props.className,
494 494
 								style: {'minHeight': '30px'}
495 495
 							})
496 496
 							<?php
497
-							}
498
-							?>
497
+                            }
498
+                            ?>
499 499
 						]; // end return
500 500
 					},
501 501
 
@@ -539,11 +539,11 @@  discard block
 block discarded – undo
539 539
 						$html = '';
540 540
 						<?php
541 541
 
542
-						if(! empty( $this->sd->arguments )){
542
+                        if(! empty( $this->sd->arguments )){
543 543
 
544
-						foreach($this->sd->arguments as $key => $args){
545
-						$key = str_replace('-','__', $key);
546
-						?>
544
+                        foreach($this->sd->arguments as $key => $args){
545
+                        $key = str_replace('-','__', $key);
546
+                        ?>
547 547
 						if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) {
548 548
 							if ('<?php echo esc_attr( $key );?>' == 'html') {
549 549
 								$html = attr.<?php echo esc_attr( $key );?>;
@@ -552,10 +552,10 @@  discard block
 block discarded – undo
552 552
 							}
553 553
 						}
554 554
 						<?php
555
-						}
556
-						}
555
+                        }
556
+                        }
557 557
 
558
-						?>
558
+                        ?>
559 559
 						content += "]";
560 560
 
561 561
 						// if has html element
@@ -578,20 +578,20 @@  discard block
 block discarded – undo
578 578
 						}
579 579
 
580 580
 						<?php
581
-						if(isset( $this->sd->options['block-wrap'] ) && $this->sd->options['block-wrap'] == ''){
582
-						?>
581
+                        if(isset( $this->sd->options['block-wrap'] ) && $this->sd->options['block-wrap'] == ''){
582
+                        ?>
583 583
 						return content;
584 584
 						<?php
585
-						}else{
586
-						?>
585
+                        }else{
586
+                        ?>
587 587
 						var block_wrap = 'div';
588 588
 						if (attr.hasOwnProperty("block_wrap")) {
589 589
 							block_wrap = attr.block_wrap;
590 590
 						}
591 591
 						return el(block_wrap, {dangerouslySetInnerHTML: {__html: content}, className: align});
592 592
 						<?php
593
-						}
594
-						?>
593
+                        }
594
+                        ?>
595 595
 
596 596
 
597 597
 					}
@@ -599,62 +599,62 @@  discard block
 block discarded – undo
599 599
 			})();
600 600
 		</script>
601 601
 		<?php
602
-		$output = ob_get_clean();
602
+        $output = ob_get_clean();
603 603
 
604
-		/*
604
+        /*
605 605
 		 * We only add the <script> tags for code highlighting, so we strip them from the output.
606 606
 		 */
607 607
 
608
-		return str_replace( array(
609
-			'<script>',
610
-			'</script>'
611
-		), '', $output );
612
-	}
613
-
614
-	/**
615
-	 * Generate the block icon.
616
-	 *
617
-	 * Enables the use of Font Awesome icons.
618
-	 *
619
-	 * @note xlink:href is actually deprecated but href is not supported by all so we use both.
620
-	 *
621
-	 * @param $icon
622
-	 *
623
-	 * @since 1.1.0
624
-	 * @return string
625
-	 */
626
-	public function get_block_icon( $icon ) {
627
-
628
-		// check if we have a Font Awesome icon
629
-		$fa_type = '';
630
-		if ( substr( $icon, 0, 7 ) === 'fas fa-' ) {
631
-			$fa_type = 'solid';
632
-		} elseif ( substr( $icon, 0, 7 ) === 'far fa-' ) {
633
-			$fa_type = 'regular';
634
-		} elseif ( substr( $icon, 0, 7 ) === 'fab fa-' ) {
635
-			$fa_type = 'brands';
636
-		} else {
637
-			$icon = sprintf( "'%s'", esc_js( $icon ) );
638
-		}
639
-
640
-		// set the icon if we found one
641
-		if ( $fa_type ) {
642
-			$fa_icon = substr( $icon, 7 );
643
-			$icon    = "el('svg',{width: 20, height: 20, viewBox: '0 0 20 20'},el('use', {'xlink:href': '" . $this->sd->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "','href': '" . $this->sd->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "'}))";
644
-		}
645
-
646
-		return $icon;
647
-	}
648
-
649
-	public function block_row_start( $key, $args ) {
650
-		// check for row
651
-		if ( ! empty( $args['row'] ) ) {
652
-			if ( ! empty( $args['row']['open'] ) ) {
653
-				// element require
654
-				$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
655
-				echo $element_require;
656
-			if ( false ){
657
-				?>
608
+        return str_replace( array(
609
+            '<script>',
610
+            '</script>'
611
+        ), '', $output );
612
+    }
613
+
614
+    /**
615
+     * Generate the block icon.
616
+     *
617
+     * Enables the use of Font Awesome icons.
618
+     *
619
+     * @note xlink:href is actually deprecated but href is not supported by all so we use both.
620
+     *
621
+     * @param $icon
622
+     *
623
+     * @since 1.1.0
624
+     * @return string
625
+     */
626
+    public function get_block_icon( $icon ) {
627
+
628
+        // check if we have a Font Awesome icon
629
+        $fa_type = '';
630
+        if ( substr( $icon, 0, 7 ) === 'fas fa-' ) {
631
+            $fa_type = 'solid';
632
+        } elseif ( substr( $icon, 0, 7 ) === 'far fa-' ) {
633
+            $fa_type = 'regular';
634
+        } elseif ( substr( $icon, 0, 7 ) === 'fab fa-' ) {
635
+            $fa_type = 'brands';
636
+        } else {
637
+            $icon = sprintf( "'%s'", esc_js( $icon ) );
638
+        }
639
+
640
+        // set the icon if we found one
641
+        if ( $fa_type ) {
642
+            $fa_icon = substr( $icon, 7 );
643
+            $icon    = "el('svg',{width: 20, height: 20, viewBox: '0 0 20 20'},el('use', {'xlink:href': '" . $this->sd->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "','href': '" . $this->sd->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "'}))";
644
+        }
645
+
646
+        return $icon;
647
+    }
648
+
649
+    public function block_row_start( $key, $args ) {
650
+        // check for row
651
+        if ( ! empty( $args['row'] ) ) {
652
+            if ( ! empty( $args['row']['open'] ) ) {
653
+                // element require
654
+                $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
655
+                echo $element_require;
656
+            if ( false ){
657
+                ?>
658 658
 				<script><?php }?>
659 659
 					el('div', {
660 660
 							className: 'bsui components-base-control',
@@ -679,8 +679,8 @@  discard block
 block discarded – undo
679 679
 							'div',
680 680
 							{
681 681
 								className: 'row mb-n2 <?php if ( ! empty( $args['row']['class'] ) ) {
682
-									echo esc_attr( $args['row']['class'] );
683
-								} ?>',
682
+                                    echo esc_attr( $args['row']['class'] );
683
+                                } ?>',
684 684
 							},
685 685
 							el(
686 686
 								'div',
@@ -688,11 +688,11 @@  discard block
 block discarded – undo
688 688
 									className: 'col pr-2',
689 689
 								},
690 690
 					<?php
691
-					if ( false ){
692
-					?></script><?php }
693
-			} elseif ( ! empty( $args['row']['close'] ) ) {
694
-			if ( false ){
695
-				?>
691
+                    if ( false ){
692
+                    ?></script><?php }
693
+            } elseif ( ! empty( $args['row']['close'] ) ) {
694
+            if ( false ){
695
+                ?>
696 696
 				<script><?php }?>
697 697
 					el(
698 698
 						'div',
@@ -700,11 +700,11 @@  discard block
 block discarded – undo
700 700
 							className: 'col pl-0',
701 701
 						},
702 702
 					<?php
703
-					if ( false ){
704
-					?></script><?php }
705
-			} else {
706
-			if ( false ){
707
-				?>
703
+                    if ( false ){
704
+                    ?></script><?php }
705
+            } else {
706
+            if ( false ){
707
+                ?>
708 708
 				<script><?php }?>
709 709
 					el(
710 710
 						'div',
@@ -712,255 +712,255 @@  discard block
 block discarded – undo
712 712
 							className: 'col pl-0 pr-2',
713 713
 						},
714 714
 					<?php
715
-					if ( false ){
716
-					?></script><?php }
717
-			}
718
-		}
719
-	}
720
-
721
-	/**
722
-	 * Replace block attributes placeholders with the proper naming.
723
-	 *
724
-	 * @param $string
725
-	 *
726
-	 * @return mixed
727
-	 */
728
-	public function block_props_replace( $string, $no_wrap = false ) {
729
-
730
-		if ( $no_wrap ) {
731
-			$string = str_replace( array( "[%", "%]" ), array( "props.attributes.", "" ), $string );
732
-		} else {
733
-			$string = str_replace( array( "[%", "%]" ), array( "'+props.attributes.", "+'" ), $string );
734
-		}
735
-
736
-		return $string;
737
-	}
738
-
739
-	public function build_block_arguments( $key, $args ) {
740
-		$custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->sd->array_to_attributes( $args['custom_attributes'] ) : '';
741
-		$options           = '';
742
-		$key               = sanitize_key( $key );
743
-		$extra             = "key: '$key',";
744
-
745
-		// `content` is a protected and Gutenberg special argument
746
-		if ( $key == 'content' ) {
747
-			return;
748
-		}
749
-
750
-		// icon
751
-		$icon = '';
752
-		if ( ! empty( $args['icon'] ) ) {
753
-			$icon .= "el('div', {";
754
-			$icon .= "dangerouslySetInnerHTML: {__html: '" . $this->sd->get_widget_icon( esc_attr( $args['icon'] ) ) . "'},";
755
-			$icon .= "className: 'text-center',";
756
-			$icon .= "title: '" . addslashes( $args['title'] ) . "',";
757
-			$icon .= "}),";
758
-			// blank title as its added to the icon.
759
-			$args['title'] = '';
760
-		}
761
-
762
-		// require advanced
763
-		$require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
764
-
765
-		// element require
766
-		$element_require  = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
767
-		$onchange         = "props.setAttributes({ $key: $key } )";
768
-		$onchangecomplete = "";
769
-		$value            = "props.attributes.$key";
770
-		$text_type        = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx' );
771
-		if ( in_array( $args['type'], $text_type ) ) {
772
-			$type = 'TextControl';
773
-			// Save numbers as numbers and not strings
774
-			if ( $args['type'] == 'number' ) {
775
-				$onchange = "props.setAttributes({ $key: Number($key) } )";
776
-			}
777
-		} elseif ( $args['type'] == 'color' ) {
778
-			$type     = 'ColorPicker';
779
-			$onchange = "";
780
-			$extra .= "color: $value,";
781
-			if ( ! empty( $args['disable_alpha'] ) ) {
782
-				$extra .= "disableAlpha: true,";
783
-			}
784
-			$onchangecomplete = "onChangeComplete: function($key) {
715
+                    if ( false ){
716
+                    ?></script><?php }
717
+            }
718
+        }
719
+    }
720
+
721
+    /**
722
+     * Replace block attributes placeholders with the proper naming.
723
+     *
724
+     * @param $string
725
+     *
726
+     * @return mixed
727
+     */
728
+    public function block_props_replace( $string, $no_wrap = false ) {
729
+
730
+        if ( $no_wrap ) {
731
+            $string = str_replace( array( "[%", "%]" ), array( "props.attributes.", "" ), $string );
732
+        } else {
733
+            $string = str_replace( array( "[%", "%]" ), array( "'+props.attributes.", "+'" ), $string );
734
+        }
735
+
736
+        return $string;
737
+    }
738
+
739
+    public function build_block_arguments( $key, $args ) {
740
+        $custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->sd->array_to_attributes( $args['custom_attributes'] ) : '';
741
+        $options           = '';
742
+        $key               = sanitize_key( $key );
743
+        $extra             = "key: '$key',";
744
+
745
+        // `content` is a protected and Gutenberg special argument
746
+        if ( $key == 'content' ) {
747
+            return;
748
+        }
749
+
750
+        // icon
751
+        $icon = '';
752
+        if ( ! empty( $args['icon'] ) ) {
753
+            $icon .= "el('div', {";
754
+            $icon .= "dangerouslySetInnerHTML: {__html: '" . $this->sd->get_widget_icon( esc_attr( $args['icon'] ) ) . "'},";
755
+            $icon .= "className: 'text-center',";
756
+            $icon .= "title: '" . addslashes( $args['title'] ) . "',";
757
+            $icon .= "}),";
758
+            // blank title as its added to the icon.
759
+            $args['title'] = '';
760
+        }
761
+
762
+        // require advanced
763
+        $require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
764
+
765
+        // element require
766
+        $element_require  = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
767
+        $onchange         = "props.setAttributes({ $key: $key } )";
768
+        $onchangecomplete = "";
769
+        $value            = "props.attributes.$key";
770
+        $text_type        = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx' );
771
+        if ( in_array( $args['type'], $text_type ) ) {
772
+            $type = 'TextControl';
773
+            // Save numbers as numbers and not strings
774
+            if ( $args['type'] == 'number' ) {
775
+                $onchange = "props.setAttributes({ $key: Number($key) } )";
776
+            }
777
+        } elseif ( $args['type'] == 'color' ) {
778
+            $type     = 'ColorPicker';
779
+            $onchange = "";
780
+            $extra .= "color: $value,";
781
+            if ( ! empty( $args['disable_alpha'] ) ) {
782
+                $extra .= "disableAlpha: true,";
783
+            }
784
+            $onchangecomplete = "onChangeComplete: function($key) {
785 785
 			value =  $key.rgb.a && $key.rgb.a < 1 ? \"rgba(\"+$key.rgb.r+\",\"+$key.rgb.g+\",\"+$key.rgb.b+\",\"+$key.rgb.a+\")\" : $key.hex;
786 786
                         props.setAttributes({
787 787
                             $key: value
788 788
                         });
789 789
                     },";
790
-		} elseif ( $args['type'] == 'checkbox' ) {
791
-			$type = 'CheckboxControl';
792
-			$extra .= "checked: props.attributes.$key,";
793
-			$onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
794
-		} elseif ( $args['type'] == 'textarea' ) {
795
-			$type = 'TextareaControl';
796
-		} elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
797
-			$type = 'SelectControl';
798
-			if ( $args['name'] == 'category' && ! empty( $args['post_type_linked'] ) ) {
799
-				$options .= "options: taxonomies_" . str_replace( "-", "_", $this->sd->base_id . '_' . $this->sd->get_number() ) . ",";
800
-			} elseif ( $args['name'] == 'sort_by' && ! empty( $args['post_type_linked'] ) ) {
801
-				$options .= "options: sort_by_" . str_replace( "-", "_", $this->sd->base_id . '_' . $this->sd->get_number() ) . ",";
802
-			} else {
803
-				if ( ! empty( $args['options'] ) ) {
804
-					$options .= "options: [";
805
-					foreach ( $args['options'] as $option_val => $option_label ) {
806
-						$options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . addslashes( $option_label ) . "' },";
807
-					}
808
-					$options .= "],";
809
-				}
810
-			}
811
-			if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
812
-				$extra .= ' multiple: true, ';
813
-			}
814
-		} elseif ( $args['type'] == 'alignment' ) {
815
-			$type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
816
-		} elseif ( $args['type'] == 'margins' ) {
817
-		} else {
818
-			return;// if we have not implemented the control then don't break the JS.
819
-		}
820
-
821
-		// color input does not show the labels so we add them
822
-		if ( $args['type'] == 'color' ) {
823
-			// add show only if advanced
824
-			echo $require_advanced;
825
-			// add setting require if defined
826
-			echo $element_require;
827
-			echo "el('div', {style: {'marginBottom': '8px'}}, '" . addslashes( $args['title'] ) . "'),";
828
-		}
829
-
830
-		// add show only if advanced
831
-		echo $require_advanced;
832
-		// add setting require if defined
833
-		echo $element_require;
834
-
835
-		// icon
836
-		echo $icon;
837
-		?>
790
+        } elseif ( $args['type'] == 'checkbox' ) {
791
+            $type = 'CheckboxControl';
792
+            $extra .= "checked: props.attributes.$key,";
793
+            $onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
794
+        } elseif ( $args['type'] == 'textarea' ) {
795
+            $type = 'TextareaControl';
796
+        } elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
797
+            $type = 'SelectControl';
798
+            if ( $args['name'] == 'category' && ! empty( $args['post_type_linked'] ) ) {
799
+                $options .= "options: taxonomies_" . str_replace( "-", "_", $this->sd->base_id . '_' . $this->sd->get_number() ) . ",";
800
+            } elseif ( $args['name'] == 'sort_by' && ! empty( $args['post_type_linked'] ) ) {
801
+                $options .= "options: sort_by_" . str_replace( "-", "_", $this->sd->base_id . '_' . $this->sd->get_number() ) . ",";
802
+            } else {
803
+                if ( ! empty( $args['options'] ) ) {
804
+                    $options .= "options: [";
805
+                    foreach ( $args['options'] as $option_val => $option_label ) {
806
+                        $options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . addslashes( $option_label ) . "' },";
807
+                    }
808
+                    $options .= "],";
809
+                }
810
+            }
811
+            if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
812
+                $extra .= ' multiple: true, ';
813
+            }
814
+        } elseif ( $args['type'] == 'alignment' ) {
815
+            $type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
816
+        } elseif ( $args['type'] == 'margins' ) {
817
+        } else {
818
+            return;// if we have not implemented the control then don't break the JS.
819
+        }
820
+
821
+        // color input does not show the labels so we add them
822
+        if ( $args['type'] == 'color' ) {
823
+            // add show only if advanced
824
+            echo $require_advanced;
825
+            // add setting require if defined
826
+            echo $element_require;
827
+            echo "el('div', {style: {'marginBottom': '8px'}}, '" . addslashes( $args['title'] ) . "'),";
828
+        }
829
+
830
+        // add show only if advanced
831
+        echo $require_advanced;
832
+        // add setting require if defined
833
+        echo $element_require;
834
+
835
+        // icon
836
+        echo $icon;
837
+        ?>
838 838
 		el( wp.components.<?php echo $type; ?>, {
839 839
 		label: '<?php echo addslashes( $args['title'] ); ?>',
840 840
 		help: '<?php if ( isset( $args['desc'] ) ) {
841
-			echo addslashes( $args['desc'] );
842
-		} ?>',
841
+            echo addslashes( $args['desc'] );
842
+        } ?>',
843 843
 		value: <?php echo $value; ?>,
844 844
 		<?php if ( $type == 'TextControl' && $args['type'] != 'text' ) {
845
-			echo "type: '" . addslashes( $args['type'] ) . "',";
846
-		} ?>
845
+            echo "type: '" . addslashes( $args['type'] ) . "',";
846
+        } ?>
847 847
 		<?php if ( ! empty( $args['placeholder'] ) ) {
848
-			echo "placeholder: '" . addslashes( $args['placeholder'] ) . "',";
849
-		}
850
-		echo $options;
851
-		echo $extra;
852
-		echo $custom_attributes;
853
-		echo $onchangecomplete . "\n"; ?>
848
+            echo "placeholder: '" . addslashes( $args['placeholder'] ) . "',";
849
+        }
850
+        echo $options;
851
+        echo $extra;
852
+        echo $custom_attributes;
853
+        echo $onchangecomplete . "\n"; ?>
854 854
 		onChange: function ( <?php echo $key; ?> ) {<?php echo $onchange; ?>}
855 855
 		} ),
856 856
 		<?php
857
-	}
858
-
859
-	public function block_row_end( $key, $args ) {
860
-		if ( ! empty( $args['row'] ) ) {
861
-			// maybe close
862
-			if ( ! empty( $args['row']['close'] ) ) {
863
-				echo "))";
864
-			}
865
-			echo "),";
866
-		}
867
-	}
868
-
869
-	/**
870
-	 * A self looping function to create the output for JS block elements.
871
-	 *
872
-	 * This is what is output in the WP Editor visual view.
873
-	 *
874
-	 * @param $args
875
-	 */
876
-	public function block_element( $args ) {
877
-
878
-		// Make sure we have args.
879
-		if ( ! empty( $args ) ) {
880
-
881
-			// For each argument...
882
-			foreach ( $args as $element => $new_args ) {
883
-
884
-				// Check if its an element.
885
-				if ( is_array( $new_args ) ) {
886
-					if ( isset( $new_args['element'] ) ) {
887
-						if ( isset( $new_args['element_require'] ) ) {
888
-							echo str_replace( array(
889
-									"'+",
890
-									"+'"
891
-								), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
892
-							unset( $new_args['element_require'] );
893
-						}
894
-
895
-						echo "\n el( '" . $new_args['element'] . "', {";
896
-
897
-						// get the attributes
898
-						foreach ( $new_args as $new_key => $new_value ) {
899
-							if ( $new_key == 'element' || $new_key == 'content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
900
-								// do nothing
901
-							} else {
902
-								echo $this->block_element( array( $new_key => $new_value ) );
903
-							}
904
-						}
905
-
906
-						echo "key: '$element'},";// end attributes
907
-
908
-						// get the content
909
-						$first_item = 0;
910
-						foreach ( $new_args as $new_key => $new_value ) {
911
-							if ( $new_key === 'content' || is_array( $new_value ) ) {
912
-								if ( $new_key === 'content' ) {
913
-									echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
914
-								}
915
-
916
-								if ( is_array( $new_value ) ) {
917
-									if ( isset( $new_value['element_require'] ) ) {
918
-										echo str_replace( array(
919
-												"'+",
920
-												"+'"
921
-											), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
922
-										unset( $new_value['element_require'] );
923
-									}
924
-
925
-									if ( isset( $new_value['element_repeat'] ) ) {
926
-										$x = 1;
927
-										while ( $x <= absint( $new_value['element_repeat'] ) ) {
928
-											$this->block_element( array( '' => $new_value ) );
929
-											$x ++;
930
-										}
931
-									} else {
932
-										$this->block_element( array( '' => $new_value ) );
933
-									}
934
-								}
935
-								$first_item ++;
936
-							}
937
-						}
938
-						echo ")";// end content
939
-						echo ", \n";
940
-					}
941
-
942
-					// Or an attribute.
943
-				} else {
944
-					if ( substr( $element, 0, 3 ) === 'if_' ) {
945
-						echo str_replace( 'if_', '', $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
946
-					} elseif ( $element == 'style' ) {
947
-						echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
948
-					} else {
949
-						echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
950
-					}
951
-				}
952
-			}
953
-
954
-		}
955
-	}
956
-
957
-	/**
958
-	 * Enqueue CSS assets in the editor if defined
959
-	 */
960
-	public function enqueue_editor_assets() {
961
-		if ( isset( $this->sd->options['block-editor-style'] ) ) {
962
-			echo "<link rel='stylesheet' id='glossary-shortcode' href='" . $this->sd->options['block-editor-style'] . "'/>";
963
-		}
964
-	}
857
+    }
858
+
859
+    public function block_row_end( $key, $args ) {
860
+        if ( ! empty( $args['row'] ) ) {
861
+            // maybe close
862
+            if ( ! empty( $args['row']['close'] ) ) {
863
+                echo "))";
864
+            }
865
+            echo "),";
866
+        }
867
+    }
868
+
869
+    /**
870
+     * A self looping function to create the output for JS block elements.
871
+     *
872
+     * This is what is output in the WP Editor visual view.
873
+     *
874
+     * @param $args
875
+     */
876
+    public function block_element( $args ) {
877
+
878
+        // Make sure we have args.
879
+        if ( ! empty( $args ) ) {
880
+
881
+            // For each argument...
882
+            foreach ( $args as $element => $new_args ) {
883
+
884
+                // Check if its an element.
885
+                if ( is_array( $new_args ) ) {
886
+                    if ( isset( $new_args['element'] ) ) {
887
+                        if ( isset( $new_args['element_require'] ) ) {
888
+                            echo str_replace( array(
889
+                                    "'+",
890
+                                    "+'"
891
+                                ), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
892
+                            unset( $new_args['element_require'] );
893
+                        }
894
+
895
+                        echo "\n el( '" . $new_args['element'] . "', {";
896
+
897
+                        // get the attributes
898
+                        foreach ( $new_args as $new_key => $new_value ) {
899
+                            if ( $new_key == 'element' || $new_key == 'content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
900
+                                // do nothing
901
+                            } else {
902
+                                echo $this->block_element( array( $new_key => $new_value ) );
903
+                            }
904
+                        }
905
+
906
+                        echo "key: '$element'},";// end attributes
907
+
908
+                        // get the content
909
+                        $first_item = 0;
910
+                        foreach ( $new_args as $new_key => $new_value ) {
911
+                            if ( $new_key === 'content' || is_array( $new_value ) ) {
912
+                                if ( $new_key === 'content' ) {
913
+                                    echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
914
+                                }
915
+
916
+                                if ( is_array( $new_value ) ) {
917
+                                    if ( isset( $new_value['element_require'] ) ) {
918
+                                        echo str_replace( array(
919
+                                                "'+",
920
+                                                "+'"
921
+                                            ), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
922
+                                        unset( $new_value['element_require'] );
923
+                                    }
924
+
925
+                                    if ( isset( $new_value['element_repeat'] ) ) {
926
+                                        $x = 1;
927
+                                        while ( $x <= absint( $new_value['element_repeat'] ) ) {
928
+                                            $this->block_element( array( '' => $new_value ) );
929
+                                            $x ++;
930
+                                        }
931
+                                    } else {
932
+                                        $this->block_element( array( '' => $new_value ) );
933
+                                    }
934
+                                }
935
+                                $first_item ++;
936
+                            }
937
+                        }
938
+                        echo ")";// end content
939
+                        echo ", \n";
940
+                    }
941
+
942
+                    // Or an attribute.
943
+                } else {
944
+                    if ( substr( $element, 0, 3 ) === 'if_' ) {
945
+                        echo str_replace( 'if_', '', $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
946
+                    } elseif ( $element == 'style' ) {
947
+                        echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
948
+                    } else {
949
+                        echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
950
+                    }
951
+                }
952
+            }
953
+
954
+        }
955
+    }
956
+
957
+    /**
958
+     * Enqueue CSS assets in the editor if defined
959
+     */
960
+    public function enqueue_editor_assets() {
961
+        if ( isset( $this->sd->options['block-editor-style'] ) ) {
962
+            echo "<link rel='stylesheet' id='glossary-shortcode' href='" . $this->sd->options['block-editor-style'] . "'/>";
963
+        }
964
+    }
965 965
 
966 966
 }
Please login to merge, or discard this patch.
Spacing   +217 added lines, -217 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @since 2.0.0
6 6
  */
7 7
 
8
-defined( 'ABSPATH' ) || exit;
8
+defined('ABSPATH') || exit;
9 9
 
10 10
 /**
11 11
  *
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
 	 *
28 28
 	 * @param WP_Super_Duper $super_duper
29 29
 	 */
30
-	public function __construct( $super_duper ) {
30
+	public function __construct($super_duper) {
31 31
 
32 32
 		$this->sd = $super_duper;
33 33
 
34 34
 		// Process the SD shortcode preview.
35
-		add_action( 'wp_ajax_super_duper_output_shortcode', array( __CLASS__, 'render_shortcode' ) );
36
-		add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
37
-		add_action( 'admin_footer-post.php', array( $this, 'enqueue_editor_assets' ) );
38
-		add_action( 'admin_footer-post-new.php', array( $this, 'enqueue_editor_assets' ) );
35
+		add_action('wp_ajax_super_duper_output_shortcode', array(__CLASS__, 'render_shortcode'));
36
+		add_action('admin_enqueue_scripts', array($this, 'register_block'));
37
+		add_action('admin_footer-post.php', array($this, 'enqueue_editor_assets'));
38
+		add_action('admin_footer-post-new.php', array($this, 'enqueue_editor_assets'));
39 39
 	}
40 40
 
41 41
 	/**
@@ -46,45 +46,45 @@  discard block
 block discarded – undo
46 46
 	public static function render_shortcode() {
47 47
 
48 48
 		// Verify nonce.
49
-		check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
49
+		check_ajax_referer('super_duper_output_shortcode', '_ajax_nonce', true);
50 50
 
51 51
 		// And permissions.
52
-		if ( ! current_user_can( 'manage_options' ) ) {
52
+		if (!current_user_can('manage_options')) {
53 53
 			wp_die();
54 54
 		}
55 55
 
56 56
 		// Ensure a shortcode is provided.
57
-		if ( empty( $_POST['shortcode'] ) ) {
57
+		if (empty($_POST['shortcode'])) {
58 58
 			wp_die();
59 59
 		}
60 60
 
61 61
 		// We might need the $post value here so lets set it.
62
-		if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
63
-			$post_obj = get_post( absint( $_POST['post_id'] ) );
64
-			if ( ! empty( $post_obj ) && empty( $post ) ) {
62
+		if (isset($_POST['post_id']) && $_POST['post_id']) {
63
+			$post_obj = get_post(absint($_POST['post_id']));
64
+			if (!empty($post_obj) && empty($post)) {
65 65
 				global $post;
66 66
 				$post = $post_obj;
67 67
 			}
68 68
 		}
69 69
 
70 70
 		// Prepare args.
71
-		$shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
72
-		$attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
71
+		$shortcode_name   = sanitize_title_with_dashes($_POST['shortcode']);
72
+		$attributes_array = isset($_POST['attributes']) && $_POST['attributes'] ? $_POST['attributes'] : array();
73 73
 		$attributes       = '';
74 74
 
75 75
 		// Convert attributes array into a string.
76
-		if ( ! empty( $attributes_array ) ) {
77
-			foreach ( $attributes_array as $key => $value ) {
78
-				if ( is_array( $value ) ) {
79
-					$value = implode( ',', $value );
76
+		if (!empty($attributes_array)) {
77
+			foreach ($attributes_array as $key => $value) {
78
+				if (is_array($value)) {
79
+					$value = implode(',', $value);
80 80
 				}
81
-				$key   = sanitize_title_with_dashes( $key );
82
-				$value = wp_slash( $value );
81
+				$key   = sanitize_title_with_dashes($key);
82
+				$value = wp_slash($value);
83 83
 				$attributes .= " $key='$value' ";
84 84
 			}
85 85
 		}
86 86
 
87
-		echo do_shortcode( "[$shortcode_name $attributes]" );
87
+		echo do_shortcode("[$shortcode_name $attributes]");
88 88
 		exit;
89 89
 
90 90
 	}
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
 	 * Add the dynamic block code inline when the wp-block in enqueued.
94 94
 	 */
95 95
 	public function register_block() {
96
-		wp_add_inline_script( 'wp-blocks', $this->block() );
97
-		if ( class_exists( 'SiteOrigin_Panels' ) ) {
98
-			wp_add_inline_script( 'wp-blocks', WP_Super_Duper::siteorigin_js() );
96
+		wp_add_inline_script('wp-blocks', $this->block());
97
+		if (class_exists('SiteOrigin_Panels')) {
98
+			wp_add_inline_script('wp-blocks', WP_Super_Duper::siteorigin_js());
99 99
 		}
100 100
 	}
101 101
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	public function block() {
111 111
 		ob_start();
112 112
 
113
-		$block_name    = str_replace( '_', '-', sanitize_title_with_dashes( $this->sd->options['textdomain'] ) . '/' . sanitize_title_with_dashes( $this->sd->options['class_name'] ) );
113
+		$block_name    = str_replace('_', '-', sanitize_title_with_dashes($this->sd->options['textdomain']) . '/' . sanitize_title_with_dashes($this->sd->options['class_name']));
114 114
 		$show_advanced = $this->sd->block_show_advanced();
115 115
 		$id            = $this->sd->base_id . '-' . $this->sd->get_number();
116 116
 		?>
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
 				var prev_attributes = [];
136 136
 
137 137
 				var term_query_type = '';
138
-				var post_type_rest_slugs = <?php if ( ! empty( $this->sd->arguments ) && isset( $this->sd->arguments['post_type']['onchange_rest']['values'] ) ) {
139
-					echo "[" . json_encode( $this->sd->arguments['post_type']['onchange_rest']['values'] ) . "]";
138
+				var post_type_rest_slugs = <?php if (!empty($this->sd->arguments) && isset($this->sd->arguments['post_type']['onchange_rest']['values'])) {
139
+					echo "[" . json_encode($this->sd->arguments['post_type']['onchange_rest']['values']) . "]";
140 140
 				} else {
141 141
 					echo "[]";
142 142
 				} ?>;
143
-				const taxonomies_<?php echo str_replace( "-", "_", $id );?> = [{label: "Please wait", value: 0}];
144
-				const sort_by_<?php echo str_replace( "-", "_", $id );?> = [{label: "Please wait", value: 0}];
143
+				const taxonomies_<?php echo str_replace("-", "_", $id); ?> = [{label: "Please wait", value: 0}];
144
+				const sort_by_<?php echo str_replace("-", "_", $id); ?> = [{label: "Please wait", value: 0}];
145 145
 
146 146
 				/**
147 147
 				 * Register Basic Block.
@@ -155,39 +155,39 @@  discard block
 block discarded – undo
155 155
 				 * @return {?WPBlock}          The block, if it has been successfully
156 156
 				 *                             registered; otherwise `undefined`.
157 157
 				 */
158
-				registerBlockType('<?php echo $block_name;  ?>', { // Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
159
-					title: '<?php echo addslashes( $this->sd->options['name'] ); ?>', // Block title.
160
-					description: '<?php echo addslashes( $this->sd->options['widget_ops']['description'] )?>', // Block title.
161
-					icon: <?php echo $this->get_block_icon( $this->sd->options['block-icon'] );?>,//'<?php echo isset( $this->sd->options['block-icon'] ) ? esc_attr( $this->sd->options['block-icon'] ) : 'shield-alt';?>', // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
158
+				registerBlockType('<?php echo $block_name; ?>', { // Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
159
+					title: '<?php echo addslashes($this->sd->options['name']); ?>', // Block title.
160
+					description: '<?php echo addslashes($this->sd->options['widget_ops']['description'])?>', // Block title.
161
+					icon: <?php echo $this->get_block_icon($this->sd->options['block-icon']); ?>,//'<?php echo isset($this->sd->options['block-icon']) ? esc_attr($this->sd->options['block-icon']) : 'shield-alt'; ?>', // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
162 162
 					supports: {
163 163
 						<?php
164
-						if ( isset( $this->sd->options['block-supports'] ) ) {
165
-							echo $this->sd->array_to_attributes( $this->sd->options['block-supports'] );
164
+						if (isset($this->sd->options['block-supports'])) {
165
+							echo $this->sd->array_to_attributes($this->sd->options['block-supports']);
166 166
 						}
167 167
 						?>
168 168
 					},
169
-					category: '<?php echo isset( $this->sd->options['block-category'] ) ? esc_attr( $this->sd->options['block-category'] ) : 'common';?>', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
170
-					<?php if ( isset( $this->sd->options['block-keywords'] ) ) {
169
+					category: '<?php echo isset($this->sd->options['block-category']) ? esc_attr($this->sd->options['block-category']) : 'common'; ?>', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
170
+					<?php if (isset($this->sd->options['block-keywords'])) {
171 171
 					echo "keywords : " . $this->sd->options['block-keywords'] . ",";
172 172
 				}?>
173 173
 
174 174
 					<?php
175 175
 
176 176
 					// maybe set no_wrap
177
-					$no_wrap = isset( $this->sd->options['no_wrap'] ) && $this->sd->options['no_wrap'] ? true : false;
178
-					if ( isset( $this->sd->arguments['no_wrap'] ) && $this->sd->arguments['no_wrap'] ) {
177
+					$no_wrap = isset($this->sd->options['no_wrap']) && $this->sd->options['no_wrap'] ? true : false;
178
+					if (isset($this->sd->arguments['no_wrap']) && $this->sd->arguments['no_wrap']) {
179 179
 						$no_wrap = true;
180 180
 					}
181
-					if ( $no_wrap ) {
181
+					if ($no_wrap) {
182 182
 						$this->sd->options['block-wrap'] = '';
183 183
 					}
184 184
 
185 185
 					$show_alignment = false;
186 186
 
187
-					if ( ! empty( $this->sd->arguments ) ) {
187
+					if (!empty($this->sd->arguments)) {
188 188
 						echo "attributes : {";
189 189
 
190
-						if ( $show_advanced ) {
190
+						if ($show_advanced) {
191 191
 							echo "show_advanced: {";
192 192
 							echo "	type: 'boolean',";
193 193
 							echo "  default: false,";
@@ -195,43 +195,43 @@  discard block
 block discarded – undo
195 195
 						}
196 196
 
197 197
 						// block wrap element
198
-						if ( ! empty( $this->sd->options['block-wrap'] ) ) { //@todo we should validate this?
198
+						if (!empty($this->sd->options['block-wrap'])) { //@todo we should validate this?
199 199
 							echo "block_wrap: {";
200 200
 							echo "	type: 'string',";
201
-							echo "  default: '" . esc_attr( $this->sd->options['block-wrap'] ) . "',";
201
+							echo "  default: '" . esc_attr($this->sd->options['block-wrap']) . "',";
202 202
 							echo "},";
203 203
 						}
204 204
 
205
-						foreach ( $this->sd->arguments as $key => $args ) {
205
+						foreach ($this->sd->arguments as $key => $args) {
206 206
 
207 207
 							// set if we should show alignment
208
-							if ( $key == 'alignment' ) {
208
+							if ($key == 'alignment') {
209 209
 								$show_alignment = true;
210 210
 							}
211 211
 
212 212
 							$extra = '';
213 213
 
214
-							if ( $args['type'] == 'checkbox' ) {
214
+							if ($args['type'] == 'checkbox') {
215 215
 								$type    = 'boolean';
216
-								$default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false';
217
-							} elseif ( $args['type'] == 'number' ) {
216
+								$default = isset($args['default']) && $args['default'] ? 'true' : 'false';
217
+							} elseif ($args['type'] == 'number') {
218 218
 								$type    = 'number';
219
-								$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
220
-							} elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
219
+								$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
220
+							} elseif ($args['type'] == 'select' && !empty($args['multiple'])) {
221 221
 								$type = 'array';
222
-								if ( isset( $args['default'] ) && is_array( $args['default'] ) ) {
223
-									$default = ! empty( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]";
222
+								if (isset($args['default']) && is_array($args['default'])) {
223
+									$default = !empty($args['default']) ? "['" . implode("','", $args['default']) . "']" : "[]";
224 224
 								} else {
225
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
225
+									$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
226 226
 								}
227
-							} elseif ( $args['type'] == 'multiselect' ) {
227
+							} elseif ($args['type'] == 'multiselect') {
228 228
 								$type    = 'array';
229
-								$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
229
+								$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
230 230
 							} else {
231 231
 								$type    = 'string';
232
-								$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
232
+								$default = isset($args['default']) ? "'" . $args['default'] . "'" : "''";
233 233
 							}
234
-							echo str_replace( '-','__', $key ) . " : {";
234
+							echo str_replace('-', '__', $key) . " : {";
235 235
 							echo "type : '$type',";
236 236
 							echo "default : $default,";
237 237
 							echo "},";
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 						var $value = '';
253 253
 						<?php
254 254
 						// if we have a post_type and a category then link them
255
-						if( isset( $this->sd->arguments['post_type'] ) && isset( $this->sd->arguments['category'] ) && ! empty( $this->sd->arguments['category']['post_type_linked'] ) ){
255
+						if (isset($this->sd->arguments['post_type']) && isset($this->sd->arguments['category']) && !empty($this->sd->arguments['category']['post_type_linked'])) {
256 256
 						?>
257 257
 						if (typeof(prev_attributes[props.id]) != 'undefined') {
258 258
 							$pt = props.attributes.post_type;
@@ -269,20 +269,20 @@  discard block
 block discarded – undo
269 269
 							// taxonomies
270 270
 							if ($value && 'post_type' in prev_attributes[props.id] && 'category' in prev_attributes[props.id] && run) {
271 271
 								wp.apiFetch({
272
-									path: "<?php if ( isset( $this->sd->arguments['post_type']['onchange_rest']['path'] ) ) {
272
+									path: "<?php if (isset($this->sd->arguments['post_type']['onchange_rest']['path'])) {
273 273
 										echo $this->sd->arguments['post_type']['onchange_rest']['path'];
274 274
 									} else {
275 275
 										'/wp/v2/"+$value+"/categories/?per_page=100';
276 276
 									} ?>"
277 277
 								}).then(terms => {
278
-									while (taxonomies_<?php echo str_replace( "-", "_", $id );?>.length
278
+									while (taxonomies_<?php echo str_replace("-", "_", $id); ?>.length
279 279
 							)
280 280
 								{
281
-									taxonomies_<?php echo str_replace("-","_", $id);?>.pop();
281
+									taxonomies_<?php echo str_replace("-", "_", $id); ?>.pop();
282 282
 								}
283
-								taxonomies_<?php echo str_replace("-","_", $id);?>.push({label: "All", value: 0});
283
+								taxonomies_<?php echo str_replace("-", "_", $id); ?>.push({label: "All", value: 0});
284 284
 								jQuery.each(terms, function (key, val) {
285
-									taxonomies_<?php echo str_replace("-","_", $id);?>.push({
285
+									taxonomies_<?php echo str_replace("-", "_", $id); ?>.push({
286 286
 										label: val.name,
287 287
 										value: val.id
288 288
 									});
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 								props.setAttributes({category: [0]});
294 294
 								props.setAttributes({category: $old_cat_value});
295 295
 
296
-								return taxonomies_<?php echo str_replace( "-", "_", $id );?>;
296
+								return taxonomies_<?php echo str_replace("-", "_", $id); ?>;
297 297
 							})
298 298
 							};
299 299
 
@@ -305,12 +305,12 @@  discard block
 block discarded – undo
305 305
 								};
306 306
 								jQuery.post(ajaxurl, data, function (response) {
307 307
 									response = JSON.parse(response);
308
-									while (sort_by_<?php echo str_replace( "-", "_", $id );?>.length) {
309
-										sort_by_<?php echo str_replace("-","_", $id);?>.pop();
308
+									while (sort_by_<?php echo str_replace("-", "_", $id); ?>.length) {
309
+										sort_by_<?php echo str_replace("-", "_", $id); ?>.pop();
310 310
 									}
311 311
 
312 312
 									jQuery.each(response, function (key, val) {
313
-										sort_by_<?php echo str_replace("-","_", $id);?>.push({label: val, value: key});
313
+										sort_by_<?php echo str_replace("-", "_", $id); ?>.push({label: val, value: key});
314 314
 									});
315 315
 
316 316
 									// setting the value back and fourth fixes the no update issue that sometimes happens where it won't update the options.
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 									props.setAttributes({sort_by: [0]});
319 319
 									props.setAttributes({sort_by: $old_sort_by_value});
320 320
 
321
-									return sort_by_<?php echo str_replace( "-", "_", $id );?>;
321
+									return sort_by_<?php echo str_replace("-", "_", $id); ?>;
322 322
 								});
323 323
 
324 324
 							}
@@ -345,14 +345,14 @@  discard block
 block discarded – undo
345 345
 								is_fetching = true;
346 346
 								var data = {
347 347
 									'action': 'super_duper_output_shortcode',
348
-									'shortcode': '<?php echo $this->sd->options['base_id'];?>',
348
+									'shortcode': '<?php echo $this->sd->options['base_id']; ?>',
349 349
 									'attributes': props.attributes,
350
-									'post_id': <?php global $post; if ( isset( $post->ID ) ) {
350
+									'post_id': <?php global $post; if (isset($post->ID)) {
351 351
 									echo $post->ID;
352 352
 								} else {
353 353
 									echo '0';
354 354
 								}?>,
355
-									'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
355
+									'_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>'
356 356
 								};
357 357
 
358 358
 								jQuery.post(ajaxurl, data, function (response) {
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 
362 362
 									// if the content is empty then we place some placeholder text
363 363
 									if (env == '') {
364
-										env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e( 'Placeholder for: ' );?>" + props.name + "</div>";
364
+										env = "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" + "<?php _e('Placeholder for: '); ?>" + props.name + "</div>";
365 365
 									}
366 366
 
367 367
 									props.setAttributes({content: env});
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 
386 386
 							el(wp.blockEditor.BlockControls, {key: 'controls'},
387 387
 
388
-								<?php if($show_alignment){?>
388
+								<?php if ($show_alignment) {?>
389 389
 								el(
390 390
 									wp.blockEditor.AlignmentToolbar,
391 391
 									{
@@ -403,9 +403,9 @@  discard block
 block discarded – undo
403 403
 
404 404
 								<?php
405 405
 
406
-								if(! empty( $this->sd->arguments )){
406
+								if (!empty($this->sd->arguments)) {
407 407
 
408
-								if ( $show_advanced ) {
408
+								if ($show_advanced) {
409 409
 								?>
410 410
 								el('div', {
411 411
 										style: {'padding-left': '16px', 'padding-right': '16px'}
@@ -426,19 +426,19 @@  discard block
 block discarded – undo
426 426
 
427 427
 								}
428 428
 
429
-								$arguments = $this->sd->group_arguments( $this->sd->arguments );
429
+								$arguments = $this->sd->group_arguments($this->sd->arguments);
430 430
 
431 431
 								// Do we have sections?
432 432
 								$has_sections = $arguments == $this->sd->arguments ? false : true;
433 433
 
434 434
 
435
-								if($has_sections){
435
+								if ($has_sections) {
436 436
 								$panel_count = 0;
437
-								foreach($arguments as $key => $args){
437
+								foreach ($arguments as $key => $args) {
438 438
 								?>
439 439
 								el(wp.components.PanelBody, {
440
-										title: '<?php esc_attr_e( $key ); ?>',
441
-										initialOpen: <?php if ( $panel_count ) {
440
+										title: '<?php esc_attr_e($key); ?>',
441
+										initialOpen: <?php if ($panel_count) {
442 442
 										echo "false";
443 443
 									} else {
444 444
 										echo "true";
@@ -446,30 +446,30 @@  discard block
 block discarded – undo
446 446
 									},
447 447
 									<?php
448 448
 
449
-									foreach ( $args as $k => $a ) {
450
-										$k = str_replace('-','__', $k);
451
-										$this->block_row_start( $k, $a );
452
-										$this->build_block_arguments( $k, $a );
453
-										$this->block_row_end( $k, $a );
449
+									foreach ($args as $k => $a) {
450
+										$k = str_replace('-', '__', $k);
451
+										$this->block_row_start($k, $a);
452
+										$this->build_block_arguments($k, $a);
453
+										$this->block_row_end($k, $a);
454 454
 									}
455 455
 									?>
456 456
 								),
457 457
 								<?php
458
-								$panel_count ++;
458
+								$panel_count++;
459 459
 
460 460
 								}
461
-								}else {
461
+								} else {
462 462
 								?>
463 463
 								el(wp.components.PanelBody, {
464
-										title: '<?php esc_attr_e( "Settings" ); ?>',
464
+										title: '<?php esc_attr_e("Settings"); ?>',
465 465
 										initialOpen: true
466 466
 									},
467 467
 									<?php
468
-									foreach ( $this->sd->arguments as $key => $args ) {
469
-										$key = str_replace('-','__', $key);
470
-										$this->block_row_start( $key, $args );
471
-										$this->build_block_arguments( $key, $args );
472
-										$this->block_row_end( $key, $args );
468
+									foreach ($this->sd->arguments as $key => $args) {
469
+										$key = str_replace('-', '__', $key);
470
+										$this->block_row_start($key, $args);
471
+										$this->build_block_arguments($key, $args);
472
+										$this->block_row_end($key, $args);
473 473
 									}
474 474
 									?>
475 475
 								),
@@ -483,9 +483,9 @@  discard block
 block discarded – undo
483 483
 
484 484
 							<?php
485 485
 							// If the user sets block-output array then build it
486
-							if ( ! empty( $this->sd->options['block-output'] ) ) {
487
-							$this->block_element( $this->sd->options['block-output'] );
488
-						}else{
486
+							if (!empty($this->sd->options['block-output'])) {
487
+							$this->block_element($this->sd->options['block-output']);
488
+						} else {
489 489
 							// if no block-output is set then we try and get the shortcode html output via ajax.
490 490
 							?>
491 491
 							el('div', {
@@ -514,12 +514,12 @@  discard block
 block discarded – undo
514 514
 										return false;
515 515
 									}
516 516
 
517
-									return idBase === "<?php echo $this->sd->options['base_id'];?>";
517
+									return idBase === "<?php echo $this->sd->options['base_id']; ?>";
518 518
 								},
519 519
 								transform: function transform(attributes) {
520 520
 									var instance = attributes.instance;
521 521
 
522
-									return wp.blocks.createBlock("<?php echo $block_name;?>", instance.raw);
522
+									return wp.blocks.createBlock("<?php echo $block_name; ?>", instance.raw);
523 523
 								}
524 524
 							}
525 525
 						]
@@ -535,20 +535,20 @@  discard block
 block discarded – undo
535 535
 						var align = '';
536 536
 
537 537
 						// build the shortcode.
538
-						var content = "[<?php echo $this->sd->options['base_id'];?>";
538
+						var content = "[<?php echo $this->sd->options['base_id']; ?>";
539 539
 						$html = '';
540 540
 						<?php
541 541
 
542
-						if(! empty( $this->sd->arguments )){
542
+						if (!empty($this->sd->arguments)) {
543 543
 
544
-						foreach($this->sd->arguments as $key => $args){
545
-						$key = str_replace('-','__', $key);
544
+						foreach ($this->sd->arguments as $key => $args) {
545
+						$key = str_replace('-', '__', $key);
546 546
 						?>
547
-						if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) {
548
-							if ('<?php echo esc_attr( $key );?>' == 'html') {
549
-								$html = attr.<?php echo esc_attr( $key );?>;
547
+						if (attr.hasOwnProperty("<?php echo esc_attr($key); ?>")) {
548
+							if ('<?php echo esc_attr($key); ?>' == 'html') {
549
+								$html = attr.<?php echo esc_attr($key); ?>;
550 550
 							} else {
551
-								content += " <?php echo str_replace( '__','-', esc_attr( $key ) );?>='" + attr.<?php echo esc_attr( $key );?>+ "' ";
551
+								content += " <?php echo str_replace('__', '-', esc_attr($key)); ?>='" + attr.<?php echo esc_attr($key); ?>+ "' ";
552 552
 							}
553 553
 						}
554 554
 						<?php
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 
561 561
 						// if has html element
562 562
 						if ($html) {
563
-							content += $html + "[/<?php echo $this->sd->options['base_id'];?>]";
563
+							content += $html + "[/<?php echo $this->sd->options['base_id']; ?>]";
564 564
 						}
565 565
 
566 566
 
@@ -578,11 +578,11 @@  discard block
 block discarded – undo
578 578
 						}
579 579
 
580 580
 						<?php
581
-						if(isset( $this->sd->options['block-wrap'] ) && $this->sd->options['block-wrap'] == ''){
581
+						if (isset($this->sd->options['block-wrap']) && $this->sd->options['block-wrap'] == '') {
582 582
 						?>
583 583
 						return content;
584 584
 						<?php
585
-						}else{
585
+						} else {
586 586
 						?>
587 587
 						var block_wrap = 'div';
588 588
 						if (attr.hasOwnProperty("block_wrap")) {
@@ -605,10 +605,10 @@  discard block
 block discarded – undo
605 605
 		 * We only add the <script> tags for code highlighting, so we strip them from the output.
606 606
 		 */
607 607
 
608
-		return str_replace( array(
608
+		return str_replace(array(
609 609
 			'<script>',
610 610
 			'</script>'
611
-		), '', $output );
611
+		), '', $output);
612 612
 	}
613 613
 
614 614
 	/**
@@ -623,63 +623,63 @@  discard block
 block discarded – undo
623 623
 	 * @since 1.1.0
624 624
 	 * @return string
625 625
 	 */
626
-	public function get_block_icon( $icon ) {
626
+	public function get_block_icon($icon) {
627 627
 
628 628
 		// check if we have a Font Awesome icon
629 629
 		$fa_type = '';
630
-		if ( substr( $icon, 0, 7 ) === 'fas fa-' ) {
630
+		if (substr($icon, 0, 7) === 'fas fa-') {
631 631
 			$fa_type = 'solid';
632
-		} elseif ( substr( $icon, 0, 7 ) === 'far fa-' ) {
632
+		} elseif (substr($icon, 0, 7) === 'far fa-') {
633 633
 			$fa_type = 'regular';
634
-		} elseif ( substr( $icon, 0, 7 ) === 'fab fa-' ) {
634
+		} elseif (substr($icon, 0, 7) === 'fab fa-') {
635 635
 			$fa_type = 'brands';
636 636
 		} else {
637
-			$icon = sprintf( "'%s'", esc_js( $icon ) );
637
+			$icon = sprintf("'%s'", esc_js($icon));
638 638
 		}
639 639
 
640 640
 		// set the icon if we found one
641
-		if ( $fa_type ) {
642
-			$fa_icon = substr( $icon, 7 );
641
+		if ($fa_type) {
642
+			$fa_icon = substr($icon, 7);
643 643
 			$icon    = "el('svg',{width: 20, height: 20, viewBox: '0 0 20 20'},el('use', {'xlink:href': '" . $this->sd->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "','href': '" . $this->sd->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "'}))";
644 644
 		}
645 645
 
646 646
 		return $icon;
647 647
 	}
648 648
 
649
-	public function block_row_start( $key, $args ) {
649
+	public function block_row_start($key, $args) {
650 650
 		// check for row
651
-		if ( ! empty( $args['row'] ) ) {
652
-			if ( ! empty( $args['row']['open'] ) ) {
651
+		if (!empty($args['row'])) {
652
+			if (!empty($args['row']['open'])) {
653 653
 				// element require
654
-				$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
654
+				$element_require = !empty($args['element_require']) ? $this->block_props_replace($args['element_require'], true) . " && " : "";
655 655
 				echo $element_require;
656
-			if ( false ){
656
+			if (false) {
657 657
 				?>
658 658
 				<script><?php }?>
659 659
 					el('div', {
660 660
 							className: 'bsui components-base-control',
661 661
 						},
662
-						<?php if(! empty( $args['row']['title'] )){ ?>
662
+						<?php if (!empty($args['row']['title'])) { ?>
663 663
 						el('label', {
664 664
 								className: 'components-base-control__label',
665
-								key: '<?php esc_attr( $key )?>-title'
665
+								key: '<?php esc_attr($key)?>-title'
666 666
 							},
667
-							'<?php echo addslashes( $args['row']['title'] ); ?>'
667
+							'<?php echo addslashes($args['row']['title']); ?>'
668 668
 						),
669 669
 						<?php }?>
670
-						<?php if(! empty( $args['row']['desc'] )){ ?>
670
+						<?php if (!empty($args['row']['desc'])) { ?>
671 671
 						el('p', {
672 672
 								className: 'components-base-control__help mb-0',
673
-								key: '<?php esc_attr( $key )?>-desc'
673
+								key: '<?php esc_attr($key)?>-desc'
674 674
 							},
675
-							'<?php echo addslashes( $args['row']['desc'] ); ?>'
675
+							'<?php echo addslashes($args['row']['desc']); ?>'
676 676
 						),
677 677
 						<?php }?>
678 678
 						el(
679 679
 							'div',
680 680
 							{
681
-								className: 'row mb-n2 <?php if ( ! empty( $args['row']['class'] ) ) {
682
-									echo esc_attr( $args['row']['class'] );
681
+								className: 'row mb-n2 <?php if (!empty($args['row']['class'])) {
682
+									echo esc_attr($args['row']['class']);
683 683
 								} ?>',
684 684
 							},
685 685
 							el(
@@ -688,10 +688,10 @@  discard block
 block discarded – undo
688 688
 									className: 'col pr-2',
689 689
 								},
690 690
 					<?php
691
-					if ( false ){
691
+					if (false) {
692 692
 					?></script><?php }
693
-			} elseif ( ! empty( $args['row']['close'] ) ) {
694
-			if ( false ){
693
+			} elseif (!empty($args['row']['close'])) {
694
+			if (false) {
695 695
 				?>
696 696
 				<script><?php }?>
697 697
 					el(
@@ -700,10 +700,10 @@  discard block
 block discarded – undo
700 700
 							className: 'col pl-0',
701 701
 						},
702 702
 					<?php
703
-					if ( false ){
703
+					if (false) {
704 704
 					?></script><?php }
705 705
 			} else {
706
-			if ( false ){
706
+			if (false) {
707 707
 				?>
708 708
 				<script><?php }?>
709 709
 					el(
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 							className: 'col pl-0 pr-2',
713 713
 						},
714 714
 					<?php
715
-					if ( false ){
715
+					if (false) {
716 716
 					?></script><?php }
717 717
 			}
718 718
 		}
@@ -725,60 +725,60 @@  discard block
 block discarded – undo
725 725
 	 *
726 726
 	 * @return mixed
727 727
 	 */
728
-	public function block_props_replace( $string, $no_wrap = false ) {
728
+	public function block_props_replace($string, $no_wrap = false) {
729 729
 
730
-		if ( $no_wrap ) {
731
-			$string = str_replace( array( "[%", "%]" ), array( "props.attributes.", "" ), $string );
730
+		if ($no_wrap) {
731
+			$string = str_replace(array("[%", "%]"), array("props.attributes.", ""), $string);
732 732
 		} else {
733
-			$string = str_replace( array( "[%", "%]" ), array( "'+props.attributes.", "+'" ), $string );
733
+			$string = str_replace(array("[%", "%]"), array("'+props.attributes.", "+'"), $string);
734 734
 		}
735 735
 
736 736
 		return $string;
737 737
 	}
738 738
 
739
-	public function build_block_arguments( $key, $args ) {
740
-		$custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->sd->array_to_attributes( $args['custom_attributes'] ) : '';
739
+	public function build_block_arguments($key, $args) {
740
+		$custom_attributes = !empty($args['custom_attributes']) ? $this->sd->array_to_attributes($args['custom_attributes']) : '';
741 741
 		$options           = '';
742
-		$key               = sanitize_key( $key );
742
+		$key               = sanitize_key($key);
743 743
 		$extra             = "key: '$key',";
744 744
 
745 745
 		// `content` is a protected and Gutenberg special argument
746
-		if ( $key == 'content' ) {
746
+		if ($key == 'content') {
747 747
 			return;
748 748
 		}
749 749
 
750 750
 		// icon
751 751
 		$icon = '';
752
-		if ( ! empty( $args['icon'] ) ) {
752
+		if (!empty($args['icon'])) {
753 753
 			$icon .= "el('div', {";
754
-			$icon .= "dangerouslySetInnerHTML: {__html: '" . $this->sd->get_widget_icon( esc_attr( $args['icon'] ) ) . "'},";
754
+			$icon .= "dangerouslySetInnerHTML: {__html: '" . $this->sd->get_widget_icon(esc_attr($args['icon'])) . "'},";
755 755
 			$icon .= "className: 'text-center',";
756
-			$icon .= "title: '" . addslashes( $args['title'] ) . "',";
756
+			$icon .= "title: '" . addslashes($args['title']) . "',";
757 757
 			$icon .= "}),";
758 758
 			// blank title as its added to the icon.
759 759
 			$args['title'] = '';
760 760
 		}
761 761
 
762 762
 		// require advanced
763
-		$require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
763
+		$require_advanced = !empty($args['advanced']) ? "props.attributes.show_advanced && " : "";
764 764
 
765 765
 		// element require
766
-		$element_require  = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
766
+		$element_require  = !empty($args['element_require']) ? $this->block_props_replace($args['element_require'], true) . " && " : "";
767 767
 		$onchange         = "props.setAttributes({ $key: $key } )";
768 768
 		$onchangecomplete = "";
769 769
 		$value            = "props.attributes.$key";
770
-		$text_type        = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx' );
771
-		if ( in_array( $args['type'], $text_type ) ) {
770
+		$text_type        = array('text', 'password', 'number', 'email', 'tel', 'url', 'colorx');
771
+		if (in_array($args['type'], $text_type)) {
772 772
 			$type = 'TextControl';
773 773
 			// Save numbers as numbers and not strings
774
-			if ( $args['type'] == 'number' ) {
774
+			if ($args['type'] == 'number') {
775 775
 				$onchange = "props.setAttributes({ $key: Number($key) } )";
776 776
 			}
777
-		} elseif ( $args['type'] == 'color' ) {
777
+		} elseif ($args['type'] == 'color') {
778 778
 			$type     = 'ColorPicker';
779 779
 			$onchange = "";
780 780
 			$extra .= "color: $value,";
781
-			if ( ! empty( $args['disable_alpha'] ) ) {
781
+			if (!empty($args['disable_alpha'])) {
782 782
 				$extra .= "disableAlpha: true,";
783 783
 			}
784 784
 			$onchangecomplete = "onChangeComplete: function($key) {
@@ -787,44 +787,44 @@  discard block
 block discarded – undo
787 787
                             $key: value
788 788
                         });
789 789
                     },";
790
-		} elseif ( $args['type'] == 'checkbox' ) {
790
+		} elseif ($args['type'] == 'checkbox') {
791 791
 			$type = 'CheckboxControl';
792 792
 			$extra .= "checked: props.attributes.$key,";
793 793
 			$onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
794
-		} elseif ( $args['type'] == 'textarea' ) {
794
+		} elseif ($args['type'] == 'textarea') {
795 795
 			$type = 'TextareaControl';
796
-		} elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
796
+		} elseif ($args['type'] == 'select' || $args['type'] == 'multiselect') {
797 797
 			$type = 'SelectControl';
798
-			if ( $args['name'] == 'category' && ! empty( $args['post_type_linked'] ) ) {
799
-				$options .= "options: taxonomies_" . str_replace( "-", "_", $this->sd->base_id . '_' . $this->sd->get_number() ) . ",";
800
-			} elseif ( $args['name'] == 'sort_by' && ! empty( $args['post_type_linked'] ) ) {
801
-				$options .= "options: sort_by_" . str_replace( "-", "_", $this->sd->base_id . '_' . $this->sd->get_number() ) . ",";
798
+			if ($args['name'] == 'category' && !empty($args['post_type_linked'])) {
799
+				$options .= "options: taxonomies_" . str_replace("-", "_", $this->sd->base_id . '_' . $this->sd->get_number()) . ",";
800
+			} elseif ($args['name'] == 'sort_by' && !empty($args['post_type_linked'])) {
801
+				$options .= "options: sort_by_" . str_replace("-", "_", $this->sd->base_id . '_' . $this->sd->get_number()) . ",";
802 802
 			} else {
803
-				if ( ! empty( $args['options'] ) ) {
803
+				if (!empty($args['options'])) {
804 804
 					$options .= "options: [";
805
-					foreach ( $args['options'] as $option_val => $option_label ) {
806
-						$options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . addslashes( $option_label ) . "' },";
805
+					foreach ($args['options'] as $option_val => $option_label) {
806
+						$options .= "{ value: '" . esc_attr($option_val) . "', label: '" . addslashes($option_label) . "' },";
807 807
 					}
808 808
 					$options .= "],";
809 809
 				}
810 810
 			}
811
-			if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
811
+			if (isset($args['multiple']) && $args['multiple']) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
812 812
 				$extra .= ' multiple: true, ';
813 813
 			}
814
-		} elseif ( $args['type'] == 'alignment' ) {
814
+		} elseif ($args['type'] == 'alignment') {
815 815
 			$type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
816
-		} elseif ( $args['type'] == 'margins' ) {
816
+		} elseif ($args['type'] == 'margins') {
817 817
 		} else {
818
-			return;// if we have not implemented the control then don't break the JS.
818
+			return; // if we have not implemented the control then don't break the JS.
819 819
 		}
820 820
 
821 821
 		// color input does not show the labels so we add them
822
-		if ( $args['type'] == 'color' ) {
822
+		if ($args['type'] == 'color') {
823 823
 			// add show only if advanced
824 824
 			echo $require_advanced;
825 825
 			// add setting require if defined
826 826
 			echo $element_require;
827
-			echo "el('div', {style: {'marginBottom': '8px'}}, '" . addslashes( $args['title'] ) . "'),";
827
+			echo "el('div', {style: {'marginBottom': '8px'}}, '" . addslashes($args['title']) . "'),";
828 828
 		}
829 829
 
830 830
 		// add show only if advanced
@@ -836,16 +836,16 @@  discard block
 block discarded – undo
836 836
 		echo $icon;
837 837
 		?>
838 838
 		el( wp.components.<?php echo $type; ?>, {
839
-		label: '<?php echo addslashes( $args['title'] ); ?>',
840
-		help: '<?php if ( isset( $args['desc'] ) ) {
841
-			echo addslashes( $args['desc'] );
839
+		label: '<?php echo addslashes($args['title']); ?>',
840
+		help: '<?php if (isset($args['desc'])) {
841
+			echo addslashes($args['desc']);
842 842
 		} ?>',
843 843
 		value: <?php echo $value; ?>,
844
-		<?php if ( $type == 'TextControl' && $args['type'] != 'text' ) {
845
-			echo "type: '" . addslashes( $args['type'] ) . "',";
844
+		<?php if ($type == 'TextControl' && $args['type'] != 'text') {
845
+			echo "type: '" . addslashes($args['type']) . "',";
846 846
 		} ?>
847
-		<?php if ( ! empty( $args['placeholder'] ) ) {
848
-			echo "placeholder: '" . addslashes( $args['placeholder'] ) . "',";
847
+		<?php if (!empty($args['placeholder'])) {
848
+			echo "placeholder: '" . addslashes($args['placeholder']) . "',";
849 849
 		}
850 850
 		echo $options;
851 851
 		echo $extra;
@@ -856,10 +856,10 @@  discard block
 block discarded – undo
856 856
 		<?php
857 857
 	}
858 858
 
859
-	public function block_row_end( $key, $args ) {
860
-		if ( ! empty( $args['row'] ) ) {
859
+	public function block_row_end($key, $args) {
860
+		if (!empty($args['row'])) {
861 861
 			// maybe close
862
-			if ( ! empty( $args['row']['close'] ) ) {
862
+			if (!empty($args['row']['close'])) {
863 863
 				echo "))";
864 864
 			}
865 865
 			echo "),";
@@ -873,80 +873,80 @@  discard block
 block discarded – undo
873 873
 	 *
874 874
 	 * @param $args
875 875
 	 */
876
-	public function block_element( $args ) {
876
+	public function block_element($args) {
877 877
 
878 878
 		// Make sure we have args.
879
-		if ( ! empty( $args ) ) {
879
+		if (!empty($args)) {
880 880
 
881 881
 			// For each argument...
882
-			foreach ( $args as $element => $new_args ) {
882
+			foreach ($args as $element => $new_args) {
883 883
 
884 884
 				// Check if its an element.
885
-				if ( is_array( $new_args ) ) {
886
-					if ( isset( $new_args['element'] ) ) {
887
-						if ( isset( $new_args['element_require'] ) ) {
888
-							echo str_replace( array(
885
+				if (is_array($new_args)) {
886
+					if (isset($new_args['element'])) {
887
+						if (isset($new_args['element_require'])) {
888
+							echo str_replace(array(
889 889
 									"'+",
890 890
 									"+'"
891
-								), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
892
-							unset( $new_args['element_require'] );
891
+								), '', $this->block_props_replace($new_args['element_require'])) . " &&  ";
892
+							unset($new_args['element_require']);
893 893
 						}
894 894
 
895 895
 						echo "\n el( '" . $new_args['element'] . "', {";
896 896
 
897 897
 						// get the attributes
898
-						foreach ( $new_args as $new_key => $new_value ) {
899
-							if ( $new_key == 'element' || $new_key == 'content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
898
+						foreach ($new_args as $new_key => $new_value) {
899
+							if ($new_key == 'element' || $new_key == 'content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array($new_value)) {
900 900
 								// do nothing
901 901
 							} else {
902
-								echo $this->block_element( array( $new_key => $new_value ) );
902
+								echo $this->block_element(array($new_key => $new_value));
903 903
 							}
904 904
 						}
905 905
 
906
-						echo "key: '$element'},";// end attributes
906
+						echo "key: '$element'},"; // end attributes
907 907
 
908 908
 						// get the content
909 909
 						$first_item = 0;
910
-						foreach ( $new_args as $new_key => $new_value ) {
911
-							if ( $new_key === 'content' || is_array( $new_value ) ) {
912
-								if ( $new_key === 'content' ) {
913
-									echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
910
+						foreach ($new_args as $new_key => $new_value) {
911
+							if ($new_key === 'content' || is_array($new_value)) {
912
+								if ($new_key === 'content') {
913
+									echo "'" . $this->block_props_replace(wp_slash($new_value)) . "'";
914 914
 								}
915 915
 
916
-								if ( is_array( $new_value ) ) {
917
-									if ( isset( $new_value['element_require'] ) ) {
918
-										echo str_replace( array(
916
+								if (is_array($new_value)) {
917
+									if (isset($new_value['element_require'])) {
918
+										echo str_replace(array(
919 919
 												"'+",
920 920
 												"+'"
921
-											), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
922
-										unset( $new_value['element_require'] );
921
+											), '', $this->block_props_replace($new_value['element_require'])) . " &&  ";
922
+										unset($new_value['element_require']);
923 923
 									}
924 924
 
925
-									if ( isset( $new_value['element_repeat'] ) ) {
925
+									if (isset($new_value['element_repeat'])) {
926 926
 										$x = 1;
927
-										while ( $x <= absint( $new_value['element_repeat'] ) ) {
928
-											$this->block_element( array( '' => $new_value ) );
929
-											$x ++;
927
+										while ($x <= absint($new_value['element_repeat'])) {
928
+											$this->block_element(array('' => $new_value));
929
+											$x++;
930 930
 										}
931 931
 									} else {
932
-										$this->block_element( array( '' => $new_value ) );
932
+										$this->block_element(array('' => $new_value));
933 933
 									}
934 934
 								}
935
-								$first_item ++;
935
+								$first_item++;
936 936
 							}
937 937
 						}
938
-						echo ")";// end content
938
+						echo ")"; // end content
939 939
 						echo ", \n";
940 940
 					}
941 941
 
942 942
 					// Or an attribute.
943 943
 				} else {
944
-					if ( substr( $element, 0, 3 ) === 'if_' ) {
945
-						echo str_replace( 'if_', '', $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
946
-					} elseif ( $element == 'style' ) {
947
-						echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
944
+					if (substr($element, 0, 3) === 'if_') {
945
+						echo str_replace('if_', '', $element) . ": " . $this->block_props_replace($new_args, true) . ",";
946
+					} elseif ($element == 'style') {
947
+						echo $element . ": " . $this->block_props_replace($new_args) . ",";
948 948
 					} else {
949
-						echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
949
+						echo $element . ": '" . $this->block_props_replace($new_args) . "',";
950 950
 					}
951 951
 				}
952 952
 			}
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
 	 * Enqueue CSS assets in the editor if defined
959 959
 	 */
960 960
 	public function enqueue_editor_assets() {
961
-		if ( isset( $this->sd->options['block-editor-style'] ) ) {
961
+		if (isset($this->sd->options['block-editor-style'])) {
962 962
 			echo "<link rel='stylesheet' id='glossary-shortcode' href='" . $this->sd->options['block-editor-style'] . "'/>";
963 963
 		}
964 964
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 								$panel_count ++;
459 459
 
460 460
 								}
461
-								}else {
461
+								} else {
462 462
 								?>
463 463
 								el(wp.components.PanelBody, {
464 464
 										title: '<?php esc_attr_e( "Settings" ); ?>',
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 							// If the user sets block-output array then build it
486 486
 							if ( ! empty( $this->sd->options['block-output'] ) ) {
487 487
 							$this->block_element( $this->sd->options['block-output'] );
488
-						}else{
488
+						} else{
489 489
 							// if no block-output is set then we try and get the shortcode html output via ajax.
490 490
 							?>
491 491
 							el('div', {
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 						?>
583 583
 						return content;
584 584
 						<?php
585
-						}else{
585
+						} else{
586 586
 						?>
587 587
 						var block_wrap = 'div';
588 588
 						if (attr.hasOwnProperty("block_wrap")) {
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/type/widget.php 2 patches
Indentation   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -17,194 +17,194 @@
 block discarded – undo
17 17
  */
18 18
 class WP_Super_Duper_Widget extends WP_Widget {
19 19
 
20
-	/**
21
-	 * @var WP_Super_Duper
22
-	 */
23
-	protected $sd;
24
-
25
-	/**
26
-	 * Class constructor.
27
-	 *
28
-	 * @param WP_Super_Duper $super_duper
29
-	 */
30
-	public function __construct( $super_duper ) {
31
-		$this->sd = $super_duper;
32
-
33
-		// Register widget.
34
-		$widget_ops = $super_duper->options['widget_ops'];
35
-
36
-		// Only overwrite if not set already.
37
-		if ( ! isset( $widget_ops['show_instance_in_rest'] ) ) {
38
-			$widget_ops['show_instance_in_rest'] = true;
39
-		}
40
-
41
-		parent::__construct( $super_duper->options['base_id'], $super_duper->options['name'], $widget_ops );
42
-
43
-		if ( did_action( 'widgets_init' ) || doing_action( 'widgets_init' ) ) {
44
-			$this->register_widget();
45
-		} else {
46
-			add_action( 'widgets_init', array( $this, 'register_widget' ) );
47
-		}
48
-
49
-		add_action( 'wp_enqueue_scripts', array( __CLASS__, 'enqueue_scripts' ) );
50
-		add_action( 'elementor/editor/after_enqueue_styles', array( __CLASS__, 'elementor_editor_styles' ) );
51
-		add_filter( 'widget_types_to_hide_from_legacy_widget_block', array( $this, 'hide_widget' ) );
52
-
53
-	}
54
-
55
-	/**
56
-	 * Registers the widget.
57
-	 */
58
-	public function register_widget() {
59
-		register_widget( $this );
60
-	}
61
-
62
-	/**
63
-	 * Enqeues scripts.
64
-	 *
65
-	 * @param WP_Super_Duper $super_duper
66
-	 */
67
-	public static function enqueue_scripts() {
68
-		wp_add_inline_script( 'admin-widgets', WP_Super_Duper::widget_js() );
69
-		wp_add_inline_script( 'customize-controls', WP_Super_Duper::widget_js() );
70
-		wp_add_inline_style( 'widgets', WP_Super_Duper::widget_css() );
71
-	}
72
-
73
-	/**
74
-	 * Add our widget CSS to elementor editor.
75
-	 */
76
-	public static function elementor_editor_styles() {
77
-		wp_add_inline_style( 'elementor-editor', WP_Super_Duper::widget_css( false ) );
78
-	}
79
-
80
-	/**
81
-	 * Outputs the content of the widget
82
-	 *
83
-	 * @param array $args
84
-	 * @param array $instance
85
-	 */
86
-	public function widget( $args, $instance ) {
87
-
88
-		// Prepare output args.
89
-		$argument_values = $this->sd->argument_values( $instance );
90
-		$argument_values = $this->sd->string_to_bool( $argument_values );
91
-		$output          = $this->sd->output( $argument_values, $args );
92
-		$no_wrap         = ! empty( $argument_values['no_wrap'] );
93
-
94
-		ob_start();
95
-		if ( $output && ! $no_wrap ) {
96
-
97
-			$class_original = $this->sd->options['widget_ops']['classname'];
98
-			$class          = $this->sd->options['widget_ops']['classname'] . ' sdel-' . $this->sd->get_instance_hash();
99
-
100
-			// Before widget
101
-			$before_widget = $args['before_widget'];
102
-			$before_widget = str_replace( $class_original, $class, $before_widget );
103
-			$before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
104
-			$before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->sd->base_id, $before_widget, $args, $instance, $this );
105
-
106
-			// After widget
107
-			$after_widget = $args['after_widget'];
108
-			$after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
109
-			$after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->sd->base_id, $after_widget, $args, $instance, $this );
110
-
111
-			echo $before_widget;
112
-
113
-			// elementor strips the widget wrapping div so we check for and add it back if needed
114
-			if ( $this->is_elementor_widget_output() ) {
115
-				// Filter class & attrs for elementor widget output.
116
-				$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this->sd, $this );
117
-				$class = apply_filters( 'wp_super_duper_div_classname_' . $this->sd->base_id, $class, $args, $this->sd, $this );
118
-
119
-				$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this->sd, $this );
120
-				$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->sd->base_id, $attrs, $args, $this->sd, $this );
121
-
122
-				echo "<span class='" . esc_attr( $class ) . "' " . $attrs . ">";
123
-			}
124
-
125
-			echo $this->sd->output_title( $args, $instance );
126
-			echo $output;
127
-			if ( $this->is_elementor_widget_output() ) {
128
-				echo "</span>";
129
-			}
130
-
131
-			echo $after_widget;
132
-		} elseif ( $this->sd->is_preview() && $output == '' ) {// if preview show a placeholder if empty
133
-			$output = $this->sd->preview_placeholder_text( "{{" . $this->base_id . "}}" );
134
-			echo $output;
135
-		} elseif ( $output && $no_wrap ) {
136
-			echo $output;
137
-		}
138
-		$output = ob_get_clean();
139
-
140
-		$output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
141
-
142
-		echo $output;
143
-	}
144
-
145
-	/**
146
-	 * Tests if the current output is inside a elementor container.
147
-	 *
148
-	 * @since 1.0.4
149
-	 * @return bool
150
-	 */
151
-	public function is_elementor_widget_output() {
152
-		return defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID';
153
-	}
154
-
155
-	/**
156
-	 * Outputs the options form inputs for the widget.
157
-	 *
158
-	 * @param array $instance The widget options.
159
-	 */
160
-	public function form( $instance ) {
161
-		$this->sd->form( $instance );
162
-	}
163
-
164
-	/**
165
-	 * Processing widget options on save
166
-	 *
167
-	 * @param array $new_instance The new options
168
-	 * @param array $old_instance The previous options
169
-	 *
170
-	 * @return array
171
-	 * @todo we should add some sanitation here.
172
-	 */
173
-	public function update( $new_instance, $old_instance ) {
174
-
175
-		// Save the widget.
176
-		$instance = array_merge( (array) $old_instance, (array) $new_instance );
177
-
178
-		// set widget instance
179
-		$this->sd->instance = $instance;
180
-
181
-		if ( empty( $this->arguments ) ) {
182
-			$this->sd->get_arguments();
183
-		}
184
-
185
-		// check for checkboxes
186
-		if ( ! empty( $this->sd->arguments ) ) {
187
-			foreach ( $this->sd->arguments as $argument ) {
188
-				if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
189
-					$instance[ $argument['name'] ] = '0';
190
-				}
191
-			}
192
-		}
193
-
194
-		return $instance;
195
-	}
196
-
197
-	/**
198
-	 * Hides this widget from the block widgets inserter function.
199
-	 *
200
-	 * @param array $widget_types List of hidden widgets.
201
-	 *
202
-	 * @return array
203
-	 */
204
-	public function hide_widget( $widget_types ) {
205
-		$widget_types[] = $this->id_base;
206
-
207
-		return $widget_types;
208
-	}
20
+    /**
21
+     * @var WP_Super_Duper
22
+     */
23
+    protected $sd;
24
+
25
+    /**
26
+     * Class constructor.
27
+     *
28
+     * @param WP_Super_Duper $super_duper
29
+     */
30
+    public function __construct( $super_duper ) {
31
+        $this->sd = $super_duper;
32
+
33
+        // Register widget.
34
+        $widget_ops = $super_duper->options['widget_ops'];
35
+
36
+        // Only overwrite if not set already.
37
+        if ( ! isset( $widget_ops['show_instance_in_rest'] ) ) {
38
+            $widget_ops['show_instance_in_rest'] = true;
39
+        }
40
+
41
+        parent::__construct( $super_duper->options['base_id'], $super_duper->options['name'], $widget_ops );
42
+
43
+        if ( did_action( 'widgets_init' ) || doing_action( 'widgets_init' ) ) {
44
+            $this->register_widget();
45
+        } else {
46
+            add_action( 'widgets_init', array( $this, 'register_widget' ) );
47
+        }
48
+
49
+        add_action( 'wp_enqueue_scripts', array( __CLASS__, 'enqueue_scripts' ) );
50
+        add_action( 'elementor/editor/after_enqueue_styles', array( __CLASS__, 'elementor_editor_styles' ) );
51
+        add_filter( 'widget_types_to_hide_from_legacy_widget_block', array( $this, 'hide_widget' ) );
52
+
53
+    }
54
+
55
+    /**
56
+     * Registers the widget.
57
+     */
58
+    public function register_widget() {
59
+        register_widget( $this );
60
+    }
61
+
62
+    /**
63
+     * Enqeues scripts.
64
+     *
65
+     * @param WP_Super_Duper $super_duper
66
+     */
67
+    public static function enqueue_scripts() {
68
+        wp_add_inline_script( 'admin-widgets', WP_Super_Duper::widget_js() );
69
+        wp_add_inline_script( 'customize-controls', WP_Super_Duper::widget_js() );
70
+        wp_add_inline_style( 'widgets', WP_Super_Duper::widget_css() );
71
+    }
72
+
73
+    /**
74
+     * Add our widget CSS to elementor editor.
75
+     */
76
+    public static function elementor_editor_styles() {
77
+        wp_add_inline_style( 'elementor-editor', WP_Super_Duper::widget_css( false ) );
78
+    }
79
+
80
+    /**
81
+     * Outputs the content of the widget
82
+     *
83
+     * @param array $args
84
+     * @param array $instance
85
+     */
86
+    public function widget( $args, $instance ) {
87
+
88
+        // Prepare output args.
89
+        $argument_values = $this->sd->argument_values( $instance );
90
+        $argument_values = $this->sd->string_to_bool( $argument_values );
91
+        $output          = $this->sd->output( $argument_values, $args );
92
+        $no_wrap         = ! empty( $argument_values['no_wrap'] );
93
+
94
+        ob_start();
95
+        if ( $output && ! $no_wrap ) {
96
+
97
+            $class_original = $this->sd->options['widget_ops']['classname'];
98
+            $class          = $this->sd->options['widget_ops']['classname'] . ' sdel-' . $this->sd->get_instance_hash();
99
+
100
+            // Before widget
101
+            $before_widget = $args['before_widget'];
102
+            $before_widget = str_replace( $class_original, $class, $before_widget );
103
+            $before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
104
+            $before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->sd->base_id, $before_widget, $args, $instance, $this );
105
+
106
+            // After widget
107
+            $after_widget = $args['after_widget'];
108
+            $after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
109
+            $after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->sd->base_id, $after_widget, $args, $instance, $this );
110
+
111
+            echo $before_widget;
112
+
113
+            // elementor strips the widget wrapping div so we check for and add it back if needed
114
+            if ( $this->is_elementor_widget_output() ) {
115
+                // Filter class & attrs for elementor widget output.
116
+                $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this->sd, $this );
117
+                $class = apply_filters( 'wp_super_duper_div_classname_' . $this->sd->base_id, $class, $args, $this->sd, $this );
118
+
119
+                $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this->sd, $this );
120
+                $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->sd->base_id, $attrs, $args, $this->sd, $this );
121
+
122
+                echo "<span class='" . esc_attr( $class ) . "' " . $attrs . ">";
123
+            }
124
+
125
+            echo $this->sd->output_title( $args, $instance );
126
+            echo $output;
127
+            if ( $this->is_elementor_widget_output() ) {
128
+                echo "</span>";
129
+            }
130
+
131
+            echo $after_widget;
132
+        } elseif ( $this->sd->is_preview() && $output == '' ) {// if preview show a placeholder if empty
133
+            $output = $this->sd->preview_placeholder_text( "{{" . $this->base_id . "}}" );
134
+            echo $output;
135
+        } elseif ( $output && $no_wrap ) {
136
+            echo $output;
137
+        }
138
+        $output = ob_get_clean();
139
+
140
+        $output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
141
+
142
+        echo $output;
143
+    }
144
+
145
+    /**
146
+     * Tests if the current output is inside a elementor container.
147
+     *
148
+     * @since 1.0.4
149
+     * @return bool
150
+     */
151
+    public function is_elementor_widget_output() {
152
+        return defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID';
153
+    }
154
+
155
+    /**
156
+     * Outputs the options form inputs for the widget.
157
+     *
158
+     * @param array $instance The widget options.
159
+     */
160
+    public function form( $instance ) {
161
+        $this->sd->form( $instance );
162
+    }
163
+
164
+    /**
165
+     * Processing widget options on save
166
+     *
167
+     * @param array $new_instance The new options
168
+     * @param array $old_instance The previous options
169
+     *
170
+     * @return array
171
+     * @todo we should add some sanitation here.
172
+     */
173
+    public function update( $new_instance, $old_instance ) {
174
+
175
+        // Save the widget.
176
+        $instance = array_merge( (array) $old_instance, (array) $new_instance );
177
+
178
+        // set widget instance
179
+        $this->sd->instance = $instance;
180
+
181
+        if ( empty( $this->arguments ) ) {
182
+            $this->sd->get_arguments();
183
+        }
184
+
185
+        // check for checkboxes
186
+        if ( ! empty( $this->sd->arguments ) ) {
187
+            foreach ( $this->sd->arguments as $argument ) {
188
+                if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
189
+                    $instance[ $argument['name'] ] = '0';
190
+                }
191
+            }
192
+        }
193
+
194
+        return $instance;
195
+    }
196
+
197
+    /**
198
+     * Hides this widget from the block widgets inserter function.
199
+     *
200
+     * @param array $widget_types List of hidden widgets.
201
+     *
202
+     * @return array
203
+     */
204
+    public function hide_widget( $widget_types ) {
205
+        $widget_types[] = $this->id_base;
206
+
207
+        return $widget_types;
208
+    }
209 209
 
210 210
 }
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @since 2.0.0
6 6
  */
7 7
 
8
-defined( 'ABSPATH' ) || exit;
8
+defined('ABSPATH') || exit;
9 9
 
10 10
 /**
11 11
  *
@@ -27,28 +27,28 @@  discard block
 block discarded – undo
27 27
 	 *
28 28
 	 * @param WP_Super_Duper $super_duper
29 29
 	 */
30
-	public function __construct( $super_duper ) {
30
+	public function __construct($super_duper) {
31 31
 		$this->sd = $super_duper;
32 32
 
33 33
 		// Register widget.
34 34
 		$widget_ops = $super_duper->options['widget_ops'];
35 35
 
36 36
 		// Only overwrite if not set already.
37
-		if ( ! isset( $widget_ops['show_instance_in_rest'] ) ) {
37
+		if (!isset($widget_ops['show_instance_in_rest'])) {
38 38
 			$widget_ops['show_instance_in_rest'] = true;
39 39
 		}
40 40
 
41
-		parent::__construct( $super_duper->options['base_id'], $super_duper->options['name'], $widget_ops );
41
+		parent::__construct($super_duper->options['base_id'], $super_duper->options['name'], $widget_ops);
42 42
 
43
-		if ( did_action( 'widgets_init' ) || doing_action( 'widgets_init' ) ) {
43
+		if (did_action('widgets_init') || doing_action('widgets_init')) {
44 44
 			$this->register_widget();
45 45
 		} else {
46
-			add_action( 'widgets_init', array( $this, 'register_widget' ) );
46
+			add_action('widgets_init', array($this, 'register_widget'));
47 47
 		}
48 48
 
49
-		add_action( 'wp_enqueue_scripts', array( __CLASS__, 'enqueue_scripts' ) );
50
-		add_action( 'elementor/editor/after_enqueue_styles', array( __CLASS__, 'elementor_editor_styles' ) );
51
-		add_filter( 'widget_types_to_hide_from_legacy_widget_block', array( $this, 'hide_widget' ) );
49
+		add_action('wp_enqueue_scripts', array(__CLASS__, 'enqueue_scripts'));
50
+		add_action('elementor/editor/after_enqueue_styles', array(__CLASS__, 'elementor_editor_styles'));
51
+		add_filter('widget_types_to_hide_from_legacy_widget_block', array($this, 'hide_widget'));
52 52
 
53 53
 	}
54 54
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * Registers the widget.
57 57
 	 */
58 58
 	public function register_widget() {
59
-		register_widget( $this );
59
+		register_widget($this);
60 60
 	}
61 61
 
62 62
 	/**
@@ -65,16 +65,16 @@  discard block
 block discarded – undo
65 65
 	 * @param WP_Super_Duper $super_duper
66 66
 	 */
67 67
 	public static function enqueue_scripts() {
68
-		wp_add_inline_script( 'admin-widgets', WP_Super_Duper::widget_js() );
69
-		wp_add_inline_script( 'customize-controls', WP_Super_Duper::widget_js() );
70
-		wp_add_inline_style( 'widgets', WP_Super_Duper::widget_css() );
68
+		wp_add_inline_script('admin-widgets', WP_Super_Duper::widget_js());
69
+		wp_add_inline_script('customize-controls', WP_Super_Duper::widget_js());
70
+		wp_add_inline_style('widgets', WP_Super_Duper::widget_css());
71 71
 	}
72 72
 
73 73
 	/**
74 74
 	 * Add our widget CSS to elementor editor.
75 75
 	 */
76 76
 	public static function elementor_editor_styles() {
77
-		wp_add_inline_style( 'elementor-editor', WP_Super_Duper::widget_css( false ) );
77
+		wp_add_inline_style('elementor-editor', WP_Super_Duper::widget_css(false));
78 78
 	}
79 79
 
80 80
 	/**
@@ -83,61 +83,61 @@  discard block
 block discarded – undo
83 83
 	 * @param array $args
84 84
 	 * @param array $instance
85 85
 	 */
86
-	public function widget( $args, $instance ) {
86
+	public function widget($args, $instance) {
87 87
 
88 88
 		// Prepare output args.
89
-		$argument_values = $this->sd->argument_values( $instance );
90
-		$argument_values = $this->sd->string_to_bool( $argument_values );
91
-		$output          = $this->sd->output( $argument_values, $args );
92
-		$no_wrap         = ! empty( $argument_values['no_wrap'] );
89
+		$argument_values = $this->sd->argument_values($instance);
90
+		$argument_values = $this->sd->string_to_bool($argument_values);
91
+		$output          = $this->sd->output($argument_values, $args);
92
+		$no_wrap         = !empty($argument_values['no_wrap']);
93 93
 
94 94
 		ob_start();
95
-		if ( $output && ! $no_wrap ) {
95
+		if ($output && !$no_wrap) {
96 96
 
97 97
 			$class_original = $this->sd->options['widget_ops']['classname'];
98 98
 			$class          = $this->sd->options['widget_ops']['classname'] . ' sdel-' . $this->sd->get_instance_hash();
99 99
 
100 100
 			// Before widget
101 101
 			$before_widget = $args['before_widget'];
102
-			$before_widget = str_replace( $class_original, $class, $before_widget );
103
-			$before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
104
-			$before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->sd->base_id, $before_widget, $args, $instance, $this );
102
+			$before_widget = str_replace($class_original, $class, $before_widget);
103
+			$before_widget = apply_filters('wp_super_duper_before_widget', $before_widget, $args, $instance, $this);
104
+			$before_widget = apply_filters('wp_super_duper_before_widget_' . $this->sd->base_id, $before_widget, $args, $instance, $this);
105 105
 
106 106
 			// After widget
107 107
 			$after_widget = $args['after_widget'];
108
-			$after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
109
-			$after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->sd->base_id, $after_widget, $args, $instance, $this );
108
+			$after_widget = apply_filters('wp_super_duper_after_widget', $after_widget, $args, $instance, $this);
109
+			$after_widget = apply_filters('wp_super_duper_after_widget_' . $this->sd->base_id, $after_widget, $args, $instance, $this);
110 110
 
111 111
 			echo $before_widget;
112 112
 
113 113
 			// elementor strips the widget wrapping div so we check for and add it back if needed
114
-			if ( $this->is_elementor_widget_output() ) {
114
+			if ($this->is_elementor_widget_output()) {
115 115
 				// Filter class & attrs for elementor widget output.
116
-				$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this->sd, $this );
117
-				$class = apply_filters( 'wp_super_duper_div_classname_' . $this->sd->base_id, $class, $args, $this->sd, $this );
116
+				$class = apply_filters('wp_super_duper_div_classname', $class, $args, $this->sd, $this);
117
+				$class = apply_filters('wp_super_duper_div_classname_' . $this->sd->base_id, $class, $args, $this->sd, $this);
118 118
 
119
-				$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this->sd, $this );
120
-				$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->sd->base_id, $attrs, $args, $this->sd, $this );
119
+				$attrs = apply_filters('wp_super_duper_div_attrs', '', $args, $this->sd, $this);
120
+				$attrs = apply_filters('wp_super_duper_div_attrs_' . $this->sd->base_id, $attrs, $args, $this->sd, $this);
121 121
 
122
-				echo "<span class='" . esc_attr( $class ) . "' " . $attrs . ">";
122
+				echo "<span class='" . esc_attr($class) . "' " . $attrs . ">";
123 123
 			}
124 124
 
125
-			echo $this->sd->output_title( $args, $instance );
125
+			echo $this->sd->output_title($args, $instance);
126 126
 			echo $output;
127
-			if ( $this->is_elementor_widget_output() ) {
127
+			if ($this->is_elementor_widget_output()) {
128 128
 				echo "</span>";
129 129
 			}
130 130
 
131 131
 			echo $after_widget;
132
-		} elseif ( $this->sd->is_preview() && $output == '' ) {// if preview show a placeholder if empty
133
-			$output = $this->sd->preview_placeholder_text( "{{" . $this->base_id . "}}" );
132
+		} elseif ($this->sd->is_preview() && $output == '') {// if preview show a placeholder if empty
133
+			$output = $this->sd->preview_placeholder_text("{{" . $this->base_id . "}}");
134 134
 			echo $output;
135
-		} elseif ( $output && $no_wrap ) {
135
+		} elseif ($output && $no_wrap) {
136 136
 			echo $output;
137 137
 		}
138 138
 		$output = ob_get_clean();
139 139
 
140
-		$output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
140
+		$output = apply_filters('wp_super_duper_widget_output', $output, $instance, $args, $this);
141 141
 
142 142
 		echo $output;
143 143
 	}
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * @return bool
150 150
 	 */
151 151
 	public function is_elementor_widget_output() {
152
-		return defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID';
152
+		return defined('ELEMENTOR_VERSION') && isset($this->number) && $this->number == 'REPLACE_TO_ID';
153 153
 	}
154 154
 
155 155
 	/**
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @param array $instance The widget options.
159 159
 	 */
160
-	public function form( $instance ) {
161
-		$this->sd->form( $instance );
160
+	public function form($instance) {
161
+		$this->sd->form($instance);
162 162
 	}
163 163
 
164 164
 	/**
@@ -170,23 +170,23 @@  discard block
 block discarded – undo
170 170
 	 * @return array
171 171
 	 * @todo we should add some sanitation here.
172 172
 	 */
173
-	public function update( $new_instance, $old_instance ) {
173
+	public function update($new_instance, $old_instance) {
174 174
 
175 175
 		// Save the widget.
176
-		$instance = array_merge( (array) $old_instance, (array) $new_instance );
176
+		$instance = array_merge((array) $old_instance, (array) $new_instance);
177 177
 
178 178
 		// set widget instance
179 179
 		$this->sd->instance = $instance;
180 180
 
181
-		if ( empty( $this->arguments ) ) {
181
+		if (empty($this->arguments)) {
182 182
 			$this->sd->get_arguments();
183 183
 		}
184 184
 
185 185
 		// check for checkboxes
186
-		if ( ! empty( $this->sd->arguments ) ) {
187
-			foreach ( $this->sd->arguments as $argument ) {
188
-				if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
189
-					$instance[ $argument['name'] ] = '0';
186
+		if (!empty($this->sd->arguments)) {
187
+			foreach ($this->sd->arguments as $argument) {
188
+				if (isset($argument['type']) && $argument['type'] == 'checkbox' && !isset($new_instance[$argument['name']])) {
189
+					$instance[$argument['name']] = '0';
190 190
 				}
191 191
 			}
192 192
 		}
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 *
202 202
 	 * @return array
203 203
 	 */
204
-	public function hide_widget( $widget_types ) {
204
+	public function hide_widget($widget_types) {
205 205
 		$widget_types[] = $this->id_base;
206 206
 
207 207
 		return $widget_types;
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/type/shortcode.php 2 patches
Indentation   +321 added lines, -321 removed lines patch added patch discarded remove patch
@@ -17,268 +17,268 @@  discard block
 block discarded – undo
17 17
  */
18 18
 class WP_Super_Duper_Shortcode {
19 19
 
20
-	/**
21
-	 * @var WP_Super_Duper
22
-	 */
23
-	protected $sd;
24
-
25
-	/**
26
-	 * Class constructor.
27
-	 *
28
-	 * @param WP_Super_Duper $super_duper
29
-	 */
30
-	public function __construct( $super_duper ) {
31
-
32
-		$this->sd = $super_duper;
33
-
34
-		// Registers the shortcode.
35
-		add_shortcode( $this->sd->base_id, array( $this, 'shortcode_output' ) );
36
-
37
-		// This makes the insert button work for cornerstone.
38
-		add_action( 'wp_print_footer_scripts', array( $this, 'maybe_cornerstone_builder' ) );
39
-
40
-		// Fusion Builder (avada) support
41
-		if ( function_exists( 'fusion_builder_map' ) ) {
42
-			add_action( 'init', array( $this, 'register_fusion_element' ) );
43
-		}
44
-
45
-		// Add shortcode insert button once
46
-		add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
47
-		add_action( 'wp_ajax_super_duper_get_widget_settings', array( $this, 'get_widget_settings' ) );
48
-
49
-		// generatepress theme sections compatibility
50
-		if ( function_exists( 'generate_sections_sections_metabox' ) ) {
51
-			add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
52
-		}
53
-
54
-		if ( $this->sd->is_preview() ) {
55
-			add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
56
-			// this makes the insert button work for elementor
57
-			add_action( 'elementor/editor/after_enqueue_scripts', array(
58
-				$this,
59
-				'shortcode_insert_button_script'
60
-			) ); // for elementor
61
-		}
62
-
63
-	}
64
-
65
-	/**
66
-	 * Insert shortcode builder button to classic editor (not inside Gutenberg, not needed).
67
-	 *
68
-	 * @since 1.0.0
69
-	 *
70
-	 * @param string $editor_id Optional. Shortcode editor id. Default null.
71
-	 * @param string $insert_shortcode_function Optional. Insert shortcode function. Default null.
72
-	 */
73
-	public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
74
-		global $shortcode_insert_button_once;
75
-		if ( $shortcode_insert_button_once ) {
76
-			return;
77
-		}
78
-		add_thickbox();
79
-
80
-		/**
81
-		 * Cornerstone makes us play dirty tricks :/
82
-		 * All media_buttons are removed via JS unless they are two specific id's so we wrap our content in this ID so it is not removed.
83
-		 */
84
-		if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
85
-			echo '<span id="insert-media-button">';
86
-		}
87
-
88
-		echo self::shortcode_button( 'this', 'true' );
89
-
90
-		// see opening note
91
-		if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
92
-			echo '</span>'; // end #insert-media-button
93
-		}
94
-
95
-		// Add separate script for generatepress theme sections
96
-		if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
97
-		} else {
98
-			self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
99
-		}
100
-
101
-		$shortcode_insert_button_once = true;
102
-	}
103
-
104
-	/**
105
-	 * Output the shortcode.
106
-	 *
107
-	 * @param array $args
108
-	 * @param string $content
109
-	 *
110
-	 * @return string
111
-	 */
112
-	public function shortcode_output( $args = array(), $content = '' ) {
113
-		$args = $this->sd->argument_values( $args );
114
-
115
-		// Clean booleans.
116
-		$args = $this->sd->string_to_bool( $args );
117
-
118
-		// if we have a enclosed shortcode we add it to the special `html` argument
119
-		if ( ! empty( $content ) ) {
120
-			$args['html'] = $content;
121
-		}
122
-
123
-		$class = isset( $this->sd->options['widget_ops']['classname'] ) ? esc_attr( $this->sd->options['widget_ops']['classname'] ) : '';
124
-		$class .= " sdel-" . $this->sd->get_instance_hash();
125
-
126
-		$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this->sd, $this );
127
-		$class = apply_filters( 'wp_super_duper_div_classname_' . $this->sd->base_id, $class, $args, $this->sd, $this );
128
-
129
-		$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this->sd, $this );
130
-		$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->sd->base_id, $attrs, $args, $this->sd, $this );
131
-
132
-		$shortcode_args = array();
133
-		$output         = '';
134
-		$no_wrap        = ! empty( $this->sd->options['no_wrap'] ) || ! empty( $args['no_wrap'] );
135
-
136
-		$main_content = $this->sd->output( $args, $shortcode_args, $content );
137
-
138
-		if ( $main_content && ! $no_wrap ) {
139
-			// wrap the shortcode in a div with the same class as the widget
140
-			$output .= '<div class="' . esc_attr( $class ) . '" ' . $attrs . '>';
141
-			if ( ! empty( $args['title'] ) ) {
142
-				// if its a shortcode and there is a title try to grab the title wrappers
143
-				$shortcode_args = array( 'before_title' => '', 'after_title' => '' );
144
-				if ( empty( $instance ) ) {
145
-					global $wp_registered_sidebars;
146
-					if ( ! empty( $wp_registered_sidebars ) ) {
147
-						foreach ( $wp_registered_sidebars as $sidebar ) {
148
-							if ( ! empty( $sidebar['before_title'] ) ) {
149
-								$shortcode_args['before_title'] = $sidebar['before_title'];
150
-								$shortcode_args['after_title']  = $sidebar['after_title'];
151
-								break;
152
-							}
153
-						}
154
-					}
155
-				}
156
-				$output .= $this->sd->output_title( $shortcode_args, $args );
157
-			}
158
-			$output .= $main_content;
159
-			$output .= '</div>';
160
-		} elseif ( $main_content && $no_wrap ) {
161
-			$output .= $main_content;
162
-		}
163
-
164
-		// if preview, show a placeholder if empty
165
-		if ( $this->sd->is_preview() && $output == '' ) {
166
-			$output = $this->sd->preview_placeholder_text( "{{" . $this->sd->base_id . "}}" );
167
-		}
168
-
169
-		return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
170
-	}
171
-
172
-	public function register_fusion_element() {
173
-		$options = $this->sd->options;
174
-
175
-		if ( $this->sd->base_id ) {
176
-
177
-			$params = $this->get_fusion_params();
178
-
179
-			$args = array(
180
-				'name'            => $options['name'],
181
-				'shortcode'       => $this->sd->base_id,
182
-				'icon'            => $options['block-icon'] ? $options['block-icon'] : 'far fa-square',
183
-				'allow_generator' => true,
184
-			);
185
-
186
-			if ( ! empty( $params ) ) {
187
-				$args['params'] = $params;
188
-			}
189
-
190
-			fusion_builder_map( $args );
191
-		}
192
-	}
193
-
194
-	protected function get_fusion_params() {
195
-		$params    = array();
196
-		$arguments = $this->sd->get_arguments();
197
-
198
-		if ( ! empty( $arguments ) ) {
199
-			foreach ( $arguments as $key => $val ) {
200
-				$param = array();
201
-				// type
202
-				$param['type'] = str_replace(
203
-					array(
204
-						"text",
205
-						"number",
206
-						"email",
207
-						"color",
208
-						"checkbox"
209
-					),
210
-					array(
211
-						"textfield",
212
-						"textfield",
213
-						"textfield",
214
-						"colorpicker",
215
-						"select",
216
-					),
217
-					$val['type'] );
218
-
219
-				// multiselect
220
-				if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
221
-					$param['type']     = 'multiple_select';
222
-					$param['multiple'] = true;
223
-				}
224
-
225
-				// heading
226
-				$param['heading'] = $val['title'];
227
-
228
-				// description
229
-				$param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
230
-
231
-				// param_name
232
-				$param['param_name'] = $key;
233
-
234
-				// Default
235
-				$param['default'] = isset( $val['default'] ) ? $val['default'] : '';
236
-
237
-				// Group
238
-				if ( isset( $val['group'] ) ) {
239
-					$param['group'] = $val['group'];
240
-				}
241
-
242
-				// value
243
-				if ( $val['type'] == 'checkbox' ) {
244
-					if ( isset( $val['default'] ) && $val['default'] == '0' ) {
245
-						unset( $param['default'] );
246
-					}
247
-					$param['value'] = array( '' => __( "No" ), '1' => __( "Yes" ) );
248
-				} elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
249
-					$param['value'] = isset( $val['options'] ) ? $val['options'] : array();
250
-				} else {
251
-					$param['value'] = isset( $val['default'] ) ? $val['default'] : '';
252
-				}
253
-
254
-				// setup the param
255
-				$params[] = $param;
256
-
257
-			}
258
-		}
259
-
260
-		return $params;
261
-	}
262
-
263
-	/**
264
-	 * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder
265
-	 */
266
-	public function maybe_cornerstone_builder() {
267
-		if ( did_action( 'cornerstone_before_boot_app' ) ) {
268
-			self::shortcode_insert_button_script();
269
-		}
270
-	}
271
-
272
-	/**
273
-	 * Output the JS and CSS for the shortcode insert button.
274
-	 *
275
-	 * @since 1.0.6
276
-	 *
277
-	 * @param string $editor_id
278
-	 * @param string $insert_shortcode_function
279
-	 */
280
-	public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
281
-		?>
20
+    /**
21
+     * @var WP_Super_Duper
22
+     */
23
+    protected $sd;
24
+
25
+    /**
26
+     * Class constructor.
27
+     *
28
+     * @param WP_Super_Duper $super_duper
29
+     */
30
+    public function __construct( $super_duper ) {
31
+
32
+        $this->sd = $super_duper;
33
+
34
+        // Registers the shortcode.
35
+        add_shortcode( $this->sd->base_id, array( $this, 'shortcode_output' ) );
36
+
37
+        // This makes the insert button work for cornerstone.
38
+        add_action( 'wp_print_footer_scripts', array( $this, 'maybe_cornerstone_builder' ) );
39
+
40
+        // Fusion Builder (avada) support
41
+        if ( function_exists( 'fusion_builder_map' ) ) {
42
+            add_action( 'init', array( $this, 'register_fusion_element' ) );
43
+        }
44
+
45
+        // Add shortcode insert button once
46
+        add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
47
+        add_action( 'wp_ajax_super_duper_get_widget_settings', array( $this, 'get_widget_settings' ) );
48
+
49
+        // generatepress theme sections compatibility
50
+        if ( function_exists( 'generate_sections_sections_metabox' ) ) {
51
+            add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
52
+        }
53
+
54
+        if ( $this->sd->is_preview() ) {
55
+            add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
56
+            // this makes the insert button work for elementor
57
+            add_action( 'elementor/editor/after_enqueue_scripts', array(
58
+                $this,
59
+                'shortcode_insert_button_script'
60
+            ) ); // for elementor
61
+        }
62
+
63
+    }
64
+
65
+    /**
66
+     * Insert shortcode builder button to classic editor (not inside Gutenberg, not needed).
67
+     *
68
+     * @since 1.0.0
69
+     *
70
+     * @param string $editor_id Optional. Shortcode editor id. Default null.
71
+     * @param string $insert_shortcode_function Optional. Insert shortcode function. Default null.
72
+     */
73
+    public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
74
+        global $shortcode_insert_button_once;
75
+        if ( $shortcode_insert_button_once ) {
76
+            return;
77
+        }
78
+        add_thickbox();
79
+
80
+        /**
81
+         * Cornerstone makes us play dirty tricks :/
82
+         * All media_buttons are removed via JS unless they are two specific id's so we wrap our content in this ID so it is not removed.
83
+         */
84
+        if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
85
+            echo '<span id="insert-media-button">';
86
+        }
87
+
88
+        echo self::shortcode_button( 'this', 'true' );
89
+
90
+        // see opening note
91
+        if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
92
+            echo '</span>'; // end #insert-media-button
93
+        }
94
+
95
+        // Add separate script for generatepress theme sections
96
+        if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
97
+        } else {
98
+            self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
99
+        }
100
+
101
+        $shortcode_insert_button_once = true;
102
+    }
103
+
104
+    /**
105
+     * Output the shortcode.
106
+     *
107
+     * @param array $args
108
+     * @param string $content
109
+     *
110
+     * @return string
111
+     */
112
+    public function shortcode_output( $args = array(), $content = '' ) {
113
+        $args = $this->sd->argument_values( $args );
114
+
115
+        // Clean booleans.
116
+        $args = $this->sd->string_to_bool( $args );
117
+
118
+        // if we have a enclosed shortcode we add it to the special `html` argument
119
+        if ( ! empty( $content ) ) {
120
+            $args['html'] = $content;
121
+        }
122
+
123
+        $class = isset( $this->sd->options['widget_ops']['classname'] ) ? esc_attr( $this->sd->options['widget_ops']['classname'] ) : '';
124
+        $class .= " sdel-" . $this->sd->get_instance_hash();
125
+
126
+        $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this->sd, $this );
127
+        $class = apply_filters( 'wp_super_duper_div_classname_' . $this->sd->base_id, $class, $args, $this->sd, $this );
128
+
129
+        $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this->sd, $this );
130
+        $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->sd->base_id, $attrs, $args, $this->sd, $this );
131
+
132
+        $shortcode_args = array();
133
+        $output         = '';
134
+        $no_wrap        = ! empty( $this->sd->options['no_wrap'] ) || ! empty( $args['no_wrap'] );
135
+
136
+        $main_content = $this->sd->output( $args, $shortcode_args, $content );
137
+
138
+        if ( $main_content && ! $no_wrap ) {
139
+            // wrap the shortcode in a div with the same class as the widget
140
+            $output .= '<div class="' . esc_attr( $class ) . '" ' . $attrs . '>';
141
+            if ( ! empty( $args['title'] ) ) {
142
+                // if its a shortcode and there is a title try to grab the title wrappers
143
+                $shortcode_args = array( 'before_title' => '', 'after_title' => '' );
144
+                if ( empty( $instance ) ) {
145
+                    global $wp_registered_sidebars;
146
+                    if ( ! empty( $wp_registered_sidebars ) ) {
147
+                        foreach ( $wp_registered_sidebars as $sidebar ) {
148
+                            if ( ! empty( $sidebar['before_title'] ) ) {
149
+                                $shortcode_args['before_title'] = $sidebar['before_title'];
150
+                                $shortcode_args['after_title']  = $sidebar['after_title'];
151
+                                break;
152
+                            }
153
+                        }
154
+                    }
155
+                }
156
+                $output .= $this->sd->output_title( $shortcode_args, $args );
157
+            }
158
+            $output .= $main_content;
159
+            $output .= '</div>';
160
+        } elseif ( $main_content && $no_wrap ) {
161
+            $output .= $main_content;
162
+        }
163
+
164
+        // if preview, show a placeholder if empty
165
+        if ( $this->sd->is_preview() && $output == '' ) {
166
+            $output = $this->sd->preview_placeholder_text( "{{" . $this->sd->base_id . "}}" );
167
+        }
168
+
169
+        return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
170
+    }
171
+
172
+    public function register_fusion_element() {
173
+        $options = $this->sd->options;
174
+
175
+        if ( $this->sd->base_id ) {
176
+
177
+            $params = $this->get_fusion_params();
178
+
179
+            $args = array(
180
+                'name'            => $options['name'],
181
+                'shortcode'       => $this->sd->base_id,
182
+                'icon'            => $options['block-icon'] ? $options['block-icon'] : 'far fa-square',
183
+                'allow_generator' => true,
184
+            );
185
+
186
+            if ( ! empty( $params ) ) {
187
+                $args['params'] = $params;
188
+            }
189
+
190
+            fusion_builder_map( $args );
191
+        }
192
+    }
193
+
194
+    protected function get_fusion_params() {
195
+        $params    = array();
196
+        $arguments = $this->sd->get_arguments();
197
+
198
+        if ( ! empty( $arguments ) ) {
199
+            foreach ( $arguments as $key => $val ) {
200
+                $param = array();
201
+                // type
202
+                $param['type'] = str_replace(
203
+                    array(
204
+                        "text",
205
+                        "number",
206
+                        "email",
207
+                        "color",
208
+                        "checkbox"
209
+                    ),
210
+                    array(
211
+                        "textfield",
212
+                        "textfield",
213
+                        "textfield",
214
+                        "colorpicker",
215
+                        "select",
216
+                    ),
217
+                    $val['type'] );
218
+
219
+                // multiselect
220
+                if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
221
+                    $param['type']     = 'multiple_select';
222
+                    $param['multiple'] = true;
223
+                }
224
+
225
+                // heading
226
+                $param['heading'] = $val['title'];
227
+
228
+                // description
229
+                $param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
230
+
231
+                // param_name
232
+                $param['param_name'] = $key;
233
+
234
+                // Default
235
+                $param['default'] = isset( $val['default'] ) ? $val['default'] : '';
236
+
237
+                // Group
238
+                if ( isset( $val['group'] ) ) {
239
+                    $param['group'] = $val['group'];
240
+                }
241
+
242
+                // value
243
+                if ( $val['type'] == 'checkbox' ) {
244
+                    if ( isset( $val['default'] ) && $val['default'] == '0' ) {
245
+                        unset( $param['default'] );
246
+                    }
247
+                    $param['value'] = array( '' => __( "No" ), '1' => __( "Yes" ) );
248
+                } elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
249
+                    $param['value'] = isset( $val['options'] ) ? $val['options'] : array();
250
+                } else {
251
+                    $param['value'] = isset( $val['default'] ) ? $val['default'] : '';
252
+                }
253
+
254
+                // setup the param
255
+                $params[] = $param;
256
+
257
+            }
258
+        }
259
+
260
+        return $params;
261
+    }
262
+
263
+    /**
264
+     * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder
265
+     */
266
+    public function maybe_cornerstone_builder() {
267
+        if ( did_action( 'cornerstone_before_boot_app' ) ) {
268
+            self::shortcode_insert_button_script();
269
+        }
270
+    }
271
+
272
+    /**
273
+     * Output the JS and CSS for the shortcode insert button.
274
+     *
275
+     * @since 1.0.6
276
+     *
277
+     * @param string $editor_id
278
+     * @param string $insert_shortcode_function
279
+     */
280
+    public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
281
+        ?>
282 282
 		<style>
283 283
 			.sd-shortcode-left-wrap {
284 284
 				float: left;
@@ -404,35 +404,35 @@  discard block
 block discarded – undo
404 404
 			<?php } ?>
405 405
 		</style>
406 406
 		<?php
407
-		if ( class_exists( 'SiteOrigin_Panels' ) ) {
408
-			echo "<script>" . WP_Super_Duper::siteorigin_js() . "</script>";
409
-		}
410
-		?>
407
+        if ( class_exists( 'SiteOrigin_Panels' ) ) {
408
+            echo "<script>" . WP_Super_Duper::siteorigin_js() . "</script>";
409
+        }
410
+        ?>
411 411
 		<script>
412 412
 			<?php
413
-			if(! empty( $insert_shortcode_function )){
414
-				echo $insert_shortcode_function;
415
-			} else {
416
-
417
-			/**
418
-			 * Function for super duper insert shortcode.
419
-			 *
420
-			 * @since 1.0.0
421
-			 */
422
-			?>
413
+            if(! empty( $insert_shortcode_function )){
414
+                echo $insert_shortcode_function;
415
+            } else {
416
+
417
+            /**
418
+             * Function for super duper insert shortcode.
419
+             *
420
+             * @since 1.0.0
421
+             */
422
+            ?>
423 423
 			function sd_insert_shortcode($editor_id) {
424 424
 				$shortcode = jQuery('#TB_ajaxContent #sd-shortcode-output').val();
425 425
 				if ($shortcode) {
426 426
 					if (!$editor_id) {
427 427
 						<?php
428
-						if ( isset( $_REQUEST['et_fb'] ) ) {
429
-							echo '$editor_id = "#main_content_content_vb_tiny_mce";';
430
-						} elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
431
-							echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
432
-						} else {
433
-							echo '$editor_id = "#wp-content-editor-container textarea";';
434
-						}
435
-						?>
428
+                        if ( isset( $_REQUEST['et_fb'] ) ) {
429
+                            echo '$editor_id = "#main_content_content_vb_tiny_mce";';
430
+                        } elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
431
+                            echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
432
+                        } else {
433
+                            echo '$editor_id = "#wp-content-editor-container textarea";';
434
+                        }
435
+                        ?>
436 436
 					} else {
437 437
 						$editor_id = '#' + $editor_id;
438 438
 					}
@@ -731,24 +731,24 @@  discard block
 block discarded – undo
731 731
 			}
732 732
 		</script>
733 733
 		<?php
734
-	}
735
-
736
-	/**
737
-	 * Gets the shortcode insert button html.
738
-	 *
739
-	 * @param string $id
740
-	 * @param string $search_for_id
741
-	 *
742
-	 * @return mixed
743
-	 */
744
-	public static function shortcode_button( $id = '', $search_for_id = '' ) {
745
-		ob_start();
746
-		?>
734
+    }
735
+
736
+    /**
737
+     * Gets the shortcode insert button html.
738
+     *
739
+     * @param string $id
740
+     * @param string $search_for_id
741
+     *
742
+     * @return mixed
743
+     */
744
+    public static function shortcode_button( $id = '', $search_for_id = '' ) {
745
+        ob_start();
746
+        ?>
747 747
 		<span class="sd-lable-shortcode-inserter">
748 748
 			<a onclick="sd_ajax_get_picker(<?php echo $id;
749
-			if ( $search_for_id ) {
750
-				echo "," . $search_for_id;
751
-			} ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
749
+            if ( $search_for_id ) {
750
+                echo "," . $search_for_id;
751
+            } ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
752 752
 			   class="thickbox button super-duper-content-open" title="Add Shortcode">
753 753
 				<span style="vertical-align: middle;line-height: 18px;font-size: 20px;"
754 754
 				      class="dashicons dashicons-screenoptions"></span>
@@ -759,34 +759,34 @@  discard block
 block discarded – undo
759 759
 		</span>
760 760
 
761 761
 		<?php
762
-		$html = ob_get_clean();
762
+        $html = ob_get_clean();
763 763
 
764
-		// remove line breaks so we can use it in js
765
-		return preg_replace( "/\r|\n/", "", trim( $html ) );
766
-	}
764
+        // remove line breaks so we can use it in js
765
+        return preg_replace( "/\r|\n/", "", trim( $html ) );
766
+    }
767 767
 
768
-	/**
769
-	 * Get widget settings.
770
-	 *
771
-	 * @since 1.0.0
772
-	 */
773
-	public function get_widget_settings() {
768
+    /**
769
+     * Get widget settings.
770
+     *
771
+     * @since 1.0.0
772
+     */
773
+    public function get_widget_settings() {
774 774
 
775
-		if ( isset( $_REQUEST['shortcode'] ) && $this->sd->base_id == sanitize_title_with_dashes( $_REQUEST['shortcode'] ) ) {
775
+        if ( isset( $_REQUEST['shortcode'] ) && $this->sd->base_id == sanitize_title_with_dashes( $_REQUEST['shortcode'] ) ) {
776 776
 
777
-			$shortcode = sanitize_title_with_dashes( $_REQUEST['shortcode'] );
777
+            $shortcode = sanitize_title_with_dashes( $_REQUEST['shortcode'] );
778 778
 
779
-			ob_start();
780
-			$this->sd->form( array() );
781
-			$form = ob_get_clean();
779
+            ob_start();
780
+            $this->sd->form( array() );
781
+            $form = ob_get_clean();
782 782
 
783
-			echo "<form id='$shortcode'>" . $form . "<div class='widget-control-save'></div></form>";
784
-			echo "<style>" . WP_Super_Duper::widget_css() . "</style>";
785
-			echo "<script>" . WP_Super_Duper::widget_js() . "</script>";
786
-			exit;
783
+            echo "<form id='$shortcode'>" . $form . "<div class='widget-control-save'></div></form>";
784
+            echo "<style>" . WP_Super_Duper::widget_css() . "</style>";
785
+            echo "<script>" . WP_Super_Duper::widget_js() . "</script>";
786
+            exit;
787 787
 
788
-		}
788
+        }
789 789
 
790
-	}
790
+    }
791 791
 
792 792
 }
Please login to merge, or discard this patch.
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @since 2.0.0
6 6
  */
7 7
 
8
-defined( 'ABSPATH' ) || exit;
8
+defined('ABSPATH') || exit;
9 9
 
10 10
 /**
11 11
  *
@@ -27,37 +27,37 @@  discard block
 block discarded – undo
27 27
 	 *
28 28
 	 * @param WP_Super_Duper $super_duper
29 29
 	 */
30
-	public function __construct( $super_duper ) {
30
+	public function __construct($super_duper) {
31 31
 
32 32
 		$this->sd = $super_duper;
33 33
 
34 34
 		// Registers the shortcode.
35
-		add_shortcode( $this->sd->base_id, array( $this, 'shortcode_output' ) );
35
+		add_shortcode($this->sd->base_id, array($this, 'shortcode_output'));
36 36
 
37 37
 		// This makes the insert button work for cornerstone.
38
-		add_action( 'wp_print_footer_scripts', array( $this, 'maybe_cornerstone_builder' ) );
38
+		add_action('wp_print_footer_scripts', array($this, 'maybe_cornerstone_builder'));
39 39
 
40 40
 		// Fusion Builder (avada) support
41
-		if ( function_exists( 'fusion_builder_map' ) ) {
42
-			add_action( 'init', array( $this, 'register_fusion_element' ) );
41
+		if (function_exists('fusion_builder_map')) {
42
+			add_action('init', array($this, 'register_fusion_element'));
43 43
 		}
44 44
 
45 45
 		// Add shortcode insert button once
46
-		add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
47
-		add_action( 'wp_ajax_super_duper_get_widget_settings', array( $this, 'get_widget_settings' ) );
46
+		add_action('media_buttons', array($this, 'shortcode_insert_button'));
47
+		add_action('wp_ajax_super_duper_get_widget_settings', array($this, 'get_widget_settings'));
48 48
 
49 49
 		// generatepress theme sections compatibility
50
-		if ( function_exists( 'generate_sections_sections_metabox' ) ) {
51
-			add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
50
+		if (function_exists('generate_sections_sections_metabox')) {
51
+			add_action('generate_sections_metabox', array($this, 'shortcode_insert_button_script'));
52 52
 		}
53 53
 
54
-		if ( $this->sd->is_preview() ) {
55
-			add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
54
+		if ($this->sd->is_preview()) {
55
+			add_action('wp_footer', array($this, 'shortcode_insert_button_script'));
56 56
 			// this makes the insert button work for elementor
57
-			add_action( 'elementor/editor/after_enqueue_scripts', array(
57
+			add_action('elementor/editor/after_enqueue_scripts', array(
58 58
 				$this,
59 59
 				'shortcode_insert_button_script'
60
-			) ); // for elementor
60
+			)); // for elementor
61 61
 		}
62 62
 
63 63
 	}
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 	 * @param string $editor_id Optional. Shortcode editor id. Default null.
71 71
 	 * @param string $insert_shortcode_function Optional. Insert shortcode function. Default null.
72 72
 	 */
73
-	public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
73
+	public static function shortcode_insert_button($editor_id = '', $insert_shortcode_function = '') {
74 74
 		global $shortcode_insert_button_once;
75
-		if ( $shortcode_insert_button_once ) {
75
+		if ($shortcode_insert_button_once) {
76 76
 			return;
77 77
 		}
78 78
 		add_thickbox();
@@ -81,21 +81,21 @@  discard block
 block discarded – undo
81 81
 		 * Cornerstone makes us play dirty tricks :/
82 82
 		 * All media_buttons are removed via JS unless they are two specific id's so we wrap our content in this ID so it is not removed.
83 83
 		 */
84
-		if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
84
+		if (function_exists('cornerstone_plugin_init') && !is_admin()) {
85 85
 			echo '<span id="insert-media-button">';
86 86
 		}
87 87
 
88
-		echo self::shortcode_button( 'this', 'true' );
88
+		echo self::shortcode_button('this', 'true');
89 89
 
90 90
 		// see opening note
91
-		if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
91
+		if (function_exists('cornerstone_plugin_init') && !is_admin()) {
92 92
 			echo '</span>'; // end #insert-media-button
93 93
 		}
94 94
 
95 95
 		// Add separate script for generatepress theme sections
96
-		if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
96
+		if (function_exists('generate_sections_sections_metabox') && did_action('generate_sections_metabox')) {
97 97
 		} else {
98
-			self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
98
+			self::shortcode_insert_button_script($editor_id, $insert_shortcode_function);
99 99
 		}
100 100
 
101 101
 		$shortcode_insert_button_once = true;
@@ -109,43 +109,43 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @return string
111 111
 	 */
112
-	public function shortcode_output( $args = array(), $content = '' ) {
113
-		$args = $this->sd->argument_values( $args );
112
+	public function shortcode_output($args = array(), $content = '') {
113
+		$args = $this->sd->argument_values($args);
114 114
 
115 115
 		// Clean booleans.
116
-		$args = $this->sd->string_to_bool( $args );
116
+		$args = $this->sd->string_to_bool($args);
117 117
 
118 118
 		// if we have a enclosed shortcode we add it to the special `html` argument
119
-		if ( ! empty( $content ) ) {
119
+		if (!empty($content)) {
120 120
 			$args['html'] = $content;
121 121
 		}
122 122
 
123
-		$class = isset( $this->sd->options['widget_ops']['classname'] ) ? esc_attr( $this->sd->options['widget_ops']['classname'] ) : '';
123
+		$class = isset($this->sd->options['widget_ops']['classname']) ? esc_attr($this->sd->options['widget_ops']['classname']) : '';
124 124
 		$class .= " sdel-" . $this->sd->get_instance_hash();
125 125
 
126
-		$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this->sd, $this );
127
-		$class = apply_filters( 'wp_super_duper_div_classname_' . $this->sd->base_id, $class, $args, $this->sd, $this );
126
+		$class = apply_filters('wp_super_duper_div_classname', $class, $args, $this->sd, $this);
127
+		$class = apply_filters('wp_super_duper_div_classname_' . $this->sd->base_id, $class, $args, $this->sd, $this);
128 128
 
129
-		$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this->sd, $this );
130
-		$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->sd->base_id, $attrs, $args, $this->sd, $this );
129
+		$attrs = apply_filters('wp_super_duper_div_attrs', '', $args, $this->sd, $this);
130
+		$attrs = apply_filters('wp_super_duper_div_attrs_' . $this->sd->base_id, $attrs, $args, $this->sd, $this);
131 131
 
132 132
 		$shortcode_args = array();
133 133
 		$output         = '';
134
-		$no_wrap        = ! empty( $this->sd->options['no_wrap'] ) || ! empty( $args['no_wrap'] );
134
+		$no_wrap        = !empty($this->sd->options['no_wrap']) || !empty($args['no_wrap']);
135 135
 
136
-		$main_content = $this->sd->output( $args, $shortcode_args, $content );
136
+		$main_content = $this->sd->output($args, $shortcode_args, $content);
137 137
 
138
-		if ( $main_content && ! $no_wrap ) {
138
+		if ($main_content && !$no_wrap) {
139 139
 			// wrap the shortcode in a div with the same class as the widget
140
-			$output .= '<div class="' . esc_attr( $class ) . '" ' . $attrs . '>';
141
-			if ( ! empty( $args['title'] ) ) {
140
+			$output .= '<div class="' . esc_attr($class) . '" ' . $attrs . '>';
141
+			if (!empty($args['title'])) {
142 142
 				// if its a shortcode and there is a title try to grab the title wrappers
143
-				$shortcode_args = array( 'before_title' => '', 'after_title' => '' );
144
-				if ( empty( $instance ) ) {
143
+				$shortcode_args = array('before_title' => '', 'after_title' => '');
144
+				if (empty($instance)) {
145 145
 					global $wp_registered_sidebars;
146
-					if ( ! empty( $wp_registered_sidebars ) ) {
147
-						foreach ( $wp_registered_sidebars as $sidebar ) {
148
-							if ( ! empty( $sidebar['before_title'] ) ) {
146
+					if (!empty($wp_registered_sidebars)) {
147
+						foreach ($wp_registered_sidebars as $sidebar) {
148
+							if (!empty($sidebar['before_title'])) {
149 149
 								$shortcode_args['before_title'] = $sidebar['before_title'];
150 150
 								$shortcode_args['after_title']  = $sidebar['after_title'];
151 151
 								break;
@@ -153,26 +153,26 @@  discard block
 block discarded – undo
153 153
 						}
154 154
 					}
155 155
 				}
156
-				$output .= $this->sd->output_title( $shortcode_args, $args );
156
+				$output .= $this->sd->output_title($shortcode_args, $args);
157 157
 			}
158 158
 			$output .= $main_content;
159 159
 			$output .= '</div>';
160
-		} elseif ( $main_content && $no_wrap ) {
160
+		} elseif ($main_content && $no_wrap) {
161 161
 			$output .= $main_content;
162 162
 		}
163 163
 
164 164
 		// if preview, show a placeholder if empty
165
-		if ( $this->sd->is_preview() && $output == '' ) {
166
-			$output = $this->sd->preview_placeholder_text( "{{" . $this->sd->base_id . "}}" );
165
+		if ($this->sd->is_preview() && $output == '') {
166
+			$output = $this->sd->preview_placeholder_text("{{" . $this->sd->base_id . "}}");
167 167
 		}
168 168
 
169
-		return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
169
+		return apply_filters('wp_super_duper_widget_output', $output, $args, $shortcode_args, $this);
170 170
 	}
171 171
 
172 172
 	public function register_fusion_element() {
173 173
 		$options = $this->sd->options;
174 174
 
175
-		if ( $this->sd->base_id ) {
175
+		if ($this->sd->base_id) {
176 176
 
177 177
 			$params = $this->get_fusion_params();
178 178
 
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 				'allow_generator' => true,
184 184
 			);
185 185
 
186
-			if ( ! empty( $params ) ) {
186
+			if (!empty($params)) {
187 187
 				$args['params'] = $params;
188 188
 			}
189 189
 
190
-			fusion_builder_map( $args );
190
+			fusion_builder_map($args);
191 191
 		}
192 192
 	}
193 193
 
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
 		$params    = array();
196 196
 		$arguments = $this->sd->get_arguments();
197 197
 
198
-		if ( ! empty( $arguments ) ) {
199
-			foreach ( $arguments as $key => $val ) {
198
+		if (!empty($arguments)) {
199
+			foreach ($arguments as $key => $val) {
200 200
 				$param = array();
201 201
 				// type
202 202
 				$param['type'] = str_replace(
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 					$val['type'] );
218 218
 
219 219
 				// multiselect
220
-				if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
220
+				if ($val['type'] == 'multiselect' || (($param['type'] == 'select' || $val['type'] == 'select') && !empty($val['multiple']))) {
221 221
 					$param['type']     = 'multiple_select';
222 222
 					$param['multiple'] = true;
223 223
 				}
@@ -226,29 +226,29 @@  discard block
 block discarded – undo
226 226
 				$param['heading'] = $val['title'];
227 227
 
228 228
 				// description
229
-				$param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
229
+				$param['description'] = isset($val['desc']) ? $val['desc'] : '';
230 230
 
231 231
 				// param_name
232 232
 				$param['param_name'] = $key;
233 233
 
234 234
 				// Default
235
-				$param['default'] = isset( $val['default'] ) ? $val['default'] : '';
235
+				$param['default'] = isset($val['default']) ? $val['default'] : '';
236 236
 
237 237
 				// Group
238
-				if ( isset( $val['group'] ) ) {
238
+				if (isset($val['group'])) {
239 239
 					$param['group'] = $val['group'];
240 240
 				}
241 241
 
242 242
 				// value
243
-				if ( $val['type'] == 'checkbox' ) {
244
-					if ( isset( $val['default'] ) && $val['default'] == '0' ) {
245
-						unset( $param['default'] );
243
+				if ($val['type'] == 'checkbox') {
244
+					if (isset($val['default']) && $val['default'] == '0') {
245
+						unset($param['default']);
246 246
 					}
247
-					$param['value'] = array( '' => __( "No" ), '1' => __( "Yes" ) );
248
-				} elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
249
-					$param['value'] = isset( $val['options'] ) ? $val['options'] : array();
247
+					$param['value'] = array('' => __("No"), '1' => __("Yes"));
248
+				} elseif ($param['type'] == 'select' || $param['type'] == 'multiple_select') {
249
+					$param['value'] = isset($val['options']) ? $val['options'] : array();
250 250
 				} else {
251
-					$param['value'] = isset( $val['default'] ) ? $val['default'] : '';
251
+					$param['value'] = isset($val['default']) ? $val['default'] : '';
252 252
 				}
253 253
 
254 254
 				// setup the param
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder
265 265
 	 */
266 266
 	public function maybe_cornerstone_builder() {
267
-		if ( did_action( 'cornerstone_before_boot_app' ) ) {
267
+		if (did_action('cornerstone_before_boot_app')) {
268 268
 			self::shortcode_insert_button_script();
269 269
 		}
270 270
 	}
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 * @param string $editor_id
278 278
 	 * @param string $insert_shortcode_function
279 279
 	 */
280
-	public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
280
+	public static function shortcode_insert_button_script($editor_id = '', $insert_shortcode_function = '') {
281 281
 		?>
282 282
 		<style>
283 283
 			.sd-shortcode-left-wrap {
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 				width: 100%;
397 397
 			}
398 398
 
399
-			<?php if ( function_exists( 'generate_sections_sections_metabox' ) ) { ?>
399
+			<?php if (function_exists('generate_sections_sections_metabox')) { ?>
400 400
 			.generate-sections-modal #custom-media-buttons > .sd-lable-shortcode-inserter {
401 401
 				display: inline;
402 402
 			}
@@ -404,13 +404,13 @@  discard block
 block discarded – undo
404 404
 			<?php } ?>
405 405
 		</style>
406 406
 		<?php
407
-		if ( class_exists( 'SiteOrigin_Panels' ) ) {
407
+		if (class_exists('SiteOrigin_Panels')) {
408 408
 			echo "<script>" . WP_Super_Duper::siteorigin_js() . "</script>";
409 409
 		}
410 410
 		?>
411 411
 		<script>
412 412
 			<?php
413
-			if(! empty( $insert_shortcode_function )){
413
+			if (!empty($insert_shortcode_function)) {
414 414
 				echo $insert_shortcode_function;
415 415
 			} else {
416 416
 
@@ -425,9 +425,9 @@  discard block
 block discarded – undo
425 425
 				if ($shortcode) {
426 426
 					if (!$editor_id) {
427 427
 						<?php
428
-						if ( isset( $_REQUEST['et_fb'] ) ) {
428
+						if (isset($_REQUEST['et_fb'])) {
429 429
 							echo '$editor_id = "#main_content_content_vb_tiny_mce";';
430
-						} elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
430
+						} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') {
431 431
 							echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
432 432
 						} else {
433 433
 							echo '$editor_id = "#wp-content-editor-container textarea";';
@@ -509,11 +509,11 @@  discard block
 block discarded – undo
509 509
 						'shortcode': $short_code,
510 510
 						'attributes': 123,
511 511
 						'post_id': 321,
512
-						'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
512
+						'_ajax_nonce': '<?php echo wp_create_nonce('super_duper_output_shortcode'); ?>'
513 513
 					};
514 514
 
515 515
 					if (typeof ajaxurl === 'undefined') {
516
-						var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' );?>";
516
+						var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
517 517
 					}
518 518
 
519 519
 					jQuery.post(ajaxurl, data, function (response) {
@@ -699,11 +699,11 @@  discard block
 block discarded – undo
699 699
 				var data = {
700 700
 					'action': 'super_duper_get_picker',
701 701
 					'editor_id': $id,
702
-					'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_picker' );?>'
702
+					'_ajax_nonce': '<?php echo wp_create_nonce('super_duper_picker'); ?>'
703 703
 				};
704 704
 
705 705
 				if (!ajaxurl) {
706
-					var ajaxurl = "<?php echo admin_url( 'admin-ajax.php' ); ?>";
706
+					var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
707 707
 				}
708 708
 
709 709
 				jQuery.post(ajaxurl, data, function (response) {
@@ -724,9 +724,9 @@  discard block
 block discarded – undo
724 724
 			 */
725 725
 			function sd_shortcode_button($id) {
726 726
 				if ($id) {
727
-					return '<?php echo self::shortcode_button( "\\''+\$id+'\\'" );?>';
727
+					return '<?php echo self::shortcode_button("\\''+\$id+'\\'"); ?>';
728 728
 				} else {
729
-					return '<?php echo self::shortcode_button();?>';
729
+					return '<?php echo self::shortcode_button(); ?>';
730 730
 				}
731 731
 			}
732 732
 		</script>
@@ -741,12 +741,12 @@  discard block
 block discarded – undo
741 741
 	 *
742 742
 	 * @return mixed
743 743
 	 */
744
-	public static function shortcode_button( $id = '', $search_for_id = '' ) {
744
+	public static function shortcode_button($id = '', $search_for_id = '') {
745 745
 		ob_start();
746 746
 		?>
747 747
 		<span class="sd-lable-shortcode-inserter">
748 748
 			<a onclick="sd_ajax_get_picker(<?php echo $id;
749
-			if ( $search_for_id ) {
749
+			if ($search_for_id) {
750 750
 				echo "," . $search_for_id;
751 751
 			} ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
752 752
 			   class="thickbox button super-duper-content-open" title="Add Shortcode">
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 		$html = ob_get_clean();
763 763
 
764 764
 		// remove line breaks so we can use it in js
765
-		return preg_replace( "/\r|\n/", "", trim( $html ) );
765
+		return preg_replace("/\r|\n/", "", trim($html));
766 766
 	}
767 767
 
768 768
 	/**
@@ -772,12 +772,12 @@  discard block
 block discarded – undo
772 772
 	 */
773 773
 	public function get_widget_settings() {
774 774
 
775
-		if ( isset( $_REQUEST['shortcode'] ) && $this->sd->base_id == sanitize_title_with_dashes( $_REQUEST['shortcode'] ) ) {
775
+		if (isset($_REQUEST['shortcode']) && $this->sd->base_id == sanitize_title_with_dashes($_REQUEST['shortcode'])) {
776 776
 
777
-			$shortcode = sanitize_title_with_dashes( $_REQUEST['shortcode'] );
777
+			$shortcode = sanitize_title_with_dashes($_REQUEST['shortcode']);
778 778
 
779 779
 			ob_start();
780
-			$this->sd->form( array() );
780
+			$this->sd->form(array());
781 781
 			$form = ob_get_clean();
782 782
 
783 783
 			echo "<form id='$shortcode'>" . $form . "<div class='widget-control-save'></div></form>";
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/hello-world.php 2 patches
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -2,101 +2,101 @@  discard block
 block discarded – undo
2 2
 
3 3
 class SD_Hello_World extends WP_Super_Duper {
4 4
 
5
-	public $arguments;
6
-
7
-	/**
8
-	 * Sets up the widgets name etc
9
-	 */
10
-	public function __construct() {
11
-
12
-		$options = array(
13
-			'textdomain'     => 'super-duper',
14
-			// textdomain of the plugin/theme (used to prefix the Gutenberg block)
15
-			'block-icon'     => 'fas fa-globe-americas',
16
-			// Dash icon name for the block: https://developer.wordpress.org/resource/dashicons/#arrow-right
17
-			// OR font-awesome 5 class name: fas fa-globe-americas
18
-			'block-category' => 'widgets',
19
-			// the category for the block, 'common', 'formatting', 'layout', 'widgets', 'embed'.
20
-			'block-keywords' => "['hello','world']",
21
-			// used in the block search, MAX 3
22
-			'block-output'   => array( // the block visual output elements as an array
23
-				array(
24
-					'element' => 'p',
25
-					'title'   => __( 'Placeholder', 'hello-world' ),
26
-					'class'   => '[%className%]',
27
-					'content' => 'Hello: [%after_text%]' // block properties can be added by wrapping them in [%name%]
28
-				)
29
-			),
30
-			'output_types'   => array( 'block', 'shortcode' ),
31
-			// Sample showing how to disable widgets for a given SD instance.
32
-			'block-wrap'     => '',
33
-			// You can specify the type of element to wrap the block `div` or `span` etc.. Or blank for no wrap at all.
34
-			'class_name'     => __CLASS__,
35
-			// The calling class name
36
-			'base_id'        => 'hello_world',
37
-			// this is used as the widget id and the shortcode id.
38
-			'name'           => __( 'Hello World', 'hello-world' ),
39
-			// the name of the widget/block
40
-			'widget_ops'     => array(
41
-				'classname'   => 'hello-world-class',
42
-				// widget class
43
-				'description' => esc_html__( 'This is an example that will take a text parameter and output it after `Hello:`.', 'hello-world' ),
44
-				// widget description
45
-				'output'      => array( $this, 'output' )
46
-			),
47
-			'no_wrap'        => true,
48
-			// This will prevent the widget being wrapped in the containing widget class div.
49
-			//'block-editor-style'    => 'https://example.com/style.css',
50
-			// Lets you add a URL for styles that should be added to the block editor.
51
-			'arguments'      => array( // these are the arguments that will be used in the widget, shortcode and block settings.
52
-				'after_text' => array( // this is the input name=''
53
-					'title'       => __( 'Text after hello:', 'hello-world' ),
54
-					// input title
55
-					'desc'        => __( 'This is the text that will appear after `Hello:`.', 'hello-world' ),
56
-					// input description
57
-					'type'        => 'text',
58
-					// the type of input, test, select, checkbox etc.
59
-					'placeholder' => 'World',
60
-					// the input placeholder text.
61
-					'desc_tip'    => true,
62
-					// if the input should show the widget description text as a tooltip.
63
-					'default'     => 'World',
64
-					// the input default value.
65
-					'advanced'    => false
66
-					// not yet implemented
67
-				),
68
-			)
69
-		);
70
-
71
-		parent::__construct( $options );
72
-	}
73
-
74
-
75
-	/**
76
-	 * This is the output function for the widget, shortcode and block (front end).
77
-	 *
78
-	 * @param array $args The arguments values.
79
-	 * @param array $widget_args The widget arguments when used.
80
-	 * @param string $content The shortcode content argument
81
-	 *
82
-	 * @return string
83
-	 */
84
-	public function output( $args = array(), $widget_args = array(), $content = '' ) {
85
-		/**
86
-		 * @var string $after_text
87
-		 * @var string $another_input This is added by filter below.
88
-		 */
89
-		extract( $args, EXTR_SKIP );
90
-
91
-		/*
5
+    public $arguments;
6
+
7
+    /**
8
+     * Sets up the widgets name etc
9
+     */
10
+    public function __construct() {
11
+
12
+        $options = array(
13
+            'textdomain'     => 'super-duper',
14
+            // textdomain of the plugin/theme (used to prefix the Gutenberg block)
15
+            'block-icon'     => 'fas fa-globe-americas',
16
+            // Dash icon name for the block: https://developer.wordpress.org/resource/dashicons/#arrow-right
17
+            // OR font-awesome 5 class name: fas fa-globe-americas
18
+            'block-category' => 'widgets',
19
+            // the category for the block, 'common', 'formatting', 'layout', 'widgets', 'embed'.
20
+            'block-keywords' => "['hello','world']",
21
+            // used in the block search, MAX 3
22
+            'block-output'   => array( // the block visual output elements as an array
23
+                array(
24
+                    'element' => 'p',
25
+                    'title'   => __( 'Placeholder', 'hello-world' ),
26
+                    'class'   => '[%className%]',
27
+                    'content' => 'Hello: [%after_text%]' // block properties can be added by wrapping them in [%name%]
28
+                )
29
+            ),
30
+            'output_types'   => array( 'block', 'shortcode' ),
31
+            // Sample showing how to disable widgets for a given SD instance.
32
+            'block-wrap'     => '',
33
+            // You can specify the type of element to wrap the block `div` or `span` etc.. Or blank for no wrap at all.
34
+            'class_name'     => __CLASS__,
35
+            // The calling class name
36
+            'base_id'        => 'hello_world',
37
+            // this is used as the widget id and the shortcode id.
38
+            'name'           => __( 'Hello World', 'hello-world' ),
39
+            // the name of the widget/block
40
+            'widget_ops'     => array(
41
+                'classname'   => 'hello-world-class',
42
+                // widget class
43
+                'description' => esc_html__( 'This is an example that will take a text parameter and output it after `Hello:`.', 'hello-world' ),
44
+                // widget description
45
+                'output'      => array( $this, 'output' )
46
+            ),
47
+            'no_wrap'        => true,
48
+            // This will prevent the widget being wrapped in the containing widget class div.
49
+            //'block-editor-style'    => 'https://example.com/style.css',
50
+            // Lets you add a URL for styles that should be added to the block editor.
51
+            'arguments'      => array( // these are the arguments that will be used in the widget, shortcode and block settings.
52
+                'after_text' => array( // this is the input name=''
53
+                    'title'       => __( 'Text after hello:', 'hello-world' ),
54
+                    // input title
55
+                    'desc'        => __( 'This is the text that will appear after `Hello:`.', 'hello-world' ),
56
+                    // input description
57
+                    'type'        => 'text',
58
+                    // the type of input, test, select, checkbox etc.
59
+                    'placeholder' => 'World',
60
+                    // the input placeholder text.
61
+                    'desc_tip'    => true,
62
+                    // if the input should show the widget description text as a tooltip.
63
+                    'default'     => 'World',
64
+                    // the input default value.
65
+                    'advanced'    => false
66
+                    // not yet implemented
67
+                ),
68
+            )
69
+        );
70
+
71
+        parent::__construct( $options );
72
+    }
73
+
74
+
75
+    /**
76
+     * This is the output function for the widget, shortcode and block (front end).
77
+     *
78
+     * @param array $args The arguments values.
79
+     * @param array $widget_args The widget arguments when used.
80
+     * @param string $content The shortcode content argument
81
+     *
82
+     * @return string
83
+     */
84
+    public function output( $args = array(), $widget_args = array(), $content = '' ) {
85
+        /**
86
+         * @var string $after_text
87
+         * @var string $another_input This is added by filter below.
88
+         */
89
+        extract( $args, EXTR_SKIP );
90
+
91
+        /*
92 92
 		 * This value is added by filter so might not exist if filter is removed so we check.
93 93
 		 */
94
-		if ( ! isset( $another_input ) ) {
95
-			$another_input = '';
96
-		}
94
+        if ( ! isset( $another_input ) ) {
95
+            $another_input = '';
96
+        }
97 97
 
98
-		return "Hello: " . $after_text . "" . $another_input;
99
-	}
98
+        return "Hello: " . $after_text . "" . $another_input;
99
+    }
100 100
 
101 101
 }
102 102
 
@@ -111,26 +111,26 @@  discard block
 block discarded – undo
111 111
  */
112 112
 function _my_extra_arguments( $options ) {
113 113
 
114
-	/*
114
+    /*
115 115
 	 * Add a new input option.
116 116
 	 */
117
-	$options['arguments']['another_input'] = array(
118
-		'name'        => 'another_input', // this is the input name=''
119
-		'title'       => __( 'Another input:', 'hello-world' ), // input title
120
-		'desc'        => __( 'This is an input added via filter.', 'hello-world' ), // input description
121
-		'type'        => 'text', // the type of input, test, select, checkbox etc.
122
-		'placeholder' => 'Placeholder text', // the input placeholder text.
123
-		'desc_tip'    => true, // if the input should show the widget description text as a tooltip.
124
-		'default'     => '', // the input default value.
125
-		'advanced'    => false // not yet implemented
126
-	);
127
-
128
-	/*
117
+    $options['arguments']['another_input'] = array(
118
+        'name'        => 'another_input', // this is the input name=''
119
+        'title'       => __( 'Another input:', 'hello-world' ), // input title
120
+        'desc'        => __( 'This is an input added via filter.', 'hello-world' ), // input description
121
+        'type'        => 'text', // the type of input, test, select, checkbox etc.
122
+        'placeholder' => 'Placeholder text', // the input placeholder text.
123
+        'desc_tip'    => true, // if the input should show the widget description text as a tooltip.
124
+        'default'     => '', // the input default value.
125
+        'advanced'    => false // not yet implemented
126
+    );
127
+
128
+    /*
129 129
 	 * Output the new option in the block output also.
130 130
 	 */
131
-	$options['block-output']['element::p']['content'] = $options['block-output']['element::p']['content'] . " [%another_input%]";;
131
+    $options['block-output']['element::p']['content'] = $options['block-output']['element::p']['content'] . " [%another_input%]";;
132 132
 
133
-	return $options;
133
+    return $options;
134 134
 }
135 135
 
136 136
 //add_filter( 'wp_super_duper_options_hello_world', '_my_extra_arguments' );
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
 			'block-output'   => array( // the block visual output elements as an array
23 23
 				array(
24 24
 					'element' => 'p',
25
-					'title'   => __( 'Placeholder', 'hello-world' ),
25
+					'title'   => __('Placeholder', 'hello-world'),
26 26
 					'class'   => '[%className%]',
27 27
 					'content' => 'Hello: [%after_text%]' // block properties can be added by wrapping them in [%name%]
28 28
 				)
29 29
 			),
30
-			'output_types'   => array( 'block', 'shortcode' ),
30
+			'output_types'   => array('block', 'shortcode'),
31 31
 			// Sample showing how to disable widgets for a given SD instance.
32 32
 			'block-wrap'     => '',
33 33
 			// You can specify the type of element to wrap the block `div` or `span` etc.. Or blank for no wrap at all.
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
 			// The calling class name
36 36
 			'base_id'        => 'hello_world',
37 37
 			// this is used as the widget id and the shortcode id.
38
-			'name'           => __( 'Hello World', 'hello-world' ),
38
+			'name'           => __('Hello World', 'hello-world'),
39 39
 			// the name of the widget/block
40 40
 			'widget_ops'     => array(
41 41
 				'classname'   => 'hello-world-class',
42 42
 				// widget class
43
-				'description' => esc_html__( 'This is an example that will take a text parameter and output it after `Hello:`.', 'hello-world' ),
43
+				'description' => esc_html__('This is an example that will take a text parameter and output it after `Hello:`.', 'hello-world'),
44 44
 				// widget description
45
-				'output'      => array( $this, 'output' )
45
+				'output'      => array($this, 'output')
46 46
 			),
47 47
 			'no_wrap'        => true,
48 48
 			// This will prevent the widget being wrapped in the containing widget class div.
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 			// Lets you add a URL for styles that should be added to the block editor.
51 51
 			'arguments'      => array( // these are the arguments that will be used in the widget, shortcode and block settings.
52 52
 				'after_text' => array( // this is the input name=''
53
-					'title'       => __( 'Text after hello:', 'hello-world' ),
53
+					'title'       => __('Text after hello:', 'hello-world'),
54 54
 					// input title
55
-					'desc'        => __( 'This is the text that will appear after `Hello:`.', 'hello-world' ),
55
+					'desc'        => __('This is the text that will appear after `Hello:`.', 'hello-world'),
56 56
 					// input description
57 57
 					'type'        => 'text',
58 58
 					// the type of input, test, select, checkbox etc.
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 			)
69 69
 		);
70 70
 
71
-		parent::__construct( $options );
71
+		parent::__construct($options);
72 72
 	}
73 73
 
74 74
 
@@ -81,17 +81,17 @@  discard block
 block discarded – undo
81 81
 	 *
82 82
 	 * @return string
83 83
 	 */
84
-	public function output( $args = array(), $widget_args = array(), $content = '' ) {
84
+	public function output($args = array(), $widget_args = array(), $content = '') {
85 85
 		/**
86 86
 		 * @var string $after_text
87 87
 		 * @var string $another_input This is added by filter below.
88 88
 		 */
89
-		extract( $args, EXTR_SKIP );
89
+		extract($args, EXTR_SKIP);
90 90
 
91 91
 		/*
92 92
 		 * This value is added by filter so might not exist if filter is removed so we check.
93 93
 		 */
94
-		if ( ! isset( $another_input ) ) {
94
+		if (!isset($another_input)) {
95 95
 			$another_input = '';
96 96
 		}
97 97
 
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
  *
110 110
  * @return mixed
111 111
  */
112
-function _my_extra_arguments( $options ) {
112
+function _my_extra_arguments($options) {
113 113
 
114 114
 	/*
115 115
 	 * Add a new input option.
116 116
 	 */
117 117
 	$options['arguments']['another_input'] = array(
118 118
 		'name'        => 'another_input', // this is the input name=''
119
-		'title'       => __( 'Another input:', 'hello-world' ), // input title
120
-		'desc'        => __( 'This is an input added via filter.', 'hello-world' ), // input description
119
+		'title'       => __('Another input:', 'hello-world'), // input title
120
+		'desc'        => __('This is an input added via filter.', 'hello-world'), // input description
121 121
 		'type'        => 'text', // the type of input, test, select, checkbox etc.
122 122
 		'placeholder' => 'Placeholder text', // the input placeholder text.
123 123
 		'desc_tip'    => true, // if the input should show the widget description text as a tooltip.
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	/*
129 129
 	 * Output the new option in the block output also.
130 130
 	 */
131
-	$options['block-output']['element::p']['content'] = $options['block-output']['element::p']['content'] . " [%another_input%]";;
131
+	$options['block-output']['element::p']['content'] = $options['block-output']['element::p']['content'] . " [%another_input%]"; ;
132 132
 
133 133
 	return $options;
134 134
 }
Please login to merge, or discard this patch.
vendor/composer/installed.php 2 patches
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php return array (
2
-  'root' => 
3
-  array (
2
+    'root' => 
3
+    array (
4 4
     'pretty_version' => 'dev-master',
5 5
     'version' => 'dev-master',
6 6
     'aliases' => 
@@ -8,94 +8,94 @@  discard block
 block discarded – undo
8 8
     ),
9 9
     'reference' => '877d435f0d6e766e8c5a957200a2dcebe6a6cdeb',
10 10
     'name' => 'ayecode/invoicing',
11
-  ),
12
-  'versions' => 
13
-  array (
11
+    ),
12
+    'versions' => 
13
+    array (
14 14
     'ayecode/ayecode-connect-helper' => 
15 15
     array (
16
-      'pretty_version' => '1.0.3',
17
-      'version' => '1.0.3.0',
18
-      'aliases' => 
19
-      array (
20
-      ),
21
-      'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
16
+        'pretty_version' => '1.0.3',
17
+        'version' => '1.0.3.0',
18
+        'aliases' => 
19
+        array (
20
+        ),
21
+        'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
22 22
     ),
23 23
     'ayecode/invoicing' => 
24 24
     array (
25
-      'pretty_version' => 'dev-master',
26
-      'version' => 'dev-master',
27
-      'aliases' => 
28
-      array (
29
-      ),
30
-      'reference' => '877d435f0d6e766e8c5a957200a2dcebe6a6cdeb',
25
+        'pretty_version' => 'dev-master',
26
+        'version' => 'dev-master',
27
+        'aliases' => 
28
+        array (
29
+        ),
30
+        'reference' => '877d435f0d6e766e8c5a957200a2dcebe6a6cdeb',
31 31
     ),
32 32
     'ayecode/wp-ayecode-ui' => 
33 33
     array (
34
-      'pretty_version' => '0.1.61',
35
-      'version' => '0.1.61.0',
36
-      'aliases' => 
37
-      array (
38
-      ),
39
-      'reference' => 'e97d1e520d6722df2cb323c04a6e818b1e901ab5',
34
+        'pretty_version' => '0.1.61',
35
+        'version' => '0.1.61.0',
36
+        'aliases' => 
37
+        array (
38
+        ),
39
+        'reference' => 'e97d1e520d6722df2cb323c04a6e818b1e901ab5',
40 40
     ),
41 41
     'ayecode/wp-deactivation-survey' => 
42 42
     array (
43
-      'pretty_version' => '1.0.3',
44
-      'version' => '1.0.3.0',
45
-      'aliases' => 
46
-      array (
47
-      ),
48
-      'reference' => 'c4b0ba914835f17dca0cf69fe621c2db491d4667',
43
+        'pretty_version' => '1.0.3',
44
+        'version' => '1.0.3.0',
45
+        'aliases' => 
46
+        array (
47
+        ),
48
+        'reference' => 'c4b0ba914835f17dca0cf69fe621c2db491d4667',
49 49
     ),
50 50
     'ayecode/wp-font-awesome-settings' => 
51 51
     array (
52
-      'pretty_version' => '1.0.13',
53
-      'version' => '1.0.13.0',
54
-      'aliases' => 
55
-      array (
56
-      ),
57
-      'reference' => 'a7a11ee4290674ec214d1fe694139af275350402',
52
+        'pretty_version' => '1.0.13',
53
+        'version' => '1.0.13.0',
54
+        'aliases' => 
55
+        array (
56
+        ),
57
+        'reference' => 'a7a11ee4290674ec214d1fe694139af275350402',
58 58
     ),
59 59
     'ayecode/wp-super-duper' => 
60 60
     array (
61
-      'pretty_version' => '2.0.0',
62
-      'version' => '2.0.0.0',
63
-      'aliases' => 
64
-      array (
65
-      ),
66
-      'reference' => '0b76c70dff7339ddcfc67c148e932b8915cbcbf5',
61
+        'pretty_version' => '2.0.0',
62
+        'version' => '2.0.0.0',
63
+        'aliases' => 
64
+        array (
65
+        ),
66
+        'reference' => '0b76c70dff7339ddcfc67c148e932b8915cbcbf5',
67 67
     ),
68 68
     'composer/installers' => 
69 69
     array (
70
-      'pretty_version' => 'v1.12.0',
71
-      'version' => '1.12.0.0',
72
-      'aliases' => 
73
-      array (
74
-      ),
75
-      'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19',
70
+        'pretty_version' => 'v1.12.0',
71
+        'version' => '1.12.0.0',
72
+        'aliases' => 
73
+        array (
74
+        ),
75
+        'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19',
76 76
     ),
77 77
     'maxmind-db/reader' => 
78 78
     array (
79
-      'pretty_version' => 'v1.6.0',
80
-      'version' => '1.6.0.0',
81
-      'aliases' => 
82
-      array (
83
-      ),
84
-      'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
79
+        'pretty_version' => 'v1.6.0',
80
+        'version' => '1.6.0.0',
81
+        'aliases' => 
82
+        array (
83
+        ),
84
+        'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
85 85
     ),
86 86
     'roundcube/plugin-installer' => 
87 87
     array (
88
-      'replaced' => 
89
-      array (
88
+        'replaced' => 
89
+        array (
90 90
         0 => '*',
91
-      ),
91
+        ),
92 92
     ),
93 93
     'shama/baton' => 
94 94
     array (
95
-      'replaced' => 
96
-      array (
95
+        'replaced' => 
96
+        array (
97 97
         0 => '*',
98
-      ),
98
+        ),
99
+    ),
99 100
     ),
100
-  ),
101 101
 );
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,99 +1,99 @@
 block discarded – undo
1
-<?php return array (
1
+<?php return array(
2 2
   'root' => 
3
-  array (
3
+  array(
4 4
     'pretty_version' => 'dev-master',
5 5
     'version' => 'dev-master',
6 6
     'aliases' => 
7
-    array (
7
+    array(
8 8
     ),
9 9
     'reference' => '877d435f0d6e766e8c5a957200a2dcebe6a6cdeb',
10 10
     'name' => 'ayecode/invoicing',
11 11
   ),
12 12
   'versions' => 
13
-  array (
13
+  array(
14 14
     'ayecode/ayecode-connect-helper' => 
15
-    array (
15
+    array(
16 16
       'pretty_version' => '1.0.3',
17 17
       'version' => '1.0.3.0',
18 18
       'aliases' => 
19
-      array (
19
+      array(
20 20
       ),
21 21
       'reference' => '1af7cdefdbd20d4443a3ab4834e4c1cd8fe57fb4',
22 22
     ),
23 23
     'ayecode/invoicing' => 
24
-    array (
24
+    array(
25 25
       'pretty_version' => 'dev-master',
26 26
       'version' => 'dev-master',
27 27
       'aliases' => 
28
-      array (
28
+      array(
29 29
       ),
30 30
       'reference' => '877d435f0d6e766e8c5a957200a2dcebe6a6cdeb',
31 31
     ),
32 32
     'ayecode/wp-ayecode-ui' => 
33
-    array (
33
+    array(
34 34
       'pretty_version' => '0.1.61',
35 35
       'version' => '0.1.61.0',
36 36
       'aliases' => 
37
-      array (
37
+      array(
38 38
       ),
39 39
       'reference' => 'e97d1e520d6722df2cb323c04a6e818b1e901ab5',
40 40
     ),
41 41
     'ayecode/wp-deactivation-survey' => 
42
-    array (
42
+    array(
43 43
       'pretty_version' => '1.0.3',
44 44
       'version' => '1.0.3.0',
45 45
       'aliases' => 
46
-      array (
46
+      array(
47 47
       ),
48 48
       'reference' => 'c4b0ba914835f17dca0cf69fe621c2db491d4667',
49 49
     ),
50 50
     'ayecode/wp-font-awesome-settings' => 
51
-    array (
51
+    array(
52 52
       'pretty_version' => '1.0.13',
53 53
       'version' => '1.0.13.0',
54 54
       'aliases' => 
55
-      array (
55
+      array(
56 56
       ),
57 57
       'reference' => 'a7a11ee4290674ec214d1fe694139af275350402',
58 58
     ),
59 59
     'ayecode/wp-super-duper' => 
60
-    array (
60
+    array(
61 61
       'pretty_version' => '2.0.0',
62 62
       'version' => '2.0.0.0',
63 63
       'aliases' => 
64
-      array (
64
+      array(
65 65
       ),
66 66
       'reference' => '0b76c70dff7339ddcfc67c148e932b8915cbcbf5',
67 67
     ),
68 68
     'composer/installers' => 
69
-    array (
69
+    array(
70 70
       'pretty_version' => 'v1.12.0',
71 71
       'version' => '1.12.0.0',
72 72
       'aliases' => 
73
-      array (
73
+      array(
74 74
       ),
75 75
       'reference' => 'd20a64ed3c94748397ff5973488761b22f6d3f19',
76 76
     ),
77 77
     'maxmind-db/reader' => 
78
-    array (
78
+    array(
79 79
       'pretty_version' => 'v1.6.0',
80 80
       'version' => '1.6.0.0',
81 81
       'aliases' => 
82
-      array (
82
+      array(
83 83
       ),
84 84
       'reference' => 'febd4920bf17c1da84cef58e56a8227dfb37fbe4',
85 85
     ),
86 86
     'roundcube/plugin-installer' => 
87
-    array (
87
+    array(
88 88
       'replaced' => 
89
-      array (
89
+      array(
90 90
         0 => '*',
91 91
       ),
92 92
     ),
93 93
     'shama/baton' => 
94
-    array (
94
+    array(
95 95
       'replaced' => 
96
-      array (
96
+      array(
97 97
         0 => '*',
98 98
       ),
99 99
     ),
Please login to merge, or discard this patch.