Version Description
- Added: Integration with Photo Gallery plugin.
Download this release
Release Info
Developer | webdorado |
Plugin | Image Optimizer by 10web – Image Optimizer and Compression plugin |
Version | 1.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.0.3
- assets/css/admin_main.css +34 -3
- assets/js/settings.js +123 -19
- classes/iowddb.php +10 -0
- includes/iowd-ajax.php +22 -12
- includes/iowd-helper.php +8 -3
- includes/iowd-optimize.php +5 -1
- includes/iowd-settings.php +24 -0
- io-wd.php +1 -1
- iowd_class.php +18 -13
- readme.txt +7 -3
- views/iowd_limit_display.php +57 -52
- views/iowd_settings_display.php +248 -198
assets/css/admin_main.css
CHANGED
@@ -284,11 +284,11 @@ a:focus {
|
|
284 |
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
285 |
}
|
286 |
|
287 |
-
.iowd_other_dirs_container{
|
288 |
margin-top: 20px;
|
289 |
}
|
290 |
|
291 |
-
.iowd_other_save_btn {
|
292 |
text-align: right;
|
293 |
}
|
294 |
|
@@ -459,7 +459,7 @@ a:focus {
|
|
459 |
border-left: 1px solid #dddfe3 !important;
|
460 |
}
|
461 |
|
462 |
-
.iowd-dir-paths {
|
463 |
margin: 10px 0px;
|
464 |
}
|
465 |
|
@@ -1056,3 +1056,34 @@ input:checked + .iowd-slider:before {
|
|
1056 |
}
|
1057 |
|
1058 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
285 |
}
|
286 |
|
287 |
+
.iowd_other_dirs_container, .iowd_wd_plugins{
|
288 |
margin-top: 20px;
|
289 |
}
|
290 |
|
291 |
+
.iowd_other_save_btn, .iowd_gallery_save_btn {
|
292 |
text-align: right;
|
293 |
}
|
294 |
|
459 |
border-left: 1px solid #dddfe3 !important;
|
460 |
}
|
461 |
|
462 |
+
.iowd-dir-paths, .iowd-dir-gallery-paths {
|
463 |
margin: 10px 0px;
|
464 |
}
|
465 |
|
1056 |
}
|
1057 |
|
1058 |
|
1059 |
+
.iowd-toggle-indicator {
|
1060 |
+
float:right;
|
1061 |
+
}
|
1062 |
+
.iowd-toggle:after{
|
1063 |
+
content: "";
|
1064 |
+
display: table;
|
1065 |
+
clear: both;
|
1066 |
+
}
|
1067 |
+
|
1068 |
+
.iowd-toggle-indicator:before {
|
1069 |
+
display: inline-block;
|
1070 |
+
font: 400 20px/1 dashicons;
|
1071 |
+
speak: none;
|
1072 |
+
-webkit-font-smoothing: antialiased;
|
1073 |
+
-moz-osx-font-smoothing: grayscale;
|
1074 |
+
text-decoration: none !important;
|
1075 |
+
border: 1px solid #868484;
|
1076 |
+
border-radius: 32px;
|
1077 |
+
padding: 1px 2px 1px 0px;
|
1078 |
+
cursor: pointer;
|
1079 |
+
text-align: center;
|
1080 |
+
vertical-align: middle;
|
1081 |
+
}
|
1082 |
+
|
1083 |
+
.iowd-toggle-open:before {
|
1084 |
+
content: "\f142";
|
1085 |
+
}
|
1086 |
+
|
1087 |
+
.iowd-toggle-close:before {
|
1088 |
+
content: "\f140";
|
1089 |
+
}
|
assets/js/settings.js
CHANGED
@@ -2,9 +2,30 @@ jQuery(document).ready(function () {
|
|
2 |
|
3 |
if (iowdSettingsGlobal.page == "iowd_settings") {
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
jQuery("#settings_form").tooltip();
|
6 |
// quick settings
|
7 |
-
jQuery(".
|
8 |
var value = 0;
|
9 |
if (jQuery(this).is(":checked") == true) {
|
10 |
value = 1;
|
@@ -16,7 +37,7 @@ jQuery(document).ready(function () {
|
|
16 |
|
17 |
// standart settings
|
18 |
jQuery(".iowd-standart-mode-view1 .iowd-standart-cell").click(function () {
|
19 |
-
if(jQuery(this).attr("data-value") == "extreme"){
|
20 |
return false;
|
21 |
}
|
22 |
jQuery("[name=standard_setting]").val(jQuery(this).attr("data-value"));
|
@@ -121,7 +142,7 @@ jQuery(document).ready(function () {
|
|
121 |
return false;
|
122 |
}
|
123 |
});
|
124 |
-
|
125 |
jQuery(".iowd-dir-tree-title").on('click', function (e) {
|
126 |
e.stopPropagation();
|
127 |
var thisElem = jQuery(e.target).closest("li");
|
@@ -168,7 +189,9 @@ jQuery(document).ready(function () {
|
|
168 |
}
|
169 |
jQuery(".iowd-spinner-select").show();
|
170 |
jQuery.post(iowd.ajaxURL, data, function (response) {
|
171 |
-
|
|
|
|
|
172 |
jQuery(".iowd-spinner-select").hide();
|
173 |
save_settings();
|
174 |
});
|
@@ -196,7 +219,9 @@ jQuery(document).ready(function () {
|
|
196 |
}
|
197 |
jQuery(".iowd-spinner-select").show();
|
198 |
jQuery.post(iowd.ajaxURL, data, function (response) {
|
199 |
-
|
|
|
|
|
200 |
jQuery(".iowd-spinner-select").hide();
|
201 |
updateOtherFolders();
|
202 |
});
|
@@ -349,8 +374,8 @@ jQuery(document).ready(function () {
|
|
349 |
window.location.href = "admin.php?page=iowd_settings";
|
350 |
});
|
351 |
});
|
352 |
-
jQuery(".iowd-butn-ajax-container").closest(".iowd-main").append('<img src="
|
353 |
-
|
354 |
|
355 |
});
|
356 |
|
@@ -360,10 +385,10 @@ function updateOtherFolders(html) {
|
|
360 |
html = true;
|
361 |
}
|
362 |
var otherFolders = {};
|
363 |
-
|
364 |
jQuery(".iowd_other_folders_row").each(function () {
|
365 |
var otherFolderPath = jQuery(this).find(".iowd_other_path").attr("data-name").trim();
|
366 |
-
if (otherFolderPath) {
|
367 |
var otherImages = [];
|
368 |
jQuery(this).find(".iowd_other_img_path").each(function () {
|
369 |
var imagePath = jQuery(this).find(".iowd_image_path").html();
|
@@ -372,23 +397,38 @@ function updateOtherFolders(html) {
|
|
372 |
}
|
373 |
});
|
374 |
otherFolders[otherFolderPath] = otherImages;
|
|
|
375 |
}
|
376 |
|
377 |
});
|
378 |
|
379 |
if (html === true) {
|
380 |
if (Number(Object.keys(otherFolders).length) > 0) {
|
381 |
-
|
382 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
var saveButton = '<div class="iowd_other_save_btn"><button class="iowd-btn iowd-btn-small iowd-btn-secondary">' + iowdSettingsGlobal.save_dirs_txt + '</button></div>';
|
384 |
-
jQuery(".iowd_other_dirs_container").append(saveButton);
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
}
|
386 |
}
|
387 |
else {
|
388 |
jQuery(".iowd_other_save_btn").remove();
|
|
|
389 |
otherFolders = "";
|
390 |
}
|
391 |
}
|
|
|
392 |
jQuery("[name=other_folders]").val(otherFolders);
|
393 |
|
394 |
}
|
@@ -405,7 +445,9 @@ function showOtherFolders() {
|
|
405 |
|
406 |
jQuery(".iowd-spinner-select").show();
|
407 |
jQuery.post(iowd.ajaxURL, data, function (response) {
|
408 |
-
|
|
|
|
|
409 |
jQuery(".iowd-spinner-select").hide();
|
410 |
updateOtherFolders();
|
411 |
});
|
@@ -439,6 +481,7 @@ function iowdShowHide(onChangeElem, showToggleElem, checkedVal, parent, parentVa
|
|
439 |
}
|
440 |
}
|
441 |
}
|
|
|
442 |
function iowdShowHideChange(onChangeElem, showToggleElem, checkedVal, onChangeElemChild, showToggleElemChild, checkedValChild) {
|
443 |
|
444 |
jQuery("[name=" + onChangeElem).change(function () {
|
@@ -459,8 +502,68 @@ function iowdCickSettings(name, value) {
|
|
459 |
value: value
|
460 |
};
|
461 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
462 |
|
|
|
463 |
jQuery.post(iowd.ajaxURL, data, function (response) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
464 |
});
|
465 |
}
|
466 |
|
@@ -481,14 +584,14 @@ function iowdScan(limit) {
|
|
481 |
|
482 |
jQuery.post(iowd.ajaxURL, data, function (response) {
|
483 |
response = JSON.parse(response);
|
484 |
-
if(response["status"] != "done"){
|
485 |
limit = limit + 2000;
|
486 |
iowdScan(limit);
|
487 |
-
} else{
|
488 |
var data = {
|
489 |
action: "scan_all",
|
490 |
nonce_iowd: iowd.nonce,
|
491 |
-
limit
|
492 |
};
|
493 |
|
494 |
jQuery.post(iowd.ajaxURL, data, function (response) {
|
@@ -502,14 +605,15 @@ function iowdScan(limit) {
|
|
502 |
|
503 |
function iowdLoadBlocks(scan) {
|
504 |
jQuery(".iowd-loading-spinner-ajax").remove();
|
505 |
-
if(scan["not_optimized_data"] > 0 || scan["not_optimized_data_sizes"] > 0){
|
506 |
jQuery(".iowd-stat-ajax span b").html("There are " + scan["not_optimized_data_media"] + " full-size ( totally " + scan["not_optimized_data_media_sizes"] + " ) images from media library and " + scan["not_optimized_data_other"] + " from other directories ready for optimize");
|
507 |
}
|
508 |
|
509 |
dataAttachments = jQuery(".iowd-butn-ajax-container").attr("data-attachments");
|
510 |
-
if(dataAttachments == "1" || scan["not_optimized_data"] > 0 || scan["not_optimized_data_sizes"] > 0){
|
511 |
jQuery(".iowd-butn-ajax-container").show();
|
512 |
-
|
|
|
513 |
if (scan["optimized_data"]) {
|
514 |
jQuery(".iowd-optimized-ajax-text").html('<strong class="iowd-up-to-date">All images are optimized and up to date.</strong>');
|
515 |
} else {
|
2 |
|
3 |
if (iowdSettingsGlobal.page == "iowd_settings") {
|
4 |
|
5 |
+
if (iowdSettingsGlobal.from_gallery == 1) {
|
6 |
+
removeGalleryFromOther();
|
7 |
+
jQuery(".iowd_optimize_gallery").prop('checked', true);
|
8 |
+
iowdCickSettings("optimize_gallery", 1);
|
9 |
+
} else {
|
10 |
+
iowdScan(0);
|
11 |
+
}
|
12 |
+
|
13 |
+
jQuery(".iowd-toggle").click(function () {
|
14 |
+
if (jQuery(this).find("span").hasClass("iowd-toggle-open")) {
|
15 |
+
jQuery(this).closest(".iowd-toggle-container").find(".iowd-toggle-body").slideUp();
|
16 |
+
jQuery(this).find("span").removeClass("iowd-toggle-open");
|
17 |
+
jQuery(this).find("span").addClass("iowd-toggle-close");
|
18 |
+
} else {
|
19 |
+
jQuery(this).closest(".iowd-toggle-container").find(".iowd-toggle-body").slideDown();
|
20 |
+
jQuery(this).find("span").removeClass("iowd-toggle-close");
|
21 |
+
jQuery(this).find("span").addClass("iowd-toggle-open");
|
22 |
+
}
|
23 |
+
|
24 |
+
});
|
25 |
+
|
26 |
jQuery("#settings_form").tooltip();
|
27 |
// quick settings
|
28 |
+
jQuery(".iowd_quick_settings_el").change(function () {
|
29 |
var value = 0;
|
30 |
if (jQuery(this).is(":checked") == true) {
|
31 |
value = 1;
|
37 |
|
38 |
// standart settings
|
39 |
jQuery(".iowd-standart-mode-view1 .iowd-standart-cell").click(function () {
|
40 |
+
if (jQuery(this).attr("data-value") == "extreme") {
|
41 |
return false;
|
42 |
}
|
43 |
jQuery("[name=standard_setting]").val(jQuery(this).attr("data-value"));
|
142 |
return false;
|
143 |
}
|
144 |
});
|
145 |
+
|
146 |
jQuery(".iowd-dir-tree-title").on('click', function (e) {
|
147 |
e.stopPropagation();
|
148 |
var thisElem = jQuery(e.target).closest("li");
|
189 |
}
|
190 |
jQuery(".iowd-spinner-select").show();
|
191 |
jQuery.post(iowd.ajaxURL, data, function (response) {
|
192 |
+
response = JSON.parse(response);
|
193 |
+
jQuery(".iowd-dir-paths").html(response["other"]);
|
194 |
+
jQuery(".iowd-dir-gallery-paths").html(response["gallery"]);
|
195 |
jQuery(".iowd-spinner-select").hide();
|
196 |
save_settings();
|
197 |
});
|
219 |
}
|
220 |
jQuery(".iowd-spinner-select").show();
|
221 |
jQuery.post(iowd.ajaxURL, data, function (response) {
|
222 |
+
response = JSON.parse(response);
|
223 |
+
jQuery(".iowd-dir-paths").append(response["other"]);
|
224 |
+
jQuery(".iowd-dir-gallery-paths").append(response["gallery"]);
|
225 |
jQuery(".iowd-spinner-select").hide();
|
226 |
updateOtherFolders();
|
227 |
});
|
374 |
window.location.href = "admin.php?page=iowd_settings";
|
375 |
});
|
376 |
});
|
377 |
+
jQuery(".iowd-butn-ajax-container").closest(".iowd-main").append('<img src="' + iowdSettingsGlobal.image_url + '/spinner.gif" class="iowd-spinner iowd-loading-spinner-ajax" style="display:inline-block; vertical-align:sub;">');
|
378 |
+
|
379 |
|
380 |
});
|
381 |
|
385 |
html = true;
|
386 |
}
|
387 |
var otherFolders = {};
|
388 |
+
var otherFolderPaths = [];
|
389 |
jQuery(".iowd_other_folders_row").each(function () {
|
390 |
var otherFolderPath = jQuery(this).find(".iowd_other_path").attr("data-name").trim();
|
391 |
+
if (otherFolderPath && otherFolderPaths.indexOf(otherFolderPath) == -1) {
|
392 |
var otherImages = [];
|
393 |
jQuery(this).find(".iowd_other_img_path").each(function () {
|
394 |
var imagePath = jQuery(this).find(".iowd_image_path").html();
|
397 |
}
|
398 |
});
|
399 |
otherFolders[otherFolderPath] = otherImages;
|
400 |
+
otherFolderPaths.push(otherFolderPath);
|
401 |
}
|
402 |
|
403 |
});
|
404 |
|
405 |
if (html === true) {
|
406 |
if (Number(Object.keys(otherFolders).length) > 0) {
|
407 |
+
var otherFoldersGallery = {};
|
408 |
+
var otherFoldersOther = jQuery.extend({}, otherFolders);
|
409 |
+
if (jQuery("[name=gallery_upload_dir]").length > 0) {
|
410 |
+
otherFoldersGallery = otherFolders[jQuery("[name=gallery_upload_dir]").val()];
|
411 |
+
delete otherFoldersOther[jQuery("[name=gallery_upload_dir]").val()];
|
412 |
+
}
|
413 |
+
|
414 |
+
if (jQuery(".iowd_other_save_btn").length == 0 && Number(Object.keys(otherFoldersOther).length) > 0) {
|
415 |
var saveButton = '<div class="iowd_other_save_btn"><button class="iowd-btn iowd-btn-small iowd-btn-secondary">' + iowdSettingsGlobal.save_dirs_txt + '</button></div>';
|
416 |
+
jQuery(".iowd_other_dirs_container .iowd-toggle-body").append(saveButton);
|
417 |
+
|
418 |
+
}
|
419 |
+
if (jQuery(".iowd_gallery_save_btn").length == 0 && Number(Object.keys(otherFoldersGallery).length) > 0) {
|
420 |
+
var saveButton = '<div class="iowd_gallery_save_btn"><button class="iowd-btn iowd-btn-small iowd-btn-secondary">' + iowdSettingsGlobal.save_gallery_dirs_txt + '</button></div>';
|
421 |
+
|
422 |
+
jQuery(".iowd_wd_plugins .iowd-toggle-body").append(saveButton);
|
423 |
}
|
424 |
}
|
425 |
else {
|
426 |
jQuery(".iowd_other_save_btn").remove();
|
427 |
+
jQuery(".iowd_gallery_save_btn").remove();
|
428 |
otherFolders = "";
|
429 |
}
|
430 |
}
|
431 |
+
otherFolders = typeof otherFolders == "object" ? JSON.stringify(otherFolders) : otherFolders;
|
432 |
jQuery("[name=other_folders]").val(otherFolders);
|
433 |
|
434 |
}
|
445 |
|
446 |
jQuery(".iowd-spinner-select").show();
|
447 |
jQuery.post(iowd.ajaxURL, data, function (response) {
|
448 |
+
response = JSON.parse(response);
|
449 |
+
jQuery(".iowd-dir-paths").append(response["other"]);
|
450 |
+
jQuery(".iowd-dir-gallery-paths").append(response["gallery"]);
|
451 |
jQuery(".iowd-spinner-select").hide();
|
452 |
updateOtherFolders();
|
453 |
});
|
481 |
}
|
482 |
}
|
483 |
}
|
484 |
+
|
485 |
function iowdShowHideChange(onChangeElem, showToggleElem, checkedVal, onChangeElemChild, showToggleElemChild, checkedValChild) {
|
486 |
|
487 |
jQuery("[name=" + onChangeElem).change(function () {
|
502 |
value: value
|
503 |
};
|
504 |
|
505 |
+
jQuery.post(iowd.ajaxURL, data, function (response) {
|
506 |
+
if (name = "optimize_gallery") {
|
507 |
+
if (value == 1) {
|
508 |
+
getGalleryDir();
|
509 |
+
} else {
|
510 |
+
removeGalleryFromOther();
|
511 |
+
jQuery("#settings_form").submit();
|
512 |
+
}
|
513 |
+
}
|
514 |
+
});
|
515 |
+
}
|
516 |
+
|
517 |
+
function removeGalleryFromOther() {
|
518 |
+
var gelleryDir = jQuery("[name=gallery_upload_dir]").val().trim();
|
519 |
+
var otherFolders = jQuery("[name=other_folders]").val().trim();
|
520 |
+
if (otherFolders) {
|
521 |
+
var otherFolders = JSON.parse(otherFolders);
|
522 |
+
delete otherFolders[gelleryDir];
|
523 |
+
jQuery("[name=other_folders]").val(JSON.stringify(otherFolders));
|
524 |
+
}
|
525 |
+
|
526 |
+
}
|
527 |
+
|
528 |
+
function getGalleryDir() {
|
529 |
+
var dirData = {};
|
530 |
+
dirData[jQuery("[name=gallery_upload_dir]").val()] = [];
|
531 |
+
var data = {
|
532 |
+
action: "choose_dirs",
|
533 |
+
nonce_iowd: iowd.nonce,
|
534 |
+
dir: JSON.stringify(dirData)
|
535 |
+
};
|
536 |
|
537 |
+
jQuery(".iowd-spinner-select").show();
|
538 |
jQuery.post(iowd.ajaxURL, data, function (response) {
|
539 |
+
response = JSON.parse(response);
|
540 |
+
jQuery(".iowd-dir-paths").append(response["other"]);
|
541 |
+
jQuery(".iowd-dir-gallery-paths").append(response["gallery"]);
|
542 |
+
jQuery(".iowd-spinner-select").hide();
|
543 |
+
updateOtherFolders();
|
544 |
+
|
545 |
+
var data = {
|
546 |
+
action: "quick_settings",
|
547 |
+
nonce_iowd: iowd.nonce,
|
548 |
+
name: "other_folders",
|
549 |
+
value: jQuery("[name=other_folders]").val()
|
550 |
+
};
|
551 |
+
|
552 |
+
jQuery.post(iowd.ajaxURL, data, function (response) {
|
553 |
+
/*if (jQuery("[name=other_folders]").val()) {
|
554 |
+
var otherFolders = JSON.parse(jQuery("[name=other_folders]").val().trim());
|
555 |
+
var count = 0;
|
556 |
+
for (var key in otherFolders) {
|
557 |
+
count = count + otherFolders[key].length;
|
558 |
+
}
|
559 |
+
if(count){
|
560 |
+
jQuery(".iowd-optimized-ajax-text").remove();
|
561 |
+
}
|
562 |
+
}*/
|
563 |
+
|
564 |
+
iowdScan(0);
|
565 |
+
});
|
566 |
+
|
567 |
});
|
568 |
}
|
569 |
|
584 |
|
585 |
jQuery.post(iowd.ajaxURL, data, function (response) {
|
586 |
response = JSON.parse(response);
|
587 |
+
if (response["status"] != "done") {
|
588 |
limit = limit + 2000;
|
589 |
iowdScan(limit);
|
590 |
+
} else {
|
591 |
var data = {
|
592 |
action: "scan_all",
|
593 |
nonce_iowd: iowd.nonce,
|
594 |
+
limit: limit
|
595 |
};
|
596 |
|
597 |
jQuery.post(iowd.ajaxURL, data, function (response) {
|
605 |
|
606 |
function iowdLoadBlocks(scan) {
|
607 |
jQuery(".iowd-loading-spinner-ajax").remove();
|
608 |
+
if (scan["not_optimized_data"] > 0 || scan["not_optimized_data_sizes"] > 0) {
|
609 |
jQuery(".iowd-stat-ajax span b").html("There are " + scan["not_optimized_data_media"] + " full-size ( totally " + scan["not_optimized_data_media_sizes"] + " ) images from media library and " + scan["not_optimized_data_other"] + " from other directories ready for optimize");
|
610 |
}
|
611 |
|
612 |
dataAttachments = jQuery(".iowd-butn-ajax-container").attr("data-attachments");
|
613 |
+
if (dataAttachments == "1" || scan["not_optimized_data"] > 0 || scan["not_optimized_data_sizes"] > 0) {
|
614 |
jQuery(".iowd-butn-ajax-container").show();
|
615 |
+
jQuery(".iowd-optimized-ajax-text").hide();
|
616 |
+
} else {
|
617 |
if (scan["optimized_data"]) {
|
618 |
jQuery(".iowd-optimized-ajax-text").html('<strong class="iowd-up-to-date">All images are optimized and up to date.</strong>');
|
619 |
} else {
|
classes/iowddb.php
CHANGED
@@ -96,6 +96,16 @@ class IOWDDB extends IOWDDB_Class
|
|
96 |
$this->create_table("iowd_images", $fields);
|
97 |
}
|
98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
|
100 |
}
|
101 |
|
96 |
$this->create_table("iowd_images", $fields);
|
97 |
}
|
98 |
|
99 |
+
public function update()
|
100 |
+
{
|
101 |
+
$options = json_decode(get_option(IOWD_PREFIX . "_options"), true);
|
102 |
+
|
103 |
+
if(!in_array("optimize_gallery", $options)){
|
104 |
+
$options["optimize_gallery"] = "0";
|
105 |
+
update_option(IOWD_PREFIX . "_options",json_encode($options));
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
|
110 |
}
|
111 |
|
includes/iowd-ajax.php
CHANGED
@@ -29,7 +29,7 @@ class IOWD_Ajax
|
|
29 |
$path = get_attached_file($id);
|
30 |
$type = strtolower(pathinfo($path, PATHINFO_EXTENSION));
|
31 |
global $wpdb;
|
32 |
-
$row = $wpdb->get_row("SELECT COUNT(*) AS image_count, SUM(image_orig_size) AS image_orig_size, SUM(image_size) AS image_size, post_id FROM " . $wpdb->prefix . "iowd_images WHERE post_id='" . $id."' GROUP BY post_id");
|
33 |
|
34 |
$reduced = $row->image_orig_size - $row->image_size;
|
35 |
$reduced_percent = $row->image_orig_size ? ($reduced / $row->image_orig_size) * 100 : 0;
|
@@ -187,8 +187,10 @@ class IOWD_Ajax
|
|
187 |
|
188 |
public static function choose_dirs()
|
189 |
{
|
|
|
190 |
$dirs = isset($_POST["dir"]) ? json_decode(stripslashes($_POST["dir"])) : array();
|
191 |
-
$
|
|
|
192 |
if ($dirs) {
|
193 |
foreach ($dirs as $dir => $images) {
|
194 |
if (!$images) {
|
@@ -205,21 +207,29 @@ class IOWD_Ajax
|
|
205 |
$images_tmpl .= '</div>';
|
206 |
}
|
207 |
$dir_name = str_replace(get_home_path(), "", $dir);
|
208 |
-
$template
|
209 |
'<div class="other_folders" >' .
|
210 |
'<span class="iowd_other_path" title="' . $dir . '" data-name="' . $dir . '">' . $dir_name . ' </span> ' . $show .
|
211 |
'<span class="iowd_remove"> × </span>' .
|
212 |
'</div>' . $images_tmpl .
|
213 |
|
214 |
'</div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
}
|
216 |
|
217 |
}
|
218 |
|
219 |
-
echo $
|
220 |
wp_die();
|
221 |
}
|
222 |
|
|
|
|
|
223 |
public static function filter_report()
|
224 |
{
|
225 |
$report_class = new IOWD_Report();
|
@@ -247,12 +257,12 @@ class IOWD_Ajax
|
|
247 |
public static function quick_settings()
|
248 |
{
|
249 |
$name = isset($_POST["name"]) ? $_POST["name"] : false;
|
250 |
-
$value = isset($_POST["value"]) ?
|
251 |
|
252 |
if ($name !== false && $value !== false) {
|
253 |
$settings = json_decode(get_option(IOWD_PREFIX . "_options"), true);
|
254 |
if (isset($settings[$name])) {
|
255 |
-
$settings[$name] = $value;
|
256 |
update_option(IOWD_PREFIX . "_options", json_encode($settings));
|
257 |
}
|
258 |
|
@@ -312,24 +322,24 @@ class IOWD_Ajax
|
|
312 |
$other = array();
|
313 |
$media_sizes = array();
|
314 |
$attachments = array();
|
315 |
-
for($i=0; $i <= $limit; $i+=2000){
|
316 |
-
$db_attachments = get_site_transient("iowd_temp_scan_data_"
|
317 |
$media_attachments = isset($db_attachments["media"]) ? $db_attachments["media"] : array();
|
318 |
$media_sizes_attachments = isset($db_attachments["media_sizes"]) ? $db_attachments["media_sizes"] : array();
|
319 |
$other_attachments = isset($db_attachments["other"]) ? $db_attachments["other"] : array();
|
320 |
$u_attachments = isset($db_attachments["attachments"]) ? $db_attachments["attachments"] : array();
|
321 |
|
322 |
-
$media = $media +
|
323 |
$other = $other + $other_attachments;
|
324 |
$media_sizes = $media_sizes + $media_sizes_attachments;
|
325 |
$attachments = $attachments + $u_attachments;
|
326 |
|
327 |
-
delete_site_transient("iowd_temp_scan_data_"
|
328 |
}
|
329 |
$all_attachments = array(
|
330 |
-
"media"
|
331 |
"media_sizes" => $media_sizes,
|
332 |
-
"other"
|
333 |
"attachments" => $attachments,
|
334 |
);
|
335 |
|
29 |
$path = get_attached_file($id);
|
30 |
$type = strtolower(pathinfo($path, PATHINFO_EXTENSION));
|
31 |
global $wpdb;
|
32 |
+
$row = $wpdb->get_row("SELECT COUNT(*) AS image_count, SUM(image_orig_size) AS image_orig_size, SUM(image_size) AS image_size, post_id FROM " . $wpdb->prefix . "iowd_images WHERE post_id='" . $id . "' GROUP BY post_id");
|
33 |
|
34 |
$reduced = $row->image_orig_size - $row->image_size;
|
35 |
$reduced_percent = $row->image_orig_size ? ($reduced / $row->image_orig_size) * 100 : 0;
|
187 |
|
188 |
public static function choose_dirs()
|
189 |
{
|
190 |
+
global $wd_bwg_options;
|
191 |
$dirs = isset($_POST["dir"]) ? json_decode(stripslashes($_POST["dir"])) : array();
|
192 |
+
$template_other = "";
|
193 |
+
$template_gallery = "";
|
194 |
if ($dirs) {
|
195 |
foreach ($dirs as $dir => $images) {
|
196 |
if (!$images) {
|
207 |
$images_tmpl .= '</div>';
|
208 |
}
|
209 |
$dir_name = str_replace(get_home_path(), "", $dir);
|
210 |
+
$template = '<div class="iowd_other_folders_row">' .
|
211 |
'<div class="other_folders" >' .
|
212 |
'<span class="iowd_other_path" title="' . $dir . '" data-name="' . $dir . '">' . $dir_name . ' </span> ' . $show .
|
213 |
'<span class="iowd_remove"> × </span>' .
|
214 |
'</div>' . $images_tmpl .
|
215 |
|
216 |
'</div>';
|
217 |
+
|
218 |
+
if (strpos($dir_name, "photo-gallery") !== false && isset($wd_bwg_options)) {
|
219 |
+
$template_gallery .= $template;
|
220 |
+
} else {
|
221 |
+
$template_other .= $template;
|
222 |
+
}
|
223 |
}
|
224 |
|
225 |
}
|
226 |
|
227 |
+
echo json_encode(array("other" => $template_other, "gallery" => $template_gallery));
|
228 |
wp_die();
|
229 |
}
|
230 |
|
231 |
+
|
232 |
+
|
233 |
public static function filter_report()
|
234 |
{
|
235 |
$report_class = new IOWD_Report();
|
257 |
public static function quick_settings()
|
258 |
{
|
259 |
$name = isset($_POST["name"]) ? $_POST["name"] : false;
|
260 |
+
$value = isset($_POST["value"]) ? $_POST["value"] : false;
|
261 |
|
262 |
if ($name !== false && $value !== false) {
|
263 |
$settings = json_decode(get_option(IOWD_PREFIX . "_options"), true);
|
264 |
if (isset($settings[$name])) {
|
265 |
+
$settings[$name] = esc_html($value);
|
266 |
update_option(IOWD_PREFIX . "_options", json_encode($settings));
|
267 |
}
|
268 |
|
322 |
$other = array();
|
323 |
$media_sizes = array();
|
324 |
$attachments = array();
|
325 |
+
for ($i = 0; $i <= $limit; $i += 2000) {
|
326 |
+
$db_attachments = get_site_transient("iowd_temp_scan_data_" . $i);
|
327 |
$media_attachments = isset($db_attachments["media"]) ? $db_attachments["media"] : array();
|
328 |
$media_sizes_attachments = isset($db_attachments["media_sizes"]) ? $db_attachments["media_sizes"] : array();
|
329 |
$other_attachments = isset($db_attachments["other"]) ? $db_attachments["other"] : array();
|
330 |
$u_attachments = isset($db_attachments["attachments"]) ? $db_attachments["attachments"] : array();
|
331 |
|
332 |
+
$media = $media + $media_attachments;
|
333 |
$other = $other + $other_attachments;
|
334 |
$media_sizes = $media_sizes + $media_sizes_attachments;
|
335 |
$attachments = $attachments + $u_attachments;
|
336 |
|
337 |
+
delete_site_transient("iowd_temp_scan_data_" . $i);
|
338 |
}
|
339 |
$all_attachments = array(
|
340 |
+
"media" => $media,
|
341 |
"media_sizes" => $media_sizes,
|
342 |
+
"other" => $other,
|
343 |
"attachments" => $attachments,
|
344 |
);
|
345 |
|
includes/iowd-helper.php
CHANGED
@@ -52,7 +52,8 @@ class IOWD_Helper
|
|
52 |
|
53 |
public static function get_images_from_dir_recursiv($dir_path, &$image_paths = array())
|
54 |
{
|
55 |
-
|
|
|
56 |
if (file_exists($dir_path)) {
|
57 |
$dir = scandir($dir_path);
|
58 |
$images = glob($dir_path . '/*.{jpg,png,gif,jpeg,pdf}', GLOB_BRACE);
|
@@ -64,10 +65,14 @@ class IOWD_Helper
|
|
64 |
}
|
65 |
$image_paths = array_merge($image_paths, $images);
|
66 |
foreach ($dir as $file) {
|
67 |
-
if ($file == "." || $file == ".."
|
68 |
continue;
|
69 |
}
|
70 |
-
|
|
|
|
|
|
|
|
|
71 |
if (is_dir($dir_path . "/" . $file)) {
|
72 |
self::get_images_from_dir_recursiv($dir_path . "/" . $file, $image_paths);
|
73 |
}
|
52 |
|
53 |
public static function get_images_from_dir_recursiv($dir_path, &$image_paths = array())
|
54 |
{
|
55 |
+
global $wd_bwg_options;
|
56 |
+
$options = json_decode(get_option(IOWD_PREFIX . "_options"), true);
|
57 |
if (file_exists($dir_path)) {
|
58 |
$dir = scandir($dir_path);
|
59 |
$images = glob($dir_path . '/*.{jpg,png,gif,jpeg,pdf}', GLOB_BRACE);
|
65 |
}
|
66 |
$image_paths = array_merge($image_paths, $images);
|
67 |
foreach ($dir as $file) {
|
68 |
+
if ($file == "." || $file == "..") {
|
69 |
continue;
|
70 |
}
|
71 |
+
if(!(strpos($file, ".original") !== false && $options["exclude_full_size"] == "0" && !empty($wd_bwg_options))){
|
72 |
+
if( (strpos($file, ".") !== false)){
|
73 |
+
continue;
|
74 |
+
}
|
75 |
+
}
|
76 |
if (is_dir($dir_path . "/" . $file)) {
|
77 |
self::get_images_from_dir_recursiv($dir_path . "/" . $file, $image_paths);
|
78 |
}
|
includes/iowd-optimize.php
CHANGED
@@ -229,6 +229,10 @@ class IOWD_Optimize
|
|
229 |
continue;
|
230 |
}
|
231 |
|
|
|
|
|
|
|
|
|
232 |
$other_path = str_replace($protocaol . '://' . $_SERVER['SERVER_NAME'], $_SERVER['DOCUMENT_ROOT'], $other_image);
|
233 |
|
234 |
if (!file_exists($other_path)) {
|
@@ -714,7 +718,7 @@ class IOWD_Optimize
|
|
714 |
continue;
|
715 |
}
|
716 |
|
717 |
-
if ($options["enable_conversion"] == 1) {
|
718 |
$request_row = $this->convert($request_row);
|
719 |
}
|
720 |
|
229 |
continue;
|
230 |
}
|
231 |
|
232 |
+
if($options["exclude_full_size"] == "1" && strpos($other_image, ".original") !== false){
|
233 |
+
continue;
|
234 |
+
}
|
235 |
+
|
236 |
$other_path = str_replace($protocaol . '://' . $_SERVER['SERVER_NAME'], $_SERVER['DOCUMENT_ROOT'], $other_image);
|
237 |
|
238 |
if (!file_exists($other_path)) {
|
718 |
continue;
|
719 |
}
|
720 |
|
721 |
+
if ($options["enable_conversion"] == 1 && !($request_row["media"] == 0 && strpos($request_row["path"], "photo-gallery"))) {
|
722 |
$request_row = $this->convert($request_row);
|
723 |
}
|
724 |
|
includes/iowd-settings.php
CHANGED
@@ -7,6 +7,7 @@ class IOWD_Settings
|
|
7 |
{
|
8 |
|
9 |
private $tabs = array();
|
|
|
10 |
|
11 |
|
12 |
public function __construct()
|
@@ -477,6 +478,18 @@ class IOWD_Settings
|
|
477 |
|
478 |
}
|
479 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
480 |
public static function save_settings()
|
481 |
{
|
482 |
if(isset($_POST["action"]) && $_POST["action"] == "save_settings") {
|
@@ -494,6 +507,16 @@ class IOWD_Settings
|
|
494 |
wp_clear_scheduled_hook('iowd_optimize');
|
495 |
}
|
496 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
497 |
update_option(IOWD_PREFIX . "_options", json_encode($new_settings));
|
498 |
}
|
499 |
$iowd_tabs_active = isset($_POST["iowd_tabs_active"]) ? $_POST["iowd_tabs_active"] : "general";
|
@@ -540,6 +563,7 @@ class IOWD_Settings
|
|
540 |
|
541 |
public function display()
|
542 |
{
|
|
|
543 |
// get options
|
544 |
$options = json_decode(get_option(IOWD_PREFIX . "_options"), true);
|
545 |
// get mode
|
7 |
{
|
8 |
|
9 |
private $tabs = array();
|
10 |
+
public $photo_gallery_dir = null;
|
11 |
|
12 |
|
13 |
public function __construct()
|
478 |
|
479 |
}
|
480 |
|
481 |
+
private static function get_gallery_dir()
|
482 |
+
{
|
483 |
+
global $wd_bwg_options;
|
484 |
+
if ($wd_bwg_options) {
|
485 |
+
$photo_gallery_dir = ABSPATH . "/" .$wd_bwg_options->images_directory . '/photo-gallery';
|
486 |
+
|
487 |
+
return $photo_gallery_dir;
|
488 |
+
}
|
489 |
+
|
490 |
+
return null;
|
491 |
+
}
|
492 |
+
|
493 |
public static function save_settings()
|
494 |
{
|
495 |
if(isset($_POST["action"]) && $_POST["action"] == "save_settings") {
|
507 |
wp_clear_scheduled_hook('iowd_optimize');
|
508 |
}
|
509 |
|
510 |
+
$photo_gallery_dir = self::get_gallery_dir();
|
511 |
+
|
512 |
+
$other_dirs = $new_settings["other_folders"] ? json_decode(htmlspecialchars_decode(stripslashes($new_settings["other_folders"])), true) : array();
|
513 |
+
$other_dirs = array_keys($other_dirs);
|
514 |
+
if (!in_array($photo_gallery_dir, $other_dirs)) {
|
515 |
+
$new_settings["optimize_gallery"] = 0;
|
516 |
+
} else {
|
517 |
+
$new_settings["optimize_gallery"] = 1;
|
518 |
+
}
|
519 |
+
|
520 |
update_option(IOWD_PREFIX . "_options", json_encode($new_settings));
|
521 |
}
|
522 |
$iowd_tabs_active = isset($_POST["iowd_tabs_active"]) ? $_POST["iowd_tabs_active"] : "general";
|
563 |
|
564 |
public function display()
|
565 |
{
|
566 |
+
$this->photo_gallery_dir = self::get_gallery_dir();
|
567 |
// get options
|
568 |
$options = json_decode(get_option(IOWD_PREFIX . "_options"), true);
|
569 |
// get mode
|
io-wd.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Image Optimizer WD
|
5 |
* Plugin URI: https://web-dorado.com/products/wordpress-image-optimizer.html
|
6 |
* Description: Image Optimizer WordPress plugin enables you to resize, compress and optimize PNG, JPG, GIF files while maintaining image quality.
|
7 |
-
* Version: 1.0.
|
8 |
* Author: WebDorado
|
9 |
* Author URI: https://web-dorado.com/
|
10 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
4 |
* Plugin Name: Image Optimizer WD
|
5 |
* Plugin URI: https://web-dorado.com/products/wordpress-image-optimizer.html
|
6 |
* Description: Image Optimizer WordPress plugin enables you to resize, compress and optimize PNG, JPG, GIF files while maintaining image quality.
|
7 |
+
* Version: 1.0.3
|
8 |
* Author: WebDorado
|
9 |
* Author URI: https://web-dorado.com/
|
10 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
iowd_class.php
CHANGED
@@ -8,7 +8,7 @@ class IOWD
|
|
8 |
{
|
9 |
|
10 |
protected static $instance = null;
|
11 |
-
private static $version = '1.0.
|
12 |
private static $page;
|
13 |
private $reg_autoloader = false;
|
14 |
private $options = array();
|
@@ -20,7 +20,7 @@ class IOWD
|
|
20 |
$this->options = json_decode(get_option(IOWD_PREFIX . "_options"), true);
|
21 |
|
22 |
add_action('admin_init', array('IOWD_Settings', 'save_settings'));
|
23 |
-
|
24 |
|
25 |
// ajax
|
26 |
add_action('wp_ajax_choose_dirs', array($this, 'ajax'));
|
@@ -69,7 +69,7 @@ class IOWD
|
|
69 |
|
70 |
public static function activate()
|
71 |
{
|
72 |
-
if (version_compare(phpversion(), "5.4", '<')){
|
73 |
echo "<div class='error'><p>" . __("Image Optimizer plugin requires PHP 5.4 or higher.", IOWD_PREFIX) . "</p></div>";
|
74 |
wp_die();
|
75 |
}
|
@@ -83,8 +83,11 @@ class IOWD
|
|
83 |
add_option(IOWD_PREFIX . "_pro", "yes", '', 'no');
|
84 |
}
|
85 |
|
|
|
|
|
86 |
if ($version && version_compare($version, self::$version, '<')) {
|
87 |
update_option(IOWD_PREFIX . "_version", self::$version);
|
|
|
88 |
|
89 |
} else {
|
90 |
add_option(IOWD_PREFIX . "_version", self::$version, '', 'no');
|
@@ -98,8 +101,6 @@ class IOWD
|
|
98 |
}
|
99 |
|
100 |
self::add_options_to_db();
|
101 |
-
require_once IOWD_DIR_CLASSES . "/iowddb.php";
|
102 |
-
$db = new IOWDDB();
|
103 |
$db->create_iowd_images_table();
|
104 |
}
|
105 |
|
@@ -144,6 +145,7 @@ class IOWD
|
|
144 |
"gif_to_png" => "0",
|
145 |
"jpg_to_webp" => "0",
|
146 |
"png_to_webp" => "0",
|
|
|
147 |
);
|
148 |
add_option(IOWD_PREFIX . "_options", json_encode($options), '', 'no');
|
149 |
}
|
@@ -180,13 +182,13 @@ class IOWD
|
|
180 |
|
181 |
public function notice()
|
182 |
{
|
183 |
-
if($this->is_iowd_page()) {
|
184 |
$limitation = IOWD_Helper::limitation();
|
185 |
$whitelist = array(
|
186 |
'127.0.0.1',
|
187 |
'::1'
|
188 |
);
|
189 |
-
if(in_array($_SERVER['REMOTE_ADDR'], $whitelist)){
|
190 |
echo "<div class='error'><p>" . __("Image optimizing is disabled on Localhost. Please install the plugin on a live server to optimize images.", IOWD_PREFIX) . "</p></div>";
|
191 |
}
|
192 |
if ($limitation["already_optimized"] >= $limitation["limit"]) {
|
@@ -293,7 +295,7 @@ class IOWD
|
|
293 |
public function admin_menu()
|
294 |
{
|
295 |
$parent_slug = null;
|
296 |
-
if(
|
297 |
$parent_slug = "iowd_settings";
|
298 |
add_menu_page("Image Optimizer", "Image Optimizer", 'manage_options', 'iowd_settings', array($this, 'iowd_admin'), IOWD_URL_IMG . "/icon.png");
|
299 |
}
|
@@ -416,13 +418,16 @@ class IOWD
|
|
416 |
|
417 |
wp_enqueue_script(IOWD_PREFIX . '_settings-js', IOWD_URL_JS . '/settings.js', array(), self::$version);
|
418 |
|
|
|
419 |
|
420 |
wp_localize_script(IOWD_PREFIX . '_settings-js', 'iowdSettingsGlobal', array(
|
421 |
-
"image_url"
|
422 |
-
"ajaxURL"
|
423 |
-
"nonce"
|
424 |
-
"page"
|
425 |
-
"save_dirs_txt"
|
|
|
|
|
426 |
));
|
427 |
|
428 |
wp_enqueue_script(IOWD_PREFIX . '_calendar-js', IOWD_URL_JS . '/calendar.js', array(), self::$version, true);
|
8 |
{
|
9 |
|
10 |
protected static $instance = null;
|
11 |
+
private static $version = '1.0.3';
|
12 |
private static $page;
|
13 |
private $reg_autoloader = false;
|
14 |
private $options = array();
|
20 |
$this->options = json_decode(get_option(IOWD_PREFIX . "_options"), true);
|
21 |
|
22 |
add_action('admin_init', array('IOWD_Settings', 'save_settings'));
|
23 |
+
// add_action('admin_post_nopriv_save_settings', array('IOWD_Settings', 'save_settings'));
|
24 |
|
25 |
// ajax
|
26 |
add_action('wp_ajax_choose_dirs', array($this, 'ajax'));
|
69 |
|
70 |
public static function activate()
|
71 |
{
|
72 |
+
if (version_compare(phpversion(), "5.4", '<')) {
|
73 |
echo "<div class='error'><p>" . __("Image Optimizer plugin requires PHP 5.4 or higher.", IOWD_PREFIX) . "</p></div>";
|
74 |
wp_die();
|
75 |
}
|
83 |
add_option(IOWD_PREFIX . "_pro", "yes", '', 'no');
|
84 |
}
|
85 |
|
86 |
+
require_once IOWD_DIR_CLASSES . "/iowddb.php";
|
87 |
+
$db = new IOWDDB();
|
88 |
if ($version && version_compare($version, self::$version, '<')) {
|
89 |
update_option(IOWD_PREFIX . "_version", self::$version);
|
90 |
+
$db->update();
|
91 |
|
92 |
} else {
|
93 |
add_option(IOWD_PREFIX . "_version", self::$version, '', 'no');
|
101 |
}
|
102 |
|
103 |
self::add_options_to_db();
|
|
|
|
|
104 |
$db->create_iowd_images_table();
|
105 |
}
|
106 |
|
145 |
"gif_to_png" => "0",
|
146 |
"jpg_to_webp" => "0",
|
147 |
"png_to_webp" => "0",
|
148 |
+
"optimize_gallery" => "0",
|
149 |
);
|
150 |
add_option(IOWD_PREFIX . "_options", json_encode($options), '', 'no');
|
151 |
}
|
182 |
|
183 |
public function notice()
|
184 |
{
|
185 |
+
if ($this->is_iowd_page()) {
|
186 |
$limitation = IOWD_Helper::limitation();
|
187 |
$whitelist = array(
|
188 |
'127.0.0.1',
|
189 |
'::1'
|
190 |
);
|
191 |
+
if (in_array($_SERVER['REMOTE_ADDR'], $whitelist)) {
|
192 |
echo "<div class='error'><p>" . __("Image optimizing is disabled on Localhost. Please install the plugin on a live server to optimize images.", IOWD_PREFIX) . "</p></div>";
|
193 |
}
|
194 |
if ($limitation["already_optimized"] >= $limitation["limit"]) {
|
295 |
public function admin_menu()
|
296 |
{
|
297 |
$parent_slug = null;
|
298 |
+
if (get_option("iowd_subscribe_done") == 1) {
|
299 |
$parent_slug = "iowd_settings";
|
300 |
add_menu_page("Image Optimizer", "Image Optimizer", 'manage_options', 'iowd_settings', array($this, 'iowd_admin'), IOWD_URL_IMG . "/icon.png");
|
301 |
}
|
418 |
|
419 |
wp_enqueue_script(IOWD_PREFIX . '_settings-js', IOWD_URL_JS . '/settings.js', array(), self::$version);
|
420 |
|
421 |
+
$from_gallery = isset($_GET["target"]) && $_GET["target"] == "wd_gallery" ? 1 : 0;
|
422 |
|
423 |
wp_localize_script(IOWD_PREFIX . '_settings-js', 'iowdSettingsGlobal', array(
|
424 |
+
"image_url" => IOWD_URL_IMG,
|
425 |
+
"ajaxURL" => admin_url('admin-ajax.php'),
|
426 |
+
"nonce" => wp_create_nonce('nonce_' . IOWD_PREFIX),
|
427 |
+
"page" => (isset($_GET["page"]) ? $_GET["page"] : IOWD_PREFIX . "_settings"),
|
428 |
+
"save_dirs_txt" => __("Save directories", IOWD_PREFIX),
|
429 |
+
"save_gallery_dirs_txt" => __("Save Gallery directories", IOWD_PREFIX),
|
430 |
+
"from_gallery" => $from_gallery,
|
431 |
));
|
432 |
|
433 |
wp_enqueue_script(IOWD_PREFIX . '_calendar-js', IOWD_URL_JS . '/calendar.js', array(), self::$version, true);
|
readme.txt
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
-
=== Image Optimizer WD
|
2 |
Contributors: webdorado
|
3 |
Donate link: https://web-dorado.com/products/wordpress-image-optimizer.html
|
4 |
Tags: : compress, image, images optimization, performance, photos, lossless, optimize
|
5 |
Requires at least: 3.9
|
6 |
-
Tested up to: 4.
|
7 |
-
|
|
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -54,6 +55,9 @@ Upgrade to [Image Optimizer WD Pro](https://web-dorado.com/products/wordpress-im
|
|
54 |
|
55 |
== Changelog ==
|
56 |
|
|
|
|
|
|
|
57 |
= 1.0.2 =
|
58 |
* Change: Require PHP 5.5
|
59 |
* Change: Using AJAX for getting optimizer scan info
|
1 |
+
=== Image Optimizer WD - WordPress Image Optimizer ===
|
2 |
Contributors: webdorado
|
3 |
Donate link: https://web-dorado.com/products/wordpress-image-optimizer.html
|
4 |
Tags: : compress, image, images optimization, performance, photos, lossless, optimize
|
5 |
Requires at least: 3.9
|
6 |
+
Tested up to: 4.9
|
7 |
+
Requires PHP: 5.5
|
8 |
+
Stable tag: 1.0.3
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
55 |
|
56 |
== Changelog ==
|
57 |
|
58 |
+
= 1.0.3 =
|
59 |
+
* Added: Integration with Photo Gallery plugin.
|
60 |
+
|
61 |
= 1.0.2 =
|
62 |
* Change: Require PHP 5.5
|
63 |
* Change: Using AJAX for getting optimizer scan info
|
views/iowd_limit_display.php
CHANGED
@@ -6,71 +6,76 @@ if (!defined('ABSPATH')) {
|
|
6 |
?>
|
7 |
|
8 |
<div
|
9 |
-
|
10 |
-
<
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
</b>
|
28 |
-
</div>
|
29 |
-
<div
|
30 |
-
class="iowd_stat-row">
|
31 |
<div
|
32 |
-
|
33 |
-
<b>
|
34 |
-
<?php echo __("
|
35 |
</b>
|
36 |
</div>
|
37 |
<div
|
38 |
-
|
39 |
-
<
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
echo '<span class="images_count">' . $limitation["already_optimized"] . '</span> ';
|
42 |
echo __("images", IOWD_PREFIX);
|
43 |
if ($limitation["already_optimized"] >= $limitation["limit"]) {
|
44 |
-
echo "<span style='color:red'><br>( " . __("Expired", IOWD_PREFIX) .
|
45 |
}
|
46 |
-
|
47 |
-
|
|
|
48 |
</div>
|
49 |
-
</div>
|
50 |
-
<div
|
51 |
-
class="iowd_stat-row">
|
52 |
<div
|
53 |
-
|
54 |
-
<
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
<
|
61 |
-
|
62 |
-
|
|
|
|
|
63 |
echo '<span class="images_count">' . ($limitation["limit"] - $limitation["already_optimized"]) . '</span> ';
|
64 |
echo __("images", IOWD_PREFIX);
|
65 |
}
|
66 |
-
|
67 |
-
|
|
|
68 |
</div>
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
}
|
74 |
|
75 |
-
|
|
|
76 |
</div>
|
6 |
?>
|
7 |
|
8 |
<div
|
9 |
+
class="iowd-toggle-container iowd_limit_content">
|
10 |
+
<div class="iowd-toggle">
|
11 |
+
<h2>
|
12 |
+
<?php _e("Your plan", IOWD_PREFIX); ?>
|
13 |
+
<img
|
14 |
+
class="iowd_update_alreday_used"
|
15 |
+
src="<?php echo IOWD_URL_IMG . "/reset.png"; ?>" title="<?php _e("Update data", IOWD_PREFIX); ?>">
|
16 |
+
<img
|
17 |
+
src="<?php echo IOWD_URL_IMG; ?>/spinner.gif"
|
18 |
+
class="iowd-spinner-select-already-used"
|
19 |
+
style="display:none; vertical-align:sub;"/>
|
20 |
+
<span class="iowd-toggle-indicator iowd-toggle-open"></span>
|
21 |
+
</h2>
|
22 |
+
</div>
|
23 |
+
<div class="iowd-toggle-body">
|
24 |
+
<?php
|
25 |
+
if ($limitation["limit"]) {
|
26 |
+
?>
|
|
|
|
|
|
|
|
|
27 |
<div
|
28 |
+
class="iowd_stat-row">
|
29 |
+
<b class="iowd-blue-txt">
|
30 |
+
<?php echo sprintf(__("You can optimize %d images every %s.", IOWD_PREFIX), $limitation["limit"], $limitation["period"]); ?>
|
31 |
</b>
|
32 |
</div>
|
33 |
<div
|
34 |
+
class="iowd_stat-row">
|
35 |
+
<div
|
36 |
+
class="iowd_stat-cell">
|
37 |
+
<b>
|
38 |
+
<?php echo __("Already optimized", IOWD_PREFIX); ?>
|
39 |
+
</b>
|
40 |
+
</div>
|
41 |
+
<div
|
42 |
+
class="iowd_stat-cell">
|
43 |
+
<b class="iowd_already_used_cell">
|
44 |
+
<?php
|
45 |
echo '<span class="images_count">' . $limitation["already_optimized"] . '</span> ';
|
46 |
echo __("images", IOWD_PREFIX);
|
47 |
if ($limitation["already_optimized"] >= $limitation["limit"]) {
|
48 |
+
echo "<span style='color:red'><br>( " . __("Expired", IOWD_PREFIX) . " )</span>";
|
49 |
}
|
50 |
+
?>
|
51 |
+
</b>
|
52 |
+
</div>
|
53 |
</div>
|
|
|
|
|
|
|
54 |
<div
|
55 |
+
class="iowd_stat-row">
|
56 |
+
<div
|
57 |
+
class="iowd_stat-cell">
|
58 |
+
<b>
|
59 |
+
<?php echo __("Remained", IOWD_PREFIX); ?>
|
60 |
+
</b>
|
61 |
+
</div>
|
62 |
+
<div
|
63 |
+
class="iowd_stat-cell">
|
64 |
+
<b class="iowd_remained_cell">
|
65 |
+
<?php
|
66 |
+
if ($limitation["limit"] - $limitation["already_optimized"] >= 0) {
|
67 |
echo '<span class="images_count">' . ($limitation["limit"] - $limitation["already_optimized"]) . '</span> ';
|
68 |
echo __("images", IOWD_PREFIX);
|
69 |
}
|
70 |
+
?>
|
71 |
+
</b>
|
72 |
+
</div>
|
73 |
</div>
|
74 |
+
<?php
|
75 |
+
} else {
|
76 |
+
_e("No data.", IOWD_PREFIX);
|
77 |
+
}
|
|
|
78 |
|
79 |
+
?>
|
80 |
+
</div>
|
81 |
</div>
|
views/iowd_settings_display.php
CHANGED
@@ -9,111 +9,111 @@ require_once IOWD_DIR_VIEWS . '/iowd_how_it_works_display.php';
|
|
9 |
|
10 |
?>
|
11 |
<div
|
12 |
-
|
13 |
<div
|
14 |
-
|
15 |
<?php echo $msg; ?>
|
16 |
</div>
|
17 |
<div
|
18 |
-
|
19 |
×
|
20 |
</div>
|
21 |
</div>
|
22 |
|
23 |
<form
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
<?php wp_nonce_field('nonce_' . IOWD_PREFIX, 'nonce_' . IOWD_PREFIX); ?>
|
28 |
<div
|
29 |
-
|
30 |
<div
|
31 |
-
|
32 |
<div
|
33 |
-
|
34 |
<div
|
35 |
-
|
36 |
<div
|
37 |
-
|
38 |
<a href="admin.php?page=iowd_settings&iowd_mode=standart">
|
39 |
<?php _e("Easy mode", IOWD_PREFIX); ?>
|
40 |
</a>
|
41 |
</div>
|
42 |
<div
|
43 |
-
|
44 |
<a href="admin.php?page=iowd_settings&iowd_mode=advanced"><?php _e("Advanced", IOWD_PREFIX); ?></a>
|
45 |
</div>
|
46 |
</div>
|
47 |
<div
|
48 |
-
|
49 |
<div
|
50 |
-
|
51 |
<div
|
52 |
-
|
53 |
<div
|
54 |
-
|
55 |
<?php if ($mode == "standart") { ?>
|
56 |
<a class="iowd-how-works"
|
57 |
href="#"><?php _e("How it works?", IOWD_PREFIX); ?></a>
|
58 |
<?php } ?>
|
59 |
</div>
|
60 |
<div
|
61 |
-
|
62 |
<label
|
63 |
-
|
64 |
<label
|
65 |
-
|
66 |
<input
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
<div
|
72 |
-
|
73 |
</label>
|
74 |
</div>
|
75 |
</div>
|
76 |
</div>
|
77 |
<div
|
78 |
-
|
79 |
<?php _e("Please don't leave the page while uploading.", IOWD_PREFIX); ?>
|
80 |
</div>
|
81 |
<?php if ($mode == "standart") { ?>
|
82 |
<div
|
83 |
-
|
84 |
<div
|
85 |
-
|
86 |
-
|
87 |
<div
|
88 |
-
|
89 |
-
|
90 |
<div
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
<?php _e("EXTREME", IOWD_PREFIX); ?>
|
95 |
</div>
|
96 |
</div>
|
97 |
<input
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
|
102 |
<?php }
|
103 |
|
104 |
if (get_transient("iowd_optimizing_post_ids") && get_transient("iowd_images_count_start")) { ?>
|
105 |
|
106 |
<div
|
107 |
-
|
108 |
<?php
|
109 |
echo '<strong>';
|
110 |
echo sprintf(__("%u images are optimizing...", IOWD_PREFIX), get_transient("iowd_images_count_start"));
|
111 |
echo '</strong>';
|
112 |
?>
|
113 |
<img
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
<br>
|
118 |
<small>
|
119 |
<a href="#"
|
@@ -125,95 +125,95 @@ require_once IOWD_DIR_VIEWS . '/iowd_how_it_works_display.php';
|
|
125 |
</div>
|
126 |
<?php
|
127 |
} else {
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
}
|
148 |
-
?>
|
149 |
-
<div
|
150 |
-
class="iowd-media-seleced-b">
|
151 |
-
<b><?php echo sprintf(__("You are going to optimize %d (totally %d) media images ", IOWD_PREFIX), count($ids), $all_images_count); ?></b>
|
152 |
-
</div>
|
153 |
-
<div
|
154 |
-
class="iowd-main iowd-media-seleced">
|
155 |
-
<?php
|
156 |
-
echo $attachment_rows;
|
157 |
-
?>
|
158 |
-
</div>
|
159 |
-
<?php } ?>
|
160 |
-
<div
|
161 |
-
class="iowd-main">
|
162 |
-
<div class="iowd-butn-ajax-container"
|
163 |
-
data-attachments="<?php echo empty($attachments) ? 0 : 1; ?>" style="display:none;">
|
164 |
-
<?php
|
165 |
-
if ($limitation["already_optimized"] < $limitation["limit"]) {
|
166 |
-
$optimize_btn_class = "iowd-btn-primary";
|
167 |
-
$optimize_btn_id = "iowd_optimizing";
|
168 |
-
$return_false = "";
|
169 |
-
} else {
|
170 |
-
$optimize_btn_class = "iowd-btn-disabled";
|
171 |
-
$optimize_btn_id = "";
|
172 |
-
$return_false = "onclick='return false;'";
|
173 |
}
|
174 |
?>
|
175 |
-
<
|
176 |
-
|
177 |
-
|
|
|
|
|
|
|
178 |
<?php
|
179 |
-
|
180 |
-
?>
|
181 |
-
</button>
|
182 |
-
|
183 |
-
<img
|
184 |
-
src="<?php echo IOWD_URL_IMG . '/spinner.gif'; ?>"
|
185 |
-
class="iowd-spinner"
|
186 |
-
style="display:none; vertical-align:sub;"/>
|
187 |
-
<?php if (empty($attachments) === true) { ?>
|
188 |
-
<div
|
189 |
-
class="iowd-help iowd-help-from-media">
|
190 |
-
<?php _e("You can optimize individual images via your ", IOWD_PREFIX); ?>
|
191 |
-
<strong><a
|
192 |
-
href="<?php echo admin_url("upload.php"); ?>"><?php _e("Media Library", IOWD_PREFIX); ?></a></strong>.
|
193 |
-
</div>
|
194 |
-
<?php } else {
|
195 |
?>
|
196 |
-
|
197 |
-
|
198 |
-
data-cancel-type="<?php echo empty($attachments) === true ? 1 : 0; ?>"><?php _e("Cancel", IOWD_PREFIX); ?></a>
|
199 |
-
<div
|
200 |
-
class="iowd-respose-status"></div>
|
201 |
-
<?php } ?>
|
202 |
-
</div>
|
203 |
-
<div
|
204 |
-
class="iowd-optimized-txt iowd-optimized-ajax-text" style="display:none;">
|
205 |
-
</div>
|
206 |
<div
|
207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
<div
|
209 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
</div>
|
211 |
-
|
212 |
-
class="iowd-abort">
|
213 |
-
<?php _e("Cancel", IOWD_PREFIX); ?>
|
214 |
-
</a>
|
215 |
-
</div>
|
216 |
-
<?php
|
217 |
}
|
218 |
if ($mode == "advanced") {
|
219 |
require_once(IOWD_DIR_VIEWS . '/iowd_settings_form_display.php');
|
@@ -221,85 +221,135 @@ require_once IOWD_DIR_VIEWS . '/iowd_how_it_works_display.php';
|
|
221 |
?>
|
222 |
|
223 |
</div>
|
224 |
-
|
225 |
-
class="iowd_actions_content iowd_other_dirs_container">
|
226 |
-
<h2><?php _e("Other directories", IOWD_PREFIX); ?></h2>
|
227 |
-
<p><?php _e("Optimize images from directories other than the WordPress media library. Simply add any directories you wish to optimize.", IOWD_PREFIX); ?></p>
|
228 |
-
<button
|
229 |
-
class="iowd-open-dir-tree-btn iowd-btn iowd-btn-small iowd-btn-primary"><?php _e("Select Directory", IOWD_PREFIX); ?></button>
|
230 |
-
<img
|
231 |
-
class="iowd_update_dirs"
|
232 |
-
src="<?php echo IOWD_URL_IMG . "/reset.png"; ?>"
|
233 |
-
title="<?php _e("Update data", IOWD_PREFIX); ?>">
|
234 |
-
<img
|
235 |
-
src="<?php echo IOWD_URL_IMG; ?>/spinner.gif"
|
236 |
-
class="iowd-spinner-select"
|
237 |
-
style="display:none; vertical-align:sub;"/>
|
238 |
-
<div
|
239 |
-
class="iowd-dir-paths"></div>
|
240 |
-
<input
|
241 |
-
type="hidden"
|
242 |
-
name="other_folders"
|
243 |
-
value="<?php echo stripslashes($options["other_folders"]); ?>">
|
244 |
-
</div>
|
245 |
-
</div>
|
246 |
-
<div
|
247 |
-
class="iowd_stat">
|
248 |
-
<div
|
249 |
-
class="iowd_stat_content">
|
250 |
-
<h2><?php _e("Statistics", IOWD_PREFIX); ?></h2>
|
251 |
<div
|
252 |
-
|
253 |
-
<div
|
254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
<div
|
256 |
-
|
|
|
|
|
257 |
</div>
|
258 |
-
<div
|
259 |
-
class="iowd-stat-ratio"></div>
|
260 |
</div>
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
<b><?php echo "<span class='iowd_total_reduced'>" . IOWD_Util::format_bytes($last_optimized_data_reduced) . "</span> ( <span class='iowd_total_reduced_persent'>" . $last_optimized_data_reduced_percent . "</span>% )"; ?></b>
|
270 |
-
</div>
|
271 |
</div>
|
272 |
-
<div
|
273 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
<div
|
275 |
-
|
276 |
-
|
277 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
<div
|
279 |
-
|
280 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
</div>
|
282 |
-
</div>
|
283 |
-
<div
|
284 |
-
class="iowd_stat-row">
|
285 |
<div
|
286 |
-
|
287 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
</div>
|
289 |
<div
|
290 |
-
|
291 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
</div>
|
293 |
-
</div>
|
294 |
-
<div
|
295 |
-
class="iowd_stat-row">
|
296 |
<div
|
297 |
-
|
298 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
</div>
|
300 |
<div
|
301 |
-
|
302 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
</div>
|
304 |
</div>
|
305 |
|
@@ -313,18 +363,18 @@ require_once IOWD_DIR_VIEWS . '/iowd_how_it_works_display.php';
|
|
313 |
|
314 |
|
315 |
<input
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
<input
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
<input
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
</form>
|
9 |
|
10 |
?>
|
11 |
<div
|
12 |
+
class="iowd_msg_div iowd_msg_div_msg <?php echo $msg_class; ?>" <?php echo $msg_style; ?> >
|
13 |
<div
|
14 |
+
class="iowd_msg_div_text">
|
15 |
<?php echo $msg; ?>
|
16 |
</div>
|
17 |
<div
|
18 |
+
class="iowd_msg_div_close">
|
19 |
×
|
20 |
</div>
|
21 |
</div>
|
22 |
|
23 |
<form
|
24 |
+
method="post"
|
25 |
+
id="settings_form"
|
26 |
+
action="">
|
27 |
<?php wp_nonce_field('nonce_' . IOWD_PREFIX, 'nonce_' . IOWD_PREFIX); ?>
|
28 |
<div
|
29 |
+
class="iowd_header">
|
30 |
<div
|
31 |
+
class="iowd_header_cells">
|
32 |
<div
|
33 |
+
class="iowd_actions">
|
34 |
<div
|
35 |
+
class="iowd_actions_tabs">
|
36 |
<div
|
37 |
+
class="iowd_tab iowd_tab_standart <?php echo $mode == "standart" ? "iowd_tab_active" : ""; ?>">
|
38 |
<a href="admin.php?page=iowd_settings&iowd_mode=standart">
|
39 |
<?php _e("Easy mode", IOWD_PREFIX); ?>
|
40 |
</a>
|
41 |
</div>
|
42 |
<div
|
43 |
+
class="iowd_tab iowd_tab_advanced <?php echo $mode == "advanced" ? "iowd_tab_active" : ""; ?>">
|
44 |
<a href="admin.php?page=iowd_settings&iowd_mode=advanced"><?php _e("Advanced", IOWD_PREFIX); ?></a>
|
45 |
</div>
|
46 |
</div>
|
47 |
<div
|
48 |
+
class="iowd_actions_content">
|
49 |
<div
|
50 |
+
class="iowd_quick_settings">
|
51 |
<div
|
52 |
+
class="iowd_quick_settings_row">
|
53 |
<div
|
54 |
+
class="iowd_quick_settings_cell">
|
55 |
<?php if ($mode == "standart") { ?>
|
56 |
<a class="iowd-how-works"
|
57 |
href="#"><?php _e("How it works?", IOWD_PREFIX); ?></a>
|
58 |
<?php } ?>
|
59 |
</div>
|
60 |
<div
|
61 |
+
class="iowd_quick_settings_cell">
|
62 |
<label
|
63 |
+
title="<?php _e("Automatically optimize the images on upload.", IOWD_PREFIX); ?>"><?php _e("Auto optimize", IOWD_PREFIX); ?></label>
|
64 |
<label
|
65 |
+
class="iowd-switch">
|
66 |
<input
|
67 |
+
type="checkbox"
|
68 |
+
class="iowd_quick_settings_el iowd_quick_automatically_optimize"
|
69 |
+
name="automatically_optimize"
|
70 |
+
value="1" <?php echo $options["automatically_optimize"] == 1 ? "checked" : ""; ?>>
|
71 |
<div
|
72 |
+
class="iowd-slider"></div>
|
73 |
</label>
|
74 |
</div>
|
75 |
</div>
|
76 |
</div>
|
77 |
<div
|
78 |
+
class="iowd_optimizing_msg">
|
79 |
<?php _e("Please don't leave the page while uploading.", IOWD_PREFIX); ?>
|
80 |
</div>
|
81 |
<?php if ($mode == "standart") { ?>
|
82 |
<div
|
83 |
+
class="iowd-standart-mode-view iowd-standart-mode-view1">
|
84 |
<div
|
85 |
+
class="iowd-standart-cell <?php echo $standart_setting == "conservative" ? "iowd-standart-cell-active" : ""; ?>"
|
86 |
+
data-value="conservative"><?php _e("CONSERVATIVE", IOWD_PREFIX); ?></div>
|
87 |
<div
|
88 |
+
class="iowd-standart-cell <?php echo $standart_setting == "balanced" ? "iowd-standart-cell-active" : ""; ?>"
|
89 |
+
data-value="balanced"><?php _e("BALANCED", IOWD_PREFIX); ?></div>
|
90 |
<div
|
91 |
+
class="iowd-standart-cell iowd-btn-disabled"
|
92 |
+
data-value="extreme"
|
93 |
+
title="<?php _e("This option is disabled in free version.", IOWD_PREFIX); ?>">
|
94 |
<?php _e("EXTREME", IOWD_PREFIX); ?>
|
95 |
</div>
|
96 |
</div>
|
97 |
<input
|
98 |
+
type="hidden"
|
99 |
+
value=""
|
100 |
+
name="standard_setting">
|
101 |
|
102 |
<?php }
|
103 |
|
104 |
if (get_transient("iowd_optimizing_post_ids") && get_transient("iowd_images_count_start")) { ?>
|
105 |
|
106 |
<div
|
107 |
+
class="iowd-optimized-txt">
|
108 |
<?php
|
109 |
echo '<strong>';
|
110 |
echo sprintf(__("%u images are optimizing...", IOWD_PREFIX), get_transient("iowd_images_count_start"));
|
111 |
echo '</strong>';
|
112 |
?>
|
113 |
<img
|
114 |
+
src="<?php echo IOWD_URL_IMG . '/spinner.gif'; ?>"
|
115 |
+
class="iowd-spinner"
|
116 |
+
style="display:inline-block; vertical-align:sub;"/>
|
117 |
<br>
|
118 |
<small>
|
119 |
<a href="#"
|
125 |
</div>
|
126 |
<?php
|
127 |
} else {
|
128 |
+
if (empty($attachments) === true) { ?>
|
129 |
+
<div
|
130 |
+
class="iowd-main iowd-stat-ajax">
|
131 |
+
<span><b> </b></span>
|
132 |
+
</div>
|
133 |
+
<?php } ?>
|
134 |
+
<?php if (empty($attachments) === false) {
|
135 |
+
$attachment_rows = "";
|
136 |
+
$all_images_count = 0;
|
137 |
+
for ($i = 0; $i < count($attachments); $i++) {
|
138 |
+
foreach ($attachments[$i] as $attachment) {
|
139 |
+
$attachment_rows .= '<div class="attachment-row attachment-row-' . $attachment["post_id"] . '">';
|
140 |
+
$attachment_rows .= basename($attachment["path"]);
|
141 |
+
if ($attachment["size"] == "full") {
|
142 |
+
$attachment_rows .= '<span class="iowd_remove_attachment" data-id="' . $attachment["post_id"] . '"> × </span>';
|
143 |
+
}
|
144 |
+
$attachment_rows .= '</div>';
|
145 |
+
$all_images_count++;
|
146 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
}
|
148 |
?>
|
149 |
+
<div
|
150 |
+
class="iowd-media-seleced-b">
|
151 |
+
<b><?php echo sprintf(__("You are going to optimize %d (totally %d) media images ", IOWD_PREFIX), count($ids), $all_images_count); ?></b>
|
152 |
+
</div>
|
153 |
+
<div
|
154 |
+
class="iowd-main iowd-media-seleced">
|
155 |
<?php
|
156 |
+
echo $attachment_rows;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
?>
|
158 |
+
</div>
|
159 |
+
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
<div
|
161 |
+
class="iowd-main">
|
162 |
+
<div class="iowd-butn-ajax-container"
|
163 |
+
data-attachments="<?php echo empty($attachments) ? 0 : 1; ?>" style="display:none;">
|
164 |
+
<?php
|
165 |
+
if ($limitation["already_optimized"] < $limitation["limit"]) {
|
166 |
+
$optimize_btn_class = "iowd-btn-primary";
|
167 |
+
$optimize_btn_id = "iowd_optimizing";
|
168 |
+
$return_false = "";
|
169 |
+
} else {
|
170 |
+
$optimize_btn_class = "iowd-btn-disabled";
|
171 |
+
$optimize_btn_id = "";
|
172 |
+
$return_false = "onclick='return false;'";
|
173 |
+
}
|
174 |
+
?>
|
175 |
+
<button
|
176 |
+
class="iowd-btn <?php echo $optimize_btn_class; ?>"
|
177 |
+
id="<?php echo $optimize_btn_id; ?>" <?php echo $return_false; ?>>
|
178 |
+
<?php
|
179 |
+
_e("Bulk Optimizing", IOWD_PREFIX);
|
180 |
+
?>
|
181 |
+
</button>
|
182 |
+
|
183 |
+
<img
|
184 |
+
src="<?php echo IOWD_URL_IMG . '/spinner.gif'; ?>"
|
185 |
+
class="iowd-spinner"
|
186 |
+
style="display:none; vertical-align:sub;"/>
|
187 |
+
<?php if (empty($attachments) === true) { ?>
|
188 |
+
<div
|
189 |
+
class="iowd-help iowd-help-from-media">
|
190 |
+
<?php _e("You can optimize individual images via your ", IOWD_PREFIX); ?>
|
191 |
+
<strong><a
|
192 |
+
href="<?php echo admin_url("upload.php"); ?>"><?php _e("Media Library", IOWD_PREFIX); ?></a></strong>.
|
193 |
+
</div>
|
194 |
+
<?php } else {
|
195 |
+
?>
|
196 |
+
<a href="upload.php?page=iowd_settings"
|
197 |
+
class="iowd-btn iowd-btn-secondary iowd-cancel"
|
198 |
+
data-cancel-type="<?php echo empty($attachments) === true ? 1 : 0; ?>"><?php _e("Cancel", IOWD_PREFIX); ?></a>
|
199 |
+
<div
|
200 |
+
class="iowd-respose-status"></div>
|
201 |
+
<?php } ?>
|
202 |
+
</div>
|
203 |
<div
|
204 |
+
class="iowd-optimized-txt iowd-optimized-ajax-text" style="display:none;">
|
205 |
+
</div>
|
206 |
+
<div
|
207 |
+
class="iowd-loading-bar">
|
208 |
+
<div
|
209 |
+
class="iowd-loading-bar-inner"></div>
|
210 |
+
</div>
|
211 |
+
<a href="#"
|
212 |
+
class="iowd-abort">
|
213 |
+
<?php _e("Cancel", IOWD_PREFIX); ?>
|
214 |
+
</a>
|
215 |
</div>
|
216 |
+
<?php
|
|
|
|
|
|
|
|
|
|
|
217 |
}
|
218 |
if ($mode == "advanced") {
|
219 |
require_once(IOWD_DIR_VIEWS . '/iowd_settings_form_display.php');
|
221 |
?>
|
222 |
|
223 |
</div>
|
224 |
+
<?php if (!is_null($this->photo_gallery_dir)) { ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
<div
|
226 |
+
class="iowd-toggle-container iowd_actions_content iowd_wd_plugins">
|
227 |
+
<div class="iowd-toggle">
|
228 |
+
<h2>
|
229 |
+
<?php _e("Optimize images from Photo Gallery plugin", IOWD_PREFIX); ?>
|
230 |
+
<span class="iowd-toggle-indicator iowd-toggle-open"></span>
|
231 |
+
</h2>
|
232 |
+
</div>
|
233 |
+
<div class="iowd-toggle-body">
|
234 |
+
<label><?php _e("Enable Photo Gallery optimization", IOWD_PREFIX); ?></label>
|
235 |
+
<label
|
236 |
+
class="iowd-switch">
|
237 |
+
<input
|
238 |
+
type="checkbox"
|
239 |
+
class="iowd_quick_settings_el iowd_optimize_gallery"
|
240 |
+
name="optimize_gallery"
|
241 |
+
value="1" <?php echo $options["optimize_gallery"] == 1 ? "checked" : ""; ?>>
|
242 |
+
<div
|
243 |
+
class="iowd-slider"></div>
|
244 |
+
</label>
|
245 |
+
<img
|
246 |
+
class="iowd_update_dirs"
|
247 |
+
src="<?php echo IOWD_URL_IMG . "/reset.png"; ?>"
|
248 |
+
title="<?php _e("Update data", IOWD_PREFIX); ?>">
|
249 |
+
<img
|
250 |
+
src="<?php echo IOWD_URL_IMG; ?>/spinner.gif"
|
251 |
+
class="iowd-spinner-select"
|
252 |
+
style="display:none; vertical-align:sub;"/>
|
253 |
<div
|
254 |
+
class="iowd-dir-gallery-paths"></div>
|
255 |
+
<input type="hidden" name="gallery_upload_dir"
|
256 |
+
value="<?php echo $this->photo_gallery_dir; ?>">
|
257 |
</div>
|
|
|
|
|
258 |
</div>
|
259 |
+
<?php } ?>
|
260 |
+
<div
|
261 |
+
class="iowd-toggle-container iowd_actions_content iowd_other_dirs_container">
|
262 |
+
<div class="iowd-toggle">
|
263 |
+
<h2>
|
264 |
+
<?php _e("Other directories", IOWD_PREFIX); ?>
|
265 |
+
<span class="iowd-toggle-indicator iowd-toggle-open"></span>
|
266 |
+
</h2>
|
|
|
|
|
267 |
</div>
|
268 |
+
<div class="iowd-toggle-body">
|
269 |
+
<p><?php _e("Optimize images from directories other than the WordPress media library. Simply add any directories you wish to optimize.", IOWD_PREFIX); ?></p>
|
270 |
+
<button
|
271 |
+
class="iowd-open-dir-tree-btn iowd-btn iowd-btn-small iowd-btn-primary"><?php _e("Select Directory", IOWD_PREFIX); ?></button>
|
272 |
+
<img
|
273 |
+
class="iowd_update_dirs"
|
274 |
+
src="<?php echo IOWD_URL_IMG . "/reset.png"; ?>"
|
275 |
+
title="<?php _e("Update data", IOWD_PREFIX); ?>">
|
276 |
+
<img
|
277 |
+
src="<?php echo IOWD_URL_IMG; ?>/spinner.gif"
|
278 |
+
class="iowd-spinner-select"
|
279 |
+
style="display:none; vertical-align:sub;"/>
|
280 |
<div
|
281 |
+
class="iowd-dir-paths"></div>
|
282 |
+
<input
|
283 |
+
type="hidden"
|
284 |
+
name="other_folders"
|
285 |
+
value="<?php echo stripslashes($options["other_folders"]); ?>">
|
286 |
+
</div>
|
287 |
+
</div>
|
288 |
+
</div>
|
289 |
+
<div
|
290 |
+
class="iowd_stat">
|
291 |
+
<div
|
292 |
+
class="iowd-toggle-container iowd_stat_content">
|
293 |
+
<div class="iowd-toggle">
|
294 |
+
<h2>
|
295 |
+
<?php _e("Statistics", IOWD_PREFIX); ?>
|
296 |
+
<span class="iowd-toggle-indicator iowd-toggle-open"></span>
|
297 |
+
</h2>
|
298 |
+
</div>
|
299 |
+
<div class="iowd-toggle-body">
|
300 |
<div
|
301 |
+
class="iowd_stat-row">
|
302 |
+
<div
|
303 |
+
class="iowd-stat-progress-bar">
|
304 |
+
<div
|
305 |
+
class="iowd-stat-progress-bar-inner"></div>
|
306 |
+
</div>
|
307 |
+
<div
|
308 |
+
class="iowd-stat-ratio"></div>
|
309 |
</div>
|
|
|
|
|
|
|
310 |
<div
|
311 |
+
class="iowd_stat-row">
|
312 |
+
<div
|
313 |
+
class="iowd_stat-cell">
|
314 |
+
<b><?php _e("Last optimization", IOWD_PREFIX); ?></b>
|
315 |
+
</div>
|
316 |
+
<div
|
317 |
+
class="iowd_stat-cell">
|
318 |
+
<b><?php echo "<span class='iowd_total_reduced'>" . IOWD_Util::format_bytes($last_optimized_data_reduced) . "</span> ( <span class='iowd_total_reduced_persent'>" . $last_optimized_data_reduced_percent . "</span>% )"; ?></b>
|
319 |
+
</div>
|
320 |
</div>
|
321 |
<div
|
322 |
+
class="iowd_stat-row">
|
323 |
+
<div
|
324 |
+
class="iowd_stat-cell">
|
325 |
+
<b><?php _e("Media library total reduced", IOWD_PREFIX); ?></b>
|
326 |
+
</div>
|
327 |
+
<div
|
328 |
+
class="iowd_stat-cell">
|
329 |
+
<b><?php echo "<span class='iowd_total_reduced'>" . IOWD_Util::format_bytes($stat["total_reduced"]) . "</span> ( <span class='iowd_total_reduced_persent'>" . $stat["total_reduced_persent"] . "</span>% )"; ?></b>
|
330 |
+
</div>
|
331 |
</div>
|
|
|
|
|
|
|
332 |
<div
|
333 |
+
class="iowd_stat-row">
|
334 |
+
<div
|
335 |
+
class="iowd_stat-cell">
|
336 |
+
<b><?php _e("Other directories total reduced ", IOWD_PREFIX); ?></b>
|
337 |
+
</div>
|
338 |
+
<div
|
339 |
+
class="iowd_stat-cell">
|
340 |
+
<b><?php echo "<span class='iowd_total_reduced_other'>" . IOWD_Util::format_bytes($stat["total_reduced_other"]) . "</span> ( <span class='iowd_total_reduced_persent_other'>" . $stat["total_reduced_persent_other"] . "</span>% )"; ?></b>
|
341 |
+
</div>
|
342 |
</div>
|
343 |
<div
|
344 |
+
class="iowd_stat-row">
|
345 |
+
<div
|
346 |
+
class="iowd_stat-cell">
|
347 |
+
<b><?php _e("Total", IOWD_PREFIX); ?></b>
|
348 |
+
</div>
|
349 |
+
<div
|
350 |
+
class="iowd_stat-cell">
|
351 |
+
<b><?php echo "<span class='iowd_total'>" . IOWD_Util::format_bytes($stat["total"]) . "</span> ( <span class='iowd_total_persent'>" . $stat["total_persent"] . "</span>% )"; ?></b>
|
352 |
+
</div>
|
353 |
</div>
|
354 |
</div>
|
355 |
|
363 |
|
364 |
|
365 |
<input
|
366 |
+
type="hidden"
|
367 |
+
name="iowd_tabs_active"
|
368 |
+
id="iowd_tabs_active"
|
369 |
+
value="<?php echo $iowd_tabs_active; ?>">
|
370 |
<input
|
371 |
+
type="hidden"
|
372 |
+
name="ids"
|
373 |
+
id="ids"
|
374 |
+
value="<?php echo implode(",", $ids); ?>">
|
375 |
<input
|
376 |
+
type="hidden"
|
377 |
+
name="action"
|
378 |
+
id="action"
|
379 |
+
value="save_settings">
|
380 |
</form>
|