| 1 |
<?php |
| 2 |
|
| 3 |
namespace Photonic_Plugin\Admin; |
| 4 |
|
| 5 |
if (!defined('ABSPATH')) { |
| 6 |
echo '<h1>WordPress not loaded!</h1>'; |
| 7 |
exit; |
| 8 |
} |
| 9 |
|
| 10 |
require_once 'Admin_Page.php'; |
| 11 |
|
| 12 |
class Getting_Started extends Admin_Page { |
| 13 |
private static ?Getting_Started $instance = null; |
| 14 |
|
| 15 |
private function __construct() { |
| 16 |
// Empty |
| 17 |
} |
| 18 |
|
| 19 |
public static function get_instance() { |
| 20 |
if (null === self::$instance) { |
| 21 |
self::$instance = new Getting_Started(); |
| 22 |
} |
| 23 |
return self::$instance; |
| 24 |
} |
| 25 |
|
| 26 |
public function render_content() { |
| 27 |
$this->tabs(); |
| 28 |
$this->capabilities(); |
| 29 |
$this->build_gallery(); |
| 30 |
$this->layouts(); |
| 31 |
$this->lightbox(); |
| 32 |
$this->secret_menu(); |
| 33 |
$this->helper_shortcode(); |
| 34 |
$this->really_technical(); |
| 35 |
} |
| 36 |
|
| 37 |
private function tabs() { |
| 38 |
?> |
| 39 |
<script type="text/javascript"> |
| 40 |
document.addEventListener('DOMContentLoaded', function () { |
| 41 |
const photonicStartTabs = document.querySelectorAll('.photonic-options-header-bar .nav-tab'); |
| 42 |
photonicStartTabs.forEach(function (tab) { |
| 43 |
tab.addEventListener('click', function (e) { |
| 44 |
e.preventDefault(); |
| 45 |
const hash = tab.getAttribute('href'); |
| 46 |
photonicShowSection(hash); |
| 47 |
}); |
| 48 |
}); |
| 49 |
|
| 50 |
function photonicShowSection(hash) { |
| 51 |
let check = 'photonic-start-capabilities'; |
| 52 |
let foundHash = false; |
| 53 |
if (hash) { |
| 54 |
check = hash.substr(1); |
| 55 |
if (['photonic-start-capabilities', 'photonic-start-create', 'photonic-start-layouts', 'photonic-start-lightbox', 'photonic-start-secret', 'photonic-start-helpers', 'photonic-start-tech'].indexOf(check) < 0) { |
| 56 |
check = 'photonic-start-capabilities'; |
| 57 |
} |
| 58 |
else { |
| 59 |
foundHash = true; |
| 60 |
} |
| 61 |
} |
| 62 |
|
| 63 |
photonicStartTabs.forEach(function (tab) { |
| 64 |
let panel; |
| 65 |
if (tab.getAttribute('href') === ('#' + check)) { |
| 66 |
tab.classList.add('nav-tab-active'); |
| 67 |
panel = document.querySelector(tab.getAttribute('href')); |
| 68 |
panel.classList.add('photonic-panel-visible'); |
| 69 |
if (foundHash) { |
| 70 |
window.history.pushState({}, document.title, '#' + check); |
| 71 |
} |
| 72 |
else { |
| 73 |
window.history.pushState({}, document.title, ''); |
| 74 |
} |
| 75 |
} |
| 76 |
else { |
| 77 |
tab.classList.remove('nav-tab-active'); |
| 78 |
panel = document.querySelector(tab.getAttribute('href')); |
| 79 |
panel.classList.remove('photonic-panel-visible'); |
| 80 |
} |
| 81 |
}); |
| 82 |
} |
| 83 |
|
| 84 |
let hash = location.hash; |
| 85 |
photonicShowSection(hash); |
| 86 |
}); |
| 87 |
</script> |
| 88 |
<div class="photonic-tabbed-start"> |
| 89 |
<div class="photonic-header-nav"> |
| 90 |
<div class="photonic-options-header-bar fix"> |
| 91 |
<h2 class='nav-tab-wrapper'> |
| 92 |
<a class='nav-tab' id='photonic-start-tab-capabilities' href='#photonic-start-capabilities'>Overview</a> |
| 93 |
<a class='nav-tab' id='photonic-start-tab-create' href='#photonic-start-create'>Create |
| 94 |
Galleries</a> |
| 95 |
<a class='nav-tab' id='photonic-start-tab-layouts' href='#photonic-start-layouts'>Layouts</a> |
| 96 |
<a class='nav-tab' id='photonic-start-tab-lightbox' |
| 97 |
href='#photonic-start-lightbox'>Lightboxes</a> |
| 98 |
<a class='nav-tab' id='photonic-start-tab-secret' href='#photonic-start-secret'>Secret Menu</a> |
| 99 |
<a class='nav-tab' id='photonic-start-tab-helpers' href='#photonic-start-helpers'>Helpers</a> |
| 100 |
<a class='nav-tab' id='photonic-start-tab-tech' href='#photonic-start-tech'>Technical Stuff</a> |
| 101 |
</h2> |
| 102 |
</div> |
| 103 |
</div> |
| 104 |
</div><!-- /#photonic-tabbed-options --> |
| 105 |
<?php |
| 106 |
} |
| 107 |
|
| 108 |
private function capabilities() { |
| 109 |
?> |
| 110 |
<div id="photonic-start-capabilities" class="photonic-start-panel"> |
| 111 |
<h2 class="photonic-section">Capabilities and Documentation</h2> |
| 112 |
<p> |
| 113 |
Photonic can show you photos and galleries not just from standard WordPress, but also from several |
| 114 |
third-party photo-hosting providers |
| 115 |
such as Flickr, SmugMug, etc. The following table tells you what you need for each |
| 116 |
provider, and provides you with |
| 117 |
documentation links for how to show something using Photonic. |
| 118 |
</p> |
| 119 |
|
| 120 |
<table class="form-table photonic-form-table"> |
| 121 |
<tr> |
| 122 |
<th rowspan="2" class="theader">Provider</th> |
| 123 |
<th colspan="4" class="theader">What Can You Show?</th> |
| 124 |
<th rowspan="2" class="theader">Authentication</th> |
| 125 |
<th rowspan="2" class="theader">Lightbox Support</th> |
| 126 |
</tr> |
| 127 |
|
| 128 |
<tr> |
| 129 |
<th class="theader">Single Photo<br/>(Level 0)</th> |
| 130 |
<th class="theader">Photos / Videos<br/>(Level 1)</th> |
| 131 |
<th class="theader">Albums / Sets / Galleries<br/>(Level 2)</th> |
| 132 |
<th class="theader">Collections / Groups<br/>(Level 3)</th> |
| 133 |
</tr> |
| 134 |
|
| 135 |
<tr> |
| 136 |
<th>Native WP</th> |
| 137 |
<td>Not supported</td> |
| 138 |
<td><a href="https://aquoid.com/plugins/photonic/wp-galleries/">Standard gallery photos</a>, no |
| 139 |
videos in WP galleries |
| 140 |
</td> |
| 141 |
<td><a href="https://aquoid.com/plugins/photonic/wp-galleries/">Standard galleries</a></td> |
| 142 |
<td>No such feature in WP</td> |
| 143 |
<td>No such feature in WP</td> |
| 144 |
<td>All</td> |
| 145 |
</tr> |
| 146 |
|
| 147 |
<tr> |
| 148 |
<th> |
| 149 |
Flickr<br/> |
| 150 |
<em><a href="https://www.flickr.com/services/api/misc.api_keys.html">API Key |
| 151 |
Required</a></em><br/> |
| 152 |
<em>See <a href="https://aquoid.com/plugins/photonic/flickr/#api-key">Instructions</a></em> |
| 153 |
</th> |
| 154 |
<td><a href="https://aquoid.com/plugins/photonic/flickr/flickr-photo/">Supported</a></td> |
| 155 |
<td><a href="https://aquoid.com/plugins/photonic/flickr/flickr-photos/">User Photos, Videos and |
| 156 |
Group Pools</a></td> |
| 157 |
<td><a href="https://aquoid.com/plugins/photonic/flickr/flickr-photosets/">Albums / Photosets</a> |
| 158 |
and <a href="https://aquoid.com/plugins/photonic/flickr/flickr-galleries/">Galleries</a></td> |
| 159 |
<td><a href="https://aquoid.com/plugins/photonic/flickr/flickr-collections/">Collections, with lazy |
| 160 |
loading</a></td> |
| 161 |
<td><a href="https://aquoid.com/plugins/photonic/flickr/flickr-authentication/">Required to share |
| 162 |
private photos</a></td> |
| 163 |
<td>All; Image Lightbox, PrettyPhoto and StripJS cannot handle videos; Lightcase shows Flash videos |
| 164 |
for Flickr |
| 165 |
</td> |
| 166 |
</tr> |
| 167 |
|
| 168 |
<tr> |
| 169 |
<th> |
| 170 |
SmugMug<br/> |
| 171 |
<em><a href="https://api.smugmug.com/api/developer/apply">API Key required for private |
| 172 |
photos</a></em><br/> |
| 173 |
<em>See <a href="https://aquoid.com/plugins/photonic/smugmug/#api-key">instructions</a></em> |
| 174 |
</th> |
| 175 |
<td>Not supported</td> |
| 176 |
<td><a href="https://aquoid.com/plugins/photonic/smugmug/smugmug-photos/">User photos and videos</a> |
| 177 |
</td> |
| 178 |
<td><a href="https://aquoid.com/plugins/photonic/smugmug/smugmug-albums/">Albums</a></td> |
| 179 |
<td><a href="https://aquoid.com/plugins/photonic/smugmug/smugmug-tree/">User tree</a> and <a |
| 180 |
href="https://aquoid.com/plugins/photonic/smugmug/folders/">Folders</a></td> |
| 181 |
<td><a href="https://aquoid.com/plugins/photonic/smugmug/smugmug-albums/#protected">Password-protection</a>, |
| 182 |
<a href="https://aquoid.com/plugins/photonic/authentication/#back-end">Authentication to share |
| 183 |
your private photos</a></td> |
| 184 |
<td>All; Image Lightbox, PrettyPhoto and StripJS cannot handle videos</td> |
| 185 |
</tr> |
| 186 |
|
| 187 |
<tr> |
| 188 |
<th> |
| 189 |
Google Photos |
| 190 |
</th> |
| 191 |
<td>Not supported</td> |
| 192 |
<td>Not supported</td> |
| 193 |
<td>Not supported</td> |
| 194 |
<td>No such feature in Google Photos</td> |
| 195 |
<td>Not supported</td> |
| 196 |
<td>Not supported</td> |
| 197 |
</tr> |
| 198 |
|
| 199 |
<tr> |
| 200 |
<th>Zenfolio</th> |
| 201 |
<td><a href="https://aquoid.com/plugins/photonic/zenfolio/photos/#individual">Supported</a></td> |
| 202 |
<td><a href="https://aquoid.com/plugins/photonic/zenfolio/photosets/">User</a> and <a |
| 203 |
href="https://aquoid.com/plugins/photonic/zenfolio/photos/">Generic</a> photos and |
| 204 |
videos |
| 205 |
</td> |
| 206 |
<td><a href="https://aquoid.com/plugins/photonic/zenfolio/photosets/">Photosets (Galleries and |
| 207 |
Collections)</a></td> |
| 208 |
<td><a href="https://aquoid.com/plugins/photonic/zenfolio/groups/">Groups</a> and <a |
| 209 |
href="https://aquoid.com/plugins/photonic/zenfolio/group-hierarchy/">Group |
| 210 |
hierarchies</a></td> |
| 211 |
<td><a href="https://aquoid.com/plugins/photonic/zenfolio/groups/">Password-protection supported</a>, |
| 212 |
authentication not supported |
| 213 |
</td> |
| 214 |
<td>All; Image Lightbox, PrettyPhoto and StripJS cannot handle videos</td> |
| 215 |
</tr> |
| 216 |
|
| 217 |
<tr> |
| 218 |
<th> |
| 219 |
Instagram |
| 220 |
</th> |
| 221 |
<td>Not supported</td> |
| 222 |
<td>Not supported</td> |
| 223 |
<td>Not supported</td> |
| 224 |
<td>No such feature in Google Photos</td> |
| 225 |
<td>Not supported</td> |
| 226 |
<td>Not supported</td> |
| 227 |
</tr> |
| 228 |
</table> |
| 229 |
</div> |
| 230 |
<?php |
| 231 |
} |
| 232 |
|
| 233 |
private function build_gallery() { |
| 234 |
?> |
| 235 |
<div id="photonic-start-create" class="photonic-start-panel"> |
| 236 |
<h2 class="photonic-section">Showing a Gallery</h2> |
| 237 |
<p> |
| 238 |
While using the Classic Editor a gallery is displayed using the <code>[gallery]</code> shortcode. If the |
| 239 |
Gutenberg Block Editor is |
| 240 |
used a gallery is displayed using a Gutenberg Block instead. Given the plethora of options and |
| 241 |
configurations offered in Photonic, |
| 242 |
things have been made easier by virtue of a shortcode insertion UI. To use it: |
| 243 |
</p> |
| 244 |
|
| 245 |
<ol> |
| 246 |
<li> |
| 247 |
<h4>Getting Started</h4> |
| 248 |
If you are using the "Classic Editor" click on the "Add Media" button or the "Add / Edit Photonic |
| 249 |
Gallery" button:<br/> |
| 250 |
<img src="<?php echo esc_url(PHOTONIC_URL) . 'screenshot-2.jpg'; ?>" alt="'Add Media' Button"/><br/><br/> |
| 251 |
|
| 252 |
Correspondingly if you are using "Gutenberg" use the Photonic Gallery block:<br/> |
| 253 |
<img src="<?php echo esc_url(PHOTONIC_URL) . 'screenshot-1.png'; ?>" alt="Gutenberg Block"/> |
| 254 |
</li> |
| 255 |
|
| 256 |
<li> |
| 257 |
<h4>Building a Gallery</h4> |
| 258 |
<ol> |
| 259 |
<li> |
| 260 |
<strong>Via "Add Media"</strong> |
| 261 |
<ol> |
| 262 |
<li> |
| 263 |
Click on the "Photonic" tab:<br/> |
| 264 |
<img src="<?php echo esc_url(PHOTONIC_URL) . 'screenshot-5.jpg'; ?>" |
| 265 |
alt="Media Uploader"/><br/> |
| 266 |
</li> |
| 267 |
<li> |
| 268 |
Pick your source:<br/> |
| 269 |
<img src="<?php echo esc_url(PHOTONIC_URL) . 'screenshot-6.jpg'; ?>" |
| 270 |
alt="Sources in Media Uploader"/><br/> |
| 271 |
</li> |
| 272 |
<li> |
| 273 |
Fill out the attributes for the gallery:<br/> |
| 274 |
<img src="<?php echo esc_url(PHOTONIC_URL) . 'screenshot-8.png'; ?>" |
| 275 |
alt="Gallery attributes"/><br/> |
| 276 |
</li> |
| 277 |
</ol> |
| 278 |
</li> |
| 279 |
<li> |
| 280 |
<strong>Wizard Via "Add / Edit Photonic Gallery", or the "Photonic Gallery" block</strong> |
| 281 |
<ol> |
| 282 |
<li> |
| 283 |
You are presented with a wizard to pick the source for your gallery:<br/> |
| 284 |
<img src="<?php echo esc_url(PHOTONIC_URL) . 'screenshot-3.png'; ?>" |
| 285 |
alt="Wizard Starting Screen"/><br/> |
| 286 |
</li> |
| 287 |
<li> |
| 288 |
You will be shown a contextual set of options based on your choices:<br/> |
| 289 |
<img src="<?php echo esc_url(PHOTONIC_URL) . 'screenshot-4.png'; ?>" |
| 290 |
alt="Contextual options in the Wizard"/><br/> |
| 291 |
</li> |
| 292 |
</ol> |
| 293 |
</li> |
| 294 |
</ol> |
| 295 |
</li> |
| 296 |
<li> |
| 297 |
Depending on which gallery you inserted you will be shown a placeholder of this sort:<br/> |
| 298 |
<img src="<?php echo esc_url(PHOTONIC_URL) . 'screenshot-7.png'; ?>" |
| 299 |
alt="Gallery shows up with a placeholder"/> |
| 300 |
</li> |
| 301 |
<li> |
| 302 |
Clicking on the placeholder will let you edit the gallery you inserted.<br/> |
| 303 |
Note that if you are using the Visual Editor, you <em>may</em> encounter TinyMCE conflicts with |
| 304 |
other plugins. In case of such a conflict |
| 305 |
please <a href="https://wordpress.org/support/plugin/photonic/">report a bug</a>, and disable the |
| 306 |
Visual Editor integration from |
| 307 |
<em>Photonic → Settings → Generic Options → Generic Settings → Disable shortcode |
| 308 |
editing in Visual Editor</em>. The plugin will |
| 309 |
continue working normally – the only difference is that you will have to do shortcode edits by |
| 310 |
hand via the Text Editor rather than via a UI |
| 311 |
in the Visual Editor. |
| 312 |
</li> |
| 313 |
</ol> |
| 314 |
</div> |
| 315 |
<?php |
| 316 |
} |
| 317 |
|
| 318 |
private function layouts() { |
| 319 |
?> |
| 320 |
<div id="photonic-start-layouts" class="photonic-start-panel"> |
| 321 |
<h2 class="photonic-section">Gallery Layouts</h2> |
| 322 |
<p> |
| 323 |
Photonic supports the following types of layouts: |
| 324 |
</p> |
| 325 |
<ol> |
| 326 |
<li><a href="https://aquoid.com/plugins/photonic/layouts/#square">Square thumbnails</a></li> |
| 327 |
<li><a href="https://aquoid.com/plugins/photonic/layouts/#circle">Circular thumbnails</a></li> |
| 328 |
<li><a href="https://aquoid.com/plugins/photonic/layouts/#slideshow">Slideshow</a></li> |
| 329 |
<li><a href="https://aquoid.com/plugins/photonic/layouts/#justified">Random Justified Grid</a></li> |
| 330 |
<li><a href="https://aquoid.com/plugins/photonic/layouts/#masonry">Masonry</a></li> |
| 331 |
<li><a href="https://aquoid.com/plugins/photonic/layouts/#mosaic">Mosaic</a></li> |
| 332 |
</ol> |
| 333 |
</div> |
| 334 |
<?php |
| 335 |
} |
| 336 |
|
| 337 |
private function lightbox() { |
| 338 |
$lightboxes = [ |
| 339 |
'baguetteBox' => [ |
| 340 |
'name' => 'BaguetteBox', |
| 341 |
'url' => 'https://feimosi.github.io/baguetteBox.js/', |
| 342 |
'size' => '~10KB JS, ~4KB CSS', |
| 343 |
'supports' => ['bundled', 'deepLinking', 'html5', 'noJQ', 'socialSharing', 'touch'], |
| 344 |
'license' => 'MIT', |
| 345 |
'notes' => 'No support for YouTube / Vimeo', |
| 346 |
], |
| 347 |
'bigPicture' => [ |
| 348 |
'name' => 'BigPicture', |
| 349 |
'url' => 'https://henrygd.me/bigpicture/', |
| 350 |
'size' => '~9KB JS, no CSS', |
| 351 |
'supports' => ['bundled', 'deepLinking', 'html5', 'noJQ', 'socialSharing', 'touch', 'ytVimeo'], |
| 352 |
'license' => 'MIT', |
| 353 |
'notes' => 'No support for videos in galleries', |
| 354 |
], |
| 355 |
'colorbox' => [ |
| 356 |
'name' => 'Colorbox', |
| 357 |
'url' => 'https://jacklmoore.com/colorbox/', |
| 358 |
'size' => '~10KB JS, 5KB CSS', |
| 359 |
'supports' => ['autoStart', 'bundled', 'deepLinking', 'html5', 'socialSharing', 'touch', 'ytVimeo'], |
| 360 |
'license' => 'MIT', |
| 361 |
], |
| 362 |
'fancybox' => [ |
| 363 |
'name' => 'Fancybox1', |
| 364 |
'url' => 'http://fancybox.net/', |
| 365 |
'size' => '~16KB JS, 9KB CSS', |
| 366 |
'supports' => ['autoStart', 'html5', 'touch', 'ytVimeo'], |
| 367 |
'license' => 'MIT, GPL', |
| 368 |
], |
| 369 |
'fancybox2' => [ |
| 370 |
'name' => 'Fancybox2', |
| 371 |
'url' => 'https://fancyapps.com/fancybox/', |
| 372 |
'size' => '~23KB JS, 5KB CSS', |
| 373 |
'supports' => ['autoStart', 'deepLinking', 'socialSharing', 'html5', 'thumbnails', 'touch', 'ytVimeo'], |
| 374 |
'license' => 'CC-BY-NC 3.0', |
| 375 |
], |
| 376 |
'fancybox3' => [ |
| 377 |
'name' => 'Fancybox3', |
| 378 |
'url' => 'https://fancyapps.com/fancybox/3', |
| 379 |
'size' => '~61KB JS, 14KB CSS', |
| 380 |
'supports' => ['autoStart', 'bundled', 'deepLinking', 'html5', 'socialSharing', 'thumbnails', 'touch', 'ytVimeo'], |
| 381 |
'license' => 'GPL v3', |
| 382 |
], |
| 383 |
'featherlight' => [ |
| 384 |
'name' => 'Featherlight', |
| 385 |
'url' => 'https://noelboss.github.io/featherlight/', |
| 386 |
'size' => '~13KB JS, 5KB CSS', |
| 387 |
'supports' => ['bundled', 'deepLinking', 'html5', 'socialSharing', 'touch', 'ytVimeo'], |
| 388 |
'license' => 'MIT', |
| 389 |
], |
| 390 |
'glightbox' => [ |
| 391 |
'name' => '"Gie" Lightbox (GLightbox)', |
| 392 |
'url' => 'https://biati-digital.github.io/glightbox/', |
| 393 |
'size' => '~54KB JS, 14KB CSS', |
| 394 |
'supports' => ['bundled', 'deepLinking', 'html5', 'noJQ', 'socialSharing', 'touch', 'ytVimeo'], |
| 395 |
'license' => 'MIT', |
| 396 |
], |
| 397 |
'imageLightbox' => [ |
| 398 |
'name' => 'Image Lightbox', |
| 399 |
'url' => 'https://osvaldas.info/image-lightbox-responsive-touch-friendly', |
| 400 |
'size' => '~6KB JS, 5KB CSS', |
| 401 |
'supports' => ['bundled', 'deepLinking', 'socialSharing', 'touch'], |
| 402 |
'license' => 'MIT', |
| 403 |
'notes' => 'No video support', |
| 404 |
], |
| 405 |
'lightCase' => [ |
| 406 |
'name' => 'LightCase', |
| 407 |
'url' => 'https://cornel.bopp-art.com/lightcase/', |
| 408 |
'size' => '~26KB JS, 14KB CSS', |
| 409 |
'supports' => ['autoStart', 'bundled', 'deepLinking', 'html5', 'socialSharing', 'touch', 'ytVimeo'], |
| 410 |
'license' => 'GPL', |
| 411 |
], |
| 412 |
'lightGallery' => [ |
| 413 |
'name' => 'LightGallery', |
| 414 |
'url' => 'https://lightgalleryjs.com/', |
| 415 |
'size' => '~52KB JS, 21KB CSS, ~26KB Fonts, + Additional Plugins', |
| 416 |
'supports' => ['autoStart', 'bundled', 'deepLinking', 'html5', 'noJQ', 'socialSharing', 'thumbnails', 'touch', 'ytVimeo'], |
| 417 |
'license' => 'GPL v3', |
| 418 |
], |
| 419 |
'magnific' => [ |
| 420 |
'name' => 'Magnific Popup', |
| 421 |
'url' => 'https://dimsemenov.com/plugins/magnific-popup/', |
| 422 |
'size' => '~20KB JS, 7KB CSS', |
| 423 |
'supports' => ['deepLinking', 'html5', 'socialSharing', 'touch', 'ytVimeo'], |
| 424 |
'license' => 'MIT', |
| 425 |
], |
| 426 |
'photoSwipe' => [ |
| 427 |
'name' => 'PhotoSwipe', |
| 428 |
'url' => 'https://github.com/dimsemenov/PhotoSwipe/tree/v4.1.3', |
| 429 |
'size' => '~41KB JS, 11KB CSS', |
| 430 |
'supports' => ['bundled', 'deepLinking', 'html5', 'noJQ', 'socialSharing', 'touch', 'ytVimeo'], |
| 431 |
'license' => 'MIT', |
| 432 |
'notes' => 'No video support for Flickr', |
| 433 |
], |
| 434 |
'photoSwipe5' => [ |
| 435 |
'name' => 'PhotoSwipe v5', |
| 436 |
'url' => 'https://photoswipe.com/', |
| 437 |
'size' => '~66KB JS, 5KB CSS', |
| 438 |
'supports' => ['bundled', 'deepLinking', 'html5', 'noJQ', 'socialSharing', 'touch', 'ytVimeo'], |
| 439 |
'license' => 'MIT', |
| 440 |
'notes' => 'No video support for Flickr', |
| 441 |
], |
| 442 |
'prettyPhoto' => [ |
| 443 |
'name' => 'PrettyPhoto', |
| 444 |
'url' => 'http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/', |
| 445 |
'size' => '~23KB JS, 27KB CSS', |
| 446 |
'supports' => ['autoStart', 'deepLinking', 'socialSharing', 'thumbnails', 'touch', 'ytVimeo'], |
| 447 |
'license' => 'GPL v2.0', |
| 448 |
'notes' => 'YouTube / Vimeo supported, but not other videos' |
| 449 |
], |
| 450 |
'strip' => [ |
| 451 |
'name' => 'Strip', |
| 452 |
'url' => 'http://stripjs.com', |
| 453 |
'size' => '~39KB JS, 13KB CSS', |
| 454 |
'supports' => ['bundled', 'deepLinking', 'touch', 'ytVimeo'], |
| 455 |
'license' => 'CC-BY 4.0', |
| 456 |
'notes' => 'YouTube / Vimeo supported, but not other videos', |
| 457 |
], |
| 458 |
'spotlight' => [ |
| 459 |
'name' => 'Spotlight', |
| 460 |
'url' => 'https://nextapps-de.github.io/spotlight/', |
| 461 |
'size' => '~10KB JS, 11KB CSS', |
| 462 |
'supports' => ['autoStart', 'bundled', 'deepLinking', 'html5', 'noJQ', 'socialSharing', 'touch', 'ytVimeo'], |
| 463 |
'license' => 'Apache 2.0', |
| 464 |
], |
| 465 |
'swipebox' => [ |
| 466 |
'name' => 'Swipebox', |
| 467 |
'url' => 'https://brutaldesign.github.io/swipebox/', |
| 468 |
'size' => '~12KB JS, 5KB CSS', |
| 469 |
'supports' => ['bundled', 'deepLinking', 'html5', 'socialSharing', 'touch', 'ytVimeo'], |
| 470 |
'license' => 'MIT', |
| 471 |
], |
| 472 |
'thickbox' => [ |
| 473 |
'name' => 'Thickbox', |
| 474 |
'url' => 'http://codylindley.com/thickbox/', |
| 475 |
'size' => '~12KB JS', |
| 476 |
'supports' => ['bundled', 'deepLinking', 'html5', 'socialSharing', 'touch', 'ytVimeo'], |
| 477 |
'license' => 'MIT', |
| 478 |
'notes' => 'No video support' |
| 479 |
], |
| 480 |
'venobox' => [ |
| 481 |
'name' => 'VenoBox', |
| 482 |
'url' => 'https://veno.es/venobox/', |
| 483 |
'size' => '~16KB JS, ~15KB CSS', |
| 484 |
'supports' => ['bundled', 'deepLinking', 'html5', 'noJQ', 'socialSharing', 'touch', 'ytVimeo'], |
| 485 |
'license' => 'MIT', |
| 486 |
], |
| 487 |
]; |
| 488 |
$lightboxes_json = wp_json_encode($lightboxes); |
| 489 |
|
| 490 |
$supports = [ |
| 491 |
'autoStart' => '<abbr title="When you open a gallery in a lightbox, this lets the lightbox run in a slideshow mode automatically without the user driving the navigation.">Auto-start slideshow</abbr>', |
| 492 |
'bundled' => 'Bundled with Photonic', |
| 493 |
'deepLinking' => '<abbr title="Deep-linking assigns a URL to every image in a gallery. If you enter that URL directly in a browser\'s address bar, it automatically opens the image in a lightbox.">Deep-linking</abbr>', |
| 494 |
'html5' => 'HTML5 Videos from Flickr etc.', |
| 495 |
'noJQ' => 'No <abbr title="jQuery adds a ~95KB file to the pages. It is commonly used by themes and plugins, so even if Photonic doesn\'t load jQuery, something else might.">jQuery</abbr> required', |
| 496 |
'socialSharing' => '<abbr title="If deep-linking is enabled, you have the option to display social sharing links. Photonic can help you share links on Facebook, Twitter and Google+.">Social Sharing</abbr>', |
| 497 |
'thumbnails' => '<abbr title="This capability helps display thumbnails for all your images within the lightbox.">Thumbnails</abbr>', |
| 498 |
'touch' => 'Touch / gestures', |
| 499 |
'ytVimeo' => 'YouTube, Vimeo etc.', |
| 500 |
]; |
| 501 |
?> |
| 502 |
<div id="photonic-start-lightbox" class="photonic-start-panel"> |
| 503 |
<h2 class="photonic-section">Which Lightbox?</h2> |
| 504 |
<p> |
| 505 |
Photonic includes several lightboxes and supports some others that it cannot include due to licensing |
| 506 |
reasons. Each lightbox has |
| 507 |
its own strengths — some are lightweight, some are full-featured and some are very elegant |
| 508 |
looking. You can pick one based on the |
| 509 |
features that you feel are most important to you. Note that out-of-the-box, several of these don't |
| 510 |
support features such as touch gestures, or deep-linking, |
| 511 |
but for Photonic those capabilities have been integrated into the scripts via other approaches. |
| 512 |
</p> |
| 513 |
|
| 514 |
<table class="form-table photonic-form-table" id="photonic-lightboxes"> |
| 515 |
<tr> |
| 516 |
<th>Features</th> |
| 517 |
<th>Lightboxes</th> |
| 518 |
</tr> |
| 519 |
|
| 520 |
<tr> |
| 521 |
<td id="lightbox-features"> |
| 522 |
<ul> |
| 523 |
<?php |
| 524 |
foreach ($supports as $feature => $text) { |
| 525 |
?> |
| 526 |
<li> |
| 527 |
<label> |
| 528 |
<input type="checkbox" value="<?php echo esc_attr($feature); ?>" /> |
| 529 |
<?php echo wp_kses_post($text); ?> |
| 530 |
</label> |
| 531 |
</li> |
| 532 |
<?php |
| 533 |
} |
| 534 |
?> |
| 535 |
</ul> |
| 536 |
</td> |
| 537 |
|
| 538 |
<td id="lightbox-list"> |
| 539 |
<ul> |
| 540 |
<?php |
| 541 |
foreach ($lightboxes as $lb => $lightbox) { |
| 542 |
?> |
| 543 |
<li id="photonic-lb-<?php echo esc_attr($lb); ?>"> |
| 544 |
<button id="photonic-lb-button-<?php echo esc_attr($lb); ?>" |
| 545 |
style="border: none; cursor: pointer; "> |
| 546 |
<span class="dashicons dashicons-forms"></span> |
| 547 |
</button> |
| 548 |
<a href="<?php echo esc_url($lightbox['url']); ?>"><?php echo wp_kses_post($lightbox['name']); ?></a> |
| 549 |
(<?php echo wp_kses_post($lightbox['size']); ?>) |
| 550 |
<strong>License</strong> – <?php echo wp_kses_post($lightbox['license']); ?> |
| 551 |
<?php |
| 552 |
if (!empty($lightbox['notes'])) { |
| 553 |
?> |
| 554 |
; <?php echo wp_kses_post($lightbox['notes']); ?> |
| 555 |
<?php |
| 556 |
} |
| 557 |
?> |
| 558 |
</li> |
| 559 |
<?php |
| 560 |
} |
| 561 |
?> |
| 562 |
</ul> |
| 563 |
</td> |
| 564 |
</tr> |
| 565 |
<script type="text/javascript"> |
| 566 |
document.addEventListener('DOMContentLoaded', function () { |
| 567 |
const lightboxes = <?php echo wp_kses_post($lightboxes_json); ?>; |
| 568 |
const checkboxes = document.querySelectorAll('#lightbox-features input'); |
| 569 |
let matches; |
| 570 |
checkboxes.forEach(function (checkbox) { |
| 571 |
checkbox.addEventListener('change', function () { |
| 572 |
photonicResetButtonsAndCheckboxes(false, false); |
| 573 |
const checked = document.querySelectorAll('#lightbox-features input:checked'); |
| 574 |
matches = []; |
| 575 |
let iterator = 0; |
| 576 |
checked.forEach(function (feature) { |
| 577 |
for (const [key, value] of Object.entries(lightboxes)) { |
| 578 |
if (iterator === 0 || matches.indexOf(key) >= 0) { |
| 579 |
const inArray = (matches.indexOf(key) >= 0); |
| 580 |
const supportList = value.supports; |
| 581 |
let found = false; |
| 582 |
for (let idx = 0; idx < supportList.length; idx++) { |
| 583 |
if (typeof supportList[idx] === 'string') { |
| 584 |
if (feature.value === supportList[idx]) { |
| 585 |
if (!inArray) { |
| 586 |
matches.push(key) |
| 587 |
} |
| 588 |
found = true; |
| 589 |
break; |
| 590 |
} |
| 591 |
} |
| 592 |
else { |
| 593 |
if (feature.value === supportList[idx].type) { |
| 594 |
if (!inArray) { |
| 595 |
matches.push(key); |
| 596 |
} |
| 597 |
found = true; |
| 598 |
break; |
| 599 |
} |
| 600 |
} |
| 601 |
} |
| 602 |
|
| 603 |
if (!found) { |
| 604 |
const pos = matches.indexOf(key); |
| 605 |
if (pos > -1) { |
| 606 |
matches.splice(pos, 1); |
| 607 |
} |
| 608 |
} |
| 609 |
} |
| 610 |
} |
| 611 |
iterator++; |
| 612 |
}); |
| 613 |
photonicShowLightboxMatches(checked, matches); |
| 614 |
}); |
| 615 |
}); |
| 616 |
|
| 617 |
const buttons = document.querySelectorAll('#lightbox-list button'); |
| 618 |
buttons.forEach(function (button) { |
| 619 |
button.addEventListener('click', function (e) { |
| 620 |
e.preventDefault(); |
| 621 |
photonicShowLightboxFeatures(button); |
| 622 |
}); |
| 623 |
}); |
| 624 |
|
| 625 |
function photonicShowLightboxMatches(checked, matches) { |
| 626 |
let all = document.querySelectorAll('#lightbox-list li'); |
| 627 |
all.forEach(function (line) { |
| 628 |
const lb = line.getAttribute('id').substr(12); |
| 629 |
line.classList.remove('matching'); |
| 630 |
line.classList.remove('not-matching'); |
| 631 |
if (checked.length > 0 && matches.indexOf(lb) > -1) { |
| 632 |
line.classList.add('matching'); |
| 633 |
} |
| 634 |
else if (checked.length > 0 && matches.indexOf(lb) < 0) { |
| 635 |
line.classList.add('not-matching'); |
| 636 |
} |
| 637 |
}); |
| 638 |
} |
| 639 |
|
| 640 |
function photonicShowLightboxFeatures(button) { |
| 641 |
const lightbox = button.getAttribute('id').substring('photonic-lb-button-'.length); |
| 642 |
if (lightboxes[lightbox]) { |
| 643 |
photonicResetButtonsAndCheckboxes(true, true); |
| 644 |
checkboxes.forEach(function (checkbox) { |
| 645 |
const li = checkbox.closest('li'); |
| 646 |
if (lightboxes[lightbox]['supports'].indexOf(checkbox.value) > -1) { |
| 647 |
li.classList.remove('photonic-not-supported'); |
| 648 |
li.classList.add('photonic-supported'); |
| 649 |
} |
| 650 |
else { |
| 651 |
li.classList.remove('photonic-supported'); |
| 652 |
li.classList.add('photonic-not-supported'); |
| 653 |
} |
| 654 |
}); |
| 655 |
|
| 656 |
button.closest('li').classList.add('lb-selected'); |
| 657 |
} |
| 658 |
} |
| 659 |
|
| 660 |
function photonicResetButtons(unmatch) { |
| 661 |
let remove = ['lb-selected']; |
| 662 |
if (unmatch) { |
| 663 |
remove = remove.concat(['matching', 'not-matching']); |
| 664 |
} |
| 665 |
buttons.forEach(function (button) { |
| 666 |
const li = button.closest('li'); |
| 667 |
remove.forEach(function (css) { |
| 668 |
li.classList.remove(css); |
| 669 |
}) |
| 670 |
}); |
| 671 |
} |
| 672 |
|
| 673 |
function photonicResetCheckboxes(uncheck) { |
| 674 |
checkboxes.forEach(function (checkbox) { |
| 675 |
if (uncheck) { |
| 676 |
checkbox.checked = false; |
| 677 |
} |
| 678 |
checkbox.closest('li').classList.remove('photonic-supported', 'photonic-not-supported'); |
| 679 |
}); |
| 680 |
} |
| 681 |
|
| 682 |
function photonicResetButtonsAndCheckboxes(unmatch, uncheck) { |
| 683 |
photonicResetButtons(unmatch); |
| 684 |
photonicResetCheckboxes(uncheck); |
| 685 |
} |
| 686 |
}); |
| 687 |
</script> |
| 688 |
</table> |
| 689 |
</div> |
| 690 |
<?php |
| 691 |
} |
| 692 |
|
| 693 |
private function secret_menu() { |
| 694 |
?> |
| 695 |
<div id="photonic-start-secret" class="photonic-start-panel"> |
| 696 |
<h2 class="photonic-section">The Secret Menu</h2> |
| 697 |
<p> |
| 698 |
While the shortcode generator for Photonic is fairly comprehensive, there are some additional hidden |
| 699 |
shortcode parameters that you can use. These are baked into the |
| 700 |
interactive shortcode builder / Photonic block for Gutenberg, but will not show up in the traditional |
| 701 |
shortcode interface: |
| 702 |
</p> |
| 703 |
<ol> |
| 704 |
<li><code>title_position</code> – Takes values <code>none</code>, <code>regular</code>, <code>tooltip</code>, |
| 705 |
<code>below</code>, <code>hover-slideup-show</code> and <code>slideup-stick</code>. It overrides the |
| 706 |
title positioning that you have set for that particular provider through your options. |
| 707 |
</li> |
| 708 |
<li><code>headers</code> – Takes a comma-separated list containing none or more of |
| 709 |
<code>thumbnail</code>, <code>title</code>, and <code>counter</code>. |
| 710 |
If a value is specified, that particular component will be shown in the level 2 entity's (i.e. album |
| 711 |
/ gallery / set) header, regardless of the back-end options. |
| 712 |
So, setting <code>headers='title,counter'</code> for a particular call to display a Zenfolio set, |
| 713 |
will show the title and photo-count for that set in the header, and not its thumbnail. |
| 714 |
</li> |
| 715 |
<li><code>fx</code> – Applicable to slideshow layouts. Takes values <code>fade</code> and <code>slide</code> |
| 716 |
to provide the transitioning effect between slides. |
| 717 |
</li> |
| 718 |
<li><code>speed</code> – Applicable to slideshow layouts. Takes numeric values in milliseconds, |
| 719 |
determines the speed of transitioning of slides. |
| 720 |
</li> |
| 721 |
<li><code>timeout</code> – Applicable to slideshow layouts. Takes numeric values in milliseconds, |
| 722 |
determines the pause between two slides. |
| 723 |
</li> |
| 724 |
<li><code>pause</code> – Applicable to slideshow layouts. Takes values <code>0</code> (no pause) |
| 725 |
and <code>1</code> (pause), determines if the slideshow should pause upon hovering on it. |
| 726 |
</li> |
| 727 |
<li><code>controls</code> – Applicable to slideshow layouts. Takes values <code>show</code> and |
| 728 |
<code>hide</code>, and shows "Previous" and "Next" buttons on the slideshow. |
| 729 |
</li> |
| 730 |
<li><code>strip-style</code> – Applicable to slideshow layouts. Takes values <code>thumbs</code> |
| 731 |
and <code>button</code>. If set, and if the <code>layout</code> / <code>style</code> parameter is |
| 732 |
set to <code>strip-below</code>, <code>strip-above</code>, <code>strip-right</code>, it shows |
| 733 |
buttons <strong>below</strong> the slideshow. |
| 734 |
</li> |
| 735 |
<li><code>popup</code> – Takes values <code>show</code> and <code>hide</code>. If set, and if a |
| 736 |
level 2 thumbnail (i.e. an Album, Photoset or Gallery thumbnail) is being displayed, this setting |
| 737 |
overrides <em>Photonic → Settings → Generic Options → Overlaid Popup Panel → |
| 738 |
Enable Interim Popup for Album Thumbnails</em>. |
| 739 |
</li> |
| 740 |
</ol> |
| 741 |
</div> |
| 742 |
<?php |
| 743 |
} |
| 744 |
|
| 745 |
private function helper_shortcode() { |
| 746 |
?> |
| 747 |
<div id="photonic-start-helpers" class="photonic-start-panel"> |
| 748 |
<h2 class="photonic-section">The Helper Shortcode</h2> |
| 749 |
<p> |
| 750 |
There is a second utility shortcode present in the plugin, which displays the output of the helpers but |
| 751 |
<em>in the front-end</em>. |
| 752 |
</p> |
| 753 |
<ol> |
| 754 |
<li><strong>Short-code: </strong><code>photonic_helper</code></li> |
| 755 |
<li> |
| 756 |
<strong>Attributes: </strong> This primary attribute is <code>type</code>. Depending on the value of |
| 757 |
<code>type</code> other attributes can be passed: |
| 758 |
<ol> |
| 759 |
<li> |
| 760 |
<code>type='flickr'</code> - Additional attributes: |
| 761 |
<ol> |
| 762 |
<li><code>user='xxx'</code> - Passing the user name (i.e. from |
| 763 |
https://flickr.com/photos/xxx) will get the user_id for use in the Flickr shortcode |
| 764 |
</li> |
| 765 |
<li><code>group='yyy'</code> - Passing the group name will get the group_id for use in |
| 766 |
the Flickr shortcode |
| 767 |
</li> |
| 768 |
</ol> |
| 769 |
</li> |
| 770 |
<li> |
| 771 |
<code>type='google'</code> - Additional attributes: |
| 772 |
<ol> |
| 773 |
<li><code>album_type='self'</code> - Prints out the user's Google Photos albums in |
| 774 |
tabular form |
| 775 |
</li> |
| 776 |
<li><code>album_type='shared'</code> - Prints out the all Google Photos albums shared |
| 777 |
with and by the user in tabular form |
| 778 |
</li> |
| 779 |
</ol> |
| 780 |
</li> |
| 781 |
</ol> |
| 782 |
</li> |
| 783 |
</ol> |
| 784 |
</div> |
| 785 |
<?php |
| 786 |
} |
| 787 |
|
| 788 |
private function really_technical() { |
| 789 |
?> |
| 790 |
<div id="photonic-start-tech" class="photonic-start-panel"> |
| 791 |
<h2 class="photonic-section">The Really Technical Stuff</h2> |
| 792 |
<p> |
| 793 |
You are running PHP with the following details: |
| 794 |
</p> |
| 795 |
<table class="form-table photonic-form-table"> |
| 796 |
<tr> |
| 797 |
<th>PHP Version</th> |
| 798 |
<td><?php echo wp_kses_post(phpversion()); ?></td> |
| 799 |
</tr> |
| 800 |
<tr> |
| 801 |
<th>Loaded Extensions</th> |
| 802 |
<td><?php echo wp_kses_post(implode(', ', get_loaded_extensions())); ?></td> |
| 803 |
</tr> |
| 804 |
</table> |
| 805 |
</div> |
| 806 |
<?php |
| 807 |
} |
| 808 |
} |
| 809 |
|