PluginProbe
Pixel Gallery Addons for Elementor – Easy Grid, Creative Gallery, Drag and Drop Grid, Custom Grid Layout, Portfolio Gallery / 2.1.13
Pixel Gallery Addons for Elementor – Easy Grid, Creative Gallery, Drag and Drop Grid, Custom Grid Layout, Portfolio Gallery v2.1.13
2.1.14 2.1.13 2.1.12 2.1.11 2.1.10 2.1.9 2.1.8 2.1.7 trunk 1.2.2 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.4.0 1.4.1 1.4.10 1.4.11 1.4.2 1.4.3 1.4.5 1.4.6 All 74 releases
pixel-gallery / admin / class-settings-api.php

class-settings-api.php in Pixel Gallery Addons for Elementor – Easy Grid, Creative Gallery, Drag and Drop Grid, Custom Grid Layout, Portfolio Gallery 2.1.13, at admin/class-settings-api.php

1,239 lines 51.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!class_exists('PixelGallery_Settings_API')) :
4
5 class PixelGallery_Settings_API {
6
7 /**
8 * settings sections array
9 *
10 * @var array
11 */
12 protected $settings_sections = array();
13
14 /**
15 * Settings fields array
16 *
17 * @var array
18 */
19 protected $settings_fields = array();
20
21 public function __construct() {
22 add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
23
24 add_action('wp_ajax_pixel_gallery_settings_save', [$this, "pixel_gallery_settings_save"]);
25 }
26
27 /**
28 * Enqueue scripts and styles
29 */
30 function admin_enqueue_scripts() {
31 wp_enqueue_script('jquery');
32 }
33
34 /**
35 * Set settings sections
36 *
37 * @param array $sections setting sections array
38 */
39 function set_sections($sections) {
40 $this->settings_sections = $sections;
41
42 return $this;
43 }
44
45 /**
46 * Add a single section
47 *
48 * @param array $section
49 */
50 function add_section($section) {
51 $this->settings_sections[] = $section;
52
53 return $this;
54 }
55
56 /**
57 * Set settings fields
58 *
59 * @param array $fields settings fields array
60 */
61 function set_fields($fields) {
62 $this->settings_fields = $fields;
63
64 return $this;
65 }
66
67 function add_field($section, $field) {
68 $defaults = array(
69 'name' => '',
70 'label' => '',
71 'desc' => '',
72 'type' => 'text'
73 );
74
75 $arg = wp_parse_args($field, $defaults);
76 $this->settings_fields[$section][] = $arg;
77
78 return $this;
79 }
80
81 function do_settings_sections($page) {
82 global $wp_settings_sections, $wp_settings_fields;
83
84 if (!isset($wp_settings_sections[$page])) {
85 return;
86 }
87
88 $matched_height = ' bdt-grid bdt-height-match="target: > div > .pg-option-item-inner"';
89 $data_settings = '';
90
91 foreach ((array) $wp_settings_sections[$page] as $section) {
92 if ($section['id'] == 'pixel_gallery_api_settings') {
93 $section_class = ' bdt-grid-small bdt-child-width-1-3@xl';
94 } elseif ($section['id'] == 'pixel_gallery_other_settings') {
95 $data_settings = $matched_height;
96 $section_class = ' bdt-grid-small bdt-child-width-1-3@xl';
97 } else {
98 $section_class = ' bdt-grid-small bdt-child-width-1-4@xl';
99 }
100
101
102
103 if ($section['callback']) {
104 call_user_func($section['callback'], $section);
105 }
106
107 if (!isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section['id']])) {
108 continue;
109 }
110 echo '<div class="pg-options" role="presentation" ' . esc_attr($data_settings) . '>';
111
112 echo '<p class="pg-no-result bdt-text-center bdt-width-1-1 bdt-margin-small-top bdt-h4">'.esc_html__('Ops! Your Searched widget not found! Do you have any idea? If yes, ', 'pixel-gallery').'<a href="https://feedback.elementpack.pro/b/3v2gg80n/feature-requests/idea/new" target="_blank">'.esc_html__('Submit here', 'pixel-gallery').'</a></p>';
113
114 $this->do_settings_fields($page, $section['id']);
115
116 echo '</div>';
117 }
118 }
119
120
121 function do_settings_fields($page, $section) {
122 global $wp_settings_fields;
123
124 if (!isset($wp_settings_fields[$page][$section])) {
125 return;
126 }
127
128
129 foreach ((array) $wp_settings_fields[$page][$section] as $field) {
130 $class = '';
131
132 if (!empty($field['args']['class'])) {
133 $class .= ' ' . esc_attr($field['args']['class']);
134 }
135
136 if (!empty($field['args']['widget_type'])) {
137 $class .= ' pg-widget-' . esc_attr($field['args']['widget_type']);
138 }
139
140 if (!empty($field['args']['widget_type']) && 'pro' == $field['args']['widget_type'] && true !== _is_pg_pro_activated()) {
141 $class .= ' pg-pro-inactive';
142 }
143
144 $used_widgets = self::get_used_widgets_obj();
145 $widget_name = 'pg-' . str_replace(' ', '-', strtolower($field['args']['id']));
146 $used_widgets_count = 0;
147
148 if (isset($used_widgets)) {
149 $used_widgets_count = (in_array($widget_name, array_keys($used_widgets)) ? $used_widgets[$widget_name] : 0);
150 if ($used_widgets_count === 0) {
151 $widget_name = str_replace('_', '-', $widget_name);
152 $used_widgets_count = (in_array($widget_name, array_keys($used_widgets)) ? $used_widgets[$widget_name] : 0);
153 }
154 }
155
156 $widget_used_status = ' pg-used'; // default used class
157 if ($used_widgets_count === 0) {
158 $widget_used_status = ' pg-unused'; // replace by unused class
159 }
160
161 $data_type = ' data-widget-type="' . esc_attr($field['args']['widget_type']) . '" data-content-type="' . esc_attr($field['args']['content_type']) . esc_attr($widget_used_status) . '" data-widget-name="' . strtolower($field['args']['name']) . '"';
162
163
164 if (!empty($field['args']['widget_type']) && 'pro' == $field['args']['widget_type'] && true !== _is_pg_pro_activated()) {
165 $data_type .= ' bdt-tooltip="'.esc_html__('Pro widget only works with Pro version.', 'pixel-gallery').'"';
166 }
167
168 echo "<div class='pg-option-item {$class} {$widget_used_status}' {$data_type}>";
169
170
171 // printf('<div class="pg-option-item %1$s %5$s" data-widget-type="%2$s" data-content-type="%3$s %5$s" data-widget-name="%4$s">', $class, $field['args']['widget_type'], $field['args']['content_type'], strtolower($field['args']['name']), esc_attr($widget_used_status));
172
173 call_user_func($field['callback'], $field['args']);
174
175 echo '</div>';
176 }
177 }
178
179 /**
180 * Initialize and registers the settings sections and fileds to WordPress
181 *
182 * Usually this should be called at `admin_init` hook.
183 *
184 * This function gets the initiated settings sections and fields. Then
185 * registers them to WordPress and ready for use.
186 */
187 function admin_init() {
188 //register settings sections
189 foreach ($this->settings_sections as $section) {
190 if (false == get_option($section['id'])) {
191 add_option($section['id']);
192 }
193
194 if (isset($section['desc']) && !empty($section['desc'])) {
195 $section['desc'] = '<div class="inside">' . $section['desc'] . '</div>';
196 $callback = function () use ($section) {
197 echo str_replace('"', '\"', esc_html($section['desc']));
198 };
199 } elseif (isset($section['callback'])) {
200 $callback = $section['callback'];
201 } else {
202 $callback = null;
203 }
204
205 add_settings_section($section['id'], $section['title'], $callback, $section['id']);
206 }
207
208 //register settings fields
209 foreach ($this->settings_fields as $section => $field) {
210 foreach ($field as $option) {
211 $name = $option['name'];
212 $type = isset($option['type']) ? $option['type'] : 'text';
213 $label = isset($option['label']) ? $option['label'] : '';
214 $callback = isset($option['callback']) ? $option['callback'] : array($this, 'callback_' . $type);
215
216 $args = array(
217 'id' => $name,
218 'class' => isset($option['class']) ? 'pg-' . $name . ' ' . $option['class'] : 'pg-' . $name,
219 'label_for' => "pg-{$section}[{$name}]",
220 'desc' => isset($option['desc']) ? $option['desc'] : '',
221 'name' => $label,
222 'section' => $section,
223 'size' => isset($option['size']) ? $option['size'] : null,
224 'options' => isset($option['options']) ? $option['options'] : '',
225 'std' => isset($option['default']) ? $option['default'] : '',
226 'sanitize_callback' => isset($option['sanitize_callback']) ? $option['sanitize_callback'] : '',
227 'type' => $type,
228 'placeholder' => isset($option['placeholder']) ? $option['placeholder'] : '',
229 'min' => isset($option['min']) ? $option['min'] : '',
230 'max' => isset($option['max']) ? $option['max'] : '',
231 'step' => isset($option['step']) ? $option['step'] : '',
232 'plugin_name' => !empty($option['plugin_name']) ? $option['plugin_name'] : null,
233 'plugin_path' => !empty($option['plugin_path']) ? $option['plugin_path'] : null,
234 'paid' => !empty($option['paid']) ? $option['paid'] : null,
235 'widget_type' => !empty($option['widget_type']) ? $option['widget_type'] : null,
236 'content_type' => !empty($option['content_type']) ? $option['content_type'] : null,
237 'demo_url' => !empty($option['demo_url']) ? $option['demo_url'] : null,
238 'video_url' => !empty($option['video_url']) ? $option['video_url'] : null,
239 );
240
241 add_settings_field("{$section}[{$name}]", $label, $callback, $section, $section, $args);
242 }
243 }
244
245 // creates our settings in the options table
246 foreach ($this->settings_sections as $section) {
247 register_setting($section['id'], $section['id'], array($this, 'sanitize_options'));
248 }
249 }
250
251 /**
252 * Get field description for display
253 *
254 * @param array $args settings field args
255 */
256 public function get_field_description($args) {
257 if (!empty($args['desc'])) {
258 $desc = sprintf('<p class="description">%s</p>', $args['desc']);
259 } else {
260 $desc = '';
261 }
262
263 return $desc;
264 }
265
266
267 public function get_control_output($output) {
268
269
270 $tags = [
271 'div' => ['class' => [], 'bdt-grid' => []],
272 'a' => ['href' => [], 'target' => [], 'class' => [], 'data-bdt-tooltip' => []],
273 'label' => ['for' => []],
274 'span' => ['scope' => [], 'class' => []],
275 'input' => ['type' => [], 'class' => [], 'id' => [], 'name' => [], 'value' => [], 'placeholder' => [], 'checked' => []],
276 'i' => ['class' => [], 'aria-hidden' => []],
277 'fieldset' => [],
278 'br' => [],
279 'select' => [
280 'class' => [],
281 'name' => [],
282 'id' => [],
283 ],
284 'option' => [
285 'value' => [],
286 'selected' => []
287 ],
288 'h3' => [
289 'class' => []
290 ],
291 'hr' => [
292 'class' => []
293 ],
294 'ul' => [
295 'class' => [],
296 'bdt-tab' => [],
297 ],
298 'li' => [],
299 'p' => [
300 'class' => [],
301 ],
302 ];
303
304 if (isset($output)) {
305 echo wp_kses($output, $tags);
306 }
307 }
308
309
310 /**
311 * Displays a text field for a settings field
312 *
313 * @param array $args settings field args
314 */
315 function callback_text($args) {
316
317 $value = esc_attr($this->get_option($args['id'], $args['section'], $args['std']));
318 $class = 'bdt-input';
319 $type = isset($args['type']) ? $args['type'] : 'text';
320 $placeholder = empty($args['placeholder']) ? '' : ' placeholder="' . $args['placeholder'] . '"';
321 $html = '';
322
323
324 $html .= '<div class="pg-option-item-inner">';
325 if ($args['video_url']) {
326 $html .= '<a href="' . $args['video_url'] . '" target="_blank" class="pg-option-video" bdt-tooltip="View ' . $args['name'] . ' Video Tutorial"><i class="pg-icon-tutorial" aria-hidden="true"></i></a>';
327 }
328 $html .= sprintf('<label for="bdt_pg_%1$s[%2$s]">', $args['section'], $args['id']);
329 $html .= '<span scope="row" class="pg-option-label">' . $args['name'] . '</span>';
330 $html .= '</label>';
331
332
333 $html .= sprintf('<input type="%1$s" class="%2$s" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s/>', $type, $class, $args['section'], $args['id'], $value, $placeholder);
334
335 $html .= $this->get_field_description($args);
336
337 $html .= '</div>';
338
339 $this->get_control_output($html);
340 }
341
342 /**
343 * Displays a url field for a settings field
344 *
345 * @param array $args settings field args
346 */
347 function callback_url($args) {
348 $this->callback_text($args);
349 }
350
351 /**
352 * Displays a number field for a settings field
353 *
354 * @param array $args settings field args
355 */
356 function callback_number($args) {
357 $value = esc_attr($this->get_option($args['id'], $args['section'], $args['std']));
358 $size = isset($args['size']) && !is_null($args['size']) ? $args['size'] : 'regular';
359 $type = isset($args['type']) ? $args['type'] : 'number';
360 $placeholder = empty($args['placeholder']) ? '' : ' placeholder="' . $args['placeholder'] . '"';
361 $min = ($args['min'] == '') ? '' : ' min="' . $args['min'] . '"';
362 $max = ($args['max'] == '') ? '' : ' max="' . $args['max'] . '"';
363 $step = ($args['step'] == '') ? '' : ' step="' . $args['step'] . '"';
364
365 $html = sprintf('<input type="%1$s" class="%2$s-number" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s%7$s%8$s%9$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder, $min, $max, $step);
366 $html .= $this->get_field_description($args);
367
368 $this->get_control_output($html);
369 }
370
371 /**
372 * Get used widgets.
373 *
374 * @access public
375 * @since 6.0.0
376 *
377 * @return array
378 */
379
380 public static function get_used_widgets_obj() {
381 return PixelGallery_Admin_Settings::get_used_widgets();
382 }
383
384 /**
385 * Get unused widgets.
386 *
387 * @access public
388 * @since 6.0.0
389 *
390 * @return array
391 */
392
393 public static function get_unused_widgets_obj() {
394 return PixelGallery_Admin_Settings::get_unused_widgets();
395 }
396
397 /**
398 * Displays a checkbox for a settings field
399 *
400 * @param array $args settings field args
401 */
402 function callback_checkbox($args) {
403
404 $value = esc_attr($this->get_option($args['id'], $args['section'], $args['std']));
405 $plugin_name = isset($args['plugin_name']) ? $args['plugin_name'] : '';
406 $plugin_path = isset($args['plugin_path']) ? $args['plugin_path'] : '';
407 $paid = isset($args['paid']) ? $args['paid'] : '';
408
409
410 $used_widgets = self::get_used_widgets_obj();
411 $widget_name = 'pg-' . $args['id'];
412 $used_widgets_count = 0;
413
414
415 if (isset($used_widgets)) {
416 $used_widgets_count = (in_array($widget_name, array_keys($used_widgets)) ? $used_widgets[$widget_name] : 0);
417 if ($used_widgets_count === 0) {
418 $widget_name = str_replace('_', '-', $widget_name);
419 $used_widgets_count = (in_array($widget_name, array_keys($used_widgets)) ? $used_widgets[$widget_name] : 0);
420 }
421 }
422
423 $widget_using_status = '</span> <br><span class="pg-widget-count-text">'.esc_html__('Total Used', 'pixel-gallery').' - ' . esc_html($used_widgets_count) . ' </span>';
424
425 // remove counts
426 if (isset($args['id']) && $args['id'] == 'not') {
427 $widget_using_status = '';
428 }
429
430 $html = '';
431
432 $html .= '<div class="pg-option-item-inner">';
433 $html .= '<div class="bdt-grid bdt-grid-collapse bdt-flex bdt-flex-middle">';
434
435 $html .= '<div class="bdt-width-expand bdt-flex-inline bdt-flex-middle">';
436
437
438 $html .= '<i class="pg-icon-' . esc_attr($args['id']) . '" aria-hidden="true"></i>';
439 $html .= '<div class="pg-option-label-wrap">';
440 $html .= sprintf('<label for="bdt_pg_%1$s[%2$s]">', $args['section'], $args['id']);
441 $html .= '<span scope="row" class="pg-option-label">' . $args['name'] . '</span>';
442 $html .= '</label>';
443
444 $html .= '<div class="pg-option-links">';
445 if ($args['demo_url']) {
446 $html .= '<a href=' . $args['demo_url'] . ' target="_blank" class="pg-option-demo" title="' . esc_html__('View ' . $args['name'] . ' Widget Demo', 'pixel-gallery') . '">' . esc_html__('Demo', 'pixel-gallery') . '<i class="pg-icon-preview" aria-hidden="true"></i></a>';
447 }
448 if ($args['video_url']) {
449 $html .= '<a href=' . $args['video_url'] . ' target="_blank" class="pg-option-video" title="' . esc_html__('View ' . $args['name'] . ' Video Tutorial', 'pixel-gallery') . '">' . esc_html__('Video', 'pixel-gallery') . '<i class="pg-icon-tutorial" aria-hidden="true"></i></a>';
450 }
451 $html .= '</div>';
452 $html .= '</div>';
453 $html .= '</div>';
454
455 $html .= '<div class="bdt-width-auto">';
456
457
458
459 // 3rd party widgets
460 if ($plugin_name and $plugin_path) {
461 if ($this->_is_plugin_installed($plugin_name, $plugin_path)) {
462 if (!current_user_can('activate_plugins')) {
463 return;
464 }
465 if (!is_plugin_active($plugin_path)) {
466 $active_link = wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_path . '&amp;plugin_status=all&amp;paged=1&amp;s', 'activate-plugin_' . $plugin_path);
467 $html .= '<a href="' . $active_link . '" class="pixel-gallery-3pp-active" bdt-tooltip="'.esc_html__('Activate the plugin first then you can activate this widget.', 'pixel-gallery').'"><span class="dashicons dashicons-admin-plugins"></span></a>';
468 }
469 } else {
470 if ($paid) {
471 $html .= '<a href="' . $paid . '" class="pixel-gallery-3pp-download" bdt-tooltip="'.esc_html__('Download and install plugin first then you can activate this widget.', 'pixel-gallery').'"><span class="dashicons dashicons-download"></span></a>';
472 } else {
473 $install_link = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $plugin_name), 'install-plugin_' . $plugin_name);
474 $html .= '<a href="' . $install_link . '" class="pixel-gallery-3pp-install" bdt-tooltip="'.esc_html__('Install the plugin first then you can activate this widget.', 'pixel-gallery').'"><span class="dashicons dashicons-download"></span></a>';
475 }
476 }
477
478 if ($this->_is_plugin_installed($plugin_name, $plugin_path) and is_plugin_active($plugin_path)) {
479 $html .= '<fieldset>';
480 $html .= sprintf('<label for="bdt_pg_%1$s[%2$s]">', $args['section'], $args['id']);
481 $html .= sprintf('<input type="hidden" name="%1$s[%2$s]" value="off" />', $args['section'], $args['id']);
482 $html .= sprintf('<input type="checkbox" class="checkbox" id="bdt_pg_%1$s[%2$s]" name="%1$s[%2$s]" value="on" %3$s />', $args['section'], $args['id'], checked($value, 'on', false));
483 $html .= '<span class="switch"></span>';
484 $html .= '</label>';
485 $html .= '</fieldset>';
486 }
487 } else { // core widgets
488 $html .= '<fieldset>';
489 $html .= sprintf('<label for="bdt_pg_%1$s[%2$s]">', $args['section'], $args['id']);
490 $html .= sprintf('<input type="hidden" name="%1$s[%2$s]" value="off" />', $args['section'], $args['id']);
491 $html .= sprintf('<input type="checkbox" class="checkbox" id="bdt_pg_%1$s[%2$s]" name="%1$s[%2$s]" value="on" %3$s />', $args['section'], $args['id'], checked($value, 'on', false));
492 $html .= '<span class="switch"></span>';
493 $html .= '</label>';
494 $html .= '</fieldset>';
495 }
496
497 $html .= '</div>';
498 $html .= '</div>';
499 $html .= '</div>';
500
501 $this->get_control_output($html);
502 }
503
504 function _is_plugin_installed($plugin, $plugin_path) {
505 $installed_plugins = get_plugins();
506 return isset($installed_plugins[$plugin_path]);
507 }
508
509
510 /**
511 * Displays a multicheckbox for a settings field
512 *
513 * @param array $args settings field args
514 */
515 function callback_multicheck($args) {
516
517 $value = $this->get_option($args['id'], $args['section'], $args['std']);
518 $html = '<fieldset>';
519 $html .= sprintf('<input type="hidden" name="%1$s[%2$s]" value="" />', $args['section'], $args['id']);
520 foreach ($args['options'] as $key => $label) {
521 $checked = isset($value[$key]) ? $value[$key] : '0';
522 $html .= sprintf('<label for="bdt_pg_%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key);
523 $html .= sprintf('<input type="checkbox" class="checkbox" id="bdt_pg_%1$s[%2$s][%3$s]" name="%1$s[%2$s][%3$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked($checked, $key, false));
524 $html .= '<span class="switch"></span>';
525 $html .= sprintf('%1$s</label><br>', $label);
526 }
527
528 $html .= $this->get_field_description($args);
529 $html .= '</fieldset>';
530
531 $this->get_control_output($html);
532 }
533
534 /**
535 * Displays a radio button for a settings field
536 *
537 * @param array $args settings field args
538 */
539 function callback_radio($args) {
540
541 $value = $this->get_option($args['id'], $args['section'], $args['std']);
542 $html = '<fieldset>';
543
544 foreach ($args['options'] as $key => $label) {
545 $html .= sprintf('<label for="bdt_pg_%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key);
546 $html .= sprintf('<input type="radio" class="radio" id="bdt_pg_%1$s[%2$s][%3$s]" name="%1$s[%2$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked($value, $key, false));
547 $html .= sprintf('%1$s</label><br>', $label);
548 }
549
550 $html .= $this->get_field_description($args);
551 $html .= '</fieldset>';
552
553 $this->get_control_output($html);
554 }
555
556 /**
557 * Displays a selectbox for a settings field
558 *
559 * @param array $args settings field args
560 */
561 function callback_select($args) {
562
563 $value = esc_attr($this->get_option($args['id'], $args['section'], $args['std']));
564 $size = isset($args['size']) && !is_null($args['size']) ? $args['size'] : 'regular';
565 $html = sprintf('<select class="%1$s" name="%2$s[%3$s]" id="%2$s[%3$s]">', $size, $args['section'], $args['id']);
566
567 foreach ($args['options'] as $key => $label) {
568 $html .= sprintf('<option value="%s"%s>%s</option>', $key, selected($value, $key, false), $label);
569 }
570
571 $html .= sprintf('</select>');
572 $html .= $this->get_field_description($args);
573
574 $this->get_control_output($html);
575 }
576
577 /**
578 * Displays a textarea for a settings field
579 *
580 * @param array $args settings field args
581 */
582 function callback_textarea($args) {
583
584 $value = esc_textarea($this->get_option($args['id'], $args['section'], $args['std']));
585 $size = isset($args['size']) && !is_null($args['size']) ? $args['size'] : 'regular';
586 $placeholder = empty($args['placeholder']) ? '' : ' placeholder="' . $args['placeholder'] . '"';
587
588 $html = '';
589 $html .= sprintf('<label for="bdt_pg_%1$s[%2$s]">', $args['section'], $args['id']);
590 $html .= '<span scope="row" class="pg-option-label">' . $args['name'] . '</span>';
591 $html .= '</label>';
592
593 $html .= sprintf('<textarea rows="5" cols="55" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]" %4$s >%5$s</textarea>', $size, $args['section'], $args['id'], $placeholder, $value);
594 $html .= $this->get_field_description($args);
595
596 $this->get_control_output($html);
597 }
598
599 /**
600 * Displays the html for a settings field
601 *
602 * @param array $args settings field args
603 * @return string
604 */
605 function callback_html($args) {
606 echo esc_html($args['desc']);
607 }
608
609 /**
610 * Displays a file upload field for a settings field
611 *
612 * @param array $args settings field args
613 */
614 function callback_file($args) {
615
616 $value = esc_attr($this->get_option($args['id'], $args['section'], $args['std']));
617 $size = isset($args['size']) && !is_null($args['size']) ? $args['size'] : 'regular';
618 $id = $args['section'] . '[' . $args['id'] . ']';
619 $label = isset($args['options']['button_label']) ? $args['options']['button_label'] : __('Choose File', 'pixel-gallery');
620
621 $html = sprintf('<input type="text" class="%1$s-text wpsa-url" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value);
622 $html .= '<input type="button" class="button wpsa-browse" value="' . $label . '" />';
623 $html .= $this->get_field_description($args);
624
625 $this->get_control_output($html);
626 }
627
628 /**
629 * Displays a password field for a settings field
630 *
631 * @param array $args settings field args
632 */
633 function callback_password($args) {
634
635 $value = esc_attr($this->get_option($args['id'], $args['section'], $args['std']));
636 $size = isset($args['size']) && !is_null($args['size']) ? $args['size'] : 'regular';
637
638 $html = sprintf('<input type="password" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value);
639 $html .= $this->get_field_description($args);
640
641 $this->get_control_output($html);
642 }
643
644 /**
645 * Displays a color picker field for a settings field
646 *
647 * @param array $args settings field args
648 */
649 function callback_color($args) {
650
651 $value = esc_attr($this->get_option($args['id'], $args['section'], $args['std']));
652 $size = isset($args['size']) && !is_null($args['size']) ? $args['size'] : 'regular';
653
654 $html = sprintf('<input type="text" class="%1$s-text wp-color-picker-field" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, $args['std']);
655 $html .= $this->get_field_description($args);
656
657 $this->get_control_output($html);
658 }
659
660 /**
661 * Displays a 2 colspan subheading field for a settings field
662 *
663 * @param array $args settings field args
664 */
665 function callback_subheading($args) {
666
667 $html = '<h3 class="setting_subheading column-merge">' . $args['name'] . '</h3>';
668 $html .= $this->get_field_description($args);
669 $html .= '<hr class="setting_separator">';
670
671 $this->get_control_output($html);
672 }
673
674 function callback_start_group($args) {
675
676 $html = '<div class="pg-option-item-inner pg-option-group">';
677
678 $html .= sprintf('<label for="bdt_pg_%1$s[%2$s]">', $args['section'], $args['id']);
679 $html .= '<span scope="row" class="pg-option-label">' . $args['name'] . '</span>';
680 $html .= '</label>';
681
682 if ($args['video_url']) {
683 $html .= '<a href="' . $args['video_url'] . '" target="_blank" class="pg-option-video" bdt-tooltip="View ' . $args['name'] . ' Video Tutorial"><i class="pg-icon-tutorial" aria-hidden="true"></i></a>';
684 }
685
686 $html .= $this->get_field_description($args);
687
688 $html .= '<div class="bdt-grid" bdt-grid>';
689
690 $this->get_control_output($html);
691 }
692
693 function callback_end_group($args) {
694
695 $html = '</div>';
696 $html .= '</div>';
697
698 $this->get_control_output($html);
699 }
700
701 /**
702 * Displays a 2 colspan separator field for a settings field
703 *
704 * @param array $args settings field args
705 */
706 function callback_separator($args) {
707
708 $html = '<hr class="setting_separator column-merge">';
709 $html .= $this->get_field_description($args);
710
711
712 $this->get_control_output($html);
713 }
714
715
716 /**
717 * Displays a select box for creating the pages select box
718 *
719 * @param array $args settings field args
720 */
721 function callback_pages($args) {
722
723 $dropdown_args = array(
724 'selected' => esc_attr($this->get_option($args['id'], $args['section'], $args['std'])),
725 'name' => $args['section'] . '[' . $args['id'] . ']',
726 'id' => $args['section'] . '[' . $args['id'] . ']',
727 'echo' => 0
728 );
729 $html = wp_dropdown_pages($dropdown_args);
730 $this->get_control_output($html);
731 }
732
733 /**
734 * Sanitize callback for Settings API
735 *
736 * @return mixed
737 */
738 function sanitize_options($options) {
739
740 if (!$options) {
741 return $options;
742 }
743
744 foreach ($options as $option_slug => $option_value) {
745 $sanitize_callback = $this->get_sanitize_callback($option_slug);
746
747 // If callback is set, call it
748 if ($sanitize_callback) {
749 $options[$option_slug] = call_user_func($sanitize_callback, $option_value);
750 continue;
751 }
752 }
753
754 return $options;
755 }
756
757 /**
758 * Get sanitization callback for given option slug
759 *
760 * @param string $slug option slug
761 *
762 * @return mixed string or bool false
763 */
764 function get_sanitize_callback($slug = '') {
765 if (empty($slug)) {
766 return false;
767 }
768
769 // Iterate over registered fields and see if we can find proper callback
770 foreach ($this->settings_fields as $section => $options) {
771 foreach ($options as $option) {
772 if ($option['name'] != $slug) {
773 continue;
774 }
775
776 // Return the callback name
777 return isset($option['sanitize_callback']) && is_callable($option['sanitize_callback']) ? $option['sanitize_callback'] : false;
778 }
779 }
780
781 return false;
782 }
783
784 /**
785 * Get the value of a settings field
786 *
787 * @param string $option settings field name
788 * @param string $section the section name this field belongs to
789 * @param string $default default text if it's not found
790 * @return string
791 */
792 function get_option($option, $section, $default = '') {
793
794 $options = get_option($section);
795
796 if (isset($options[$option])) {
797 return $options[$option];
798 }
799
800 return $default;
801 }
802
803 /**
804 * Show navigations as tab
805 *
806 * Shows all the settings section labels as tab
807 */
808 function show_navigation() {
809
810 $html = '<div class="bdt-dashboard-navigation">';
811 $html .= '<ul class="bdt-tab bdt-flex-column" bdt-tab="animation: bdt-animation-slide-bottom-small;connect: .bdt-tab-container;">';
812
813 // Dashboard - always first
814 $html .= sprintf('<li><a href="#%1$s" class="bdt-tab-item" id="bdt-%1$s" data-tab-index="0"><i class="dashicons dashicons-admin-home"></i>%2$s</a></li>', 'pixel_gallery_welcome', esc_html__('Dashboard', 'pixel-gallery'));
815
816 $count = 1;
817
818 // Get all sections including manually created ones
819 $all_sections = $this->get_all_sections();
820
821 foreach ($all_sections as $tab) {
822 $icon = isset($tab['icon']) ? $tab['icon'] : 'dashicons dashicons-screenoptions';
823 $html .= sprintf('<li><a href="#%1$s" class="bdt-tab-item" id="bdt-%1$s" data-tab-index="%2$s"><i class="%4$s"></i>%3$s</a></li>', $tab['id'], $count++, $tab['title'], $icon);
824 }
825
826 if (true !== _is_pg_pro_activated()) {
827 $html .= sprintf('<li><a href="#%1$s" class="bdt-tab-item" id="bdt-%1$s" data-tab-index="%2$s"><span></span><span></span><span></span><span></span>%3$s</a></li>', 'pixel_gallery_get_pro', $count++, esc_html__('Get Pro', 'pixel-gallery'));
828 }
829
830 $html .= '</ul>';
831 $html .= '</div>';
832
833 echo wp_kses($html, array(
834 'div' => array(
835 'class' => true,
836 ),
837 'ul' => array(
838 'class' => true,
839 'bdt-tab' => true,
840 ),
841 'li' => array(
842 'class' => true,
843 ),
844 'a' => array(
845 'href' => true,
846 'class' => true,
847 'id' => true,
848 'data-tab-index' => true,
849 ),
850 'i' => array(
851 'class' => true,
852 )
853 ));
854 }
855
856 /**
857 * Get all sections including manually created content pages
858 */
859 private function get_all_sections() {
860 // Start with the settings sections that have forms
861 $all_sections = $this->settings_sections;
862
863 // Add manually created content sections that don't have settings forms
864 $content_only_sections = [
865 [
866 'id' => 'pixel_gallery_extra_options',
867 'title' => esc_html__('Extra Options', 'pixel-gallery'),
868 'icon' => 'dashicons dashicons-smiley',
869 ],
870 [
871 'id' => 'pixel_gallery_analytics_system_req',
872 'title' => esc_html__('System Status', 'pixel-gallery'),
873 'icon' => 'dashicons dashicons-chart-bar',
874 ],
875 [
876 'id' => 'pixel_gallery_other_plugins',
877 'title' => esc_html__('Other Plugins', 'pixel-gallery'),
878 'icon' => 'dashicons dashicons-admin-plugins',
879 ],
880 // [
881 // 'id' => 'pixel_gallery_affiliate',
882 // 'title' => esc_html__('Get Up to 60%', 'pixel-gallery'),
883 // 'icon' => 'dashicons dashicons-money-alt',
884 // ],
885 ];
886
887 if (true == _is_pg_pro_activated()) {
888 $content_only_sections[] = [
889 'id' => 'pixel_gallery_rollback_version',
890 'title' => esc_html__('Rollback Version', 'pixel-gallery'),
891 'icon' => 'dashicons dashicons-update',
892 ];
893 }
894
895 // Add License section if pro is activated and license is not hidden
896 if ((true == _is_pg_pro_activated()) && !defined('BDTPG_LO')) {
897 $content_only_sections[] = [
898 'id' => 'pixel_gallery_license_settings',
899 'title' => esc_html__('License', 'pixel-gallery'),
900 'icon' => 'dashicons dashicons-admin-network',
901 ];
902 }
903
904 // Check if each content section exists in settings sections, if not add it
905 foreach ($content_only_sections as $content_section) {
906 $exists = false;
907 foreach ($all_sections as $existing_section) {
908 if ($existing_section['id'] === $content_section['id']) {
909 $exists = true;
910 break;
911 }
912 }
913 if (!$exists) {
914 $all_sections[] = $content_section;
915 }
916 }
917
918 return $all_sections;
919 }
920
921
922
923 /**
924 * Custom sanitizer for option array element sanitize
925 * At first getting the full array then sanitize each element after sanitize them return again to array.
926 * @param array $post_data [description]
927 * @return array [description]
928 */
929 function sanitize_pg_options($post_data) {
930
931 if (isset($post_data)) {
932 foreach ($post_data as $key => $value) {
933 $_options[sanitize_key($key)] = sanitize_key($value);
934 }
935
936 return $_options;
937 }
938 }
939 function pixel_gallery_settings_save() {
940
941 if (!check_ajax_referer('pixel-gallery-settings-save-nonce')) {
942 wp_send_json_error();
943 }
944
945 if (!current_user_can('manage_options')) {
946 return;
947 }
948
949 $moudle_id = sanitize_key($_POST['id']);
950
951 unset($_POST['id']);
952 $options = $this->sanitize_pg_options($_POST[$moudle_id]);
953
954
955 update_option($moudle_id, $options);
956
957 wp_send_json_success();
958 }
959
960 /**
961 * Show the section settings forms
962 *
963 * This function displays every sections in a different form
964 */
965 function old_show_forms() {
966 ?>
967
968 <?php $i = 0;
969 foreach ($this->settings_sections as $form) {
970 $i++; ?>
971 <div id="<?php echo esc_attr($form['id']); ?>_page" class="pg-option-page">
972
973 <div bdt-filter="target: .pg-options" class="pg-options-parent" id="pg-options-parent-<?php echo esc_attr($i); ?>">
974
975 <?php if ($form['id'] == 'pixel_gallery_active_modules' or $form['id'] == 'pixel_gallery_third_party_widget' or $form['id'] == 'pixel_gallery_elementor_extend') : ?>
976 <div class="bdt-widget-filter-wrapper bdt-grid">
977
978 <div class="bdt-width-expand@l pg-widget-filter-nav bdt-visible@m">
979 <div class="bdt-flex-inline bdt-flex-middle">
980
981 <div>
982 <ul class="bdt-subnav bdt-subnav-pill pg-widget-filter bdt-widget-type-content bdt-flex-inline">
983 <li class="pg-widget-all bdt-active" bdt-filter-control="*"><a href="#"><?php esc_html_e('All', 'pixel-gallery'); ?></a></li>
984 <li class="pg-widget-free" bdt-filter-control="filter: [data-widget-type='free']; group: data-content-type"><a href="#"><?php esc_html_e('Free', 'pixel-gallery'); ?></a></li>
985 <li class="pg-widget-pro" bdt-filter-control="filter: [data-widget-type='pro']; group: data-content-type"><a href="#"><?php esc_html_e('Pro', 'pixel-gallery'); ?></a></li>
986 </ul>
987 </div>
988
989 <?php if ($form['id'] == 'pixel_gallery_active_modules') : ?>
990 <div>
991 <button class="bdt-button bdt-button-default" type="button"><?php esc_html_e('Filter By', 'pixel-gallery'); ?></button>
992 <div bdt-dropdown="animation: bdt-animation-slide-top-small; duration: 300">
993 <ul class="bdt-nav bdt-subnav-pill bdt-dropdown-nav pg-widget-filter pg-widget-content-type">
994
995 <li class="pg-widget-new" bdt-filter-control="filter: [data-content-type*='new']; group: data-widget-type"><a href="#"><?php esc_html_e('New', 'pixel-gallery'); ?></a></li>
996 <li class="pg-widget-grid" bdt-filter-control="filter: [data-content-type*='grid']; group: data-widget-type"><a href="#"><?php esc_html_e('Grid', 'pixel-gallery'); ?></a></li>
997 <li class="pg-widget-custom" bdt-filter-control="filter: [data-content-type*='custom']; group: data-widget-type"><a href="#"><?php esc_html_e('Custom', 'pixel-gallery'); ?></a></li>
998 <li class="pg-widget-others" bdt-filter-control="filter: [data-content-type*='others']; group: data-widget-type"><a href="#"><?php esc_html_e('Others', 'pixel-gallery'); ?></a></li>
999 </ul>
1000 </div>
1001 </div>
1002
1003 <?php if ($form['id'] != 'pixel_gallery_elementor_extend') : ?>
1004 <div>
1005 <ul class="bdt-subnav bdt-subnav-pill pg-widget-filter pg-used-unused-widgets bdt-flex-inline">
1006 <li class="pg-widget--" bdt-filter-control="filter: [data-content-type*='pg-used']; group: data-content-type">
1007 <a href="#"><?php esc_html_e('Used', 'pixel-gallery'); ?>
1008 <span class="bdt-badge pg-used-widget"></span>
1009 </a>
1010 </li>
1011 <li class="pg-widget--" bdt-filter-control="filter: [data-content-type*='pg-unused']; group: data-content-type"><a href="#" bdt-tooltip="<?php esc_html_e('Don\'t need unused widget? Click on the Deactivate All button.', 'pixel-gallery'); ?>"><?php esc_html_e('Unused', 'pixel-gallery'); ?>
1012 <span class="bdt-badge pg-unused-widget bdt-danger"></span>
1013 </a>
1014 </li>
1015 </ul>
1016
1017 </div>
1018 <?php endif; ?>
1019
1020 <?php endif; ?>
1021 </div>
1022 </div>
1023
1024
1025 <div class="bdt-width-auto@l bdt-search-active-wrap bdt-flex bdt-flex-middle bdt-flex-between">
1026 <div class="bdt-widget-search">
1027 <input data-id="pg-options-parent-<?php echo esc_attr($i); ?>" onkeyup="filterSearch(this);" bdt-filter-control="" class="bdt-search-input bdt-flex-middle" type="search" placeholder="Search widget..." autofocus>
1028 </div>
1029
1030 <?php //if ($form['id'] == 'pixel_gallery_active_modules' or $form['id'] == 'pixel_gallery_third_party_widget' ) :
1031 ?>
1032 <div>
1033 <ul class="bdt-subnav bdt-subnav-pill pg-widget-onoff">
1034 <li>
1035 <a href="#" class="pg-active-all-widget">
1036 <?php esc_html_e('Activate All', 'pixel-gallery'); ?>
1037 </a>
1038 </li>
1039 <li>
1040 <a href="#" class="pg-deactive-all-widget">
1041 <?php esc_html_e('Deactivate All', 'pixel-gallery'); ?>
1042 </a>
1043 </li>
1044 </ul>
1045 </div>
1046 <?php //endif;
1047 ?>
1048 </div>
1049
1050 </div>
1051
1052 <?php endif; ?>
1053
1054 <form class="settings-save" method="post" action="admin-ajax.php?action=pixel_gallery_settings_save">
1055 <input type="hidden" name="id" value="<?php echo esc_attr($form['id']); ?>">
1056
1057 <?php
1058
1059 if (!current_user_can('manage_options')) {
1060 return;
1061 }
1062
1063 wp_nonce_field('pixel-gallery-settings-save-nonce');
1064
1065 do_action('wsa_form_top_' . $form['id'], $form);
1066
1067 $this->do_settings_sections($form['id']);
1068
1069 do_action('wsa_form_bottom_' . $form['id'], $form);
1070
1071 ?>
1072
1073 </form>
1074 </div>
1075 </div>
1076 <?php
1077 }
1078 }
1079
1080 /**
1081 * Show the section settings forms
1082 *
1083 * This function displays every sections in a different form
1084 */
1085 function show_forms() {
1086 ?>
1087
1088 <?php $i = 0;
1089 foreach ($this->settings_sections as $form) {
1090 $i++; ?>
1091 <div id="<?php echo esc_attr($form['id']); ?>_page" class="pg-option-page">
1092
1093 <div bdt-filter="target: .pg-options" class="pg-options-parent" id="pg-options-parent-<?php echo esc_attr($i); ?>">
1094
1095
1096 <?php if ($form['id'] == 'pixel_gallery_active_modules' or $form['id'] == 'pixel_gallery_elementor_extend'): ?>
1097
1098 <div class="bdt-widget-filter-wrapper bdt-flex bdt-flex-column bdt-flex-wrap"
1099 bdt-sticky="end: !.pg-dashboard-container; offset: 115; animation: bdt-animation-slide-top-small; duration: 300">
1100
1101 <!-- Filter Shape Elements -->
1102 <div class="pg-filter-elements">
1103 <span class="pg-filter-element pg-filter-circle"></span>
1104 <span class="pg-filter-element pg-filter-dots"></span>
1105 <span class="pg-filter-element pg-filter-wave"></span>
1106 <span class="pg-filter-element pg-filter-hexagon"></span>
1107 <span class="pg-filter-element pg-filter-zigzag"></span>
1108 </div>
1109
1110 <div class="bdt-widget-filter-header">
1111
1112 <div class="bdt-flex bdt-flex-wrap">
1113
1114 <div class="bdt-width-expand@l pg-widget-filter-nav bdt-visible@l">
1115 <div class="bdt-flex-inline bdt-flex-middle">
1116
1117 <div>
1118 <ul
1119 class="bdt-subnav bdt-subnav-pill pg-widget-filter bdt-widget-type-content bdt-flex-inline">
1120 <li class="pg-widget-all bdt-active" bdt-filter-control="*"><a
1121 href="#"><?php esc_html_e('All', 'pixel-gallery'); ?></a></li>
1122 <li class="pg-widget-free"
1123 bdt-filter-control="filter: [data-widget-type='free']; group: data-content-type">
1124 <a href="#"><?php esc_html_e('Free', 'pixel-gallery'); ?></a>
1125 </li>
1126 <li class="pg-widget-pro"
1127 bdt-filter-control="filter: [data-widget-type='pro']; group: data-content-type">
1128 <a href="#"><?php esc_html_e('Pro', 'pixel-gallery'); ?></a>
1129 </li>
1130
1131 </ul>
1132 </div>
1133
1134 <?php if ($form['id'] == 'pixel_gallery_active_modules' or $form['id'] == 'pixel_gallery_third_party_widget'): ?>
1135
1136
1137 <?php if ($form['id'] != 'pixel_gallery_elementor_extend' or $form['id'] == 'pixel_gallery_third_party_widget'): ?>
1138
1139 <div>
1140 <ul
1141 class="bdt-subnav bdt-subnav-pill pg-widget-filter pg-used-unused-widgets bdt-flex-inline ">
1142 <li class="pg-widget--"
1143 bdt-filter-control="filter: [data-content-type*='pg-used']; group: data-content-type">
1144 <a href="#"><?php esc_html_e('Used', 'pixel-gallery'); ?>
1145 <span class="bdt-badge pg-used-widget"></span>
1146 </a>
1147 </li>
1148 <li class="pg-widget--"
1149 bdt-filter-control="filter: [data-content-type*='pg-unused']; group: data-content-type">
1150 <a href="#"
1151 bdt-tooltip="<?php esc_html_e('Don\'t need unused widget? Click on the Deactivate All button.', 'pixel-gallery'); ?>"><?php esc_html_e('Unused', 'pixel-gallery'); ?>
1152 <span class="bdt-badge pg-unused-widget bdt-danger"></span>
1153 </a>
1154 </li>
1155 </ul>
1156
1157 </div>
1158 <?php endif; ?>
1159
1160 <?php endif; ?>
1161 </div>
1162 </div>
1163
1164
1165 <div class="bdt-width-auto@l bdt-search-active-wrap bdt-flex bdt-flex-middle bdt-flex-between">
1166 <div class="bdt-widget-search">
1167 <input data-id="pg-options-parent-<?php echo esc_attr($i); ?>" onkeyup="filterSearch(this);"
1168 bdt-filter-control="" class="bdt-search-input bdt-flex-middle" type="search"
1169 placeholder="<?php esc_html_e('Search widget...', 'pixel-gallery'); ?>"
1170 autofocus>
1171 </div>
1172
1173 <div>
1174 <ul class="bdt-subnav bdt-subnav-pill pg-widget-onoff">
1175 <li>
1176 <a href="#" class="pg-active-all-widget">
1177 <?php esc_html_e('Activate All', 'pixel-gallery'); ?>
1178 </a>
1179 </li>
1180 <li>
1181 <a href="#" class="pg-deactive-all-widget">
1182 <?php esc_html_e('Deactivate All', 'pixel-gallery'); ?>
1183 </a>
1184 </li>
1185 </ul>
1186 </div>
1187 </div>
1188 </div>
1189
1190 <?php if ($form['id'] == 'pixel_gallery_active_modules'): ?>
1191 <div class="pg-content-type-filter bdt-margin-top">
1192 <div class="bdt-flex bdt-flex-wrap bdt-flex-middle bdt-visible@l">
1193 <div class="pg-filter-by-text bdt-visible@xl">
1194 <?php esc_html_e('Filter By: ', 'pixel-gallery'); ?>
1195 </div>
1196 <ul class="bdt-nav xbdt-subnav-pill xbdt-dropdown-nav pg-widget-filter pg-widget-content-type bdt-flex bdt-flex-wrap ">
1197 <li class="pg-widget-new" bdt-filter-control="filter: [data-content-type*='new']; group: data-widget-type"><a href="#"><?php esc_html_e('New', 'pixel-gallery'); ?></a></li>
1198 <li class="pg-widget-grid" bdt-filter-control="filter: [data-content-type*='grid']; group: data-widget-type"><a href="#"><?php esc_html_e('Grid', 'pixel-gallery'); ?></a></li>
1199 <li class="pg-widget-custom" bdt-filter-control="filter: [data-content-type*='custom']; group: data-widget-type"><a href="#"><?php esc_html_e('Custom', 'pixel-gallery'); ?></a></li>
1200 <li class="pg-widget-others" bdt-filter-control="filter: [data-content-type*='others']; group: data-widget-type"><a href="#"><?php esc_html_e('Others', 'pixel-gallery'); ?></a></li>
1201 </ul>
1202 </div>
1203 </div>
1204 <?php endif; ?>
1205
1206 </div>
1207
1208 </div>
1209
1210 <?php endif; ?>
1211
1212 <form class="settings-save" method="post" action="admin-ajax.php?action=pixel_gallery_settings_save">
1213 <input type="hidden" name="id" value="<?php echo esc_attr($form['id']); ?>">
1214
1215 <?php
1216
1217 if (!current_user_can('manage_options')) {
1218 return;
1219 }
1220
1221 wp_nonce_field('pixel-gallery-settings-save-nonce');
1222
1223 do_action('wsa_form_top_' . $form['id'], $form);
1224
1225 $this->do_settings_sections($form['id']);
1226
1227 do_action('wsa_form_bottom_' . $form['id'], $form);
1228
1229 ?>
1230
1231 </form>
1232 </div>
1233 </div>
1234 <?php }
1235 }
1236 }
1237
1238 endif;
1239