PluginProbe
Photonic Gallery & Lightbox for Flickr, SmugMug & Others / 3.36
Photonic Gallery & Lightbox for Flickr, SmugMug & Others v3.36
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
← All changes | Options/Google.php +119 -115 2.413.36 View file →
@@ -1,173 +1,177 @@
1 1 <?php
2 +
2 3 namespace Photonic_Plugin\Options;
3 -use Photonic_Plugin\Core\Photonic;
4 +
4 5 use Photonic_Plugin\Core\Utilities;
5 6
6 7 class Google extends Option_Tab {
7 - private static $instance;
8 + private string $preface;
8 9
9 - private function __construct() {
10 + protected function __construct() {
11 + $this->preface = "<section class='notice notice-error'><strong>API Shutdown</strong><p>Google is making a change to its APIs, which make them unusable for browsing on the web. This will prevent Photonic from working after <strong>31st March 2025</strong>. Please switch to a different platform to avoid disruption.</p></section>";
10 12 $this->options = [
11 - ['name' => 'Google Photos settings',
12 - 'desc' => 'Control settings for Google Photos',
13 + [
14 + 'name' => 'Google Photos settings',
15 + 'desc' => 'Control settings for Google Photos',
16 + 'preface' => $this->preface,
13 17 'category' => 'google-settings',
14 - 'type' => 'section',],
18 + 'type' => 'section',
19 + ],
15 20
16 - /* ['name' => 'Use own Google Client ID?',
21 + /*
22 + ['name' => 'Use own Google Client ID?',
17 23 'desc' => "Photonic can perform authentication with its own Client ID. Select this option if you want to use your own Client ID instead.
18 24 Creating a Google Client ID can take at least 15-30 minutes, but can save you from potential API quota issues if too many people start using Photonic's ID.
19 25 <strong>Note that if you have already defined a Client ID and Secret below they will be used regardless of this option.</strong>
20 26 ",
21 - 'id' => "google_google_use_own_keys",
27 + 'id' => 'google_google_use_own_keys',
22 28 'grouping' => 'google-settings',
23 - 'type' => 'checkbox'],*/
29 + 'type' => 'checkbox'],
30 + */
24 31
25 - ['name' => 'Google Client ID',
26 - 'desc' => "Enter your Google Client ID. You can get / create one from Google's <a href='https://console.developers.google.com/apis/'>API Manager</a>.
32 + [
33 + 'name' => 'Google Client ID',
34 + 'desc' => "Enter your Google Client ID. You can get / create one from Google's <a href='https://console.developers.google.com/apis/'>API Manager</a>.
27 35 The <a href='https://aquoid.com/plugins/photonic/google-photos/#api-key'>documentation page</a> can help you with further instructions.
28 - If you have previously obtained a Client ID for Picasa you can use that here, provided you follow the additional instructions in the documentation.
29 36 <ol>
30 37 <li>Use the option for 'OAuth Client ID', and subsequently pick 'Web applications'.</li>
31 38 <li>Make sure that you add these as your Redirect URIs:
32 39 <ol>
33 40 <li>" . site_url() . "</li>
34 - <li>" . admin_url('admin.php?page=photonic-auth&source=google') . "</li>
41 + <li>" . esc_url(admin_url('admin.php?page=photonic-auth&source=google')) . "</li>
35 42 </ol>
36 43 <strong>Without the above your authentication will not work.</strong>
37 44 </li>
38 45 </ol>",
39 - 'id' => 'google_client_id',
46 + 'id' => 'google_client_id',
40 47 'grouping' => 'google-settings',
41 - 'type' => 'text'],
48 + 'type' => 'text'
49 + ],
42 50
43 - ['name' => 'Google Client Secret',
44 - 'desc' => "Enter your Google Client Secret.",
45 - 'id' => 'google_client_secret',
51 + [
52 + 'name' => 'Google Client Secret',
53 + 'desc' => "Enter your Google Client Secret.",
54 + 'id' => 'google_client_secret',
46 55 'grouping' => 'google-settings',
47 - 'type' => 'text'],
56 + 'type' => 'text'
57 + ],
48 58
49 - ['name' => 'Refresh Token (for Back-end / Server-side Authentication)',
50 - 'desc' => "To access any content in Google Photos you need to get a token. To get your token go to
59 + [
60 + 'name' => 'Refresh Token',
61 + 'desc' => "To access any content in Google Photos you need to get a token. To get your token go to
51 62 <em>Photonic &rarr; Authentication &rarr; Google Photos &rarr; Google Photos Refresh Token Getter</em>, and authenticate.",
52 - 'id' => 'google_refresh_token',
63 + 'id' => 'google_refresh_token',
53 64 'grouping' => 'google-settings',
54 - 'type' => 'text'],
65 + 'type' => 'text'
66 + ],
55 67
56 - ['name' => 'Media to show',
57 - 'desc' => 'You can choose to include photos as well as videos in your output. This can be overridden by the <code>media</code> parameter in the shortcode:',
58 - 'id' => 'google_media',
68 + [
69 + 'name' => 'Media to show',
70 + 'desc' => 'You can choose to include photos as well as videos in your output. This can be overridden by the <code>media</code> parameter in the shortcode:',
71 + 'id' => 'google_media',
59 72 'grouping' => 'google-settings',
60 - 'type' => 'select',
61 - 'options' => Utilities::media_options()],
73 + 'type' => 'select',
74 + 'options' => Utilities::media_options()
75 + ],
62 76
63 - ['name' => "Hide Photo Count in Album Title Display",
64 - 'desc' => "This will hide the number of photos in your Album's title.",
65 - 'id' => "google_hide_album_photo_count_display",
77 + [
78 + 'name' => "Hide Photo Count in Album Title Display",
79 + 'desc' => "This will hide the number of photos in your Album's title.",
80 + 'id' => 'google_hide_album_photo_count_display',
66 81 'grouping' => 'google-settings',
67 - 'type' => 'checkbox'],
82 + 'type' => 'checkbox'
83 + ],
68 84
69 - ['name' => "Photo titles and captions",
70 - 'desc' => "What do you want to show as the photo title in the tooltip and lightbox?",
71 - 'id' => "google_title_caption",
72 - 'grouping' => "google-settings",
73 - 'type' => 'select',
74 - 'options' => [
75 - 'none' => esc_html__('No title / caption / description', 'photonic'),
85 + [
86 + 'name' => "Photo titles and captions for the galleries / slideshows",
87 + 'desc' => "What do you want to show as the photo title in the gallery / slideshow? This is used for the tooltips and title displays.",
88 + 'id' => 'google_title_caption',
89 + 'grouping' => 'google-settings',
90 + 'type' => 'select',
91 + 'options' => [
92 + 'none' => esc_html__('No title / caption / description', 'photonic'),
76 93 'title' => esc_html__('Always use the photo title, even if blank', 'photonic'),
77 - ]],
94 + ]
95 + ],
78 96
79 - ['name' => "Chain queries",
80 - 'desc' => "When you use Photonic to display a selected list of albums, Photonic will only display the matches from the first page of results. Select this option to let it display albums from later pages.",
81 - 'id' => "google_chain_queries",
97 + [
98 + 'name' => "Chain queries",
99 + 'desc' => "When you use Photonic to display a selected list of albums, Photonic will only display the matches from the first page of results. Select this option to let it display albums from later pages.",
100 + 'id' => 'google_chain_queries',
82 101 'grouping' => 'google-settings',
83 - 'type' => 'checkbox'],
102 + 'type' => 'checkbox'
103 + ],
84 104
85 - ['name' => "Photos (Main Page)",
86 - 'desc' => "Control settings for photos from Google Photos when displayed in your page",
105 + $this->get_layout_engine_options('google_layout_engine', 'google-settings'),
106 +
107 + [
108 + 'name' => "Photos (Main Page)",
109 + 'preface' => $this->preface,
110 + 'desc' => "Control settings for photos from Google Photos when displayed in your page",
87 111 'category' => 'google-photos',
88 - 'type' => 'section',],
112 + 'type' => 'section',
113 + ],
89 114
90 - ['name' => "What is this section?",
91 - 'desc' => "Options in this section are in effect when you use the shortcode format <code>[gallery type='google' view='photos']</code>. In other words, the photos are printed directly on the page.",
115 + [
116 + 'name' => "What is this section?",
117 + 'desc' => "Options in this section are in effect when you use the shortcode format <code>[gallery type='google' view='photos']</code>. In other words, the photos are printed directly on the page.",
92 118 'grouping' => 'google-photos',
93 - 'type' => "blurb",],
119 + 'type' => "blurb",
120 + ],
94 121
95 - ['name' => "Photo Title Display",
96 - 'desc' => "How do you want the title of the photos?",
97 - 'id' => "google_photo_title_display",
122 + [
123 + 'name' => "Photo Title Display",
124 + 'desc' => "How do you want the title of the photos?",
125 + 'id' => 'google_photo_title_display',
98 126 'grouping' => 'google-photos',
99 - 'type' => 'radio',
100 - 'options' => $this->title_styles()],
127 + 'type' => 'radio',
128 + 'options' => $this->title_styles()
129 + ],
101 130
102 - ['name' => "Constrain Photos Per Row",
103 - 'desc' => "How do you want the control the number of photo thumbnails per row by default? This can be overridden by adding the '<code>columns</code>' parameter to the '<code>gallery</code>' shortcode.",
104 - 'id' => "google_photos_per_row_constraint",
131 + [
132 + 'name' => "Constrain Photos Per Row",
133 + 'desc' => "How do you want the control the number of photo thumbnails per row by default? This can be overridden by adding the '<code>columns</code>' parameter to the '<code>gallery</code>' shortcode.",
134 + 'id' => 'google_photos_per_row_constraint',
105 135 'grouping' => 'google-photos',
106 - 'type' => 'select',
107 - 'options' => ["padding" => "Fix the padding around the thumbnails",
108 - "count" => "Fix the number of thumbnails per row",
109 - ]],
136 + 'type' => 'select',
137 + 'options' => [
138 + 'padding' => 'Automatically calculate thumbnails per row',
139 + 'count' => 'Fix the number of thumbnails per row',
140 + ]
141 + ],
110 142
111 - ['name' => "Constrain by padding",
112 - 'desc' => " If you have constrained by padding above, enter the number of pixels here to pad the thumbs by",
113 - 'id' => "google_photos_constrain_by_padding",
143 + [
144 + 'name' => "Fixed number of thumbnails",
145 + 'desc' => " If you have fixed the number of thumbnails per row above, enter the number of thumbnails",
146 + 'id' => 'google_photos_constrain_by_count',
114 147 'grouping' => 'google-photos',
115 - 'type' => 'text',
116 - 'hint' => "Enter the number of pixels here (don't enter 'px'). Non-integers will be ignored."],
148 + 'type' => 'select',
149 + 'options' => $this->selection_range(1, 10)
150 + ],
117 151
118 - ['name' => "Constrain by number of thumbnails",
119 - 'desc' => " If you have constrained by number of thumbnails per row above, enter the number of thumbnails",
120 - 'id' => "google_photos_constrain_by_count",
121 - 'grouping' => 'google-photos',
122 - 'type' => 'select',
123 - 'options' => $this->selection_range(1, 25)],
124 -
125 - ['name' => "Photos (Overlaid Popup Panel)",
126 - 'desc' => "Control settings for photos from Google Photos when displayed in a popup",
152 + [
153 + 'name' => "Photos (Overlaid Popup Panel)",
154 + 'preface' => $this->preface,
155 + 'desc' => "Control settings for photos from Google Photos when displayed in a popup",
127 156 'category' => 'google-photos-pop',
128 - 'type' => 'section',],
157 + 'type' => 'section',
158 + ],
129 159
130 - ['name' => "What is this section?",
131 - 'desc' => "Options in this section are in effect when you use the shortcode format <code>[gallery type='google' view='albums']</code>, then click on an album to show an overlaid panel. In other words, the photos are printed directly in the overlaid panel.",
160 + [
161 + 'name' => "What is this section?",
162 + 'desc' => "Options in this section are in effect when you use the shortcode format <code>[gallery type='google' view='albums']</code>, then click on an album to show an overlaid panel. In other words, the photos are printed directly in the overlaid panel.",
132 163 'grouping' => 'google-photos-pop',
133 - 'type' => "blurb",],
164 + 'type' => "blurb",
165 + ],
134 166
135 - ['name' => "Photo Title Display",
136 - 'desc' => "How do you want the title of the photos?",
137 - 'id' => "google_photo_pop_title_display",
167 + [
168 + 'name' => "Photo Title Display",
169 + 'desc' => "How do you want the title of the photos?",
170 + 'id' => 'google_photo_pop_title_display',
138 171 'grouping' => 'google-photos-pop',
139 - 'type' => 'radio',
140 - 'options' => $this->title_styles()],
141 -
142 - ['name' => "Constrain Photos Per Row",
143 - 'desc' => "How do you want the control the number of photo thumbnails per row by default? This can be overridden by adding the '<code>columns</code>' parameter to the '<code>gallery</code>' shortcode.",
144 - 'id' => "google_photos_pop_per_row_constraint",
145 - 'grouping' => 'google-photos-pop',
146 - 'type' => 'select',
147 - 'options' => ["padding" => "Fix the padding around the thumbnails",
148 - "count" => "Fix the number of thumbnails per row",
149 - ]],
150 -
151 - ['name' => "Constrain by padding",
152 - 'desc' => " If you have constrained by padding above, enter the number of pixels here to pad the thumbs by",
153 - 'id' => "google_photos_pop_constrain_by_padding",
154 - 'grouping' => 'google-photos-pop',
155 - 'type' => 'text',
156 - 'hint' => "Enter the number of pixels here (don't enter 'px'). Non-integers will be ignored."],
157 -
158 - ['name' => "Constrain by number of thumbnails",
159 - 'desc' => " If you have constrained by number of thumbnails per row above, enter the number of thumbnails",
160 - 'id' => "google_photos_pop_constrain_by_count",
161 - 'grouping' => 'google-photos-pop',
162 - 'type' => 'select',
163 - 'options' => $this->selection_range(1, 25)],
172 + 'type' => 'radio',
173 + 'options' => $this->title_styles()
174 + ],
164 175 ];
165 - }
166 -
167 - public static function get_instance() {
168 - if (self::$instance == null) {
169 - self::$instance = new Google();
170 - }
171 - return self::$instance;
172 176 }
173 177 }