Version Description
- Fixed: Smush causing media uploads to not function properly (in rare conditions)
Download this release
Release Info
Developer | vanyukov |
Plugin | Smush Image Compression and Optimization |
Version | 2.8.0.1 |
Comparing to | |
See all releases |
Code changes from version 2.8.0 to 2.8.0.1
- _src/js/media.js +29 -49
- assets/js/blocks.min.js +0 -2
- assets/js/blocks.min.js.map +0 -1
- assets/js/media.min.js +1 -1
- assets/js/media.min.js.map +1 -1
- languages/wp-smushit.pot +2 -2
- readme.txt +7 -3
- wp-smush.php +2 -2
_src/js/media.js
CHANGED
@@ -5,8 +5,26 @@
|
|
5 |
'use strict';
|
6 |
|
7 |
// Local reference to the WordPress media namespace.
|
8 |
-
const smush_media
|
9 |
-
sharedTemplate = "<label class='setting smush-stats' data-setting='description'><span class='name'><%= label %></span><span class='value'><%= value %></span></label>"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
if ( 'undefined' !== typeof smush_media.view &&
|
12 |
'undefined' !== typeof smush_media.view.Attachment.Details.TwoColumn ) {
|
@@ -30,40 +48,19 @@
|
|
30 |
// Ensure that the main attachment fields are rendered.
|
31 |
smush_media.view.Attachment.prototype.render.apply( this, arguments );
|
32 |
|
33 |
-
|
|
|
34 |
return this;
|
35 |
}
|
36 |
|
37 |
-
|
38 |
-
self = this;
|
39 |
-
|
40 |
-
image.fetch( {attribute: 'smush'} ).done( function ( img ) {
|
41 |
-
if ( typeof img.smush !== 'object' ) {
|
42 |
-
setTimeout( () => self.model.fetch(), 3000 );
|
43 |
-
}
|
44 |
-
});
|
45 |
|
46 |
/**
|
47 |
* Detach the views, append our custom fields, make sure that our data is fully updated
|
48 |
* and re-render the updated view.
|
49 |
*/
|
50 |
this.views.detach();
|
51 |
-
|
52 |
-
let detailsHtml = this.$el.find( '.settings' );
|
53 |
-
|
54 |
-
// Create the template.
|
55 |
-
let template = _.template( sharedTemplate );
|
56 |
-
let html = template( {
|
57 |
-
/**
|
58 |
-
* @var {array} smush_vars.strings Localization strings.
|
59 |
-
* @var {object} smush_vars Object from wp_localize_script()
|
60 |
-
*/
|
61 |
-
label: smush_vars.strings['stats_label'],
|
62 |
-
value: this.model.get( 'smush' )
|
63 |
-
} );
|
64 |
-
|
65 |
-
detailsHtml.append( html );
|
66 |
-
this.model.fetch();
|
67 |
this.views.render();
|
68 |
|
69 |
return this;
|
@@ -86,39 +83,22 @@
|
|
86 |
// Ensure that the main attachment fields are rendered.
|
87 |
smush_media.view.Attachment.prototype.render.apply( this, arguments );
|
88 |
|
89 |
-
|
|
|
90 |
return this;
|
91 |
}
|
92 |
|
93 |
-
|
94 |
-
self = this;
|
95 |
-
|
96 |
-
image.fetch( {attribute: 'smush'} ).done( function ( img ) {
|
97 |
-
if ( typeof img.smush !== 'object' ) {
|
98 |
-
setTimeout( () => self.model.fetch(), 3000 );
|
99 |
-
}
|
100 |
-
});
|
101 |
|
102 |
/**
|
103 |
* Detach the views, append our custom fields, make sure that our data is fully updated
|
104 |
* and re-render the updated view.
|
105 |
*/
|
106 |
this.views.detach();
|
107 |
-
|
108 |
-
let template = _.template( sharedTemplate );
|
109 |
-
let html = template( {
|
110 |
-
/**
|
111 |
-
* @var {object} smush_vars Object from wp_localize_script()
|
112 |
-
* @var {array} smush_vars.strings Localization strings.
|
113 |
-
*/
|
114 |
-
label: smush_vars.strings['stats_label'],
|
115 |
-
value: this.model.get( 'smush' )
|
116 |
-
} );
|
117 |
-
|
118 |
-
this.$el.append( html );
|
119 |
|
120 |
return this;
|
121 |
}
|
122 |
} );
|
123 |
|
124 |
-
})( jQuery, _ );
|
5 |
'use strict';
|
6 |
|
7 |
// Local reference to the WordPress media namespace.
|
8 |
+
const smush_media = wp.media,
|
9 |
+
sharedTemplate = "<label class='setting smush-stats' data-setting='description'><span class='name'><%= label %></span><span class='value'><%= value %></span></label>",
|
10 |
+
template = _.template( sharedTemplate );
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Create the template.
|
14 |
+
*
|
15 |
+
* @param {string} smushHTML
|
16 |
+
* @returns {Object}
|
17 |
+
*/
|
18 |
+
const prepareTemplate = function ( smushHTML ) {
|
19 |
+
/**
|
20 |
+
* @var {array} smush_vars.strings Localization strings.
|
21 |
+
* @var {object} smush_vars Object from wp_localize_script()
|
22 |
+
*/
|
23 |
+
return template( {
|
24 |
+
label: smush_vars.strings['stats_label'],
|
25 |
+
value: smushHTML
|
26 |
+
} );
|
27 |
+
};
|
28 |
|
29 |
if ( 'undefined' !== typeof smush_media.view &&
|
30 |
'undefined' !== typeof smush_media.view.Attachment.Details.TwoColumn ) {
|
48 |
// Ensure that the main attachment fields are rendered.
|
49 |
smush_media.view.Attachment.prototype.render.apply( this, arguments );
|
50 |
|
51 |
+
const smushHTML = this.model.get( 'smush' );
|
52 |
+
if ( typeof smushHTML === 'undefined' ) {
|
53 |
return this;
|
54 |
}
|
55 |
|
56 |
+
this.model.fetch();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
/**
|
59 |
* Detach the views, append our custom fields, make sure that our data is fully updated
|
60 |
* and re-render the updated view.
|
61 |
*/
|
62 |
this.views.detach();
|
63 |
+
this.$el.find( '.settings' ).append( prepareTemplate( smushHTML ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
this.views.render();
|
65 |
|
66 |
return this;
|
83 |
// Ensure that the main attachment fields are rendered.
|
84 |
smush_media.view.Attachment.prototype.render.apply( this, arguments );
|
85 |
|
86 |
+
const smushHTML = this.model.get( 'smush' );
|
87 |
+
if ( typeof smushHTML === 'undefined' ) {
|
88 |
return this;
|
89 |
}
|
90 |
|
91 |
+
this.model.fetch();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
|
93 |
/**
|
94 |
* Detach the views, append our custom fields, make sure that our data is fully updated
|
95 |
* and re-render the updated view.
|
96 |
*/
|
97 |
this.views.detach();
|
98 |
+
this.$el.append( prepareTemplate( smushHTML ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
|
100 |
return this;
|
101 |
}
|
102 |
} );
|
103 |
|
104 |
+
})( jQuery, _ );
|
assets/js/blocks.min.js
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var s=t[r]={i:r,l:!1,exports:{}};return e[r].call(s.exports,s,s.exports,n),s.l=!0,s.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(r,s,function(t){return e[t]}.bind(null,s));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=16)}({16:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.smushStats=a;var r=wp.i18n.__,s=wp.element.createElement;function a(e){return void 0===e?React.createElement("div",null,"Select an image to view Smush stats."):"string"==typeof e?React.createElement("div",null,e):React.createElement("div",{id:"smush-stats",className:"sui-smush-media smush-stats-wrapper hidden",style:{display:"block"}},React.createElement("table",{className:"wp-smush-stats-holder"},React.createElement("thead",null,React.createElement("tr",null,React.createElement("th",{className:"smush-stats-header"},"Image size"),React.createElement("th",{className:"smush-stats-header"},"Savings"))),React.createElement("tbody",null,Object.keys(e.sizes).map(function(t,n){return React.createElement("tr",{key:n},React.createElement("td",null,t.toUpperCase()),React.createElement("td",null,function(e){var t=["kB","MB","GB","TB","PB","EB","ZB","YB"];if(Math.abs(e)<1024)return e+" B";var n=-1;do{e/=1024,++n}while(Math.abs(e)>=1024&&n<t.length-1);return e.toFixed(1)+" "+t[n]}(e.sizes[t].bytes)," ( ",e.sizes[t].percent,"% )"))}))))}var u=wp.element.createHigherOrderComponent(function(e){return function(t){if("core/image"!==t.name||!t.isSelected||void 0===t.attributes.id)return s(wp.element.Fragment,{},s(e,t));var n=t.attributes.smush;return function e(t){var n=new wp.api.models.Media({id:t.attributes.id}),r=t.attributes.smush;n.fetch({attribute:"smush"}).done(function(n){"string"==typeof n.smush?(t.setAttributes({smush:n.smush}),setTimeout(function(){return e(t)},3e3)):void 0===n.smush||void 0!==r&&JSON.stringify(r)===JSON.stringify(n.smush)||t.setAttributes({smush:n.smush})})}(t),s(wp.element.Fragment,{},s(e,t),s(wp.editor.InspectorControls,{},s(wp.components.PanelBody,{title:r("Smush Stats")},a(n))))}},"withInspectorControls");wp.hooks.addFilter("editor.BlockEdit","wp-smushit/smush-data-control",u)}});
|
2 |
-
//# sourceMappingURL=blocks.min.js.map
|
|
|
|
assets/js/blocks.min.js.map
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./_src/js/blocks.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","smushStats","__","wp","i18n","el","element","createElement","stats","React","id","className","style","display","keys","sizes","map","item","toUpperCase","bytes","units","Math","abs","u","length","toFixed","humanFileSize","percent","smushStatsControl","createHigherOrderComponent","BlockEdit","props","isSelected","attributes","Fragment","smushData","smush","fetch","image","api","models","Media","attribute","done","img","setAttributes","setTimeout","JSON","stringify","editor","InspectorControls","components","PanelBody","title","hooks","addFilter"],"mappings":"aACA,IAAAA,KAGA,SAAAC,EAAAC,GAGA,GA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AIC,OAAOC,OAAS/B,GAAIqB,EAAME,WAAWvB,KAC3DyB,EAAYJ,EAAME,WAAWG,MAE9BE,EAAMD,OAASK,UAAW,UAAYC,KAAM,SAAWC,GACjD,iBAAoBA,EAAIR,OAC5BL,EAAMc,eAAiBT,MAAOQ,EAAIR,QAClCU,WAAY,kBAAMT,EAAON,IAAS,WACvB,IAAuBa,EAAIR,YACtC,IAAuBD,GAAaY,KAAKC,UAAWb,KAAgBY,KAAKC,UAAWJ,EAAIR,QAExFL,EAAMc,eAAiBT,MAAOQ,EAAIR,UAsBpCC,CAAON,GAEA1B,EACNF,GAAGG,QAAQ4B,YAEX7B,EACCyB,EACAC,GAED1B,EACCF,GAAG8C,OAAOC,qBAEV7C,EACCF,GAAGgD,WAAWC,WAEbC,MAAOnD,EAAI,gBAEZD,EAAYkC,QAKd,yBAEHhC,GAAGmD,MAAMC,UAAW,mBAAoB,gCAAiC3B","file":"blocks.min.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 16);\n","/**\n * BLOCK: extend image block\n */\n\nconst { __ } = wp.i18n,\n \t el = wp.element.createElement;\n\n/**\n * Transform bytes to human readable format.\n *\n * @param {int} bytes\n * @returns {string}\n */\nfunction humanFileSize( bytes ) {\n\tconst thresh = 1024,\n\t\tunits = ['kB','MB','GB','TB','PB','EB','ZB','YB'];\n\n\tif ( Math.abs( bytes ) < thresh ) {\n\t\treturn bytes + ' B';\n\t}\n\n\tlet u = -1;\n\tdo {\n\t\tbytes /= thresh;\n\t\t++u;\n\t} while ( Math.abs( bytes ) >= thresh && u < units.length - 1 );\n\n\treturn bytes.toFixed( 1) + ' ' + units[u];\n}\n\n/**\n * Generate Smush stats table.\n *\n * @param {object} stats\n * @returns {*}\n */\nexport function smushStats( stats ) {\n\tif ( 'undefined' === typeof stats ) {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\tSelect an image to view Smush stats.\n\t\t\t</div>\n\t\t);\n\t} else if ( 'string' === typeof stats ) {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t{ stats }\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div id=\"smush-stats\" className=\"sui-smush-media smush-stats-wrapper hidden\" style={ { display: 'block' } }>\n\t\t\t<table className=\"wp-smush-stats-holder\">\n\t\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th className=\"smush-stats-header\">Image size</th>\n\t\t\t\t\t<th className=\"smush-stats-header\">Savings</th>\n\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<tbody>\n\t\t\t\t{ Object.keys( stats.sizes ).map( ( item, i ) => (\n\t\t\t\t\t<tr key={ i }>\n\t\t\t\t\t\t<td>{ item.toUpperCase() }</td>\n\t\t\t\t\t\t<td>{ humanFileSize( stats.sizes[item].bytes ) } ( { stats.sizes[item].percent }% )</td>\n\t\t\t\t\t</tr>)\n\t\t\t\t) }\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t</div>\n\t);\n}\n\n/**\n * Modify the block’s edit component.\n * Receives the original block BlockEdit component and returns a new wrapped component.\n */\nlet smushStatsControl = wp.element.createHigherOrderComponent( function( BlockEdit ) {\n\t/**\n\t * Fetch image data. If image is Smushing, update in 3 seconds.\n\t *\n\t * TODO: this could be optimized not to query so much.\n\t */\n\tfunction fetch( props ) {\n\t\tlet image = new wp.api.models.Media( { id: props.attributes.id } ),\n\t\t\tsmushData = props.attributes.smush;\n\n\t\timage.fetch( { attribute: 'smush' } ).done( function ( img ) {\n\t\t\tif ( 'string' === typeof img.smush ) {\n\t\t\t\tprops.setAttributes( { smush: img.smush } );\n\t\t\t\tsetTimeout( () => fetch( props ), 3000 );\n\t\t\t} else if ( 'undefined' !== typeof img.smush && (\n\t\t\t\t'undefined' === typeof smushData || JSON.stringify( smushData ) !== JSON.stringify( img.smush )\n\t\t\t) ) {\n\t\t\t\tprops.setAttributes( { smush: img.smush } );\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Return block.\n\t */\n\treturn function( props ) {\n\t\t// If not image block or not selected, return unmodified block.\n\t\tif ( 'core/image' !== props.name || ! props.isSelected || 'undefined' === typeof props.attributes.id ) {\n\t\t\treturn el(\n\t\t\t\twp.element.Fragment,\n\t\t\t\t{},\n\t\t\t\tel(\n\t\t\t\t\tBlockEdit,\n\t\t\t\t\tprops\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\tlet smushData = props.attributes.smush;\n\t\tfetch( props );\n\n\t\treturn el(\n\t\t\twp.element.Fragment,\n\t\t\t{},\n\t\t\tel(\n\t\t\t\tBlockEdit,\n\t\t\t\tprops\n\t\t\t),\n\t\t\tel(\n\t\t\t\twp.editor.InspectorControls,\n\t\t\t\t{},\n\t\t\t\tel(\n\t\t\t\t\twp.components.PanelBody,\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle: __( 'Smush Stats' )\n\t\t\t\t\t},\n\t\t\t\t\tsmushStats( smushData )\n\t\t\t\t),\n\t\t\t)\n\t\t);\n\t};\n}, 'withInspectorControls' );\n\nwp.hooks.addFilter( 'editor.BlockEdit', 'wp-smushit/smush-data-control', smushStatsControl );\n"],"sourceRoot":""}
|
|
assets/js/media.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
!function(e){var t={};function n(i){if(t[i])return t[i].exports;var
|
2 |
//# sourceMappingURL=media.min.js.map
|
1 |
+
!function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}({2:function(e,t,n){"use strict";!function(e,t){var n=wp.media,i=t.template("<label class='setting smush-stats' data-setting='description'><span class='name'><%= label %></span><span class='value'><%= value %></span></label>"),r=function(e){return i({label:smush_vars.strings.stats_label,value:e})};if(void 0!==n.view&&void 0!==n.view.Attachment.Details.TwoColumn){var s=n.view.Attachment.Details.TwoColumn;n.view.Attachment.Details.TwoColumn=s.extend({initialize:function(){this.listenTo(this.model,"change:smush",this.render)},render:function(){n.view.Attachment.prototype.render.apply(this,arguments);var e=this.model.get("smush");return void 0===e?this:(this.model.fetch(),this.views.detach(),this.$el.find(".settings").append(r(e)),this.views.render(),this)}})}var a=n.view.Attachment.Details;n.view.Attachment.Details=a.extend({initialize:function(){this.listenTo(this.model,"change:smush",this.render)},render:function(){n.view.Attachment.prototype.render.apply(this,arguments);var e=this.model.get("smush");return void 0===e?this:(this.model.fetch(),this.views.detach(),this.$el.append(r(e)),this)}})}(jQuery,_)}});
|
2 |
//# sourceMappingURL=media.min.js.map
|
assets/js/media.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./_src/js/media.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","$","_","smush_media","wp","media","sharedTemplate","view","Attachment","Details","TwoColumn","smushMediaTwoColumn","extend","initialize","this","listenTo","model","render","apply","arguments","self","api","models","Media","id","fetch","attribute","done","img","_typeof","smush","setTimeout","views","detach","detailsHtml","$el","find","html","template","label","smush_vars","strings","append","smushAttachmentDetails","jQuery"],"mappings":"aACA,IAAAA,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,IACAG,EAAAH,EACAI,GAAA,EACAH,YAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QAKAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,GAA0CK,YAAA,EAAAC,IAAAL,KAK1CZ,EAAAkB,EAAA,SAAAhB,GACA,oBAAAiB,eAAAC,aACAN,OAAAC,eAAAb,EAAAiB,OAAAC,aAAwDC,MAAA,WAExDP,OAAAC,eAAAb,EAAA,cAAiDmB,OAAA,KAQjDrB,EAAAsB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAArB,EAAAqB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,iBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAX,OAAAY,OAAA,MAGA,GAFA1B,EAAAkB,EAAAO,GACAX,OAAAC,eAAAU,EAAA,WAAyCT,YAAA,EAAAK,UACzC,EAAAE,GAAA,iBAAAF,EAAA,QAAAM,KAAAN,EAAArB,EAAA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L,GACpBvB,KAAKE,MAAMS,QACXX,KAAKkB,MAAMf,SAEJH,QAMV,IAAI6B,EAAyBxC,EAAYI,KAAKC,WAAWC,QAKzDN,EAAYI,KAAKC,WAAWC,QAAUkC,EAAuB/B,QAC5DC,WAAY,WACXC,KAAKC,SAAUD,KAAKE,MAAO,eAAgBF,KAAKG,SAGjDA,OAAQ,WAIP,GAFAd,EAAYI,KAAKC,WAAWX,UAAUoB,OAAOC,MAAOJ,KAAMK,gBAEhB,IAA9BL,KAAKE,MAAMlC,IAAK,SAC3B,OAAOgC,KAGR,IACCM,EAAQN,KADG,IAAIV,GAAGiB,IAAIC,OAAOC,OAAQC,GAAIV,KAAKE,MAAMlC,IAAK,QAGpD2C,OAAQC,UAAW,UAAWC,KAAM,SAAWC,GAC1B,WAArBC,EAAOD,EAAIE,QACfC,WAAY,kBAAMX,EAAKJ,MAAMS,SAAS,OAQxCX,KAAKkB,MAAMC,SAEX,IACII,EADWnC,EAAEoC,SAAUhC,EAChBgC,EAKVC,MAAOC,WAAWC,QAAX,YACPvD,MAAO4B,KAAKE,MAAMlC,IAAK,WAKxB,OAFAgC,KAAKqB,IAAIO,OAAQL,GAEVvB,QApHV,CAwHI8B,OAAQ1C","file":"media.min.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n","/**\n * Adds a Smush Now button and displays stats in Media Attachment Details Screen\n */\n(function ( $, _ ) {\n\t'use strict';\n\n\t// Local reference to the WordPress media namespace.\n\tconst smush_media = wp.media,\n\t\tsharedTemplate = \"<label class='setting smush-stats' data-setting='description'><span class='name'><%= label %></span><span class='value'><%= value %></span></label>\";\n\n\tif ( 'undefined' !== typeof smush_media.view &&\n\t\t'undefined' !== typeof smush_media.view.Attachment.Details.TwoColumn ) {\n\t\t// Local instance of the Attachment Details TwoColumn used in the edit attachment modal view\n\t\tlet smushMediaTwoColumn = smush_media.view.Attachment.Details.TwoColumn;\n\n\t\t/**\n\t\t * Add Smush details to attachment.\n\t\t *\n\t\t * A similar view to media.view.Attachment.Details\n\t\t * for use in the Edit Attachment modal.\n\t\t *\n\t\t * @see wp-includes/js/media-grid.js\n\t\t */\n\t\tsmush_media.view.Attachment.Details.TwoColumn = smushMediaTwoColumn.extend( {\n\t\t\tinitialize: function () {\n\t\t\t\tthis.listenTo( this.model, 'change:smush', this.render );\n\t\t\t},\n\n\t\t\trender: function () {\n\t\t\t\t// Ensure that the main attachment fields are rendered.\n\t\t\t\tsmush_media.view.Attachment.prototype.render.apply( this, arguments );\n\n\t\t\t\tif ( typeof this.model.get( 'smush' ) === 'undefined' ) {\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\n\t\t\t\tlet image = new wp.api.models.Media( {id: this.model.get( 'id' )} ),\n\t\t\t\t\tself = this;\n\n\t\t\t\timage.fetch( {attribute: 'smush'} ).done( function ( img ) {\n\t\t\t\t\tif ( typeof img.smush !== 'object' ) {\n\t\t\t\t\t\tsetTimeout( () => self.model.fetch(), 3000 );\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t/**\n\t\t\t\t * Detach the views, append our custom fields, make sure that our data is fully updated\n\t\t\t\t * and re-render the updated view.\n\t\t\t\t */\n\t\t\t\tthis.views.detach();\n\n\t\t\t\tlet detailsHtml = this.$el.find( '.settings' );\n\n\t\t\t\t// Create the template.\n\t\t\t\tlet template = _.template( sharedTemplate );\n\t\t\t\tlet html = template( {\n\t\t\t\t\t/**\n\t\t\t\t\t * @var {array} smush_vars.strings Localization strings.\n\t\t\t\t\t * @var {object} smush_vars Object from wp_localize_script()\n\t\t\t\t\t */\n\t\t\t\t\tlabel: smush_vars.strings['stats_label'],\n\t\t\t\t\tvalue: this.model.get( 'smush' )\n\t\t\t\t} );\n\n\t\t\t\tdetailsHtml.append( html );\n\t\t\t\tthis.model.fetch();\n\t\t\t\tthis.views.render();\n\n\t\t\t\treturn this;\n\t\t\t}\n\t\t} );\n\t}\n\n\t// Local instance of the Attachment Details TwoColumn used in the edit attachment modal view\n\tlet smushAttachmentDetails = smush_media.view.Attachment.Details;\n\n\t/**\n\t * Add Smush details to attachment.\n\t */\n\tsmush_media.view.Attachment.Details = smushAttachmentDetails.extend( {\n\t\tinitialize: function () {\n\t\t\tthis.listenTo( this.model, 'change:smush', this.render );\n\t\t},\n\n\t\trender: function () {\n\t\t\t// Ensure that the main attachment fields are rendered.\n\t\t\tsmush_media.view.Attachment.prototype.render.apply( this, arguments );\n\n\t\t\tif ( typeof this.model.get( 'smush' ) === 'undefined' ) {\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tlet image = new wp.api.models.Media( {id: this.model.get( 'id' )} ),\n\t\t\t\tself = this;\n\n\t\t\timage.fetch( {attribute: 'smush'} ).done( function ( img ) {\n\t\t\t\tif ( typeof img.smush !== 'object' ) {\n\t\t\t\t\tsetTimeout( () => self.model.fetch(), 3000 );\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t/**\n\t\t\t * Detach the views, append our custom fields, make sure that our data is fully updated\n\t\t\t * and re-render the updated view.\n\t\t\t */\n\t\t\tthis.views.detach();\n\n\t\t\tlet template = _.template( sharedTemplate );\n\t\t\tlet html = template( {\n\t\t\t\t/**\n\t\t\t\t * @var {object} smush_vars Object from wp_localize_script()\n\t\t\t\t * @var {array} smush_vars.strings Localization strings.\n\t\t\t\t */\n\t\t\t\tlabel: smush_vars.strings['stats_label'],\n\t\t\t\tvalue: this.model.get( 'smush' )\n\t\t\t} );\n\n\t\t\tthis.$el.append( html );\n\n\t\t\treturn this;\n\t\t}\n\t} );\n\n})( jQuery, _ );\n"],"sourceRoot":""}
|
1 |
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./_src/js/media.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","$","_","smush_media","wp","media","template","prepareTemplate","smushHTML","label","smush_vars","strings","view","Attachment","Details","TwoColumn","smushMediaTwoColumn","extend","initialize","this","listenTo","model","render","apply","arguments","fetch","views","detach","$el","find","append","smushAttachmentDetails","jQuery"],"mappings":"aACA,IAAAA,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,IACAG,EAAAH,EACAI,GAAA,EACAH,YAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QAKAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,GAA0CK,YAAA,EAAAC,IAAAL,KAK1CZ,EAAAkB,EAAA,SAAAhB,GACA,oBAAAiB,eAAAC,aACAN,OAAAC,eAAAb,EAAAiB,OAAAC,aAAwDC,MAAA,WAExDP,OAAAC,eAAAb,EAAA,cAAiDmB,OAAA,KAQjDrB,EAAAsB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAArB,EAAAqB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,iBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAX,OAAAY,OAAA,MAGA,GAFA1B,EAAAkB,EAAAO,GACAX,OAAAC,eAAAU,EAAA,WAAy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,WAAY,WACXC,KAAKC,SAAUD,KAAKE,MAAO,eAAgBF,KAAKG,SAGjDA,OAAQ,WAEPnB,EAAYS,KAAKC,WAAWhB,UAAUyB,OAAOC,MAAOJ,KAAMK,WAE1D,IAAMhB,EAAYW,KAAKE,MAAMvC,IAAK,SAClC,YAA0B,IAAd0B,EACJW,MAGRA,KAAKE,MAAMI,QAMXN,KAAKO,MAAMC,SACXR,KAAKS,IAAIE,OAAQvB,EAAiBC,IAE3BW,SAhGV,CAoGIa,OAAQ9B","file":"media.min.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 2);\n","/**\n * Adds a Smush Now button and displays stats in Media Attachment Details Screen\n */\n(function ( $, _ ) {\n\t'use strict';\n\n\t// Local reference to the WordPress media namespace.\n\tconst smush_media = wp.media,\n\t\tsharedTemplate = \"<label class='setting smush-stats' data-setting='description'><span class='name'><%= label %></span><span class='value'><%= value %></span></label>\",\n\t\ttemplate = _.template( sharedTemplate );\n\n\t/**\n\t * Create the template.\n\t *\n\t * @param {string} smushHTML\n\t * @returns {Object}\n\t */\n\tconst prepareTemplate = function ( smushHTML ) {\n\t\t/**\n\t\t * @var {array} smush_vars.strings Localization strings.\n\t\t * @var {object} smush_vars Object from wp_localize_script()\n\t\t */\n\t\treturn template( {\n\t\t\tlabel: smush_vars.strings['stats_label'],\n\t\t\tvalue: smushHTML\n\t\t} );\n\t};\n\n\tif ( 'undefined' !== typeof smush_media.view &&\n\t\t'undefined' !== typeof smush_media.view.Attachment.Details.TwoColumn ) {\n\t\t// Local instance of the Attachment Details TwoColumn used in the edit attachment modal view\n\t\tlet smushMediaTwoColumn = smush_media.view.Attachment.Details.TwoColumn;\n\n\t\t/**\n\t\t * Add Smush details to attachment.\n\t\t *\n\t\t * A similar view to media.view.Attachment.Details\n\t\t * for use in the Edit Attachment modal.\n\t\t *\n\t\t * @see wp-includes/js/media-grid.js\n\t\t */\n\t\tsmush_media.view.Attachment.Details.TwoColumn = smushMediaTwoColumn.extend( {\n\t\t\tinitialize: function () {\n\t\t\t\tthis.listenTo( this.model, 'change:smush', this.render );\n\t\t\t},\n\n\t\t\trender: function () {\n\t\t\t\t// Ensure that the main attachment fields are rendered.\n\t\t\t\tsmush_media.view.Attachment.prototype.render.apply( this, arguments );\n\n\t\t\t\tconst smushHTML = this.model.get( 'smush' );\n\t\t\t\tif ( typeof smushHTML === 'undefined' ) {\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\n\t\t\t\tthis.model.fetch();\n\n\t\t\t\t/**\n\t\t\t\t * Detach the views, append our custom fields, make sure that our data is fully updated\n\t\t\t\t * and re-render the updated view.\n\t\t\t\t */\n\t\t\t\tthis.views.detach();\n\t\t\t\tthis.$el.find( '.settings' ).append( prepareTemplate( smushHTML ) );\n\t\t\t\tthis.views.render();\n\n\t\t\t\treturn this;\n\t\t\t}\n\t\t} );\n\t}\n\n\t// Local instance of the Attachment Details TwoColumn used in the edit attachment modal view\n\tlet smushAttachmentDetails = smush_media.view.Attachment.Details;\n\n\t/**\n\t * Add Smush details to attachment.\n\t */\n\tsmush_media.view.Attachment.Details = smushAttachmentDetails.extend( {\n\t\tinitialize: function () {\n\t\t\tthis.listenTo( this.model, 'change:smush', this.render );\n\t\t},\n\n\t\trender: function () {\n\t\t\t// Ensure that the main attachment fields are rendered.\n\t\t\tsmush_media.view.Attachment.prototype.render.apply( this, arguments );\n\n\t\t\tconst smushHTML = this.model.get( 'smush' );\n\t\t\tif ( typeof smushHTML === 'undefined' ) {\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tthis.model.fetch();\n\n\t\t\t/**\n\t\t\t * Detach the views, append our custom fields, make sure that our data is fully updated\n\t\t\t * and re-render the updated view.\n\t\t\t */\n\t\t\tthis.views.detach();\n\t\t\tthis.$el.append( prepareTemplate( smushHTML ) );\n\n\t\t\treturn this;\n\t\t}\n\t} );\n\n})( jQuery, _ );"],"sourceRoot":""}
|
languages/wp-smushit.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the GPLv2.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Smush 2.8.0\n"
|
6 |
"Report-Msgid-Bugs-To: https://wpmudev.org\n"
|
7 |
-
"POT-Creation-Date: 2018-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
2 |
# This file is distributed under the GPLv2.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Smush 2.8.0.1\n"
|
6 |
"Report-Msgid-Bugs-To: https://wpmudev.org\n"
|
7 |
+
"POT-Creation-Date: 2018-08-03 12:12:05+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
readme.txt
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
=== Smush Image Compression and Optimization ===
|
2 |
Plugin Name: Smush Image Compression and Optimization
|
3 |
-
Version: 2.
|
4 |
Author: WPMU DEV
|
5 |
Author URI: https://premium.wpmudev.org/
|
6 |
Contributors: WPMUDEV, alexdunae
|
7 |
Tags: image, resize, optimize, optimise, compress, performance, optimisation, optimise JPG, photo, pictures, optimizer, Smush WordPress Compression, Smush.it
|
8 |
Requires at least: 4.6
|
9 |
-
Tested up to: 4.9.
|
10 |
-
Stable tag: 2.8.0
|
11 |
Requires PHP: 5.2.4
|
12 |
License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
13 |
|
@@ -164,6 +164,10 @@ Yahoo's Smush.it API is gone forever. So WPMU DEV built our own free API that is
|
|
164 |
|
165 |
== Changelog ==
|
166 |
|
|
|
|
|
|
|
|
|
167 |
= 2.8.0 =
|
168 |
|
169 |
* New: High-power API cluster for Smush Pro users
|
1 |
=== Smush Image Compression and Optimization ===
|
2 |
Plugin Name: Smush Image Compression and Optimization
|
3 |
+
Version: 2.8.0.1
|
4 |
Author: WPMU DEV
|
5 |
Author URI: https://premium.wpmudev.org/
|
6 |
Contributors: WPMUDEV, alexdunae
|
7 |
Tags: image, resize, optimize, optimise, compress, performance, optimisation, optimise JPG, photo, pictures, optimizer, Smush WordPress Compression, Smush.it
|
8 |
Requires at least: 4.6
|
9 |
+
Tested up to: 4.9.8
|
10 |
+
Stable tag: 2.8.0.1
|
11 |
Requires PHP: 5.2.4
|
12 |
License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
13 |
|
164 |
|
165 |
== Changelog ==
|
166 |
|
167 |
+
= 2.8.0.1 =
|
168 |
+
|
169 |
+
* Fixed: Smush causing media uploads to not function properly (in rare conditions)
|
170 |
+
|
171 |
= 2.8.0 =
|
172 |
|
173 |
* New: High-power API cluster for Smush Pro users
|
wp-smush.php
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
* Plugin Name: Smush
|
14 |
* Plugin URI: http://wordpress.org/extend/plugins/wp-smushit/
|
15 |
* Description: Reduce image file sizes, improve performance and boost your SEO using the free free <a href="https://premium.wpmudev.org/">WPMU DEV</a> WordPress Smush API.
|
16 |
-
* Version: 2.8.0
|
17 |
* Author: WPMU DEV
|
18 |
* Author URI: https://premium.wpmudev.org/
|
19 |
* License: GPLv2
|
@@ -47,7 +47,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
47 |
}
|
48 |
|
49 |
if ( ! defined( 'WP_SMUSH_VERSION' ) ) {
|
50 |
-
define( 'WP_SMUSH_VERSION', '2.8.0' );
|
51 |
}
|
52 |
// Used to define body class.
|
53 |
if ( ! defined( 'WP_SHARED_UI_VERSION' ) ) {
|
13 |
* Plugin Name: Smush
|
14 |
* Plugin URI: http://wordpress.org/extend/plugins/wp-smushit/
|
15 |
* Description: Reduce image file sizes, improve performance and boost your SEO using the free free <a href="https://premium.wpmudev.org/">WPMU DEV</a> WordPress Smush API.
|
16 |
+
* Version: 2.8.0.1
|
17 |
* Author: WPMU DEV
|
18 |
* Author URI: https://premium.wpmudev.org/
|
19 |
* License: GPLv2
|
47 |
}
|
48 |
|
49 |
if ( ! defined( 'WP_SMUSH_VERSION' ) ) {
|
50 |
+
define( 'WP_SMUSH_VERSION', '2.8.0.1' );
|
51 |
}
|
52 |
// Used to define body class.
|
53 |
if ( ! defined( 'WP_SHARED_UI_VERSION' ) ) {
|