Version Description
- Enhancement: keyword image search (multiple suggestions, infinite scroll and integration with Quick Edit); enhancement: CDN + Optimized Thumbnails (does not require Jetpack plugin anymore).
Download this release
Release Info
Developer | marceljm |
Plugin | Featured Image From URL |
Version | 3.6.6 |
Comparing to | |
See all releases |
Code changes from version 3.6.5 to 3.6.6
- admin/cli-commands.php +11 -0
- admin/column.php +3 -0
- admin/html/css/unsplash.css +7 -0
- admin/html/js/column.js +12 -2
- admin/html/js/menu.js +0 -1
- admin/html/js/meta-box.js +32 -21
- admin/html/js/unsplash.js +60 -0
- admin/html/menu.html +42 -16
- admin/html/meta-box.html +1 -9
- admin/html/support-data.html +1 -0
- admin/menu.php +4 -1
- admin/meta-box.php +12 -0
- admin/strings.php +43 -14
- featured-image-from-url.php +2 -3
- includes/attachment.php +19 -12
- includes/html/js/lazySizesConfig.js +1 -1
- includes/jetpack.php +14 -5
- includes/thumbnail.php +7 -0
- includes/util.php +0 -17
- readme.txt +12 -9
admin/cli-commands.php
CHANGED
@@ -233,6 +233,17 @@ class fifu_cli extends WP_CLI_Command {
|
|
233 |
|
234 |
// performance
|
235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
function lazy($args) {
|
237 |
switch ($args[0]) {
|
238 |
case 'on':
|
233 |
|
234 |
// performance
|
235 |
|
236 |
+
function cdn($args) {
|
237 |
+
switch ($args[0]) {
|
238 |
+
case 'on':
|
239 |
+
update_option('fifu_photon', 'toggleon', 'no'); // toggle
|
240 |
+
break;
|
241 |
+
case 'off':
|
242 |
+
update_option('fifu_photon', 'toggleoff', 'no'); // toggle
|
243 |
+
break;
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
function lazy($args) {
|
248 |
switch ($args[0]) {
|
249 |
case 'on':
|
admin/column.php
CHANGED
@@ -25,10 +25,13 @@ function fifu_admin_add_css_js() {
|
|
25 |
wp_localize_script('fifu-column-js', 'fifuColumnVars', [
|
26 |
'labelImage' => $fifu['title']['image'](),
|
27 |
'labelVideo' => $fifu['title']['video'](),
|
|
|
28 |
'tipImage' => $fifu['tip']['image'](),
|
29 |
'tipVideo' => $fifu['tip']['video'](),
|
|
|
30 |
'urlImage' => $fifu['url']['image'](),
|
31 |
'urlVideo' => $fifu['url']['video'](),
|
|
|
32 |
]);
|
33 |
}
|
34 |
|
25 |
wp_localize_script('fifu-column-js', 'fifuColumnVars', [
|
26 |
'labelImage' => $fifu['title']['image'](),
|
27 |
'labelVideo' => $fifu['title']['video'](),
|
28 |
+
'labelSearch' => $fifu['title']['search'](),
|
29 |
'tipImage' => $fifu['tip']['image'](),
|
30 |
'tipVideo' => $fifu['tip']['video'](),
|
31 |
+
'tipSearch' => $fifu['tip']['search'](),
|
32 |
'urlImage' => $fifu['url']['image'](),
|
33 |
'urlVideo' => $fifu['url']['video'](),
|
34 |
+
'keywords' => $fifu['image']['keywords'](),
|
35 |
]);
|
36 |
}
|
37 |
|
admin/html/css/unsplash.css
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.fancybox-bg {
|
2 |
+
opacity: 0.4 !important;
|
3 |
+
}
|
4 |
+
|
5 |
+
div.mItem > img {
|
6 |
+
cursor: pointer;
|
7 |
+
}
|
admin/html/js/column.js
CHANGED
@@ -19,18 +19,28 @@ function fifu_open_quick_lightbox() {
|
|
19 |
<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>
|
20 |
<div>
|
21 |
<div style="padding-bottom:5px">
|
22 |
-
<span class="dashicons dashicons-camera" style="font-size:20px" title="${fifuColumnVars.tipImage}"></span>
|
23 |
<b>${fifuColumnVars.labelImage}</b>
|
24 |
</div>
|
25 |
<input id="fifu-quick-input-url" type="text" placeholder="${fifuColumnVars.urlImage}" value="${url}"/>
|
26 |
<br><br>
|
27 |
|
28 |
<div style="padding-bottom:5px">
|
29 |
-
<span class="dashicons dashicons-video-alt3" style="font-size:20px" title="${fifuColumnVars.tipVideo}"></span>
|
30 |
<b>${fifuColumnVars.labelVideo}</b>
|
31 |
</div>
|
32 |
<input id="fifu-quick-video-input-url" type="text" placeholder="${fifuColumnVars.urlVideo}" value=""/>
|
33 |
<br><br>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
</div>
|
35 |
<div style="width:100%">
|
36 |
<button id="fifu-clean-button" class="fifu-quick-button" type="button" style="background-color: #e7e7e7; color: black;">Clean</button>
|
19 |
<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>
|
20 |
<div>
|
21 |
<div style="padding-bottom:5px">
|
22 |
+
<span class="dashicons dashicons-camera" style="font-size:20px;cursor:auto;" title="${fifuColumnVars.tipImage}"></span>
|
23 |
<b>${fifuColumnVars.labelImage}</b>
|
24 |
</div>
|
25 |
<input id="fifu-quick-input-url" type="text" placeholder="${fifuColumnVars.urlImage}" value="${url}"/>
|
26 |
<br><br>
|
27 |
|
28 |
<div style="padding-bottom:5px">
|
29 |
+
<span class="dashicons dashicons-video-alt3" style="font-size:20px;cursor:auto;" title="${fifuColumnVars.tipVideo}"></span>
|
30 |
<b>${fifuColumnVars.labelVideo}</b>
|
31 |
</div>
|
32 |
<input id="fifu-quick-video-input-url" type="text" placeholder="${fifuColumnVars.urlVideo}" value=""/>
|
33 |
<br><br>
|
34 |
+
|
35 |
+
<div style="padding-bottom:5px">
|
36 |
+
<span class="dashicons dashicons-search" style="font-size:20px;cursor:auto" title="${fifuColumnVars.tipSearch}"></span>
|
37 |
+
<b>${fifuColumnVars.labelSearch}</b>
|
38 |
+
</div>
|
39 |
+
<div>
|
40 |
+
<input id="fifu-quick-search-input-keywords" type="text" placeholder="${fifuColumnVars.keywords}" value="" style="width:170px"/>
|
41 |
+
<button id="fifu-search-button" class="fifu-quick-button" type="button" style="width:50px;border-radius:5px;height:30px;position:absolute;background-color:#3c434a"><span class="dashicons dashicons-search" style="font-size:16px;cursor:auto"></span></button>
|
42 |
+
</div>
|
43 |
+
<br><br>
|
44 |
</div>
|
45 |
<div style="width:100%">
|
46 |
<button id="fifu-clean-button" class="fifu-quick-button" type="button" style="background-color: #e7e7e7; color: black;">Clean</button>
|
admin/html/js/menu.js
CHANGED
@@ -48,7 +48,6 @@ jQuery(function () {
|
|
48 |
jQuery("#tabsPremium").tabs();
|
49 |
jQuery("#tabsWooImport").tabs();
|
50 |
jQuery("#tabsWpAllImport").tabs();
|
51 |
-
jQuery("#tabsCDN").tabs();
|
52 |
jQuery("#tabsShortcode").tabs();
|
53 |
jQuery("#tabsFifuShortcode").tabs();
|
54 |
jQuery("#tabsAutoSet").tabs();
|
48 |
jQuery("#tabsPremium").tabs();
|
49 |
jQuery("#tabsWooImport").tabs();
|
50 |
jQuery("#tabsWpAllImport").tabs();
|
|
|
51 |
jQuery("#tabsShortcode").tabs();
|
52 |
jQuery("#tabsFifuShortcode").tabs();
|
53 |
jQuery("#tabsAutoSet").tabs();
|
admin/html/js/meta-box.js
CHANGED
@@ -3,7 +3,6 @@ function removeImage() {
|
|
3 |
jQuery("#fifu_image").hide();
|
4 |
jQuery("#fifu_upload").hide();
|
5 |
jQuery("#fifu_link").hide();
|
6 |
-
jQuery("#fifu_next").hide();
|
7 |
|
8 |
jQuery("#fifu_input_alt").val("");
|
9 |
jQuery("#fifu_input_url").val("");
|
@@ -40,27 +39,23 @@ function previewImage() {
|
|
40 |
runPreview($url);
|
41 |
}
|
42 |
setTimeout(function () {
|
43 |
-
jQuery("#fifu_next").hide();
|
44 |
if (fifuMetaBoxVars.is_taxonomy)
|
45 |
jQuery('#fifu_button').parent().parent().unblock();
|
46 |
else
|
47 |
jQuery('#fifu_button').parent().parent().parent().unblock();
|
48 |
-
|
49 |
-
if (jQuery("#fifu_link").is(":visible"))
|
50 |
-
jQuery("#fifu_next").show();
|
51 |
-
}, 2000);
|
52 |
-
}, 2000);
|
53 |
}
|
54 |
}
|
55 |
if (!$url || $url == ' ')
|
56 |
xhr.open("GET", 'https://source.unsplash.com/random', true);
|
57 |
-
else
|
58 |
xhr.open("GET", 'https://source.unsplash.com/featured/?' + $url, true);
|
|
|
|
|
59 |
xhr.send();
|
60 |
if (!$url)
|
61 |
jQuery("#fifu_keywords").val(' ');
|
62 |
} else {
|
63 |
-
jQuery("#fifu_next").hide();
|
64 |
runPreview($url);
|
65 |
}
|
66 |
}
|
@@ -90,8 +85,8 @@ function runPreview($url) {
|
|
90 |
}
|
91 |
|
92 |
jQuery(document).ready(function () {
|
93 |
-
//
|
94 |
-
|
95 |
|
96 |
// lightbox
|
97 |
fifu_open_lightbox();
|
@@ -116,6 +111,8 @@ jQuery(document).ready(function () {
|
|
116 |
|
117 |
function fifu_get_sizes() {
|
118 |
image_url = jQuery("#fifu_input_url").val();
|
|
|
|
|
119 |
fifu_get_image(image_url);
|
120 |
}
|
121 |
|
@@ -137,19 +134,33 @@ function fifu_open_lightbox() {
|
|
137 |
});
|
138 |
}
|
139 |
|
140 |
-
function fifu_find_next() {
|
141 |
-
jQuery("#fifu_next").on('click', function (evt) {
|
142 |
-
evt.stopImmediatePropagation();
|
143 |
-
if (jQuery("#fifu_keywords").val()) {
|
144 |
-
jQuery("#fifu_input_url").val(jQuery("#fifu_keywords").val());
|
145 |
-
previewImage();
|
146 |
-
}
|
147 |
-
});
|
148 |
-
}
|
149 |
-
|
150 |
function fifu_type_url() {
|
151 |
jQuery("#fifu_input_url").on('input', function (evt) {
|
152 |
evt.stopImmediatePropagation();
|
153 |
fifu_get_sizes();
|
154 |
});
|
155 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
jQuery("#fifu_image").hide();
|
4 |
jQuery("#fifu_upload").hide();
|
5 |
jQuery("#fifu_link").hide();
|
|
|
6 |
|
7 |
jQuery("#fifu_input_alt").val("");
|
8 |
jQuery("#fifu_input_url").val("");
|
39 |
runPreview($url);
|
40 |
}
|
41 |
setTimeout(function () {
|
|
|
42 |
if (fifuMetaBoxVars.is_taxonomy)
|
43 |
jQuery('#fifu_button').parent().parent().unblock();
|
44 |
else
|
45 |
jQuery('#fifu_button').parent().parent().parent().unblock();
|
46 |
+
}, 500);
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
}
|
49 |
if (!$url || $url == ' ')
|
50 |
xhr.open("GET", 'https://source.unsplash.com/random', true);
|
51 |
+
else {
|
52 |
xhr.open("GET", 'https://source.unsplash.com/featured/?' + $url, true);
|
53 |
+
fifu_start_unsplash_lightbox($url, 'featured');
|
54 |
+
}
|
55 |
xhr.send();
|
56 |
if (!$url)
|
57 |
jQuery("#fifu_keywords").val(' ');
|
58 |
} else {
|
|
|
59 |
runPreview($url);
|
60 |
}
|
61 |
}
|
85 |
}
|
86 |
|
87 |
jQuery(document).ready(function () {
|
88 |
+
// help
|
89 |
+
fifu_register_help();
|
90 |
|
91 |
// lightbox
|
92 |
fifu_open_lightbox();
|
111 |
|
112 |
function fifu_get_sizes() {
|
113 |
image_url = jQuery("#fifu_input_url").val();
|
114 |
+
if (!image_url.startsWith("http") && !image_url.startsWith("//"))
|
115 |
+
return;
|
116 |
fifu_get_image(image_url);
|
117 |
}
|
118 |
|
134 |
});
|
135 |
}
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
function fifu_type_url() {
|
138 |
jQuery("#fifu_input_url").on('input', function (evt) {
|
139 |
evt.stopImmediatePropagation();
|
140 |
fifu_get_sizes();
|
141 |
});
|
142 |
}
|
143 |
+
|
144 |
+
function fifu_register_help() {
|
145 |
+
jQuery('#fifu_help').on('click', function () {
|
146 |
+
jQuery.fancybox.open(`
|
147 |
+
<div style="color:#1e1e1e">
|
148 |
+
<h1 style="background-color:whitesmoke;padding:20px;padding-left:0">${fifuMetaBoxVars.txt_title_examples}</h1>
|
149 |
+
<p></p>
|
150 |
+
<h3>${fifuMetaBoxVars.txt_title_url}</h3>
|
151 |
+
<p style="background-color:#1e1e1e;color:white;padding:10px;border-radius:5px">https://ps.w.org/featured-image-from-url/assets/banner-1544x500.png</p>
|
152 |
+
<br>
|
153 |
+
<h3>${fifuMetaBoxVars.txt_title_keywords}</h3>
|
154 |
+
<p style="background-color:#1e1e1e;color:white;padding:10px;border-radius:5px">sea,sun</p>
|
155 |
+
<div style="padding:10px">
|
156 |
+
<li>${fifuMetaBoxVars.txt_desc_empty}</li>
|
157 |
+
<li>${fifuMetaBoxVars.txt_desc_size}</li>
|
158 |
+
</div>
|
159 |
+
<br>
|
160 |
+
<h1 style="background-color:whitesmoke;padding:20px;padding-left:0">${fifuMetaBoxVars.txt_title_more}</h1>
|
161 |
+
<p></p>
|
162 |
+
<p>${fifuMetaBoxVars.txt_desc_more}</p>
|
163 |
+
</div>`
|
164 |
+
);
|
165 |
+
});
|
166 |
+
}
|
admin/html/js/unsplash.js
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function fifu_get_unsplash_urls(keywords, limit, size) {
|
2 |
+
const urls = [];
|
3 |
+
var count = 1;
|
4 |
+
var LIMIT = limit;
|
5 |
+
var sleepyAlert = setInterval(function () {
|
6 |
+
var xhr = new XMLHttpRequest();
|
7 |
+
xhr.onreadystatechange = function (e) {
|
8 |
+
if (xhr.status == 200 && xhr.readyState == 4) {
|
9 |
+
url = xhr.responseURL;
|
10 |
+
imageId = url.split('-')[2].split('?')[0];
|
11 |
+
if (!idSet.has(imageId)) {
|
12 |
+
idSet.add(imageId);
|
13 |
+
urls.push(url);
|
14 |
+
} else
|
15 |
+
LIMIT--;
|
16 |
+
}
|
17 |
+
};
|
18 |
+
xhr.open("GET", "https://source.unsplash.com/" + size + "/?" + keywords + "&" + Math.random() * 10000, true);
|
19 |
+
xhr.send();
|
20 |
+
if (count++ >= LIMIT) {
|
21 |
+
clearInterval(sleepyAlert);
|
22 |
+
(async() => {
|
23 |
+
// waiting for urls
|
24 |
+
while (urls.length < LIMIT)
|
25 |
+
await new Promise(resolve => setTimeout(resolve, 250));
|
26 |
+
// ready
|
27 |
+
for (i = 0; i < urls.length; i++) {
|
28 |
+
jQuery('div.masonry').append('<div class="mItem" style="max-width:400px;object-fit:content"><img src="' + urls[i] + '" style="width:100%"></div>');
|
29 |
+
}
|
30 |
+
jQuery('#fifu-loading').remove();
|
31 |
+
jQuery('div.masonry').after('<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><center><div id="fifu-loading"><img src="https://cdnjs.cloudflare.com/ajax/libs/jquery.lazyloadxt/1.1.0/loading.gif"><div>Loading more...</div><div></center>');
|
32 |
+
fifu_scrolling = false;
|
33 |
+
})();
|
34 |
+
}
|
35 |
+
}, 50);
|
36 |
+
}
|
37 |
+
|
38 |
+
var fifu_scrolling = false;
|
39 |
+
var idSet = new Set();
|
40 |
+
|
41 |
+
function fifu_start_unsplash_lightbox(keywords, size) {
|
42 |
+
idSet = new Set();
|
43 |
+
fifu_register_unsplash_click_event();
|
44 |
+
|
45 |
+
jQuery.fancybox.open('<div><div class="masonry"></div></div>');
|
46 |
+
jQuery('div.masonry').after('<center><div id="fifu-loading"><img src="https://cdnjs.cloudflare.com/ajax/libs/jquery.lazyloadxt/1.1.0/loading.gif"><div>Loading...</div><div></center>');
|
47 |
+
fifu_get_unsplash_urls(keywords, 10, size);
|
48 |
+
}
|
49 |
+
|
50 |
+
function fifu_register_unsplash_click_event() {
|
51 |
+
jQuery('body').on('click', 'div.mItem > img', function (evt) {
|
52 |
+
evt.stopImmediatePropagation();
|
53 |
+
// meta-box
|
54 |
+
if (jQuery("#fifu_input_url").length) {
|
55 |
+
jQuery("#fifu_input_url").val(jQuery(this).attr('src'));
|
56 |
+
previewImage();
|
57 |
+
}
|
58 |
+
jQuery.fancybox.close();
|
59 |
+
});
|
60 |
+
}
|
admin/html/menu.html
CHANGED
@@ -1568,6 +1568,21 @@
|
|
1568 |
100, 1000, 5000...
|
1569 |
</th>
|
1570 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1571 |
<tr class="color">
|
1572 |
<th>
|
1573 |
<?php $fifu['tab']['performance']() ?>
|
@@ -3974,7 +3989,6 @@
|
|
3974 |
</div>
|
3975 |
<div id="tabsSlider-b">
|
3976 |
1) <?php $fifu['slider']['jetpack']() ?><br>
|
3977 |
-
2) <?php $fifu['slider']['lazy']() ?>
|
3978 |
</div>
|
3979 |
</ul>
|
3980 |
</div>
|
@@ -4187,25 +4201,37 @@
|
|
4187 |
|
4188 |
<h2><?php $fifu['title']['jetpack']() ?></h2>
|
4189 |
|
4190 |
-
<div
|
4191 |
-
<ul>
|
4192 |
-
<li><a href="#tabs-1">Jetpack</a></li>
|
4193 |
-
</ul>
|
4194 |
-
<div id="tabs-1">
|
4195 |
-
<div class="greybox">
|
4196 |
-
|
4197 |
-
<?php $fifu['jetpack']['desc']() ?><br><br>
|
4198 |
|
4199 |
-
|
4200 |
-
<img src="https://storage.googleapis.com/featuredimagefromurl/jetpack-219.jpg">
|
4201 |
-
</div>
|
4202 |
|
4203 |
-
|
4204 |
-
<b><?php $fifu['detail']['requirement']() ?></b>: <?php $fifu['jetpack']['requirement']() ?>
|
4205 |
|
4206 |
-
</div>
|
4207 |
-
</div>
|
4208 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4209 |
</div>
|
4210 |
|
4211 |
<div class="box">
|
1568 |
100, 1000, 5000...
|
1569 |
</th>
|
1570 |
</tr>
|
1571 |
+
<tr class="color">
|
1572 |
+
<th>
|
1573 |
+
<?php $fifu['tab']['performance']() ?>
|
1574 |
+
</th>
|
1575 |
+
<th>
|
1576 |
+
<?php $fifu['title']['jetpack']() ?>
|
1577 |
+
</th>
|
1578 |
+
<th></th>
|
1579 |
+
<th>
|
1580 |
+
wp fifu cdn <toggle>
|
1581 |
+
</th>
|
1582 |
+
<th>
|
1583 |
+
on, off
|
1584 |
+
</th>
|
1585 |
+
</tr>
|
1586 |
<tr class="color">
|
1587 |
<th>
|
1588 |
<?php $fifu['tab']['performance']() ?>
|
3989 |
</div>
|
3990 |
<div id="tabsSlider-b">
|
3991 |
1) <?php $fifu['slider']['jetpack']() ?><br>
|
|
|
3992 |
</div>
|
3993 |
</ul>
|
3994 |
</div>
|
4201 |
|
4202 |
<h2><?php $fifu['title']['jetpack']() ?></h2>
|
4203 |
|
4204 |
+
<div class="greybox">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4205 |
|
4206 |
+
<?php $fifu['jetpack']['desc']() ?><br><br>
|
|
|
|
|
4207 |
|
4208 |
+
<b><?php $fifu['detail']['requirement']() ?></b>: <?php $fifu['jetpack']['requirement']() ?>
|
|
|
4209 |
|
|
|
|
|
4210 |
</div>
|
4211 |
+
|
4212 |
+
<br>
|
4213 |
+
|
4214 |
+
<form
|
4215 |
+
id="fifu_form_photon"
|
4216 |
+
action="javascript:void(0)"
|
4217 |
+
method="post">
|
4218 |
+
|
4219 |
+
<input
|
4220 |
+
type="submit"
|
4221 |
+
href="javascript:void(0)"
|
4222 |
+
id="fifu_toggle_photon"
|
4223 |
+
onclick="invert('photon')"
|
4224 |
+
name="fifu_toggle_photon"
|
4225 |
+
class="<?php echo $enable_photon; ?>"
|
4226 |
+
value=""
|
4227 |
+
style="display:block;border:none">
|
4228 |
+
|
4229 |
+
<input
|
4230 |
+
type="hidden"
|
4231 |
+
id="fifu_input_photon"
|
4232 |
+
name="fifu_input_photon"
|
4233 |
+
value="" >
|
4234 |
+
</form>
|
4235 |
</div>
|
4236 |
|
4237 |
<div class="box">
|
admin/html/meta-box.html
CHANGED
@@ -39,17 +39,9 @@
|
|
39 |
</td>
|
40 |
<td>
|
41 |
<span id="fifu_help"
|
42 |
-
title="<?php $fifu['image']['help']() ?>"
|
43 |
class="dashicons dashicons-editor-help"
|
44 |
-
style="<?php echo $show_button . ';font-size:20px' ?>">
|
45 |
</span>
|
46 |
-
|
47 |
-
<span
|
48 |
-
id="fifu_next"
|
49 |
-
title="<?php $fifu['word']['next']() ?>"
|
50 |
-
class="dashicons dashicons-arrow-right-alt"
|
51 |
-
style="font-size:25px;cursor:pointer;display:none">
|
52 |
-
</span>
|
53 |
</td>
|
54 |
</tr>
|
55 |
</table>
|
39 |
</td>
|
40 |
<td>
|
41 |
<span id="fifu_help"
|
|
|
42 |
class="dashicons dashicons-editor-help"
|
43 |
+
style="<?php echo $show_button . ';font-size:20px;cursor:pointer;' ?>">
|
44 |
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
</td>
|
46 |
</tr>
|
47 |
</table>
|
admin/html/support-data.html
CHANGED
@@ -42,6 +42,7 @@ fifu_hide_page:<?php echo $enable_hide_page ?>;
|
|
42 |
fifu_hide_post:<?php echo $enable_hide_post ?>;
|
43 |
fifu_lazy:<?php echo $enable_lazy ?>;
|
44 |
fifu_ovw_first:<?php echo $enable_ovw_first ?>;
|
|
|
45 |
fifu_pop_first:<?php echo $enable_pop_first ?>;
|
46 |
fifu_query_strings:<?php echo $enable_query_strings ?>;
|
47 |
fifu_reset:<?php echo $enable_reset ?>;
|
42 |
fifu_hide_post:<?php echo $enable_hide_post ?>;
|
43 |
fifu_lazy:<?php echo $enable_lazy ?>;
|
44 |
fifu_ovw_first:<?php echo $enable_ovw_first ?>;
|
45 |
+
fifu_photon:<?php echo $enable_photon ?>;
|
46 |
fifu_pop_first:<?php echo $enable_pop_first ?>;
|
47 |
fifu_query_strings:<?php echo $enable_query_strings ?>;
|
48 |
fifu_reset:<?php echo $enable_reset ?>;
|
admin/menu.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
define('FIFU_SETTINGS', serialize(array('fifu_social', 'fifu_social_image_only', 'fifu_lazy', '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_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_grid_category', 'fifu_auto_alt', 'fifu_dynamic_alt', 'fifu_data_clean')));
|
4 |
|
5 |
define('FIFU_SLUG', 'featured-image-from-url');
|
6 |
|
@@ -45,6 +45,7 @@ function fifu_support_data() {
|
|
45 |
$enable_social = get_option('fifu_social');
|
46 |
$enable_social_image_only = get_option('fifu_social_image_only');
|
47 |
$enable_lazy = get_option('fifu_lazy');
|
|
|
48 |
$enable_reset = get_option('fifu_reset');
|
49 |
$enable_content = get_option('fifu_content');
|
50 |
$enable_content_page = get_option('fifu_content_page');
|
@@ -98,6 +99,7 @@ function fifu_get_menu_html() {
|
|
98 |
$enable_social = get_option('fifu_social');
|
99 |
$enable_social_image_only = get_option('fifu_social_image_only');
|
100 |
$enable_lazy = get_option('fifu_lazy');
|
|
|
101 |
$enable_reset = get_option('fifu_reset');
|
102 |
$enable_content = get_option('fifu_content');
|
103 |
$enable_content_page = get_option('fifu_content_page');
|
@@ -196,6 +198,7 @@ function fifu_update_menu_options() {
|
|
196 |
fifu_update_option('fifu_input_social', 'fifu_social');
|
197 |
fifu_update_option('fifu_input_social_image_only', 'fifu_social_image_only');
|
198 |
fifu_update_option('fifu_input_lazy', 'fifu_lazy');
|
|
|
199 |
fifu_update_option('fifu_input_reset', 'fifu_reset');
|
200 |
fifu_update_option('fifu_input_content', 'fifu_content');
|
201 |
fifu_update_option('fifu_input_content_page', 'fifu_content_page');
|
1 |
<?php
|
2 |
|
3 |
+
define('FIFU_SETTINGS', serialize(array('fifu_social', 'fifu_social_image_only', 'fifu_lazy', 'fifu_photon', '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_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_grid_category', 'fifu_auto_alt', 'fifu_dynamic_alt', 'fifu_data_clean')));
|
4 |
|
5 |
define('FIFU_SLUG', 'featured-image-from-url');
|
6 |
|
45 |
$enable_social = get_option('fifu_social');
|
46 |
$enable_social_image_only = get_option('fifu_social_image_only');
|
47 |
$enable_lazy = get_option('fifu_lazy');
|
48 |
+
$enable_photon = get_option('fifu_photon');
|
49 |
$enable_reset = get_option('fifu_reset');
|
50 |
$enable_content = get_option('fifu_content');
|
51 |
$enable_content_page = get_option('fifu_content_page');
|
99 |
$enable_social = get_option('fifu_social');
|
100 |
$enable_social_image_only = get_option('fifu_social_image_only');
|
101 |
$enable_lazy = get_option('fifu_lazy');
|
102 |
+
$enable_photon = get_option('fifu_photon');
|
103 |
$enable_reset = get_option('fifu_reset');
|
104 |
$enable_content = get_option('fifu_content');
|
105 |
$enable_content_page = get_option('fifu_content_page');
|
198 |
fifu_update_option('fifu_input_social', 'fifu_social');
|
199 |
fifu_update_option('fifu_input_social_image_only', 'fifu_social_image_only');
|
200 |
fifu_update_option('fifu_input_lazy', 'fifu_lazy');
|
201 |
+
fifu_update_option('fifu_input_photon', 'fifu_photon');
|
202 |
fifu_update_option('fifu_input_reset', 'fifu_reset');
|
203 |
fifu_update_option('fifu_input_content', 'fifu_content');
|
204 |
fifu_update_option('fifu_input_content_page', 'fifu_content_page');
|
admin/meta-box.php
CHANGED
@@ -18,6 +18,7 @@ function fifu_insert_meta_box() {
|
|
18 |
|
19 |
function fifu_register_meta_box_script() {
|
20 |
$fifu = fifu_get_strings_meta_box_php();
|
|
|
21 |
|
22 |
wp_enqueue_script('jquery-block-ui', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.blockUI/2.70/jquery.blockUI.min.js');
|
23 |
wp_enqueue_style('fancy-box-css', 'https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.css');
|
@@ -27,6 +28,10 @@ function fifu_register_meta_box_script() {
|
|
27 |
wp_enqueue_script('fifu-meta-box-js', plugins_url('/html/js/meta-box.js', __FILE__), array('jquery'), fifu_version_number());
|
28 |
wp_enqueue_script('fifu-convert-url-js', plugins_url('/html/js/convert-url.js', __FILE__), array('jquery'), fifu_version_number());
|
29 |
|
|
|
|
|
|
|
|
|
30 |
// register custom variables for the AJAX script
|
31 |
wp_localize_script('fifu-rest-route-js', 'fifuScriptVars', [
|
32 |
'restUrl' => esc_url_raw(rest_url()),
|
@@ -42,6 +47,13 @@ function fifu_register_meta_box_script() {
|
|
42 |
'is_sirv_active' => fifu_is_sirv_active(),
|
43 |
'wait' => $fifu['common']['wait'](),
|
44 |
'is_taxonomy' => get_current_screen()->taxonomy,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
]);
|
46 |
}
|
47 |
|
18 |
|
19 |
function fifu_register_meta_box_script() {
|
20 |
$fifu = fifu_get_strings_meta_box_php();
|
21 |
+
$fifu_help = fifu_get_strings_help();
|
22 |
|
23 |
wp_enqueue_script('jquery-block-ui', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.blockUI/2.70/jquery.blockUI.min.js');
|
24 |
wp_enqueue_style('fancy-box-css', 'https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.css');
|
28 |
wp_enqueue_script('fifu-meta-box-js', plugins_url('/html/js/meta-box.js', __FILE__), array('jquery'), fifu_version_number());
|
29 |
wp_enqueue_script('fifu-convert-url-js', plugins_url('/html/js/convert-url.js', __FILE__), array('jquery'), fifu_version_number());
|
30 |
|
31 |
+
wp_register_style('fifu-unsplash-css', plugins_url('/html/css/unsplash.css', __FILE__), array(), fifu_version_number());
|
32 |
+
wp_enqueue_style('fifu-unsplash-css');
|
33 |
+
wp_enqueue_script('fifu-unsplash-js', plugins_url('/html/js/unsplash.js', __FILE__), array('jquery'), fifu_version_number());
|
34 |
+
|
35 |
// register custom variables for the AJAX script
|
36 |
wp_localize_script('fifu-rest-route-js', 'fifuScriptVars', [
|
37 |
'restUrl' => esc_url_raw(rest_url()),
|
47 |
'is_sirv_active' => fifu_is_sirv_active(),
|
48 |
'wait' => $fifu['common']['wait'](),
|
49 |
'is_taxonomy' => get_current_screen()->taxonomy,
|
50 |
+
'txt_title_examples' => $fifu_help['title']['examples'](),
|
51 |
+
'txt_title_keywords' => $fifu_help['title']['keywords'](),
|
52 |
+
'txt_title_more' => $fifu_help['title']['more'](),
|
53 |
+
'txt_title_url' => $fifu_help['title']['url'](),
|
54 |
+
'txt_desc_empty' => $fifu_help['desc']['empty'](),
|
55 |
+
'txt_desc_size' => $fifu_help['desc']['size'](),
|
56 |
+
'txt_desc_more' => $fifu_help['desc']['more'](),
|
57 |
]);
|
58 |
}
|
59 |
|
admin/strings.php
CHANGED
@@ -412,13 +412,13 @@ function fifu_get_strings_settings() {
|
|
412 |
_e("You probably have a plugin or theme that sets a default image as the Facebook image (og:image tag). Just find and disable the option.", FIFU_SLUG);
|
413 |
};
|
414 |
$fifu['support']['null-desc'] = function() {
|
415 |
-
_e("This plugin has
|
416 |
};
|
417 |
$fifu['support']['money-desc'] = function() {
|
418 |
_e("Because Instagram is invalidating its URLs once a month. FIFU can renew the URLs automatically via API, however due to the costs involved, it is only available in the Premium version.", FIFU_SLUG);
|
419 |
};
|
420 |
$fifu['support']['speed-desc'] = function() {
|
421 |
-
_e("You can solve that
|
422 |
};
|
423 |
|
424 |
// start
|
@@ -913,10 +913,10 @@ function fifu_get_strings_settings() {
|
|
913 |
|
914 |
// jetpack
|
915 |
$fifu['jetpack']['desc'] = function() {
|
916 |
-
_e("
|
917 |
};
|
918 |
$fifu['jetpack']['requirement'] = function() {
|
919 |
-
_e("
|
920 |
};
|
921 |
|
922 |
// lazy
|
@@ -1080,11 +1080,8 @@ function fifu_get_strings_settings() {
|
|
1080 |
$fifu['slider']['desc'] = function() {
|
1081 |
_e("This feature allows you to have a slider of images instead of a regular featured image. It's often quite useful on some types of websites, such as real estate. It can run fast even with a huge amount of big images (just follow the performance tips below).", FIFU_SLUG);
|
1082 |
};
|
1083 |
-
$fifu['slider']['lazy'] = function() {
|
1084 |
-
_e("enable FIFU Settings > Performance > Lazy Load", FIFU_SLUG);
|
1085 |
-
};
|
1086 |
$fifu['slider']['jetpack'] = function() {
|
1087 |
-
_e("
|
1088 |
};
|
1089 |
$fifu['slider']['tab']['configuration'] = function() {
|
1090 |
_e("Configuration", FIFU_SLUG);
|
@@ -1393,9 +1390,6 @@ function fifu_get_strings_meta_box() {
|
|
1393 |
$fifu = array();
|
1394 |
|
1395 |
// word
|
1396 |
-
$fifu['word']['next'] = function() {
|
1397 |
-
_e("Next", FIFU_SLUG);
|
1398 |
-
};
|
1399 |
$fifu['word']['remove'] = function() {
|
1400 |
_e("Remove", FIFU_SLUG);
|
1401 |
};
|
@@ -1468,9 +1462,6 @@ function fifu_get_strings_meta_box() {
|
|
1468 |
$fifu['image']['keywords'] = function() {
|
1469 |
_e("Image URL or Keywords", FIFU_SLUG);
|
1470 |
};
|
1471 |
-
$fifu['image']['help'] = function() {
|
1472 |
-
_e("Examples: https://domain/image.jpg (image URL); sea,sun (keywords); empty (random image).", FIFU_SLUG);
|
1473 |
-
};
|
1474 |
$fifu['image']['remove'] = function() {
|
1475 |
_e("remove external featured image", FIFU_SLUG);
|
1476 |
};
|
@@ -1640,6 +1631,9 @@ function fifu_get_strings_quick_edit() {
|
|
1640 |
$fifu['title']['video'] = function() {
|
1641 |
return __("Featured video", FIFU_SLUG);
|
1642 |
};
|
|
|
|
|
|
|
1643 |
|
1644 |
// tips
|
1645 |
$fifu['tip']['image'] = function() {
|
@@ -1648,6 +1642,9 @@ function fifu_get_strings_quick_edit() {
|
|
1648 |
$fifu['tip']['video'] = function() {
|
1649 |
return __("Set the featured video using a video URL", FIFU_SLUG);
|
1650 |
};
|
|
|
|
|
|
|
1651 |
|
1652 |
// placeholder
|
1653 |
$fifu['url']['image'] = function() {
|
@@ -1656,6 +1653,38 @@ function fifu_get_strings_quick_edit() {
|
|
1656 |
$fifu['url']['video'] = function() {
|
1657 |
return __("Video URL", FIFU_SLUG);
|
1658 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1659 |
|
1660 |
return $fifu;
|
1661 |
}
|
412 |
_e("You probably have a plugin or theme that sets a default image as the Facebook image (og:image tag). Just find and disable the option.", FIFU_SLUG);
|
413 |
};
|
414 |
$fifu['support']['null-desc'] = function() {
|
415 |
+
_e("This plugin has no nulled versions, but modified versions. Don't install that. It's illegal and may ruin your site. Moreover, sales of the original premium version keep this project alive.", FIFU_SLUG);
|
416 |
};
|
417 |
$fifu['support']['money-desc'] = function() {
|
418 |
_e("Because Instagram is invalidating its URLs once a month. FIFU can renew the URLs automatically via API, however due to the costs involved, it is only available in the Premium version.", FIFU_SLUG);
|
419 |
};
|
420 |
$fifu['support']['speed-desc'] = function() {
|
421 |
+
_e("You can solve that activating Performance > CDN + Optimized Thumbnails. Even large images hosted on slow servers should load quickly on your website.", FIFU_SLUG);
|
422 |
};
|
423 |
|
424 |
// start
|
913 |
|
914 |
// jetpack
|
915 |
$fifu['jetpack']['desc'] = function() {
|
916 |
+
_e("Your external images will be automatically optimized and served from a free CDN. And to make things even faster FIFU will load the thumbnails in the exact size your site needs.", FIFU_SLUG);
|
917 |
};
|
918 |
$fifu['jetpack']['requirement'] = function() {
|
919 |
+
_e("for images added in an automated way, the Lazy Load feature below should be enabled.", FIFU_SLUG);
|
920 |
};
|
921 |
|
922 |
// lazy
|
1080 |
$fifu['slider']['desc'] = function() {
|
1081 |
_e("This feature allows you to have a slider of images instead of a regular featured image. It's often quite useful on some types of websites, such as real estate. It can run fast even with a huge amount of big images (just follow the performance tips below).", FIFU_SLUG);
|
1082 |
};
|
|
|
|
|
|
|
1083 |
$fifu['slider']['jetpack'] = function() {
|
1084 |
+
_e("enable Performance > CDN + Optimized Thumbnails", FIFU_SLUG);
|
1085 |
};
|
1086 |
$fifu['slider']['tab']['configuration'] = function() {
|
1087 |
_e("Configuration", FIFU_SLUG);
|
1390 |
$fifu = array();
|
1391 |
|
1392 |
// word
|
|
|
|
|
|
|
1393 |
$fifu['word']['remove'] = function() {
|
1394 |
_e("Remove", FIFU_SLUG);
|
1395 |
};
|
1462 |
$fifu['image']['keywords'] = function() {
|
1463 |
_e("Image URL or Keywords", FIFU_SLUG);
|
1464 |
};
|
|
|
|
|
|
|
1465 |
$fifu['image']['remove'] = function() {
|
1466 |
_e("remove external featured image", FIFU_SLUG);
|
1467 |
};
|
1631 |
$fifu['title']['video'] = function() {
|
1632 |
return __("Featured video", FIFU_SLUG);
|
1633 |
};
|
1634 |
+
$fifu['title']['search'] = function() {
|
1635 |
+
return __("Image search", FIFU_SLUG);
|
1636 |
+
};
|
1637 |
|
1638 |
// tips
|
1639 |
$fifu['tip']['image'] = function() {
|
1642 |
$fifu['tip']['video'] = function() {
|
1643 |
return __("Set the featured video using a video URL", FIFU_SLUG);
|
1644 |
};
|
1645 |
+
$fifu['tip']['search'] = function() {
|
1646 |
+
return __("Search for Unsplash images. Example: sun,sea", FIFU_SLUG);
|
1647 |
+
};
|
1648 |
|
1649 |
// placeholder
|
1650 |
$fifu['url']['image'] = function() {
|
1653 |
$fifu['url']['video'] = function() {
|
1654 |
return __("Video URL", FIFU_SLUG);
|
1655 |
};
|
1656 |
+
$fifu['image']['keywords'] = function() {
|
1657 |
+
return __("Keywords", FIFU_SLUG);
|
1658 |
+
};
|
1659 |
+
|
1660 |
+
return $fifu;
|
1661 |
+
}
|
1662 |
+
|
1663 |
+
function fifu_get_strings_help() {
|
1664 |
+
$fifu = array();
|
1665 |
+
|
1666 |
+
// title
|
1667 |
+
$fifu['title']['examples'] = function() {
|
1668 |
+
return __("Examples", FIFU_SLUG);
|
1669 |
+
};
|
1670 |
+
$fifu['title']['keywords'] = function() {
|
1671 |
+
return __("Keywords", FIFU_SLUG);
|
1672 |
+
};
|
1673 |
+
$fifu['title']['more'] = function() {
|
1674 |
+
return __("More", FIFU_SLUG);
|
1675 |
+
};
|
1676 |
+
$fifu['title']['url'] = function() {
|
1677 |
+
return __("Image URL", FIFU_SLUG);
|
1678 |
+
};
|
1679 |
+
$fifu['desc']['empty'] = function() {
|
1680 |
+
return __("If empty, returns a random image.", FIFU_SLUG);
|
1681 |
+
};
|
1682 |
+
$fifu['desc']['size'] = function() {
|
1683 |
+
return __("You can define the images dimensions at FIFU Settings > Featured image > Unsplash Image Size. For sharing on Facebook, the best size is 1200x630.", FIFU_SLUG);
|
1684 |
+
};
|
1685 |
+
$fifu['desc']['more'] = function() {
|
1686 |
+
return __("FIFU is able to auto set the images based on the post title, post tags, external web page address and more. Take a look at FIFU Settings > Automatic.", FIFU_SLUG);
|
1687 |
+
};
|
1688 |
|
1689 |
return $fifu;
|
1690 |
}
|
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.6.
|
8 |
* Author: fifu.app
|
9 |
* Author URI: https://fifu.app/
|
10 |
* WC requires at least: 4.0
|
11 |
-
* WC tested up to: 5.
|
12 |
* Text Domain: featured-image-from-url
|
13 |
* License: GPLv3
|
14 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
@@ -19,7 +19,6 @@ 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_DEV_DEBUG', false);
|
23 |
|
24 |
require_once (FIFU_INCLUDES_DIR . '/attachment.php');
|
25 |
require_once (FIFU_INCLUDES_DIR . '/convert-url.php');
|
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.6.6
|
8 |
* Author: fifu.app
|
9 |
* Author URI: https://fifu.app/
|
10 |
* WC requires at least: 4.0
|
11 |
+
* WC tested up to: 5.5
|
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 |
|
23 |
require_once (FIFU_INCLUDES_DIR . '/attachment.php');
|
24 |
require_once (FIFU_INCLUDES_DIR . '/convert-url.php');
|
includes/attachment.php
CHANGED
@@ -88,8 +88,8 @@ function fifu_replace_attachment_image_src($image, $att_id, $size) {
|
|
88 |
return null;
|
89 |
|
90 |
// photon
|
91 |
-
if (
|
92 |
-
$old_url = $image[0];
|
93 |
$image = fifu_get_photon_url($image, $size, $att_id);
|
94 |
// ws
|
95 |
// if ($att_post->post_parent) {
|
@@ -111,8 +111,10 @@ function fifu_replace_attachment_image_src($image, $att_id, $size) {
|
|
111 |
}
|
112 |
|
113 |
// use saved dimensions
|
114 |
-
if ($image[1] > 1 && $image[2] > 1)
|
|
|
115 |
return $image;
|
|
|
116 |
|
117 |
// fix null height
|
118 |
if ($image[2] == null)
|
@@ -136,6 +138,14 @@ function fifu_fix_dimensions($image, $size) {
|
|
136 |
return $image;
|
137 |
}
|
138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
function fifu_add_size($image, $size) {
|
140 |
// fix lightbox
|
141 |
if ($size == 'woocommerce_single')
|
@@ -175,19 +185,16 @@ function fifu_get_photon_url($image, $size, $att_id) {
|
|
175 |
$w = $image[1];
|
176 |
$h = $image[2];
|
177 |
|
178 |
-
if (fifu_debug_jetpack())
|
179 |
-
define('IS_WPCOM', true);
|
180 |
-
|
181 |
$args = array();
|
182 |
|
183 |
if ($w > 0 && $h > 0) {
|
184 |
-
$args['resize'] =
|
185 |
} elseif ($w > 0) {
|
186 |
-
$args['resize'] =
|
187 |
-
$args['w'] =
|
188 |
} elseif ($h > 0) {
|
189 |
-
$args['resize'] =
|
190 |
-
$args['h'] =
|
191 |
} else {
|
192 |
|
193 |
}
|
@@ -197,7 +204,7 @@ function fifu_get_photon_url($image, $size, $att_id) {
|
|
197 |
if ($matches && count($matches) > 2)
|
198 |
$image[0] = str_replace('https://' . $matches[1], '', $image[0]);
|
199 |
|
200 |
-
$image[0] =
|
201 |
$image[0] = fifu_process_external_url($image[0], $att_id, $size);
|
202 |
|
203 |
return $image;
|
88 |
return null;
|
89 |
|
90 |
// photon
|
91 |
+
if (fifu_is_on('fifu_photon') && !fifu_jetpack_blocked($image[0])) {
|
92 |
+
// $old_url = $image[0];
|
93 |
$image = fifu_get_photon_url($image, $size, $att_id);
|
94 |
// ws
|
95 |
// if ($att_post->post_parent) {
|
111 |
}
|
112 |
|
113 |
// use saved dimensions
|
114 |
+
if ($image[1] > 1 && $image[2] > 1) {
|
115 |
+
$image = fifu_resize_unsplash($image);
|
116 |
return $image;
|
117 |
+
}
|
118 |
|
119 |
// fix null height
|
120 |
if ($image[2] == null)
|
138 |
return $image;
|
139 |
}
|
140 |
|
141 |
+
function fifu_resize_unsplash($image) {
|
142 |
+
if (strpos($image[0], 'https://images.unsplash.com') !== false) {
|
143 |
+
$image[0] = preg_replace("/&w=[0-9]+/", '&w=' . $image[1], $image[0]);
|
144 |
+
$image[0] = preg_replace("/&h=[0-9]+/", '&h=' . $image[2], $image[0]);
|
145 |
+
}
|
146 |
+
return $image;
|
147 |
+
}
|
148 |
+
|
149 |
function fifu_add_size($image, $size) {
|
150 |
// fix lightbox
|
151 |
if ($size == 'woocommerce_single')
|
185 |
$w = $image[1];
|
186 |
$h = $image[2];
|
187 |
|
|
|
|
|
|
|
188 |
$args = array();
|
189 |
|
190 |
if ($w > 0 && $h > 0) {
|
191 |
+
$args['resize'] = $w . ',' . $h;
|
192 |
} elseif ($w > 0) {
|
193 |
+
$args['resize'] = $w;
|
194 |
+
$args['w'] = $w;
|
195 |
} elseif ($h > 0) {
|
196 |
+
$args['resize'] = $h;
|
197 |
+
$args['h'] = $h;
|
198 |
} else {
|
199 |
|
200 |
}
|
204 |
if ($matches && count($matches) > 2)
|
205 |
$image[0] = str_replace('https://' . $matches[1], '', $image[0]);
|
206 |
|
207 |
+
$image[0] = fifu_jetpack_photon_url($image[0], $args);
|
208 |
$image[0] = fifu_process_external_url($image[0], $att_id, $size);
|
209 |
|
210 |
return $image;
|
includes/html/js/lazySizesConfig.js
CHANGED
@@ -46,7 +46,7 @@ function fifu_add_srcset() {
|
|
46 |
srcset = '';
|
47 |
sizes = [75, 100, 150, 240, 320, 500, 640, 800, 1024, 1280, 1600];
|
48 |
for (j = 0; j < sizes.length; j++)
|
49 |
-
srcset += ((j != 0) ? ', ' : '') + src.replace(src.split('?')[1], 'w=' + sizes[j] + '&resize=' + sizes[j]
|
50 |
jQuery(this).attr(types[i] + 'set', srcset);
|
51 |
jQuery(this).attr('data-sizes', 'auto');
|
52 |
}
|
46 |
srcset = '';
|
47 |
sizes = [75, 100, 150, 240, 320, 500, 640, 800, 1024, 1280, 1600];
|
48 |
for (j = 0; j < sizes.length; j++)
|
49 |
+
srcset += ((j != 0) ? ', ' : '') + src.replace(src.split('?')[1], 'w=' + sizes[j] + '&resize=' + sizes[j]) + ' ' + sizes[j] + 'w';
|
50 |
jQuery(this).attr(types[i] + 'set', srcset);
|
51 |
jQuery(this).attr('data-sizes', 'auto');
|
52 |
}
|
includes/jetpack.php
CHANGED
@@ -1,11 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
function fifu_debug_jetpack() {
|
4 |
-
return defined('FIFU_DEV_DEBUG') && !defined('IS_WPCOM') && FIFU_DEV_DEBUG && fifu_is_local() && !fifu_is_in_editor();
|
5 |
-
}
|
6 |
-
|
7 |
function fifu_jetpack_blocked($url) {
|
8 |
-
$blocklist = array('amazon-adsystem.com', 'sapo.io');
|
9 |
foreach ($blocklist as $domain) {
|
10 |
if (strpos($url, $domain) !== false)
|
11 |
return true;
|
@@ -13,3 +9,16 @@ function fifu_jetpack_blocked($url) {
|
|
13 |
return false;
|
14 |
}
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
3 |
function fifu_jetpack_blocked($url) {
|
4 |
+
$blocklist = array('amazon-adsystem.com', 'sapo.io', 'unsplash.com');
|
5 |
foreach ($blocklist as $domain) {
|
6 |
if (strpos($url, $domain) !== false)
|
7 |
return true;
|
9 |
return false;
|
10 |
}
|
11 |
|
12 |
+
function fifu_jetpack_photon_url($url, $args) {
|
13 |
+
$image_url_parts = wp_parse_url($url);
|
14 |
+
if (!is_array($image_url_parts) || empty($image_url_parts['host']) || empty($image_url_parts['path']))
|
15 |
+
return $url;
|
16 |
+
$subdomain = abs(crc32($url) % 3);
|
17 |
+
$host = $image_url_parts['host'];
|
18 |
+
$path = $image_url_parts['path'];
|
19 |
+
$photon_url = "https://i{$subdomain}.wp.com/{$host}{$path}";
|
20 |
+
if ($args)
|
21 |
+
return add_query_arg($args, $photon_url);
|
22 |
+
return $photon_url;
|
23 |
+
}
|
24 |
+
|
includes/thumbnail.php
CHANGED
@@ -22,6 +22,13 @@ add_filter('wp_head', 'fifu_apply_css');
|
|
22 |
function fifu_add_js() {
|
23 |
echo '<link rel="preconnect" href="https://cdnjs.cloudflare.com">';
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
if (fifu_is_on('fifu_lazy')) {
|
26 |
wp_enqueue_style('lazyload-spinner', plugins_url('/html/css/lazyload.css', __FILE__), array(), fifu_version_number());
|
27 |
wp_enqueue_script('lazysizes-config', plugins_url('/html/js/lazySizesConfig.js', __FILE__), array('jquery'), fifu_version_number());
|
22 |
function fifu_add_js() {
|
23 |
echo '<link rel="preconnect" href="https://cdnjs.cloudflare.com">';
|
24 |
|
25 |
+
if (fifu_is_on('fifu_photon')) {
|
26 |
+
for ($i = 0; $i < 3; $i++) {
|
27 |
+
echo "<link rel='preconnect' href='https://i{$i}.wp.com/' crossorigin>";
|
28 |
+
echo "<link rel='dns-prefetch' href='https://i{$i}.wp.com/'>";
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
if (fifu_is_on('fifu_lazy')) {
|
33 |
wp_enqueue_style('lazyload-spinner', plugins_url('/html/css/lazyload.css', __FILE__), array(), fifu_version_number());
|
34 |
wp_enqueue_script('lazysizes-config', plugins_url('/html/js/lazySizesConfig.js', __FILE__), array('jquery'), fifu_version_number());
|
includes/util.php
CHANGED
@@ -115,23 +115,6 @@ function fifu_is_elementor_editor() {
|
|
115 |
return \Elementor\Plugin::$instance->editor->is_edit_mode() || \Elementor\Plugin::$instance->preview->is_preview_mode();
|
116 |
}
|
117 |
|
118 |
-
function fifu_is_jetpack_active() {
|
119 |
-
if (!is_plugin_active('jetpack/jetpack.php'))
|
120 |
-
return false;
|
121 |
-
|
122 |
-
if (defined('FIFU_DEV_DEBUG') && FIFU_DEV_DEBUG) {
|
123 |
-
add_filter('jetpack_photon_any_extension_for_domain', '__return_true');
|
124 |
-
return true;
|
125 |
-
}
|
126 |
-
|
127 |
-
if (function_exists('jetpack_photon_url') && class_exists('Jetpack') && method_exists('Jetpack', 'get_active_modules') && in_array('photon', Jetpack::get_active_modules())) {
|
128 |
-
add_filter('jetpack_photon_any_extension_for_domain', '__return_true');
|
129 |
-
return true;
|
130 |
-
}
|
131 |
-
|
132 |
-
return false;
|
133 |
-
}
|
134 |
-
|
135 |
function fifu_is_bbpress_active() {
|
136 |
return is_plugin_active('bbpress/bbpress.php');
|
137 |
}
|
115 |
return \Elementor\Plugin::$instance->editor->is_edit_mode() || \Elementor\Plugin::$instance->preview->is_preview_mode();
|
116 |
}
|
117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
function fifu_is_bbpress_active() {
|
119 |
return is_plugin_active('bbpress/bbpress.php');
|
120 |
}
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: marceljm
|
|
3 |
Donate link: https://donorbox.org/fifu
|
4 |
Tags: featured, image, url, video, woocommerce
|
5 |
Requires at least: 5.3
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 3.6.
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -122,9 +122,12 @@ Supports videos from YouTube, Vimeo, Imgur, 9GAG, Cloudinary, Tumblr, Publitio,
|
|
122 |
|
123 |
#### LINKS
|
124 |
|
125 |
-
* **<a href="https://fifu.app/">Featured Image from URL PRO</a>**
|
126 |
* **<a href="https://chrome.google.com/webstore/detail/fifu-scraper/pccimcccbkdeeadhejdmnffmllpicola">Google Chrome extension</a>**
|
127 |
|
|
|
|
|
|
|
128 |
|
129 |
== Installation ==
|
130 |
|
@@ -164,7 +167,7 @@ Supports videos from YouTube, Vimeo, Imgur, 9GAG, Cloudinary, Tumblr, Publitio,
|
|
164 |
|
165 |
= What are the disadvantages of the external images?
|
166 |
|
167 |
-
* No image optimization or thumbnails. You can fix that with
|
168 |
|
169 |
= What are the advantages of the external images?
|
170 |
|
@@ -220,20 +223,20 @@ Supports videos from YouTube, Vimeo, Imgur, 9GAG, Cloudinary, Tumblr, Publitio,
|
|
220 |
|
221 |
== Changelog ==
|
222 |
|
|
|
|
|
|
|
223 |
= 3.6.5 =
|
224 |
* New feature: WooCommerce > Fast Buy.
|
225 |
|
226 |
= 3.6.4 =
|
227 |
* New feature: Auto set featured image from Unsplash using tags; new option: Auto set screenshot as featured image > Scale; new option: bbPress > copy the featured image/video to the forum/topic content.
|
228 |
|
229 |
-
= 3.6.3 =
|
230 |
-
* New feature: Quick Edit (for featured images and videos); new feature: FIFU Shortcodes; new widget: Product gallery; new integration functions: fifu_dev_set_video(), fifu_dev_set_category_image() and fifu_dev_set_category_video(); new option: Auto set featured image using post title and search engine > Post types.
|
231 |
-
|
232 |
= others =
|
233 |
* [more](https://fifu.app/changelog)
|
234 |
|
235 |
|
236 |
== Upgrade Notice ==
|
237 |
|
238 |
-
= 3.6.
|
239 |
-
*
|
3 |
Donate link: https://donorbox.org/fifu
|
4 |
Tags: featured, image, url, video, woocommerce
|
5 |
Requires at least: 5.3
|
6 |
+
Tested up to: 5.8
|
7 |
+
Stable tag: 3.6.6
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
122 |
|
123 |
#### LINKS
|
124 |
|
125 |
+
* **<a href="https://fifu.app/">Featured Image from URL PRO</a>**
|
126 |
* **<a href="https://chrome.google.com/webstore/detail/fifu-scraper/pccimcccbkdeeadhejdmnffmllpicola">Google Chrome extension</a>**
|
127 |
|
128 |
+
#### FIFU, the best WordPress plugin for...
|
129 |
+
Featured Image, Figurë e Zgjedhur, Image mise en avant, Uitgelichte afbeelding, وێنەی تایبەت, Obrazek wyróżniający, Tugna tameẓlit, Beitragsbild, გამორჩეული სურათი, Utvald bild, 特色图片, تصویر ویژه, Framhevet bilde, Artikkelikuva, Ilustračný obrázok, Imaxe destacada, Ảnh đại diện, Prikazna slika, Imagine reprezentativă, Imagen destacada, 특성 이미지, Delwedd Nodwedd, รูปประจำเรื่อง, Immagine in evidenza, 特選圖片, Imagem destacada, Imagem de destaque, Избранное изображение, アイキャッチ画像, Pśinoskowy wobraz, Öne çıkan görsel, Přinoškowy wobraz, Uitgelichte Afbeelding
|
130 |
+
|
131 |
|
132 |
== Installation ==
|
133 |
|
167 |
|
168 |
= What are the disadvantages of the external images?
|
169 |
|
170 |
+
* No image optimization or thumbnails by default. You can fix that with CDN + Optimized Thumbnails feature (performance settings).
|
171 |
|
172 |
= What are the advantages of the external images?
|
173 |
|
223 |
|
224 |
== Changelog ==
|
225 |
|
226 |
+
= 3.6.6 =
|
227 |
+
* Enhancement: keyword image search (multiple suggestions, infinite scroll and integration with Quick Edit); enhancement: CDN + Optimized Thumbnails (does not require Jetpack plugin anymore).
|
228 |
+
|
229 |
= 3.6.5 =
|
230 |
* New feature: WooCommerce > Fast Buy.
|
231 |
|
232 |
= 3.6.4 =
|
233 |
* New feature: Auto set featured image from Unsplash using tags; new option: Auto set screenshot as featured image > Scale; new option: bbPress > copy the featured image/video to the forum/topic content.
|
234 |
|
|
|
|
|
|
|
235 |
= others =
|
236 |
* [more](https://fifu.app/changelog)
|
237 |
|
238 |
|
239 |
== Upgrade Notice ==
|
240 |
|
241 |
+
= 3.6.6 =
|
242 |
+
* Enhancement: keyword image search (multiple suggestions, infinite scroll and integration with Quick Edit); enhancement: CDN + Optimized Thumbnails (does not require Jetpack plugin anymore).
|