Featured Image From URL - Version 4.0.0

Version Description

  • FIFU Cloud: available for beta testers; enhancement: security (prevents CSRF attack); enhancement: Play Button > hide from grid (WordPress/WooCommerce); enhancement: Mute (desktop/mobile); deprecated: Related Videos.
Download this release

Release Info

Developer marceljm
Plugin Icon 128x128 Featured Image From URL
Version 4.0.0
Comparing to
See all releases

Code changes from version 3.9.9 to 4.0.0

admin/api.php CHANGED
@@ -1,8 +1,285 @@
1
  <?php
2
 
3
- define('FIFU_SU_ADDRESS', FIFU_CLOUD_DEBUG && fifu_is_local() ? 'http://0.0.0.0:8080' : 'https://cloud.featuredimagefromurl.com');
 
 
4
  define('FIFU_QUERY_ADDRESS', 'https://query.featuredimagefromurl.com');
5
  define('FIFU_SURVEY_ADDRESS', 'https://survey.featuredimagefromurl.com');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  function fifu_get_ip() {
8
  foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key) {
@@ -17,13 +294,340 @@ function fifu_get_ip() {
17
  return $_SERVER['REMOTE_ADDR'];
18
  }
19
 
20
- function fifu_is_local() {
21
- $query = 'http://localhost';
22
- return substr(get_home_url(), 0, strlen($query)) === $query;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  }
24
 
25
- function fifu_remote_post($endpoint, $array) {
26
- return fifu_is_local() ? wp_remote_post($endpoint, $array) : wp_safe_remote_post($endpoint, $array);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  }
28
 
29
  function fifu_api_query($dataset) {
@@ -84,6 +688,24 @@ function fifu_api_query($dataset) {
84
  }
85
  }
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  function fifu_enable_fake_api(WP_REST_Request $request) {
88
  update_option('fifu_fake_stop', false, 'no');
89
  fifu_enable_fake();
@@ -300,6 +922,72 @@ add_action('rest_api_init', function () {
300
  'callback' => 'fifu_rest_url',
301
  'permission_callback' => 'fifu_public_permission',
302
  ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
  });
304
 
305
  function fifu_get_private_data_permissions_check() {
1
  <?php
2
 
3
+ define('FIFU_TRY_AGAIN_LATER', json_encode(array('code' => 0, 'message' => 'try again later', 'color' => 'orange')));
4
+ define('FIFU_NO_CREDENTIALS', json_encode(array('code' => 'no_credentials')));
5
+ define('FIFU_SU_ADDRESS', FIFU_CLOUD_DEBUG && fifu_is_local() ? 'http://0.0.0.0:8080' : 'https://ws.fifu.app');
6
  define('FIFU_QUERY_ADDRESS', 'https://query.featuredimagefromurl.com');
7
  define('FIFU_SURVEY_ADDRESS', 'https://survey.featuredimagefromurl.com');
8
+ define('FIFU_CLIENT', 'featured-image-from-url');
9
+
10
+ function fifu_is_local() {
11
+ $query = 'http://localhost';
12
+ return substr(get_home_url(), 0, strlen($query)) === $query;
13
+ }
14
+
15
+ function fifu_remote_post($endpoint, $array) {
16
+ return fifu_is_local() ? wp_remote_post($endpoint, $array) : wp_safe_remote_post($endpoint, $array);
17
+ }
18
+
19
+ function fifu_api_sign_up(WP_REST_Request $request) {
20
+ $first_name = $request['first_name'];
21
+ $last_name = $request['last_name'];
22
+ $email = $request['email'];
23
+ $site = fifu_get_home_url();
24
+
25
+ fifu_cloud_log(['sign_up' => ['site' => $site]]);
26
+
27
+ $array = array(
28
+ 'headers' => array('Content-Type' => 'application/json; charset=utf-8'),
29
+ 'body' => json_encode(
30
+ array(
31
+ 'site' => $site,
32
+ 'first_name' => $first_name,
33
+ 'last_name' => $last_name,
34
+ 'email' => $email,
35
+ 'public_key' => fifu_create_keys($email),
36
+ 'slug' => FIFU_CLIENT,
37
+ 'version' => fifu_version_number()
38
+ )
39
+ ),
40
+ 'method' => 'POST',
41
+ 'data_format' => 'body',
42
+ 'blocking' => true,
43
+ 'timeout' => 120,
44
+ );
45
+ $response = fifu_remote_post(FIFU_SU_ADDRESS . '/sign-up/', $array);
46
+ if (is_wp_error($response) || $response['response']['code'] == 404) {
47
+ fifu_delete_credentials();
48
+ return json_decode(FIFU_TRY_AGAIN_LATER);
49
+ }
50
+
51
+ $json = json_decode($response['http_response']->get_response_object()->body);
52
+ if ($json->code <= 0)
53
+ fifu_delete_credentials();
54
+
55
+ $privKey = openssl_decrypt(base64_decode(get_option('fifu_su_privkey')[0]), "AES-128-ECB", $email . $site);
56
+ if ($privKey) {
57
+ openssl_private_decrypt(base64_decode($json->qrcode), $decrypted, $privKey);
58
+ $json->qrcode = $decrypted;
59
+ }
60
+
61
+ return $json;
62
+ }
63
+
64
+ function fifu_delete_credentials() {
65
+ delete_option('fifu_su_privkey');
66
+ delete_option('fifu_su_email');
67
+ delete_option('fifu_proxy_auth');
68
+ }
69
+
70
+ function fifu_api_login(WP_REST_Request $request) {
71
+ if (!fifu_su_sign_up_complete())
72
+ return json_decode(FIFU_NO_CREDENTIALS);
73
+
74
+ $email = $request['email'];
75
+ $site = fifu_get_home_url();
76
+ $tfa = $request['tfa'];
77
+ $ip = fifu_get_ip();
78
+ $time = time();
79
+ $signature = fifu_create_signature($site . $email . $time . $ip . $tfa);
80
+
81
+ fifu_cloud_log(['login' => ['site' => $site]]);
82
+
83
+ $array = array(
84
+ 'headers' => array('Content-Type' => 'application/json; charset=utf-8'),
85
+ 'body' => json_encode(
86
+ array(
87
+ 'site' => $site,
88
+ 'email' => $email,
89
+ 'signature' => $signature,
90
+ 'time' => $time,
91
+ 'ip' => $ip,
92
+ 'proxy_auth' => get_option('fifu_proxy_auth') ? true : false,
93
+ 'slug' => FIFU_CLIENT,
94
+ 'version' => fifu_version_number()
95
+ )
96
+ ),
97
+ 'method' => 'POST',
98
+ 'data_format' => 'body',
99
+ 'blocking' => true,
100
+ 'timeout' => 30,
101
+ );
102
+ $response = fifu_remote_post(FIFU_SU_ADDRESS . '/login/', $array);
103
+ if (is_wp_error($response))
104
+ return json_decode(FIFU_TRY_AGAIN_LATER);
105
+
106
+ $json = json_decode($response['http_response']->get_response_object()->body);
107
+ $json->fifu_tfa_hash = hash('sha512', $tfa);
108
+
109
+ if (isset($json->proxy_key)) {
110
+ $privKey = openssl_decrypt(base64_decode(get_option('fifu_su_privkey')[0]), "AES-128-ECB", $email . $site);
111
+ if ($privKey) {
112
+ openssl_private_decrypt(base64_decode($json->proxy_key), $key, $privKey);
113
+ openssl_private_decrypt(base64_decode($json->proxy_salt), $salt, $privKey);
114
+ update_option('fifu_proxy_auth', array($key, $salt));
115
+ }
116
+ }
117
+
118
+ return $json;
119
+ }
120
+
121
+ function fifu_api_logout(WP_REST_Request $request) {
122
+ if (!fifu_su_sign_up_complete())
123
+ return json_decode(FIFU_NO_CREDENTIALS);
124
+
125
+ $email = fifu_su_get_email();
126
+ $site = fifu_get_home_url();
127
+ $tfa = $request['tfa'];
128
+ $ip = fifu_get_ip();
129
+ $time = time();
130
+ $signature = fifu_create_signature($site . $email . $time . $ip . $tfa);
131
+
132
+ fifu_cloud_log(['logout' => ['site' => $site]]);
133
+
134
+ $array = array(
135
+ 'headers' => array('Content-Type' => 'application/json; charset=utf-8'),
136
+ 'body' => json_encode(
137
+ array(
138
+ 'site' => $site,
139
+ 'email' => $email,
140
+ 'signature' => $signature,
141
+ 'time' => $time,
142
+ 'ip' => $ip,
143
+ 'slug' => FIFU_CLIENT,
144
+ 'version' => fifu_version_number()
145
+ )
146
+ ),
147
+ 'method' => 'POST',
148
+ 'data_format' => 'body',
149
+ 'blocking' => true,
150
+ 'timeout' => 30,
151
+ );
152
+ $response = fifu_remote_post(FIFU_SU_ADDRESS . '/logout/', $array);
153
+ if (is_wp_error($response))
154
+ return json_decode(FIFU_TRY_AGAIN_LATER);
155
+
156
+ $json = json_decode($response['http_response']->get_response_object()->body);
157
+ if ($json->code == 8)
158
+ setcookie('fifu-tfa', '');
159
+
160
+ return $json;
161
+ }
162
+
163
+ function fifu_api_cancel(WP_REST_Request $request) {
164
+ if (!fifu_su_sign_up_complete())
165
+ return json_decode(FIFU_NO_CREDENTIALS);
166
+
167
+ $site = fifu_get_home_url();
168
+ $tfa = $request['tfa'];
169
+ $ip = fifu_get_ip();
170
+ $time = time();
171
+ $signature = fifu_create_signature($site . $time . $ip . $tfa);
172
+
173
+ fifu_cloud_log(['cancel' => ['site' => $site]]);
174
+
175
+ $array = array(
176
+ 'headers' => array('Content-Type' => 'application/json; charset=utf-8'),
177
+ 'body' => json_encode(
178
+ array(
179
+ 'site' => $site,
180
+ 'signature' => $signature,
181
+ 'time' => $time,
182
+ 'ip' => $ip,
183
+ 'slug' => FIFU_CLIENT,
184
+ 'version' => fifu_version_number()
185
+ )
186
+ ),
187
+ 'method' => 'POST',
188
+ 'data_format' => 'body',
189
+ 'blocking' => true,
190
+ 'timeout' => 30,
191
+ );
192
+ $response = fifu_remote_post(FIFU_SU_ADDRESS . '/cancel/', $array);
193
+ if (is_wp_error($response))
194
+ return json_decode(FIFU_TRY_AGAIN_LATER);
195
+
196
+ $json = json_decode($response['http_response']->get_response_object()->body);
197
+
198
+ return $json;
199
+ }
200
+
201
+ function fifu_api_payment_info(WP_REST_Request $request) {
202
+ if (!fifu_su_sign_up_complete())
203
+ return json_decode(FIFU_NO_CREDENTIALS);
204
+
205
+ $site = fifu_get_home_url();
206
+ $tfa = $request['tfa'];
207
+ $ip = fifu_get_ip();
208
+ $time = time();
209
+ $signature = fifu_create_signature($site . $time . $ip . $tfa);
210
+
211
+ fifu_cloud_log(['payment_info' => ['site' => $site]]);
212
+
213
+ $array = array(
214
+ 'headers' => array('Content-Type' => 'application/json; charset=utf-8'),
215
+ 'body' => json_encode(
216
+ array(
217
+ 'site' => $site,
218
+ 'signature' => $signature,
219
+ 'time' => $time,
220
+ 'ip' => $ip,
221
+ 'slug' => FIFU_CLIENT,
222
+ 'version' => fifu_version_number()
223
+ )
224
+ ),
225
+ 'method' => 'POST',
226
+ 'data_format' => 'body',
227
+ 'blocking' => true,
228
+ 'timeout' => 30,
229
+ );
230
+ $response = fifu_remote_post(FIFU_SU_ADDRESS . '/payment-info/', $array);
231
+ if (is_wp_error($response))
232
+ return json_decode(FIFU_TRY_AGAIN_LATER);
233
+
234
+ $json = json_decode($response['http_response']->get_response_object()->body);
235
+
236
+ return $json;
237
+ }
238
+
239
+ function fifu_api_connected(WP_REST_Request $request) {
240
+ if (!fifu_su_sign_up_complete())
241
+ return json_decode(FIFU_NO_CREDENTIALS);
242
+
243
+ $email = fifu_su_get_email();
244
+ $site = fifu_get_home_url();
245
+ $tfa = $request['tfa'];
246
+ $ip = fifu_get_ip();
247
+ $time = time();
248
+ $signature = fifu_create_signature($site . $email . $time . $ip . $tfa);
249
+
250
+ fifu_cloud_log(['connected' => ['site' => $site]]);
251
+
252
+ $array = array(
253
+ 'headers' => array('Content-Type' => 'application/json; charset=utf-8'),
254
+ 'body' => json_encode(
255
+ array(
256
+ 'site' => $site,
257
+ 'email' => $email,
258
+ 'signature' => $signature,
259
+ 'time' => $time,
260
+ 'ip' => $ip,
261
+ 'slug' => FIFU_CLIENT,
262
+ 'version' => fifu_version_number()
263
+ )
264
+ ),
265
+ 'method' => 'POST',
266
+ 'data_format' => 'body',
267
+ 'blocking' => true,
268
+ 'timeout' => 30,
269
+ );
270
+ $response = fifu_remote_post(FIFU_SU_ADDRESS . '/connected/', $array);
271
+ if (is_wp_error($response))
272
+ return json_decode(FIFU_TRY_AGAIN_LATER);
273
+
274
+ // offline
275
+ if ($response['http_response']->get_response_object()->status_code == 404)
276
+ return json_decode(FIFU_TRY_AGAIN_LATER);
277
+
278
+ // enable lazy load
279
+ update_option('fifu_lazy', 'toggleon');
280
+
281
+ return json_decode($response['http_response']->get_response_object()->body);
282
+ }
283
 
284
  function fifu_get_ip() {
285
  foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key) {
294
  return $_SERVER['REMOTE_ADDR'];
295
  }
296
 
297
+ function fifu_api_create_thumbnails_list(WP_REST_Request $request) {
298
+ if (!fifu_su_sign_up_complete())
299
+ return json_decode(FIFU_NO_CREDENTIALS);
300
+
301
+ $rows = array();
302
+ $images = $request['selected'];
303
+ $tfa = $request['tfa'];
304
+ $total = count($images);
305
+ $url_sign = '';
306
+ foreach ($images as $image) {
307
+ $post_id = $image[0];
308
+ $url = $image[1];
309
+ $meta_key = $image[2];
310
+ $meta_id = $image[3];
311
+ $is_category = $image[4] == 1;
312
+ $video_url = $image[5];
313
+
314
+ if (!$url || !$post_id)
315
+ continue;
316
+
317
+ $encoded_url = base64_encode($url);
318
+ $encoded_video_url = $video_url ? base64_encode($video_url) : '';
319
+ array_push($rows, array($post_id, $encoded_url, $meta_key, $meta_id, $is_category, $encoded_video_url));
320
+ $url_sign .= substr($encoded_url, -10);
321
+
322
+ fifu_cloud_log(['create_thumbnails_list' => ['post_id' => $post_id, 'meta_key' => $meta_key, 'meta_id' => $meta_id, 'is_category' => $is_category, 'video_url' => $video_url, 'url' => $url]]);
323
+ }
324
+ $time = time();
325
+ $ip = fifu_get_ip();
326
+ $site = fifu_get_home_url();
327
+ $signature = fifu_create_signature($url_sign . $site . $time . $ip . $tfa);
328
+ $array = array(
329
+ 'headers' => array('Content-Type' => 'application/json; charset=utf-8'),
330
+ 'body' => json_encode(
331
+ array(
332
+ 'rows' => $rows,
333
+ 'site' => $site,
334
+ 'signature' => $signature,
335
+ 'time' => $time,
336
+ 'ip' => $ip,
337
+ 'slug' => FIFU_CLIENT,
338
+ 'version' => fifu_version_number()
339
+ )
340
+ ),
341
+ 'method' => 'POST',
342
+ 'data_format' => 'body',
343
+ 'blocking' => true,
344
+ 'timeout' => 60,
345
+ );
346
+ $response = fifu_remote_post(FIFU_SU_ADDRESS . '/create-thumbnails/', $array);
347
+ if (is_wp_error($response))
348
+ return;
349
+
350
+ $json = json_decode($response['http_response']->get_response_object()->body);
351
+ $code = $json->code;
352
+ if ($code && $code > 0) {
353
+ if (count((array) $json->thumbnails) > 0) {
354
+ $category_images = array();
355
+ $post_images = array();
356
+ foreach ((array) $json->thumbnails as $thumbnail) {
357
+ if ($thumbnail->is_category)
358
+ array_push($category_images, $thumbnail);
359
+ else
360
+ array_push($post_images, $thumbnail);
361
+ }
362
+ if (count($category_images) > 0)
363
+ fifu_ctgr_add_urls_su($json->bucket_id, $category_images);
364
+
365
+ if (count($post_images) > 0)
366
+ fifu_add_urls_su($json->bucket_id, $post_images);
367
+ }
368
+ }
369
+
370
+ return $json;
371
  }
372
 
373
+ function fifu_api_delete(WP_REST_Request $request) {
374
+ if (!fifu_su_sign_up_complete())
375
+ return json_decode(FIFU_NO_CREDENTIALS);
376
+
377
+ $rows = array();
378
+ $images = $request['selected'];
379
+ $tfa = $request['tfa'];
380
+ $total = count($images);
381
+ $url_sign = '';
382
+ foreach ($images as $image) {
383
+ $storage_id = $image['storage_id'];
384
+ if (!$storage_id)
385
+ continue;
386
+
387
+ array_push($rows, $storage_id);
388
+ $url_sign .= $storage_id;
389
+ }
390
+ $time = time();
391
+ $ip = fifu_get_ip();
392
+ $site = fifu_get_home_url();
393
+ $signature = fifu_create_signature($url_sign . $site . $time . $ip . $tfa);
394
+
395
+ fifu_cloud_log(['delete' => ['rows' => $rows]]);
396
+
397
+ $array = array(
398
+ 'headers' => array('Content-Type' => 'application/json; charset=utf-8'),
399
+ 'body' => json_encode(
400
+ array(
401
+ 'rows' => $rows,
402
+ 'site' => $site,
403
+ 'signature' => $signature,
404
+ 'time' => $time,
405
+ 'ip' => $ip,
406
+ 'slug' => FIFU_CLIENT,
407
+ 'version' => fifu_version_number()
408
+ )
409
+ ),
410
+ 'method' => 'POST',
411
+ 'data_format' => 'body',
412
+ 'blocking' => true,
413
+ 'timeout' => 60,
414
+ );
415
+ $response = fifu_remote_post(FIFU_SU_ADDRESS . '/delete/', $array);
416
+ if (is_wp_error($response))
417
+ return json_decode(FIFU_TRY_AGAIN_LATER);
418
+
419
+ $json = json_decode($response['http_response']->get_response_object()->body);
420
+ if (!$json)
421
+ return null;
422
+
423
+ $code = $json->code;
424
+ if ($code && $code > 0) {
425
+ if (count((array) $json->urls) > 0) {
426
+ $map = array();
427
+ $posts = fifu_get_posts_su($rows);
428
+ foreach ($posts as $post)
429
+ $map[$post->storage_id] = $post;
430
+
431
+ $category_images = array();
432
+ $post_images = array();
433
+ foreach ($posts as $post) {
434
+ if ($post->category)
435
+ array_push($category_images, $post);
436
+ else
437
+ array_push($post_images, $post);
438
+ }
439
+
440
+ if (count($post_images) > 0)
441
+ fifu_remove_urls_su($json->bucket_id, $post_images, (array) $json->urls, (array) $json->video_urls);
442
+
443
+ if (count($category_images) > 0)
444
+ fifu_ctgr_remove_urls_su($json->bucket_id, $category_images, (array) $json->urls, (array) $json->video_urls);
445
+
446
+ return fifu_api_confirm_delete($rows, $site, $ip, $tfa, $url_sign);
447
+ }
448
+ }
449
+
450
+ return $json;
451
+ }
452
+
453
+ function fifu_api_confirm_delete($rows, $site, $ip, $tfa, $url_sign) {
454
+ if (!fifu_su_sign_up_complete())
455
+ return json_decode(FIFU_NO_CREDENTIALS);
456
+
457
+ $time = time();
458
+ $signature = fifu_create_signature($url_sign . $site . $time . $ip . $tfa);
459
+
460
+ fifu_cloud_log(['confirm_delete' => ['rows' => $rows]]);
461
+
462
+ $array = array(
463
+ 'headers' => array('Content-Type' => 'application/json; charset=utf-8'),
464
+ 'body' => json_encode(
465
+ array(
466
+ 'rows' => $rows,
467
+ 'site' => $site,
468
+ 'signature' => $signature,
469
+ 'time' => $time,
470
+ 'ip' => $ip,
471
+ 'slug' => FIFU_CLIENT,
472
+ 'version' => fifu_version_number()
473
+ )
474
+ ),
475
+ 'method' => 'POST',
476
+ 'data_format' => 'body',
477
+ 'blocking' => true,
478
+ 'timeout' => 300,
479
+ );
480
+ $response = fifu_remote_post(FIFU_SU_ADDRESS . '/confirm-delete/', $array);
481
+ if (is_wp_error($response))
482
+ return json_decode(FIFU_TRY_AGAIN_LATER);
483
+
484
+ $json = json_decode($response['http_response']->get_response_object()->body);
485
+ return $json;
486
+ }
487
+
488
+ function fifu_api_reset_credentials(WP_REST_Request $request) {
489
+ fifu_delete_credentials();
490
+ $email = $request['email'];
491
+ $site = fifu_get_home_url();
492
+
493
+ fifu_cloud_log(['reset_credentials' => ['site' => $site]]);
494
+
495
+ $array = array(
496
+ 'headers' => array('Content-Type' => 'application/json; charset=utf-8'),
497
+ 'body' => json_encode(
498
+ array(
499
+ 'site' => $site,
500
+ 'email' => $email,
501
+ 'public_key' => fifu_create_keys($email),
502
+ 'slug' => FIFU_CLIENT,
503
+ 'version' => fifu_version_number()
504
+ )
505
+ ),
506
+ 'method' => 'POST',
507
+ 'data_format' => 'body',
508
+ 'blocking' => true,
509
+ 'timeout' => 30,
510
+ );
511
+ $response = fifu_remote_post(FIFU_SU_ADDRESS . '/reset-credentials/', $array);
512
+ if (is_wp_error($response))
513
+ return json_decode(FIFU_TRY_AGAIN_LATER);
514
+ else {
515
+ $json = json_decode($response['http_response']->get_response_object()->body);
516
+ $privKey = openssl_decrypt(base64_decode(get_option('fifu_su_privkey')[0]), "AES-128-ECB", $email . $site);
517
+ if (isset($json->qrcode)) {
518
+ openssl_private_decrypt(base64_decode($json->qrcode), $decrypted, $privKey);
519
+ $json->qrcode = $decrypted;
520
+ }
521
+
522
+ # unknown site
523
+ if ($json->code == -21)
524
+ fifu_delete_credentials();
525
+
526
+ return $json;
527
+ }
528
+ }
529
+
530
+ function fifu_api_list_all_su(WP_REST_Request $request) {
531
+ if (!fifu_su_sign_up_complete())
532
+ return json_decode(FIFU_NO_CREDENTIALS);
533
+
534
+ $time = time();
535
+ $site = fifu_get_home_url();
536
+ $tfa = $request['tfa'];
537
+ $page = (int) $request['page'];
538
+ $ip = fifu_get_ip();
539
+ $signature = fifu_create_signature($site . $time . $ip . $tfa);
540
+
541
+ fifu_cloud_log(['list_all_su' => ['site' => $site, 'page' => $page]]);
542
+
543
+ $array = array(
544
+ 'headers' => array('Content-Type' => 'application/json; charset=utf-8'),
545
+ 'body' => json_encode(
546
+ array(
547
+ 'site' => $site,
548
+ 'signature' => $signature,
549
+ 'time' => $time,
550
+ 'ip' => $ip,
551
+ 'page' => $page,
552
+ 'slug' => FIFU_CLIENT,
553
+ 'version' => fifu_version_number()
554
+ )
555
+ ),
556
+ 'method' => 'POST',
557
+ 'data_format' => 'body',
558
+ 'blocking' => true,
559
+ 'timeout' => 30,
560
+ );
561
+ $response = fifu_remote_post(FIFU_SU_ADDRESS . '/list-all/', $array);
562
+ if (is_wp_error($response))
563
+ return json_decode(FIFU_TRY_AGAIN_LATER);
564
+
565
+ // offline
566
+ if ($response['http_response']->get_response_object()->status_code == 404)
567
+ return json_decode(FIFU_TRY_AGAIN_LATER);
568
+
569
+ $map = array();
570
+ $posts = fifu_get_posts_su(null);
571
+ foreach ($posts as $post)
572
+ $map[$post->storage_id] = $post;
573
+
574
+ $json = json_decode($response['http_response']->get_response_object()->body);
575
+ if ($json && $json->code > 0) {
576
+ for ($i = 0; $i < count($json->photo_data); $i++) {
577
+ $post = $json->photo_data[$i];
578
+ if (isset($map[$post->storage_id])) {
579
+ $post->title = $map[$post->storage_id]->post_title;
580
+ $post->meta_id = $map[$post->storage_id]->meta_id;
581
+ $post->post_id = $map[$post->storage_id]->post_id;
582
+ $post->meta_key = $map[$post->storage_id]->meta_key;
583
+ } else
584
+ $post->title = $post->meta_id = $post->post_id = $post->meta_key = '';
585
+ $is_video = strpos($post->meta_key, 'video') !== false;
586
+ $post->proxy_url = fifu_speedup_get_signed_url(null, 128, 128, $json->bucket_id, $post->storage_id, $is_video);
587
+ }
588
+ }
589
+ return $json;
590
+ }
591
+
592
+ function fifu_api_list_daily_count(WP_REST_Request $request) {
593
+ if (!fifu_su_sign_up_complete())
594
+ return json_decode(FIFU_NO_CREDENTIALS);
595
+
596
+ $time = time();
597
+ $site = fifu_get_home_url();
598
+ $tfa = $request['tfa'];
599
+ $ip = fifu_get_ip();
600
+ $signature = fifu_create_signature($site . $time . $ip . $tfa);
601
+
602
+ fifu_cloud_log(['list_daily_count' => ['site' => $site]]);
603
+
604
+ $array = array(
605
+ 'headers' => array('Content-Type' => 'application/json; charset=utf-8'),
606
+ 'body' => json_encode(
607
+ array(
608
+ 'site' => $site,
609
+ 'signature' => $signature,
610
+ 'time' => $time,
611
+ 'ip' => $ip,
612
+ 'slug' => FIFU_CLIENT,
613
+ 'version' => fifu_version_number()
614
+ )
615
+ ),
616
+ 'method' => 'POST',
617
+ 'data_format' => 'body',
618
+ 'blocking' => true,
619
+ 'timeout' => 30,
620
+ );
621
+ $response = fifu_remote_post(FIFU_SU_ADDRESS . '/list-daily-count/', $array);
622
+ if (is_wp_error($response))
623
+ return json_decode(FIFU_TRY_AGAIN_LATER);
624
+
625
+ // offline
626
+ if ($response['http_response']->get_response_object()->status_code == 404)
627
+ return json_decode(FIFU_TRY_AGAIN_LATER);
628
+
629
+ $json = json_decode($response['http_response']->get_response_object()->body);
630
+ return $json;
631
  }
632
 
633
  function fifu_api_query($dataset) {
688
  }
689
  }
690
 
691
+ function fifu_get_storage_id($hex_id, $width, $height) {
692
+ return $hex_id . '-' . $width . '-' . $height;
693
+ }
694
+
695
+ function fifu_api_list_all_fifu(WP_REST_Request $request) {
696
+ $page = (int) $request['page'];
697
+ $urls = fifu_db_get_all_urls($page);
698
+ return $urls;
699
+ }
700
+
701
+ function fifu_api_list_all_media_library(WP_REST_Request $request) {
702
+ if (!fifu_su_sign_up_complete())
703
+ return json_decode(array());
704
+
705
+ $page = (int) $request['page'];
706
+ return fifu_db_get_posts_with_internal_featured_image($page);
707
+ }
708
+
709
  function fifu_enable_fake_api(WP_REST_Request $request) {
710
  update_option('fifu_fake_stop', false, 'no');
711
  fifu_enable_fake();
922
  'callback' => 'fifu_rest_url',
923
  'permission_callback' => 'fifu_public_permission',
924
  ));
925
+
926
+ register_rest_route('featured-image-from-url/v2', '/create_thumbnails_list/', array(
927
+ 'methods' => 'POST',
928
+ 'callback' => 'fifu_api_create_thumbnails_list',
929
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
930
+ ));
931
+ register_rest_route('featured-image-from-url/v2', '/sign_up/', array(
932
+ 'methods' => 'POST',
933
+ 'callback' => 'fifu_api_sign_up',
934
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
935
+ ));
936
+ register_rest_route('featured-image-from-url/v2', '/login/', array(
937
+ 'methods' => 'POST',
938
+ 'callback' => 'fifu_api_login',
939
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
940
+ ));
941
+ register_rest_route('featured-image-from-url/v2', '/logout/', array(
942
+ 'methods' => 'POST',
943
+ 'callback' => 'fifu_api_logout',
944
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
945
+ ));
946
+ register_rest_route('featured-image-from-url/v2', '/connected/', array(
947
+ 'methods' => 'POST',
948
+ 'callback' => 'fifu_api_connected',
949
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
950
+ ));
951
+ register_rest_route('featured-image-from-url/v2', '/reset_credentials/', array(
952
+ 'methods' => 'POST',
953
+ 'callback' => 'fifu_api_reset_credentials',
954
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
955
+ ));
956
+ register_rest_route('featured-image-from-url/v2', '/list_all_su/', array(
957
+ 'methods' => 'POST',
958
+ 'callback' => 'fifu_api_list_all_su',
959
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
960
+ ));
961
+ register_rest_route('featured-image-from-url/v2', '/list_all_fifu/', array(
962
+ 'methods' => 'POST',
963
+ 'callback' => 'fifu_api_list_all_fifu',
964
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
965
+ ));
966
+ register_rest_route('featured-image-from-url/v2', '/list_all_media_library/', array(
967
+ 'methods' => 'POST',
968
+ 'callback' => 'fifu_api_list_all_media_library',
969
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
970
+ ));
971
+ register_rest_route('featured-image-from-url/v2', '/list_daily_count/', array(
972
+ 'methods' => 'POST',
973
+ 'callback' => 'fifu_api_list_daily_count',
974
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
975
+ ));
976
+ register_rest_route('featured-image-from-url/v2', '/delete/', array(
977
+ 'methods' => 'POST',
978
+ 'callback' => 'fifu_api_delete',
979
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
980
+ ));
981
+ register_rest_route('featured-image-from-url/v2', '/cancel/', array(
982
+ 'methods' => 'POST',
983
+ 'callback' => 'fifu_api_cancel',
984
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
985
+ ));
986
+ register_rest_route('featured-image-from-url/v2', '/payment_info/', array(
987
+ 'methods' => 'POST',
988
+ 'callback' => 'fifu_api_payment_info',
989
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
990
+ ));
991
  });
