PluginProbe
Photonic Gallery & Lightbox for Flickr, SmugMug & Others / 2.41
Photonic Gallery & Lightbox for Flickr, SmugMug & Others v2.41
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 2.44 All 141 releases
photonic / Admin / Wizard / Screen_Flow.php

Screen_Flow.php in Photonic Gallery & Lightbox for Flickr, SmugMug & Others 2.41, at Admin/Wizard/Screen_Flow.php

127 lines 5.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Photonic_Plugin\Admin\Wizard;
3
4 /**
5 * Contains the flow layout skeleton. Cannot be overridden by a theme file
6 *
7 * Screen 1: Provider selection
8 * Screen 2: Display Type selection; input: Provider
9 * Screen 3: Gallery selection; input: Display Type
10 * Screen 4: Layout selection; input: Gallery & Display Type
11 *
12 * @since 2.00
13 */
14
15 if (!current_user_can('edit_posts')) {
16 wp_die(esc_html__('You are not authorized to use this capability.', 'photonic'));
17 }
18
19 class Screen_Flow {
20 var $editor_shortcode, $input_shortcode, $editor_shortcode_text;
21 function __construct() {
22 global $photonic_flow_input_shortcode;
23 if (isset($_REQUEST['shortcode'])) {
24 $this->input_shortcode = sanitize_text_field($_REQUEST['shortcode']);
25 $this->input_shortcode = base64_decode($this->input_shortcode);
26 $this->input_shortcode = json_decode($this->input_shortcode);
27 }
28
29 $this->editor_shortcode = [
30 'provider' => '',
31 ];
32
33 if (!empty($this->input_shortcode) && !empty($this->input_shortcode->shortcode)) {
34 $this->editor_shortcode_text = esc_attr($this->input_shortcode->content);
35 $shortcode = $this->input_shortcode->shortcode;
36 $tag = $shortcode->tag;
37 $attrs = $shortcode->attrs;
38 $attrs = $attrs->named;
39 if ((!empty($attrs->type) && in_array($attrs->type, ['wp', 'flickr', 'smugmug', 'picasa', 'google', 'zenfolio', 'instagram'])) ||
40 (empty($attrs->type) && !empty($attrs->style)) && in_array($attrs->style, ['square', 'circle', 'random', 'masonry', 'mosaic', 'strip-above', 'strip-below', 'strip-right', 'no-strip'])) {
41 $this->editor_shortcode['provider'] = !empty($attrs->type) ? $attrs->type : 'wp';
42 }
43 }
44 }
45
46 function render() {
47 ?>
48 <div id="photonic-flow-wrapper" data-current-screen="1">
49 <form id="photonic-flow" data-photonic-submission="" data-photonic-submission-pending="">
50 <input type="hidden" name="post_id" value="<?php echo $_REQUEST['post_id']; ?>"/>
51 <input name="photonic-editor-shortcode" id="photonic-editor-shortcode" type="hidden" value="<?php echo !empty($this->editor_shortcode_text) ? $this->editor_shortcode_text : ''; ?>" />
52 <input name="photonic-editor-shortcode-raw" id="photonic-editor-shortcode-raw" type="hidden" value="<?php echo !empty($_REQUEST['shortcode']) ? sanitize_text_field($_REQUEST['shortcode']) : ''; ?>" />
53 <input name="photonic-editor-json" id="photonic-editor-json" type="hidden" value="" />
54 <input name="photonic-gutenberg-active" id="photonic-gutenberg-active" type="hidden" value="" />
55 <div id="photonic-flow-provider" class="photonic-flow-screen photonic-gallery" data-screen="1">
56 <!-- Provider selection -->
57 <h1><?php esc_html_e('Choose Gallery Source', 'photonic'); ?></h1>
58 <div class='photonic-flow-selector-container photonic-flow-provider' data-photonic-flow-selector-mode='single-no-plus' data-photonic-flow-selector-for="provider">
59 <input type="hidden" id="provider" name="provider" value="<?php echo $this->editor_shortcode['provider']; ?>"/>
60
61 <?php
62 $providers = [
63 'wp' => 'WordPress',
64 'flickr' => 'Flickr',
65 'smugmug' => 'SmugMug',
66 // 'picasa' => 'Picasa',
67 'google' => 'Google Photos',
68 'zenfolio' => 'Zenfolio',
69 'instagram' => 'Instagram',
70 ];
71 foreach ($providers as $provider => $desc) {
72 ?>
73 <div class="photonic-flow-selector photonic-flow-provider-<?php echo $provider; ?> <?php echo $provider == $this->editor_shortcode['provider'] ? 'selected' : ''; ?>" title="<?php echo esc_attr($desc);?>">
74 <span class="photonic-flow-selector-inner photonic-provider" data-photonic-selection-id="<?php echo $provider; ?>">&nbsp;</span>
75 <div class='photonic-flow-selector-info'><?php echo $desc;?></div>
76 </div>
77 <?php
78 }
79 ?>
80
81 </div>
82 <div class="photonic-editor-info">
83 <?php
84 if (empty($this->editor_shortcode_text)) {
85 echo '<div>'.sprintf(esc_html__('%1$sHint:%2$s To edit an existing shortcode select the shortcode before clicking on the "Add / Edit Photonic Gallery" button.', 'photonic'), '<strong>', '</strong>').'</div>';
86 }
87 ?>
88 </div>
89 </div>
90
91 <!-- "Display Type" selection -->
92 <div class="photonic-flow-screen" data-submitted="" data-screen="2">
93 </div>
94
95 <!-- Gallery Builder -->
96 <div class="photonic-flow-screen" data-submitted="" data-screen="3">
97 </div>
98
99 <!-- Layout Selection -->
100 <div class="photonic-flow-screen" data-submitted="" data-screen="4">
101 </div>
102
103 <!-- Layout Options -->
104 <div class="photonic-flow-screen" data-submitted="" data-screen="5">
105 </div>
106
107 <!-- Final shortcode -->
108 <div class="photonic-flow-screen" data-submitted="" data-screen="6">
109 </div>
110
111 <div id="photonic-flow-navigation" class="photonic-flow-navigation">
112 <a href="#" id="photonic-nav-previous" class="previous disabled">Previous</a>
113 <a href="#" id="photonic-nav-next" class="next">Next</a>
114 </div>
115
116 <input type="hidden" id="selected_data" name="selected_data"/>
117 <input type="hidden" id="selection_passworded" name="selection_passworded"/>
118 </form>
119 </div>
120 <div class="photonic-waiting"></div>
121 <?php
122 }
123 }
124
125 $flow = new Screen_Flow();
126 $flow->render();
127