Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/wp-smush.../_src/js/smush
File: smush.js
}
[1000] Fix | Delete
[1001] Fix | Delete
maybeShowCDNUpsellForPreSiteOnCompleted() {
[1002] Fix | Delete
// Show upsell cdn.
[1003] Fix | Delete
const upsellCdn = document.querySelector('.wp-smush-upsell-cdn');
[1004] Fix | Delete
if ( upsellCdn ) {
[1005] Fix | Delete
upsellCdn.querySelector('p').innerHTML = wp_smush_msgs.processed_cdn_for_free;
[1006] Fix | Delete
upsellCdn.classList.remove('sui-hidden');
[1007] Fix | Delete
}
[1008] Fix | Delete
}
[1009] Fix | Delete
[1010] Fix | Delete
onBulkSmushCompleted() {
[1011] Fix | Delete
// Show upsell unlimited on completed.
[1012] Fix | Delete
this.maybeShowUnlimitedUpsellNotice();
[1013] Fix | Delete
// Show CDN activation notice for pro users.
[1014] Fix | Delete
this.maybeShowCDNActivationNotice();
[1015] Fix | Delete
// Show CDN upsell for old users.
[1016] Fix | Delete
this.maybeShowCDNUpsellForPreSiteOnCompleted();
[1017] Fix | Delete
[1018] Fix | Delete
this.maybeShowBulkErrorActions();
[1019] Fix | Delete
[1020] Fix | Delete
const callback = this.is_bulk
[1021] Fix | Delete
? () => this.trackBulkSmushCompleted()
[1022] Fix | Delete
: () => false;
[1023] Fix | Delete
[1024] Fix | Delete
this.syncStats().done(callback);
[1025] Fix | Delete
}
[1026] Fix | Delete
[1027] Fix | Delete
getPercentOptimized(totalImages, totalImagesToSmush) {
[1028] Fix | Delete
if (totalImages === totalImagesToSmush || totalImages <= 0) {
[1029] Fix | Delete
return 100;
[1030] Fix | Delete
} else {
[1031] Fix | Delete
return Math.floor((totalImages - totalImagesToSmush) * 100 / totalImages);
[1032] Fix | Delete
}
[1033] Fix | Delete
}
[1034] Fix | Delete
[1035] Fix | Delete
/**
[1036] Fix | Delete
* Prepare error row. Will only allow to hide errors for WP media attachments (not nextgen).
[1037] Fix | Delete
*
[1038] Fix | Delete
* @since 1.9.0
[1039] Fix | Delete
*
[1040] Fix | Delete
* @param {string} errorMsg Error message.
[1041] Fix | Delete
* @param {string} fileName File name.
[1042] Fix | Delete
* @param {string} thumbnail Thumbnail for image (if available).
[1043] Fix | Delete
* @param {number} id Image ID.
[1044] Fix | Delete
* @param {string} type Smush type: media or netxgen.
[1045] Fix | Delete
*
[1046] Fix | Delete
* @return {string} Row with error.
[1047] Fix | Delete
*/
[1048] Fix | Delete
static prepareErrorRow( errorMsg, fileName, thumbnail, id, type ) {
[1049] Fix | Delete
const thumbDiv =
[1050] Fix | Delete
'undefined' === typeof thumbnail
[1051] Fix | Delete
? '<i class="sui-icon-photo-picture" aria-hidden="true"></i>'
[1052] Fix | Delete
: thumbnail;
[1053] Fix | Delete
const fileLink =
[1054] Fix | Delete
'undefined' === fileName || 'undefined' === typeof fileName
[1055] Fix | Delete
? 'undefined'
[1056] Fix | Delete
: fileName;
[1057] Fix | Delete
[1058] Fix | Delete
let tableDiv =
[1059] Fix | Delete
'<div class="smush-bulk-error-row">' +
[1060] Fix | Delete
'<div class="smush-bulk-image-data">' +
[1061] Fix | Delete
thumbDiv +
[1062] Fix | Delete
'<span class="smush-image-name">' +
[1063] Fix | Delete
fileLink +
[1064] Fix | Delete
'</span>' +
[1065] Fix | Delete
'<span class="smush-image-error">' +
[1066] Fix | Delete
errorMsg +
[1067] Fix | Delete
'</span>' +
[1068] Fix | Delete
'</div>';
[1069] Fix | Delete
[1070] Fix | Delete
if ( 'media' === type ) {
[1071] Fix | Delete
tableDiv =
[1072] Fix | Delete
tableDiv +
[1073] Fix | Delete
'<div class="smush-bulk-image-actions">' +
[1074] Fix | Delete
'<button type="button" class="sui-button-icon sui-tooltip sui-tooltip-constrained sui-tooltip-left smush-ignore-image" data-tooltip="' +
[1075] Fix | Delete
window.wp_smush_msgs.error_ignore +
[1076] Fix | Delete
'" data-id="' +
[1077] Fix | Delete
id +
[1078] Fix | Delete
'">' +
[1079] Fix | Delete
'<i class="sui-icon-eye-hide" aria-hidden="true"></i>' +
[1080] Fix | Delete
'</button>' +
[1081] Fix | Delete
'</div>';
[1082] Fix | Delete
}
[1083] Fix | Delete
[1084] Fix | Delete
tableDiv = tableDiv + '</div>';
[1085] Fix | Delete
[1086] Fix | Delete
return tableDiv;
[1087] Fix | Delete
}
[1088] Fix | Delete
[1089] Fix | Delete
trackBulkSmushCompleted() {
[1090] Fix | Delete
const {
[1091] Fix | Delete
savings_bytes,
[1092] Fix | Delete
count_images,
[1093] Fix | Delete
percent_optimized,
[1094] Fix | Delete
savings_percent,
[1095] Fix | Delete
count_resize,
[1096] Fix | Delete
savings_resize
[1097] Fix | Delete
} = GlobalStats.getGlobalStats();
[1098] Fix | Delete
[1099] Fix | Delete
const failurePercentage = this.total > 0 ? Math.round( this.errors.length * 100 / this.total ) : 0;
[1100] Fix | Delete
[1101] Fix | Delete
tracker.track( 'Bulk Smush Completed', {
[1102] Fix | Delete
'Total Savings': this.convertToMegabytes( savings_bytes ),
[1103] Fix | Delete
'Total Images': count_images,
[1104] Fix | Delete
'Media Optimization Percentage': parseFloat( percent_optimized ),
[1105] Fix | Delete
'Percentage of Savings': parseFloat( savings_percent ),
[1106] Fix | Delete
'Images Resized': count_resize,
[1107] Fix | Delete
'Resize Savings': this.convertToMegabytes( savings_resize ),
[1108] Fix | Delete
'Total Enqueued Images': this.total,
[1109] Fix | Delete
'Failure Percentage': failurePercentage,
[1110] Fix | Delete
} );
[1111] Fix | Delete
}
[1112] Fix | Delete
[1113] Fix | Delete
convertToMegabytes( sizeInBytes ) {
[1114] Fix | Delete
const unitMB = Math.pow( 1024, 2 );
[1115] Fix | Delete
const sizeInMegabytes = sizeInBytes / unitMB;
[1116] Fix | Delete
return sizeInMegabytes && parseFloat( sizeInMegabytes.toFixed( 2 ) ) || 0;
[1117] Fix | Delete
}
[1118] Fix | Delete
[1119] Fix | Delete
/**
[1120] Fix | Delete
* Send ajax request for single and bulk Smushing.
[1121] Fix | Delete
*/
[1122] Fix | Delete
run() {
[1123] Fix | Delete
// If bulk and we have a definite number of IDs.
[1124] Fix | Delete
if ( this.is_bulk && this.ids.length > 0 ) {
[1125] Fix | Delete
this.callAjax(true);
[1126] Fix | Delete
}
[1127] Fix | Delete
[1128] Fix | Delete
if ( ! this.is_bulk ) {
[1129] Fix | Delete
this.callAjax();
[1130] Fix | Delete
}
[1131] Fix | Delete
}
[1132] Fix | Delete
[1133] Fix | Delete
/**
[1134] Fix | Delete
* Show bulk Smush errors, and disable bulk Smush button on completion.
[1135] Fix | Delete
*/
[1136] Fix | Delete
bindDeferredEvents() {
[1137] Fix | Delete
const self = this;
[1138] Fix | Delete
[1139] Fix | Delete
this.deferred.done( function() {
[1140] Fix | Delete
// self.button.removeAttr( 'continue_smush' );
[1141] Fix | Delete
self.continueSmush = true;
[1142] Fix | Delete
[1143] Fix | Delete
if ( self.errors.length ) {
[1144] Fix | Delete
/** @param {string} wp_smush_msgs.error_in_bulk */
[1145] Fix | Delete
const msg = self.errors.length === self.total ?
[1146] Fix | Delete
window.wp_smush_msgs.all_failed :
[1147] Fix | Delete
window.wp_smush_msgs.error_in_bulk
[1148] Fix | Delete
.replace( '{{errors}}', self.errors.length )
[1149] Fix | Delete
.replace( '{{total}}', self.total )
[1150] Fix | Delete
.replace( '{{smushed}}', self.smushed );
[1151] Fix | Delete
[1152] Fix | Delete
jQuery( '.wp-smush-all-done' )
[1153] Fix | Delete
.addClass( 'sui-notice-warning' )
[1154] Fix | Delete
.removeClass( 'sui-notice-success' )
[1155] Fix | Delete
.find( 'p' )
[1156] Fix | Delete
.html( msg );
[1157] Fix | Delete
}
[1158] Fix | Delete
[1159] Fix | Delete
self.bulkDone();
[1160] Fix | Delete
[1161] Fix | Delete
// Re-enable the buttons.
[1162] Fix | Delete
jQuery(
[1163] Fix | Delete
'.wp-smush-all:not(.wp-smush-finished)'
[1164] Fix | Delete
).prop('disabled', false);
[1165] Fix | Delete
} );
[1166] Fix | Delete
}
[1167] Fix | Delete
[1168] Fix | Delete
/**
[1169] Fix | Delete
* Handles the cancel button click.
[1170] Fix | Delete
* Update the UI, and enable the bulk Smush button.
[1171] Fix | Delete
*/
[1172] Fix | Delete
cancelAjax() {
[1173] Fix | Delete
// Add a data attribute to the Smush button, to stop sending ajax.
[1174] Fix | Delete
// this.button.attr( 'continue_smush', false );
[1175] Fix | Delete
this.continueSmush = false;
[1176] Fix | Delete
// Sync and update stats.
[1177] Fix | Delete
this.syncStats();
[1178] Fix | Delete
[1179] Fix | Delete
this.request.abort();
[1180] Fix | Delete
this.enableButton();
[1181] Fix | Delete
this.button.removeClass( 'wp-smush-started' );
[1182] Fix | Delete
wp_smushit_data.unsmushed.unshift( this.current_id );
[1183] Fix | Delete
jQuery( '.wp-smush-bulk-wrapper' ).removeClass( 'sui-hidden' );
[1184] Fix | Delete
[1185] Fix | Delete
// Hide the progress bar.
[1186] Fix | Delete
jQuery( '.wp-smush-bulk-progress-bar-wrapper' ).addClass( 'sui-hidden' );
[1187] Fix | Delete
[1188] Fix | Delete
this.hideBulkFreeLimitReachedNotice();
[1189] Fix | Delete
}
[1190] Fix | Delete
[1191] Fix | Delete
/**
[1192] Fix | Delete
* Remove the current ID from the unSmushed/re-Smush variable.
[1193] Fix | Delete
*
[1194] Fix | Delete
* @param {number} currentId
[1195] Fix | Delete
*/
[1196] Fix | Delete
static updateSmushIds( currentId ) {
[1197] Fix | Delete
if (
[1198] Fix | Delete
'undefined' !== typeof wp_smushit_data.unsmushed &&
[1199] Fix | Delete
wp_smushit_data.unsmushed.length > 0
[1200] Fix | Delete
) {
[1201] Fix | Delete
const uIndex = wp_smushit_data.unsmushed.indexOf( currentId );
[1202] Fix | Delete
if ( uIndex > -1 ) {
[1203] Fix | Delete
wp_smushit_data.unsmushed.splice( uIndex, 1 );
[1204] Fix | Delete
}
[1205] Fix | Delete
}
[1206] Fix | Delete
[1207] Fix | Delete
// Remove from the re-Smush list.
[1208] Fix | Delete
if (
[1209] Fix | Delete
'undefined' !== typeof wp_smushit_data.resmush &&
[1210] Fix | Delete
wp_smushit_data.resmush.length > 0
[1211] Fix | Delete
) {
[1212] Fix | Delete
const index = wp_smushit_data.resmush.indexOf( currentId );
[1213] Fix | Delete
if ( index > -1 ) {
[1214] Fix | Delete
wp_smushit_data.resmush.splice( index, 1 );
[1215] Fix | Delete
}
[1216] Fix | Delete
}
[1217] Fix | Delete
}
[1218] Fix | Delete
}
[1219] Fix | Delete
[1220] Fix | Delete
export default Smush;
[1221] Fix | Delete
[1222] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function