992
 
993
  function fifu_get_private_data_permissions_check() {
admin/column.php CHANGED
@@ -93,6 +93,11 @@ function fifu_column_custom_post_type() {
93
  }
94
 
95
  function fifu_optimized_column_image($url) {
 
 
 
 
 
96
  if (fifu_is_on('fifu_photon')) {
97
  $height = get_option('fifu_column_height');
98
  return fifu_jetpack_photon_url($url, fifu_get_photon_args($height, $height));
93
  }
94
 
95
  function fifu_optimized_column_image($url) {
96
+ if (fifu_is_from_speedup($url)) {
97
+ $url = explode('?', $url)[0];
98
+ return fifu_speedup_get_signed_url($url, 128, 128, null, null, false);
99
+ }
100
+
101
  if (fifu_is_on('fifu_photon')) {
102
  $height = get_option('fifu_column_height');
103
  return fifu_jetpack_photon_url($url, fifu_get_photon_args($height, $height));
admin/db.php CHANGED
@@ -17,6 +17,7 @@ class FifuDb {
17
  $this->posts = $wpdb->prefix . 'posts';
18
  $this->options = $wpdb->prefix . 'options';
19
  $this->postmeta = $wpdb->prefix . 'postmeta';
 
20
  $this->termmeta = $wpdb->prefix . 'termmeta';
21
  $this->term_taxonomy = $wpdb->prefix . 'term_taxonomy';
22
  $this->term_relationships = $wpdb->prefix . 'term_relationships';
@@ -556,6 +557,444 @@ class FifuDb {
556
  );
557
  }
558
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
559
  function count_available_images() {
560
  $total = 0;
561
 
@@ -1070,6 +1509,41 @@ function fifu_db_number_of_posts() {
1070
 
1071
  /* speed up */
1072
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1073
  function fifu_db_count_available_images() {
1074
  $db = new FifuDb();
1075
  return $db->count_available_images();
17
  $this->posts = $wpdb->prefix . 'posts';
18
  $this->options = $wpdb->prefix . 'options';
19
  $this->postmeta = $wpdb->prefix . 'postmeta';
20
+ $this->terms = $wpdb->prefix . 'terms';
21
  $this->termmeta = $wpdb->prefix . 'termmeta';
22
  $this->term_taxonomy = $wpdb->prefix . 'term_taxonomy';
23
  $this->term_relationships = $wpdb->prefix . 'term_relationships';
557
  );
558
  }
559
 
560
+ /* speed up */
561
+
562
+ function get_all_urls($page) {
563
+ $start = $page * 1000;
564
+
565
+ $sql = "
566
+ (
567
+ SELECT pm.meta_id, pm.post_id, pm.meta_value AS url, pm.meta_key, p.post_name, p.post_title, p.post_date, false AS category, null AS video_url
568
+ FROM " . $this->postmeta . " pm
569
+ INNER JOIN " . $this->posts . " p ON pm.post_id = p.id
570
+ WHERE pm.meta_key = 'fifu_image_url'
571
+ AND pm.meta_value NOT LIKE '%https://cdn.fifu.app/%'
572
+ AND pm.meta_value <> 'https://storage.googleapis.com/featuredimagefromurl/shortcode.svg'
573
+ AND p.post_status <> 'trash'
574
+ )
575
+ ";
576
+ if (class_exists('WooCommerce')) {
577
+ $sql .= "
578
+ UNION
579
+ (
580
+ SELECT tm.meta_id, tm.term_id AS post_id, tm.meta_value AS url, tm.meta_key, null AS post_name, t.name AS post_title, null AS post_date, true AS category, null AS video_url
581
+ FROM " . $this->termmeta . " tm
582
+ INNER JOIN " . $this->terms . " t ON tm.term_id = t.term_id
583
+ WHERE tm.meta_key IN ('fifu_image_url')
584
+ AND tm.meta_value NOT LIKE '%https://cdn.fifu.app/%'
585
+ AND tm.meta_value <> 'https://storage.googleapis.com/featuredimagefromurl/shortcode.svg'
586
+ )
587
+ ";
588
+ }
589
+ $sql .= "
590
+ ORDER BY post_id DESC
591
+ LIMIT {$start},1000
592
+ ";
593
+ return $this->wpdb->get_results($sql);
594
+ }
595
+
596
+ function get_posts_with_internal_featured_image($page) {
597
+ $start = $page * 1000;
598
+
599
+ $sql = "
600
+ (
601
+ SELECT
602
+ pm.post_id,
603
+ att.guid AS url,
604
+ p.post_name,
605
+ p.post_title,
606
+ p.post_date,
607
+ att.id AS thumbnail_id,
608
+ (SELECT meta_value FROM " . $this->postmeta . " pm2 WHERE pm2.post_id = pm.post_id AND pm2.meta_key = '_product_image_gallery') AS gallery_ids,
609
+ false AS category
610
+ FROM " . $this->postmeta . " pm
611
+ INNER JOIN " . $this->posts . " p ON pm.post_id = p.id
612
+ INNER JOIN " . $this->posts . " att ON (
613
+ pm.meta_key = '_thumbnail_id'
614
+ AND pm.meta_value = att.id
615
+ AND att.post_author <> " . $this->author . "
616
+ )
617
+ WHERE NOT EXISTS (
618
+ SELECT 1
619
+ FROM " . $this->postmeta . "
620
+ WHERE post_id = pm.post_id
621
+ AND (meta_key LIKE 'fifu_%image_url%' OR meta_key IN ('bkp_thumbnail_id', 'bkp_product_image_gallery'))
622
+ )
623
+ AND p.post_status <> 'trash'
624
+ )
625
+ ";
626
+ if (class_exists('WooCommerce')) {
627
+ $sql .= "
628
+ UNION
629
+ (
630
+ SELECT
631
+ tm.term_id AS post_id,
632
+ att.guid AS url,
633
+ null AS post_name,
634
+ t.name AS post_title,
635
+ null AS post_date,
636
+ att.id AS thumbnail_id,
637
+ null AS gallery_ids,
638
+ true AS category
639
+ FROM " . $this->termmeta . " tm
640
+ INNER JOIN " . $this->terms . " t ON tm.term_id = t.term_id
641
+ INNER JOIN " . $this->posts . " att ON (
642
+ tm.meta_key = 'thumbnail_id'
643
+ AND tm.meta_value = att.id
644
+ AND att.post_author <> " . $this->author . "
645
+ )
646
+ WHERE NOT EXISTS (
647
+ SELECT 1
648
+ FROM " . $this->termmeta . "
649
+ WHERE term_id = tm.term_id
650
+ AND (meta_key = 'fifu_image_url' OR meta_key = 'bkp_thumbnail_id')
651
+ )
652
+ )
653
+ ";
654
+ }
655
+ $sql .= "
656
+ ORDER BY post_id DESC
657
+ LIMIT {$start},1000
658
+ ";
659
+ return $this->wpdb->get_results($sql);
660
+ }
661
+
662
+ function get_posts_su($storage_ids) {
663
+ if ($storage_ids) {
664
+ $storage_ids = '"' . implode('","', $storage_ids) . '"';
665
+ $filter_post_image = "AND SUBSTRING_INDEX(SUBSTRING_INDEX(pm.meta_value, '/', 5), '/', -1) IN ({$storage_ids})";
666
+ $filter_term_image = "AND SUBSTRING_INDEX(SUBSTRING_INDEX(tm.meta_value, '/', 5), '/', -1) IN ({$storage_ids})";
667
+ } else
668
+ $filter_post_image = $filter_term_image = "";
669
+
670
+ $sql = "
671
+ (
672
+ SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(pm.meta_value, '/', 5), '/', -1) AS storage_id,
673
+ p.post_title,
674
+ p.post_date,
675
+ pm.meta_id,
676
+ pm.post_id,
677
+ pm.meta_key,
678
+ false AS category
679
+ FROM " . $this->postmeta . " pm
680
+ INNER JOIN " . $this->posts . " p ON pm.post_id = p.id
681
+ WHERE pm.meta_key LIKE 'fifu_%image_url%'
682
+ AND pm.meta_value LIKE 'https://cdn.fifu.app/%'" .
683
+ $filter_post_image . "
684
+ )
685
+ ";
686
+ if (class_exists('WooCommerce')) {
687
+ $sql .= "
688
+ UNION
689
+ (
690
+ SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(tm.meta_value, '/', 5), '/', -1) AS storage_id,
691
+ t.name AS post_title,
692
+ null AS post_date,
693
+ tm.meta_id,
694
+ tm.term_id AS post_id,
695
+ tm.meta_key,
696
+ true AS category
697
+ FROM " . $this->termmeta . " tm
698
+ INNER JOIN " . $this->terms . " t ON tm.term_id = t.term_id
699
+ WHERE tm.meta_key = 'fifu_image_url'
700
+ AND tm.meta_value LIKE 'https://cdn.fifu.app/%'" .
701
+ $filter_term_image . "
702
+ )
703
+ ";
704
+ }
705
+ return $this->wpdb->get_results($sql);
706
+ }
707
+
708
+ /* speed up (add) */
709
+
710
+ function add_urls_su($bucket_id, $thumbnails) {
711
+ // custom field
712
+ $this->speed_up_custom_fields($bucket_id, $thumbnails, false);
713
+
714
+ // two groups
715
+ $featured_list = array();
716
+ foreach ($thumbnails as $thumbnail) {
717
+ if ($thumbnail->meta_key == 'fifu_image_url')
718
+ array_push($featured_list, $thumbnail);
719
+ }
720
+
721
+ // featured group
722
+ if (count($featured_list) > 0) {
723
+ $att_ids_map = $this->get_thumbnail_ids($featured_list, false);
724
+ if (count($att_ids_map) > 0) {
725
+ $this->speed_up_attachments($bucket_id, $featured_list, $att_ids_map);
726
+ $meta_ids_map = $this->get_thumbnail_meta_ids($featured_list, $att_ids_map);
727
+ if (count($meta_ids_map) > 0)
728
+ $this->speed_up_attachments_meta($bucket_id, $featured_list, $meta_ids_map);
729
+ }
730
+ }
731
+ }
732
+
733
+ function ctgr_add_urls_su($bucket_id, $thumbnails) {
734
+ // custom field
735
+ $this->speed_up_custom_fields($bucket_id, $thumbnails, true);
736
+
737
+ $featured_list = array();
738
+ foreach ($thumbnails as $thumbnail)
739
+ array_push($featured_list, $thumbnail);
740
+
741
+ // featured group
742
+ if (count($featured_list) > 0) {
743
+ $att_ids_map = $this->get_thumbnail_ids($featured_list, true);
744
+ if (count($att_ids_map) > 0) {
745
+ $this->speed_up_attachments($bucket_id, $featured_list, $att_ids_map);
746
+ $meta_ids_map = $this->get_thumbnail_meta_ids($featured_list, $att_ids_map);
747
+ if (count($meta_ids_map) > 0)
748
+ $this->speed_up_attachments_meta($bucket_id, $featured_list, $meta_ids_map);
749
+ }
750
+ }
751
+ }
752
+
753
+ function get_su_url($bucket_id, $storage_id) {
754
+ return 'https://cdn.fifu.app/' . $bucket_id . '/' . $storage_id;
755
+ }
756
+
757
+ function speed_up_custom_fields($bucket_id, $thumbnails, $is_ctgr) {
758
+ $table = $is_ctgr ? $this->termmeta : $this->postmeta;
759
+
760
+ $query = "
761
+ INSERT INTO " . $table . " (meta_id, meta_value) VALUES ";
762
+ $count = 0;
763
+ foreach ($thumbnails as $thumbnail) {
764
+ $su_url = $this->get_su_url($bucket_id, $thumbnail->storage_id);
765
+
766
+ if ($count++ != 0)
767
+ $query .= ", ";
768
+ $query .= "(" . $thumbnail->meta_id . ",'" . $su_url . "') ";
769
+ }
770
+ $query .= "ON DUPLICATE KEY UPDATE meta_value=VALUES(meta_value)";
771
+ return $this->wpdb->get_results($query);
772
+ }
773
+
774
+ function get_thumbnail_ids($thumbnails, $is_ctgr) {
775
+ // join post_ids
776
+ $i = 0;
777
+ $ids = null;
778
+ foreach ($thumbnails as $thumbnail)
779
+ $ids = ($i++ == 0) ? $thumbnail->post_id : ($ids . "," . $thumbnail->post_id);
780
+
781
+ // get featured ids
782
+ if ($is_ctgr) {
783
+ $result = $this->wpdb->get_results("
784
+ SELECT term_id AS post_id, meta_value AS att_id
785
+ FROM " . $this->termmeta . "
786
+ WHERE term_id IN (" . $ids . ")
787
+ AND meta_key = 'thumbnail_id'"
788
+ );
789
+ } else {
790
+ $result = $this->wpdb->get_results("
791
+ SELECT post_id, meta_value AS att_id
792
+ FROM " . $this->postmeta . "
793
+ WHERE post_id IN (" . $ids . ")
794
+ AND meta_key = '_thumbnail_id'"
795
+ );
796
+ }
797
+
798
+ // map featured ids
799
+ $featured_map = array();
800
+ foreach ($result as $res)
801
+ $featured_map[$res->post_id] = $res->att_id;
802
+
803
+ // map thumbnails
804
+ $map = array();
805
+ foreach ($thumbnails as $thumbnail) {
806
+ if (isset($featured_map[$thumbnail->post_id])) {
807
+ $att_id = $featured_map[$thumbnail->post_id];
808
+ $map[$thumbnail->meta_id] = $att_id;
809
+ }
810
+ }
811
+ // meta_id -> att_id
812
+ return $map;
813
+ }
814
+
815
+ function speed_up_attachments($bucket_id, $thumbnails, $att_ids_map) {
816
+ $count = 0;
817
+ $query = "
818
+ INSERT INTO " . $this->posts . " (id, guid) VALUES ";
819
+ foreach ($thumbnails as $thumbnail) {
820
+ if (!isset($att_ids_map[$thumbnail->meta_id])) // no metadata, only custom field
821
+ continue;
822
+
823
+ $su_url = $this->get_su_url($bucket_id, $thumbnail->storage_id);
824
+
825
+ if ($count++ != 0)
826
+ $query .= ", ";
827
+ $query .= "(" . $att_ids_map[$thumbnail->meta_id] . ",'" . $su_url . "') ";
828
+ }
829
+ $query .= "ON DUPLICATE KEY UPDATE guid=VALUES(guid)";
830
+ return $this->wpdb->get_results($query);
831
+ }
832
+
833
+ function get_thumbnail_meta_ids($thumbnails, $att_ids_map) {
834
+ // join post_ids
835
+ $i = 0;
836
+ $ids = null;
837
+ foreach ($thumbnails as $thumbnail) {
838
+ if (!isset($att_ids_map[$thumbnail->meta_id])) // no metadata, only custom field
839
+ continue;
840
+ $ids = ($i++ == 0) ? $att_ids_map[$thumbnail->meta_id] : ($ids . "," . $att_ids_map[$thumbnail->meta_id]);
841
+ }
842
+
843
+ // get meta ids
844
+ $result = $this->wpdb->get_results("
845
+ SELECT meta_id, post_id
846
+ FROM " . $this->postmeta . "
847
+ WHERE post_id IN (" . $ids . ")
848
+ AND meta_key = '_wp_attached_file'"
849
+ );
850
+
851
+ // map att_id -> meta_id
852
+ $attid_metaid_map = array();
853
+ foreach ($result as $res)
854
+ $attid_metaid_map[$res->post_id] = $res->meta_id;
855
+
856
+ // map meta_id (fifu metadata) -> meta_id (atachment metadata)
857
+ $map = array();
858
+ foreach ($thumbnails as $thumbnail) {
859
+ if (!isset($att_ids_map[$thumbnail->meta_id])) // no metadata, only custom field
860
+ continue;
861
+ $att_meta_id = $attid_metaid_map[$att_ids_map[$thumbnail->meta_id]];
862
+ $map[$thumbnail->meta_id] = $att_meta_id;
863
+ }
864
+ return $map;
865
+ }
866
+
867
+ function speed_up_attachments_meta($bucket_id, $thumbnails, $meta_ids_map) {
868
+ $count = 0;
869
+ $query = "
870
+ INSERT INTO " . $this->postmeta . " (meta_id, meta_value) VALUES ";
871
+ foreach ($thumbnails as $thumbnail) {
872
+ if (!isset($meta_ids_map[$thumbnail->meta_id])) // no metadata, only custom field
873
+ continue;
874
+
875
+ $su_url = $this->get_su_url($bucket_id, $thumbnail->storage_id);
876
+
877
+ if ($count++ != 0)
878
+ $query .= ", ";
879
+ $query .= "(" . $meta_ids_map[$thumbnail->meta_id] . ",'" . $su_url . "') ";
880
+ }
881
+ $query .= "ON DUPLICATE KEY UPDATE meta_value=VALUES(meta_value)";
882
+ return $this->wpdb->get_results($query);
883
+ }
884
+
885
+ /* speed up (remove) */
886
+
887
+ function remove_urls_su($bucket_id, $thumbnails, $urls, $video_urls) {
888
+ foreach ($thumbnails as $thumbnail) {
889
+ // post removed
890
+ if (!$thumbnail->meta_id)
891
+ unset($urls[$thumbnail->storage_id]);
892
+ }
893
+
894
+ if (empty($urls))
895
+ return;
896
+
897
+ // custom field
898
+ $this->revert_custom_fields($thumbnails, $urls, $video_urls, false);
899
+
900
+ // two groups
901
+ $featured_list = array();
902
+ foreach ($thumbnails as $thumbnail) {
903
+ if ($thumbnail->meta_key == 'fifu_image_url')
904
+ array_push($featured_list, $thumbnail);
905
+ }
906
+
907
+ // featured group
908
+ if (count($featured_list) > 0) {
909
+ $att_ids_map = $this->get_thumbnail_ids($featured_list, false);
910
+ if (count($att_ids_map) > 0) {
911
+ $this->revert_attachments($urls, $featured_list, $att_ids_map);
912
+ $meta_ids_map = $this->get_thumbnail_meta_ids($featured_list, $att_ids_map);
913
+ if (count($meta_ids_map) > 0)
914
+ $this->revert_attachments_meta($urls, $featured_list, $meta_ids_map);
915
+ }
916
+ }
917
+ }
918
+
919
+ function ctgr_remove_urls_su($bucket_id, $thumbnails, $urls, $video_urls) {
920
+ foreach ($thumbnails as $thumbnail) {
921
+ // post removed
922
+ if (!$thumbnail->meta_id)
923
+ unset($urls[$thumbnail->storage_id]);
924
+ }
925
+
926
+ if (empty($urls))
927
+ return;
928
+
929
+ // custom field
930
+ $this->revert_custom_fields($thumbnails, $urls, $video_urls, true);
931
+
932
+ $featured_list = array();
933
+ foreach ($thumbnails as $thumbnail)
934
+ array_push($featured_list, $thumbnail);
935
+
936
+ // featured group
937
+ if (count($featured_list) > 0) {
938
+ $att_ids_map = $this->get_thumbnail_ids($featured_list, true);
939
+ if (count($att_ids_map) > 0) {
940
+ $this->revert_attachments($urls, $featured_list, $att_ids_map);
941
+ $meta_ids_map = $this->get_thumbnail_meta_ids($featured_list, $att_ids_map);
942
+ if (count($meta_ids_map) > 0)
943
+ $this->revert_attachments_meta($urls, $featured_list, $meta_ids_map);
944
+ }
945
+ }
946
+ }
947
+
948
+ /* speed up (add custom fields) */
949
+
950
+ function revert_custom_fields($thumbnails, $urls, $video_urls, $is_ctgr) {
951
+ $table = $is_ctgr ? $this->termmeta : $this->postmeta;
952
+
953
+ $query = "
954
+ INSERT INTO " . $table . " (meta_id, meta_value) VALUES ";
955
+ $count = 0;
956
+ foreach ($thumbnails as $thumbnail) {
957
+ if ($count++ != 0)
958
+ $query .= ", ";
959
+ $url = $urls[$thumbnail->storage_id];
960
+ $query .= "(" . $thumbnail->meta_id . ",'" . $url . "')";
961
+ }
962
+ $query .= "ON DUPLICATE KEY UPDATE meta_value=VALUES(meta_value)";
963
+ return $this->wpdb->get_results($query);
964
+ }
965
+
966
+ function revert_attachments($urls, $thumbnails, $att_ids_map) {
967
+ $count = 0;
968
+ $query = "
969
+ INSERT INTO " . $this->posts . " (id, guid) VALUES ";
970
+ foreach ($thumbnails as $thumbnail) {
971
+ if (!isset($att_ids_map[$thumbnail->meta_id])) // no metadata, only custom field
972
+ continue;
973
+ if ($count++ != 0)
974
+ $query .= ", ";
975
+ $query .= "(" . $att_ids_map[$thumbnail->meta_id] . ",'" . $urls[$thumbnail->storage_id] . "')";
976
+ }
977
+ $query .= "ON DUPLICATE KEY UPDATE guid=VALUES(guid)";
978
+ return $this->wpdb->get_results($query);
979
+ }
980
+
981
+ function revert_attachments_meta($urls, $thumbnails, $meta_ids_map) {
982
+ $count = 0;
983
+ $query = "
984
+ INSERT INTO " . $this->postmeta . " (meta_id, meta_value) VALUES ";
985
+ foreach ($thumbnails as $thumbnail) {
986
+ if (!isset($meta_ids_map[$thumbnail->meta_id])) // no metadata, only custom field
987
+ continue;
988
+ if ($count++ != 0)
989
+ $query .= ", ";
990
+ $query .= "(" . $meta_ids_map[$thumbnail->meta_id] . ",'" . $urls[$thumbnail->storage_id] . "')";
991
+ }
992
+ $query .= "ON DUPLICATE KEY UPDATE meta_value=VALUES(meta_value)";
993
+ return $this->wpdb->get_results($query);
994
+ }
995
+
996
+ ///////////////////////////////////////////////////////////////////////////////////
997
+
998
  function count_available_images() {
999
  $total = 0;
1000
 
1509
 
1510
  /* speed up */
1511
 
1512
+ function fifu_db_get_all_urls($page) {
1513
+ $db = new FifuDb();
1514
+ return $db->get_all_urls($page);
1515
+ }
1516
+
1517
+ function fifu_db_get_posts_with_internal_featured_image($page) {
1518
+ $db = new FifuDb();
1519
+ return $db->get_posts_with_internal_featured_image($page);
1520
+ }
1521
+
1522
+ function fifu_get_posts_su($storage_ids) {
1523
+ $db = new FifuDb();
1524
+ return $db->get_posts_su($storage_ids);
1525
+ }
1526
+
1527
+ function fifu_add_urls_su($bucket_id, $thumbnails) {
1528
+ $db = new FifuDb();
1529
+ return $db->add_urls_su($bucket_id, $thumbnails);
1530
+ }
1531
+
1532
+ function fifu_ctgr_add_urls_su($bucket_id, $thumbnails) {
1533
+ $db = new FifuDb();
1534
+ return $db->ctgr_add_urls_su($bucket_id, $thumbnails);
1535
+ }
1536
+
1537
+ function fifu_remove_urls_su($bucket_id, $thumbnails, $urls, $video_urls) {
1538
+ $db = new FifuDb();
1539
+ return $db->remove_urls_su($bucket_id, $thumbnails, $urls, $video_urls);
1540
+ }
1541
+
1542
+ function fifu_ctgr_remove_urls_su($bucket_id, $thumbnails, $urls, $video_urls) {
1543
+ $db = new FifuDb();
1544
+ return $db->ctgr_remove_urls_su($bucket_id, $thumbnails, $urls, $video_urls);
1545
+ }
1546
+
1547
  function fifu_db_count_available_images() {
1548
  $db = new FifuDb();
1549
  return $db->count_available_images();
admin/html/cloud.html CHANGED
@@ -2,7 +2,7 @@
2
 
3
  <div class="header-box">
4
  <h1 style="color:white;padding-left:20px;width:98%;font-family:Ubuntu,sans-serif">
5
- <span class="dashicons dashicons-cloud-upload" style="font-size:30px"></span><span style="padding-left:20px">FIFU Cloud is coming soon...</span>
6
  <a href="https://gcpsignup.page.link/1J6G" target="_blank"><img class="fifu-google-cloud" src="https://storage.googleapis.com/featuredimagefromurl/power-by-gcp2.png"/></a>
7
  </h1>
8
  </div>
@@ -10,6 +10,11 @@
10
  <div id="tabs-top" style="float:left; width: 100%; max-width: 1014px !important;">
11
  <ul>
12
  <li><a href="#tabs-a"><i class="fas fa-info-circle"></i> <?php $fifucloud['tabs']['welcome']() ?></a></li>
 
 
 
 
 
13
  </ul>
14
  <div id="tabs-a" class="cloud-tab">
15
  <div class="first-cloud-box">
@@ -105,6 +110,51 @@
105
  </div>
106
  </div>
107
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  <div class="box">
109
  <h2>
110
  <i class="fas fa-money-bill-alt"></i> <?php $fifucloud['title']['price']() ?> ¹
@@ -117,7 +167,7 @@
117
  <b><?php $fifucloud['billing']['tiers']() ?></b>
118
  </div>
119
  <img src='https://storage.googleapis.com/featuredimagefromurl/tiers.jpg'>
120
- <!--table style="text-align:left; width:100%; background-color:white;">
121
  <tr class="color">
122
  <th style="font-weight:bold;">
123
  <?php $fifucloud['pricing']['table']['quantity']() ?>
@@ -166,7 +216,7 @@
166
  $0.001
167
  </td>
168
  </tr>
169
- </table-->
170
  <br>
171
  <?php $fifucloud['pricing']['thumbnails']() ?>
172
  <br>
@@ -175,7 +225,7 @@
175
  <b><?php $fifucloud['pricing']['example']() ?></b>
176
  </div>
177
  <img src="https://storage.googleapis.com/featuredimagefromurl/price-calculation.jpg">
178
- <!--table style="text-align:left; width:100%; background-color:white;">
179
  <tr class="color">
180
  <th style="font-weight:bold;">
181
  <?php $fifucloud['pricing']['table']['interval']() ?>
@@ -243,8 +293,7 @@
243
  </td>
244
  </tr>
245
  <tr></tr>
246
- </table>
247
- <br>
248
  <table style="text-align:left; width:100%; background-color:white;">
249
  <tr class="color">
250
  <th style="font-weight:bold">
@@ -270,12 +319,471 @@
270
  1064 x $0.004 = $4.25
271
  </td>
272
  </tr>
273
- </table-->
274
  </div>
275
  <br>
276
  ¹ <?php $fifucloud['pricing']['table']['ps']() ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  </div>
278
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  </div>
280
 
281
  </div>
2
 
3
  <div class="header-box">
4
  <h1 style="color:white;padding-left:20px;width:98%;font-family:Ubuntu,sans-serif">
5
+ <span class="dashicons dashicons-cloud-upload" style="font-size:30px"></span><span style="padding-left:20px">FIFU Cloud is coming soon... </span><span style="color:orange">already available for beta testers</span>
6
  <a href="https://gcpsignup.page.link/1J6G" target="_blank"><img class="fifu-google-cloud" src="https://storage.googleapis.com/featuredimagefromurl/power-by-gcp2.png"/></a>
7
  </h1>
8
  </div>
10
  <div id="tabs-top" style="float:left; width: 100%; max-width: 1014px !important;">
11
  <ul>
12
  <li><a href="#tabs-a"><i class="fas fa-info-circle"></i> <?php $fifucloud['tabs']['welcome']() ?></a></li>
13
+ <li><a href="#tabs-b"><i class="fas fa-unlock-alt"></i> <?php $fifucloud['tabs']['login']() ?></a></li>
14
+ <li><a href="#tabs-c" onclick="listAllFifu(0)"><i class="fas fa-folder-plus"></i> <?php $fifucloud['tabs']['send']() ?></a></li>
15
+ <li><a href="#tabs-d" onclick="listAllSu(0)"><i class="fas fa-folder-minus"></i> <?php $fifucloud['tabs']['delete']() ?></a></li>
16
+ <li><a href="#tabs-e" onclick="listAllMediaLibrary(0)"><i class="fab fa-wordpress"></i> <?php $fifucloud['tabs']['media']() ?></a></li>
17
+ <li><a href="#tabs-f" onclick="listDailyCount()"><i class="fas fa-money-bill-alt"></i> <?php $fifucloud['tabs']['bill']() ?></a></li>
18
  </ul>
19
  <div id="tabs-a" class="cloud-tab">
20
  <div class="first-cloud-box">
110
  </div>
111
  </div>
112
 
113
+ <div class="box">
114
+ <h2><i class="fa-solid fa-list-ol"></i> <?php $fifucloud['title']['getting']() ?></h2>
115
+ <div class="greybox">
116
+ <?php $fifucloud['getting']['beta']() ?><br>
117
+ <br>
118
+ <table style="text-align:left; width:100%; background-color:white;">
119
+ <tr class="color">
120
+ <td>
121
+ 1
122
+ </td>
123
+ <td>
124
+ <?php $fifucloud['getting']['signup']['title']() ?>
125
+ </td>
126
+ <td>
127
+ <?php $fifucloud['getting']['signup']['description']() ?>
128
+ </td>
129
+ </tr>
130
+ <tr class="color">
131
+ <td>
132
+ 2
133
+ </td>
134
+ <td>
135
+ <?php $fifucloud['getting']['login']['title']() ?>
136
+ </td>
137
+ <td>
138
+ <?php $fifucloud['getting']['login']['description']() ?>
139
+ </td>
140
+ </tr>
141
+ <tr class="color">
142
+ <td>
143
+ 3
144
+ </td>
145
+ <td>
146
+ <?php $fifucloud['getting']['upload']['title']() ?>
147
+ </td>
148
+ <td>
149
+ <?php $fifucloud['getting']['upload']['description']() ?>
150
+ </td>
151
+ </tr>
152
+ </table>
153
+ <br>
154
+ <b><?php $fifucloud['getting']['important']() ?></b>: <?php $fifucloud['getting']['description']() ?>
155
+ </div>
156
+ </div>
157
+
158
  <div class="box">
159
  <h2>
160
  <i class="fas fa-money-bill-alt"></i> <?php $fifucloud['title']['price']() ?> ¹
167
  <b><?php $fifucloud['billing']['tiers']() ?></b>
168
  </div>
169
  <img src='https://storage.googleapis.com/featuredimagefromurl/tiers.jpg'>
170
+ <!-- <table style="text-align:left; width:100%; background-color:white;">
171
  <tr class="color">
172
  <th style="font-weight:bold;">
173
  <?php $fifucloud['pricing']['table']['quantity']() ?>
216
  $0.001
217
  </td>
218
  </tr>
219
+ </table> -->
220
  <br>
221
  <?php $fifucloud['pricing']['thumbnails']() ?>
222
  <br>
225
  <b><?php $fifucloud['pricing']['example']() ?></b>
226
  </div>
227
  <img src="https://storage.googleapis.com/featuredimagefromurl/price-calculation.jpg">
228
+ <!-- <table style="text-align:left; width:100%; background-color:white;">
229
  <tr class="color">
230
  <th style="font-weight:bold;">
231
  <?php $fifucloud['pricing']['table']['interval']() ?>
293
  </td>
294
  </tr>
295
  <tr></tr>
296
+ </table>
 
297
  <table style="text-align:left; width:100%; background-color:white;">
298
  <tr class="color">
299
  <th style="font-weight:bold">
319
  1064 x $0.004 = $4.25
320
  </td>
321
  </tr>
322
+ </table> -->
323
  </div>
324
  <br>
325
  ¹ <?php $fifucloud['pricing']['table']['ps']() ?>
326
+ </div>
327
+ </div>
328
+
329
+ <div id="tabs-b" class="cloud-tab">
330
+ <div id="log-in-box" class="first-cloud-box">
331
+ <h2>
332
+ <i class="fas fa-user-lock"></i> <?php $fifucloud['title']['login']() ?>
333
+ <output id="login_response_message" class="response_message"></output>
334
+ </h2>
335
+ <div class="greybox">
336
+ <form
337
+ id="fifu_su_form_login"
338
+ action="javascript:void(0)"
339
+ method="post">
340
+ <table style="width:100%">
341
+ <tr>
342
+ <td>
343
+ <table style="min-width:362px;">
344
+ <tr id="tr_su_login_email">
345
+ <td>
346
+ <label for="su_login_email" title="type your email, please">Email: </label>
347
+ </td>
348
+ <td>
349
+ <input id="su_login_email" type="email" required maxlength="64" style="width:100%">
350
+ </td>
351
+ </tr>
352
+ <tr id="tr_su_login_2fa">
353
+ <td>
354
+ <label for="su_login_2fa" title="type the code provided by Google Authenticator">2FA Code: </label>
355
+ </td>
356
+ <td>
357
+ <input id="su_login_2fa" maxlength="6" style="width:100%; height:28px; ">
358
+ </td>
359
+ </tr>
360
+ <tr id="tr_su_login_site">
361
+ <td>
362
+ <label for="su_login_site">Website: </label>
363
+ </td>
364
+ <td>
365
+ <input id="su_login_site"
366
+ value='<?php echo fifu_get_home_url() ?>' style="width:100%; height:28px;" readonly>
367
+ </td>
368
+ </tr>
369
+ <tr>
370
+ <td>
371
+ </td>
372
+ <td>
373
+ <button id="su_login_button" onclick="login()" style="height:28px; width:38%"><i class="fa fa-sign-in-alt"></i> log in</button>
374
+ <button id="su_login_reset" onclick="confirmResetCredentials()" style="height:28px; width:60%"><i class="fa fa-qrcode"></i> reset credrentials</button>
375
+ </td>
376
+ </tr>
377
+ </table>
378
+ </td>
379
+ <td>
380
+ <table>
381
+ <tr>
382
+ <td>
383
+ <div id="qrcode" style="position:relative;left:-7px;width:150px;height:150px;display:none;"></div>
384
+ </td>
385
+ <td style="max-width:250px;">
386
+ <div id="qrcode-info-reset" style="display:none">
387
+ <div>Resetting your credentials:</div>
388
+ <div>1) get your smartphone;</div>
389
+ <div>2) open Google Authenticator app;</div>
390
+ <div>3) scan this new QR Code;</div>
391
+ <div>4) access your email and confirm the reset.</div>
392
+ </div>
393
+ <div id="qrcode-info-signup" style="display:none">
394
+ <div>First log in:</div>
395
+ <div>1) access your email and confirm your subscription;</div>
396
+ <div>2) get your smartphone;</div>
397
+ <div>3) open Google Authenticator app;</div>
398
+ <div>4) scan this QR Code;</div>
399
+ <div>5) type the 6 digits in 2FA Code field;</div>
400
+ <div>6) click on log in button.</div>
401
+ </div>
402
+ </td>
403
+ </tr>
404
+ </table>
405
+ </td>
406
+ </tr>
407
+ </table>
408
+ </form>
409
+ </div>
410
+ </div>
411
+
412
+ <div id="log-out-box" class="first-cloud-box">
413
+ <h2>
414
+ <i class="fas fa-user-lock"></i> <?php $fifucloud['title']['logout']() ?>
415
+ <output id="logout_response_message" class="response_message"></output>
416
+ </h2>
417
+ <div class="greybox">
418
+ <form
419
+ id="fifu_su_form_logout"
420
+ action="javascript:void(0)"
421
+ method="post">
422
+ <table style="width:100%">
423
+ <tr>
424
+ <td>
425
+ <table style="min-width:362px;">
426
+ <tr id="tr_su_logout_site">
427
+ <td>
428
+ <label for="su_logout_site">Website: </label>
429
+ </td>
430
+ <td>
431
+ <input id="su_logout_site"
432
+ value='<?php echo fifu_get_home_url() ?>' style="width:100%; height:28px;" readonly>
433
+ </td>
434
+ </tr>
435
+ <tr>
436
+ <td>
437
+ </td>
438
+ <td>
439
+ <button id="su_logout_button" onclick="logout()" style="height:28px; width:100%;"><i class="fa fa-sign-out-alt"></i> log out</button>
440
+ </td>
441
+ </tr>
442
+ </table>
443
+ </td>
444
+ </tr>
445
+ </table>
446
+ </form>
447
+ </div>
448
+ </div>
449
+
450
+ <div id="sign-up-box" class="box">
451
+ <h2>
452
+ <i class="fas fa-user-edit"></i> <?php $fifucloud['title']['signup']() ?>
453
+ <output id="signup_response_message" class="response_message"></output>
454
+ </h2>
455
+ <div class="greybox">
456
+ <form
457
+ id="fifu_su_form_sign_up"
458
+ action="javascript:void(0)"
459
+ method="post">
460
+ <table style="width:100%">
461
+ <tr>
462
+ <td>
463
+ <table style="min-width:362px;">
464
+ <tr>
465
+ <td>
466
+ <label for="su_first_name" >First name: </label>
467
+ </td>
468
+ <td>
469
+ <input id="su_first_name" type="text"
470
+ title="Type your first name, please" required maxlength="32" style="width:100%">
471
+ </td>
472
+ </tr>
473
+ <tr>
474
+ <td>
475
+ <label for="su_last_name">Last name: </label>
476
+ </td>
477
+ <td>
478
+ <input id="su_last_name" type="text"
479
+ title="Type your last name, please" required maxlength="32" style="width:100%">
480
+ </td>
481
+ </tr>
482
+ <tr>
483
+ <td>
484
+ <label for="su_email">Email: </label>
485
+ </td>
486
+ <td>
487
+ <input id="su_email" type="email"
488
+ title="Type your email, please" required maxlength="64" style="width:100%">
489
+ </td>
490
+ </tr>
491
+ <tr>
492
+ <td>
493
+ <label for="su_site">Website: </label>
494
+ </td>
495
+ <td>
496
+ <input id="su_site"
497
+ value='<?php echo fifu_get_home_url() ?>' readonly style="width:100%; padding:inherit; height:28px;">
498
+ </td>
499
+ </tr>
500
+ <tr>
501
+ <td></td>
502
+ <td>
503
+ <button id="su_sign_up_button" onclick="signUp()" style="width:100%; height:28px;"><i class="fas fa-user-edit"></i> sign up</button>
504
+ </td>
505
+ </tr>
506
+ </table>
507
+ </td>
508
+ </tr>
509
+ </table>
510
+ </form>
511
+ </div>
512
  </div>
