| 1 |
<?php |
| 2 |
class Photonic_Helper_Page { |
| 3 |
function __construct() { |
| 4 |
} |
| 5 |
|
| 6 |
function render() { |
| 7 |
?> |
| 8 |
<h1>Photonic - Helpers</h1> |
| 9 |
<div class="photonic-wrap"> |
| 10 |
<div class="photonic-tabbed-options" style='position: relative; display: inline-block; '> |
| 11 |
<div class="photonic-waiting"><img src="<?php echo PHOTONIC_URL.'/include/images/downloading-dots.gif'; ?>" alt='waiting'/></div> |
| 12 |
<form method="post" id="photonic-helper-form"> |
| 13 |
<h2 class="photonic-helper-header">Flickr</h2> |
| 14 |
<div class="photonic-helper-box"> |
| 15 |
<?php $this->display_flickr_id_helper(); ?> |
| 16 |
</div> |
| 17 |
<div class="photonic-helper-box"> |
| 18 |
<?php $this->display_flickr_group_helper(); ?> |
| 19 |
</div> |
| 20 |
<h2 class="photonic-helper-header">Google Photos</h2> |
| 21 |
<div class="photonic-helper-box"> |
| 22 |
<?php $this->display_google_photos_album_helper(); ?> |
| 23 |
</div> |
| 24 |
|
| 25 |
<h2 class="photonic-helper-header">SmugMug</h2> |
| 26 |
<div class="photonic-helper-box"> |
| 27 |
<?php $this->display_smugmug_album_id_helper(); ?> |
| 28 |
</div> |
| 29 |
|
| 30 |
<h2 class="photonic-helper-header">Zenfolio</h2> |
| 31 |
<div class="photonic-helper-box"> |
| 32 |
<?php $this->display_zenfolio_category_helper(); ?> |
| 33 |
</div> |
| 34 |
|
| 35 |
<!-- <h2 class="photonic-helper-header">Instagram</h2> |
| 36 |
<div class="photonic-helper-box"> |
| 37 |
<?php /*$this->display_instagram_id_helper(); */?> |
| 38 |
</div> |
| 39 |
--> </form> |
| 40 |
</div> |
| 41 |
</div> |
| 42 |
<?php |
| 43 |
} |
| 44 |
|
| 45 |
function display_flickr_id_helper() { |
| 46 |
global $photonic_flickr_api_key; |
| 47 |
if (empty($photonic_flickr_api_key)) { |
| 48 |
echo sprintf(esc_html__('Please set up your Flickr API Key under %s', 'photonic'), '<em>Photonic → Settings → Flickr → Flickr Settings</em>'); |
| 49 |
} |
| 50 |
else { |
| 51 |
echo '<h4>'.esc_html__('Flickr User ID Finder', 'photonic').'</h4>'; |
| 52 |
echo '<label>'.esc_html__('Enter your Flickr photostream URL and click "Find"', 'photonic'); |
| 53 |
echo '<input type="text" value="https://www.flickr.com/photos/username/" id="photonic-flickr-user" name="photonic-flickr-user"/>'; |
| 54 |
echo '</label>'; |
| 55 |
echo '<input type="button" value="'.esc_attr__('Find', 'photonic').'" id="photonic-flickr-user-find" class="button button-primary"/>'; |
| 56 |
echo '<div class="result"> </div>'; |
| 57 |
} |
| 58 |
} |
| 59 |
|
| 60 |
function display_flickr_group_helper() { |
| 61 |
global $photonic_flickr_api_key; |
| 62 |
if (empty($photonic_flickr_api_key)) { |
| 63 |
echo sprintf(esc_html__('Please set up your Flickr API Key under %s', 'photonic'), '<em>Photonic → Settings → Flickr → Flickr Settings</em>'); |
| 64 |
} |
| 65 |
else { |
| 66 |
echo '<h4>'.esc_html__('Flickr Group ID Finder', 'photonic').'</h4>'; |
| 67 |
echo '<label>'.esc_html__('Enter your Flickr group URL and click "Find"', 'photonic'); |
| 68 |
echo '<input type="text" value="https://www.flickr.com/groups/groupname/" id="photonic-flickr-group" name="photonic-flickr-group"/>'; |
| 69 |
echo '</label>'; |
| 70 |
echo '<input type="button" value="'.esc_attr__('Find', 'photonic').'" id="photonic-flickr-group-find" class="button button-primary"/>'; |
| 71 |
echo '<div class="result"> </div>'; |
| 72 |
} |
| 73 |
} |
| 74 |
|
| 75 |
function display_google_photos_album_helper() { |
| 76 |
echo '<h4>'.esc_html__('Google Photos Album ID Finder', 'photonic').'</h4>'; |
| 77 |
global $photonic_google_client_id, $photonic_google_client_secret, $photonic_google_refresh_token, $photonic_google_use_own_keys; |
| 78 |
// if (!empty($photonic_google_use_own_keys) && (empty($photonic_google_client_id) || empty($photonic_google_client_secret))) { |
| 79 |
if (empty($photonic_google_client_id) || empty($photonic_google_client_secret)) { |
| 80 |
echo sprintf(esc_html__('Please set up your Google Client ID and Client Secret under %s', 'photonic'), |
| 81 |
'<em>Photonic → Settings → Google Photos → Google Photos Settings</em>'); |
| 82 |
} |
| 83 |
else if (empty($photonic_google_refresh_token)) { |
| 84 |
echo sprintf(esc_html__('Please obtain your Refresh Token and save it under %s', 'photonic'), |
| 85 |
'<em>Photonic → Settings → Google Photos → Google Photos Settings</em>'); |
| 86 |
} |
| 87 |
else { |
| 88 |
echo '<input type="button" value="'.esc_attr__('Find my albums', 'photonic').'" id="photonic-google-album-find" class="button button-primary"/>'; |
| 89 |
echo '<div class="result"> </div>'; |
| 90 |
} |
| 91 |
} |
| 92 |
|
| 93 |
function display_smugmug_album_id_helper() { |
| 94 |
global $photonic_smug_api_key; |
| 95 |
if (empty($photonic_smug_api_key)) { |
| 96 |
echo sprintf(esc_html__('Please set up your SmugMug API Key under %s', 'photonic'), '<em>Photonic → Settings → SmugMug → SmugMug Settings</em>'); |
| 97 |
} |
| 98 |
else { |
| 99 |
echo '<h4>'.esc_html__('SmugMug User Albums and Folders', 'photonic').'</h4>'; |
| 100 |
echo '<label>'.esc_html__('Enter your SmugMug username and click "Find"', 'photonic'); |
| 101 |
echo '<input type="text" value="username" id="photonic-smugmug-user" name="photonic-smugmug-user"/>'; |
| 102 |
echo '</label>'; |
| 103 |
echo '<input type="button" value="'.esc_attr__('Find', 'photonic').'" id="photonic-smugmug-user-tree" class="button button-primary"/>'; |
| 104 |
echo '<div class="result"> </div>'; |
| 105 |
} |
| 106 |
} |
| 107 |
|
| 108 |
function display_zenfolio_category_helper() { |
| 109 |
echo '<h4>'.esc_html__('Zenfolio Categories', 'photonic').'</h4>'; |
| 110 |
echo '<input type="button" value="'.esc_attr__('List', 'photonic').'" id="photonic-zenfolio-categories-find" class="button button-primary"/>'; |
| 111 |
echo '<div class="result"> </div>'; |
| 112 |
} |
| 113 |
|
| 114 |
function display_instagram_id_helper() { |
| 115 |
global $photonic_instagram_access_token; |
| 116 |
if (!isset($photonic_instagram_access_token)) { |
| 117 |
echo sprintf(esc_html__('Please set up your Instagram Access Token under %s', 'photonic'), |
| 118 |
'<em>Photonic → Settings → Instagram → Instagram Settings</em>')."\n"; |
| 119 |
} |
| 120 |
else { |
| 121 |
echo '<h4>'.esc_html__('Instagram ID Finder', 'photonic').'</h4>'; |
| 122 |
echo sprintf(esc_html__('Instagram has made it almost impossible to determine user ids using the API. %1$sThat being said, if you are authenticated your user id is not required: the authenticated user is used to show photos.%2$s However, if you are feeling adventurous, you can try the following steps:', 'photonic'), |
| 123 |
'<strong>', '</strong>')."<br/>\n"; |
| 124 |
echo "<ol>\n"; |
| 125 |
echo "<li>".esc_html__("Log into Instagram with your account on a browser like Chrome, Firefox or Edge", 'photonic')."</li>\n"; |
| 126 |
echo "<li>".esc_html__("Open the Developer tools and go to the Console tab", 'photonic')."</li>\n"; |
| 127 |
echo "<li>".sprintf(esc_html__('Type %s and hit "Enter"', 'photonic'), '<code>window._sharedData.config.viewer.id</code>')."</li>\n"; |
| 128 |
echo "<li>".esc_html__("Your id will show up", 'photonic')."</li>\n"; |
| 129 |
echo "</ol>\n"; |
| 130 |
} |
| 131 |
} |
| 132 |
} |
| 133 |
|