diff --git a/.gitignore b/.gitignore index 154604232..04543391a 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ coverage/html/ # IDE .vscode cloudinary-image-management-and-manipulation-in-the-cloud-cdn +cloudinary-image-management-and-manipulation-in-the-cloud-cdn.zip diff --git a/gruntfile.js b/gruntfile.js index c3de3c009..38b0ef61e 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -15,11 +15,12 @@ module.exports = function( grunt ) { dist: { src: [ 'css/**', - 'js/**', + 'js/**.js', 'php/**', 'ui-definitions/**', '*.php', 'readme.txt', + '!**/src/**' ], dest: '<%= dist_dir %>', expand: true, diff --git a/package-lock.json b/package-lock.json index ab3144f4f..578f334ee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -154,28 +154,67 @@ } }, "@babel/helper-compilation-targets": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.8.3.tgz", - "integrity": "sha512-JLylPCsFjhLN+6uBSSh3iYdxKdeO9MNmoY96PE/99d8kyBFaXLORtAVhqN6iHa+wtPeqxKLghDOZry0+Aiw9Tw==", + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.10.4.tgz", + "integrity": "sha512-a3rYhlsGV0UHNDvrtOXBg8/OpfV0OKTkxKPzIplS1zpx7CygDcWWxckxZeDd3gzPzC4kUT0A4nVFDK0wGMh4MQ==", "dev": true, "requires": { - "@babel/compat-data": "^7.8.1", - "browserslist": "^4.8.2", + "@babel/compat-data": "^7.10.4", + "browserslist": "^4.12.0", "invariant": "^2.2.4", - "levenary": "^1.1.0", + "levenary": "^1.1.1", "semver": "^5.5.0" }, "dependencies": { + "@babel/compat-data": { + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.11.0.tgz", + "integrity": "sha512-TPSvJfv73ng0pfnEOh17bYMPQbI95+nGWc71Ss4vZdRBHTDqmM9Z8ZV4rYz8Ks7sfzc95n30k6ODIq5UGnXcYQ==", + "dev": true, + "requires": { + "browserslist": "^4.12.0", + "invariant": "^2.2.4", + "semver": "^5.5.0" + } + }, "browserslist": { - "version": "4.8.5", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.8.5.tgz", - "integrity": "sha512-4LMHuicxkabIB+n9874jZX/az1IaZ5a+EUuvD7KFOu9x/Bd5YHyO0DIz2ls/Kl8g0ItS4X/ilEgf4T1Br0lgSg==", + "version": "4.14.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.14.5.tgz", + "integrity": "sha512-Z+vsCZIvCBvqLoYkBFTwEYH3v5MCQbsAjp50ERycpOjnPmolg1Gjy4+KaWWpm8QOJt9GHkhdqAl14NpCX73CWA==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001022", - "electron-to-chromium": "^1.3.338", - "node-releases": "^1.1.46" + "caniuse-lite": "^1.0.30001135", + "electron-to-chromium": "^1.3.571", + "escalade": "^3.1.0", + "node-releases": "^1.1.61" + } + }, + "caniuse-lite": { + "version": "1.0.30001143", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001143.tgz", + "integrity": "sha512-p/PO5YbwmCpBJPxjOiKBvAlUPgF8dExhfEpnsH+ys4N/791WHrYrGg0cyHiAURl5hSbx5vIcjKmQAP6sHDYH3w==", + "dev": true + }, + "electron-to-chromium": { + "version": "1.3.576", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.576.tgz", + "integrity": "sha512-uSEI0XZ//5ic+0NdOqlxp0liCD44ck20OAGyLMSymIWTEAtHKVJi6JM18acOnRgUgX7Q65QqnI+sNncNvIy8ew==", + "dev": true + }, + "levenary": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/levenary/-/levenary-1.1.1.tgz", + "integrity": "sha512-mkAdOIt79FD6irqjYSs4rdbnlT5vRonMEvBVPVb3XmevfS8kgRXwfes0dhPdEtzTWD/1eNE/Bm/G1iRt6DcnQQ==", + "dev": true, + "requires": { + "leven": "^3.1.0" } + }, + "node-releases": { + "version": "1.1.61", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.61.tgz", + "integrity": "sha512-DD5vebQLg8jLCOzwupn954fbIiZht05DAZs0k2u8NStSe6h9XdsuIQL8hSRKYiU8WUQRznmSDrKGbv3ObOmC7g==", + "dev": true } } }, @@ -4987,6 +5026,12 @@ "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", "dev": true }, + "array-differ": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", + "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==", + "dev": true + }, "array-each": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz", @@ -6388,6 +6433,12 @@ "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", "dev": true }, + "compare-versions": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz", + "integrity": "sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA==", + "dev": true + }, "component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", @@ -7752,6 +7803,12 @@ "es6-promise": "^4.0.3" } }, + "escalade": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.0.tgz", + "integrity": "sha512-mAk+hPSO8fLDkhV7V0dXazH5pDc6MrjBTPyD3VeKzxnVFjH1MIxbCdqGZB9O8+EwWakZs3ZCbDS4IpRt79V1ig==", + "dev": true + }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -8592,6 +8649,15 @@ "locate-path": "^3.0.0" } }, + "find-versions": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-3.2.0.tgz", + "integrity": "sha512-P8WRou2S+oe222TOCHitLy8zj+SIsVJh52VP4lvXkaFVnOFFdoWv1H1Jjvel1aI6NCFOAaeAVm8qrI0odiLcww==", + "dev": true, + "requires": { + "semver-regex": "^2.0.0" + } + }, "findup": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/findup/-/findup-0.1.5.tgz", @@ -10411,6 +10477,144 @@ } } }, + "husky": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/husky/-/husky-4.3.0.tgz", + "integrity": "sha512-tTMeLCLqSBqnflBZnlVDhpaIMucSGaYyX6855jM4AguGeWCeSzNdb1mfyWduTZ3pe3SJVvVWGL0jO1iKZVPfTA==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "ci-info": "^2.0.0", + "compare-versions": "^3.6.0", + "cosmiconfig": "^7.0.0", + "find-versions": "^3.2.0", + "opencollective-postinstall": "^2.0.2", + "pkg-dir": "^4.2.0", + "please-upgrade-node": "^3.2.0", + "slash": "^3.0.0", + "which-pm-runs": "^1.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "cosmiconfig": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.0.tgz", + "integrity": "sha512-pondGvTuVYDk++upghXJabWzL6Kxu6f26ljFw64Swq9v6sQPUL3EUlVDV56diOjpCayKihL6hVe8exIACU4XcA==", + "dev": true, + "requires": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "yaml": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.0.tgz", + "integrity": "sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg==", + "dev": true + } + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -12113,6 +12317,26 @@ "integrity": "sha512-XPQH8Z2GDP/Hwz2PCDrh2mth4yFejwA1OZ/81Ti3LgKyhDcEjsSsqFWZojHG0va/duGd+WyosY7eXLDoOyqcPw==", "dev": true }, + "load-grunt-tasks": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/load-grunt-tasks/-/load-grunt-tasks-5.1.0.tgz", + "integrity": "sha512-oNj0Jlka1TsfDe+9He0kcA1cRln+TMoTsEByW7ij6kyktNLxBKJtslCFEvFrLC2Dj0S19IWJh3fOCIjLby2Xrg==", + "dev": true, + "requires": { + "arrify": "^2.0.1", + "multimatch": "^4.0.0", + "pkg-up": "^3.1.0", + "resolve-pkg": "^2.0.0" + }, + "dependencies": { + "arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "dev": true + } + } + }, "load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", @@ -12880,6 +13104,33 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, + "multimatch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-4.0.0.tgz", + "integrity": "sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ==", + "dev": true, + "requires": { + "@types/minimatch": "^3.0.3", + "array-differ": "^3.0.0", + "array-union": "^2.1.0", + "arrify": "^2.0.1", + "minimatch": "^3.0.4" + }, + "dependencies": { + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, + "arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "dev": true + } + } + }, "mute-stream": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", @@ -13646,6 +13897,12 @@ "mimic-fn": "^1.0.0" } }, + "opencollective-postinstall": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz", + "integrity": "sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q==", + "dev": true + }, "opener": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.1.tgz", @@ -14038,6 +14295,24 @@ "find-up": "^3.0.0" } }, + "pkg-up": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-3.1.0.tgz", + "integrity": "sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==", + "dev": true, + "requires": { + "find-up": "^3.0.0" + } + }, + "please-upgrade-node": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz", + "integrity": "sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==", + "dev": true, + "requires": { + "semver-compare": "^1.0.0" + } + }, "plur": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/plur/-/plur-3.1.1.tgz", @@ -16444,6 +16719,23 @@ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, + "resolve-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg/-/resolve-pkg-2.0.0.tgz", + "integrity": "sha512-+1lzwXehGCXSeryaISr6WujZzowloigEofRB+dj75y9RRa/obVcYgbHJd53tdYw8pvZj8GojXaaENws8Ktw/hQ==", + "dev": true, + "requires": { + "resolve-from": "^5.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + } + } + }, "resolve-url": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", @@ -16931,6 +17223,18 @@ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true }, + "semver-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", + "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=", + "dev": true + }, + "semver-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-2.0.0.tgz", + "integrity": "sha512-mUdIBBvdn0PLOeP3TEkMH7HHeUP3GjsXCwKarjv/kGmUFOYg1VqEemKhoQpWMu6X2I8kHeuVdGibLGkVK+/5Qw==", + "dev": true + }, "send": { "version": "0.17.1", "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", @@ -19792,8 +20096,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz", "integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=", - "dev": true, - "optional": true + "dev": true }, "wide-align": { "version": "1.1.3", diff --git a/package.json b/package.json index 65d9834b5..0b6e71452 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "devDependencies": { "@babel/cli": "7.4.4", "@babel/core": "7.4.5", + "@babel/helper-compilation-targets": "^7.10.4", "@babel/plugin-proposal-object-rest-spread": "7.4.4", "@babel/plugin-transform-react-jsx": "7.3.0", "@wordpress/babel-preset-default": "4.2.0", @@ -68,6 +69,8 @@ "grunt-contrib-compress": "1.6.0", "grunt-contrib-copy": "1.0.0", "grunt-wp-deploy": "2.1.2", + "husky": "^4.3.0", + "load-grunt-tasks": "^5.1.0", "loading-attribute-polyfill": "^1.5.4", "lodash": "4.17.19", "mini-css-extract-plugin": "0.7.0", diff --git a/php/class-connect.php b/php/class-connect.php index 0c2596634..6a3250d32 100644 --- a/php/class-connect.php +++ b/php/class-connect.php @@ -102,7 +102,7 @@ class Connect implements Config, Setup, Notice { public function __construct( Plugin $plugin ) { $this->plugin = $plugin; add_filter( 'pre_update_option_cloudinary_connect', array( $this, 'verify_connection' ) ); - add_filter( 'cron_schedules', array( $this, 'get_status_schedule' ) ); + add_filter( 'cron_schedules', array( $this, 'get_status_schedule' ) ); // phpcs:ignore WordPress.WP.CronInterval add_action( 'cloudinary_status', array( $this, 'check_status' ) ); } @@ -126,7 +126,7 @@ public function media_library_script() { // sign maybe. if ( ! empty( $this->credentials['user_email'] ) ) { - $timestamp = current_time( 'timestamp' ); + $timestamp = current_time( 'timestamp' ); // phpcs:ignore WordPress.DateTime.CurrentTimeTimestamp.Requested $params['mloptions']['username'] = $this->credentials['user_email']; $params['mloptions']['timestamp'] = (string) $timestamp; $query = array( @@ -172,7 +172,7 @@ public function verify_connection( $data ) { return $data; } - // Pattern match to ensure validity of the provided url + // Pattern match to ensure validity of the provided url. if ( ! preg_match( '~' . self::CLOUDINARY_VARIABLE_REGEX . '~', $data['cloudinary_url'] ) ) { add_settings_error( 'cloudinary_connect', @@ -216,7 +216,7 @@ public function is_connected() { return false; } - $connect_data = get_option( self::META_KEYS['connect'], [] ); + $connect_data = get_option( self::META_KEYS['connect'], array() ); $current_url = isset( $connect_data['cloudinary_url'] ) ? $connect_data['cloudinary_url'] : null; if ( null === $current_url ) { @@ -279,7 +279,7 @@ public function test_connection( $url ) { $valid = array_filter( array_keys( $test ), function ( $a ) { - return in_array( $a, [ 'scheme', 'host', 'user', 'pass' ], true ); + return in_array( $a, array( 'scheme', 'host', 'user', 'pass' ), true ); } ); @@ -348,7 +348,7 @@ public function test_ping() { /** * Extracts the CNAME from a parsed connection URL. * - * @param array $parsed_url + * @param array $parsed_url Parsed URL. * * @return string|null */ @@ -369,7 +369,7 @@ protected function extract_cname( $parsed_url ) { /** * Safely validate a domain. * - * @param string $domain + * @param string $domain The domain. * * @return bool */ @@ -451,7 +451,7 @@ public function config_from_url( $url ) { } } - // Specifically set CNAME + // Specifically set CNAME. $cname = $this->extract_cname( $parts ); if ( ! empty( $cname ) ) { $this->set_credentials( array( 'cname' => $cname ) ); @@ -495,7 +495,7 @@ public function get_status_schedule( $schedules ) { */ protected function setup_status_cron() { if ( false === wp_get_schedule( 'cloudinary_status' ) ) { - $now = current_time( 'timestamp' ); + $now = current_time( 'timestamp' ); // phpcs:ignore WordPress.DateTime.CurrentTimeTimestamp.Requested wp_schedule_event( $now + ( MINUTE_IN_SECONDS ), 'every_minute', 'cloudinary_status' ); } } @@ -620,7 +620,7 @@ public function usage_notices() { continue; } $usage = $this->get_usage_stat( $stat, 'used_percent' ); - if ( empty ( $usage ) ) { + if ( empty( $usage ) ) { continue; } $link = null; @@ -640,7 +640,7 @@ public function usage_notices() { continue; } // translators: Placeholders are URLS and percentage values. - $message = sprintf( + $message = sprintf( /* translators: %1$s quota size, %2$s amount in percent, %3$s link URL, %4$s link anchor text. */ __( ' You are %2$s of the way through your monthly quota for %1$s on your Cloudinary account. If you exceed your quota, the Cloudinary plugin will be deactivated until your next billing cycle and your media assets will be served from your WordPress Media Library. You may wish to %4$s and increase your quota to ensure you maintain full functionality.', diff --git a/php/class-media.php b/php/class-media.php index 835136560..d9acc3d75 100644 --- a/php/class-media.php +++ b/php/class-media.php @@ -686,7 +686,7 @@ public function apply_default_transformations( array $transformations, $type = ' $default['fetch_format'] = 'auto'; } if ( isset( $global[ $type . '_quality' ] ) ) { - $default['quality'] = $global[ $type . '_quality' ] !== 'none' ? $global[ $type . '_quality' ] : null; + $default['quality'] = 'none' !== $global[ $type . '_quality' ] ? $global[ $type . '_quality' ] : null; } else { $default['quality'] = 'auto'; } @@ -730,7 +730,6 @@ public function apply_default_transformations( array $transformations, $type = ' * @param array $transformations Set of transformations to apply to this url. * @param string $cloudinary_id Optional forced cloudinary ID. * @param bool $overwrite_transformations Flag url is a breakpoint URL to stop re-applying default transformations. - * @param bool $clean Flag to present a clean url (With out a WP size variable. * * @return string The converted URL. */ @@ -985,7 +984,6 @@ public function cloudinary_id( $attachment_id ) { * * @return array The image array of size and url. * @uses filter:image_downsize - * */ public function filter_downsize( $image, $attachment_id, $size ) { // Don't do this while saving. @@ -1281,22 +1279,25 @@ public function get_asset_payload() { $asset['url'] = filter_var( $data['asset']['derived'][0]['secure_url'], FILTER_SANITIZE_URL ); } - //convert_media_extension + // convert_media_extension. if ( ! $this->is_file_compatible( $asset['url'] ) ) { $asset['url'] = $this->convert_media_extension( $asset['url'] ); } // Move all context data into the meta key. if ( ! empty( $data['asset']['context'] ) ) { - array_walk_recursive( $data['asset']['context'], function ( $value, $key ) use ( &$asset ) { - $asset['meta'][ $key ] = filter_var( $value, FILTER_SANITIZE_STRING ); - } ); + array_walk_recursive( + $data['asset']['context'], + function ( $value, $key ) use ( &$asset ) { + $asset['meta'][ $key ] = filter_var( $value, FILTER_SANITIZE_STRING ); + } + ); } // Check for transformations. $transformations = $this->get_transformations_from_string( $asset['url'] ); if ( ! empty( $transformations ) ) { - $asset['sync_key'] .= wp_json_encode( $transformations ); + $asset['sync_key'] .= wp_json_encode( $transformations ); $asset['transformations'] = $transformations; } // Attempt to find attachment ID. @@ -1773,9 +1774,12 @@ public function maybe_overwrite_featured_image( $attachment_id ) { */ public function set_doing_featured( $post_id, $attachment_id ) { $this->doing_featured_image = (int) $attachment_id; - add_action( 'end_fetch_post_thumbnail_html', function () { - $this->doing_featured_image = false; - } ); + add_action( + 'end_fetch_post_thumbnail_html', + function () { + $this->doing_featured_image = false; + } + ); } /** diff --git a/php/class-plugin.php b/php/class-plugin.php index d8bd8b35c..a03a849f0 100644 --- a/php/class-plugin.php +++ b/php/class-plugin.php @@ -130,7 +130,7 @@ public function init() { /** * Get a plugin component. * - * @param $component + * @param mixed $component The component. * * @return \Cloudinary\Connect|\Cloudinary\Media|\Cloudinary\REST_API|\Cloudinary\Settings_Page|\Cloudinary\Sync|null */ @@ -340,9 +340,9 @@ public function rest_dismiss_notice( \WP_REST_Request $request ) { */ public function admin_notices() { /** - * @var $components Notice[] - * * An array of classes that implement the Notice interface. + * + * @var $components Notice[] */ $components = array_filter( $this->components, array( $this, 'is_notice_component' ) ); $default = array( @@ -520,7 +520,8 @@ public function trigger_warning( $message, $code = \E_USER_WARNING ) { */ public function force_visit_plugin_site_link( $plugin_meta, $plugin_file, $plugin_data, $status ) { if ( 'Cloudinary' === $plugin_data['Name'] ) { - $plugin_site_link = sprintf( '%s', + $plugin_site_link = sprintf( + '%s', esc_url( $plugin_data['PluginURI'] ), __( 'Visit plugin site' ) ); diff --git a/php/class-settings-page.php b/php/class-settings-page.php index e07bab9c2..9978c9af7 100644 --- a/php/class-settings-page.php +++ b/php/class-settings-page.php @@ -310,7 +310,11 @@ public function render_field( $field, $value = null, $show_description = true ) // Place a hidden field before it, to set unchecked value to off. ?> - pattern="" data-condition="" data-context="" > + + pattern="" data-condition="" data-context="" > " value="" /> - - "> + validate_tab( $tab ) ) { // Tab is invalid or not set, check if in a POST. - $tab = filter_input( INPUT_POST, 'tab', FILTER_DEFAULT ); + $tab = filter_input( INPUT_POST, 'tab', FILTER_SANITIZE_STRING ); if ( ! $this->validate_tab( $tab ) ) { // Tab is invalid or not set, load the default/first tab. $tab = array_keys( $page['tabs'] ); $tab = array_shift( $tab ); diff --git a/php/class-sync.php b/php/class-sync.php index b9b912d58..0ac3894c7 100644 --- a/php/class-sync.php +++ b/php/class-sync.php @@ -300,11 +300,11 @@ public function generate_public_id( $attachment_id ) { /** * Register a new sync type. * - * @param string $type Sync type key. Must not exceed 20 characters and may - * only contain lowercase alphanumeric characters, dashes, - * and underscores. See sanitize_key() - * @param array $structure { - * Array of arguments for registering a sync type. + * @param string $type Sync type key. Must not exceed 20 characters and may + * only contain lowercase alphanumeric characters, dashes, + * and underscores. See sanitize_key(). + * @param array $structure { + * Array of arguments for registering a sync type. * * @type callable $generate Callback method that generates the values to be used to sign a state. * Returns a string or array. @@ -347,7 +347,7 @@ public function setup_sync_base_struct() { $base_struct = array( 'upgrade' => array( - 'generate' => array( $this, 'get_sync_version' ), // Method to generate a signature. Which + 'generate' => array( $this, 'get_sync_version' ), // Method to generate a signature. 'validate' => array( $this, 'been_synced' ), 'priority' => 0, 'sync' => array( $this->managers['media']->upgrade, 'convert_cloudinary_version' ), @@ -398,7 +398,7 @@ public function setup_sync_base_struct() { return false === $public_id; }, 'priority' => 20, - 'sync' => array( $this->managers['media']->upgrade, 'convert_cloudinary_version' ), // Rename + 'sync' => array( $this->managers['media']->upgrade, 'convert_cloudinary_version' ), // Rename. 'state' => 'info syncing', 'note' => __( 'Updating metadata', 'cloudinary' ), 'required' => true, @@ -621,7 +621,7 @@ function ( $item, $key ) use ( $required_signature ) { public function validate_sync_type( $type, $attachment_id ) { // Validate that this sync type applied (for optional types like upgrade). if ( false === $this->run_sync_method( $type, 'validate', $attachment_id ) ) { - // If invalid, save the new signature + // If invalid, save the new signature. $this->set_signature_item( $attachment_id, $type ); $type = $this->get_sync_type( $attachment_id, false ); // Set cache to false to get the new signature. @@ -650,7 +650,7 @@ public function filter_status( $status, $attachment_id ) { $sync_type = $this->get_sync_type( $attachment_id ); if ( ! empty( $sync_type ) && isset( $this->sync_base_struct[ $sync_type ] ) ) { // check process log in case theres an error. - $log = $this->managers['media']->get_post_meta( $attachment_id, Sync::META_KEYS['process_log'] ); + $log = $this->managers['media']->get_post_meta( $attachment_id, self::META_KEYS['process_log'] ); if ( ! empty( $log[ $sync_type ] ) && is_wp_error( $log[ $sync_type ] ) ) { // Use error instead of sync note. $status['state'] = 'error'; @@ -666,7 +666,7 @@ public function filter_status( $status, $attachment_id ) { // Check if there's an error. - $has_error = $this->managers['media']->get_post_meta( $attachment_id, Sync::META_KEYS['sync_error'], true ); + $has_error = $this->managers['media']->get_post_meta( $attachment_id, self::META_KEYS['sync_error'], true ); if ( ! empty( $has_error ) && $this->get_sync_type( $attachment_id ) ) { $status['state'] = 'error'; $status['note'] = $has_error; @@ -704,7 +704,7 @@ public function filter_media_states( $media_states, $post ) { public function is_pending( $attachment_id ) { // Check if it's not already in the to sync array. if ( ! in_array( $attachment_id, $this->to_sync, true ) ) { - $is_pending = get_post_meta( $attachment_id, Sync::META_KEYS['pending'], true ); + $is_pending = get_post_meta( $attachment_id, self::META_KEYS['pending'], true ); if ( empty( $is_pending ) || $is_pending < time() - 5 * 60 ) { // No need to delete pending meta, since it will be updated with the new timestamp anyway. return false; @@ -722,7 +722,7 @@ public function is_pending( $attachment_id ) { public function add_to_sync( $attachment_id ) { if ( ! in_array( $attachment_id, $this->to_sync, true ) ) { // Flag image as pending to prevent duplicate upload. - update_post_meta( $attachment_id, Sync::META_KEYS['pending'], time() ); + update_post_meta( $attachment_id, self::META_KEYS['pending'], time() ); $this->to_sync[] = $attachment_id; } } @@ -749,7 +749,7 @@ public function sync_signature_by_type( $attachment_id, $type ) { * * @param int $attachment_id The attachment ID. * @param string $type The sync type. - * @param null $value + * @param null $value The value. */ public function set_signature_item( $attachment_id, $type, $value = null ) { @@ -758,8 +758,8 @@ public function set_signature_item( $attachment_id, $type, $value = null ) { if ( ! is_array( $meta ) ) { $meta = array(); } - if ( empty( $meta[ Sync::META_KEYS['cloudinary'] ] ) ) { - $meta[ Sync::META_KEYS['cloudinary'] ] = array(); + if ( empty( $meta[ self::META_KEYS['cloudinary'] ] ) ) { + $meta[ self::META_KEYS['cloudinary'] ] = array(); } // Set the specific value. if ( is_null( $value ) ) { @@ -767,10 +767,10 @@ public function set_signature_item( $attachment_id, $type, $value = null ) { $value = $this->generate_type_signature( $type, $attachment_id ); } // Ensure we have an array. - if ( empty( $meta[ Sync::META_KEYS['cloudinary'] ][ Sync::META_KEYS['signature'] ] ) || ! is_array( $meta[ Sync::META_KEYS['cloudinary'] ][ Sync::META_KEYS['signature'] ] ) ) { - $meta[ Sync::META_KEYS['cloudinary'] ][ Sync::META_KEYS['signature'] ] = array(); + if ( empty( $meta[ self::META_KEYS['cloudinary'] ][ self::META_KEYS['signature'] ] ) || ! is_array( $meta[ self::META_KEYS['cloudinary'] ][ self::META_KEYS['signature'] ] ) ) { + $meta[ self::META_KEYS['cloudinary'] ][ self::META_KEYS['signature'] ] = array(); } - $meta[ Sync::META_KEYS['cloudinary'] ][ Sync::META_KEYS['signature'] ][ $type ] = $value; + $meta[ self::META_KEYS['cloudinary'] ][ self::META_KEYS['signature'] ][ $type ] = $value; wp_update_attachment_metadata( $attachment_id, $meta ); } diff --git a/php/connect/class-api.php b/php/connect/class-api.php index 27ce0434f..f9e76423e 100644 --- a/php/connect/class-api.php +++ b/php/connect/class-api.php @@ -59,43 +59,43 @@ class Api { */ public static $transformation_index = array( 'image' => array( - 'a' => 'angle', - 'ar' => 'aspect_ratio', - 'b' => 'background', - 'bo' => 'border', - 'c' => 'crop', - 'co' => 'color', - 'dpr' => 'dpr', - 'du' => 'duration', - 'e' => 'effect', - 'eo' => 'end_offset', - 'fl' => 'flags', - 'h' => 'height', - 'l' => 'overlay', - 'o' => 'opacity', - 'q' => 'quality', - 'r' => 'radius', - 'so' => 'start_offset', - 't' => 'named_transformation', - 'u' => 'underlay', - 'vc' => 'video_codec', - 'w' => 'width', - 'x' => 'x', - 'y' => 'y', - 'z' => 'zoom', - 'ac' => 'audio_codec', - 'af' => 'audio_frequency', - 'br' => 'bit_rate', - 'cs' => 'color_space', - 'd' => 'default_image', - 'dl' => 'delay', - 'dn' => 'density', - 'f' => 'fetch_format', - 'g' => 'gravity', - 'p' => 'prefix', - 'pg' => 'page', - 'sp' => 'streaming_profile', - 'vs' => 'video_sampling', + 'a' => 'angle', + 'ar' => 'aspect_ratio', + 'b' => 'background', + 'bo' => 'border', + 'c' => 'crop', + 'co' => 'color', + 'dpr' => 'dpr', + 'du' => 'duration', + 'e' => 'effect', + 'eo' => 'end_offset', + 'fl' => 'flags', + 'h' => 'height', + 'l' => 'overlay', + 'o' => 'opacity', + 'q' => 'quality', + 'r' => 'radius', + 'so' => 'start_offset', + 't' => 'named_transformation', + 'u' => 'underlay', + 'vc' => 'video_codec', + 'w' => 'width', + 'x' => 'x', + 'y' => 'y', + 'z' => 'zoom', + 'ac' => 'audio_codec', + 'af' => 'audio_frequency', + 'br' => 'bit_rate', + 'cs' => 'color_space', + 'd' => 'default_image', + 'dl' => 'delay', + 'dn' => 'density', + 'f' => 'fetch_format', + 'g' => 'gravity', + 'p' => 'prefix', + 'pg' => 'page', + 'sp' => 'streaming_profile', + 'vs' => 'video_sampling', ), 'video' => array( 'w' => 'width', @@ -137,7 +137,7 @@ class Api { * API constructor. * * @param \Cloudinary\Connect $connect The connect object. - * @param string The plugin version. + * @param string $version The plugin version. */ public function __construct( $connect, $version ) { $this->credentials = $connect->get_credentials(); @@ -228,7 +228,6 @@ function ( $item ) use ( $transformation_index ) { * @param string|null $public_id The Public ID to get a url for. * @param array $args Additional args. * @param array $size The WP Size array. - * @param bool $clean Flag to produce a non variable size url. * * @return string */ diff --git a/php/media/class-filter.php b/php/media/class-filter.php index 2837ca47a..0909b16ca 100644 --- a/php/media/class-filter.php +++ b/php/media/class-filter.php @@ -347,7 +347,7 @@ public function filter_out_local( $content ) { // Add in the class name. $new_tag = str_replace( '/>', ' class="wp-image-' . $attachment_id . '"/>', $new_tag ); } - // Apply lazy loading attribute + // Apply lazy loading attribute. if ( apply_filters( 'wp_lazy_loading_enabled', true ) && false === strpos( $new_tag, 'loading="lazy"' ) ) { $new_tag = str_replace( '/>', ' loading="lazy" />', $new_tag ); } @@ -381,7 +381,6 @@ public function filter_out_local( $content ) { * * @return array * @uses filter:wp_prepare_attachment_for_js - * */ public function filter_attachment_for_js( $attachment ) { $cloudinary_id = $this->media->get_cloudinary_id( $attachment['id'] ); @@ -424,7 +423,6 @@ public function filter_attachment_for_js( $attachment ) { * * @return \WP_REST_Response * @uses filter:rest_prepare_attachment - * */ public function filter_attachment_for_rest( $attachment ) { if ( ! isset( $attachment->data['id'] ) ) { @@ -437,7 +435,8 @@ public function filter_attachment_for_rest( $attachment ) { $attachment->data['source_url'] = $this->media->cloudinary_url( $attachment->data['id'], false ); } - if ( $has_transformations = ! empty( $this->media->get_transformation_from_meta( $attachment->data['id'] ) ) ) { + $has_transformations = ! empty( $this->media->get_transformation_from_meta( $attachment->data['id'] ) ); + if ( $has_transformations ) { $attachment->data['transformations'] = $has_transformations; } diff --git a/php/media/class-global-transformations.php b/php/media/class-global-transformations.php index 65ae8f5d2..93eb55e10 100644 --- a/php/media/class-global-transformations.php +++ b/php/media/class-global-transformations.php @@ -175,7 +175,7 @@ public function get_transformations( $type ) { // check screen context. switch ( $screen->base ) { case 'term': - $term_id = filter_input( INPUT_GET, 'tag_ID', FILTER_DEFAULT ); + $term_id = filter_input( INPUT_GET, 'tag_ID', FILTER_SANITIZE_NUMBER_INT ); $transformations = $this->get_term_transformations( $term_id, $type ); break; case 'toplevel_page_cloudinary': @@ -514,7 +514,7 @@ public function classic_overwrite_transformations_featured_image( $content, $pos /** * Updates appropriate meta for overwriting transformations of a featured image. * - * @param int $post_id + * @param int $post_id The post ID. */ public function save_overwrite_transformations_featured_image( $post_id ) { $field_value = filter_input( INPUT_POST, self::META_FEATURED_IMAGE_KEY, FILTER_VALIDATE_BOOLEAN ); diff --git a/php/media/class-upgrade.php b/php/media/class-upgrade.php index 2345583b2..b262832f5 100644 --- a/php/media/class-upgrade.php +++ b/php/media/class-upgrade.php @@ -73,7 +73,7 @@ public function convert_cloudinary_version( $attachment_id ) { $cloud_name = md5( $val ); continue; } - if ( in_array( $val, [ 'image', 'video', 'upload' ], true ) ) { + if ( in_array( $val, array( 'image', 'video', 'upload' ), true ) ) { continue; } $transformation_maybe = $media->get_transformations_from_string( $val ); @@ -144,13 +144,16 @@ public function setup_hooks() { // Add a redirection to the new plugin settings, from the old plugin. if ( is_admin() ) { - add_action( 'admin_menu', function () { - global $plugin_page; - if ( ! empty( $plugin_page ) && false !== strpos( $plugin_page, 'cloudinary-image-management-and-manipulation-in-the-cloud-cdn' ) ) { - wp_safe_redirect( admin_url( '?page=cloudinary' ) ); - die; - } - } ); + add_action( + 'admin_menu', + function () { + global $plugin_page; + if ( ! empty( $plugin_page ) && false !== strpos( $plugin_page, 'cloudinary-image-management-and-manipulation-in-the-cloud-cdn' ) ) { + wp_safe_redirect( admin_url( '?page=cloudinary' ) ); + die; + } + } + ); } } } diff --git a/php/media/class-video.php b/php/media/class-video.php index 4064385ed..36668df46 100644 --- a/php/media/class-video.php +++ b/php/media/class-video.php @@ -220,7 +220,7 @@ public function filter_video_shortcode( $html, $attr ) { if ( isset( $attr['autoplay'] ) ) { $args['autoplay'] = 'true' === $attr['autoplay']; - $args['muted'] = 'true' === $attr['autoplay']; + $args['muted'] = 'true' === $attr['autoplay']; } if ( isset( $attr['loop'] ) ) { $args['loop'] = 'true' === $attr['loop']; @@ -286,7 +286,7 @@ public function filter_video_tags( $content ) { // Enable Autoplay for this video. if ( false !== strpos( $tag, 'autoplay' ) ) { $args['autoplayMode'] = $this->config['video_autoplay_mode']; // if on, use defined mode. - $args['muted'] = 'always' === $this->config['video_autoplay_mode']; + $args['muted'] = 'always' === $this->config['video_autoplay_mode']; } // Enable Loop. if ( false !== strpos( $tag, 'loop' ) ) { @@ -312,7 +312,7 @@ public function filter_video_tags( $content ) { } $args['overwrite_transformations'] = $overwrite_transformations; - $cloudinary_url = $this->media->cloudinary_url( $attachment_id, false, false, null, $overwrite_transformations ); + $cloudinary_url = $this->media->cloudinary_url( $attachment_id, false, false, null, $overwrite_transformations ); // Bail replacing the video URL for cases where it doesn't exist. // Cases are, for instance, when the file size is larger than the API limits — free accounts. if ( ! empty( $cloudinary_url ) ) { @@ -354,7 +354,7 @@ public function print_video_scripts() { 'loop' => 'on' === $this->config['video_loop'] ? true : false, ); - $valid_autoplay_modes = [ 'never', 'always', 'on-scroll' ]; + $valid_autoplay_modes = array( 'never', 'always', 'on-scroll' ); if ( $default['autoplay'] && in_array( $this->config['video_autoplay_mode'], $valid_autoplay_modes, true ) ) { $default['autoplayMode'] = $this->config['video_autoplay_mode']; } @@ -365,7 +365,7 @@ public function print_video_scripts() { $config['fluid'] = true; } - $config['controls'] = 'on' === $this->config['video_controls'] ? true : false; + $config['controls'] = 'on' === $this->config['video_controls'] ? true : false; $cld_videos[ $instance ] = $config; } @@ -392,15 +392,15 @@ public function print_video_scripts() { if ( videoElement.length === 1 ) { videoElement = videoElement[0]; videoElement.style.width = '100%'; - config['video_freeform'] ): ?> + config['video_freeform'] ) : ?> if ( - videoElement.src.indexOf( 'config['video_freeform'] ) ?>' ) === -1 && + videoElement.src.indexOf( 'config['video_freeform'] ); ?>' ) === -1 && ! cldVideos[videoInstance]['overwrite_transformations'] ) { videoElement.src = videoElement.src.replace( 'upload/', - 'upload/config['video_freeform'] ) ?>/' + 'upload/config['video_freeform'] ); ?>/' ); } @@ -461,8 +461,7 @@ public function filter_video_block_pre_render( $block, $source_block ) { $content = str_replace( 'class="', 'class="' . $classes . ' ', $content ); } else { $content = str_replace( '
- disabled ) : ?> + disabled ) : ?> - +
@@ -95,8 +95,8 @@ diff --git a/ui-definitions/tabs/settings-sync-media.php b/ui-definitions/tabs/settings-sync-media.php index 883573a84..f4c89c020 100644 --- a/ui-definitions/tabs/settings-sync-media.php +++ b/ui-definitions/tabs/settings-sync-media.php @@ -4,6 +4,7 @@ * * @package Cloudinary */ + $dirs = wp_get_upload_dir(); $base = wp_parse_url( $dirs['baseurl'] ); @@ -18,10 +19,10 @@ 'description' => __( 'Auto Sync: Media is synchronized automatically on demand; Manual Sync: Manually synchronize assets from the Media page.', 'cloudinary' ), 'type' => 'radio', 'default' => 'on', - 'choices' => array( + 'choices' => array( 'on' => __( 'Auto Sync', 'cloudinary' ), 'off' => __( 'Manual Sync', 'cloudinary' ), - ) + ), ), 'cloudinary_folder' => array( 'label' => __( 'Cloudinary folder path', 'cloudinary' ), @@ -29,16 +30,16 @@ 'description' => __( 'Specify the folder in your Cloudinary account where WordPress assets are uploaded to. All assets uploaded to WordPress from this point on will be synced to the specified folder in Cloudinary. Leave blank to use the root of your Cloudinary library.', 'cloudinary' ), 'sanitize_callback' => array( '\Cloudinary\Media', 'sanitize_cloudinary_folder' ), ), - 'offload' => array( - 'label' => __( 'Storage', 'cloudinary' ), + 'offload' => array( + 'label' => __( 'Storage', 'cloudinary' ), 'description' => sprintf( // translators: Placeholders are tags. __( 'Choose where to store your assets. Assets stored in both Cloudinary and WordPress will enable local WordPress delivery if the Cloudinary plugin is disabled or uninstalled. Storing assets with WordPress in lower resolution will save on local WordPress storage and enable low resolution local WordPress delivery if the plugin is disabled. Storing assets with Cloudinary only will require additional steps to enable backwards compatibility. For help managing your storage, submit a %1$s support request.%2$s', 'cloudinary' ), '', '' ), - 'type' => 'select', - 'default' => 'dual_full', + 'type' => 'select', + 'default' => 'dual_full', 'choices' => array( 'dual_full' => __( 'Cloudinary and WordPress', 'cloudinary' ), 'dual_low' => __( 'Cloudinary and WordPress (low resolution)', 'cloudinary' ), diff --git a/ui-definitions/tabs/sync-media-content.php b/ui-definitions/tabs/sync-media-content.php index 8a5a57b09..a79351b1d 100644 --- a/ui-definitions/tabs/sync-media-content.php +++ b/ui-definitions/tabs/sync-media-content.php @@ -11,10 +11,10 @@ plugin->config['connect'] ) ) : ?>
- +