513
  </div>
514
+
515
+ <div id="tabs-c" class="cloud-tab">
516
+ <div id="add-box" class="first-cloud-box">
517
+ <h2>
518
+ <i class="fas fa-folder-plus"></i> <?php $fifucloud['title']['add']() ?>
519
+ <output id="add_response_message" class="response_message"></output>
520
+ </h2>
521
+ <div class="greybox">
522
+ <?php $fifucloud['upload']['desc']() ?>
523
+ <br>
524
+ <br>
525
+ <div style="background: white; padding: 10px; border-radius: 1em;">
526
+ <table id="addTable" class="display cell-border">
527
+ <thead>
528
+ <tr>
529
+ <th>image</th>
530
+ <th>post title</th>
531
+ <th>post date</th>
532
+ <th>post id</th>
533
+ <th>image location</th>
534
+ </tr>
535
+ </thead>
536
+ <tbody>
537
+ </tbody>
538
+ </table>
539
+ </div>
540
+ <br>
541
+ <div style="background: white; padding: 10px; border-radius: 1em;">
542
+ <div style="background-color:#32373c; text-align:center; width:98%; color:white; padding:6px; border-radius:5px;">
543
+ <b><?php $fifucloud['keys']['header']() ?></b>
544
+ </div>
545
+ <table style="text-align:left; width:100%">
546
+
547
+ <tr class="color">
548
+ <th>
549
+ <?php $fifucloud['keys']['non-adjacent']() ?>
550
+ </th>
551
+ <th>
552
+ <?php $fifucloud['keys']['ctrl']() ?>
553
+ </th>
554
+ </tr>
555
+ <tr class="color">
556
+ <th>
557
+ <?php $fifucloud['keys']['adjacent']() ?>
558
+ </th>
559
+ <th>
560
+ <?php $fifucloud['keys']['shift']() ?>
561
+ </th>
562
+ </tr>
563
+ </table>
564
+ </div>
565
+ </div>
566
+ </div>
567
+ </div>
568
+
569
+ <div id="tabs-d" class="cloud-tab">
570
+ <div id="delete-box" class="first-cloud-box">
571
+ <h2>
572
+ <i class="fas fa-folder-minus"></i> <?php $fifucloud['title']['delete']() ?>
573
+ <output id="delete_response_message" class="response_message"></output>
574
+ </h2>
575
+ <div class="greybox">
576
+ <?php $fifucloud['delete']['desc']() ?>
577
+ <br>
578
+ <br>
579
+ <div style="background: white; padding: 10px; border-radius: 1em;">
580
+ <table id="removeTable" class="display cell-border">
581
+ <thead>
582
+ <tr>
583
+ <th>image</th>
584
+ <th>post title</th>
585
+ <th>upload date</th>
586
+ <th>post id</th>
587
+ <th>image location</th>
588
+ </tr>
589
+ </thead>
590
+ <tbody>
591
+ </tbody>
592
+ </table>
593
+ </div>
594
+ </div>
595
+ </div>
596
+ </div>
597
+
598
+ <div id="tabs-e" class="cloud-tab">
599
+ <div id="media-box" class="first-cloud-box">
600
+ <div class="fifu-pro"><div class="fifu-pro-out"><a class="fifu-pro-link" href="https://fifu.app/" target="_blank" title="Unlock all features"><h4 class="fifu-pro-text"><span class="dashicons dashicons-lock fifu-pro-icon"></span>PRO</h4></a></div></div>
601
+ <h2>
602
+ <i class="fab fa-wordpress"></i> <?php $fifucloud['title']['media']() ?>
603
+ <output id="media_response_message" class="response_message"></output>
604
+ </h2>
605
+ <div class="greybox">
606
+ <?php $fifucloud['media']['desc']() ?>
607
+ <br>
608
+ <br>
609
+
610
+ <div style="background: white; padding: 10px; border-radius: 1em;">
611
+ <table id="mediaTable" class="display cell-border">
612
+ <thead>
613
+ <tr>
614
+ <th>featured image</th>
615
+ <th>post title</th>
616
+ <th>post date</th>
617
+ <th>post id</th>
618
+ <th>gallery images</th>
619
+ </tr>
620
+ </thead>
621
+ <tbody>
622
+ </tbody>
623
+ </table>
624
+ </div>
625
+ </div>
626
+ </div>
627
+ </div>
628
+
629
+ <div id="tabs-f" class="cloud-tab">
630
+ <div id="billing-box" class="first-cloud-box">
631
+ <h2>
632
+ <i class="fas fa-money-bill-alt"></i> <?php $fifucloud['title']['billing']() ?>
633
+ <output id="billing_response_message" class="response_message"></output>
634
+ </h2>
635
+ <div class="greybox">
636
+ <?php $fifucloud['billing']['desc']() ?>
637
+ <br>
638
+ <br>
639
+
640
+ <div style="background: white; padding: 10px; border-radius: 1em;">
641
+ <div style="background-color:#32373c; text-align:left; color:white; padding:8px; border-radius:5px;">
642
+ <b><?php $fifucloud['billing']['current']() ?></b>
643
+ </div>
644
+ <table style="text-align:left; width:100%">
645
+
646
+ <tr class="color">
647
+ <th style="width: 25%;">
648
+ <?php $fifucloud['billing']['column']['start']() ?>
649
+ </th>
650
+ <th style="width: 25%;">
651
+ <?php $fifucloud['billing']['column']['end']() ?>
652
+ </th>
653
+ <th style="width: 25%;">
654
+ <?php $fifucloud['billing']['column']['average']() ?>
655
+ </th>
656
+ <th style="width: 25%;">
657
+ <?php $fifucloud['billing']['column']['cost']() ?>
658
+ </th>
659
+ </tr>
660
+ <tr class="color">
661
+ <th id="billing-start"></th>
662
+ <th id="billing-end"></th>
663
+ <th id="billing-average"></th>
664
+ <th id="billing-cost"></th>
665
+ </tr>
666
+ </table>
667
+ </div>
668
+
669
+ <br>
670
+
671
+ <div style="background: white; padding: 10px; border-radius: 1em;">
672
+ <table id="billingTable" class="display cell-border">
673
+ <thead>
674
+ <tr>
675
+ <th>date</th>
676
+ <th>number of images</th>
677
+ </tr>
678
+ </thead>
679
+ <tbody>
680
+ </tbody>
681
+ </table>
682
+ </div>
683
+
684
+ <br>
685
+
686
+ <div style="background: white; padding: 10px; border-radius: 1em;">
687
+ <div style="background-color:#32373c; text-align:left; color:white; padding:8px; border-radius:5px;">
688
+ <b><?php $fifucloud['billing']['tiers']() ?></b>
689
+ </div>
690
+ <table style="text-align:left; width:100%; background-color:white;" id="tiers-table">
691
+ <tr class="color">
692
+ <th style="font-weight:bold;">
693
+ <?php $fifucloud['pricing']['table']['quantity']() ?>
694
+ </th>
695
+ <th style="font-weight:bold;">
696
+ <?php $fifucloud['pricing']['table']['price']() ?>
697
+ </th>
698
+ <th style="font-weight:bold;">
699
+ <?php $fifucloud['pricing']['table']['tier']() ?>
700
+ </th>
701
+ </tr>
702
+ </table>
703
+ </div>
704
+ </div>
705
+ </div>
706
+
707
+ <div id="payment-info-box" class="box">
708
+ <h2>
709
+ <i class="fa-solid fa-credit-card"></i> <?php $fifucloud['title']['payment']() ?>
710
+ <output id="payment_info_response_message" class="response_message"></output>
711
+ </h2>
712
+ <div class="greybox">
713
+ <form
714
+ id="fifu_su_form_payment_info"
715
+ action="javascript:void(0)"
716
+ method="post">
717
+ <table style="width:100%">
718
+ <tr>
719
+ <td>
720
+ <table style="min-width:287px;">
721
+ <tr>
722
+ <td>
723
+ <button id="su_payment_info_button" onclick="payment_info()" style="height:28px; width:100%"><i class="fa-solid fa-pen"></i> update</button>
724
+ </td>
725
+ <td>
726
+ <span class="dashicons dashicons-info" style="font-size: 22px;" title="<?php $fifucloud['icon']['payment']() ?>"></span>
727
+ </td>
728
+ </tr>
729
+ </table>
730
+ </td>
731
+ </tr>
732
+ </table>
733
+ </form>
734
+ </div>
735
+ </div>
736
+
737
+ <div id="cancel-box" class="box">
738
+ <h2>
739
+ <i class="fa-solid fa-user"></i> <?php $fifucloud['title']['cancel']() ?>
740
+ <output id="cancel_response_message" class="response_message"></output>
741
+ </h2>
742
+ <div class="greybox">
743
+ <form
744
+ id="fifu_su_form_cancel"
745
+ action="javascript:void(0)"
746
+ method="post">
747
+ <table style="width:100%">
748
+ <tr>
749
+ <td>
750
+ <table style="min-width:260px;">
751
+ <tr>
752
+ <td>
753
+ <button id="su_cancel_button" onclick="cancel()" style="height:28px; width:100%"><i class="fa-solid fa-ban" style="color:rgb(221, 76, 64)"></i> close account</button>
754
+ </td>
755
+ <td>
756
+ <span class="dashicons dashicons-info" style="font-size: 22px;" title="<?php $fifucloud['icon']['cancel']() ?>"></span>
757
+ </td>
758
+ </tr>
759
+ </table>
760
+ </td>
761
+ </tr>
762
+ </table>
763
+ </form>
764
+ </div>
765
+ </div>
766
+ </div>
767
+ </div>
768
+
769
+ <div id="su-dialog-remove" title="Remove selected image(s)" style="display: none;">
770
+ <p>
771
+ The selected images will be permanently removed from FIFU Cloud and cannot be recovered. Are you sure?
772
+ </p>
773
+ </div>
774
+
775
+ <div id="su-dialog-cancel" title="Close account" style="display: none;">
776
+ <p>
777
+ All the images you have uploaded to FIFU Cloud are going to be deleted. Are you sure?
778
+ </p>
779
+ </div>
780
+
781
+ <div id="su-dialog-reset-credentials">
782
+ <div>After that you will need:</div>
783
+ <div>1) get your smartphone;</div>
784
+ <div>2) open Google Authenticator app;</div>
785
+ <div>3) scan a new QR Code;</div>
786
+ <div>4) access your email and confirm the reset.</div>
787
  </div>
788
 
789
  </div>
admin/html/css/menu.css CHANGED
@@ -18,7 +18,7 @@
18
 
19
  .box {
20
  margin: 17px 0 0;
21
- background: #ffffff85;
22
  border: 1px solid #dbdbdb;
23
  padding: 20px;
24
  padding-top: 10px;
@@ -34,6 +34,9 @@
34
  background: repeating-linear-gradient(-55deg,#efefef,#efefef 2px,#efefefb3 2px,#efefefb3 5px);
35
  }
36
 
 
 
 
37
  #tabs-top{
38
  border-radius: 0px 0px 15px 15px;
39
  }
@@ -42,9 +45,6 @@
42
  padding: 0 0 0;
43
  }
44
 
45
- .greybox p {
46
- }
47
-
48
  .toggleon, .toggleoff {
49
  padding: 0;
50
  overflow: hidden;
18
 
19
  .box {
20
  margin: 17px 0 0;
21
+ background: #ffffff85;
22
  border: 1px solid #dbdbdb;
23
  padding: 20px;
24
  padding-top: 10px;
34
  background: repeating-linear-gradient(-55deg,#efefef,#efefef 2px,#efefefb3 2px,#efefefb3 5px);
35
  }
36
 
37
+ .greybox p {
38
+ }
39
+
40
  #tabs-top{
41
  border-radius: 0px 0px 15px 15px;
42
  }
45
  padding: 0 0 0;
46
  }
47
 
 
 
 
48
  .toggleon, .toggleoff {
49
  padding: 0;
50
  overflow: hidden;
admin/html/js/cloud.js CHANGED
@@ -15,6 +15,13 @@ jQuery(document).ready(function () {
15
  jQuery('div.wrap div.header-box div#message').hide();
16
  jQuery('div.wrap div.header-box div.updated').remove();
17
 
 
 
 
 
 
 
 
18
  jQuery("#availableImages").append(fifuScriptCloudVars.availableImages);
19
  });
20
 
@@ -23,4 +30,4 @@ jQuery(function () {
23
 
24
  window.scrollTo(0, 0);
25
  jQuery('.wrap').css('opacity', 1);
26
- });
15
  jQuery('div.wrap div.header-box div#message').hide();
16
  jQuery('div.wrap div.header-box div.updated').remove();
17
 
18
+ if (fifuScriptCloudVars.signUpComplete) {
19
+ remove_sign_up();
20
+ check_connection();
21
+ } else {
22
+ fifu_show_login();
23
+ }
24
+
25
  jQuery("#availableImages").append(fifuScriptCloudVars.availableImages);
26
  });
27
 
30
 
31
  window.scrollTo(0, 0);
32
  jQuery('.wrap').css('opacity', 1);
