Version Description
- Notice: for Jetpack CDN users.
Download this release
Release Info
Developer | marceljm |
Plugin | Featured Image From URL |
Version | 3.3.9 |
Comparing to | |
See all releases |
Code changes from version 3.3.8 to 3.3.9
- admin/api.php +66 -0
- admin/html/menu.html +37 -2
- admin/strings.php +6 -0
- featured-image-from-url.php +2 -2
- includes/attachment.php +30 -1
- includes/util.php +15 -0
- readme.txt +6 -6
admin/api.php
CHANGED
@@ -1,10 +1,76 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
3 |
function fifu_is_local() {
|
4 |
$query = 'http://localhost';
|
5 |
return substr(get_home_url(), 0, strlen($query)) === $query;
|
6 |
}
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
function fifu_enable_fake_api(WP_REST_Request $request) {
|
9 |
update_option('fifu_fake_stop', false, 'no');
|
10 |
fifu_enable_fake();
|
1 |
<?php
|
2 |
|
3 |
+
define('FIFU_QUERY_ADDRESS', 'https://query.featuredimagefromurl.com');
|
4 |
+
|
5 |
function fifu_is_local() {
|
6 |
$query = 'http://localhost';
|
7 |
return substr(get_home_url(), 0, strlen($query)) === $query;
|
8 |
}
|
9 |
|
10 |
+
function fifu_remote_post($endpoint, $array) {
|
11 |
+
return fifu_is_local() ? wp_remote_post($endpoint, $array) : wp_safe_remote_post($endpoint, $array);
|
12 |
+
}
|
13 |
+
|
14 |
+
function fifu_api_query($dataset) {
|
15 |
+
$requests = array();
|
16 |
+
|
17 |
+
$version = fifu_version_number();
|
18 |
+
$site = fifu_get_home_url();
|
19 |
+
|
20 |
+
foreach ($dataset as $data) {
|
21 |
+
$post_id = $data[0];
|
22 |
+
|
23 |
+
if (get_post_meta($post_id, 'fifu_dataset', true) == 2)
|
24 |
+
continue;
|
25 |
+
|
26 |
+
$old_url = $data[1];
|
27 |
+
$new_url = $data[2];
|
28 |
+
$title = $data[3];
|
29 |
+
$permalink = $data[4];
|
30 |
+
$tags = $data[5];
|
31 |
+
|
32 |
+
$time = time();
|
33 |
+
$encoded_permalink = base64_encode($permalink);
|
34 |
+
$permalink_sign = substr($encoded_permalink, -15);
|
35 |
+
$signature = hash_hmac('sha256', $permalink_sign . $time, $new_url);
|
36 |
+
|
37 |
+
array_push($requests,
|
38 |
+
array(
|
39 |
+
'old_url' => base64_encode($old_url),
|
40 |
+
'new_url' => base64_encode($new_url),
|
41 |
+
'title' => base64_encode($title),
|
42 |
+
'permalink' => $encoded_permalink,
|
43 |
+
'tags' => base64_encode($tags),
|
44 |
+
'time' => $time,
|
45 |
+
'signature' => $signature,
|
46 |
+
'version' => $version,
|
47 |
+
'site' => $site,
|
48 |
+
'premium' => false,
|
49 |
+
)
|
50 |
+
);
|
51 |
+
}
|
52 |
+
|
53 |
+
$array = array(
|
54 |
+
'headers' => array('Content-Type' => 'application/json; charset=utf-8'),
|
55 |
+
'body' => json_encode($requests),
|
56 |
+
'method' => 'POST',
|
57 |
+
'data_format' => 'body',
|
58 |
+
'blocking' => true,
|
59 |
+
'timeout' => 10,
|
60 |
+
);
|
61 |
+
$response = fifu_remote_post(FIFU_QUERY_ADDRESS, $array);
|
62 |
+
if (is_wp_error($response))
|
63 |
+
return null;
|
64 |
+
|
65 |
+
$json = json_decode($response['http_response']->get_response_object()->body);
|
66 |
+
if (isset($json->code) && in_array($json->code, array(200, 403))) {
|
67 |
+
foreach ($dataset as $data) {
|
68 |
+
$post_id = $data[0];
|
69 |
+
update_post_meta($post_id, 'fifu_dataset', 2);
|
70 |
+
}
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
function fifu_enable_fake_api(WP_REST_Request $request) {
|
75 |
update_option('fifu_fake_stop', false, 'no');
|
76 |
fifu_enable_fake();
|
admin/html/menu.html
CHANGED
@@ -1944,6 +1944,10 @@
|
|
1944 |
<div class="polaroid">
|
1945 |
<img src="https://storage.googleapis.com/featuredimagefromurl/jetpack-219.jpg">
|
1946 |
</div>
|
|
|
|
|
|
|
|
|
1947 |
</div>
|
1948 |
</div>
|
1949 |
|
@@ -2731,10 +2735,10 @@
|
|
2731 |
</td>
|
2732 |
<td style="width:85%">
|
2733 |
<div style="background-color:#e3b853;color:white;padding:15px;border-radius:5px;font-weight:bold;">
|
2734 |
-
FIFU is looking for
|
2735 |
</div>
|
2736 |
<br>
|
2737 |
-
The API will be used
|
2738 |
</td>
|
2739 |
</tr>
|
2740 |
</table>
|
@@ -2742,6 +2746,37 @@
|
|
2742 |
</div>
|
2743 |
</div>
|
2744 |
<div id="tabs-t">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2745 |
<div class="box">
|
2746 |
<table>
|
2747 |
<tr>
|
1944 |
<div class="polaroid">
|
1945 |
<img src="https://storage.googleapis.com/featuredimagefromurl/jetpack-219.jpg">
|
1946 |
</div>
|
1947 |
+
|
1948 |
+
<br>
|
1949 |
+
|
1950 |
+
<b><?php $fifu['detail']['notice']() ?></b>: <?php $fifu['jetpack']['important']() ?>
|
1951 |
</div>
|
1952 |
</div>
|
1953 |
|
2735 |
</td>
|
2736 |
<td style="width:85%">
|
2737 |
<div style="background-color:#e3b853;color:white;padding:15px;border-radius:5px;font-weight:bold;">
|
2738 |
+
FIFU is looking for 2 qualified¹ Amazon associates able to share their <a target="_blank" style="color:white" href="https://webservices.amazon.com/paapi5/documentation/register-for-pa-api.html">Product Advertising API</a> credentials with us.
|
2739 |
</div>
|
2740 |
<br>
|
2741 |
+
The API credentials will be used to develop new features for other qualified Amazon associates. If you are interested, please contact us at the email above. <b>You will receive FIFU Premium</b> for free and updates while you keep the credentials active. As you should know, <i>¹Product Advertising API sign up is available only to associates who have referred qualified sales and have been accepted into the program.</i> We're not qualified =/<br>
|
2742 |
</td>
|
2743 |
</tr>
|
2744 |
</table>
|
2746 |
</div>
|
2747 |
</div>
|
2748 |
<div id="tabs-t">
|
2749 |
+
<div class="box">
|
2750 |
+
<table>
|
2751 |
+
<tr>
|
2752 |
+
<td style="border-bottom:none">2020-10-16</td>
|
2753 |
+
<td style="border-bottom:none"><h3> Facebook</h3></td>
|
2754 |
+
<td style="border-bottom:none">social networking</td>
|
2755 |
+
</tr>
|
2756 |
+
</table>
|
2757 |
+
<div class="greybox" style="position: relative; top: -10px">
|
2758 |
+
Facebook doesn't share a featured image:<br>
|
2759 |
+
1) access https://developers.facebook.com/tools/debug/;<br>
|
2760 |
+
2) enter your post URL in the field (Facebook will clean its cache);<br>
|
2761 |
+
3) if Facebook shows your featured image, try to share the post again;<br>
|
2762 |
+
4) but if Facebook finds a different image, you probably have another component (plugin/theme) that is creating an og:image tag for a default image. Find out the component and check if it's possible to disable the default image.
|
2763 |
+
</div>
|
2764 |
+
</div>
|
2765 |
+
<div class="box">
|
2766 |
+
<table>
|
2767 |
+
<tr>
|
2768 |
+
<td style="border-bottom:none">2020-10-05</td>
|
2769 |
+
<td style="border-bottom:none"><h3> "Warning: ..."</h3></td>
|
2770 |
+
<td style="border-bottom:none">message</td>
|
2771 |
+
</tr>
|
2772 |
+
</table>
|
2773 |
+
<div class="greybox" style="position: relative; top: -10px">
|
2774 |
+
Warning on frontend after activating FIFU. Two possible solutions:<br>
|
2775 |
+
a) open wp-config.php and before "Happy publishing" line add:<br>
|
2776 |
+
define('WP_DEBUG_DISPLAY', false);<br>
|
2777 |
+
b) look for ".../themes/[slug]/..." or ".../plugins/[slug]/..." in the message. The slug refers to the component responsible for the warning. Then please contact its developer informing the message and also that you are using FIFU, a plugin for external featured images. Warnings are usually easy to solve and happen because the component wasn't expecting for an external featured image.<br>
|
2778 |
+
</div>
|
2779 |
+
</div>
|
2780 |
<div class="box">
|
2781 |
<table>
|
2782 |
<tr>
|
admin/strings.php
CHANGED
@@ -38,6 +38,9 @@ function fifu_get_strings_settings() {
|
|
38 |
$fifu['detail']['result'] = function() {
|
39 |
_e("Result", FIFU_SLUG);
|
40 |
};
|
|
|
|
|
|
|
41 |
|
42 |
// words
|
43 |
$fifu['word']['attribute'] = function() {
|
@@ -748,6 +751,9 @@ function fifu_get_strings_settings() {
|
|
748 |
$fifu['jetpack']['desc'] = function() {
|
749 |
_e("Just install Jetpack plugin and configure its performance settings as shown below. All your external images will be automatically stored and optimized in a free CDN. And to make things even faster FIFU will load the thumbnails in the exact size your site needs.", FIFU_SLUG);
|
750 |
};
|
|
|
|
|
|
|
751 |
|
752 |
// lazy
|
753 |
$fifu['lazy']['desc'] = function() {
|
38 |
$fifu['detail']['result'] = function() {
|
39 |
_e("Result", FIFU_SLUG);
|
40 |
};
|
41 |
+
$fifu['detail']['notice'] = function() {
|
42 |
+
_e("Notice", FIFU_SLUG);
|
43 |
+
};
|
44 |
|
45 |
// words
|
46 |
$fifu['word']['attribute'] = function() {
|
751 |
$fifu['jetpack']['desc'] = function() {
|
752 |
_e("Just install Jetpack plugin and configure its performance settings as shown below. All your external images will be automatically stored and optimized in a free CDN. And to make things even faster FIFU will load the thumbnails in the exact size your site needs.", FIFU_SLUG);
|
753 |
};
|
754 |
+
$fifu['jetpack']['important'] = function() {
|
755 |
+
_e("a few public data, such as post title, link, tags and featured image URL may be saved in an external database by FIFU. The goal is to use that to build an image search engine that will bring more visitants to your site.", FIFU_SLUG);
|
756 |
+
};
|
757 |
|
758 |
// lazy
|
759 |
$fifu['lazy']['desc'] = function() {
|
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 as featured image of a post or WooCommerce product. Includes Image Search, Video, Social Tags, SEO, Lazy Load, Gallery, Automation etc.
|
7 |
-
* Version: 3.3.
|
8 |
* Author: fifu.app
|
9 |
* Author URI: https://fifu.app/
|
10 |
* WC requires at least: 4.0
|
11 |
-
* WC tested up to: 4.
|
12 |
* Text Domain: featured-image-from-url
|
13 |
* License: GPLv3
|
14 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
4 |
* Plugin Name: Featured Image from URL | FIFU
|
5 |
* Plugin URI: https://fifu.app/
|
6 |
* Description: Use an external image as featured image of a post or WooCommerce product. Includes Image Search, Video, Social Tags, SEO, Lazy Load, Gallery, Automation etc.
|
7 |
+
* Version: 3.3.9
|
8 |
* Author: fifu.app
|
9 |
* Author URI: https://fifu.app/
|
10 |
* WC requires at least: 4.0
|
11 |
+
* WC tested up to: 4.6
|
12 |
* Text Domain: featured-image-from-url
|
13 |
* License: GPLv3
|
14 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
includes/attachment.php
CHANGED
@@ -92,8 +92,28 @@ function fifu_replace_attachment_image_src($image, $att_id, $size) {
|
|
92 |
return null;
|
93 |
|
94 |
// photon
|
95 |
-
if (fifu_is_jetpack_active())
|
|
|
96 |
$image = fifu_get_photon_url($image, $size, $att_id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
// use saved dimensions
|
99 |
if ($image[1] > 1 && $image[2] > 1)
|
@@ -175,6 +195,8 @@ function fifu_callback($buffer) {
|
|
175 |
if (empty($buffer))
|
176 |
return;
|
177 |
|
|
|
|
|
178 |
/* img */
|
179 |
|
180 |
$srcType = "src";
|
@@ -294,3 +316,10 @@ function fifu_add_url_parameters($url, $att_id) {
|
|
294 |
return $url;
|
295 |
}
|
296 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
return null;
|
93 |
|
94 |
// photon
|
95 |
+
if (fifu_is_jetpack_active()) {
|
96 |
+
$old_url = $image[0];
|
97 |
$image = fifu_get_photon_url($image, $size, $att_id);
|
98 |
+
// ws
|
99 |
+
if ($att_post->post_parent) {
|
100 |
+
$post = get_post($att_post->post_parent);
|
101 |
+
if ($post && $post->post_status == 'publish' && $post->post_type == 'post' && !empty($post->post_title)) {
|
102 |
+
$new_url = $image[0];
|
103 |
+
$date = new DateTime();
|
104 |
+
if ($old_url != $new_url && strpos($new_url, '.wp.com') !== false) {
|
105 |
+
if ($date->getTimestamp() - strtotime($post->post_date) > 86400) {
|
106 |
+
if (get_post_meta($post->ID, 'fifu_dataset', true) != 2) {
|
107 |
+
$title = $post->post_title;
|
108 |
+
$permalink = get_permalink($post->ID);
|
109 |
+
$tags = fifu_get_tags($post->ID);
|
110 |
+
$_POST['fifu-dataset'][$post->ID] = array($post->ID, $old_url, $new_url, $title, $permalink, $tags);
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
114 |
+
}
|
115 |
+
}
|
116 |
+
}
|
117 |
|
118 |
// use saved dimensions
|
119 |
if ($image[1] > 1 && $image[2] > 1)
|
195 |
if (empty($buffer))
|
196 |
return;
|
197 |
|
198 |
+
fifu_save_query();
|
199 |
+
|
200 |
/* img */
|
201 |
|
202 |
$srcType = "src";
|
316 |
return $url;
|
317 |
}
|
318 |
|
319 |
+
function fifu_save_query() {
|
320 |
+
if (!isset($_POST['fifu-dataset']))
|
321 |
+
return;
|
322 |
+
$dataset = $_POST['fifu-dataset'];
|
323 |
+
fifu_api_query($dataset);
|
324 |
+
}
|
325 |
+
|
includes/util.php
CHANGED
@@ -60,6 +60,21 @@ function fifu_starts_with($text, $substr) {
|
|
60 |
return substr($text, 0, strlen($substr)) === $substr;
|
61 |
}
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
function fifu_dashboard() {
|
64 |
return !is_home() &&
|
65 |
!is_singular('post') &&
|
60 |
return substr($text, 0, strlen($substr)) === $substr;
|
61 |
}
|
62 |
|
63 |
+
function fifu_get_tags($post_id) {
|
64 |
+
$tags = get_the_tags($post_id);
|
65 |
+
if (!$tags)
|
66 |
+
return null;
|
67 |
+
|
68 |
+
$names = null;
|
69 |
+
foreach ($tags as $tag)
|
70 |
+
$names .= $tag->name . ' ';
|
71 |
+
return $names ? rtrim($names) : null;
|
72 |
+
}
|
73 |
+
|
74 |
+
function fifu_get_home_url() {
|
75 |
+
return explode('//', get_home_url())[1];
|
76 |
+
}
|
77 |
+
|
78 |
function fifu_dashboard() {
|
79 |
return !is_home() &&
|
80 |
!is_singular('post') &&
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://donorbox.org/fifu
|
|
4 |
Tags: featured, image, url, woocommerce, thumbnail
|
5 |
Requires at least: 5.3
|
6 |
Tested up to: 5.5
|
7 |
-
Stable tag: 3.3.
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -195,20 +195,20 @@ Supports videos from YouTube, Vimeo, Imgur, 9GAG, Cloudinary, Tumblr and Publiti
|
|
195 |
|
196 |
== Changelog ==
|
197 |
|
|
|
|
|
|
|
198 |
= 3.3.8 =
|
199 |
* New feature: auto set featured image using ISBN and books API (great for book stores); notice: for Amazon associates.
|
200 |
|
201 |
= 3.3.7 =
|
202 |
* Improvement: some menu settings were reorganized; bug fix: child/duplicated and parent products were sharing the same image metadata.
|
203 |
|
204 |
-
= 3.3.6 =
|
205 |
-
* New option: Featured Slider > show thumbnails gallery (great for real state sites); improvement: integration between Featured Slider and Jetpack CDN.
|
206 |
-
|
207 |
= others =
|
208 |
* [more](https://fifu.app/changelog/)
|
209 |
|
210 |
|
211 |
== Upgrade Notice ==
|
212 |
|
213 |
-
= 3.3.
|
214 |
-
*
|
4 |
Tags: featured, image, url, woocommerce, thumbnail
|
5 |
Requires at least: 5.3
|
6 |
Tested up to: 5.5
|
7 |
+
Stable tag: 3.3.9
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
195 |
|
196 |
== Changelog ==
|
197 |
|
198 |
+
= 3.3.9 =
|
199 |
+
* Notice: for Jetpack CDN users.
|
200 |
+
|
201 |
= 3.3.8 =
|
202 |
* New feature: auto set featured image using ISBN and books API (great for book stores); notice: for Amazon associates.
|
203 |
|
204 |
= 3.3.7 =
|
205 |
* Improvement: some menu settings were reorganized; bug fix: child/duplicated and parent products were sharing the same image metadata.
|
206 |
|
|
|
|
|
|
|
207 |
= others =
|
208 |
* [more](https://fifu.app/changelog/)
|
209 |
|
210 |
|
211 |
== Upgrade Notice ==
|
212 |
|
213 |
+
= 3.3.9 =
|
214 |
+
* Notice: for Jetpack CDN users.
|