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