33
+ });
admin/html/js/menu-su.js CHANGED
@@ -1,5 +1,725 @@
1
  var restUrl = fifu_get_rest_url();
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  function message(data, box) {
4
  selector = "#" + box + "_response_message";
5
  jQuery(selector).css('background-color', data['color']);
@@ -11,12 +731,296 @@ function message(data, box) {
11
  jQuery(selector).show();
12
  }
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  function fifu_block() {
15
  jQuery('#tabs-top').block({message: '', css: {backgroundColor: 'none', border: 'none', color: 'white'}});
16
  jQuery('button').attr('disabled', 'true');
17
  }
18
 
 
 
 
 
 
19
  function fifu_unblock() {
20
  jQuery('#tabs-top').unblock();
21
  jQuery('button').removeAttr('disabled');
22
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  var restUrl = fifu_get_rest_url();
2
 
3
+ function signUp() {
4
+ var firstName = jQuery('#su_first_name').val();
5
+ var lastName = jQuery('#su_last_name').val();
6
+ var email = jQuery('#su_email').val();
7
+ var site = jQuery('#su_site').val();
8
+
9
+ if (!firstName || !lastName || !email || !site)
10
+ return;
11
+
12
+ var code = null;
13
+
14
+ fifu_block();
15
+
16
+ jQuery.ajax({
17
+ method: "POST",
18
+ url: restUrl + 'featured-image-from-url/v2/sign_up/',
19
+ data: {
20
+ "first_name": firstName,
21
+ "last_name": lastName,
22
+ "email": email,
23
+ },
24
+ async: true,
25
+ beforeSend: function (xhr) {
26
+ xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
27
+ },
28
+ success: function (data) {
29
+ code = data['code'];
30
+
31
+ // duplicated
32
+ if (code == -7 || code == -25)
33
+ message(data, 'signup');
34
+
35
+ // activation code
36
+ if (code == 3)
37
+ message(data, 'login');
38
+
39
+ if (code > 0) {
40
+ remove_sign_up();
41
+
42
+ jQuery('#qrcode').children().remove();
43
+ var qrcode = new QRCode(document.getElementById("qrcode"), {width: 150, height: 150});
44
+ qrcode.makeCode('otpauth://totp/FIFU-Cloud:' + email + '?secret=' + data['qrcode'] + '&issuer=FIFU-Cloud');
45
+
46
+ jQuery("#su_login_email").val(email);
47
+
48
+ jQuery('#qrcode').show();
49
+ jQuery('#qrcode-info-reset').hide();
50
+ jQuery('#qrcode-info-signup').show();
51
+
52
+ fifuScriptCloudVars.signUpComplete = true;
53
+ }
54
+ fifu_unblock();
55
+ },
56
+ error: function (jqXHR, textStatus, errorThrown) {
57
+ console.log(jqXHR);
58
+ console.log(textStatus);
59
+ console.log(errorThrown);
60
+ fifu_unblock();
61
+ }
62
+ });
63
+ return code;
64
+ }
65
+
66
+ function login() {
67
+ var email = jQuery('#su_login_email').val();
68
+ var site = jQuery('#su_login_site').val();
69
+ var tfa = jQuery('#su_login_2fa').val();
70
+
71
+ if (!email || !site)
72
+ return;
73
+
74
+ var code = null;
75
+
76
+ fifu_block();
77
+
78
+ jQuery.ajax({
79
+ method: "POST",
80
+ url: restUrl + 'featured-image-from-url/v2/login/',
81
+ data: {
82
+ "email": email,
83
+ "tfa": tfa
84
+ },
85
+ async: true,
86
+ beforeSend: function (xhr) {
87
+ xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
88
+ },
89
+ success: function (data) {
90
+ code = data['code'];
91
+
92
+ if (code > 0) {
93
+ Cookies.set('fifu-tfa', data['fifu_tfa_hash']);
94
+
95
+ fifu_hide_log_in();
96
+
97
+ jQuery('#qrcode').hide();
98
+ jQuery('#qrcode-info-signup').hide();
99
+ jQuery('#qrcode-info-reset').hide();
100
+ jQuery('#login_response_message').hide();
101
+ jQuery('#su_login_reset').removeAttr('disabled');
102
+
103
+ setTimeout(function () {
104
+ jQuery("#tabs-top").tabs("option", "active", 2);
105
+ listAllFifu(0);
106
+ fifu_enable_edition_buttons();
107
+ }, 100);
108
+ } else
109
+ fifu_show_login();
110
+ },
111
+ error: function (jqXHR, textStatus, errorThrown) {
112
+ console.log(jqXHR);
113
+ console.log(textStatus);
114
+ console.log(errorThrown);
115
+ },
116
+ complete: function (data) {
117
+ fifu_unblock();
118
+ }
119
+ });
120
+ return code;
121
+ }
122
+
123
+ function logout() {
124
+ fifu_block();
125
+ jQuery.ajax({
126
+ method: "POST",
127
+ url: restUrl + 'featured-image-from-url/v2/logout/',
128
+ data: {
129
+ "tfa": Cookies.get('fifu-tfa'),
130
+ },
131
+ async: true,
132
+ beforeSend: function (xhr) {
133
+ xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
134
+ },
135
+ success: function (data) {
136
+ code = data['code'];
137
+
138
+ if (code == 8) {
139
+ jQuery("#su_login_email").val('');
140
+ jQuery('#su_login_reset').removeAttr('disabled');
141
+ fifu_show_login();
142
+ fifu_disable_edition_buttons();
143
+ }
144
+ },
145
+ error: function (jqXHR, textStatus, errorThrown) {
146
+ console.log(jqXHR);
147
+ console.log(textStatus);
148
+ console.log(errorThrown);
149
+ },
150
+ complete: function (data) {
151
+ fifu_unblock();
152
+ }
153
+ });
154
+ }
155
+
156
+ function cancel() {
157
+ jQuery("#su-dialog-cancel").dialog("open");
158
+ }
159
+
160
+ function payment_info() {
161
+ fifu_block();
162
+ jQuery.ajax({
163
+ method: "POST",
164
+ url: restUrl + 'featured-image-from-url/v2/payment_info/',
165
+ data: {
166
+ "tfa": Cookies.get('fifu-tfa'),
167
+ },
168
+ async: true,
169
+ beforeSend: function (xhr) {
170
+ xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
171
+ },
172
+ success: function (data) {
173
+ // not connected
174
+ if (data['code'] == -20) {
175
+ fifu_show_login();
176
+ fifu_disable_edition_buttons();
177
+ } else
178
+ message(data, 'payment_info');
179
+ },
180
+ error: function (jqXHR, textStatus, errorThrown) {
181
+ console.log(jqXHR);
182
+ console.log(textStatus);
183
+ console.log(errorThrown);
184
+ },
185
+ complete: function (data) {
186
+ fifu_unblock();
187
+ }
188
+ });
189
+ }
190
+
191
+ function check_connection() {
192
+ fifu_block();
193
+ jQuery.ajax({
194
+ method: "POST",
195
+ url: restUrl + 'featured-image-from-url/v2/connected/',
196
+ data: {
197
+ "tfa": Cookies.get('fifu-tfa'),
198
+ },
199
+ async: true,
200
+ beforeSend: function (xhr) {
201
+ xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
202
+ },
203
+ success: function (data) {
204
+ if (data == null || data['code'] == 0) {
205
+ data = new Object();
206
+ data['message'] = 'web service is down';
207
+ data['color'] = '#dd4c40';
208
+ message(data, 'login');
209
+
210
+ fifu_disable_edition_buttons();
211
+ fifu_show_login();
212
+ jQuery('#su_login_button').prop('disabled', true);
213
+ jQuery('#su_login_reset').prop('disabled', true);
214
+
215
+ fifu_unblock();
216
+ return;
217
+ } else {
218
+ fifu_enable_edition_buttons();
219
+ fifu_hide_log_in();
220
+ jQuery('#su_login_button').prop('disabled', false);
221
+ jQuery('#su_login_reset').prop('disabled', false);
222
+ }
223
+
224
+ code = data['code'];
225
+
226
+ jQuery("#qrcode").hide();
227
+ jQuery("#qrcode-info-reset").hide();
228
+ jQuery("#qrcode-info-signup").hide();
229
+
230
+ if (code == 7) {
231
+ fifu_hide_log_in();
232
+ fifu_enable_edition_buttons();
233
+ data['message'] = 'connected';
234
+ message(data, 'logout');
235
+ } else {
236
+ fifu_show_login();
237
+ fifu_disable_edition_buttons();
238
+ data['message'] = 'not connected';
239
+ message(data, 'login');
240
+ }
241
+ },
242
+ error: function (jqXHR, textStatus, errorThrown) {
243
+ fifu_disable_edition_buttons();
244
+ fifu_show_login();
245
+ jQuery('#su_login_button').prop('disabled', true);
246
+ jQuery('#su_login_reset').prop('disabled', true);
247
+
248
+ console.log(jqXHR);
249
+ console.log(textStatus);
250
+ console.log(errorThrown);
251
+ },
252
+ complete: function (data) {
253
+ fifu_unblock();
254
+ }
255
+ });
256
+ }
257
+
258
+ function resetCredentials() {
259
+ var email = jQuery('#su_login_email').val();
260
+ var site = jQuery('#su_login_site').val();
261
+
262
+ if (!email || !site)
263
+ return;
264
+
265
+ var code = null;
266
+
267
+ fifu_block();
268
+
269
+ jQuery.ajax({
270
+ method: "POST",
271
+ url: restUrl + 'featured-image-from-url/v2/reset_credentials/',
272
+ data: {
273
+ "email": email
274
+ },
275
+ async: true,
276
+ beforeSend: function (xhr) {
277
+ xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
278
+ },
279
+ success: function (data) {
280
+ code = data['code'];
281
+ if (code > 0) {
282
+ jQuery('#qrcode').children().remove();
283
+ var qrcode = new QRCode(document.getElementById("qrcode"), {width: 150, height: 150});
284
+ qrcode.makeCode('otpauth://totp/FIFU-Cloud:' + email + '?secret=' + data['qrcode'] + '&issuer=FIFU-Cloud');
285
+ jQuery('#qrcode').show();
286
+ jQuery('#qrcode-info-reset').show();
287
+ jQuery('#qrcode-info-signup').hide();
288
+ jQuery('#su_login_reset').attr('disabled', 'true');
289
+
290
+ remove_sign_up();
291
+ }
292
+ message(data, 'login');
293
+ fifu_unblock();
294
+ },
295
+ error: function (jqXHR, textStatus, errorThrown) {
296
+ console.log(jqXHR);
297
+ console.log(textStatus);
298
+ console.log(errorThrown);
299
+ fifu_unblock();
300
+ }
301
+ });
302
+ return code;
303
+ }
304
+
305
+ function listAllSu(page) {
306
+ console.log(page);
307
+ update = false;
308
+
309
+ var table = jQuery('#removeTable').DataTable({
310
+ "language": {"emptyTable": "No images available"},
311
+ destroy: true,
312
+ "columns": [{"width": "64px"}, {"width": "100%"}, {"width": "64px"}, {"width": "64px"}, {"width": "64px"}],
313
+ "autoWidth": false,
314
+ "order": [[3, 'desc']],
315
+ dom: 'lfrtBip',
316
+ select: true,
317
+ buttons: [
318
+ {
319
+ text: 'select all',
320
+ titleAttr: '1,000 rows limit',
321
+ action: function () {
322
+ total_rows = table.rows().count();
323
+ amount = total_rows < MAX_ROWS ? total_rows : MAX_ROWS;
324
+ table.rows({search: 'applied'}, [...Array(amount).keys()]).select();
325
+ if (table.rows({selected: true}).count() == 0)
326
+ table.rows([...Array(amount).keys()]).select();
327
+ }
328
+ },
329
+ {
330
+ text: 'select none',
331
+ action: function () {
332
+ table.rows().deselect();
333
+ }
334
+ },
335
+ {
336
+ text: '<i class="fas fa-folder-minus"></i> delete',
337
+ attr: {
338
+ id: 'cloud-del'
339
+ },
340
+ action: function () {
341
+ jQuery("#su-dialog-remove").dialog("open");
342
+ update = true;
343
+ }
344
+ },
345
+ {
346
+ text: 'load more',
347
+ action: function () {
348
+ if (table.rows().count() == MAX_ROWS || update)
349
+ listAllSu(page + 1);
350
+ }
351
+ },
352
+ ]
353
+ });
354
+
355
+ table.clear();
356
+
357
+ if (!fifuScriptCloudVars.signUpComplete)
358
+ fifu_disable_edition_buttons();
359
+ else
360
+ check_connection();
361
+
362
+ fifu_block();
363
+
364
+ jQuery.ajax({
365
+ method: "POST",
366
+ url: restUrl + 'featured-image-from-url/v2/list_all_su/',
367
+ data: {
368
+ "tfa": Cookies.get('fifu-tfa'),
369
+ "page": page,
370
+ },
371
+ async: true,
372
+ beforeSend: function (xhr) {
373
+ xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
374
+ },
375
+ success: function (data) {
376
+ code = data['code'];
377
+ if (code > 0) {
378
+ var bucket = data['bucket'];
379
+ var photo_data = data['photo_data'];
380
+ for (var i = 0; i < photo_data.length; i++) {
381
+ imgTag = '<img id="' + photo_data[i]['storage_id'] + '" data-src="' + photo_data[i]['proxy_url'] + '" style="border-radius:5%; height:56px; width:56px; object-fit:cover; text-align:center">';
382
+
383
+ if (photo_data[i]['is_category'])
384
+ local = 'category';
385
+ else if (photo_data[i]['meta_key'].includes('slider'))
386
+ local = 'slider';
387
+ else if (photo_data[i]['meta_key'].includes('url_'))
388
+ local = 'gallery';
389
+ else
390
+ local = 'featured';
391
+
392
+ table.row.add([
393
+ imgTag,
394
+ photo_data[i]['title'],
395
+ photo_data[i]['date'],
396
+ photo_data[i]['post_id'],
397
+ local,
398
+ photo_data[i]['storage_id'],
399
+ photo_data[i]['meta_id'],
400
+ photo_data[i]['meta_key'],
401
+ photo_data[i]['is_category'],
402
+ ]);
403
+ }
404
+ table.draw(true);
405
+ } else {
406
+ // not connected
407
+ if (data['code'] == -20) {
408
+ fifu_show_login();
409
+ fifu_disable_edition_buttons();
410
+ }
411
+ }
412
+ },
413
+ error: function (jqXHR, textStatus, errorThrown) {
414
+ console.log(jqXHR);
415
+ console.log(textStatus);
416
+ console.log(errorThrown);
417
+ },
418
+ complete: function (data) {
419
+ fifu_unblock();
420
+ }
421
+ });
422
+
423
+ jQuery("#su-dialog-remove").dialog({
424
+ autoOpen: false,
425
+ modal: true,
426
+ width: "400px",
427
+ buttons: {
428
+ "Delete": function () {
429
+ selected = table.rows({selected: true});
430
+ count = selected.count();
431
+
432
+ if (count == 0)
433
+ return;
434
+
435
+ var arr = [];
436
+ for (var i = 0; i < count; i++) {
437
+ data = selected.data()[i];
438
+ arr.push({
439
+ 'storage_id': data[5],
440
+ });
441
+ }
442
+ fifu_block();
443
+ jQuery(this).dialog("close");
444
+ jQuery.ajax({
445
+ method: "POST",
446
+ url: restUrl + 'featured-image-from-url/v2/delete/',
447
+ data: {
448
+ "selected": arr,
449
+ "tfa": Cookies.get('fifu-tfa'),
450
+ },
451
+ async: true,
452
+ beforeSend: function (xhr) {
453
+ xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
454
+ },
455
+ success: function (data) {
456
+ table.rows().deselect();
457
+
458
+ // not connected
459
+ if (data['code'] == -20) {
460
+ fifu_show_login();
461
+ fifu_disable_edition_buttons();
462
+ }
463
+ // else
464
+ // message(data, 'delete');
465
+ },
466
+ error: function (jqXHR, textStatus, errorThrown) {
467
+ console.log(jqXHR);
468
+ console.log(textStatus);
469
+ console.log(errorThrown);
470
+ },
471
+ complete: function (data) {
472
+ selected.remove().draw(false);
473
+
474
+ if (table.rows().count() == 0)
475
+ listAllSu(0);
476
+
477
+ jQuery(window).lazyLoadXT();
478
+ fifu_unblock();
479
+ }
480
+ });
481
+ },
482
+ Cancel: function () {
483
+ jQuery(this).dialog("close");
484
+ }
485
+ }
486
+ });
487
+
488
+ // limit number of rows selected
489
+ table.on('select', function (e, dt, type, ix) {
490
+ var selected = dt.rows({selected: true});
491
+ if (selected.count() > MAX_ROWS)
492
+ dt.rows(ix).deselect();
493
+ });
494
+
495
+ jQuery('div#removeTable_filter label input').on('keyup', function () {
496
+ jQuery(window).lazyLoadXT();
497
+ });
498
+ }
499
+
500
+ jQuery(document).ready(function ($) {
501
+ jQuery.extend(jQuery.lazyLoadXT, {
502
+ srcAttr: 'data-src',
503
+ visibleOnly: true,
504
+ updateEvent: 'load orientationchange resize scroll touchmove focus hover'
505
+ });
506
+ });
507
+
508
+ jQuery(window).on('ajaxComplete', function () {
509
+ jQuery(window).lazyLoadXT();
510
+ });
511
+
512
+ jQuery(document).on("click", "a.paginate_button, select, th.sorting_asc, th.sorting_desc", function () {
513
+ jQuery(window).lazyLoadXT();
514
+ });
515
+
516
+ jQuery(document).ready(function ($) {
517
+ jQuery('#addTable tbody').on('click', 'tr', function () {
518
+ jQuery(this).toggleClass('selected');
519
+ });
520
+ });
521
+
522
+ const MAX_ROWS = 1000;
523
+ const MAX_ROWS_BY_REQUEST = MAX_ROWS / 10;
524
+
525
+ function listAllFifu(page) {
526
+ console.log(page);
527
+ update = false;
528
+
529
+ var table = jQuery('#addTable').DataTable({
530
+ "language": {"emptyTable": "No images available"},
531
+ destroy: true,
532
+ "columns": [{"width": "64px"}, {"width": "100%"}, {"width": "64px"}, {"width": "64px"}, {"width": "64px"}],
533
+ "autoWidth": false,
534
+ "order": [[3, 'desc']],
535
+ dom: 'lfrtBip',
536
+ select: true,
537
+ buttons: [
538
+ {
539
+ text: 'select all',
540
+ titleAttr: '1,000 rows limit',
541
+ action: function () {
542
+ total_rows = table.rows().count();
543
+ amount = total_rows < MAX_ROWS ? total_rows : MAX_ROWS;
544
+ table.rows({search: 'applied'}, [...Array(amount).keys()]).select();
545
+ if (table.rows({selected: true}).count() == 0)
546
+ table.rows([...Array(amount).keys()]).select();
547
+ }
548
+ },
549
+ {
550
+ text: 'select none',
551
+ action: function () {
552
+ table.rows().deselect();
553
+ }
554
+ },
555
+ {
556
+ text: '<i class="fas fa-folder-plus"></i> upload',
557
+ attr: {
558
+ id: 'cloud-add'
559
+ },
560
+ action: function () {
561
+ addSu(table);
562
+ update = true;
563
+ }
564
+ },
565
+ {
566
+ text: 'load more',
567
+ action: function () {
568
+ if (table.rows().count() == MAX_ROWS || update)
569
+ listAllFifu(page + 1);
570
+ }
571
+ },
572
+ ]
573
+ });
574
+ table.clear();
575
+
576
+ if (!fifuScriptCloudVars.signUpComplete)
577
+ fifu_disable_edition_buttons();
578
+ else
579
+ check_connection();
580
+
581
+ fifu_block();
582
+ jQuery.ajax({
583
+ method: "POST",
584
+ url: restUrl + 'featured-image-from-url/v2/list_all_fifu/',
585
+ data: {
586
+ "page": page,
587
+ },
588
+ async: true,
589
+ beforeSend: function (xhr) {
590
+ xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
591
+ },
592
+ success: function (data) {
593
+ for (var i = 0; i < data.length; i++) {
594
+ imgTag = '<img id="' + data[i]['meta_id'] + '" data-src="' + data[i]['url'] + '" style="border-radius:5%; height:56px; width:56px; object-fit:cover; text-align:center">';
595
+
596
+ if (data[i]['category'] == 1)
597
+ local = 'category';
598
+ else if (data[i]['meta_key'].includes('slider'))
599
+ local = 'slider';
600
+ else if (data[i]['meta_key'].includes('url_'))
601
+ local = 'gallery';
602
+ else
603
+ local = 'featured';
604
+
605
+ table.row.add([
606
+ imgTag,
607
+ data[i]['post_title'],
608
+ data[i]['post_date'],
609
+ data[i]['post_id'],
610
+ local,
611
+ data[i]['url'],
612
+ data[i]['meta_key'],
613
+ data[i]['meta_id'],
614
+ data[i]['category'],
615
+ data[i]['video_url']
616
+ ]);
617
+ }
618
+ table.draw(true);
619
+ },
620
+ error: function (jqXHR, textStatus, errorThrown) {
621
+ console.log(jqXHR);
622
+ console.log(textStatus);
623
+ console.log(errorThrown);
624
+ },
625
+ complete: function (data) {
626
+ fifu_unblock();
627
+ }
628
+ });
629
+
630
+ // limit number of rows selected
631
+ table.on('select', function (e, dt, type, ix) {
632
+ var selected = dt.rows({selected: true});
633
+ if (selected.count() > MAX_ROWS)
634
+ dt.rows(ix).deselect();
635
+ });
636
+
637
+ jQuery('div#addTable_filter label input').on('keyup', function () {
638
+ jQuery(window).lazyLoadXT();
639
+ });
640
+ }
641
+
642
+ async function addSu(table) {
643
+ selected = table.rows({selected: true});
644
+ count = selected.count();
645
+
646
+ if (count == 0)
647
+ return;
648
+
649
+ fifu_block_progress();
650
+
651
+ var arr = [];
652
+ var finished = 0;
653
+ for (var i = 0; i < count; i++) {
654
+ data = selected.data()[i];
655
+ arr.push([
656
+ data[3], // post_id
657
+ data[5], // url
658
+ data[6], // meta_key
659
+ data[7], // meta_id
660
+ data[8], // category
661
+ data[9] // video_url
662
+ ]);
663
+ if (i + 1 == count || (i > 0 && i % MAX_ROWS_BY_REQUEST == 0)) {
664
+ jQuery.ajax({
665
+ method: "POST",
666
+ url: restUrl + 'featured-image-from-url/v2/create_thumbnails_list/',
667
+ data: {
668
+ "selected": arr,
669
+ "tfa": Cookies.get('fifu-tfa'),
670
+ },
671
+ async: true,
672
+ beforeSend: function (xhr) {
673
+ xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
674
+ },
675
+ success: function (data) {
676
+ // not connected
677
+ if (data['code'] == -20) {
678
+ fifu_show_login();
679
+ fifu_disable_edition_buttons();
680
+ }
681
+ // else
682
+ // message(data, 'add');
683
+ },
684
+ error: function (jqXHR, textStatus, errorThrown) {
685
+ console.log(jqXHR);
686
+ console.log(textStatus);
687
+ console.log(errorThrown);
688
+ },
689
+ complete: function (data) {
690
+ finished++;
691
+ progress = 100 * finished / (count / MAX_ROWS_BY_REQUEST);
692
+ jQuery('#progressBar').attr('value', progress);
693
+ jQuery('#progressBar').attr('text', progress);
694
+ if (finished >= count / MAX_ROWS_BY_REQUEST) {
695
+ if (data['responseJSON']['code'] == -24 || data['responseJSON']['code'] == -20) {
696
+ // none
697
+ } else {
698
+ // success
699
+ selected.remove().draw(false);
700
+
701
+ if (table.rows().count() == 0)
702
+ listAllFifu(0);
703
+ }
704
+ jQuery(window).lazyLoadXT();
705
+ fifu_unblock();
706
+ }
707
+ }
708
+ });
709
+ await sleep(2000);
710
+ arr = [];
711
+ }
712
+ }
713
+ }
714
+
715
+ function sleep(ms) {
716
+ return new Promise(resolve => setTimeout(resolve, ms));
717
+ }
718
+
719
+ function remove_sign_up() {
720
+ jQuery("#sign-up-box").remove();
721
+ }
722
+
723
  function message(data, box) {
724
  selector = "#" + box + "_response_message";
725
  jQuery(selector).css('background-color', data['color']);
731
  jQuery(selector).show();
732
  }
733
 
734
+ function confirmResetCredentials() {
735
+ if (jQuery("#su_login_email").val())
736
+ jQuery("#su-dialog-reset-credentials").dialog("open");
737
+ }
738
+
739
+ jQuery(function () {
740
+ jQuery("#su-dialog-reset-credentials").dialog({
741
+ autoOpen: false,
742
+ modal: true,
743
+ width: "300px",
744
+ buttons: {
745
+ OK: function () {
746
+ resetCredentials();
747
+ jQuery(this).dialog("close");
748
+ },
749
+ Cancel: function () {
750
+ jQuery(this).dialog("close");
751
+ }
752
+ },
753
+ open: function (event, ui) {
754
+ jQuery(this).parent().find('.ui-dialog-titlebar').empty();
755
+ jQuery(this).parent().find('.ui-dialog-titlebar').append('<i class="fa fa-exclamation-triangle"></i> Are you sure?');
756
+ jQuery(this).parent().children().children('.ui-dialog-titlebar-close').hide();
757
+ },
758
+ });
759
+
760
+ jQuery("#su-dialog-cancel").dialog({
761
+ autoOpen: false,
762
+ modal: true,
763
+ width: "400px",
764
+ buttons: {
765
+ "Yes": function () {
766
+ fifu_block();
767
+ jQuery(this).dialog("close");
768
+ jQuery.ajax({
769
+ method: "POST",
770
+ url: restUrl + 'featured-image-from-url/v2/cancel/',
771
+ data: {
772
+ "tfa": Cookies.get('fifu-tfa'),
773
+ },
774
+ async: true,
775
+ beforeSend: function (xhr) {
776
+ xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
777
+ },
778
+ success: function (data) {
779
+ // not connected
780
+ if (data['code'] == -20) {
781
+ fifu_show_login();
782
+ fifu_disable_edition_buttons();
783
+ } else
784
+ message(data, 'cancel');
785
+ },
786
+ error: function (jqXHR, textStatus, errorThrown) {
787
+ console.log(jqXHR);
788
+ console.log(textStatus);
789
+ console.log(errorThrown);
790
+ },
791
+ complete: function (data) {
792
+ fifu_unblock();
793
+ }
794
+ });
795
+ },
796
+ "No": function () {
797
+ jQuery(this).dialog("close");
798
+ }
799
+ }
800
+ });
801
+ });
802
+
803
  function fifu_block() {
804
  jQuery('#tabs-top').block({message: '', css: {backgroundColor: 'none', border: 'none', color: 'white'}});
805
  jQuery('button').attr('disabled', 'true');
806
  }
807
 
808
+ function fifu_block_progress() {
809
+ jQuery('#tabs-top').block({message: '<progress id="progressBar" max="100" value="0" style="width:100%;height:32px;background-color:#23282d"></progress>', css: {backgroundColor: 'none', border: 'none', color: 'white'}});
810
+ jQuery('button').attr('disabled', 'true');
811
+ }
812
+
813
  function fifu_unblock() {
814
  jQuery('#tabs-top').unblock();
815
  jQuery('button').removeAttr('disabled');
816
  }
817
+
818
+ function fifu_show_login() {
819
+ jQuery("#log-in-box").show();
820
+ jQuery("#log-out-box").hide();
821
+ jQuery("#payment-info-box").hide();
822
+ jQuery("#cancel-box").hide();
823
+ jQuery("#su_login_2fa").val('');
824
+ }
825
+
826
+ function fifu_hide_log_in() {
827
+ jQuery("#log-in-box").hide();
828
+ jQuery("#log-out-box").show();
829
+ jQuery("#payment-info-box").show();
830
+ jQuery("#cancel-box").show();
831
+ }
832
+
833
+ function fifu_disable_edition_buttons() {
834
+ jQuery("button#cloud-add").attr('disabled', 'true');
835
+ jQuery("button#cloud-del").attr('disabled', 'true');
836
+ data = new Array();
837
+ data['message'] = 'not connected';
838
+ data['color'] = '#ea4335';
839
+ message(data, 'add');
840
+ message(data, 'delete');
841
+ message(data, 'billing');
842
+ }
843
+
844
+ function fifu_enable_edition_buttons() {
845
+ jQuery("button#cloud-add").removeAttr('disabled');
846
+ jQuery("button#cloud-del").attr('disabled');
847
+ jQuery('#add_response_message').hide();
848
+ jQuery('#delete_response_message').hide();
849
+ jQuery('#billing_response_message').hide();
850
+ }
851
+
852
+ function listAllMediaLibrary(page) {
853
+ console.log(page);
854
+ update = false;
855
+
856
+ var table = jQuery('#mediaTable').DataTable({
857
+ "language": {"emptyTable": "No posts available"},
858
+ destroy: true,
859
+ "columns": [{"width": "64px"}, {"width": "100%"}, {"width": "64px"}, {"width": "64px"}, {"width": "64px"}],
860
+ "autoWidth": false,
861
+ "order": [[3, 'desc']],
862
+ dom: 'lfrtBip',
863
+ select: true,
864
+ buttons: [
865
+ {
866
+ text: 'select all',
867
+ titleAttr: '1,000 rows limit',
868
+ action: function () {
869
+ total_rows = table.rows().count();
870
+ amount = total_rows < MAX_ROWS ? total_rows : MAX_ROWS;
871
+ table.rows({search: 'applied'}, [...Array(amount).keys()]).select();
872
+ if (table.rows({selected: true}).count() == 0)
873
+ table.rows([...Array(amount).keys()]).select();
874
+ }
875
+ },
876
+ {
877
+ text: 'select none',
878
+ action: function () {
879
+ table.rows().deselect();
880
+ }
881
+ },
882
+ {
883
+ text: '<i class="fas fa-link"></i> link',
884
+ attr: {
885
+ id: 'cloud-link'
886
+ },
887
+ action: function () {
888
+ update = true;
889
+ }
890
+ },
891
+ {
892
+ text: 'load more',
893
+ action: function () {
894
+ if (table.rows().count() == MAX_ROWS || update)
895
+ listAllMediaLibrary(page + 1);
896
+ }
897
+ },
898
+ ]
899
+ });
900
+ table.buttons().disable();
901
+ table.clear();
902
+
903
+ fifu_block();
904
+ jQuery.ajax({
905
+ method: "POST",
906
+ url: restUrl + 'featured-image-from-url/v2/list_all_media_library/',
907
+ data: {
908
+ "page": page,
909
+ },
910
+ async: true,
911
+ beforeSend: function (xhr) {
912
+ xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
913
+ },
914
+ success: function (data) {
915
+ for (var i = 0; i < data.length; i++) {
916
+ imgTag = '<img id="' + data[i]['meta_id'] + '" data-src="' + data[i]['url'] + '" style="border-radius:5%; height:56px; width:56px; object-fit:cover; text-align:center">';
917
+ table.row.add([
918
+ imgTag,
919
+ data[i]['post_title'],
920
+ data[i]['post_date'],
921
+ data[i]['post_id'],
922
+ data[i]['gallery_ids'] ? data[i]['gallery_ids'].split(',').length : 0,
923
+ data[i]['url'],
924
+ data[i]['thumbnail_id'],
925
+ data[i]['gallery_ids'],
926
+ data[i]['category'],
927
+ ]);
928
+ }
929
+ table.draw(true);
930
+ },
931
+ error: function (jqXHR, textStatus, errorThrown) {
932
+ console.log(jqXHR);
933
+ console.log(textStatus);
934
+ console.log(errorThrown);
935
+ },
936
+ complete: function (data) {
937
+ fifu_unblock();
938
+ }
939
+ });
940
+
941
+ // limit number of rows selected
942
+ table.on('select', function (e, dt, type, ix) {
943
+ var selected = dt.rows({selected: true});
944
+ if (selected.count() > MAX_ROWS)
945
+ dt.rows(ix).deselect();
946
+ });
947
+
948
+ jQuery('div#addTable_filter label input').on('keyup', function () {
949
+ jQuery(window).lazyLoadXT();
950
+ });
951
+ }
952
+
953
+ function listDailyCount() {
954
+ var table = jQuery('#billingTable').DataTable({
955
+ "language": {"emptyTable": "No data available"},
956
+ destroy: true,
957
+ "columns": [{"width": "64px"}, {"width": "100%"}],
958
+ "autoWidth": false,
959
+ "order": [[0, 'desc']],
960
+ dom: 'lfrtBip',
961
+ select: false,
962
+ "iDisplayLength": 30,
963
+ });
964
+
965
+ table.clear();
966
+
967
+ if (!fifuScriptCloudVars.signUpComplete)
968
+ fifu_disable_edition_buttons();
969
+ else
970
+ check_connection();
971
+
972
+ fifu_block();
973
+
974
+ jQuery.ajax({
975
+ method: "POST",
976
+ url: restUrl + 'featured-image-from-url/v2/list_daily_count/',
977
+ data: {
978
+ "tfa": Cookies.get('fifu-tfa'),
979
+ },
980
+ async: true,
981
+ beforeSend: function (xhr) {
982
+ xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
983
+ },
984
+ success: function (data) {
985
+ code = data['code'];
986
+ if (code > 0) {
987
+ var dc_data = data['dc_data'];
988
+ jQuery('#billing-start').html(data['start_date'].split('+')[0]);
989
+ jQuery('#billing-end').html(data['end_date'].split('+')[0]);
990
+ jQuery('#billing-average').html(data['quantity']);
991
+ jQuery('#billing-cost').html('US$ ' + data['amount_due']);
992
+ for (var i = 0; i < dc_data.length; i++) {
993
+ table.row.add([
994
+ dc_data[i]['date'],
995
+ dc_data[i]['quantity'],
996
+ ]);
997
+ }
998
+
999
+ jQuery(".tier-row").remove();
1000
+ tiers = data['tiers'];
1001
+ current_tier = data['current_tier'];
1002
+ for (let key in tiers) {
1003
+ icon = (parseFloat(key) == current_tier) ? '<i class="fa-solid fa-arrow-left"></i>' : '';
1004
+ jQuery("#tiers-table").append(`<tr class="color tier-row"><td>${tiers[key]}</td><td>$${key}</td><td>${icon}</td></tr>`);
1005
+ }
1006
+
1007
+ table.draw(true);
1008
+ } else {
1009
+ // not connected
1010
+ if (data['code'] == -20) {
1011
+ fifu_show_login();
1012
+ fifu_disable_edition_buttons();
1013
+ message(data, 'billing');
1014
+ }
1015
+ }
1016
+ },
1017
+ error: function (jqXHR, textStatus, errorThrown) {
1018
+ console.log(jqXHR);
1019
+ console.log(textStatus);
1020
+ console.log(errorThrown);
1021
+ },
1022
+ complete: function (data) {
1023
+ fifu_unblock();
1024
+ }
1025
+ });
1026
+ }
admin/html/js/qrcode.js ADDED
@@ -0,0 +1 @@
 
1
+ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this.parsedData=[];for(var b=[],d=0,e=this.data.length;e>d;d++){var f=this.data.charCodeAt(d);f>65536?(b[0]=240|(1835008&f)>>>18,b[1]=128|(258048&f)>>>12,b[2]=128|(4032&f)>>>6,b[3]=128|63&f):f>2048?(b[0]=224|(61440&f)>>>12,b[1]=128|(4032&f)>>>6,b[2]=128|63&f):f>128?(b[0]=192|(1984&f)>>>6,b[1]=128|63&f):b[0]=f,this.parsedData=this.parsedData.concat(b)}this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function b(a,b){this.typeNumber=a,this.errorCorrectLevel=b,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function i(a,b){if(void 0==a.length)throw new Error(a.length+"/"+b);for(var c=0;c<a.length&&0==a[c];)c++;this.num=new Array(a.length-c+b);for(var d=0;d<a.length-c;d++)this.num[d]=a[d+c]}function j(a,b){this.totalCount=a,this.dataCount=b}function k(){this.buffer=[],this.length=0}function m(){return"undefined"!=typeof CanvasRenderingContext2D}function n(){var a=!1,b=navigator.userAgent;return/android/i.test(b)&&(a=!0,aMat=b.toString().match(/android ([0-9]\.[0-9])/i),aMat&&aMat[1]&&(a=parseFloat(aMat[1]))),a}function r(a,b){for(var c=1,e=s(a),f=0,g=l.length;g>=f;f++){var h=0;switch(b){case d.L:h=l[f][0];break;case d.M:h=l[f][1];break;case d.Q:h=l[f][2];break;case d.H:h=l[f][3]}if(h>=e)break;c++}if(c>l.length)throw new Error("Too long data");return c}function s(a){var b=encodeURI(a).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return b.length+(b.length!=a?3:0)}a.prototype={getLength:function(){return this.parsedData.length},write:function(a){for(var b=0,c=this.parsedData.length;c>b;b++)a.put(this.parsedData[b],8)}},b.prototype={addData:function(b){var c=new a(b);this.dataList.push(c),this.dataCache=null},isDark:function(a,b){if(0>a||this.moduleCount<=a||0>b||this.moduleCount<=b)throw new Error(a+","+b);return this.modules[a][b]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,c){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var d=0;d<this.moduleCount;d++){this.modules[d]=new Array(this.moduleCount);for(var e=0;e<this.moduleCount;e++)this.modules[d][e]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(a,c),this.typeNumber>=7&&this.setupTypeNumber(a),null==this.dataCache&&(this.dataCache=b.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,c)},setupPositionProbePattern:function(a,b){for(var c=-1;7>=c;c++)if(!(-1>=a+c||this.moduleCount<=a+c))for(var d=-1;7>=d;d++)-1>=b+d||this.moduleCount<=b+d||(this.modules[a+c][b+d]=c>=0&&6>=c&&(0==d||6==d)||d>=0&&6>=d&&(0==c||6==c)||c>=2&&4>=c&&d>=2&&4>=d?!0:!1)},getBestMaskPattern:function(){for(var a=0,b=0,c=0;8>c;c++){this.makeImpl(!0,c);var d=f.getLostPoint(this);(0==c||a>d)&&(a=d,b=c)}return b},createMovieClip:function(a,b,c){var d=a.createEmptyMovieClip(b,c),e=1;this.make();for(var f=0;f<this.modules.length;f++)for(var g=f*e,h=0;h<this.modules[f].length;h++){var i=h*e,j=this.modules[f][h];j&&(d.beginFill(0,100),d.moveTo(i,g),d.lineTo(i+e,g),d.lineTo(i+e,g+e),d.lineTo(i,g+e),d.endFill())}return d},setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++)null==this.modules[a][6]&&(this.modules[a][6]=0==a%2);for(var b=8;b<this.moduleCount-8;b++)null==this.modules[6][b]&&(this.modules[6][b]=0==b%2)},setupPositionAdjustPattern:function(){for(var a=f.getPatternPosition(this.typeNumber),b=0;b<a.length;b++)for(var c=0;c<a.length;c++){var d=a[b],e=a[c];if(null==this.modules[d][e])for(var g=-2;2>=g;g++)for(var h=-2;2>=h;h++)this.modules[d+g][e+h]=-2==g||2==g||-2==h||2==h||0==g&&0==h?!0:!1}},setupTypeNumber:function(a){for(var b=f.getBCHTypeNumber(this.typeNumber),c=0;18>c;c++){var d=!a&&1==(1&b>>c);this.modules[Math.floor(c/3)][c%3+this.moduleCount-8-3]=d}for(var c=0;18>c;c++){var d=!a&&1==(1&b>>c);this.modules[c%3+this.moduleCount-8-3][Math.floor(c/3)]=d}},setupTypeInfo:function(a,b){for(var c=this.errorCorrectLevel<<3|b,d=f.getBCHTypeInfo(c),e=0;15>e;e++){var g=!a&&1==(1&d>>e);6>e?this.modules[e][8]=g:8>e?this.modules[e+1][8]=g:this.modules[this.moduleCount-15+e][8]=g}for(var e=0;15>e;e++){var g=!a&&1==(1&d>>e);8>e?this.modules[8][this.moduleCount-e-1]=g:9>e?this.modules[8][15-e-1+1]=g:this.modules[8][15-e-1]=g}this.modules[this.moduleCount-8][8]=!a},mapData:function(a,b){for(var c=-1,d=this.moduleCount-1,e=7,g=0,h=this.moduleCount-1;h>0;h-=2)for(6==h&&h--;;){for(var i=0;2>i;i++)if(null==this.modules[d][h-i]){var j=!1;g<a.length&&(j=1==(1&a[g]>>>e));var k=f.getMask(b,d,h-i);k&&(j=!j),this.modules[d][h-i]=j,e--,-1==e&&(g++,e=7)}if(d+=c,0>d||this.moduleCount<=d){d-=c,c=-c;break}}}},b.PAD0=236,b.PAD1=17,b.createData=function(a,c,d){for(var e=j.getRSBlocks(a,c),g=new k,h=0;h<d.length;h++){var i=d[h];g.put(i.mode,4),g.put(i.getLength(),f.getLengthInBits(i.mode,a)),i.write(g)}for(var l=0,h=0;h<e.length;h++)l+=e[h].dataCount;if(g.getLengthInBits()>8*l)throw new Error("code length overflow. ("+g.getLengthInBits()+">"+8*l+")");for(g.getLengthInBits()+4<=8*l&&g.put(0,4);0!=g.getLengthInBits()%8;)g.putBit(!1);for(;;){if(g.getLengthInBits()>=8*l)break;if(g.put(b.PAD0,8),g.getLengthInBits()>=8*l)break;g.put(b.PAD1,8)}return b.createBytes(g,e)},b.createBytes=function(a,b){for(var c=0,d=0,e=0,g=new Array(b.length),h=new Array(b.length),j=0;j<b.length;j++){var k=b[j].dataCount,l=b[j].totalCount-k;d=Math.max(d,k),e=Math.max(e,l),g[j]=new Array(k);for(var m=0;m<g[j].length;m++)g[j][m]=255&a.buffer[m+c];c+=k;var n=f.getErrorCorrectPolynomial(l),o=new i(g[j],n.getLength()-1),p=o.mod(n);h[j]=new Array(n.getLength()-1);for(var m=0;m<h[j].length;m++){var q=m+p.getLength()-h[j].length;h[j][m]=q>=0?p.get(q):0}}for(var r=0,m=0;m<b.length;m++)r+=b[m].totalCount;for(var s=new Array(r),t=0,m=0;d>m;m++)for(var j=0;j<b.length;j++)m<g[j].length&&(s[t++]=g[j][m]);for(var m=0;e>m;m++)for(var j=0;j<b.length;j++)m<h[j].length&&(s[t++]=h[j][m]);return s};for(var c={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},d={L:1,M:0,Q:3,H:2},e={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},f={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(a){for(var b=a<<10;f.getBCHDigit(b)-f.getBCHDigit(f.G15)>=0;)b^=f.G15<<f.getBCHDigit(b)-f.getBCHDigit(f.G15);return(a<<10|b)^f.G15_MASK},getBCHTypeNumber:function(a){for(var b=a<<12;f.getBCHDigit(b)-f.getBCHDigit(f.G18)>=0;)b^=f.G18<<f.getBCHDigit(b)-f.getBCHDigit(f.G18);return a<<12|b},getBCHDigit:function(a){for(var b=0;0!=a;)b++,a>>>=1;return b},getPatternPosition:function(a){return f.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,b,c){switch(a){case e.PATTERN000:return 0==(b+c)%2;case e.PATTERN001:return 0==b%2;case e.PATTERN010:return 0==c%3;case e.PATTERN011:return 0==(b+c)%3;case e.PATTERN100:return 0==(Math.floor(b/2)+Math.floor(c/3))%2;case e.PATTERN101:return 0==b*c%2+b*c%3;case e.PATTERN110:return 0==(b*c%2+b*c%3)%2;case e.PATTERN111:return 0==(b*c%3+(b+c)%2)%2;default:throw new Error("bad maskPattern:"+a)}},getErrorCorrectPolynomial:function(a){for(var b=new i([1],0),c=0;a>c;c++)b=b.multiply(new i([1,g.gexp(c)],0));return b},getLengthInBits:function(a,b){if(b>=1&&10>b)switch(a){case c.MODE_NUMBER:return 10;case c.MODE_ALPHA_NUM:return 9;case c.MODE_8BIT_BYTE:return 8;case c.MODE_KANJI:return 8;default:throw new Error("mode:"+a)}else if(27>b)switch(a){case c.MODE_NUMBER:return 12;case c.MODE_ALPHA_NUM:return 11;case c.MODE_8BIT_BYTE:return 16;case c.MODE_KANJI:return 10;default:throw new Error("mode:"+a)}else{if(!(41>b))throw new Error("type:"+b);switch(a){case c.MODE_NUMBER:return 14;case c.MODE_ALPHA_NUM:return 13;case c.MODE_8BIT_BYTE:return 16;case c.MODE_KANJI:return 12;default:throw new Error("mode:"+a)}}},getLostPoint:function(a){for(var b=a.getModuleCount(),c=0,d=0;b>d;d++)for(var e=0;b>e;e++){for(var f=0,g=a.isDark(d,e),h=-1;1>=h;h++)if(!(0>d+h||d+h>=b))for(var i=-1;1>=i;i++)0>e+i||e+i>=b||(0!=h||0!=i)&&g==a.isDark(d+h,e+i)&&f++;f>5&&(c+=3+f-5)}for(var d=0;b-1>d;d++)for(var e=0;b-1>e;e++){var j=0;a.isDark(d,e)&&j++,a.isDark(d+1,e)&&j++,a.isDark(d,e+1)&&j++,a.isDark(d+1,e+1)&&j++,(0==j||4==j)&&(c+=3)}for(var d=0;b>d;d++)for(var e=0;b-6>e;e++)a.isDark(d,e)&&!a.isDark(d,e+1)&&a.isDark(d,e+2)&&a.isDark(d,e+3)&&a.isDark(d,e+4)&&!a.isDark(d,e+5)&&a.isDark(d,e+6)&&(c+=40);for(var e=0;b>e;e++)for(var d=0;b-6>d;d++)a.isDark(d,e)&&!a.isDark(d+1,e)&&a.isDark(d+2,e)&&a.isDark(d+3,e)&&a.isDark(d+4,e)&&!a.isDark(d+5,e)&&a.isDark(d+6,e)&&(c+=40);for(var k=0,e=0;b>e;e++)for(var d=0;b>d;d++)a.isDark(d,e)&&k++;var l=Math.abs(100*k/b/b-50)/5;return c+=10*l}},g={glog:function(a){if(1>a)throw new Error("glog("+a+")");return g.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;a>=256;)a-=255;return g.EXP_TABLE[a]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},h=0;8>h;h++)g.EXP_TABLE[h]=1<<h;for(var h=8;256>h;h++)g.EXP_TABLE[h]=g.EXP_TABLE[h-4]^g.EXP_TABLE[h-5]^g.EXP_TABLE[h-6]^g.EXP_TABLE[h-8];for(var h=0;255>h;h++)g.LOG_TABLE[g.EXP_TABLE[h]]=h;i.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var b=new Array(this.getLength()+a.getLength()-1),c=0;c<this.getLength();c++)for(var d=0;d<a.getLength();d++)b[c+d]^=g.gexp(g.glog(this.get(c))+g.glog(a.get(d)));return new i(b,0)},mod:function(a){if(this.getLength()-a.getLength()<0)return this;for(var b=g.glog(this.get(0))-g.glog(a.get(0)),c=new Array(this.getLength()),d=0;d<this.getLength();d++)c[d]=this.get(d);for(var d=0;d<a.getLength();d++)c[d]^=g.gexp(g.glog(a.get(d))+b);return new i(c,0).mod(a)}},j.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],j.getRSBlocks=function(a,b){var c=j.getRsBlockTable(a,b);if(void 0==c)throw new Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+b);for(var d=c.length/3,e=[],f=0;d>f;f++)for(var g=c[3*f+0],h=c[3*f+1],i=c[3*f+2],k=0;g>k;k++)e.push(new j(h,i));return e},j.getRsBlockTable=function(a,b){switch(b){case d.L:return j.RS_BLOCK_TABLE[4*(a-1)+0];case d.M:return j.RS_BLOCK_TABLE[4*(a-1)+1];case d.Q:return j.RS_BLOCK_TABLE[4*(a-1)+2];case d.H:return j.RS_BLOCK_TABLE[4*(a-1)+3];default:return void 0}},k.prototype={get:function(a){var b=Math.floor(a/8);return 1==(1&this.buffer[b]>>>7-a%8)},put:function(a,b){for(var c=0;b>c;c++)this.putBit(1==(1&a>>>b-c-1))},getLengthInBits:function(){return this.length},putBit:function(a){var b=Math.floor(this.length/8);this.buffer.length<=b&&this.buffer.push(0),a&&(this.buffer[b]|=128>>>this.length%8),this.length++}};var l=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]],o=function(){var a=function(a,b){this._el=a,this._htOption=b};return a.prototype.draw=function(a){function g(a,b){var c=document.createElementNS("http://www.w3.org/2000/svg",a);for(var d in b)b.hasOwnProperty(d)&&c.setAttribute(d,b[d]);return c}var b=this._htOption,c=this._el,d=a.getModuleCount();Math.floor(b.width/d),Math.floor(b.height/d),this.clear();var h=g("svg",{viewBox:"0 0 "+String(d)+" "+String(d),width:"100%",height:"100%",fill:b.colorLight});h.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"),c.appendChild(h),h.appendChild(g("rect",{fill:b.colorDark,width:"1",height:"1",id:"template"}));for(var i=0;d>i;i++)for(var j=0;d>j;j++)if(a.isDark(i,j)){var k=g("use",{x:String(i),y:String(j)});k.setAttributeNS("http://www.w3.org/1999/xlink","href","#template"),h.appendChild(k)}},a.prototype.clear=function(){for(;this._el.hasChildNodes();)this._el.removeChild(this._el.lastChild)},a}(),p="svg"===document.documentElement.tagName.toLowerCase(),q=p?o:m()?function(){function a(){this._elImage.src=this._elCanvas.toDataURL("image/png"),this._elImage.style.display="block",this._elCanvas.style.display="none"}function d(a,b){var c=this;if(c._fFail=b,c._fSuccess=a,null===c._bSupportDataURI){var d=document.createElement("img"),e=function(){c._bSupportDataURI=!1,c._fFail&&_fFail.call(c)},f=function(){c._bSupportDataURI=!0,c._fSuccess&&c._fSuccess.call(c)};return d.onabort=e,d.onerror=e,d.onload=f,d.src="data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==",void 0}c._bSupportDataURI===!0&&c._fSuccess?c._fSuccess.call(c):c._bSupportDataURI===!1&&c._fFail&&c._fFail.call(c)}if(this._android&&this._android<=2.1){var b=1/window.devicePixelRatio,c=CanvasRenderingContext2D.prototype.drawImage;CanvasRenderingContext2D.prototype.drawImage=function(a,d,e,f,g,h,i,j){if("nodeName"in a&&/img/i.test(a.nodeName))for(var l=arguments.length-1;l>=1;l--)arguments[l]=arguments[l]*b;else"undefined"==typeof j&&(arguments[1]*=b,arguments[2]*=b,arguments[3]*=b,arguments[4]*=b);c.apply(this,arguments)}}var e=function(a,b){this._bIsPainted=!1,this._android=n(),this._htOption=b,this._elCanvas=document.createElement("canvas"),this._elCanvas.width=b.width,this._elCanvas.height=b.height,a.appendChild(this._elCanvas),this._el=a,this._oContext=this._elCanvas.getContext("2d"),this._bIsPainted=!1,this._elImage=document.createElement("img"),this._elImage.style.display="none",this._el.appendChild(this._elImage),this._bSupportDataURI=null};return e.prototype.draw=function(a){var b=this._elImage,c=this._oContext,d=this._htOption,e=a.getModuleCount(),f=d.width/e,g=d.height/e,h=Math.round(f),i=Math.round(g);b.style.display="none",this.clear();for(var j=0;e>j;j++)for(var k=0;e>k;k++){var l=a.isDark(j,k),m=k*f,n=j*g;c.strokeStyle=l?d.colorDark:d.colorLight,c.lineWidth=1,c.fillStyle=l?d.colorDark:d.colorLight,c.fillRect(m,n,f,g),c.strokeRect(Math.floor(m)+.5,Math.floor(n)+.5,h,i),c.strokeRect(Math.ceil(m)-.5,Math.ceil(n)-.5,h,i)}this._bIsPainted=!0},e.prototype.makeImage=function(){this._bIsPainted&&d.call(this,a)},e.prototype.isPainted=function(){return this._bIsPainted},e.prototype.clear=function(){this._oContext.clearRect(0,0,this._elCanvas.width,this._elCanvas.height),this._bIsPainted=!1},e.prototype.round=function(a){return a?Math.floor(1e3*a)/1e3:a},e}():function(){var a=function(a,b){this._el=a,this._htOption=b};return a.prototype.draw=function(a){for(var b=this._htOption,c=this._el,d=a.getModuleCount(),e=Math.floor(b.width/d),f=Math.floor(b.height/d),g=['<table style="border:0;border-collapse:collapse;">'],h=0;d>h;h++){g.push("<tr>");for(var i=0;d>i;i++)g.push('<td style="border:0;border-collapse:collapse;padding:0;margin:0;width:'+e+"px;height:"+f+"px;background-color:"+(a.isDark(h,i)?b.colorDark:b.colorLight)+';"></td>');g.push("</tr>")}g.push("</table>"),c.innerHTML=g.join("");var j=c.childNodes[0],k=(b.width-j.offsetWidth)/2,l=(b.height-j.offsetHeight)/2;k>0&&l>0&&(j.style.margin=l+"px "+k+"px")},a.prototype.clear=function(){this._el.innerHTML=""},a}();QRCode=function(a,b){if(this._htOption={width:256,height:256,typeNumber:4,colorDark:"#000000",colorLight:"#ffffff",correctLevel:d.H},"string"==typeof b&&(b={text:b}),b)for(var c in b)this._htOption[c]=b[c];"string"==typeof a&&(a=document.getElementById(a)),this._android=n(),this._el=a,this._oQRCode=null,this._oDrawing=new q(this._el,this._htOption),this._htOption.text&&this.makeCode(this._htOption.text)},QRCode.prototype.makeCode=function(a){this._oQRCode=new b(r(a,this._htOption.correctLevel),this._htOption.correctLevel),this._oQRCode.addData(a),this._oQRCode.make(),this._el.title=a,this._oDrawing.draw(this._oQRCode),this.makeImage()},QRCode.prototype.makeImage=function(){"function"==typeof this._oDrawing.makeImage&&(!this._android||this._android>=3)&&this._oDrawing.makeImage()},QRCode.prototype.clear=function(){this._oDrawing.clear()},QRCode.CorrectLevel=d}();
admin/html/menu.html CHANGED
@@ -37,6 +37,7 @@
37
  id="fifu_form_column"
38
  action="javascript:void(0)"
39
  method="post">
 
40
  <input id="fifu_input_column_height" type="text" name="fifu_input_column_height" value="<?php echo $column_height; ?>" placeholder="<?php $fifu['detail']['eg']() ?> 64" size="4">
41
  <input type="submit" value="<?php $fifu['button']['submit']() ?>" >
42
  </form>
@@ -52,6 +53,7 @@
52
  id="fifu_form_reset"
53
  action="javascript:void(0)"
54
  method="post">
 
55
  <table>
56
  <tr>
57
  <td>
@@ -1468,7 +1470,7 @@
1468
  <?php $fifu['title']['play']() ?>
1469
  </th>
1470
  <th>
1471
- <?php $fifu['play']['hide']() ?>
1472
  </th>
1473
  <th>
1474
  wp fifu video --play-hide &lt;toggle&gt;
@@ -1477,6 +1479,23 @@
1477
  on, off
1478
  </th>
1479
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1480
  <tr class="color">
1481
  <th>
1482
  <?php $fifu['tab']['video']() ?>
@@ -1597,44 +1616,48 @@
1597
  <th>
1598
  <?php $fifu['title']['mute']() ?>
1599
  </th>
1600
- <th></th>
1601
  <th>
1602
- wp fifu video --mute &lt;toggle&gt;
 
 
 
1603
  </th>
1604
  <th>
1605
  on, off
1606
  </th>
1607
- </tr>
1608
  <tr class="color">
1609
  <th>
1610
  <?php $fifu['tab']['video']() ?>
1611
  </th>
1612
  <th>
1613
- <?php $fifu['title']['background']() ?>
1614
  </th>
1615
- <th></th>
1616
  <th>
1617
- wp fifu video --background &lt;toggle&gt;
 
 
 
1618
  </th>
1619
  <th>
1620
  on, off
1621
  </th>
1622
- </tr>
1623
  <tr class="color">
1624
  <th>
1625
  <?php $fifu['tab']['video']() ?>
1626
  </th>
1627
  <th>
1628
- <?php $fifu['title']['related']() ?>
1629
  </th>
1630
  <th></th>
1631
  <th>
1632
- wp fifu video --related &lt;toggle&gt;
1633
  </th>
1634
  <th>
1635
  on, off
1636
  </th>
1637
- </tr>
1638
  <tr class="color">
1639
  <th>
1640
  <?php $fifu['tab']['video']() ?>
@@ -2215,6 +2238,7 @@
2215
  id="fifu_form_spinner_nth"
2216
  action="javascript:void(0)"
2217
  method="post">
 
2218
  <input id="fifu_input_spinner_nth"
2219
  name="fifu_input_spinner_nth"
2220
  value="<?php echo $nth_image; ?>"
@@ -2234,6 +2258,7 @@
2234
  id="fifu_form_get_first"
2235
  action="javascript:void(0)"
2236
  method="post">
 
2237
  <input
2238
  type="submit"
2239
  href="javascript:void(0)"
@@ -2260,6 +2285,7 @@
2260
  id="fifu_form_pop_first"
2261
  action="javascript:void(0)"
2262
  method="post">
 
2263
  <input
2264
  type="submit"
2265
  href="javascript:void(0)"
@@ -2286,6 +2312,7 @@
2286
  id="fifu_form_query_strings"
2287
  action="javascript:void(0)"
2288
  method="post">
 
2289
  <input
2290
  type="submit"
2291
  href="javascript:void(0)"
@@ -2313,6 +2340,7 @@
2313
  id="fifu_form_ovw_first"
2314
  action="javascript:void(0)"
2315
  method="post">
 
2316
  <input
2317
  type="submit"
2318
  href="javascript:void(0)"
@@ -2339,6 +2367,7 @@
2339
  id="fifu_form_decode"
2340
  action="javascript:void(0)"
2341
  method="post">
 
2342
  <input
2343
  type="submit"
2344
  href="javascript:void(0)"
@@ -2366,6 +2395,7 @@
2366
  id="fifu_form_check"
2367
  action="javascript:void(0)"
2368
  method="post">
 
2369
  <input
2370
  type="submit"
2371
  href="javascript:void(0)"
@@ -2396,6 +2426,7 @@
2396
  id="fifu_form_skip"
2397
  action="javascript:void(0)"
2398
  method="post">
 
2399
  <input id="fifu_input_skip"
2400
  type="text"
2401
  name="fifu_input_skip"
@@ -2501,53 +2532,43 @@
2501
  </table>
2502
  </div>
2503
  <div id="tabsAutoSet-b">
2504
- <form
2505
- id="fifu_form_auto_set_dimensions"
2506
- action="javascript:void(0)"
2507
- method="post">
2508
- <table>
2509
- <tr style="text-align:center">
2510
- <th>
2511
- <input id="fifu_input_auto_set_width"
2512
- name="fifu_input_auto_set_width"
2513
- step="10"
2514
- max="10000"
2515
- size="5">
2516
- </th>
2517
- <th>
2518
- <?php $fifu['auto']['filter']['width']() ?>
2519
- </th>
2520
- </tr>
2521
- <tr style="text-align:center">
2522
- <th>
2523
- <input id="fifu_input_auto_set_height"
2524
- name="fifu_input_auto_set_height"
2525
- step="10"
2526
- max="10000"
2527
- size="5">
2528
- </th>
2529
- <th>
2530
- <?php $fifu['auto']['filter']['height']() ?>
2531
- </th>
2532
- </tr>
2533
- <tr>
2534
- <th>
2535
- <input type="submit" value="<?php $fifu['button']['submit']() ?>" disabled style="width:85px">
2536
- </th>
2537
- <th></th>
2538
- </tr>
2539
- </table>
2540
- </form>
2541
  </div>
2542
  <div id="tabsAutoSet-c">
2543
  <?php $fifu['auto']['filter']['blocklist']() ?>
2544
- <form
2545
- id="fifu_form_auto_set_blocklist"
2546
- action="javascript:void(0)"
2547
- method="post">
2548
- <textarea id="fifu_input_auto_set_blocklist" name="fifu_input_auto_set_blocklist" style="width:100%;height:400px;resize:none;background-color:white;" placeholder="www.horribleimages.com&#10;inappropriateimages.com&#10;nakedpeopleimages.com&#10;manyadvertisements.com&#10;anysiteyoureallyhate.com"></textarea>
2549
- <input style="float: right;" type="submit" value="<?php $fifu['button']['submit']() ?>" disabled>
2550
- </form>
2551
  </div>
2552
  <div id="tabsAutoSet-d">
2553
  <?php $fifu['auto']['cpt']['desc']() ?>
@@ -2839,6 +2860,7 @@
2839
  id="fifu_form_auto_alt"
2840
  action="javascript:void(0)"
2841
  method="post">
 
2842
  <input
2843
  type="submit"
2844
  href="javascript:void(0)"
@@ -2866,6 +2888,7 @@
2866
  id="fifu_form_dynamic_alt"
2867
  action="javascript:void(0)"
2868
  method="post">
 
2869
  <input
2870
  type="submit"
2871
  href="javascript:void(0)"
@@ -2904,6 +2927,7 @@
2904
  id="fifu_form_hide_page"
2905
  action="javascript:void(0)"
2906
  method="post">
 
2907
  <input
2908
  type="submit"
2909
  href="javascript:void(0)"
@@ -2930,6 +2954,7 @@
2930
  id="fifu_form_hide_post"
2931
  action="javascript:void(0)"
2932
  method="post">
 
2933
  <input
2934
  type="submit"
2935
  href="javascript:void(0)"
@@ -2956,6 +2981,7 @@
2956
  id="fifu_form_hide_cpt"
2957
  action="javascript:void(0)"
2958
  method="post">
 
2959
  <input
2960
  type="submit"
2961
  href="javascript:void(0)"
@@ -2999,6 +3025,7 @@
2999
  id="fifu_form_default_url"
3000
  action="javascript:void(0)"
3001
  method="post">
 
3002
  <input id="fifu_input_default_url"
3003
  type="text"
3004
  name="fifu_input_default_url"
@@ -3015,6 +3042,7 @@
3015
  id="fifu_form_default_cpt"
3016
  action="javascript:void(0)"
3017
  method="post">
 
3018
  <input
3019
  id="fifu_input_default_cpt"
3020
  type="text"
@@ -3040,6 +3068,7 @@
3040
  id="fifu_form_enable_default_url"
3041
  action="javascript:void(0)"
3042
  method="post">
 
3043
  <input
3044
  type="submit"
3045
  href="javascript:void(0)"
@@ -3072,7 +3101,7 @@
3072
  id="fifu_form_content_page"
3073
  action="javascript:void(0)"
3074
  method="post">
3075
-
3076
  <input
3077
  type="submit"
3078
  href="javascript:void(0)"
@@ -3100,7 +3129,7 @@
3100
  id="fifu_form_content"
3101
  action="javascript:void(0)"
3102
  method="post">
3103
-
3104
  <input
3105
  type="submit"
3106
  href="javascript:void(0)"
@@ -3128,7 +3157,7 @@
3128
  id="fifu_form_content_cpt"
3129
  action="javascript:void(0)"
3130
  method="post">
3131
-
3132
  <input
3133
  type="submit"
3134
  href="javascript:void(0)"
@@ -3268,16 +3297,10 @@
3268
  <td><b>fifu_dev_upload_all_images()</b></td>
3269
  <td><?php $fifu['media']['dev']() ?></td>
3270
  <td>
3271
- <form
3272
- id="fifu_form_upload_proxy"
3273
- action="javascript:void(0)"
3274
- method="post">
3275
-
3276
- <input
3277
- type="submit"
3278
- value="<?php $fifu['media']['run']() ?>"
3279
- disabled>
3280
- </form>
3281
  </td>
3282
  </tr>
3283
  </table>
@@ -3589,6 +3612,7 @@
3589
  id="fifu_form_fake"
3590
  action="javascript:void(0)"
3591
  method="post">
 
3592
  <input
3593
  type="submit"
3594
  href="javascript:void(0)"
@@ -3635,6 +3659,7 @@
3635
  id="fifu_form_data_clean"
3636
  action="javascript:void(0)"
3637
  method="post">
 
3638
  <input
3639
  type="submit"
3640
  href="javascript:void(0)"
@@ -3738,7 +3763,7 @@
3738
  id="fifu_form_db"
3739
  action="javascript:void(0)"
3740
  method="post">
3741
-
3742
  <table style="text-align:left">
3743
  <tr>
3744
  <th>
@@ -3779,6 +3804,7 @@
3779
  id="fifu_form_confirm_delete_all"
3780
  action="javascript:void(0)"
3781
  method="post">
 
3782
  <input
3783
  type="submit"
3784
  href="javascript:void(0)"
@@ -3806,6 +3832,7 @@
3806
  id="fifu_form_run_delete_all"
3807
  action="javascript:void(0)"
3808
  method="post">
 
3809
  <input
3810
  type="submit"
3811
  href="javascript:void(0)"
@@ -3848,27 +3875,16 @@
3848
  <div id="tabs-0">
3849
  <table style="text-align:left">
3850
  <tr>
3851
- <th>
3852
- <form
3853
- id="fifu_form_shortcode"
3854
- action="javascript:void(0)"
3855
- method="post">
3856
- <input
3857
- type="submit"
3858
- href="javascript:void(0)"
3859
- id="fifu_toggle_shortcode"
3860
- onclick="javascript:void(0)"
3861
- name="fifu_toggle_shortcode"
3862
- class="toggleoff"
3863
- value=""
3864
- style="display:block;border:none">
3865
-
3866
- <input
3867
- type="hidden"
3868
- id="fifu_input_shortcode"
3869
- name="fifu_input_shortcode"
3870
- value="" >
3871
- </form>
3872
  </th>
3873
  </tr>
3874
  </table>
@@ -3971,27 +3987,15 @@
3971
  <br>
3972
  <br>
3973
  <div id="tabsVideo-a">
3974
- <form
3975
- id="fifu_form_video"
3976
- action="javascript:void(0)"
3977
- method="post">
3978
-
3979
- <input
3980
- type="submit"
3981
- href="javascript:void(0)"
3982
- id="fifu_toggle_video"
3983
- onclick="javascript:void(0)"
3984
- name="fifu_toggle_video"
3985
- class="toggleoff"
3986
- value=""
3987
- style="display:block;border:none">
3988
-
3989
- <input
3990
- type="hidden"
3991
- id="fifu_input_video"
3992
- name="fifu_input_video"
3993
- value="" >
3994
- </form>
3995
  </div>
3996
 
3997
  <div id="tabsVideo-b">
@@ -4108,7 +4112,7 @@
4108
  <?php $fifu['word']['zindex']() ?>
4109
  <br>
4110
  <input
4111
- id="fifu_form_video_zindex"
4112
  type="text"
4113
  name="fifu_input_video_zindex"
4114
  value=""
@@ -4116,15 +4120,36 @@
4116
  <br>
4117
  <input type="submit" value="<?php $fifu['button']['ok']() ?>" style="width:85px" disabled>
4118
  </th>
4119
- <th>
4120
- <br>
4121
- <input
4122
- type="submit"
4123
- href="javascript:void(0)"
4124
- class="toggleoff"
4125
- value=""
4126
- style="display:block;border:none">
4127
- <?php $fifu['play']['hide']() ?><br>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4128
  </th>
4129
  </tr>
4130
  </table>
@@ -4276,19 +4301,10 @@
4276
  value=""
4277
  style="display:block;border:none">
4278
  </th>
 
 
 
4279
  </tr>
4280
- </table>
4281
- </div>
4282
-
4283
-
4284
- <div class="box">
4285
- <div class="fifu-pro"><div class="fifu-pro-out"><a class="fifu-pro-link" href="https://fifu.app/" target="_blank" title="Unlock all features"><h4 class="fifu-pro-text"><span class="dashicons dashicons-lock fifu-pro-icon"></span>PRO</h4></a></div></div>
4286
- <h2><?php $fifu['title']['background']() ?></h2>
4287
- <div class="greybox" id="grad2">
4288
- <?php $fifu['background']['desc']() ?>
4289
- </div>
4290
- <br>
4291
- <table style="text-align:left">
4292
  <tr>
4293
  <th>
4294
  <input
@@ -4299,17 +4315,18 @@
4299
  style="display:block;border:none">
4300
  </th>
4301
  <th>
4302
- <?php $fifu['player']['vimeo']() ?>
4303
  </th>
4304
  </tr>
4305
  </table>
4306
  </div>
4307
 
 
4308
  <div class="box">
4309
  <div class="fifu-pro"><div class="fifu-pro-out"><a class="fifu-pro-link" href="https://fifu.app/" target="_blank" title="Unlock all features"><h4 class="fifu-pro-text"><span class="dashicons dashicons-lock fifu-pro-icon"></span>PRO</h4></a></div></div>
4310
- <h2><?php $fifu['title']['related']() ?></h2>
4311
  <div class="greybox" id="grad2">
4312
- <?php $fifu['related']['desc']() ?>
4313
  </div>
4314
  <br>
4315
  <table style="text-align:left">
@@ -4323,7 +4340,7 @@
4323
  style="display:block;border:none">
4324
  </th>
4325
  <th>
4326
- <?php $fifu['player']['youtube']() ?>
4327
  </th>
4328
  </tr>
4329
  </table>
@@ -4606,7 +4623,7 @@
4606
  id="fifu_form_social"
4607
  action="javascript:void(0)"
4608
  method="post">
4609
-
4610
  <input
4611
  type="submit"
4612
  href="javascript:void(0)"
@@ -4634,7 +4651,7 @@
4634
  id="fifu_form_social_image_only"
4635
  action="javascript:void(0)"
4636
  method="post">
4637
-
4638
  <input
4639
  type="submit"
4640
  href="javascript:void(0)"
@@ -4815,7 +4832,7 @@
4815
  id="fifu_form_photon"
4816
  action="javascript:void(0)"
4817
  method="post">
4818
-
4819
  <input
4820
  type="submit"
4821
  href="javascript:void(0)"
@@ -4841,7 +4858,7 @@
4841
  id="fifu_form_cdn_social"
4842
  action="javascript:void(0)"
4843
  method="post">
4844
-
4845
  <input
4846
  type="submit"
4847
  href="javascript:void(0)"
@@ -4867,7 +4884,7 @@
4867
  id="fifu_form_cdn_crop"
4868
  action="javascript:void(0)"
4869
  method="post">
4870
-
4871
  <input
4872
  type="submit"
4873
  href="javascript:void(0)"
@@ -4893,7 +4910,7 @@
4893
  id="fifu_form_cdn_content"
4894
  action="javascript:void(0)"
4895
  method="post">
4896
-
4897
  <input
4898
  type="submit"
4899
  href="javascript:void(0)"
@@ -4927,6 +4944,7 @@
4927
  id="fifu_form_lazy"
4928
  action="javascript:void(0)"
4929
  method="post">
 
4930
  <input
4931
  type="submit"
4932
  href="javascript:void(0)"
@@ -5243,6 +5261,7 @@
5243
  id="fifu_form_wc_lbox"
5244
  action="javascript:void(0)"
5245
  method="post">
 
5246
  <input
5247
  type="submit"
5248
  href="javascript:void(0)"
@@ -5270,6 +5289,7 @@
5270
  id="fifu_form_wc_zoom"
5271
  action="javascript:void(0)"
5272
  method="post">
 
5273
  <input
5274
  type="submit"
5275
  href="javascript:void(0)"
@@ -5307,6 +5327,7 @@
5307
  id="fifu_form_grid_category"
5308
  action="javascript:void(0)"
5309
  method="post">
 
5310
  <input
5311
  type="submit"
5312
  href="javascript:void(0)"
37
  id="fifu_form_column"
38
  action="javascript:void(0)"
39
  method="post">
40
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_column'); ?>
41
  <input id="fifu_input_column_height" type="text" name="fifu_input_column_height" value="<?php echo $column_height; ?>" placeholder="<?php $fifu['detail']['eg']() ?> 64" size="4">
42
  <input type="submit" value="<?php $fifu['button']['submit']() ?>" >
43
  </form>
53
  id="fifu_form_reset"
54
  action="javascript:void(0)"
55
  method="post">
56
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_reset'); ?>
57
  <table>
58
  <tr>
59
  <td>
1470
  <?php $fifu['title']['play']() ?>
1471
  </th>
1472
  <th>
1473
+ <?php $fifu['play']['hide']() ?> (WordPress)
1474
  </th>
1475
  <th>
1476
  wp fifu video --play-hide &lt;toggle&gt;
1479
  on, off
1480
  </th>
1481
  </tr>
1482
+ <tr class="color">
1483
+ <th>
1484
+ <?php $fifu['tab']['video']() ?>
1485
+ </th>
1486
+ <th>
1487
+ <?php $fifu['title']['play']() ?>
1488
+ </th>
1489
+ <th>
1490
+ <?php $fifu['play']['hide']() ?> (WooCommerce)
1491
+ </th>
1492
+ <th>
1493
+ wp fifu video --play-hide-wc &lt;toggle&gt;
1494
+ </th>
1495
+ <th>
1496
+ on, off
1497
+ </th>
1498
+ </tr>
1499
  <tr class="color">
1500
  <th>
1501
  <?php $fifu['tab']['video']() ?>
1616
  <th>
1617
  <?php $fifu['title']['mute']() ?>
1618
  </th>
 
1619
  <th>
1620
+ <?php $fifu['where']['desktop']() ?>
1621
+ </th>
1622
+ <th>
1623
+ wp fifu video --mute-desktop &lt;toggle&gt;
1624
  </th>
1625
  <th>
1626
  on, off
1627
  </th>
1628
+ </tr>
1629
  <tr class="color">
1630
  <th>
1631
  <?php $fifu['tab']['video']() ?>
1632
  </th>
1633
  <th>
1634
+ <?php $fifu['title']['mute']() ?>
1635
  </th>
 
1636
  <th>
1637
+ <?php $fifu['where']['mobile']() ?>
1638
+ </th>
1639
+ <th>
1640
+ wp fifu video --mute-mobile &lt;toggle&gt;
1641
  </th>
1642
  <th>
1643
  on, off
1644
  </th>
1645
+ </tr>
1646
  <tr class="color">
1647
  <th>
1648
  <?php $fifu['tab']['video']() ?>
1649
  </th>
1650
  <th>
1651
+ <?php $fifu['title']['background']() ?>
1652
  </th>
1653
  <th></th>
1654
  <th>
1655
+ wp fifu video --background &lt;toggle&gt;
1656
  </th>
1657
  <th>
1658
  on, off
1659
  </th>
1660
+ </tr>
1661
  <tr class="color">
1662
  <th>
1663
  <?php $fifu['tab']['video']() ?>
2238
  id="fifu_form_spinner_nth"
2239
  action="javascript:void(0)"
2240
  method="post">
2241
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_spinner_nth'); ?>
2242
  <input id="fifu_input_spinner_nth"
2243
  name="fifu_input_spinner_nth"
2244
  value="<?php echo $nth_image; ?>"
2258
  id="fifu_form_get_first"
2259
  action="javascript:void(0)"
2260
  method="post">
2261
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_get_first'); ?>
2262
  <input
2263
  type="submit"
2264
  href="javascript:void(0)"
2285
  id="fifu_form_pop_first"
2286
  action="javascript:void(0)"
2287
  method="post">
2288
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_pop_first'); ?>
2289
  <input
2290
  type="submit"
2291
  href="javascript:void(0)"
2312
  id="fifu_form_query_strings"
2313
  action="javascript:void(0)"
2314
  method="post">
2315
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_query_strings'); ?>
2316
  <input
2317
  type="submit"
2318
  href="javascript:void(0)"
2340
  id="fifu_form_ovw_first"
2341
  action="javascript:void(0)"
2342
  method="post">
2343
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_ovw_first'); ?>
2344
  <input
2345
  type="submit"
2346
  href="javascript:void(0)"
2367
  id="fifu_form_decode"
2368
  action="javascript:void(0)"
2369
  method="post">
2370
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_decode'); ?>
2371
  <input
2372
  type="submit"
2373
  href="javascript:void(0)"
2395
  id="fifu_form_check"
2396
  action="javascript:void(0)"
2397
  method="post">
2398
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_check'); ?>
2399
  <input
2400
  type="submit"
2401
  href="javascript:void(0)"
2426
  id="fifu_form_skip"
2427
  action="javascript:void(0)"
2428
  method="post">
2429
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_skip'); ?>
2430
  <input id="fifu_input_skip"
2431
  type="text"
2432
  name="fifu_input_skip"
2532
  </table>
2533
  </div>
2534
  <div id="tabsAutoSet-b">
2535
+ <table>
2536
+ <tr style="text-align:center">
2537
+ <th>
2538
+ <input id="fifu_input_auto_set_width"
2539
+ name="fifu_input_auto_set_width"
2540
+ step="10"
2541
+ max="10000"
2542
+ size="5">
2543
+ </th>
2544
+ <th>
2545
+ <?php $fifu['auto']['filter']['width']() ?>
2546
+ </th>
2547
+ </tr>
2548
+ <tr style="text-align:center">
2549
+ <th>
2550
+ <input id="fifu_input_auto_set_height"
2551
+ name="fifu_input_auto_set_height"
2552
+ step="10"
2553
+ max="10000"
2554
+ size="5">
2555
+ </th>
2556
+ <th>
2557
+ <?php $fifu['auto']['filter']['height']() ?>
2558
+ </th>
2559
+ </tr>
2560
+ <tr>
2561
+ <th>
2562
+ <input type="submit" value="<?php $fifu['button']['submit']() ?>" disabled style="width:85px">
2563
+ </th>
2564
+ <th></th>
2565
+ </tr>
2566
+ </table>
 
 
 
 
 
2567
  </div>
2568
  <div id="tabsAutoSet-c">
2569
  <?php $fifu['auto']['filter']['blocklist']() ?>
2570
+ <textarea id="fifu_input_auto_set_blocklist" name="fifu_input_auto_set_blocklist" style="width:100%;height:400px;resize:none;background-color:white;" placeholder="www.horribleimages.com&#10;inappropriateimages.com&#10;nakedpeopleimages.com&#10;manyadvertisements.com&#10;anysiteyoureallyhate.com"></textarea>
2571
+ <input style="float: right;" type="submit" value="<?php $fifu['button']['submit']() ?>" disabled>
 
 
 
 
 
2572
  </div>
2573
  <div id="tabsAutoSet-d">
2574
  <?php $fifu['auto']['cpt']['desc']() ?>
2860
  id="fifu_form_auto_alt"
2861
  action="javascript:void(0)"
2862
  method="post">
2863
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_auto_alt'); ?>
2864
  <input
2865
  type="submit"
2866
  href="javascript:void(0)"
2888
  id="fifu_form_dynamic_alt"
2889
  action="javascript:void(0)"
2890
  method="post">
2891
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_dynamic_alt'); ?>
2892
  <input
2893
  type="submit"
2894
  href="javascript:void(0)"
2927
  id="fifu_form_hide_page"
2928
  action="javascript:void(0)"
2929
  method="post">
2930
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_hide_page'); ?>
2931
  <input
2932
  type="submit"
2933
  href="javascript:void(0)"
2954
  id="fifu_form_hide_post"
2955
  action="javascript:void(0)"
2956
  method="post">
2957
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_hide_post'); ?>
2958
  <input
2959
  type="submit"
2960
  href="javascript:void(0)"
2981
  id="fifu_form_hide_cpt"
2982
  action="javascript:void(0)"
2983
  method="post">
2984
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_hide_cpt'); ?>
2985
  <input
2986
  type="submit"
2987
  href="javascript:void(0)"
3025
  id="fifu_form_default_url"
3026
  action="javascript:void(0)"
3027
  method="post">
3028
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_default_url'); ?>
3029
  <input id="fifu_input_default_url"
3030
  type="text"
3031
  name="fifu_input_default_url"
3042
  id="fifu_form_default_cpt"
3043
  action="javascript:void(0)"
3044
  method="post">
3045
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_default_cpt'); ?>
3046
  <input
3047
  id="fifu_input_default_cpt"
3048
  type="text"
3068
  id="fifu_form_enable_default_url"
3069
  action="javascript:void(0)"
3070
  method="post">
3071
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_enable_default_url'); ?>
3072
  <input
3073
  type="submit"
3074
  href="javascript:void(0)"
3101
  id="fifu_form_content_page"
3102
  action="javascript:void(0)"
3103
  method="post">
3104
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_content_page'); ?>
3105
  <input
3106
  type="submit"
3107
  href="javascript:void(0)"
3129
  id="fifu_form_content"
3130
  action="javascript:void(0)"
3131
  method="post">
3132
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_content'); ?>
3133
  <input
3134
  type="submit"
3135
  href="javascript:void(0)"
3157
  id="fifu_form_content_cpt"
3158
  action="javascript:void(0)"
3159
  method="post">
3160
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_content_cpt'); ?>
3161
  <input
3162
  type="submit"
3163
  href="javascript:void(0)"
3297
  <td><b>fifu_dev_upload_all_images()</b></td>
3298
  <td><?php $fifu['media']['dev']() ?></td>
3299
  <td>
3300
+ <input
3301
+ type="submit"
3302
+ value="<?php $fifu['media']['run']() ?>"
3303
+ disabled>
 
 
 
 
 
 
3304
  </td>
3305
  </tr>
3306
  </table>
3612
  id="fifu_form_fake"
3613
  action="javascript:void(0)"
3614
  method="post">
3615
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_fake'); ?>
3616
  <input
3617
  type="submit"
3618
  href="javascript:void(0)"
3659
  id="fifu_form_data_clean"
3660
  action="javascript:void(0)"
3661
  method="post">
3662
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_data_clean'); ?>
3663
  <input
3664
  type="submit"
3665
  href="javascript:void(0)"
3763
  id="fifu_form_db"
3764
  action="javascript:void(0)"
3765
  method="post">
3766
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_db'); ?>
3767
  <table style="text-align:left">
3768
  <tr>
3769
  <th>
3804
  id="fifu_form_confirm_delete_all"
3805
  action="javascript:void(0)"
3806
  method="post">
3807
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_confirm_delete_all'); ?>
3808
  <input
3809
  type="submit"
3810
  href="javascript:void(0)"
3832
  id="fifu_form_run_delete_all"
3833
  action="javascript:void(0)"
3834
  method="post">
3835
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_run_delete_all'); ?>
3836
  <input
3837
  type="submit"
3838
  href="javascript:void(0)"
3875
  <div id="tabs-0">
3876
  <table style="text-align:left">
3877
  <tr>
3878
+ <th>
3879
+ <input
3880
+ type="submit"
3881
+ href="javascript:void(0)"
3882
+ id="fifu_toggle_shortcode"
3883
+ onclick="javascript:void(0)"
3884
+ name="fifu_toggle_shortcode"
3885
+ class="toggleoff"
3886
+ value=""
3887
+ style="display:block;border:none">
 
 
 
 
 
 
 
 
 
 
 
3888
  </th>
3889
  </tr>
3890
  </table>
3987
  <br>
3988
  <br>
3989
  <div id="tabsVideo-a">
3990
+ <input
3991
+ type="submit"
3992
+ href="javascript:void(0)"
3993
+ id="fifu_toggle_video"
3994
+ onclick="javascript:void(0)"
3995
+ name="fifu_toggle_video"
3996
+ class="toggleoff"
3997
+ value=""
3998
+ style="display:block;border:none">
 
 
 
 
 
 
 
 
 
 
 
 
3999
  </div>
4000
 
4001
  <div id="tabsVideo-b">
4112
  <?php $fifu['word']['zindex']() ?>
4113
  <br>
4114
  <input
4115
+ id="fifu_input_video_zindex"
4116
  type="text"
4117
  name="fifu_input_video_zindex"
4118
  value=""
4120
  <br>
4121
  <input type="submit" value="<?php $fifu['button']['ok']() ?>" style="width:85px" disabled>
4122
  </th>
4123
+ <th style="position:relative;left:-8px;">
4124
+ <div style="position:relative;left:10px;"><?php $fifu['play']['hide']() ?></div>
4125
+ <table>
4126
+ <tr>
4127
+ <th>
4128
+ <input
4129
+ type="submit"
4130
+ href="javascript:void(0)"
4131
+ class="toggleoff"
4132
+ value=""
4133
+ style="display:block;border:none">
4134
+ </th>
4135
+ <th>
4136
+ <div style="position:relative;left:-8px">WordPress</div>
4137
+ </th>
4138
+ </tr>
4139
+ <tr>
4140
+ <th>
4141
+ <input
4142
+ type="submit"
4143
+ href="javascript:void(0)"
4144
+ class="toggleoff"
4145
+ value=""
4146
+ style="display:block;border:none">
4147
+ </th>
4148
+ <th>
4149
+ <div style="position:relative;left:-8px">WooCommerce</div>
4150
+ </th>
4151
+ </tr>
4152
+ </table>
4153
  </th>
4154
  </tr>
4155
  </table>
4301
  value=""
4302
  style="display:block;border:none">
4303
  </th>
4304
+ <th>
4305
+ <?php $fifu['where']['desktop']() ?>
4306
+ </th>
4307
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
4308
  <tr>
4309
  <th>
4310
  <input
4315
  style="display:block;border:none">
4316
  </th>
4317
  <th>
4318
+ <?php $fifu['where']['mobile']() ?>
4319
  </th>
4320
  </tr>
4321
  </table>
4322
  </div>
4323
 
4324
+
4325
  <div class="box">
4326
  <div class="fifu-pro"><div class="fifu-pro-out"><a class="fifu-pro-link" href="https://fifu.app/" target="_blank" title="Unlock all features"><h4 class="fifu-pro-text"><span class="dashicons dashicons-lock fifu-pro-icon"></span>PRO</h4></a></div></div>
4327
+ <h2><?php $fifu['title']['background']() ?></h2>
4328
  <div class="greybox" id="grad2">
4329
+ <?php $fifu['background']['desc']() ?>
4330
  </div>
4331
  <br>
4332
  <table style="text-align:left">
4340
  style="display:block;border:none">
4341
  </th>
4342
  <th>
4343
+ <?php $fifu['player']['vimeo']() ?>
4344
  </th>
4345
  </tr>
4346
  </table>
4623
  id="fifu_form_social"
4624
  action="javascript:void(0)"
4625
  method="post">
4626
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_social'); ?>
4627
  <input
4628
  type="submit"
4629
  href="javascript:void(0)"
4651
  id="fifu_form_social_image_only"
4652
  action="javascript:void(0)"
4653
  method="post">
4654
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_social_image_only'); ?>
4655
  <input
4656
  type="submit"
4657
  href="javascript:void(0)"
4832
  id="fifu_form_photon"
4833
  action="javascript:void(0)"
4834
  method="post">
4835
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_photon'); ?>
4836
  <input
4837
  type="submit"
4838
  href="javascript:void(0)"
4858
  id="fifu_form_cdn_social"
4859
  action="javascript:void(0)"
4860
  method="post">
4861
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_cdn_social'); ?>
4862
  <input
4863
  type="submit"
4864
  href="javascript:void(0)"
4884
  id="fifu_form_cdn_crop"
4885
  action="javascript:void(0)"
4886
  method="post">
4887
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_cdn_crop'); ?>
4888
  <input
4889
  type="submit"
4890
  href="javascript:void(0)"
4910
  id="fifu_form_cdn_content"
4911
  action="javascript:void(0)"
4912
  method="post">
4913
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_cdn_content'); ?>
4914
  <input
4915
  type="submit"
4916
  href="javascript:void(0)"
4944
  id="fifu_form_lazy"
4945
  action="javascript:void(0)"
4946
  method="post">
4947
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_lazy'); ?>
4948
  <input
4949
  type="submit"
4950
  href="javascript:void(0)"
5261
  id="fifu_form_wc_lbox"
5262
  action="javascript:void(0)"
5263
  method="post">
5264
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_wc_lbox'); ?>
5265
  <input
5266
  type="submit"
5267
  href="javascript:void(0)"
5289
  id="fifu_form_wc_zoom"
5290
  action="javascript:void(0)"
5291
  method="post">
5292
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_wc_zoom'); ?>
5293
  <input
5294
  type="submit"
5295
  href="javascript:void(0)"
5327
  id="fifu_form_grid_category"
5328
  action="javascript:void(0)"
5329
  method="post">
5330
+ <?php wp_nonce_field(FIFU_ACTION_SETTINGS, 'nonce_fifu_form_grid_category'); ?>
5331
  <input
5332
  type="submit"
5333
  href="javascript:void(0)"
admin/html/meta-box.html CHANGED
@@ -69,7 +69,7 @@
69
  type="hidden"
70
  id="fifu_keywords"
71
  name="fifu_keywords"
72
- value="" >
73
 
74
  <!-- show preview button if URL was not provided yet -->
75
 
69
  type="hidden"
70
  id="fifu_keywords"
71
  name="fifu_keywords"
72
+ value="" >
73
 
74
  <!-- show preview button if URL was not provided yet -->
75
 
admin/html/txt/post.txt CHANGED
@@ -1,8 +1,8 @@
1
  {
2
- "status": "publish",
3
- "content": "I'm using WP REST API!",
4
- "title": "Featured Image from URL",
5
- "excerpt": "My first post...",
6
- "fifu_image_url": "https://ps.w.org/featured-image-from-url/assets/icon-256x256.png",
7
- "fifu_image_alt": "Logo"
8
  }
1
  {
2
+ "status": "publish",
3
+ "content": "I'm using WP REST API!",
4
+ "title": "Featured Image from URL",
5
+ "excerpt": "My first post...",
6
+ "fifu_image_url": "https://ps.w.org/featured-image-from-url/assets/icon-256x256.png",
7
+ "fifu_image_alt": "Logo"
8
  }
admin/log.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function fifu_cloud_log($entry, $mode = 'a', $file = 'fifu-cloud') {
4
+ return fifu_log($entry, $file, $mode);
5
+ }
6
+
7
+ function fifu_plugin_log($entry, $mode = 'a', $file = 'fifu-plugin') {
8
+ return fifu_log($entry, $file, $mode);
9
+ }
10
+
11
+ function fifu_log($entry, $file, $mode = 'a') {
12
+ $upload_dir = wp_upload_dir()['basedir'];
13
+
14
+ if (is_array($entry))
15
+ $entry = json_encode([current_time('mysql') => $entry], JSON_UNESCAPED_SLASHES);
16
+
17
+ $file = fopen("{$upload_dir}/{$file}.log", $mode);
18
+ $bytes = fwrite($file, "{$entry}\n");
19
+ fclose($file);
20
+ return $bytes;
21
+ }
22
+
admin/menu.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
 
3
  define('FIFU_SETTINGS', serialize(array('fifu_social', 'fifu_social_image_only', 'fifu_skip', 'fifu_lazy', 'fifu_photon', 'fifu_cdn_social', 'fifu_cdn_crop', 'fifu_cdn_content', 'fifu_reset', 'fifu_content', 'fifu_content_page', 'fifu_content_cpt', 'fifu_enable_default_url', 'fifu_spinner_db', 'fifu_spinner_nth', 'fifu_fake', 'fifu_default_url', 'fifu_default_cpt', 'fifu_wc_lbox', 'fifu_wc_zoom', 'fifu_hide_page', 'fifu_hide_post', 'fifu_hide_cpt', 'fifu_get_first', 'fifu_pop_first', 'fifu_ovw_first', 'fifu_query_strings', 'fifu_confirm_delete_all', 'fifu_run_delete_all', 'fifu_column_height', 'fifu_decode', 'fifu_check', 'fifu_grid_category', 'fifu_auto_alt', 'fifu_dynamic_alt', 'fifu_data_clean')));
 
4
 
5
  define('FIFU_SLUG', 'featured-image-from-url');
6
 
@@ -18,6 +19,15 @@ function fifu_insert_menu() {
18
  wp_enqueue_script('jquery-ui', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js');
19
  wp_enqueue_script('jquery-block-ui', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.blockUI/2.70/jquery.blockUI.min.js');
20
 
 
 
 
 
 
 
 
 
 
21
  wp_enqueue_script('fifu-rest-route-js', plugins_url('/html/js/rest-route.js', __FILE__), array('jquery'), fifu_version_number());
22
 
23
  // register custom variables for the AJAX script
@@ -48,12 +58,14 @@ function fifu_cloud() {
48
  wp_enqueue_script('fifu-cookie', 'https://cdnjs.cloudflare.com/ajax/libs/js-cookie/latest/js.cookie.min.js');
49
  wp_enqueue_style('fifu-menu-su-css', plugins_url('/html/css/menu-su.css', __FILE__), array(), fifu_version_number());
50
  wp_enqueue_script('fifu-menu-su-js', plugins_url('/html/js/menu-su.js', __FILE__), array('jquery'), fifu_version_number());
 
51
 
52
  wp_enqueue_style('fifu-base-ui-css', plugins_url('/html/css/base-ui.css', __FILE__), array(), fifu_version_number());
53
  wp_enqueue_style('fifu-menu-css', plugins_url('/html/css/menu.css', __FILE__), array(), fifu_version_number());
54
  wp_enqueue_script('fifu-cloud-js', plugins_url('/html/js/cloud.js', __FILE__), array('jquery'), fifu_version_number());
55
 
56
  wp_localize_script('fifu-cloud-js', 'fifuScriptCloudVars', [
 
57
  'woocommerce' => class_exists('WooCommerce'),
58
  'availableImages' => fifu_db_count_available_images(),
59
  ]);
@@ -217,7 +229,10 @@ function fifu_get_menu_settings() {
217
 
218
  function fifu_reset_settings() {
219
  foreach (unserialize(FIFU_SETTINGS) as $i) {
220
- if ($i != 'fifu_default_url' && $i != 'fifu_enable_default_url')
 
 
 
221
  delete_option($i);
222
  }
223
  }
@@ -257,42 +272,113 @@ function fifu_get_setting($type) {
257
  }
258
 
259
  function fifu_update_menu_options() {
260
- fifu_update_option('fifu_input_social', 'fifu_social');
261
- fifu_update_option('fifu_input_social_image_only', 'fifu_social_image_only');
262
- fifu_update_option('fifu_input_skip', 'fifu_skip');
263
- fifu_update_option('fifu_input_lazy', 'fifu_lazy');
264
- fifu_update_option('fifu_input_photon', 'fifu_photon');
265
- fifu_update_option('fifu_input_cdn_social', 'fifu_cdn_social');
266
- fifu_update_option('fifu_input_cdn_crop', 'fifu_cdn_crop');
267
- fifu_update_option('fifu_input_cdn_content', 'fifu_cdn_content');
268
- fifu_update_option('fifu_input_reset', 'fifu_reset');
269
- fifu_update_option('fifu_input_content', 'fifu_content');
270
- fifu_update_option('fifu_input_content_page', 'fifu_content_page');
271
- fifu_update_option('fifu_input_content_cpt', 'fifu_content_cpt');
272
- fifu_update_option('fifu_input_fake', 'fifu_fake');
273
- fifu_update_option('fifu_input_default_url', 'fifu_default_url');
274
- fifu_update_option('fifu_input_default_cpt', 'fifu_default_cpt');
275
- fifu_update_option('fifu_input_enable_default_url', 'fifu_enable_default_url');
276
- fifu_update_option('fifu_input_spinner_db', 'fifu_spinner_db');
277
- fifu_update_option('fifu_input_spinner_nth', 'fifu_spinner_nth');
278
- fifu_update_option('fifu_input_wc_lbox', 'fifu_wc_lbox');
279
- fifu_update_option('fifu_input_wc_zoom', 'fifu_wc_zoom');
280
- fifu_update_option('fifu_input_hide_page', 'fifu_hide_page');
281
- fifu_update_option('fifu_input_hide_post', 'fifu_hide_post');
282
- fifu_update_option('fifu_input_hide_cpt', 'fifu_hide_cpt');
283
- fifu_update_option('fifu_input_get_first', 'fifu_get_first');
284
- fifu_update_option('fifu_input_pop_first', 'fifu_pop_first');
285
- fifu_update_option('fifu_input_ovw_first', 'fifu_ovw_first');
286
- fifu_update_option('fifu_input_query_strings', 'fifu_query_strings');
287
- fifu_update_option('fifu_input_confirm_delete_all', 'fifu_confirm_delete_all');
288
- fifu_update_option('fifu_input_run_delete_all', 'fifu_run_delete_all');
289
- fifu_update_option('fifu_input_column_height', 'fifu_column_height');
290
- fifu_update_option('fifu_input_decode', 'fifu_decode');
291
- fifu_update_option('fifu_input_check', 'fifu_check');
292
- fifu_update_option('fifu_input_grid_category', 'fifu_grid_category');
293
- fifu_update_option('fifu_input_auto_alt', 'fifu_auto_alt');
294
- fifu_update_option('fifu_input_dynamic_alt', 'fifu_dynamic_alt');
295
- fifu_update_option('fifu_input_data_clean', 'fifu_data_clean');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
 
297
  // delete all confirm log
298
  if (fifu_is_on('fifu_confirm_delete_all'))
@@ -359,6 +445,14 @@ function fifu_version_number() {
359
  return get_plugin_data(FIFU_PLUGIN_DIR . 'featured-image-from-url.php')['Version'];
360
  }
361
 
 
 
 
 
 
 
 
 
362
  function fifu_get_last($meta_key) {
363
  $list = '';
364
  foreach (fifu_db_get_last($meta_key) as $key => $row) {
@@ -390,3 +484,7 @@ function fifu_has_curl() {
390
  return function_exists('curl_version');
391
  }
392
 
 
 
 
 
1
  <?php
2
 
3
  define('FIFU_SETTINGS', serialize(array('fifu_social', 'fifu_social_image_only', 'fifu_skip', 'fifu_lazy', 'fifu_photon', 'fifu_cdn_social', 'fifu_cdn_crop', 'fifu_cdn_content', 'fifu_reset', 'fifu_content', 'fifu_content_page', 'fifu_content_cpt', 'fifu_enable_default_url', 'fifu_spinner_db', 'fifu_spinner_nth', 'fifu_fake', 'fifu_default_url', 'fifu_default_cpt', 'fifu_wc_lbox', 'fifu_wc_zoom', 'fifu_hide_page', 'fifu_hide_post', 'fifu_hide_cpt', 'fifu_get_first', 'fifu_pop_first', 'fifu_ovw_first', 'fifu_query_strings', 'fifu_confirm_delete_all', 'fifu_run_delete_all', 'fifu_column_height', 'fifu_decode', 'fifu_check', 'fifu_grid_category', 'fifu_auto_alt', 'fifu_dynamic_alt', 'fifu_data_clean')));
4
+ define('FIFU_ACTION_SETTINGS', '/wp-admin/admin.php?page=featured-image-from-url');
5
 
6
  define('FIFU_SLUG', 'featured-image-from-url');
7
 
19
  wp_enqueue_script('jquery-ui', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js');
20
  wp_enqueue_script('jquery-block-ui', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.blockUI/2.70/jquery.blockUI.min.js');
21
 
22
+ wp_enqueue_style('datatable-css', '//cdn.datatables.net/1.11.3/css/jquery.dataTables.min.css');
23
+ wp_enqueue_style('datatable-select-css', '//cdn.datatables.net/select/1.3.3/css/select.dataTables.min.css');
24
+ wp_enqueue_style('datatable-buttons-css', '//cdn.datatables.net/buttons/2.0.1/css/buttons.dataTables.min.css');
25
+ wp_enqueue_script('datatable-js', '//cdn.datatables.net/1.11.3/js/jquery.dataTables.min.js');
26
+ wp_enqueue_script('datatable-select', '//cdn.datatables.net/select/1.3.3/js/dataTables.select.min.js');
27
+ wp_enqueue_script('datatable-buttons', '//cdn.datatables.net/buttons/2.0.1/js/dataTables.buttons.min.js');
28
+
29
+ wp_enqueue_script('lazyload', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.lazyloadxt/1.1.0/jquery.lazyloadxt.min.js');
30
+ wp_enqueue_style('lazyload-spinner', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.lazyloadxt/1.1.0/jquery.lazyloadxt.spinner.min.css');
31
  wp_enqueue_script('fifu-rest-route-js', plugins_url('/html/js/rest-route.js', __FILE__), array('jquery'), fifu_version_number());
32
 
33
  // register custom variables for the AJAX script
58
  wp_enqueue_script('fifu-cookie', 'https://cdnjs.cloudflare.com/ajax/libs/js-cookie/latest/js.cookie.min.js');
59
  wp_enqueue_style('fifu-menu-su-css', plugins_url('/html/css/menu-su.css', __FILE__), array(), fifu_version_number());
60
  wp_enqueue_script('fifu-menu-su-js', plugins_url('/html/js/menu-su.js', __FILE__), array('jquery'), fifu_version_number());
61
+ wp_enqueue_script('fifu-qrcode', plugins_url('/html/js/qrcode.js', __FILE__), array('jquery'), fifu_version_number());
62
 
63
  wp_enqueue_style('fifu-base-ui-css', plugins_url('/html/css/base-ui.css', __FILE__), array(), fifu_version_number());
64
  wp_enqueue_style('fifu-menu-css', plugins_url('/html/css/menu.css', __FILE__), array(), fifu_version_number());
65
  wp_enqueue_script('fifu-cloud-js', plugins_url('/html/js/cloud.js', __FILE__), array('jquery'), fifu_version_number());
66
 
67
  wp_localize_script('fifu-cloud-js', 'fifuScriptCloudVars', [
68
+ 'signUpComplete' => fifu_su_sign_up_complete(),
69
  'woocommerce' => class_exists('WooCommerce'),
70
  'availableImages' => fifu_db_count_available_images(),
71
  ]);
229
 
230
  function fifu_reset_settings() {
231
  foreach (unserialize(FIFU_SETTINGS) as $i) {
232
+ if ($i != 'fifu_key' &&
233
+ $i != 'fifu_email' &&
234
+ $i != 'fifu_default_url' &&
235
+ $i != 'fifu_enable_default_url')
236
  delete_option($i);
237
  }
238
  }
272
  }
273
 
274
  function fifu_update_menu_options() {
275
+ if (fifu_is_valid_nonce('nonce_fifu_form_social'))
276
+ fifu_update_option('fifu_input_social', 'fifu_social');
277
+
278
+ if (fifu_is_valid_nonce('nonce_fifu_form_social_image_only'))
279
+ fifu_update_option('fifu_input_social_image_only', 'fifu_social_image_only');
280
+
281
+ if (fifu_is_valid_nonce('nonce_fifu_form_skip'))
282
+ fifu_update_option('fifu_input_skip', 'fifu_skip');
283
+
284
+ if (fifu_is_valid_nonce('nonce_fifu_form_lazy'))
285
+ fifu_update_option('fifu_input_lazy', 'fifu_lazy');
286
+
287
+ if (fifu_is_valid_nonce('nonce_fifu_form_photon'))
288
+ fifu_update_option('fifu_input_photon', 'fifu_photon');
289
+
290
+ if (fifu_is_valid_nonce('nonce_fifu_form_cdn_social'))
291
+ fifu_update_option('fifu_input_cdn_social', 'fifu_cdn_social');
292
+
293
+ if (fifu_is_valid_nonce('nonce_fifu_form_cdn_crop'))
294
+ fifu_update_option('fifu_input_cdn_crop', 'fifu_cdn_crop');
295
+
296
+ if (fifu_is_valid_nonce('nonce_fifu_form_cdn_content'))
297
+ fifu_update_option('fifu_input_cdn_content', 'fifu_cdn_content');
298
+
299
+ if (fifu_is_valid_nonce('nonce_fifu_form_reset'))
300
+ fifu_update_option('fifu_input_reset', 'fifu_reset');
301
+
302
+ if (fifu_is_valid_nonce('nonce_fifu_form_content'))
303
+ fifu_update_option('fifu_input_content', 'fifu_content');
304
+
305
+ if (fifu_is_valid_nonce('nonce_fifu_form_content_page'))
306
+ fifu_update_option('fifu_input_content_page', 'fifu_content_page');
307
+
308
+ if (fifu_is_valid_nonce('nonce_fifu_form_content_cpt'))
309
+ fifu_update_option('fifu_input_content_cpt', 'fifu_content_cpt');
310
+
311
+ if (fifu_is_valid_nonce('nonce_fifu_form_fake'))
312
+ fifu_update_option('fifu_input_fake', 'fifu_fake');
313
+
314
+ if (fifu_is_valid_nonce('nonce_fifu_form_default_url'))
315
+ fifu_update_option('fifu_input_default_url', 'fifu_default_url');
316
+
317
+ if (fifu_is_valid_nonce('nonce_fifu_form_default_cpt'))
318
+ fifu_update_option('fifu_input_default_cpt', 'fifu_default_cpt');
319
+
320
+ if (fifu_is_valid_nonce('nonce_fifu_form_enable_default_url'))
321
+ fifu_update_option('fifu_input_enable_default_url', 'fifu_enable_default_url');
322
+
323
+ if (fifu_is_valid_nonce('nonce_fifu_form_db'))
324
+ fifu_update_option('fifu_input_spinner_db', 'fifu_spinner_db');
325
+
326
+ if (fifu_is_valid_nonce('nonce_fifu_form_spinner_nth'))
327
+ fifu_update_option('fifu_input_spinner_nth', 'fifu_spinner_nth');
328
+
329
+ if (fifu_is_valid_nonce('nonce_fifu_form_wc_lbox'))
330
+ fifu_update_option('fifu_input_wc_lbox', 'fifu_wc_lbox');
331
+
332
+ if (fifu_is_valid_nonce('nonce_fifu_form_wc_zoom'))
333
+ fifu_update_option('fifu_input_wc_zoom', 'fifu_wc_zoom');
334
+
335
+ if (fifu_is_valid_nonce('nonce_fifu_form_hide_page'))
336
+ fifu_update_option('fifu_input_hide_page', 'fifu_hide_page');
337
+
338
+ if (fifu_is_valid_nonce('nonce_fifu_form_hide_post'))
339
+ fifu_update_option('fifu_input_hide_post', 'fifu_hide_post');
340
+
341
+ if (fifu_is_valid_nonce('nonce_fifu_form_hide_cpt'))
342
+ fifu_update_option('fifu_input_hide_cpt', 'fifu_hide_cpt');
343
+
344
+ if (fifu_is_valid_nonce('nonce_fifu_form_get_first'))
345
+ fifu_update_option('fifu_input_get_first', 'fifu_get_first');
346
+
347
+ if (fifu_is_valid_nonce('nonce_fifu_form_pop_first'))
348
+ fifu_update_option('fifu_input_pop_first', 'fifu_pop_first');
349
+
350
+ if (fifu_is_valid_nonce('nonce_fifu_form_ovw_first'))
351
+ fifu_update_option('fifu_input_ovw_first', 'fifu_ovw_first');
352
+
353
+ if (fifu_is_valid_nonce('nonce_fifu_form_query_strings'))
354
+ fifu_update_option('fifu_input_query_strings', 'fifu_query_strings');
355
+
356
+ if (fifu_is_valid_nonce('nonce_fifu_form_confirm_delete_all'))
357
+ fifu_update_option('fifu_input_confirm_delete_all', 'fifu_confirm_delete_all');
358
+
359
+ if (fifu_is_valid_nonce('nonce_fifu_form_run_delete_all'))
360
+ fifu_update_option('fifu_input_run_delete_all', 'fifu_run_delete_all');
361
+
362
+ if (fifu_is_valid_nonce('nonce_fifu_form_column'))
363
+ fifu_update_option('fifu_input_column_height', 'fifu_column_height');
364
+
365
+ if (fifu_is_valid_nonce('nonce_fifu_form_decode'))
366
+ fifu_update_option('fifu_input_decode', 'fifu_decode');
367
+
368
+ if (fifu_is_valid_nonce('nonce_fifu_form_check'))
369
+ fifu_update_option('fifu_input_check', 'fifu_check');
370
+
371
+ if (fifu_is_valid_nonce('nonce_fifu_form_grid_category'))
372
+ fifu_update_option('fifu_input_grid_category', 'fifu_grid_category');
373
+
374
+ if (fifu_is_valid_nonce('nonce_fifu_form_auto_alt'))
375
+ fifu_update_option('fifu_input_auto_alt', 'fifu_auto_alt');
376
+
377
+ if (fifu_is_valid_nonce('nonce_fifu_form_dynamic_alt'))
378
+ fifu_update_option('fifu_input_dynamic_alt', 'fifu_dynamic_alt');
379
+
380
+ if (fifu_is_valid_nonce('nonce_fifu_form_data_clean'))
381
+ fifu_update_option('fifu_input_data_clean', 'fifu_data_clean');
382
 
383
  // delete all confirm log
384
  if (fifu_is_on('fifu_confirm_delete_all'))
445
  return get_plugin_data(FIFU_PLUGIN_DIR . 'featured-image-from-url.php')['Version'];
446
  }
447
 
448
+ function fifu_su_sign_up_complete() {
449
+ return isset(get_option('fifu_su_privkey')[0]) ? true : false;
450
+ }
451
+
452
+ function fifu_su_get_email() {
453
+ return base64_decode(get_option('fifu_su_email')[0]);
454
+ }
455
+
456
  function fifu_get_last($meta_key) {
457
  $list = '';
458
  foreach (fifu_db_get_last($meta_key) as $key => $row) {
484
  return function_exists('curl_version');
485
  }
486
 
487
+ function fifu_is_valid_nonce($nonce) {
488
+ return isset($_POST[$nonce]) && wp_verify_nonce($_POST[$nonce], FIFU_ACTION_SETTINGS);
489
+ }
490
+
admin/meta-box.php CHANGED
@@ -31,6 +31,8 @@ function fifu_register_meta_box_script() {
31
  $fifu = fifu_get_strings_meta_box_php();
32
  $fifu_help = fifu_get_strings_help();
33
 
 
 
34
  wp_enqueue_script('jquery-block-ui', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.blockUI/2.70/jquery.blockUI.min.js');
35
  wp_enqueue_style('fancy-box-css', 'https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.css');
36
  wp_enqueue_script('fancy-box-js', 'https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js');
31
  $fifu = fifu_get_strings_meta_box_php();
32
  $fifu_help = fifu_get_strings_help();
33
 
34
+ wp_enqueue_script('fifu-cookie', 'https://cdnjs.cloudflare.com/ajax/libs/js-cookie/latest/js.cookie.min.js');
35
+
36
  wp_enqueue_script('jquery-block-ui', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.blockUI/2.70/jquery.blockUI.min.js');
37
  wp_enqueue_style('fancy-box-css', 'https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.css');
38
  wp_enqueue_script('fancy-box-js', 'https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js');
admin/rsa.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Encrypt the data to $encrypted using the public key:
4
+ // openssl_public_encrypt($data, $encrypted, $pubKey);
5
+ // Decrypt the data using the private key and store the results in $decrypted:
6
+ // openssl_private_decrypt($encrypted, $decrypted, $privKey);
7
+ // Encrypt the data to $encrypted using the private key:
8
+ // openssl_private_encrypt($data, $encrypted, $privKey, OPENSSL_PKCS1_PADDING);
9
+ // Decrypt the data using the public key and store the results in $decrypted:
10
+ // openssl_public_decrypt($encrypted, $decrypted, $pubKey);
11
+
12
+ function fifu_create_keys($email) {
13
+
14
+ require_once(ABSPATH . '/wp-load.php');
15
+
16
+ $config = array(
17
+ "digest_alg" => "sha256",
18
+ "private_key_bits" => 2048,
19
+ "private_key_type" => OPENSSL_KEYTYPE_RSA,
20
+ );
21
+
22
+ // Create the private and public key
23
+ $res = openssl_pkey_new($config);
24
+
25
+ // Extract the private key from $res to $privKey
26
+ openssl_pkey_export($res, $privKey);
27
+
28
+ // Extract the public key from $res to $pubKey
29
+ $pubKey = openssl_pkey_get_details($res);
30
+ $pubKey = $pubKey["key"];
31
+
32
+ // Store key
33
+ update_option('fifu_su_email', array(base64_encode($email)), 'no');
34
+ update_option('fifu_su_privkey', array(base64_encode(openssl_encrypt($privKey, "AES-128-ECB", $email . fifu_get_home_url()))), 'no');
35
+
36
+ return base64_encode($pubKey);
37
+ }
38
+
39
+ function fifu_create_signature($data) {
40
+ // Recover key
41
+ $email = base64_decode(get_option('fifu_su_email')[0]);
42
+ $privKey = openssl_decrypt(base64_decode(get_option('fifu_su_privkey')[0]), "AES-128-ECB", $email . fifu_get_home_url());
43
+
44
+ // $data is assumed to contain the data to be signed
45
+ // fetch private key from file and ready it
46
+ $pkeyid = openssl_pkey_get_private($privKey);
47
+
48
+ // compute signature
49
+ openssl_sign($data, $signature, $privKey, OPENSSL_ALGO_SHA256);
50
+
51
+ return base64_encode($signature);
52
+ }
53
+
54
+ function fifu_create_hash($data) {
55
+ $license_key = get_option('fifu_key');
56
+ return hash_hmac('sha256', $data, $license_key);
57
+ }
58
+
admin/strings.php CHANGED
@@ -120,6 +120,12 @@ function fifu_get_strings_settings() {
120
  $fifu['where']['single'] = function() {
121
  _e("on single post types", FIFU_SLUG);
122
  };
 
 
 
 
 
 
123
 
124
  // player
125
  $fifu['player']['youtube'] = function() {
@@ -342,9 +348,6 @@ function fifu_get_strings_settings() {
342
  $fifu['title']['background'] = function() {
343
  _e("Background Video", FIFU_SLUG);
344
  };
345
- $fifu['title']['related'] = function() {
346
- _e("Related Videos", FIFU_SLUG);
347
- };
348
  $fifu['title']['icon'] = function() {
349
  _e("Gallery Icon", FIFU_SLUG);
350
  };
@@ -1356,11 +1359,6 @@ function fifu_get_strings_settings() {
1356
  _e("Start the videos in background, which means autoplay, no controls and no sound.", FIFU_SLUG);
1357
  };
1358
 
1359
- // related
1360
- $fifu['related']['desc'] = function() {
1361
- _e("Show related videos when the video ends.", FIFU_SLUG);
1362
- };
1363
-
1364
  // icon
1365
  $fifu['icon']['desc'] = function() {
1366
  _e("Add icons to the video thumbnails in the WooCommerce gallery.", FIFU_SLUG);
@@ -1853,6 +1851,9 @@ function fifu_get_strings_cloud() {
1853
  $fifu['title']['price'] = function() {
1854
  return _e("Pricing", FIFU_SLUG);
1855
  };
 
 
 
1856
  $fifu['title']['signup'] = function() {
1857
  return _e("Sign up", FIFU_SLUG);
1858
  };
@@ -1953,7 +1954,36 @@ function fifu_get_strings_cloud() {
1953
  _e("WordPress themes and social media platforms work with predefined sizes of images and, when they receive an image with non-standard dimensions, they crop the central area of the image, which is not very smart, as often the main object is not located in the center. Facebook, Twitter and LinkedIn, for example, display the featured image at ~1200×630 pixels (landscape orientation), and when you try to share a full body photo (portrait), the cropped person will likely lose its head and feet. But FIFU Cloud detects faces and objects so its cropped images can show what really matters, without compromising style or information.");
1954
  };
1955
  $fifu['support']['hotlink-desc'] = function() {
1956
- _e("You cannot prevent bots from accessing and extracting content from your website, including text and image URLs. And unfortunately, after being stored, the data set can be used to replicate your entire website elsewhere, which will receive visitors that should be yours by right. However, FIFU Cloud offers hotlink protection, which means that other websites, with the exception of social media, will not be able to display your images. And while this doesn't completely solve the problem, it will certainly inhibit web scraping on your website, because posts with broken images become much less attractive.");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1957
  };
1958
 
1959
  // pricing
120
  $fifu['where']['single'] = function() {
121
  _e("on single post types", FIFU_SLUG);
122
  };
123
+ $fifu['where']['desktop'] = function() {
124
+ _e("on desktop", FIFU_SLUG);
125
+ };
126
+ $fifu['where']['mobile'] = function() {
127
+ _e("on mobile", FIFU_SLUG);
128
+ };
129
 
130
  // player
131
  $fifu['player']['youtube'] = function() {
348
  $fifu['title']['background'] = function() {
349
  _e("Background Video", FIFU_SLUG);
350
  };
 
 
 
351
  $fifu['title']['icon'] = function() {
352
  _e("Gallery Icon", FIFU_SLUG);
353
  };
1359
  _e("Start the videos in background, which means autoplay, no controls and no sound.", FIFU_SLUG);
1360
  };
1361
 
 
 
 
 
 
1362
  // icon
1363
  $fifu['icon']['desc'] = function() {
1364
  _e("Add icons to the video thumbnails in the WooCommerce gallery.", FIFU_SLUG);
1851
  $fifu['title']['price'] = function() {
1852
  return _e("Pricing", FIFU_SLUG);
1853
  };
1854
+ $fifu['title']['getting'] = function() {
1855
+ return _e("Getting started (beta testers)", FIFU_SLUG);
1856
+ };
1857
  $fifu['title']['signup'] = function() {
1858
  return _e("Sign up", FIFU_SLUG);
1859
  };
1954
  _e("WordPress themes and social media platforms work with predefined sizes of images and, when they receive an image with non-standard dimensions, they crop the central area of the image, which is not very smart, as often the main object is not located in the center. Facebook, Twitter and LinkedIn, for example, display the featured image at ~1200×630 pixels (landscape orientation), and when you try to share a full body photo (portrait), the cropped person will likely lose its head and feet. But FIFU Cloud detects faces and objects so its cropped images can show what really matters, without compromising style or information.");
1955
  };
1956
  $fifu['support']['hotlink-desc'] = function() {
1957
+ _e("You cannot prevent bots from accessing and extracting content from your website, including text and image URLs. And unfortunately, after being stored, the data set can be used to replicate your entire website elsewhere, which will receive visitors that should be yours by right. Fortunately, FIFU Cloud offers hotlink protection, which means that other websites, with the exception of social media, will not be able to display your images. And while this doesn't completely solve the problem, it will certainly inhibit web scraping on your website, because posts with blocked images become much less attractive.");
1958
+ };
1959
+
1960
+ // getting started
1961
+ $fifu['getting']['beta'] = function() {
1962
+ _e("Beta testers are going to be the ~100 first users to try FIFU Cloud. While they are using the service, we'll be monitoring the hardware usage and cloud costs generated. With this data, we'll be able to hire more or less cloud resources and offer fairer prices for everyone. If you'd like to become a beta tester, contact us at <b>cloud@fifu.app</b>");
1963
+ };
1964
+ $fifu['getting']['important'] = function() {
1965
+ _e("Important");
1966
+ };
1967
+ $fifu['getting']['signup']['title'] = function() {
1968
+ _e("Sign up");
1969
+ };
1970
+ $fifu['getting']['login']['title'] = function() {
1971
+ _e("Log in");
1972
+ };
1973
+ $fifu['getting']['upload']['title'] = function() {
1974
+ _e("Upload");
1975
+ };
1976
+ $fifu['getting']['signup']['description'] = function() {
1977
+ _e("email confirmation + Stripe subscription");
1978
+ };
1979
+ $fifu['getting']['login']['description'] = function() {
1980
+ _e("two-factor authentication app");
1981
+ };
1982
+ $fifu['getting']['upload']['description'] = function() {
1983
+ _e("selected images");
1984
+ };
1985
+ $fifu['getting']['description'] = function() {
1986
+ _e("in order to load the thumbnails in their best sizes, FIFU Settings > Performance > Lazy Load must be enabled, otherwise the images won't be displayed. If you have any issues or would like to suggest improvements, please contact us at the email address above. You'll receive priority support.");
1987
  };
1988
 
1989
  // pricing
featured-image-from-url.php CHANGED
@@ -4,11 +4,11 @@
4
  * Plugin Name: Featured Image from URL (FIFU)
5
  * Plugin URI: https://fifu.app/
6
  * Description: Use an external image/video as featured image/video of a post or WooCommerce product.
7
- * Version: 3.9.9
8
  * Author: fifu.app
9
  * Author URI: https://fifu.app/
10
  * WC requires at least: 4.0
11
- * WC tested up to: 6.6.0
12
  * Text Domain: featured-image-from-url
13
  * License: GPLv3
14
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
@@ -19,12 +19,13 @@ define('FIFU_INCLUDES_DIR', FIFU_PLUGIN_DIR . 'includes');
19
  define('FIFU_ADMIN_DIR', FIFU_PLUGIN_DIR . 'admin');
20
  define('FIFU_ELEMENTOR_DIR', FIFU_PLUGIN_DIR . 'elementor');
21
  define('FIFU_DELETE_ALL_URLS', false);
22
- define('FIFU_CLOUD_DEBUG', true);
23
 
24
  require_once (FIFU_INCLUDES_DIR . '/attachment.php');
25
  require_once (FIFU_INCLUDES_DIR . '/convert-url.php');
26
  require_once (FIFU_INCLUDES_DIR . '/external-post.php');
27
  require_once (FIFU_INCLUDES_DIR . '/jetpack.php');
 
28
  require_once (FIFU_INCLUDES_DIR . '/thumbnail.php');
29
  require_once (FIFU_INCLUDES_DIR . '/thumbnail-category.php');
30
  require_once (FIFU_INCLUDES_DIR . '/util.php');
@@ -34,8 +35,10 @@ require_once (FIFU_ADMIN_DIR . '/api.php');
34
  require_once (FIFU_ADMIN_DIR . '/db.php');
35
  require_once (FIFU_ADMIN_DIR . '/category.php');
36
  require_once (FIFU_ADMIN_DIR . '/column.php');
 
37
  require_once (FIFU_ADMIN_DIR . '/menu.php');
38
  require_once (FIFU_ADMIN_DIR . '/meta-box.php');
 
39
  require_once (FIFU_ADMIN_DIR . '/strings.php');
40
  require_once (FIFU_ADMIN_DIR . '/widgets.php');
41
 
4
  * Plugin Name: Featured Image from URL (FIFU)
5
  * Plugin URI: https://fifu.app/
6
  * Description: Use an external image/video as featured image/video of a post or WooCommerce product.
7
+ * Version: 4.0.0
8
  * Author: fifu.app
9
  * Author URI: https://fifu.app/
10
  * WC requires at least: 4.0
11
+ * WC tested up to: 6.6.1
12
  * Text Domain: featured-image-from-url
13
  * License: GPLv3
14
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
19
  define('FIFU_ADMIN_DIR', FIFU_PLUGIN_DIR . 'admin');
20
  define('FIFU_ELEMENTOR_DIR', FIFU_PLUGIN_DIR . 'elementor');
21
  define('FIFU_DELETE_ALL_URLS', false);
22
+ define('FIFU_CLOUD_DEBUG', false);
23
 
24
  require_once (FIFU_INCLUDES_DIR . '/attachment.php');
25
  require_once (FIFU_INCLUDES_DIR . '/convert-url.php');
26
  require_once (FIFU_INCLUDES_DIR . '/external-post.php');
27
  require_once (FIFU_INCLUDES_DIR . '/jetpack.php');
28
+ require_once (FIFU_INCLUDES_DIR . '/speedup.php');
29
  require_once (FIFU_INCLUDES_DIR . '/thumbnail.php');
30
  require_once (FIFU_INCLUDES_DIR . '/thumbnail-category.php');
31
  require_once (FIFU_INCLUDES_DIR . '/util.php');
35
  require_once (FIFU_ADMIN_DIR . '/db.php');
36
  require_once (FIFU_ADMIN_DIR . '/category.php');
37
  require_once (FIFU_ADMIN_DIR . '/column.php');
38
+ require_once (FIFU_ADMIN_DIR . '/log.php');
39
  require_once (FIFU_ADMIN_DIR . '/menu.php');
40
  require_once (FIFU_ADMIN_DIR . '/meta-box.php');
41
+ require_once (FIFU_ADMIN_DIR . '/rsa.php');
42
  require_once (FIFU_ADMIN_DIR . '/strings.php');
43
  require_once (FIFU_ADMIN_DIR . '/widgets.php');
44
 
includes/attachment.php CHANGED
@@ -44,7 +44,7 @@ function fifu_fix_legacy($url, $att_id) {
44
  add_filter('wp_get_attachment_url', 'fifu_replace_attachment_url', 10, 2);
45
 
46
  function fifu_replace_attachment_url($att_url, $att_id) {
47
- if ($att_url && !get_option('fifu_get_internal'))
48
  return fifu_process_url($att_url, $att_id);
49
  return $att_url;
50
  }
@@ -85,6 +85,9 @@ function fifu_replace_attachment_image_src($image, $att_id, $size) {
85
  if (fifu_should_hide() && fifu_main_image_url(get_queried_object_id(), true) == $image[0])
86
  return null;
87
 
 
 
 
88
  // photon
89
  if (fifu_is_on('fifu_photon') && !fifu_jetpack_blocked($image[0])) {
90
  // $old_url = $image[0];
@@ -246,11 +249,40 @@ function fifu_callback($buffer) {
246
  $post_id = $data['post_id'];
247
  $att_id = $data['att_id'];
248
  $featured = $data['featured'];
 
 
249
 
250
  if ($featured) {
251
  // add featured
252
  $newImgItem = str_replace('<img ', '<img fifu-featured="' . $featured . '" ', $imgItem);
253
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  $buffer = str_replace($imgItem, fifu_replace($newImgItem, $post_id, null, null, null), $buffer);
255
  }
256
  }
@@ -294,7 +326,10 @@ function fifu_callback($buffer) {
294
  // add status
295
  $newImgItem = str_replace('<img ', '<img fifu-replaced="1" ', $newImgItem);
296
 
297
- $attr = 'data-bg=' . $mainDelimiter . $url . $mainDelimiter;
 
 
 
298
  $newImgItem = str_replace('>', ' ' . $attr . '>', $newImgItem);
299
 
300
  // remove background-image
@@ -341,7 +376,30 @@ function fifu_add_url_parameters($url, $att_id, $size) {
341
  $parameters['post_id'] = $post_id;
342
  $parameters['featured'] = $featured;
343
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
344
  $_SESSION[$url] = $parameters;
 
 
 
 
 
 
 
 
 
345
  return $url;
346
  }
347
 
44
  add_filter('wp_get_attachment_url', 'fifu_replace_attachment_url', 10, 2);
45
 
46
  function fifu_replace_attachment_url($att_url, $att_id) {
47
+ if ($att_url)
48
  return fifu_process_url($att_url, $att_id);
49
  return $att_url;
50
  }
85
  if (fifu_should_hide() && fifu_main_image_url(get_queried_object_id(), true) == $image[0])
86
  return null;
87
 
88
+ if (fifu_is_from_speedup($image[0]))
89
+ $image = fifu_speedup_get_url($image, $size, $att_id);
90
+
91
  // photon
92
  if (fifu_is_on('fifu_photon') && !fifu_jetpack_blocked($image[0])) {
93
  // $old_url = $image[0];
249
  $post_id = $data['post_id'];
250
  $att_id = $data['att_id'];
251
  $featured = $data['featured'];
252
+ $theme_width = isset($data['theme-width']) ? $data['theme-width'] : null;
253
+ $theme_height = isset($data['theme-height']) ? $data['theme-height'] : null;
254
 
255
  if ($featured) {
256
  // add featured
257
  $newImgItem = str_replace('<img ', '<img fifu-featured="' . $featured . '" ', $imgItem);
258
 
259
+ // add post_id
260
+ if (get_post_type($post_id) == 'product')
261
+ $newImgItem = str_replace('<img ', '<img product-id="' . $post_id . '" ', $newImgItem);
262
+
263
+ // add theme sizes
264
+ if ($theme_width && $theme_height) {
265
+ $newImgItem = str_replace('<img ', '<img theme-width="' . $theme_width . '" ', $newImgItem);
266
+ $newImgItem = str_replace('<img ', '<img theme-height="' . $theme_height . '" ', $newImgItem);
267
+ }
268
+
269
+ // speed up (doesn't work with ajax calls)
270
+ if (fifu_is_from_speedup($url)) {
271
+ if (fifu_is_off('fifu_lazy')) {
272
+ $newImgItem = str_replace('<img ', '<img srcset="' . fifu_speedup_get_set($url) . '" ', $newImgItem);
273
+ $newImgItem = str_replace('<img ', '<img sizes="(max-width:' . $theme_width . 'px) 100vw, ' . $theme_width . 'px" ', $newImgItem);
274
+ } else {
275
+ // remove srcset
276
+ $newImgItem = preg_replace('/ srcset=.[^\'\"]+[\'\"]/', '', $newImgItem);
277
+
278
+ $srcset = $_SESSION['fifu-cloud'][$url];
279
+ $srcset = $srcset ? $srcset : fifu_speedup_get_set($url);
280
+
281
+ $newImgItem = str_replace('<img ', '<img data-srcset="' . $srcset . '" ', $newImgItem);
282
+ $newImgItem = str_replace('<img ', '<img data-sizes="auto" ', $newImgItem);
283
+ }
284
+ }
285
+
286
  $buffer = str_replace($imgItem, fifu_replace($newImgItem, $post_id, null, null, null), $buffer);
287
  }
288
  }
326
  // add status
327
  $newImgItem = str_replace('<img ', '<img fifu-replaced="1" ', $newImgItem);
328
 
329
+ if (fifu_is_from_speedup($url))
330
+ $attr = 'data-bgset=' . $mainDelimiter . fifu_speedup_get_set($url) . $mainDelimiter . ' data-sizes=' . $mainDelimiter . 'auto' . $mainDelimiter;
331
+ else
332
+ $attr = 'data-bg=' . $mainDelimiter . $url . $mainDelimiter;
333
  $newImgItem = str_replace('>', ' ' . $attr . '>', $newImgItem);
334
 
335
  // remove background-image
376
  $parameters['post_id'] = $post_id;
377
  $parameters['featured'] = $featured;
378
 
379
+ // theme size
380
+ if ($size && !is_array($size) && function_exists('wp_get_registered_image_subsizes')) {
381
+ $width = null;
382
+ $height = null;
383
+ if (isset(wp_get_registered_image_subsizes()[$size]['width']))
384
+ $width = wp_get_registered_image_subsizes()[$size]['width'];
385
+ if (isset(wp_get_registered_image_subsizes()[$size]['height']))
386
+ $height = wp_get_registered_image_subsizes()[$size]['height'];
387
+ if ($width && $height) {
388
+ $parameters['theme-width'] = $width;
389
+ $parameters['theme-height'] = $height;
390
+ }
391
+ }
392
+
393
  $_SESSION[$url] = $parameters;
394
+
395
+ if (fifu_is_from_speedup($url)) {
396
+ $_SESSION['fifu-cloud'][$url] = fifu_speedup_get_set($url);
397
+ wp_enqueue_script('fifu-cloud', plugins_url('/html/js/cloud.js', __FILE__), array('jquery'), fifu_version_number());
398
+ wp_localize_script('fifu-cloud', 'fifuCloudVars', [
399
+ 'srcsets' => $_SESSION['fifu-cloud'],
400
+ ]);
401
+ }
402
+
403
  return $url;
404
  }
405
 
includes/html/js/cloud.js ADDED
File without changes
includes/html/js/lazySizesConfig.js CHANGED
@@ -25,15 +25,21 @@ function fifu_lazy(selector = 'img') {
25
  jQuery('head').append(`<link rel="preload" as="image" href="${datasrc}" imagesizes="${width}px" imagesrcset="${datasrcset}">`);
26
  }
27
 
 
 
 
 
 
28
  if (jQuery(this).hasClass('lazyload') || jQuery(this).hasClass('lazyloaded') || jQuery(this).hasClass('lazyloading'))
29
  return;
30
 
31
  // remove wp lazy load
32
  jQuery(this).removeAttr('loading');
33
 
34
- fifu_add_placeholder(this);
 
35
 
36
- // dont touch on slider
37
  if (!jQuery(this).hasClass('fifu'))
38
  fifu_add_lazyload(this);
39
  });
@@ -47,10 +53,38 @@ function fifu_add_lazyload($) {
47
  function fifu_add_placeholder($) {
48
  src = jQuery($).attr('src');
49
  datasrc = jQuery($).attr('data-src');
 
 
 
 
 
 
 
 
50
  if (!src && datasrc) {
51
- if (fifuLazyVars.fifu_is_product && jQuery($).hasClass('lazyload')) {
52
- if (jQuery($).parents('.woocommerce-product-gallery__wrapper').length == 0)
53
- jQuery($).attr('src', FIFU_PLACEHOLDER);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  }
55
  }
56
  }
@@ -58,6 +92,22 @@ function fifu_add_placeholder($) {
58
  function fifu_add_srcset(selector) {
59
  types = ['src', 'data-src'];
60
  for (i = 0; i < types.length; i++) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  // jetpack
62
  jQuery('img[' + types[i] + '*=".wp.com/"]').each(function (index) {
63
  if (jQuery(this).attr('srcset') && jQuery(this).attr('data-srcset'))
@@ -105,6 +155,23 @@ function fifu_get_delimited_url(url, delimiter) {
105
  return delimiter + url + delimiter;
106
  }
107
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  function fifu_lazy_ajax(selector = 'img') {
109
  jQuery(selector).each(function () {
110
  if (jQuery(this).hasClass('lazyload') || jQuery(this).hasClass('lazyloaded') || jQuery(this).hasClass('lazyloading'))
@@ -114,6 +181,10 @@ function fifu_lazy_ajax(selector = 'img') {
114
  if (jQuery(this).hasClass('flickr-img-responsive') || jQuery(this).hasClass('gall-img-responsive'))
115
  return;
116
 
 
 
 
 
117
  jQuery(this).attr('data-src', jQuery(this).attr('src'));
118
  jQuery(this).removeAttr('src');
119
  });
25
  jQuery('head').append(`<link rel="preload" as="image" href="${datasrc}" imagesizes="${width}px" imagesrcset="${datasrcset}">`);
26
  }
27
 
28
+ // fix some lazy load themes: sober
29
+ src = jQuery(this).attr('src');
30
+ if (src && src.includes('cdn.fifu.app'))
31
+ jQuery(this).removeClass('lazyloading');
32
+
33
  if (jQuery(this).hasClass('lazyload') || jQuery(this).hasClass('lazyloaded') || jQuery(this).hasClass('lazyloading'))
34
  return;
35
 
36
  // remove wp lazy load
37
  jQuery(this).removeAttr('loading');
38
 
39
+ if (!jQuery(this).hasClass('fifu'))
40
+ fifu_add_placeholder(this);
41
 
42
+ // dont touch on slider (lazyload class added on back-end)
43
  if (!jQuery(this).hasClass('fifu'))
44
  fifu_add_lazyload(this);
45
  });
53
  function fifu_add_placeholder($) {
54
  src = jQuery($).attr('src');
55
  datasrc = jQuery($).attr('data-src');
56
+
57
+ if (src && src.includes('cdn.fifu.app')) {
58
+ jQuery($).attr('data-src', src);
59
+ jQuery($).removeAttr('src');
60
+ datasrc = src;
61
+ src = null;
62
+ }
63
+
64
  if (!src && datasrc) {
65
+ if (datasrc.includes('cdn.fifu.app')) {
66
+ parameters = datasrc.split(/.resize=/)[1];
67
+
68
+ if (!parameters)
69
+ parameters = datasrc.split('?theme-size=')[1];
70
+
71
+ if (!parameters) {
72
+ id = datasrc.split('/')[4];
73
+ width = parseInt(id.split('-')[1]);
74
+ height = parseInt(id.split('-')[2]);
75
+ } else {
76
+ width = parseInt(parameters.split(',')[0]);
77
+ height = parseInt(parameters.split(',')[1]);
78
+ }
79
+
80
+ if (width && height) {
81
+ jQuery($).attr('src', `https://images.placeholders.dev/?width=${width}&height=${height}&text=${'...'}`);
82
+ }
83
+ } else {
84
+ if (fifuLazyVars.fifu_is_product && !datasrc.includes('.fifu.app') && jQuery($).hasClass('lazyload')) {
85
+ if (jQuery($).parents('.woocommerce-product-gallery__wrapper').length == 0)
86
+ jQuery($).attr('src', FIFU_PLACEHOLDER);
87
+ }
88
  }
89
  }
90
  }
92
  function fifu_add_srcset(selector) {
93
  types = ['src', 'data-src'];
94
  for (i = 0; i < types.length; i++) {
95
+ // speedup
96
+ new_selector = selector != 'img' ? selector : 'img[' + types[i] + '^="https://cdn.fifu.app/"]';
97
+ jQuery(new_selector).each(function (index) {
98
+ src = jQuery(this).attr(types[i]);
99
+ srcset = jQuery(this).attr(types[i] + 'set');
100
+
101
+ if (!srcset && src && src.includes('cdn.fifu.app')) {
102
+ srcset = fifuCloudVars.srcsets[src];
103
+ srcset = srcset ? srcset : fifuCloudVars.srcsets[src.split('?')[0]];
104
+ if (srcset) {
105
+ jQuery(this).attr(types[i] + 'set', srcset);
106
+ jQuery(this).attr('data-sizes', 'auto');
107
+ }
108
+ }
109
+ });
110
+
111
  // jetpack
112
  jQuery('img[' + types[i] + '*=".wp.com/"]').each(function (index) {
113
  if (jQuery(this).attr('srcset') && jQuery(this).attr('data-srcset'))
155
  return delimiter + url + delimiter;
156
  }
157
 
158
+ jQuery(document).on('lazybeforesizes', function (e) {
159
+ // dont touch on fifu gallery
160
+ if (jQuery(e.target).parent().hasClass('lslide'))
161
+ return;
162
+
163
+ // fix width and height fields, for SEO reasons
164
+ dataSrc = jQuery(e.target).attr('data-src');
165
+ if (dataSrc && dataSrc.includes('cdn.fifu.app')) {
166
+ lsWidth = jQuery(e.target)[0].width;
167
+ urlWidth = dataSrc.split('-')[1];
168
+ urlHeight = dataSrc.split('-')[2].split('?')[0];
169
+ newHeight = parseInt(lsWidth * urlHeight / urlWidth);
170
+ jQuery(e.target).attr('width', lsWidth);
171
+ jQuery(e.target).attr('height', newHeight);
172
+ }
173
+ });
174
+
175
  function fifu_lazy_ajax(selector = 'img') {
176
  jQuery(selector).each(function () {
177
  if (jQuery(this).hasClass('lazyload') || jQuery(this).hasClass('lazyloaded') || jQuery(this).hasClass('lazyloading'))
181
  if (jQuery(this).hasClass('flickr-img-responsive') || jQuery(this).hasClass('gall-img-responsive'))
182
  return;
183
 
184
+ src = jQuery(this).attr('src');
185
+ if (src && src.includes('cloud.fifu.app'))
186
+ return;
187
+
188
  jQuery(this).attr('data-src', jQuery(this).attr('src'));
189
  jQuery(this).removeAttr('src');
190
  });
includes/jetpack.php CHANGED
@@ -31,7 +31,7 @@ function fifu_jetpack_blocked($url) {
31
  if (fifu_is_photon_url($url))
32
  return true;
33
 
34
- $blocklist = array('amazon-adsystem.com', 'sapo.io', 'unsplash.com', 'i.guim.co.uk', 's.yimg.com', 's1.yimg.com', 'www.washingtonpost.com', 'pbs.twimg.com', 'www.aljazeera.com', 'image.influenster.com', 'api.screenshotmachine.com', 'rackcdn.com', 'googleusercontent.com', 'drive.google.com', 'img.brownsfashion.com', 'cdn.fifu.app', 'cloud.fifu.app');
35
  foreach ($blocklist as $domain) {
36
  if (strpos($url, $domain) !== false)
37
  return true;
31
  if (fifu_is_photon_url($url))
32
  return true;
33
 
34
+ $blocklist = array('amazon-adsystem.com', 'sapo.io', 'unsplash.com', 'i.guim.co.uk', 's.yimg.com', 's1.yimg.com', 'www.washingtonpost.com', 'pbs.twimg.com', 'www.aljazeera.com', 'image.influenster.com', 'api.screenshotmachine.com', 'rackcdn.com', 'googleusercontent.com', 'drive.google.com', 'img.brownsfashion.com', 'accounts.parrotproducts.biz', 'cdn.fifu.app', 'cloud.fifu.app');
35
  foreach ($blocklist as $domain) {
36
  if (strpos($url, $domain) !== false)
37
  return true;
includes/speedup.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ define('FIFU_SPEEDUP_SIZES', serialize(array(64, 128, 192, 256, 384, 512, 640, 768, 896, 1024, 1280, 1600, 1920)));
4
+
5
+ function fifu_is_from_speedup($url) {
6
+ return strpos($url, "cdn.fifu.app") !== false;
7
+ }
8
+
9
+ function fifu_resize_speedup_image_size($size, $url, $width, $height, $is_video) {
10
+ $new_height = intval($size * $height / $width);
11
+ return fifu_speedup_get_signed_url($url, $size, $new_height, null, null, $is_video);
12
+ }
13
+
14
+ function fifu_speedup_get_set($url) {
15
+ $sizes = fifu_speedup_get_sizes($url);
16
+ $width = $sizes[0];
17
+ $height = $sizes[1];
18
+ $is_video = $sizes[2];
19
+ $clean_url = $sizes[3];
20
+
21
+ $set = '';
22
+ $count = 0;
23
+ foreach (unserialize(FIFU_SPEEDUP_SIZES) as $i) {
24
+ $set .= (($count++ != 0) ? ', ' : '') . fifu_resize_speedup_image_size($i, $clean_url, $width, $height, $is_video) . ' ' . $i . 'w';
25
+ if ($width <= $i)
26
+ break;
27
+ }
28
+ return $set;
29
+ }
30
+
31
+ function fifu_speedup_get_url($image, $size, $att_id) {
32
+ // video-url
33
+ $image_url = $video_url = null;
34
+ $has_video = fifu_speedup_has_video_thumb($image[0]);
35
+
36
+ // add sizes
37
+ $aux = explode('/', $image[0])[4];
38
+ $original_width = (int) explode('-', $aux)[1];
39
+ $original_height = (int) explode('-', $aux)[2];
40
+
41
+ if ($image[1] <= 1) {
42
+ $image[1] = $original_width;
43
+ $image[2] = $original_height;
44
+ }
45
+
46
+ $image = fifu_add_size($image, $size);
47
+
48
+ // no height
49
+ if (!$image[2])
50
+ $image[2] = (int) ($image[1] * $original_height / $original_width);
51
+
52
+ // crop
53
+ if ($image[3] || $image[2]) {
54
+ if ($has_video && $image[1] == 320 && $image[2] == 180) {
55
+ $image[0] = $image[0] . "&resize=1280,720";
56
+ $image[1] = 1280;
57
+ $image[2] = 720;
58
+ } else {
59
+ $image[0] .= $has_video ? '&' : '?';
60
+ $image[0] .= "resize={$image[1]},{$image[2]}";
61
+ }
62
+ } else
63
+ $image[0] .= "?theme-size={$image[1]},{$image[2]}";
64
+
65
+ $image[0] = fifu_process_external_url($image[0], $att_id, $size);
66
+ return $image;
67
+ }
68
+
69
+ function fifu_speedup_has_video_thumb($url) {
70
+ return strpos($url, 'video-thumb') !== false;
71
+ }
72
+
73
+ function fifu_speedup_get_signed_url($url, $width, $height, $bucket_id, $storage_id, $is_video) {
74
+ if ($url)
75
+ $url = explode('?', $url)[0];
76
+
77
+ $proxy_auth = get_option('fifu_proxy_auth');
78
+ if (!$proxy_auth)
79
+ return $url;
80
+
81
+ if ($url) {
82
+ $aux = explode('/', $url);
83
+ $bucket_id = $aux[3];
84
+ $storage_id = $aux[4];
85
+ }
86
+
87
+ $aux = explode('-', $storage_id);
88
+ $original_width = (int) $aux[1];
89
+ $original_height = (int) $aux[2];
90
+ $center_x = (int) $aux[3];
91
+ $center_y = (int) $aux[4];
92
+ $top_head = (int) $aux[5];
93
+ $bottom = (int) $aux[6];
94
+
95
+ $watermark = $is_video ? '/wm:0.85:ce:0:0:0.25' : '';
96
+
97
+ $x_fp = number_format($center_x / $original_width, 2);
98
+ $y_fp = number_format($center_y / $original_height, 2);
99
+
100
+ // dynamic crop
101
+ if ($top_head > 0 && fifu_is_landscape($width, $height)) {
102
+ $ratio = $width / $height;
103
+ $w = fifu_is_portrait($original_width, $original_height) ? $original_width : $original_height;
104
+ $h = $w / $ratio;
105
+
106
+ if ($bottom > 0 && ($bottom - $top_head) <= $h) {
107
+ $center_y = ($top_head + $bottom) / 2;
108
+ $y_fp = number_format($center_y / $original_height, 2);
109
+ } else {
110
+ if ($center_y - ($h / 2) < $top_head) {
111
+ $diff = $top_head - ($center_y - ($h / 2));
112
+ if ($center_y + ($h / 2) < $original_height) {
113
+ $padding_bottom = $original_height - ($center_y + ($h / 2));
114
+ $center_y += min($diff, $padding_bottom);
115
+ $y_fp = number_format($center_y / $original_height, 2);
116
+ }
117
+ }
118
+ }
119
+ }
120
+
121
+ $key = pack("H*", $proxy_auth[0]);
122
+ $salt = pack("H*", $proxy_auth[1]);
123
+
124
+ $path = "/rs:fill:{$width}:{$height}:1/g:fp:{$x_fp}:{$y_fp}{$watermark}/plain/{$bucket_id}/{$storage_id}@webp";
125
+ $signature = rtrim(strtr(base64_encode(hash_hmac('sha256', $salt . $path, $key, true)), '+/', '-_'), '=');
126
+ return "https://cloud.fifu.app/{$signature}{$path}";
127
+ }
128
+
129
+ function fifu_speedup_get_sizes($url) {
130
+ $aux = explode('?', $url);
131
+ $url = $aux[0];
132
+ $parameters = isset($aux[1]) ? $aux[1] : '';
133
+ parse_str($parameters, $parameters);
134
+
135
+ $aux = explode('-', $url);
136
+ $width = (int) $aux[1];
137
+ $height = (int) $aux[2];
138
+
139
+ if (isset($parameters['resize'])) {
140
+ $aux = explode(',', $parameters['resize']);
141
+ $width = (int) $aux[0];
142
+ $height = (int) $aux[1];
143
+ }
144
+
145
+ $is_video = isset($parameters['video-thumb']);
146
+
147
+ return array($width, $height, $is_video, $url);
148
+ }
149
+
includes/thumbnail.php CHANGED
@@ -20,6 +20,10 @@ if (!in_array($pagenow, array('post.php', 'post-new.php', 'admin-ajax.php', 'wp-
20
  add_filter('wp_head', 'fifu_apply_css');
21
 
22
  function fifu_add_js() {
 
 
 
 
23
  echo '<link rel="preconnect" href="https://cdnjs.cloudflare.com">';
24
 
25
  if (fifu_is_on('fifu_photon')) {
@@ -83,7 +87,9 @@ function fifu_add_social_tags() {
83
  $description = str_replace("'", "&#39;", wp_strip_all_tags(get_post_field('post_excerpt', $post_id)));
84
 
85
  if ($url) {
86
- if (fifu_is_on('fifu_cdn_social'))
 
 
87
  $url = fifu_jetpack_photon_url($url, null);
88
  include 'html/og-image.html';
89
  }
@@ -91,8 +97,11 @@ function fifu_add_social_tags() {
91
  if (fifu_is_off('fifu_social_image_only'))
92
  include 'html/social.html';
93
 
94
- if ($url)
 
 
95
  include 'html/twitter-image.html';
 
96
  }
97
 
98
  function fifu_apply_css() {
@@ -100,6 +109,47 @@ function fifu_apply_css() {
100
  echo '<style>[class$="woocommerce-product-gallery__trigger"] {display:none !important;}</style>';
101
  }
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  add_filter('woocommerce_product_get_image', 'fifu_woo_replace', 10, 5);
104
 
105
  function fifu_woo_replace($html, $product, $woosize) {
@@ -112,6 +162,16 @@ function fifu_replace($html, $post_id, $post_thumbnail_id, $size, $attr = null)
112
  if (!$html)
113
  return $html;
114
 
 
 
 
 
 
 
 
 
 
 
115
  $datasrc = fifu_get_attribute('data-src', $html);
116
  $src = $datasrc ? $datasrc : fifu_get_attribute('src', $html);
117
  if (isset($_SESSION[$src])) {
@@ -134,20 +194,6 @@ function fifu_replace($html, $post_id, $post_thumbnail_id, $size, $attr = null)
134
  $alt = null;
135
  }
136
 
137
- if (fifu_is_on('fifu_lazy') && !is_admin() && !fifu_is_amp_active()) {
138
- if (fifu_is_avada_active()) {
139
- if (strpos($html, ' src=') !== false && strpos($html, ' data-srcset=') === false)
140
- $html = str_replace(" src=", " data-srcset=", $html);
141
- if (strpos($html, ' srcset=') !== false && strpos($html, ' data-srcset=') !== false)
142
- $html = preg_replace("/ srcset=[\'\"][^\'\"]+[\'\"]/", ' ', $html);
143
- } else {
144
- if (strpos($html, ' src=') !== false && strpos($html, ' data-src=') === false)
145
- $html = str_replace(" src=", " data-src=", $html);
146
- if (strpos($html, ' src=') !== false && strpos($html, ' data-src=') !== false)
147
- $html = preg_replace("/ src=[\'\"][^\'\"]+[\'\"]/", ' ', $html);
148
- }
149
- }
150
-
151
  if ($url)
152
  return $html;
153
 
@@ -155,9 +201,6 @@ function fifu_replace($html, $post_id, $post_thumbnail_id, $size, $attr = null)
155
  if (!$url && fifu_should_hide())
156
  return '';
157
 
158
- $width = fifu_get_attribute('width', $html);
159
- $height = fifu_get_attribute('height', $html);
160
-
161
  return !$url ? $html : fifu_get_html($url, $alt, $width, $height);
162
  }
163
 
20
  add_filter('wp_head', 'fifu_apply_css');
21
 
22
  function fifu_add_js() {
23
+ if (fifu_su_sign_up_complete()) {
24
+ echo '<link rel="preconnect" href="https://cloud.fifu.app">';
25
+ echo '<link rel="preconnect" href="https://cdn.fifu.app">';
26
+ }
27
  echo '<link rel="preconnect" href="https://cdnjs.cloudflare.com">';
28
 
29
  if (fifu_is_on('fifu_photon')) {
87
  $description = str_replace("'", "&#39;", wp_strip_all_tags(get_post_field('post_excerpt', $post_id)));
88
 
89
  if ($url) {
90
+ if (fifu_is_from_speedup($url))
91
+ $url = fifu_speedup_get_signed_url($url, 1280, 672, null, null, false);
92
+ elseif (fifu_is_on('fifu_cdn_social'))
93
  $url = fifu_jetpack_photon_url($url, null);
94
  include 'html/og-image.html';
95
  }
97
  if (fifu_is_off('fifu_social_image_only'))
98
  include 'html/social.html';
99
 
100
+ if ($url) {
101
+ if (fifu_is_from_speedup($url))
102
+ $url = fifu_speedup_get_signed_url($url, 1280, 672, null, null, false);
103
  include 'html/twitter-image.html';
104
+ }
105
  }
106
 
107
  function fifu_apply_css() {
109
  echo '<style>[class$="woocommerce-product-gallery__trigger"] {display:none !important;}</style>';
110
  }
111
 
112
+ add_filter('wp_get_attachment_image_attributes', 'fifu_wp_get_attachment_image_attributes', 10, 3);
113
+
114
+ function fifu_wp_get_attachment_image_attributes($attr, $attachment, $size) {
115
+ // ignore themes
116
+ if (in_array(strtolower(get_option('template')), array('jnews')))
117
+ return $attr;
118
+
119
+ $url = $attr['src'];
120
+ if (strpos($url, 'cdn.fifu.app') === false)
121
+ return $attr;
122
+
123
+ // "all products" page
124
+ if (function_exists('get_current_screen') && isset(get_current_screen()->parent_file) && get_current_screen()->parent_file == 'edit.php?post_type=product') {
125
+ $attr['src'] = fifu_optimized_column_image($url);
126
+ return $attr;
127
+ }
128
+
129
+ $sizes = fifu_speedup_get_sizes($url);
130
+ $width = $sizes[0];
131
+ $height = $sizes[1];
132
+ $is_video = $sizes[2];
133
+ $clean_url = $sizes[3];
134
+ $placeholder = fifu_get_placeholder($width, $height);
135
+ $attr['src'] = $placeholder;
136
+ $attr['data-src'] = $url;
137
+ $attr['data-srcset'] = fifu_speedup_get_set($url);
138
+ $attr['data-sizes'] = 'auto';
139
+
140
+ // preload placeholder
141
+ if (!isset($_SESSION['fifu-placeholder'][$placeholder])) {
142
+ $_SESSION['fifu-placeholder'][$placeholder] = true;
143
+ echo "<link rel='preload' as='image' href='{$placeholder}'>";
144
+ }
145
+
146
+ // lazyload should be added on front-end only (js) for a correct placeholder (clickmag)
147
+ // but it will be added here for products to avoid problems with zoomImg (storefront)
148
+ if (class_exists('WooCommerce') && is_product())
149
+ $attr['class'] .= ' lazyload';
150
+ return $attr;
151
+ }
152
+
153
  add_filter('woocommerce_product_get_image', 'fifu_woo_replace', 10, 5);
154
 
155
  function fifu_woo_replace($html, $product, $woosize) {
162
  if (!$html)
163
  return $html;
164
 
165
+ $width = fifu_get_attribute('width', $html);
166
+ $height = fifu_get_attribute('height', $html);
167
+
168
+ if (fifu_is_on('fifu_lazy') && !is_admin() && !fifu_is_amp_active()) {
169
+ if (strpos($html, ' src=') !== false && strpos($html, ' data-src=') === false)
170
+ $html = str_replace(" src=", " data-src=", $html);
171
+ if (strpos($html, ' src=') !== false && strpos($html, ' data-src=') !== false)
172
+ $html = preg_replace("/ src=[\'\"][^\'\"]+[\'\"]/", ' ', $html);
173
+ }
174
+
175
  $datasrc = fifu_get_attribute('data-src', $html);
176
  $src = $datasrc ? $datasrc : fifu_get_attribute('src', $html);
177
  if (isset($_SESSION[$src])) {
194
  $alt = null;
195
  }
196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  if ($url)
198
  return $html;
199
 
201
  if (!$url && fifu_should_hide())
202
  return '';
203
 
 
 
 
204
  return !$url ? $html : fifu_get_html($url, $alt, $width, $height);
205
  }
206
 
includes/util.php CHANGED
@@ -115,6 +115,19 @@ function fifu_is_valid_default_cpt($post_id) {
115
  return in_array($type, $cpts);
116
  }
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  // developers
119
 
120
  function fifu_dev_set_image($post_id, $image_url) {
115
  return in_array($type, $cpts);
116
  }
117
 
118
+ function fifu_get_placeholder($width, $height) {
119
+ $text = '...';
120
+ return "https://images.placeholders.dev/?width={$width}&height={$height}&text={$text}";
121
+ }
122
+
123
+ function fifu_is_portrait($width, $height) {
124
+ return $height > $width;
125
+ }
126
+
127
+ function fifu_is_landscape($width, $height) {
128
+ return $width >= $height;
129
+ }
130
+
131
  // developers
132
 
133
  function fifu_dev_set_image($post_id, $image_url) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://donorbox.org/fifu
4
  Tags: featured, image, url, video, woocommerce
5
  Requires at least: 5.3
6
  Tested up to: 6.0
7
- Stable tag: 3.9.9
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -26,7 +26,6 @@ Use an external image as featured image of your post, page or custom post type.
26
  * Default featured image
27
  * Hide featured media
28
  * Featured image in content
29
- * Elementor widget
30
  * Auto set image title
31
  * Save image dimensions
32
  * Featured image column
@@ -96,11 +95,14 @@ Supports videos from YouTube, Vimeo, Imgur, 9GAG, Cloudinary, Tumblr, Publitio,
96
  * **[PRO]** Loop
97
  * **[PRO]** Mute
98
  * **[PRO]** Background video
99
- * **[PRO]** Related videos
100
  * **[PRO]** Gallery icon
101
- * **[PRO]** Elementor widget
102
 
103
- #### WIDGETS
 
 
 
 
 
104
 
105
  * **[PRO]** Featured media
106
  * **[PRO]** Featured grid
@@ -121,6 +123,15 @@ Supports videos from YouTube, Vimeo, Imgur, 9GAG, Cloudinary, Tumblr, Publitio,
121
  * **[PRO]** fifu_dev_set_category_image($term_id, $image_url)
122
  * **[PRO]** fifu_dev_set_category_video($term_id, $video_url)
123
 
 
 
 
 
 
 
 
 
 
124
  #### LINKS
125
 
126
  * **<a href="https://fifu.app/">FIFU PRO</a>**
@@ -160,6 +171,18 @@ Featured Image, Figurë e Zgjedhur, Image mise en avant, Uitgelichte afbeelding,
160
 
161
  * No. Only the PRO version is capable of doing this, but it is optional. The plugin was designed to work with external images.
162
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  = Is any action necessary before removing FIFU?
164
 
165
  * Access settings and clean the metadata.
@@ -180,66 +203,72 @@ Featured Image, Figurë e Zgjedhur, Image mise en avant, Uitgelichte afbeelding,
180
 
181
  * Yes, it is. Click [here](https://www.globalbankingandfinance.com/embedding-images-the-legal-way-to-steal/) to know more.
182
 
 
 
 
 
183
 
184
  == Screenshots ==
185
 
186
- 1. Just insert the image address or some keywords and click on preview button
187
 
188
- 2. If the image URL is correct, the image will be shown
189
 
190
  3. Featured video
191
 
192
- 4. Featured slider
 
 
193
 
194
- 5. Featured image column
195
 
196
- 6. External featured media on home
197
 
198
- 7. External featured image on post
199
 
200
- 8. Featured video on post
201
 
202
- 9. Featured slider on post
203
 
204
- 10. Many settings
205
 
206
- 11. External image gallery
207
 
208
- 12. External video gallery
209
 
210
- 13. External featured media on WooCommerce shop
211
 
212
- 14. External featured media on cart
213
 
214
- 15. External image gallery
215
 
216
- 16. External featured image on lightbox
217
 
218
- 17. Zoom
219
 
220
- 18. Video gallery
221
 
222
- 19. Featured video on lightbox
223
 
224
- 20. Fullscreen
225
 
226
 
227
  == Changelog ==
228
 
 
 
 
229
  = 3.9.9 =
230
  * Fix: URLs with apostrophe character not working; fix: Lazy Load (conflict with Flickr Album Gallery plugin); deprecated: Giphy Search.
231
 
232
  = 3.9.8 =
233
  * New option: Featured Slider > vertical mode; enhancement: Save in the Media Library > proxy (supports username and password now); fix: Automatic Updates (DB operation making the process slow); deprecated: Flickr Thumbnails (by CDN + Optimized Thumbnails).
234
 
235
- = 3.9.7 =
236
- * Enhancements: FIFU widget for Elementor (sets the image as featured image now and does not require Elementor PRO); new Elementor widget: Featured Video.
237
-
238
  = others =
239
  * [more](https://fifu.app/changelog)
240
 
241
 
242
  == Upgrade Notice ==
243
 
244
- = 3.9.9 =
245
- * Fix: URLs with apostrophe character not working; fix: Lazy Load (conflict with Flickr Album Gallery plugin); deprecated: Giphy Search.
4
  Tags: featured, image, url, video, woocommerce
5
  Requires at least: 5.3
6
  Tested up to: 6.0
7
+ Stable tag: 4.0.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
26
  * Default featured image
27
  * Hide featured media
28
  * Featured image in content
 
29
  * Auto set image title
30
  * Save image dimensions
31
  * Featured image column
95
  * **[PRO]** Loop
96
  * **[PRO]** Mute
97
  * **[PRO]** Background video
 
98
  * **[PRO]** Gallery icon
 
99
 
100
+ #### ELEMENTOR WIDGETS
101
+
102
+ * Featured image
103
+ * **[PRO]** Featured video
104
+
105
+ #### WORDPRESS WIDGETS
106
 
107
  * **[PRO]** Featured media
108
  * **[PRO]** Featured grid
123
  * **[PRO]** fifu_dev_set_category_image($term_id, $image_url)
124
  * **[PRO]** fifu_dev_set_category_video($term_id, $video_url)
125
 
126
+ #### FIFU CLOUD (COMING SOON)
127
+
128
+ * Cloud storage (never lose an image again)
129
+ * Global CDN (images loaded much faster)
130
+ * Optimized thumbnails (processed in the cloud)
131
+ * Pay-as-you-go (per stored image)
132
+ * Smart crop (detects people and objects before cropping)
133
+ * Hotlink protection (sites can't embed your images)
134
+
135
  #### LINKS
136
 
137
  * **<a href="https://fifu.app/">FIFU PRO</a>**
171
 
172
  * No. Only the PRO version is capable of doing this, but it is optional. The plugin was designed to work with external images.
173
 
174
+ = Why the featured image is being displayed twice? =
175
+
176
+ * You enabled "Featured Image in Content" option unnecessarily.
177
+
178
+ = Why the featured image is not being displayed? =
179
+
180
+ * Please check if "Hide Featured Media" option is unduly enabled.
181
+
182
+ = Why are there no changes after changing the settings? =
183
+
184
+ * Try to clean your cache.
185
+
186
  = Is any action necessary before removing FIFU?
187
 
188
  * Access settings and clean the metadata.
203
 
204
  * Yes, it is. Click [here](https://www.globalbankingandfinance.com/embedding-images-the-legal-way-to-steal/) to know more.
205
 
206
+ = Do external images affect SEO?
207
+
208
+ * No, they don't. Click [here](https://www.searchenginejournal.com/does-using-a-cdn-improve-ranking/) to know more.
209
+
210
 
211
  == Screenshots ==
212
 
213
+ 1. Featured image
214
 
215
+ 2. Unsplash image search
216
 
217
  3. Featured video
218
 
219
+ 4. Image gallery for WooCommerce products
220
+
221
+ 5. Image gallery for WooCommerce product variations
222
 
223
+ 6. Quick edit
224
 
225
+ 7. Elementor widgets
226
 
227
+ 8. Settings: featured image
228
 
229
+ 9. Settings: featured video
230
 
231
+ 10. Settings: featured slider
232
 
233
+ 11. Settings: shortcode
234
 
235
+ 12. Settings: automatic
236
 
237
+ 13. Settings: social
238
 
239
+ 14. Settings: performance
240
 
241
+ 15. Settings: WooCommerce
242
 
243
+ 16. Settings: WP All Import
244
 
245
+ 17. Settings: REST API
246
 
247
+ 18. Settings: Admin
248
 
249
+ 19. Settings: Metadata
250
 
251
+ 20. integration functions for developers
252
 
253
+ 21. FIFU Cloud
254
 
255
 
256
  == Changelog ==
257
 
258
+ = 4.0.0 =
259
+ * FIFU Cloud: available for beta testers; enhancement: security (prevents CSRF attack); enhancement: Play Button > hide from grid (WordPress/WooCommerce); enhancement: Mute (desktop/mobile); deprecated: Related Videos.
260
+
261
  = 3.9.9 =
262
  * Fix: URLs with apostrophe character not working; fix: Lazy Load (conflict with Flickr Album Gallery plugin); deprecated: Giphy Search.
263
 
264
  = 3.9.8 =
265
  * New option: Featured Slider > vertical mode; enhancement: Save in the Media Library > proxy (supports username and password now); fix: Automatic Updates (DB operation making the process slow); deprecated: Flickr Thumbnails (by CDN + Optimized Thumbnails).
266
 
 
 
 
267
  = others =
268
  * [more](https://fifu.app/changelog)
269
 
270
 
271
  == Upgrade Notice ==
272
 
273
+ = 4.0.0 =
274
+ * FIFU Cloud: available for beta testers; enhancement: security (prevents CSRF attack); enhancement: Play Button > hide from grid (WordPress/WooCommerce); enhancement: Mute (desktop/mobile); deprecated: Related Videos.