PluginProbe
Photonic Gallery & Lightbox for Flickr, SmugMug & Others / 3.37
Photonic Gallery & Lightbox for Flickr, SmugMug & Others v3.37
3.37 3.36 3.35 3.34 3.33 2.19 2.20 2.21 2.22 2.23 2.24 2.25 2.26 2.27 2.28 2.29 2.30 2.31 2.32 2.33 2.34 2.40 2.41 2.42 2.43 All 142 releases
photonic / Admin / Forms / Edit_Gallery_Templates.php

Edit_Gallery_Templates.php in Photonic Gallery & Lightbox for Flickr, SmugMug & Others 3.37, at Admin/Forms/Edit_Gallery_Templates.php

73 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Photonic_Plugin\Admin\Forms;
4
5 class Edit_Gallery_Templates {
6 private array $fields;
7 private array $providers;
8 private static ?Edit_Gallery_Templates $instance = null;
9
10 private function __construct() {
11 require_once PHOTONIC_PATH . '/Admin/Forms/Vanilla_Form.php';
12 $form = Vanilla_Form::get_instance();
13 $this->fields = $form->get_fields();
14
15 $this->providers = ['default', 'flickr', 'smugmug', 'zenfolio'];
16 }
17
18 public static function get_instance(): Edit_Gallery_Templates {
19 if (null === self::$instance) {
20 self::$instance = new Edit_Gallery_Templates();
21 }
22 return self::$instance;
23 }
24
25 public function render() {
26 foreach ($this->providers as $provider) {
27 ?>
28 <script type="text/html" id="tmpl-photonic-editor-<?php echo esc_attr($provider); ?>">
29 <?php
30 $field_list = $this->fields[$provider]['fields'];
31 echo "<div class='photonic-form'>\n";
32 echo "<h2>Photonic " . wp_kses_post('default' === $provider ? 'WP' : $provider) . " Gallery Settings</h2>\n";
33 foreach ($field_list as $field) {
34 echo "\t<label class='setting'>\n";
35 echo "\t\t<span class='label'>" . wp_kses_post($field['name'] . (isset($field['req']) && $field['req'] ? '(*)' : '')) . " </span>\n";
36 switch ($field['type']) {
37 case 'text':
38 echo "\t\t<input type='text' name='" . esc_attr($field['id']) . "' value='" . esc_attr($field['std'] ?? '') . "' />\n";
39 break;
40
41 case 'select':
42 echo "\t\t<select name='" . esc_attr($field['id']) . "'>\n";
43 $default = $field['std'] ?? '';
44 foreach ($field['options'] as $option_name => $option_value) {
45 if ($option_name === $default) {
46 $selected = 'selected';
47 }
48 else {
49 $selected = '';
50 }
51 echo "\t\t\t<option value='" . esc_attr($option_name) . "' " . esc_attr($selected) . ">" . esc_attr($option_value) . "</option>\n";
52 }
53 echo "\t\t</select>\n";
54 break;
55
56 case 'raw':
57 echo "\t\t" . wp_kses($field['std'], ['select' => ['name'], 'option' => ['value', 'selected']]) . "\n";
58 break;
59 }
60 echo "\t\t<span class='hint'>" . wp_kses_post($field['hint'] ?? '') . "</span>\n";
61 echo "\t</label>\n";
62 }
63 echo "</div>\n";
64 ?>
65 </script>
66 <?php
67 }
68 }
69 }
70
71 $photonic_edit_gallery = Edit_Gallery_Templates::get_instance();
72 $photonic_edit_gallery->render();
73