Smush Image Compression and Optimization - Version 3.0.2

Version Description

  • Enhance: Support for WordPress 5.0 release and Gutenberg editor
  • Fix: [WP Offload Media] integration with Pro version
  • Fix: PHP warning on update from Smush version 2 to version 3
Download this release

Release Info

Developer jdailey
Plugin Icon 128x128 Smush Image Compression and Optimization
Version 3.0.2
Comparing to
See all releases

Code changes from version 3.0.1 to 3.0.2

_src/js/blocks.js CHANGED
@@ -1,9 +1,11 @@
1
  /**
2
  * BLOCK: extend image block
3
  */
4
-
5
  const { __ } = wp.i18n,
6
- el = wp.element.createElement;
 
 
 
7
 
8
  /**
9
  * Transform bytes to human readable format.
@@ -13,7 +15,7 @@ const { __ } = wp.i18n,
13
  */
14
  function humanFileSize( bytes ) {
15
  const thresh = 1024,
16
- units = ['kB','MB','GB','TB','PB','EB','ZB','YB'];
17
 
18
  if ( Math.abs( bytes ) < thresh ) {
19
  return bytes + ' B';
@@ -31,22 +33,15 @@ function humanFileSize( bytes ) {
31
  /**
32
  * Generate Smush stats table.
33
  *
 
34
  * @param {object} stats
35
  * @returns {*}
36
  */
37
- export function smushStats( stats ) {
38
  if ( 'undefined' === typeof stats ) {
39
- return (
40
- <div>
41
- Select an image to view Smush stats.
42
- </div>
43
- );
44
  } else if ( 'string' === typeof stats ) {
45
- return (
46
- <div>
47
- { stats }
48
- </div>
49
- );
50
  }
51
 
52
  return (
@@ -54,8 +49,8 @@ export function smushStats( stats ) {
54
  <table className="wp-smush-stats-holder">
55
  <thead>
56
  <tr>
57
- <th className="smush-stats-header">Image size</th>
58
- <th className="smush-stats-header">Savings</th>
59
  </tr>
60
  </thead>
61
  <tbody>
@@ -72,70 +67,55 @@ export function smushStats( stats ) {
72
  }
73
 
74
  /**
75
- * Modify the block’s edit component.
76
- * Receives the original block BlockEdit component and returns a new wrapped component.
 
77
  */
78
- let smushStatsControl = wp.compose.createHigherOrderComponent( function( BlockEdit ) {
79
- /**
80
- * Fetch image data. If image is Smushing, update in 3 seconds.
81
- *
82
- * @todo this could be optimized not to query so much.
83
- */
84
- function fetch( props ) {
85
- let image = new wp.api.models.Media( { id: props.attributes.id } ),
86
- smushData = props.attributes.smush;
87
 
88
- image.fetch( { attribute: 'smush' } ).done( function ( img ) {
89
- if ( 'string' === typeof img.smush ) {
90
- props.setAttributes( { smush: img.smush } );
91
- setTimeout( () => fetch( props ), 3000 );
92
- } else if ( 'undefined' !== typeof img.smush && (
93
- 'undefined' === typeof smushData || JSON.stringify( smushData ) !== JSON.stringify( img.smush )
94
- ) ) {
95
- props.setAttributes( { smush: img.smush } );
96
- }
97
- });
98
- }
99
 
100
- /**
101
- * Return block.
102
- */
103
- return function( props ) {
 
 
104
  // If not image block or not selected, return unmodified block.
105
  if ( 'core/image' !== props.name || ! props.isSelected || 'undefined' === typeof props.attributes.id ) {
106
- return el(
107
- wp.element.Fragment,
108
- {},
109
- el(
110
- BlockEdit,
111
- props
112
- )
113
  );
114
  }
115
 
116
  let smushData = props.attributes.smush;
117
- fetch( props );
118
 
119
- return el(
120
- wp.element.Fragment,
121
- {},
122
- el(
123
- BlockEdit,
124
- props
125
- ),
126
- el(
127
- wp.editor.InspectorControls,
128
- {},
129
- el(
130
- wp.components.PanelBody,
131
- {
132
- title: __( 'Smush Stats' )
133
- },
134
- smushStats( smushData )
135
- ),
136
- )
137
  );
138
  };
139
- }, 'withInspectorControls' );
140
 
141
- wp.hooks.addFilter( 'editor.BlockEdit', 'wp-smushit/smush-data-control', smushStatsControl );
1
  /**
2
  * BLOCK: extend image block
3
  */
 
4
  const { __ } = wp.i18n,
5
+ { createHigherOrderComponent } = wp.compose,
6
+ { Fragment } = wp.element,
7
+ { InspectorControls } = wp.editor,
8
+ { PanelBody } = wp.components;
9
 
10
  /**
11
  * Transform bytes to human readable format.
15
  */
16
  function humanFileSize( bytes ) {
17
  const thresh = 1024,
18
+ units = ['kB','MB','GB','TB'];
19
 
20
  if ( Math.abs( bytes ) < thresh ) {
21
  return bytes + ' B';
33
  /**
34
  * Generate Smush stats table.
35
  *
36
+ * @param {int} id
37
  * @param {object} stats
38
  * @returns {*}
39
  */
40
+ export function smushStats( id, stats ) {
41
  if ( 'undefined' === typeof stats ) {
42
+ return smush_vars.strings.gb.select_image;
 
 
 
 
43
  } else if ( 'string' === typeof stats ) {
44
+ return stats;
 
 
 
 
45
  }
46
 
47
  return (
49
  <table className="wp-smush-stats-holder">
50
  <thead>
51
  <tr>
52
+ <th className="smush-stats-header">{ smush_vars.strings.gb.size }</th>
53
+ <th className="smush-stats-header">{ smush_vars.strings.gb.savings }</th>
54
  </tr>
55
  </thead>
56
  <tbody>
67
  }
68
 
69
  /**
70
+ * Fetch image data. If image is Smushing, update in 3 seconds.
71
+ *
72
+ * @todo this could be optimized not to query so much.
73
  */
74
+ export function fetchProps( props ) {
75
+ let image = new wp.api.models.Media( { id: props.attributes.id } ),
76
+ smushData = props.attributes.smush;
 
 
 
 
 
 
77
 
78
+ image.fetch( { attribute: 'smush' } ).done( function ( img ) {
79
+ if ( 'string' === typeof img.smush ) {
80
+ props.setAttributes( { smush: img.smush } );
81
+ setTimeout( () => fetch( props ), 3000 );
82
+ } else if ( 'undefined' !== typeof img.smush && (
83
+ 'undefined' === typeof smushData || JSON.stringify( smushData ) !== JSON.stringify( img.smush )
84
+ ) ) {
85
+ props.setAttributes( { smush: img.smush } );
86
+ }
87
+ });
88
+ }
89
 
90
+ /**
91
+ * Modify the blocks edit component.
92
+ * Receives the original block BlockEdit component and returns a new wrapped component.
93
+ */
94
+ const smushStatsControl = createHigherOrderComponent( ( BlockEdit ) => {
95
+ return ( props ) => {
96
  // If not image block or not selected, return unmodified block.
97
  if ( 'core/image' !== props.name || ! props.isSelected || 'undefined' === typeof props.attributes.id ) {
98
+ return (
99
+ <Fragment>
100
+ <BlockEdit { ...props } />
101
+ </Fragment>
 
 
 
102
  );
103
  }
104
 
105
  let smushData = props.attributes.smush;
106
+ fetchProps(props);
107
 
108
+ return (
109
+ <Fragment>
110
+ <BlockEdit { ...props } />
111
+ <InspectorControls>
112
+ <PanelBody title={ smush_vars.strings.gb.stats }>
113
+ { smushStats( props.attributes.id, smushData ) }
114
+ </PanelBody>
115
+ </InspectorControls>
116
+ </Fragment>
 
 
 
 
 
 
 
 
 
117
  );
118
  };
119
+ }, "withInspectorControl" );
120
 
121
+ wp.hooks.addFilter( 'editor.BlockEdit', 'wp-smush/smush-data-control', smushStatsControl );
app/assets/js/blocks.min.js CHANGED
@@ -1,2 +1,2 @@
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=20)}({20:function(e,t,n){"use strict";n.r(t),n.d(t,"smushStats",function(){return 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.compose.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
1
+ !function(e){var t={};function r(s){if(t[s])return t[s].exports;var n=t[s]={i:s,l:!1,exports:{}};return e[s].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,s){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(r.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(s,n,function(t){return e[t]}.bind(null,n));return s},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=20)}({20:function(e,t,r){"use strict";r.r(t),r.d(t,"smushStats",function(){return i}),r.d(t,"fetchProps",function(){return o});wp.i18n.__;var s=wp.compose.createHigherOrderComponent,n=wp.element.Fragment,a=wp.editor.InspectorControls,u=wp.components.PanelBody;function i(e,t){return void 0===t?smush_vars.strings.gb.select_image:"string"==typeof t?t: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"},smush_vars.strings.gb.size),React.createElement("th",{className:"smush-stats-header"},smush_vars.strings.gb.savings))),React.createElement("tbody",null,Object.keys(t.sizes).map(function(e,r){return React.createElement("tr",{key:r},React.createElement("td",null,e.toUpperCase()),React.createElement("td",null,function(e){var t=["kB","MB","GB","TB"];if(Math.abs(e)<1024)return e+" B";var r=-1;do{e/=1024,++r}while(Math.abs(e)>=1024&&r<t.length-1);return e.toFixed(1)+" "+t[r]}(t.sizes[e].bytes)," ( ",t.sizes[e].percent,"% )"))}))))}function o(e){var t=new wp.api.models.Media({id:e.attributes.id}),r=e.attributes.smush;t.fetch({attribute:"smush"}).done(function(t){"string"==typeof t.smush?(e.setAttributes({smush:t.smush}),setTimeout(function(){return fetch(e)},3e3)):void 0===t.smush||void 0!==r&&JSON.stringify(r)===JSON.stringify(t.smush)||e.setAttributes({smush:t.smush})})}var c=s(function(e){return function(t){if("core/image"!==t.name||!t.isSelected||void 0===t.attributes.id)return React.createElement(n,null,React.createElement(e,t));var r=t.attributes.smush;return o(t),React.createElement(n,null,React.createElement(e,t),React.createElement(a,null,React.createElement(u,{title:smush_vars.strings.gb.stats},i(t.attributes.id,r))))}},"withInspectorControl");wp.hooks.addFilter("editor.BlockEdit","wp-smush/smush-data-control",c)}});
2
  //# sourceMappingURL=blocks.min.js.map
app/assets/js/blocks.min.js.map CHANGED
@@ -1 +1 @@
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","__webpack_exports__","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","compose","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,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,WAA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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 = 20);\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.compose.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":""}
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","__webpack_exports__","smushStats","fetchProps","wp","i18n","__","createHigherOrderComponent","compose","Fragment","element","InspectorControls","editor","PanelBody","components","id","stats","smush_vars","strings","gb","select_image","React","createElement","className","style","display","size","savings","keys","sizes","map","item","toUpperCase","bytes","units","Math","abs","u","length","toFixed","humanFileSize","percent","props","image","api","models","Media","attributes","smushData","smush","fetch","attribute","done","img","setAttributes","setTimeout","JSON","stringify","smushStatsControl","BlockEdit","isSelected","title","hooks","addFilter"],"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,SAAA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EAAIJ,QAExFP,EAAMY,eAAiBL,MAAOI,EAAIJ,UASrC,IAAMS,EAAoBnD,EAA4B,SAAEoD,GACvD,OAAO,SAAEjB,GAER,GAAK,eAAiBA,EAAMlE,OAAUkE,EAAMkB,iBAAc,IAAuBlB,EAAMK,WAAWhC,GACjG,OACCM,MAAAC,cAACb,EAAD,KACCY,MAAAC,cAACqC,EAAejB,IAKnB,IAAIM,EAAYN,EAAMK,WAAWE,MAGjC,OAFA9C,EAAWuC,GAGVrB,MAAAC,cAACb,EAAD,KACCY,MAAAC,cAACqC,EAAejB,GAChBrB,MAAAC,cAACX,EAAD,KACCU,MAAAC,cAACT,GAAUgD,MAAQ5C,WAAWC,QAAQC,GAAGH,OACtCd,EAAYwC,EAAMK,WAAWhC,GAAIiC,QAMtC,wBAEH5C,GAAG0D,MAAMC,UAAW,mBAAoB,8BAA+BL","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 = 20);\n","/**\n * BLOCK: extend image block\n */\nconst { __ } = wp.i18n,\n\t{ createHigherOrderComponent } = wp.compose,\n\t{ Fragment } = wp.element,\n\t{ InspectorControls } = wp.editor,\n\t{ PanelBody } = wp.components;\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'];\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 {int} id\n * @param {object} stats\n * @returns {*}\n */\nexport function smushStats( id, stats ) {\n\tif ( 'undefined' === typeof stats ) {\n\t\treturn smush_vars.strings.gb.select_image;\n\t} else if ( 'string' === typeof stats ) {\n\t\treturn stats;\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\">{ smush_vars.strings.gb.size }</th>\n\t\t\t\t\t<th className=\"smush-stats-header\">{ smush_vars.strings.gb.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 * Fetch image data. If image is Smushing, update in 3 seconds.\n *\n * @todo this could be optimized not to query so much.\n */\nexport function fetchProps( props ) {\n\tlet image = new wp.api.models.Media( { id: props.attributes.id } ),\n\t\tsmushData = props.attributes.smush;\n\n\timage.fetch( { attribute: 'smush' } ).done( function ( img ) {\n\t\tif ( 'string' === typeof img.smush ) {\n\t\t\tprops.setAttributes( { smush: img.smush } );\n\t\t\tsetTimeout( () => fetch( props ), 3000 );\n\t\t} else if ( 'undefined' !== typeof img.smush && (\n\t\t\t'undefined' === typeof smushData || JSON.stringify( smushData ) !== JSON.stringify( img.smush )\n\t\t) ) {\n\t\t\tprops.setAttributes( { smush: img.smush } );\n\t\t}\n\t});\n}\n\n/**\n * Modify the blocks edit component.\n * Receives the original block BlockEdit component and returns a new wrapped component.\n */\nconst smushStatsControl = createHigherOrderComponent( ( BlockEdit ) => {\n\treturn ( 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 (\n\t\t\t\t<Fragment>\n\t\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t</Fragment>\n\t\t\t);\n\t\t}\n\n\t\tlet smushData = props.attributes.smush;\n\t\tfetchProps(props);\n\n\t\treturn (\n\t\t\t<Fragment>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<PanelBody title={ smush_vars.strings.gb.stats }>\n\t\t\t\t\t\t{ smushStats( props.attributes.id, smushData ) }\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</InspectorControls>\n\t\t\t</Fragment>\n\t\t);\n\t};\n}, \"withInspectorControl\" );\n\nwp.hooks.addFilter( 'editor.BlockEdit', 'wp-smush/smush-data-control', smushStatsControl );"],"sourceRoot":""}
app/views/meta-boxes/cdn/disabled-meta-box.php CHANGED
@@ -16,10 +16,9 @@
16
  <p>
17
  <?php
18
  esc_html_e(
19
- 'Automatically compress and resize your images, then on WPMU DEVs blazing-fast CDN with
20
- multi-pass lossy compression. This is the ultimate tool for boosting your pagespeed by taking the load off
21
- your server. All you need to do is activate the feature and we’ll serve your images from the CDN - no
22
- coding required.',
23
  'wp-smushit'
24
  );
25
  ?>
16
  <p>
17
  <?php
18
  esc_html_e(
19
+ "Automatically compress and resize your images with bulk Smush, or upload them to the WPMU DEV's
20
+ blazing-fast CDN with multi-pass lossy compression and auto resize features. All you need to do is activate
21
+ the feature and we’ll serve your images from the CDN - no coding required.",
 
22
  'wp-smushit'
23
  );
24
  ?>
app/views/meta-boxes/cdn/upsell-meta-box.php CHANGED
@@ -18,9 +18,9 @@
18
  <p>
19
  <?php
20
  esc_html_e(
21
- 'Automatically compress and resize your images, then on WPMU DEVs blazing-fast CDN with multi-pass
22
- lossy compression. This is the ultimate tool for boosting your pagespeed by taking the load off your server. Try it
23
- today with a WPMU DEV Membership!',
24
  'wp-smushit'
25
  );
26
  ?>
18
  <p>
19
  <?php
20
  esc_html_e(
21
+ "Automatically compress and resize your images with bulk Smush, or upload them to the WPMU DEV's
22
+ blazing-fast CDN with multi-pass lossy compression and auto resize features.. This is the ultimate tool for
23
+ boosting your pagespeed by taking the load off your server. Try it today with a WPMU DEV Membership!",
24
  'wp-smushit'
25
  );
26
  ?>
core/class-wp-smush-admin.php CHANGED
@@ -158,6 +158,8 @@ class WP_Smush_Admin {
158
 
159
  /**
160
  * Load media assets.
 
 
161
  */
162
  private function extend_media_modal() {
163
  if ( wp_script_is( 'smush-backbone-extension', 'enqueued' ) ) {
@@ -187,6 +189,12 @@ class WP_Smush_Admin {
187
  'stats_label' => esc_html__( 'Smush', 'wp-smushit' ),
188
  'filter_all' => esc_html__( 'Smush: All images', 'wp-smushit' ),
189
  'filter_excl' => esc_html__( 'Smush: Bulk ignored', 'wp-smushit' ),
 
 
 
 
 
 
190
  ),
191
  'nonce' => array(
192
  'get_smush_status' => wp_create_nonce( 'get-smush-status' ),
158
 
159
  /**
160
  * Load media assets.
161
+ *
162
+ * Localization also used in Gutenberg integration.
163
  */
164
  private function extend_media_modal() {
165
  if ( wp_script_is( 'smush-backbone-extension', 'enqueued' ) ) {
189
  'stats_label' => esc_html__( 'Smush', 'wp-smushit' ),
190
  'filter_all' => esc_html__( 'Smush: All images', 'wp-smushit' ),
191
  'filter_excl' => esc_html__( 'Smush: Bulk ignored', 'wp-smushit' ),
192
+ 'gb' => array(
193
+ 'stats' => esc_html__( 'Smush Stats', 'wp-smushit' ),
194
+ 'select_image' => esc_html__( 'Select an image to view Smush stats.', 'wp-smushit' ),
195
+ 'size' => esc_html__( 'Image size', 'wp-smushit' ),
196
+ 'savings' => esc_html__( 'Savings', 'wp-smushit' ),
197
+ ),
198
  ),
199
  'nonce' => array(
200
  'get_smush_status' => wp_create_nonce( 'get-smush-status' ),
core/class-wp-smush-installer.php CHANGED
@@ -189,8 +189,15 @@ class WP_Smush_Installer {
189
  $offset += $limit;
190
  }
191
  } else {
 
192
  $settings = get_site_option( WP_SMUSH_PREFIX . 'last_settings', array() );
193
- $settings = array_merge( WP_Smush_Settings::get_instance()->get(), $settings );
 
 
 
 
 
 
194
  update_site_option( WP_SMUSH_PREFIX . 'settings', $settings );
195
  // Remove previous data.
196
  delete_site_option( WP_SMUSH_PREFIX . 'last_settings' );
189
  $offset += $limit;
190
  }
191
  } else {
192
+ // last_settings will be an array if user had any custom settings.
193
  $settings = get_site_option( WP_SMUSH_PREFIX . 'last_settings', array() );
194
+ if ( is_array( $settings ) ) {
195
+ $settings = array_merge( WP_Smush_Settings::get_instance()->get(), $settings );
196
+ } else {
197
+ // last_settings will be a string if the Smush page hasn't been visited => get the new defaults.
198
+ $settings = WP_Smush_Settings::get_instance()->get();
199
+ }
200
+
201
  update_site_option( WP_SMUSH_PREFIX . 'settings', $settings );
202
  // Remove previous data.
203
  delete_site_option( WP_SMUSH_PREFIX . 'last_settings' );
core/integrations/class-wp-smush-gutenberg.php CHANGED
@@ -28,11 +28,7 @@ class WP_Smush_Gutenberg extends WP_Smush_Integration {
28
  $this->class = 'free';
29
  $this->priority = 3;
30
 
31
- if ( ! function_exists( 'is_plugin_active' ) ) {
32
- include_once ABSPATH . 'wp-admin/includes/plugin.php';
33
- }
34
-
35
- $this->enabled = is_plugin_active( 'gutenberg/gutenberg.php' );
36
 
37
  parent::__construct();
38
 
@@ -100,9 +96,9 @@ class WP_Smush_Gutenberg extends WP_Smush_Integration {
100
  }
101
 
102
  ?>
103
- <div class="sui-notice smush-notice-sm">
104
- <p><?php esc_html_e( 'To use this feature you need to install and activate the Gutenberg plugin.', 'wp-smushit' ); ?></p>
105
- </div>
106
  <?php
107
  }
108
 
@@ -132,4 +128,34 @@ class WP_Smush_Gutenberg extends WP_Smush_Integration {
132
  );
133
  }
134
 
135
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  $this->class = 'free';
29
  $this->priority = 3;
30
 
31
+ $this->check_for_gutenberg();
 
 
 
 
32
 
33
  parent::__construct();
34
 
96
  }
97
 
98
  ?>
99
+ <div class="sui-notice smush-notice-sm">
100
+ <p><?php esc_html_e( 'To use this feature you need to install and activate the Gutenberg plugin.', 'wp-smushit' ); ?></p>
101
+ </div>
102
  <?php
103
  }
104
 
128
  );
129
  }
130
 
131
+ /**************************************
132
+ *
133
+ * PRIVATE CLASSES
134
+ */
135
+
136
+ /**
137
+ * Make sure we only enqueue when Gutenberg is active.
138
+ *
139
+ * For WordPress pre 5.0 - only when Gutenberg plugin is installed.
140
+ * For WordPress 5.0+ - only when Classic Editor is NOT installed.
141
+ *
142
+ * @since 3.0.1
143
+ */
144
+ private function check_for_gutenberg() {
145
+ global $wp_version;
146
+
147
+ if ( ! function_exists( 'is_plugin_active' ) ) {
148
+ include_once ABSPATH . 'wp-admin/includes/plugin.php';
149
+ }
150
+
151
+ // Check if WordPress 5.0 or higher.
152
+ $is_wp5point0 = version_compare( $wp_version, '4.9.9', '>' );
153
+
154
+ if ( $is_wp5point0 ) {
155
+ $this->enabled = ! is_plugin_active( 'classic-editor/classic-editor.php' );
156
+ } else {
157
+ $this->enabled = is_plugin_active( 'gutenberg/gutenberg.php' );
158
+ }
159
+ }
160
+
161
+ }
core/integrations/class-wp-smush-s3.php CHANGED
@@ -23,7 +23,7 @@ class WP_Smush_S3 extends WP_Smush_Integration {
23
  $this->module = 's3';
24
  $this->class = 'pro';
25
  $this->priority = 5;
26
- $this->enabled = function_exists( 'as3cf_init' );
27
 
28
  parent::__construct();
29
 
23
  $this->module = 's3';
24
  $this->class = 'pro';
25
  $this->priority = 5;
26
+ $this->enabled = function_exists( 'as3cf_init' ) || function_exists( 'as3cf_pro_init' );
27
 
28
  parent::__construct();
29
 
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 3.0.1\n"
6
  "Report-Msgid-Bugs-To: https://wpmudev.org\n"
7
- "POT-Creation-Date: 2018-12-10 14:24:10+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -124,7 +124,7 @@ msgstr ""
124
 
125
  #: app/class-wp-smush-dashboard.php:89 app/class-wp-smush-dashboard.php:144
126
  #: app/class-wp-smush-dashboard.php:213 app/class-wp-smush-dashboard.php:275
127
- #: core/class-wp-smush-admin.php:211
128
  msgid "Settings"
129
  msgstr ""
130
 
@@ -449,7 +449,7 @@ msgstr ""
449
 
450
  #: app/views/meta-boxes/bulk/meta-box.php:147
451
  #: app/views/meta-boxes/directory/meta-box.php:46
452
- #: core/class-wp-smush-admin.php:242
453
  msgid "Smush Pro"
454
  msgstr ""
455
 
@@ -509,16 +509,15 @@ msgstr ""
509
 
510
  #: app/views/meta-boxes/cdn/disabled-meta-box.php:18
511
  msgid ""
512
- "Automatically compress and resize your images, then on WPMU DEV’s "
513
- "blazing-fast CDN with\n"
514
- "\t\tmulti-pass lossy compression. This is the ultimate tool for boosting "
515
- "your pagespeed by taking the load off\n"
516
- "\t\tyour server. All you need to do is activate the feature and we’ll serve "
517
- "your images from the CDN - no\n"
518
- "\t\tcoding required."
519
  msgstr ""
520
 
521
- #: app/views/meta-boxes/cdn/disabled-meta-box.php:29
522
  msgid "GET STARTED"
523
  msgstr ""
524
 
@@ -636,11 +635,12 @@ msgstr ""
636
 
637
  #: app/views/meta-boxes/cdn/upsell-meta-box.php:20
638
  msgid ""
639
- "Automatically compress and resize your images, then on WPMU DEV’s "
640
- "blazing-fast CDN with multi-pass\n"
641
- "\tlossy compression. This is the ultimate tool for boosting your pagespeed "
642
- "by taking the load off your server. Try it\n"
643
- "\ttoday with a WPMU DEV Membership!"
 
644
  msgstr ""
645
 
646
  #: app/views/meta-boxes/cdn/upsell-meta-box.php:30
@@ -1059,19 +1059,39 @@ msgstr ""
1059
  msgid "Smush"
1060
  msgstr ""
1061
 
1062
- #: core/class-wp-smush-admin.php:188
1063
  msgid "Smush: All images"
1064
  msgstr ""
1065
 
1066
- #: core/class-wp-smush-admin.php:189
1067
  msgid "Smush: Bulk ignored"
1068
  msgstr ""
1069
 
1070
- #: core/class-wp-smush-admin.php:262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1071
  msgid "Plugin: Smush"
1072
  msgstr ""
1073
 
1074
- #: core/class-wp-smush-admin.php:264
1075
  msgid ""
1076
  "Note: Smush does not interact with end users on your website. The only "
1077
  "input option Smush has is to a newsletter subscription for site admins "
@@ -1079,14 +1099,14 @@ msgid ""
1079
  "policy, you can use the information below."
1080
  msgstr ""
1081
 
1082
- #: core/class-wp-smush-admin.php:266
1083
  msgid ""
1084
  "Smush sends images to the WPMU DEV servers to optimize them for web use. "
1085
  "This includes the transfer of EXIF data. The EXIF data will either be "
1086
  "stripped or returned as it is. It is not stored on the WPMU DEV servers."
1087
  msgstr ""
1088
 
1089
- #: core/class-wp-smush-admin.php:269
1090
  msgid ""
1091
  "Smush uses the Stackpath Content Delivery Network (CDN). Stackpath may "
1092
  "store web log information of site visitors, including IPs, UA, referrer, "
@@ -1095,7 +1115,7 @@ msgid ""
1095
  "Stackpath's privacy policy can be found %1$shere%2$s."
1096
  msgstr ""
1097
 
1098
- #: core/class-wp-smush-admin.php:277
1099
  msgid ""
1100
  "Smush uses a third-party email service (Drip) to send informational emails "
1101
  "to the site administrator. The administrator's email address is sent to "
@@ -1103,15 +1123,15 @@ msgid ""
1103
  "collected by Drip."
1104
  msgstr ""
1105
 
1106
- #: core/class-wp-smush-admin.php:281
1107
  msgid "WP Smush"
1108
  msgstr ""
1109
 
1110
- #: core/class-wp-smush-admin.php:317
1111
  msgid "Validating.."
1112
  msgstr ""
1113
 
1114
- #: core/class-wp-smush-admin.php:322
1115
  #. translators: $1$s: recheck link, $2$s: closing a tag, %3$s; contact link,
1116
  #. %4$s: closing a tag
1117
  msgid ""
@@ -1122,15 +1142,15 @@ msgid ""
1122
  "\t\t\t\t\twith our %3$ssupport team%4$s."
1123
  msgstr ""
1124
 
1125
- #: core/class-wp-smush-admin.php:348
1126
  msgid "Get Optimized"
1127
  msgstr ""
1128
 
1129
- #: core/class-wp-smush-admin.php:349
1130
  msgid "Resize, compress and optimize your images here."
1131
  msgstr ""
1132
 
1133
- #: core/class-wp-smush-admin.php:549
1134
  #. translators: %1$s: user name, %2$s: strong tag, %3$s: span tag, %4$d: number
1135
  #. of remaining umages, %5$s: closing span tag, %6$s: closing strong tag
1136
  msgid "%1$s, you have %2$s%3$s%4$d%5$s attachment%6$s that needs re-compressing!"
@@ -1346,21 +1366,21 @@ msgstr ""
1346
  msgid "Resume scan"
1347
  msgstr ""
1348
 
1349
- #: core/integrations/class-wp-smush-gutenberg.php:72
1350
  msgid "Show Smush stats in Gutenberg blocks"
1351
  msgstr ""
1352
 
1353
- #: core/integrations/class-wp-smush-gutenberg.php:73
1354
  msgid "Gutenberg Support"
1355
  msgstr ""
1356
 
1357
- #: core/integrations/class-wp-smush-gutenberg.php:74
1358
  msgid ""
1359
  "Add statistics and the manual smush button to Gutenberg blocks that\n"
1360
  "\t\t\t\t\t\t\tdisplay images."
1361
  msgstr ""
1362
 
1363
- #: core/integrations/class-wp-smush-gutenberg.php:104
1364
  msgid "To use this feature you need to install and activate the Gutenberg plugin."
1365
  msgstr ""
1366
 
@@ -1508,16 +1528,6 @@ msgstr ""
1508
  msgid "Smush stats"
1509
  msgstr ""
1510
 
1511
- #: core/integrations/nextgen/class-wp-smush-nextgen-stats.php:455
1512
- #: core/modules/class-wp-smushit.php:569
1513
- msgid "Image size"
1514
- msgstr ""
1515
-
1516
- #: core/integrations/nextgen/class-wp-smush-nextgen-stats.php:456
1517
- #: core/modules/class-wp-smushit.php:570
1518
- msgid "Savings"
1519
- msgstr ""
1520
-
1521
  #: core/modules/class-wp-smush-ajax.php:267
1522
  msgid "Attachment Skipped - Check `wp_smush_image` filter."
1523
  msgstr ""
2
  # This file is distributed under the GPLv2.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Smush 3.0.2\n"
6
  "Report-Msgid-Bugs-To: https://wpmudev.org\n"
7
+ "POT-Creation-Date: 2018-12-18 14:13:13+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
124
 
125
  #: app/class-wp-smush-dashboard.php:89 app/class-wp-smush-dashboard.php:144
126
  #: app/class-wp-smush-dashboard.php:213 app/class-wp-smush-dashboard.php:275
127
+ #: core/class-wp-smush-admin.php:219
128
  msgid "Settings"
129
  msgstr ""
130
 
449
 
450
  #: app/views/meta-boxes/bulk/meta-box.php:147
451
  #: app/views/meta-boxes/directory/meta-box.php:46
452
+ #: core/class-wp-smush-admin.php:250
453
  msgid "Smush Pro"
454
  msgstr ""
455
 
509
 
510
  #: app/views/meta-boxes/cdn/disabled-meta-box.php:18
511
  msgid ""
512
+ "Automatically compress and resize your images with bulk Smush, or upload "
513
+ "them to the WPMU DEV's\n"
514
+ "\t\t\tblazing-fast CDN with multi-pass lossy compression and auto resize "
515
+ "features. All you need to do is activate\n"
516
+ "\t\t\tthe feature and we’ll serve your images from the CDN - no coding "
517
+ "required."
 
518
  msgstr ""
519
 
520
+ #: app/views/meta-boxes/cdn/disabled-meta-box.php:28
521
  msgid "GET STARTED"
522
  msgstr ""
523
 
635
 
636
  #: app/views/meta-boxes/cdn/upsell-meta-box.php:20
637
  msgid ""
638
+ "Automatically compress and resize your images with bulk Smush, or upload "
639
+ "them to the WPMU DEV's\n"
640
+ "\t\t\tblazing-fast CDN with multi-pass lossy compression and auto resize "
641
+ "features.. This is the ultimate tool for\n"
642
+ "\t\t\tboosting your pagespeed by taking the load off your server. Try it "
643
+ "today with a WPMU DEV Membership!"
644
  msgstr ""
645
 
646
  #: app/views/meta-boxes/cdn/upsell-meta-box.php:30
1059
  msgid "Smush"
1060
  msgstr ""
1061
 
1062
+ #: core/class-wp-smush-admin.php:190
1063
  msgid "Smush: All images"
1064
  msgstr ""
1065
 
1066
+ #: core/class-wp-smush-admin.php:191
1067
  msgid "Smush: Bulk ignored"
1068
  msgstr ""
1069
 
1070
+ #: core/class-wp-smush-admin.php:193
1071
+ msgid "Smush Stats"
1072
+ msgstr ""
1073
+
1074
+ #: core/class-wp-smush-admin.php:194
1075
+ msgid "Select an image to view Smush stats."
1076
+ msgstr ""
1077
+
1078
+ #: core/class-wp-smush-admin.php:195
1079
+ #: core/integrations/nextgen/class-wp-smush-nextgen-stats.php:455
1080
+ #: core/modules/class-wp-smushit.php:569
1081
+ msgid "Image size"
1082
+ msgstr ""
1083
+
1084
+ #: core/class-wp-smush-admin.php:196
1085
+ #: core/integrations/nextgen/class-wp-smush-nextgen-stats.php:456
1086
+ #: core/modules/class-wp-smushit.php:570
1087
+ msgid "Savings"
1088
+ msgstr ""
1089
+
1090
+ #: core/class-wp-smush-admin.php:270
1091
  msgid "Plugin: Smush"
1092
  msgstr ""
1093
 
1094
+ #: core/class-wp-smush-admin.php:272
1095
  msgid ""
1096
  "Note: Smush does not interact with end users on your website. The only "
1097
  "input option Smush has is to a newsletter subscription for site admins "
1099
  "policy, you can use the information below."
1100
  msgstr ""
1101
 
1102
+ #: core/class-wp-smush-admin.php:274
1103
  msgid ""
1104
  "Smush sends images to the WPMU DEV servers to optimize them for web use. "
1105
  "This includes the transfer of EXIF data. The EXIF data will either be "
1106
  "stripped or returned as it is. It is not stored on the WPMU DEV servers."
1107
  msgstr ""
1108
 
1109
+ #: core/class-wp-smush-admin.php:277
1110
  msgid ""
1111
  "Smush uses the Stackpath Content Delivery Network (CDN). Stackpath may "
1112
  "store web log information of site visitors, including IPs, UA, referrer, "
1115
  "Stackpath's privacy policy can be found %1$shere%2$s."
1116
  msgstr ""
1117
 
1118
+ #: core/class-wp-smush-admin.php:285
1119
  msgid ""
1120
  "Smush uses a third-party email service (Drip) to send informational emails "
1121
  "to the site administrator. The administrator's email address is sent to "
1123
  "collected by Drip."
1124
  msgstr ""
1125
 
1126
+ #: core/class-wp-smush-admin.php:289
1127
  msgid "WP Smush"
1128
  msgstr ""
1129
 
1130
+ #: core/class-wp-smush-admin.php:325
1131
  msgid "Validating.."
1132
  msgstr ""
1133
 
1134
+ #: core/class-wp-smush-admin.php:330
1135
  #. translators: $1$s: recheck link, $2$s: closing a tag, %3$s; contact link,
1136
  #. %4$s: closing a tag
1137
  msgid ""
1142
  "\t\t\t\t\twith our %3$ssupport team%4$s."
1143
  msgstr ""
1144
 
1145
+ #: core/class-wp-smush-admin.php:356
1146
  msgid "Get Optimized"
1147
  msgstr ""
1148
 
1149
+ #: core/class-wp-smush-admin.php:357
1150
  msgid "Resize, compress and optimize your images here."
1151
  msgstr ""
1152
 
1153
+ #: core/class-wp-smush-admin.php:557
1154
  #. translators: %1$s: user name, %2$s: strong tag, %3$s: span tag, %4$d: number
1155
  #. of remaining umages, %5$s: closing span tag, %6$s: closing strong tag
1156
  msgid "%1$s, you have %2$s%3$s%4$d%5$s attachment%6$s that needs re-compressing!"
1366
  msgid "Resume scan"
1367
  msgstr ""
1368
 
1369
+ #: core/integrations/class-wp-smush-gutenberg.php:68
1370
  msgid "Show Smush stats in Gutenberg blocks"
1371
  msgstr ""
1372
 
1373
+ #: core/integrations/class-wp-smush-gutenberg.php:69
1374
  msgid "Gutenberg Support"
1375
  msgstr ""
1376
 
1377
+ #: core/integrations/class-wp-smush-gutenberg.php:70
1378
  msgid ""
1379
  "Add statistics and the manual smush button to Gutenberg blocks that\n"
1380
  "\t\t\t\t\t\t\tdisplay images."
1381
  msgstr ""
1382
 
1383
+ #: core/integrations/class-wp-smush-gutenberg.php:100
1384
  msgid "To use this feature you need to install and activate the Gutenberg plugin."
1385
  msgstr ""
1386
 
1528
  msgid "Smush stats"
1529
  msgstr ""
1530
 
 
 
 
 
 
 
 
 
 
 
1531
  #: core/modules/class-wp-smush-ajax.php:267
1532
  msgid "Attachment Skipped - Check `wp_smush_image` filter."
1533
  msgstr ""
readme.txt CHANGED
@@ -1,13 +1,13 @@
1
  === Smush Image Compression and Optimization ===
2
  Plugin Name: Smush Image Compression and Optimization
3
- Version: 3.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: 5.0.0
10
- Stable tag: 3.0.1
11
  Requires PHP: 5.2.4
12
  License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
13
 
@@ -22,14 +22,25 @@ Compress and optimize (or optimise) image files, improve performance and boost y
22
  ### Award Winning Image Optimizer
23
  Smush has been benchmarked and tested number one for speed and quality and is the [award-winning](https://torquemag.io/2018/04/smush-image-compression-wins-2018-plugin-madness/), back-to-back proven crowd favorite image optimization plugin for WordPress.
24
 
25
- Now with image resizing! Set a max width and height and large images will scale down as they are being compressed.
 
 
 
 
 
 
 
 
 
 
 
26
 
27
- Our servers do all the heavy lifting. Strip hidden bulky information from your images and reduce file size without losing quality.
28
 
29
- Large image files may be slowing down your site without you even knowing it. WP Smush uses WPMU DEV’s super servers to quickly smush every single one of your images and cuts all the unnecessary data without slowing down your site.
30
 
31
  [youtube https://www.youtube.com/watch?v=BDtgVJZEajg&feature=youtu.be]
32
-
33
  Smush meticulously scans every image you upload – or have already added to your site – cuts all the unnecessary data and scales it for you before adding it to your media library.
34
 
35
  ### Compress any Image in any Directory
@@ -50,6 +61,9 @@ No matter what plugins you use to better manage your WordPress media library, Sm
50
  - [Styles](https://wordpress.org/plugins/styles/)
51
  - And many, many, more!
52
 
 
 
 
53
  ★★★★★
54
  > “I had no idea that my page load time was being dragged down by the images. The plugin nearly halved the time it took.” - [karlcw](http://profiles.wordpress.org/karlcw)
55
 
@@ -59,26 +73,13 @@ No matter what plugins you use to better manage your WordPress media library, Sm
59
  ★★★★★
60
  > “Smush helped reduce the total files size on my site and increased browsing speed. Well done guys!” - [pdci](https://wordpress.org/support/users/pdci/)
61
 
62
- *What about Multisite?* Smush can be used to optimize all the images across your entire network! Use global settings or configure each site individually.
63
 
64
- Smush is super easy to use no confusing compression software settings! Smush images in your library one at a time or bulk smush up to 50 images at a time. Plus, configure auto-smush to asynchronously scale and compress some or all of your images as they are being uploaded – it's incredibly fast.
65
 
66
- The faster your site loads, the more Google, Bing, Yahoo and other search engines will like it. Your site will load faster and rank higher.
67
 
68
- > ### Features available in Smush include:
69
- >
70
- > - Optimize your images using advanced lossless compression techniques.
71
- > - Set maximum width and height and large images will automatically scale before being added to your media library.
72
- > - Process JPEG, GIF and PNG image files.
73
- > - Optimize any image in any directory.
74
- > - Asynchronously auto-smush your attachments for super fast compression on upload.
75
- > - Manually smush your attachments individually in the media library, or in bulk 50 attachments at a time.
76
- > - Smush all standard web-sized images 1MB or smaller.
77
- > - Smush images with no slowdown using WPMU DEV's fast, reliable Smush API.
78
- > - Global and individual settings for Multisite.
79
- > - View advanced compression stats per-attachment and library totals.
80
- >
81
- > Install Smush now and find out why it's the most popular image optimization plugin for WordPress available today with over 11 million downloads.
82
 
83
  ### Shameless Plug(ins)
84
 
@@ -89,7 +90,7 @@ The faster your site loads, the more Google, Bing, Yahoo and other search engine
89
 
90
  Smush can take care of all your image compression needs, for free!
91
 
92
- However, if you'd like Super Smush lossy compression, the ability to optimize images up to 32MB, bulk smush optimization for all your images in just one-click, auto-convert PNG to JPEG, the ability to Smush and make a copy of your full-sized images (to restore them at any point) you can always take the next step with [WP Smush Pro](https://premium.wpmudev.org/project/wp-smush-pro/?utm_source=wordpress.org&utm_medium=readme).
93
 
94
  ### Privacy
95
 
@@ -103,10 +104,10 @@ Smush sends images to the WPMU DEV servers to optimize them for web use. This in
103
 
104
  = I just finished running Smush and Google Pagespeed still says my images need compressing and resizing. How do I fix it? =
105
 
106
- This means your images were not properly scaled for where they are being displayed. Scaling images before uploading them can be time consuming but can save space and speedup load time. First, determine what size your image needs to be. You can use the built-in developer tools in Chrome or Firefox to find what height and width your image should be. Once you know how large the image should be, scale your images to the right size.
107
 
108
 
109
- *Tip:* you may not need to scale each image individually. If the images are in your Media Library, you may be able to fix them with a plugin.
110
 
111
  = Does Smush delete or replace my original full-size images? =
112
 
@@ -122,6 +123,8 @@ PNG is best for computer generated graphics (vectors, logos, fonts, etc.), image
122
 
123
  JPG should be used for photography or images with a lot of color variation.
124
 
 
 
125
  = I’m a photographer can I keep all my EXIF data? =
126
 
127
  Yes! EXIF data stores camera settings, focal length, date, time and location information in image files. EXIF data makes image files larger but if you are a photographer you may want to preserve this information. We have included the option to preserve EXIF image data in Smush.
@@ -153,6 +156,12 @@ It depends what side of the pond you live on...but whether you say optimize, opt
153
 
154
  == Changelog ==
155
 
 
 
 
 
 
 
156
  = 3.0.1 =
157
 
158
  * Security: Remove support for Upfront theme functions
@@ -165,7 +174,8 @@ It depends what side of the pond you live on...but whether you say optimize, opt
165
  * New: Plugin structure (Important: plugin globals have been removed)
166
  * New: Show failure reason during directory Smush
167
  * New: Settings page with language translation links
168
- * Security: Fix XSS and phar deserialization vulnerabilities
 
169
  * Enhance: Better handling of animated GIFs. Improve performance.
170
  * Enhance: Update translation strings
171
  * Enhance: Clean out all the leftover data on plugin uninstall
1
  === Smush Image Compression and Optimization ===
2
  Plugin Name: Smush Image Compression and Optimization
3
+ Version: 3.0.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, WebP, photography, optimizer, Smush WordPress Compression, Smush.it
8
  Requires at least: 4.6
9
+ Tested up to: 5.0.1
10
+ Stable tag: 3.0.2
11
  Requires PHP: 5.2.4
12
  License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
13
 
22
  ### Award Winning Image Optimizer
23
  Smush has been benchmarked and tested number one for speed and quality and is the [award-winning](https://torquemag.io/2018/04/smush-image-compression-wins-2018-plugin-madness/), back-to-back proven crowd favorite image optimization plugin for WordPress.
24
 
25
+ - Lossless Compression Strip unused data without affecting image quality
26
+ - Bulk Smush – Optimize up to 50 images with one click
27
+ - Image Resizing – Set a max width and height and large images will scale down as they are being compressed
28
+ - Incorrect Size Image Detection – Quickly locate images that are slowing down your site
29
+ - Directory Smush – Optimize images even if they are not located in the media library
30
+ - Automated Optimization – Asynchronously auto-smush your attachments for super fast compression on upload
31
+ - Unlimited & Free – Optimize all of your images up to 1MB in size forever (no daily, monthly, or annual caps)
32
+ - Gutenberg Block Integration – View all Smush stats directly in image blocks
33
+ - Multisite Compatible – Both global and individual Multisite settings
34
+ - Process All Your Files – Smush will process PNG, JPEG and GIF files for optimum results
35
+ - Super Servers - Smush images with no slowdown using WPMU DEV's fast, reliable Smush API
36
+ - And many, many, more!
37
 
38
+ ###Preserve Image Quality
39
 
40
+ Some image compression tools destroy images with as much as a 30% loss in quality. Our servers strip hidden bulky information from your images and reduce file size without affecting the appearance.
41
 
42
  [youtube https://www.youtube.com/watch?v=BDtgVJZEajg&feature=youtu.be]
43
+
44
  Smush meticulously scans every image you upload – or have already added to your site – cuts all the unnecessary data and scales it for you before adding it to your media library.
45
 
46
  ### Compress any Image in any Directory
61
  - [Styles](https://wordpress.org/plugins/styles/)
62
  - And many, many, more!
63
 
64
+ ### Incorrect Size Image Detection
65
+ Smush now includes a wrong size image finder. Activate and your images will be highlighted with smart tips for scaling your images. Quickly locate the images that are keeping you from getting that perfect 100 on your Google PageSpeed test.
66
+
67
  ★★★★★
68
  > “I had no idea that my page load time was being dragged down by the images. The plugin nearly halved the time it took.” - [karlcw](http://profiles.wordpress.org/karlcw)
69
 
73
  ★★★★★
74
  > “Smush helped reduce the total files size on my site and increased browsing speed. Well done guys!” - [pdci](https://wordpress.org/support/users/pdci/)
75
 
76
+ ###What about Multisite?
77
 
78
+ Smush can be used to optimize all the images across your entire network! Use global settings or configure each site individually.
79
 
80
+ Smush is super easy to use – no confusing compression software settings. Smush images in your library one at a time or bulk smush up to 50 images at a time. Plus, configure auto-smush to asynchronously scale and compress some or all of your images as they are being uploaded – it's incredibly fast.
81
 
82
+ The faster your site loads, the more Google, Bing, Yahoo and other search engines will like it. Your site will load faster and rank higher.
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
  ### Shameless Plug(ins)
85
 
90
 
91
  Smush can take care of all your image compression needs, for free!
92
 
93
+ However, if youd like Super Smush lossy compression, fast CDN image delivery, WebP conversion, automatic resizing, the ability to optimize images up to 32MB, bulk smush optimization for all your images in just one-click, auto-convert PNG to JPEG, the ability to Smush and make a copy of your full-sized images (to restore them at any point) you can always take the next step with [WP Smush Pro](https://premium.wpmudev.org/project/wp-smush-pro/?utm_source=wordpress.org&utm_medium=readme) along with her whole team of WordPress optimization hero friends (security, SEO, performance, support and maintenance automation) for unlimited sites – perfect for agencies and freelancers offering site maintenance services.
94
 
95
  ### Privacy
96
 
104
 
105
  = I just finished running Smush and Google Pagespeed still says my images need compressing and resizing. How do I fix it? =
106
 
107
+ This means your images were not properly scaled for where they are being displayed. Scaling images before uploading them can be time consuming but can save space and speedup load time. First, determine what size your image needs to be. You can use the built-in images size detector included in the free version of Smush to find what height and width your image should be. Once you know how large the image should be, scale your images to the right size.
108
 
109
 
110
+ *Tip:* If you're having any issues or want to save a tone of time, The Smush Pro CDN includes auto resizing.
111
 
112
  = Does Smush delete or replace my original full-size images? =
113
 
123
 
124
  JPG should be used for photography or images with a lot of color variation.
125
 
126
+ *Tip:* The Smush Pro CDN includes WebP compression - sharper images that are 25 to 30 percent smaller than JPEG and PNG files.
127
+
128
  = I’m a photographer can I keep all my EXIF data? =
129
 
130
  Yes! EXIF data stores camera settings, focal length, date, time and location information in image files. EXIF data makes image files larger but if you are a photographer you may want to preserve this information. We have included the option to preserve EXIF image data in Smush.
156
 
157
  == Changelog ==
158
 
159
+ = 3.0.2 =
160
+
161
+ * Enhance: Support for WordPress 5.0 release and Gutenberg editor
162
+ * Fix: [WP Offload Media] integration with Pro version
163
+ * Fix: PHP warning on update from Smush version 2 to version 3
164
+
165
  = 3.0.1 =
166
 
167
  * Security: Remove support for Upfront theme functions
174
  * New: Plugin structure (Important: plugin globals have been removed)
175
  * New: Show failure reason during directory Smush
176
  * New: Settings page with language translation links
177
+ * Security: Fix XSS vulnerability
178
+ * Security: Fix phar deserialization vulnerability (thanks @ripstech)
179
  * Enhance: Better handling of animated GIFs. Improve performance.
180
  * Enhance: Update translation strings
181
  * Enhance: Clean out all the leftover data on plugin uninstall
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: 3.0.1
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', '3.0.1' );
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: 3.0.2
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', '3.0.2' );
51
  }
52
  // Used to define body class.
53
  if ( ! defined( 'WP_SHARED_UI_VERSION' ) ) {