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 / Source.php

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

241 lines 7.1 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 abstract class Source {
5 protected $default_under, $default_from_settings, $allowed_image_sizes, $column_options, $provider,
6 $error_not_found, $error_mandatory;
7
8 protected function __construct() {
9 $this->default_under = esc_html__('Default settings can be configured under: %s', 'photonic');
10 $this->default_from_settings = esc_html__('Default from settings', 'photonic');
11 $this->allowed_image_sizes = [];
12 $this->column_options = [
13 'desc' => esc_html__('Number of columns in output', 'photonic'),
14 'type' => 'select',
15 'options' => [
16 '' => '',
17 'auto' => esc_html__('Automatic (Photonic calculates the columns)', 'photonic'),
18 '1' => 1,
19 '2' => 2,
20 '3' => 3,
21 '4' => 4,
22 '5' => 5,
23 '6' => 6,
24 '7' => 7,
25 '8' => 8,
26 '9' => 9,
27 '10' => 10,
28 '11' => 11,
29 '12' => 12,
30 '13' => 13,
31 '14' => 14,
32 '15' => 15,
33 '16' => 16,
34 '17' => 17,
35 '18' => 18,
36 '19' => 19,
37 '20' => 20,
38 ]
39 ];
40
41 $this->error_not_found = esc_html__('Not found.', 'photonic');
42 $this->error_mandatory = esc_html__('Please fill the mandatory fields. Mandatory fields are marked with a red "*".', 'photonic');
43 }
44
45 /**
46 * Gets contents of the second screen for a given provider. The second screen contains the type of content to display for a source.
47 * E.g. "Multiple photos", "Photos in an album" etc.
48 *
49 * @return mixed
50 */
51 abstract function get_screen_2();
52
53 /**
54 * Gets contents of the third screen for a given provider. This screen contains the photos, albums etc. resultant from Screen 2.
55 *
56 * @return mixed
57 */
58 abstract function get_screen_3();
59
60 /**
61 * Shows the layout selection screen.
62 *
63 * @return mixed
64 */
65 abstract function get_screen_4();
66
67 /**
68 * Shows layout-specific options for the gallery.
69 *
70 * @return mixed
71 */
72 abstract function get_screen_5();
73
74 /**
75 * Add the thumbnail sizes to the screen for the square, circle and slideshow layouts
76 *
77 * @return mixed
78 */
79 abstract function get_square_size_options();
80
81 /**
82 * Add the tile sizes to the screen for the random (justified grid), masonry and mosaic layouts
83 *
84 * @return mixed
85 */
86 abstract function get_random_size_options();
87
88 /**
89 * Makes a request to a provider to fetch the contents to be displayed within the Wizard.
90 *
91 * @param $display_type
92 * @param $for
93 * @param $flattened_fields
94 * @return mixed
95 */
96 abstract function make_request($display_type, $for, $flattened_fields);
97
98 /**
99 * Parses the response from the provider when then wizard tries to get content from it.
100 *
101 * @param $response
102 * @param $display_type
103 * @param null $url
104 * @param array $pagination
105 * @return mixed
106 */
107 abstract function process_response($response, $display_type, $url = null, &$pagination = []);
108
109 /**
110 * @param $display_type
111 * @return mixed
112 */
113 abstract function construct_shortcode_from_screen_selections($display_type);
114
115 /**
116 * @return mixed
117 */
118 abstract function deconstruct_shortcode_to_screen_selections($input);
119
120 private function get_title_position_options() {
121 $ret = [
122 '' => $this->default_from_settings,
123 'regular' => esc_html__('Normal title display using the HTML "title" attribute', 'photonic'),
124 'below' => esc_html__('Below the thumbnail', 'photonic'),
125 'tooltip' => esc_html__('Using a JavaScript tooltip', 'photonic'),
126 'hover-slideup-show' => esc_html__('Slide up from bottom upon hover', 'photonic'),
127 'slideup-stick' => esc_html__('Cover the lower portion always', 'photonic'),
128 'none' => esc_html__('No title', 'photonic'),
129 ];
130
131 return [
132 'desc' => esc_html__('How do you want the title?', 'photonic'),
133 'type' => 'select',
134 'options' => $ret,
135 'std' => '',
136 ];
137 }
138
139 function get_slideshow_options() {
140 global $photonic_thumbnail_style;
141 return [
142 'slideshow-style' => [
143 'desc' => esc_html__('Slideshow display style', 'photonic'),
144 'type' => 'image-select',
145 'options' => [
146 'strip-below' => esc_html__('Thumbnail strip or buttons below slideshow', 'photonic'),
147 'strip-above' => esc_html__('Thumbnail strip above slideshow', 'photonic'),
148 'strip-right' => esc_html__('Thumbnail strip to the right of slideshow', 'photonic'),
149 'no-strip' => esc_html__('No thumbnails or buttons for the slideshow', 'photonic'),
150 ],
151 'std' => $photonic_thumbnail_style,
152 ],
153 'strip-style' => [
154 'desc' => esc_html__('Thumbnails or buttons for the strip?', 'photonic'),
155 'type' => 'image-select',
156 'options' => [
157 'thumbs' => esc_html__('Thumbnails', 'photonic'),
158 'button' => esc_html__('Buttons', 'photonic'),
159 ],
160 'hint' => esc_html__('If you choose "Buttons" those are only shown below the slideshow.', 'photonic'),
161 'std' => 'thumbs',
162 ],
163 'controls' => [
164 'desc' => esc_html__('Slideshow Controls', 'photonic'),
165 'type' => 'select',
166 'options' => [
167 'hide' => esc_html__('Hide', 'photonic'),
168 'show' => esc_html__('Show', 'photonic'),
169 ],
170 'hint' => esc_html__('Shows Previous and Next buttons on the slideshow.', 'photonic'),
171 ],
172 'fx' => [
173 'desc' => esc_html__('Slideshow Effects', 'photonic'),
174 'type' => 'select',
175 'options' => [
176 'fade' => esc_html__('Fade', 'photonic'),
177 'slide' => esc_html__('Slide', 'photonic'),
178 ],
179 'hint' => esc_html__('Determines if a photo in a slideshow should fade in or slide in.', 'photonic')
180 ],
181 'timeout' => [
182 'desc' => esc_html__('Time between slides in ms', 'photonic'),
183 'type' => 'text',
184 'std' => '',
185 'hint' => esc_html__('Please enter numbers only', 'photonic')
186 ],
187 'speed' => [
188 'desc' => esc_html__('Time for each transition in ms', 'photonic'),
189 'type' => 'text',
190 'std' => '',
191 'hint' => esc_html__('How fast do you want the fade or slide effect to happen?', 'photonic')
192 ],
193 'pause' => [
194 'desc' => esc_html__('Pause upon hover?', 'photonic'),
195 'type' => 'select',
196 'options' => [
197 '0' => esc_html__('No', 'photonic'),
198 '1' => esc_html__('Yes', 'photonic'),
199 ],
200 'hint' => esc_html__('Should the slideshow pause when you hover over it?', 'photonic')
201 ],
202 'columns' => [
203 'desc' => esc_html__('Number of columns in slideshow', 'photonic'),
204 'type' => 'select',
205 'options' => [
206 '' => '',
207 '1' => 1,
208 '2' => 2,
209 '3' => 3,
210 '4' => 4,
211 '5' => 5,
212 '6' => 6,
213 '7' => 7,
214 '8' => 8,
215 '9' => 9,
216 '10' => 10,
217 ],
218 'hint' => esc_html__('Pick > 1 for a carousel', 'photonic'),
219 ],
220 ];
221 }
222
223 function get_square_layout_options() {
224 return [
225 'columns' => $this->column_options,
226 $this->provider => $this->get_square_size_options(),
227 'title_position' => $this->get_title_position_options(),
228 ];
229 }
230
231 function get_random_layout_options() {
232 return [
233 $this->provider => $this->get_random_size_options(),
234 'title_position' => $this->get_title_position_options(),
235 ];
236 }
237
238 function get_column_options() {
239 return $this->column_options;
240 }
241 }