Version Description
Download this release
Release Info
| Developer | aidvu |
| Plugin | |
| Version | 0.4.6 |
| Comparing to | |
| See all releases | |
Code changes from version 0.4.4 to 0.4.6
- composer.json +7 -0
- composer.lock +340 -0
- dependency-path-mapping.php +3 -1
- page-optimize.php +1 -1
- phpunit.xml.dist +15 -0
- readme.txt +6 -2
- service.php +1 -1
- settings.php +2 -2
- tests/bootstrap.php +31 -0
- tests/data/url-to-file-mapping/content/exists +0 -0
- tests/data/url-to-file-mapping/content/plugins/exists +0 -0
- tests/data/url-to-file-mapping/plugins/exists +0 -0
- tests/data/url-to-file-mapping/site/content/exists +0 -0
- tests/data/url-to-file-mapping/site/content/plugins/exists +0 -0
- tests/data/url-to-file-mapping/site/exists +0 -0
- tests/data/url-to-file-mapping/site/plugins/exists +0 -0
- tests/test_URL_to_file_mapping.php +166 -0
composer.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"require-dev": {
|
| 3 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2",
|
| 4 |
+
"phpcompatibility/phpcompatibility-wp": "*",
|
| 5 |
+
"wp-coding-standards/wpcs": "^2.2"
|
| 6 |
+
}
|
| 7 |
+
}
|
composer.lock
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_readme": [
|
| 3 |
+
"This file locks the dependencies of your project to a known state",
|
| 4 |
+
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
| 5 |
+
"This file is @generated automatically"
|
| 6 |
+
],
|
| 7 |
+
"content-hash": "cfc0ae38ab4c4c74164edeab1a7beccd",
|
| 8 |
+
"packages": [],
|
| 9 |
+
"packages-dev": [
|
| 10 |
+
{
|
| 11 |
+
"name": "dealerdirect/phpcodesniffer-composer-installer",
|
| 12 |
+
"version": "v0.6.2",
|
| 13 |
+
"source": {
|
| 14 |
+
"type": "git",
|
| 15 |
+
"url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
|
| 16 |
+
"reference": "8001af8eb107fbfcedc31a8b51e20b07d85b457a"
|
| 17 |
+
},
|
| 18 |
+
"dist": {
|
| 19 |
+
"type": "zip",
|
| 20 |
+
"url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/8001af8eb107fbfcedc31a8b51e20b07d85b457a",
|
| 21 |
+
"reference": "8001af8eb107fbfcedc31a8b51e20b07d85b457a",
|
| 22 |
+
"shasum": ""
|
| 23 |
+
},
|
| 24 |
+
"require": {
|
| 25 |
+
"composer-plugin-api": "^1.0",
|
| 26 |
+
"php": "^5.3|^7",
|
| 27 |
+
"squizlabs/php_codesniffer": "^2|^3"
|
| 28 |
+
},
|
| 29 |
+
"require-dev": {
|
| 30 |
+
"composer/composer": "*",
|
| 31 |
+
"phpcompatibility/php-compatibility": "^9.0",
|
| 32 |
+
"sensiolabs/security-checker": "^4.1.0"
|
| 33 |
+
},
|
| 34 |
+
"type": "composer-plugin",
|
| 35 |
+
"extra": {
|
| 36 |
+
"class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
|
| 37 |
+
},
|
| 38 |
+
"autoload": {
|
| 39 |
+
"psr-4": {
|
| 40 |
+
"Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
|
| 41 |
+
}
|
| 42 |
+
},
|
| 43 |
+
"notification-url": "https://packagist.org/downloads/",
|
| 44 |
+
"license": [
|
| 45 |
+
"MIT"
|
| 46 |
+
],
|
| 47 |
+
"authors": [
|
| 48 |
+
{
|
| 49 |
+
"name": "Franck Nijhof",
|
| 50 |
+
"email": "franck.nijhof@dealerdirect.com",
|
| 51 |
+
"homepage": "http://www.frenck.nl",
|
| 52 |
+
"role": "Developer / IT Manager"
|
| 53 |
+
}
|
| 54 |
+
],
|
| 55 |
+
"description": "PHP_CodeSniffer Standards Composer Installer Plugin",
|
| 56 |
+
"homepage": "http://www.dealerdirect.com",
|
| 57 |
+
"keywords": [
|
| 58 |
+
"PHPCodeSniffer",
|
| 59 |
+
"PHP_CodeSniffer",
|
| 60 |
+
"code quality",
|
| 61 |
+
"codesniffer",
|
| 62 |
+
"composer",
|
| 63 |
+
"installer",
|
| 64 |
+
"phpcs",
|
| 65 |
+
"plugin",
|
| 66 |
+
"qa",
|
| 67 |
+
"quality",
|
| 68 |
+
"standard",
|
| 69 |
+
"standards",
|
| 70 |
+
"style guide",
|
| 71 |
+
"stylecheck",
|
| 72 |
+
"tests"
|
| 73 |
+
],
|
| 74 |
+
"time": "2020-01-29T20:22:20+00:00"
|
| 75 |
+
},
|
| 76 |
+
{
|
| 77 |
+
"name": "phpcompatibility/php-compatibility",
|
| 78 |
+
"version": "9.3.5",
|
| 79 |
+
"source": {
|
| 80 |
+
"type": "git",
|
| 81 |
+
"url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
|
| 82 |
+
"reference": "9fb324479acf6f39452e0655d2429cc0d3914243"
|
| 83 |
+
},
|
| 84 |
+
"dist": {
|
| 85 |
+
"type": "zip",
|
| 86 |
+
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243",
|
| 87 |
+
"reference": "9fb324479acf6f39452e0655d2429cc0d3914243",
|
| 88 |
+
"shasum": ""
|
| 89 |
+
},
|
| 90 |
+
"require": {
|
| 91 |
+
"php": ">=5.3",
|
| 92 |
+
"squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
|
| 93 |
+
},
|
| 94 |
+
"conflict": {
|
| 95 |
+
"squizlabs/php_codesniffer": "2.6.2"
|
| 96 |
+
},
|
| 97 |
+
"require-dev": {
|
| 98 |
+
"phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
|
| 99 |
+
},
|
| 100 |
+
"suggest": {
|
| 101 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
|
| 102 |
+
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
| 103 |
+
},
|
| 104 |
+
"type": "phpcodesniffer-standard",
|
| 105 |
+
"notification-url": "https://packagist.org/downloads/",
|
| 106 |
+
"license": [
|
| 107 |
+
"LGPL-3.0-or-later"
|
| 108 |
+
],
|
| 109 |
+
"authors": [
|
| 110 |
+
{
|
| 111 |
+
"name": "Wim Godden",
|
| 112 |
+
"homepage": "https://github.com/wimg",
|
| 113 |
+
"role": "lead"
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"name": "Juliette Reinders Folmer",
|
| 117 |
+
"homepage": "https://github.com/jrfnl",
|
| 118 |
+
"role": "lead"
|
| 119 |
+
},
|
| 120 |
+
{
|
| 121 |
+
"name": "Contributors",
|
| 122 |
+
"homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
|
| 123 |
+
}
|
| 124 |
+
],
|
| 125 |
+
"description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
|
| 126 |
+
"homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
|
| 127 |
+
"keywords": [
|
| 128 |
+
"compatibility",
|
| 129 |
+
"phpcs",
|
| 130 |
+
"standards"
|
| 131 |
+
],
|
| 132 |
+
"time": "2019-12-27T09:44:58+00:00"
|
| 133 |
+
},
|
| 134 |
+
{
|
| 135 |
+
"name": "phpcompatibility/phpcompatibility-paragonie",
|
| 136 |
+
"version": "1.3.0",
|
| 137 |
+
"source": {
|
| 138 |
+
"type": "git",
|
| 139 |
+
"url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git",
|
| 140 |
+
"reference": "b862bc32f7e860d0b164b199bd995e690b4b191c"
|
| 141 |
+
},
|
| 142 |
+
"dist": {
|
| 143 |
+
"type": "zip",
|
| 144 |
+
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/b862bc32f7e860d0b164b199bd995e690b4b191c",
|
| 145 |
+
"reference": "b862bc32f7e860d0b164b199bd995e690b4b191c",
|
| 146 |
+
"shasum": ""
|
| 147 |
+
},
|
| 148 |
+
"require": {
|
| 149 |
+
"phpcompatibility/php-compatibility": "^9.0"
|
| 150 |
+
},
|
| 151 |
+
"require-dev": {
|
| 152 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.5",
|
| 153 |
+
"paragonie/random_compat": "dev-master",
|
| 154 |
+
"paragonie/sodium_compat": "dev-master"
|
| 155 |
+
},
|
| 156 |
+
"suggest": {
|
| 157 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
|
| 158 |
+
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
| 159 |
+
},
|
| 160 |
+
"type": "phpcodesniffer-standard",
|
| 161 |
+
"notification-url": "https://packagist.org/downloads/",
|
| 162 |
+
"license": [
|
| 163 |
+
"LGPL-3.0-or-later"
|
| 164 |
+
],
|
| 165 |
+
"authors": [
|
| 166 |
+
{
|
| 167 |
+
"name": "Wim Godden",
|
| 168 |
+
"role": "lead"
|
| 169 |
+
},
|
| 170 |
+
{
|
| 171 |
+
"name": "Juliette Reinders Folmer",
|
| 172 |
+
"role": "lead"
|
| 173 |
+
}
|
| 174 |
+
],
|
| 175 |
+
"description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.",
|
| 176 |
+
"homepage": "http://phpcompatibility.com/",
|
| 177 |
+
"keywords": [
|
| 178 |
+
"compatibility",
|
| 179 |
+
"paragonie",
|
| 180 |
+
"phpcs",
|
| 181 |
+
"polyfill",
|
| 182 |
+
"standards"
|
| 183 |
+
],
|
| 184 |
+
"time": "2019-11-04T15:17:54+00:00"
|
| 185 |
+
},
|
| 186 |
+
{
|
| 187 |
+
"name": "phpcompatibility/phpcompatibility-wp",
|
| 188 |
+
"version": "2.1.0",
|
| 189 |
+
"source": {
|
| 190 |
+
"type": "git",
|
| 191 |
+
"url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
|
| 192 |
+
"reference": "41bef18ba688af638b7310666db28e1ea9158b2f"
|
| 193 |
+
},
|
| 194 |
+
"dist": {
|
| 195 |
+
"type": "zip",
|
| 196 |
+
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/41bef18ba688af638b7310666db28e1ea9158b2f",
|
| 197 |
+
"reference": "41bef18ba688af638b7310666db28e1ea9158b2f",
|
| 198 |
+
"shasum": ""
|
| 199 |
+
},
|
| 200 |
+
"require": {
|
| 201 |
+
"phpcompatibility/php-compatibility": "^9.0",
|
| 202 |
+
"phpcompatibility/phpcompatibility-paragonie": "^1.0"
|
| 203 |
+
},
|
| 204 |
+
"require-dev": {
|
| 205 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.5"
|
| 206 |
+
},
|
| 207 |
+
"suggest": {
|
| 208 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
|
| 209 |
+
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
| 210 |
+
},
|
| 211 |
+
"type": "phpcodesniffer-standard",
|
| 212 |
+
"notification-url": "https://packagist.org/downloads/",
|
| 213 |
+
"license": [
|
| 214 |
+
"LGPL-3.0-or-later"
|
| 215 |
+
],
|
| 216 |
+
"authors": [
|
| 217 |
+
{
|
| 218 |
+
"name": "Wim Godden",
|
| 219 |
+
"role": "lead"
|
| 220 |
+
},
|
| 221 |
+
{
|
| 222 |
+
"name": "Juliette Reinders Folmer",
|
| 223 |
+
"role": "lead"
|
| 224 |
+
}
|
| 225 |
+
],
|
| 226 |
+
"description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.",
|
| 227 |
+
"homepage": "http://phpcompatibility.com/",
|
| 228 |
+
"keywords": [
|
| 229 |
+
"compatibility",
|
| 230 |
+
"phpcs",
|
| 231 |
+
"standards",
|
| 232 |
+
"wordpress"
|
| 233 |
+
],
|
| 234 |
+
"time": "2019-08-28T14:22:28+00:00"
|
| 235 |
+
},
|
| 236 |
+
{
|
| 237 |
+
"name": "squizlabs/php_codesniffer",
|
| 238 |
+
"version": "3.5.4",
|
| 239 |
+
"source": {
|
| 240 |
+
"type": "git",
|
| 241 |
+
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
| 242 |
+
"reference": "dceec07328401de6211037abbb18bda423677e26"
|
| 243 |
+
},
|
| 244 |
+
"dist": {
|
| 245 |
+
"type": "zip",
|
| 246 |
+
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dceec07328401de6211037abbb18bda423677e26",
|
| 247 |
+
"reference": "dceec07328401de6211037abbb18bda423677e26",
|
| 248 |
+
"shasum": ""
|
| 249 |
+
},
|
| 250 |
+
"require": {
|
| 251 |
+
"ext-simplexml": "*",
|
| 252 |
+
"ext-tokenizer": "*",
|
| 253 |
+
"ext-xmlwriter": "*",
|
| 254 |
+
"php": ">=5.4.0"
|
| 255 |
+
},
|
| 256 |
+
"require-dev": {
|
| 257 |
+
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
|
| 258 |
+
},
|
| 259 |
+
"bin": [
|
| 260 |
+
"bin/phpcs",
|
| 261 |
+
"bin/phpcbf"
|
| 262 |
+
],
|
| 263 |
+
"type": "library",
|
| 264 |
+
"extra": {
|
| 265 |
+
"branch-alias": {
|
| 266 |
+
"dev-master": "3.x-dev"
|
| 267 |
+
}
|
| 268 |
+
},
|
| 269 |
+
"notification-url": "https://packagist.org/downloads/",
|
| 270 |
+
"license": [
|
| 271 |
+
"BSD-3-Clause"
|
| 272 |
+
],
|
| 273 |
+
"authors": [
|
| 274 |
+
{
|
| 275 |
+
"name": "Greg Sherwood",
|
| 276 |
+
"role": "lead"
|
| 277 |
+
}
|
| 278 |
+
],
|
| 279 |
+
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
|
| 280 |
+
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
|
| 281 |
+
"keywords": [
|
| 282 |
+
"phpcs",
|
| 283 |
+
"standards"
|
| 284 |
+
],
|
| 285 |
+
"time": "2020-01-30T22:20:29+00:00"
|
| 286 |
+
},
|
| 287 |
+
{
|
| 288 |
+
"name": "wp-coding-standards/wpcs",
|
| 289 |
+
"version": "2.2.1",
|
| 290 |
+
"source": {
|
| 291 |
+
"type": "git",
|
| 292 |
+
"url": "https://github.com/WordPress/WordPress-Coding-Standards.git",
|
| 293 |
+
"reference": "b5a453203114cc2284b1a614c4953456fbe4f546"
|
| 294 |
+
},
|
| 295 |
+
"dist": {
|
| 296 |
+
"type": "zip",
|
| 297 |
+
"url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/b5a453203114cc2284b1a614c4953456fbe4f546",
|
| 298 |
+
"reference": "b5a453203114cc2284b1a614c4953456fbe4f546",
|
| 299 |
+
"shasum": ""
|
| 300 |
+
},
|
| 301 |
+
"require": {
|
| 302 |
+
"php": ">=5.4",
|
| 303 |
+
"squizlabs/php_codesniffer": "^3.3.1"
|
| 304 |
+
},
|
| 305 |
+
"require-dev": {
|
| 306 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6",
|
| 307 |
+
"phpcompatibility/php-compatibility": "^9.0",
|
| 308 |
+
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
|
| 309 |
+
},
|
| 310 |
+
"suggest": {
|
| 311 |
+
"dealerdirect/phpcodesniffer-composer-installer": "^0.6 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
|
| 312 |
+
},
|
| 313 |
+
"type": "phpcodesniffer-standard",
|
| 314 |
+
"notification-url": "https://packagist.org/downloads/",
|
| 315 |
+
"license": [
|
| 316 |
+
"MIT"
|
| 317 |
+
],
|
| 318 |
+
"authors": [
|
| 319 |
+
{
|
| 320 |
+
"name": "Contributors",
|
| 321 |
+
"homepage": "https://github.com/WordPress/WordPress-Coding-Standards/graphs/contributors"
|
| 322 |
+
}
|
| 323 |
+
],
|
| 324 |
+
"description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions",
|
| 325 |
+
"keywords": [
|
| 326 |
+
"phpcs",
|
| 327 |
+
"standards",
|
| 328 |
+
"wordpress"
|
| 329 |
+
],
|
| 330 |
+
"time": "2020-02-04T02:52:06+00:00"
|
| 331 |
+
}
|
| 332 |
+
],
|
| 333 |
+
"aliases": [],
|
| 334 |
+
"minimum-stability": "stable",
|
| 335 |
+
"stability-flags": [],
|
| 336 |
+
"prefer-stable": false,
|
| 337 |
+
"prefer-lowest": false,
|
| 338 |
+
"platform": [],
|
| 339 |
+
"platform-dev": []
|
| 340 |
+
}
|
dependency-path-mapping.php
CHANGED
|
@@ -29,7 +29,8 @@ class Page_Optimize_Dependency_Path_Mapping {
|
|
| 29 |
if ( null === $site_url ) {
|
| 30 |
$site_url = is_multisite() ? get_site_url( get_current_blog_id() ) : get_site_url();
|
| 31 |
}
|
| 32 |
-
$
|
|
|
|
| 33 |
$this->site_uri_path = parse_url( $site_url, PHP_URL_PATH );
|
| 34 |
$this->site_dir = trailingslashit( $site_dir );
|
| 35 |
|
|
@@ -70,6 +71,7 @@ class Page_Optimize_Dependency_Path_Mapping {
|
|
| 70 |
if ( empty( $src_parts['host'] ) ) {
|
| 71 |
// With no host, this is a path relative to the WordPress root
|
| 72 |
$fs_path = "{$this->site_dir}{$path}";
|
|
|
|
| 73 |
return file_exists( $fs_path ) ? $fs_path : false;
|
| 74 |
}
|
| 75 |
|
| 29 |
if ( null === $site_url ) {
|
| 30 |
$site_url = is_multisite() ? get_site_url( get_current_blog_id() ) : get_site_url();
|
| 31 |
}
|
| 32 |
+
$site_url = trailingslashit( $site_url );
|
| 33 |
+
$this->site_url = $site_url;
|
| 34 |
$this->site_uri_path = parse_url( $site_url, PHP_URL_PATH );
|
| 35 |
$this->site_dir = trailingslashit( $site_dir );
|
| 36 |
|
| 71 |
if ( empty( $src_parts['host'] ) ) {
|
| 72 |
// With no host, this is a path relative to the WordPress root
|
| 73 |
$fs_path = "{$this->site_dir}{$path}";
|
| 74 |
+
|
| 75 |
return file_exists( $fs_path ) ? $fs_path : false;
|
| 76 |
}
|
| 77 |
|
page-optimize.php
CHANGED
|
@@ -4,7 +4,7 @@ Plugin Name: Page Optimize
|
|
| 4 |
Plugin URI: https://wordpress.org/plugins/page-optimize/
|
| 5 |
Description: Optimizes JS and CSS for faster page load and render in the browser.
|
| 6 |
Author: Automattic
|
| 7 |
-
Version: 0.4.
|
| 8 |
Author URI: http://automattic.com/
|
| 9 |
*/
|
| 10 |
|
| 4 |
Plugin URI: https://wordpress.org/plugins/page-optimize/
|
| 5 |
Description: Optimizes JS and CSS for faster page load and render in the browser.
|
| 6 |
Author: Automattic
|
| 7 |
+
Version: 0.4.6
|
| 8 |
Author URI: http://automattic.com/
|
| 9 |
*/
|
| 10 |
|
phpunit.xml.dist
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<phpunit
|
| 3 |
+
bootstrap="tests/bootstrap.php"
|
| 4 |
+
backupGlobals="false"
|
| 5 |
+
colors="true"
|
| 6 |
+
convertErrorsToExceptions="true"
|
| 7 |
+
convertNoticesToExceptions="true"
|
| 8 |
+
convertWarningsToExceptions="true"
|
| 9 |
+
>
|
| 10 |
+
<testsuites>
|
| 11 |
+
<testsuite>
|
| 12 |
+
<directory prefix="test_" suffix=".php">./tests/</directory>
|
| 13 |
+
</testsuite>
|
| 14 |
+
</testsuites>
|
| 15 |
+
</phpunit>
|
readme.txt
CHANGED
|
@@ -3,8 +3,8 @@ Contributors: aidvu, bpayton
|
|
| 3 |
Tags: performance
|
| 4 |
Requires at least: 5.3
|
| 5 |
Tested up to: 5.3
|
| 6 |
-
Requires PHP: 7.
|
| 7 |
-
Stable tag: 0.4.
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -49,6 +49,10 @@ Supported query params:
|
|
| 49 |
|
| 50 |
== Changelog ==
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
= 0.4.4 =
|
| 53 |
* Don't queue the cache cleaning WP Cron job if we aren't caching.
|
| 54 |
* Cleanup cache if we turned caching off or directory changed.
|
| 3 |
Tags: performance
|
| 4 |
Requires at least: 5.3
|
| 5 |
Tested up to: 5.3
|
| 6 |
+
Requires PHP: 7.0
|
| 7 |
+
Stable tag: 0.4.6
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 49 |
|
| 50 |
== Changelog ==
|
| 51 |
|
| 52 |
+
= 0.4.5, 0.4.6 =
|
| 53 |
+
* Force absolute paths for CSS replacements.
|
| 54 |
+
* Lower required PHP version to 7.0.
|
| 55 |
+
|
| 56 |
= 0.4.4 =
|
| 57 |
* Don't queue the cache cleaning WP Cron job if we aren't caching.
|
| 58 |
* Cleanup cache if we turned caching off or directory changed.
|
service.php
CHANGED
|
@@ -188,7 +188,7 @@ function page_optimize_build_output() {
|
|
| 188 |
}
|
| 189 |
|
| 190 |
if ( 'text/css' == $mime_type ) {
|
| 191 |
-
$dirpath = $subdir_path_prefix . dirname( $uri );
|
| 192 |
|
| 193 |
// url(relative/path/to/file) -> url(/absolute/and/not/relative/path/to/file)
|
| 194 |
$buf = page_optimize_relative_path_replace( $buf, $dirpath );
|
| 188 |
}
|
| 189 |
|
| 190 |
if ( 'text/css' == $mime_type ) {
|
| 191 |
+
$dirpath = '/' . ltrim( $subdir_path_prefix . dirname( $uri ), '/' );
|
| 192 |
|
| 193 |
// url(relative/path/to/file) -> url(/absolute/and/not/relative/path/to/file)
|
| 194 |
$buf = page_optimize_relative_path_replace( $buf, $dirpath );
|
settings.php
CHANGED
|
@@ -65,7 +65,7 @@ function page_optimize_settings_field_js_load_mode( $args ) {
|
|
| 65 |
</label>
|
| 66 |
|
| 67 |
<p class="description">
|
| 68 |
-
<?php _e( 'You can choose the execution mode of the concatenated JavaScript. This option might break your site, so use carefully
|
| 69 |
</p>
|
| 70 |
</fieldset>
|
| 71 |
<?php
|
|
@@ -169,7 +169,7 @@ function page_optimize_settings_init() {
|
|
| 169 |
);
|
| 170 |
add_settings_field(
|
| 171 |
'page_optimize_js_load_mode',
|
| 172 |
-
__( 'Non-critical script execution mode', page_optimize_get_text_domain() ),
|
| 173 |
'page_optimize_settings_field_js_load_mode',
|
| 174 |
'page-optimize',
|
| 175 |
'page_optimize_settings_section'
|
| 65 |
</label>
|
| 66 |
|
| 67 |
<p class="description">
|
| 68 |
+
<?php _e( 'You can choose the execution mode of the concatenated JavaScript. <strong>This option might break your site, so use carefully.</strong>', page_optimize_get_text_domain() ); ?>
|
| 69 |
</p>
|
| 70 |
</fieldset>
|
| 71 |
<?php
|
| 169 |
);
|
| 170 |
add_settings_field(
|
| 171 |
'page_optimize_js_load_mode',
|
| 172 |
+
__( 'Non-critical script execution mode (experimental)', page_optimize_get_text_domain() ),
|
| 173 |
'page_optimize_settings_field_js_load_mode',
|
| 174 |
'page-optimize',
|
| 175 |
'page_optimize_settings_section'
|
tests/bootstrap.php
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* PHPUnit bootstrap file
|
| 4 |
+
*
|
| 5 |
+
* @package Page_Optimize
|
| 6 |
+
*/
|
| 7 |
+
|
| 8 |
+
$_tests_dir = getenv( 'WP_TESTS_DIR' );
|
| 9 |
+
|
| 10 |
+
if ( ! $_tests_dir ) {
|
| 11 |
+
$_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib';
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) {
|
| 15 |
+
echo "Could not find $_tests_dir/includes/functions.php, have you run bin/install-wp-tests.sh ?" . PHP_EOL; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
| 16 |
+
exit( 1 );
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
// Give access to tests_add_filter() function.
|
| 20 |
+
require_once $_tests_dir . '/includes/functions.php';
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* Manually load the plugin being tested.
|
| 24 |
+
*/
|
| 25 |
+
function _manually_load_plugin() {
|
| 26 |
+
require dirname( dirname( __FILE__ ) ) . '/page-optimize.php';
|
| 27 |
+
}
|
| 28 |
+
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
|
| 29 |
+
|
| 30 |
+
// Start up the WP testing environment.
|
| 31 |
+
require $_tests_dir . '/includes/bootstrap.php';
|
tests/data/url-to-file-mapping/content/exists
ADDED
|
File without changes
|
tests/data/url-to-file-mapping/content/plugins/exists
ADDED
|
File without changes
|
tests/data/url-to-file-mapping/plugins/exists
ADDED
|
File without changes
|
tests/data/url-to-file-mapping/site/content/exists
ADDED
|
File without changes
|
tests/data/url-to-file-mapping/site/content/plugins/exists
ADDED
|
File without changes
|
tests/data/url-to-file-mapping/site/exists
ADDED
|
File without changes
|
tests/data/url-to-file-mapping/site/plugins/exists
ADDED
|
File without changes
|
tests/test_URL_to_file_mapping.php
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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PHPUnit\Framework\TestCase {
|
| 6 |
+
// TODO: URL without host is based on ABSPATH
|
| 7 |
+
// TODO: Separate plugin URL with site URL host. Exist/non-exist
|
| 8 |
+
// TODO: Separate content URL with site URL host. Exist/non-exist
|
| 9 |
+
// TODO: Site root URL. Exist/non-exist
|
| 10 |
+
// TODO: Plugin URL under content URL dir but separate from site URL. Same host as site URL.
|
| 11 |
+
// TODO: Plugin URL under content URL which is under site URL. Same host as site URL.
|
| 12 |
+
// TODO: Content URL descended from site URL
|
| 13 |
+
// TODO: Plugin URL with different host than site URL
|
| 14 |
+
// TODO: Content URL with different host than site URL
|
| 15 |
+
// TODO: Relative URLs
|
| 16 |
+
|
| 17 |
+
function test_abspath_resolution() {
|
| 18 |
+
$site_url = 'https://example.com/site';
|
| 19 |
+
$site_dir = __DIR__ . '/data/url-to-file-mapping/site';
|
| 20 |
+
$content_url = 'https://example.com/site/wp-content';
|
| 21 |
+
$content_dir = "$site_dir/content";
|
| 22 |
+
$plugin_url = 'https://example.com/site/wp-content/plugins';
|
| 23 |
+
$plugin_dir = "$content_dir/plugin";
|
| 24 |
+
|
| 25 |
+
$dpm = new Page_Optimize_Dependency_Path_Mapping(
|
| 26 |
+
$site_url,
|
| 27 |
+
$site_dir,
|
| 28 |
+
$content_url,
|
| 29 |
+
$content_dir,
|
| 30 |
+
$plugin_url,
|
| 31 |
+
$plugin_dir
|
| 32 |
+
);
|
| 33 |
+
|
| 34 |
+
// TODO: Remove this call to realpath() when we fix dependency_src_to_fs_path() to stop doubling path separators
|
| 35 |
+
$this->assertEquals( "$site_dir/exists", realpath( $dpm->dependency_src_to_fs_path( '/exists' ) ) );
|
| 36 |
+
$this->assertFalse( $dpm->dependency_src_to_fs_path( '/nonexistent' ) );
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
class Test_URI_Path_To_File_Mapping extends PHPUnit\Framework\TestCase {
|
| 41 |
+
|
| 42 |
+
// TODO: Test URI and FS paths with and without trailing slashes
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* @dataProvider provide_test_data
|
| 46 |
+
* @test
|
| 47 |
+
*/
|
| 48 |
+
function run_test(
|
| 49 |
+
$label,
|
| 50 |
+
$site_host,
|
| 51 |
+
$site_uri_path,
|
| 52 |
+
$site_dir,
|
| 53 |
+
$content_host,
|
| 54 |
+
$content_uri_path,
|
| 55 |
+
$content_dir,
|
| 56 |
+
$plugin_host,
|
| 57 |
+
$plugin_uri_path,
|
| 58 |
+
$plugin_dir
|
| 59 |
+
) {
|
| 60 |
+
$site_url = "{$site_host}{$site_uri_path}";
|
| 61 |
+
$content_url = "{$content_host}{$content_uri_path}";
|
| 62 |
+
$plugin_url = "{$plugin_host}{$plugin_uri_path}";
|
| 63 |
+
|
| 64 |
+
$root = __DIR__ . '/data/url-to-file-mapping';
|
| 65 |
+
$site_dir = "{$root}{$site_dir}";
|
| 66 |
+
$content_dir = "{$root}{$content_dir}";
|
| 67 |
+
$plugin_dir = "{$root}{$plugin_dir}";
|
| 68 |
+
|
| 69 |
+
$dpm = new Page_Optimize_Dependency_Path_Mapping(
|
| 70 |
+
$site_url,
|
| 71 |
+
$site_dir,
|
| 72 |
+
$content_url,
|
| 73 |
+
$content_dir,
|
| 74 |
+
$plugin_url,
|
| 75 |
+
$plugin_dir
|
| 76 |
+
);
|
| 77 |
+
|
| 78 |
+
$this->assertEquals( "$site_dir/exists", $dpm->uri_path_to_fs_path( "$site_uri_path/exists" ), "$label: Cannot find file based on site URI path" );
|
| 79 |
+
$this->assertFalse( $dpm->uri_path_to_fs_path( "$site_uri_path/nonexistent" ), "$label: Should have failed for nonexistent file based on site URI path" );
|
| 80 |
+
|
| 81 |
+
$actual_content_path = $dpm->uri_path_to_fs_path( "$content_uri_path/exists" );
|
| 82 |
+
if ( 0 === strpos( $content_url, $site_url ) ) {
|
| 83 |
+
// Content is under site URL. We expect this path to resolve.
|
| 84 |
+
$this->assertEquals( "$content_dir/exists", $actual_content_path, "$label: Cannot find file based on content URI path" );
|
| 85 |
+
} else {
|
| 86 |
+
// Content is not under site URL. We expect a resolution failure.
|
| 87 |
+
$this->assertFalse( $actual_content_path, "$label: Should have failed for content URI path outside of site URL" );
|
| 88 |
+
}
|
| 89 |
+
$this->assertFalse( $dpm->uri_path_to_fs_path( "$content_uri_path/nonexistent" ), "$label: Should have failed for nonexistent file based on content URI path" );
|
| 90 |
+
|
| 91 |
+
$actual_plugin_path = $dpm->uri_path_to_fs_path( "$plugin_uri_path/exists" );
|
| 92 |
+
if ( 0 === strpos( $plugin_url, $site_url ) ) {
|
| 93 |
+
// Plugins are under site URL. We expect this path to resolve.
|
| 94 |
+
$this->assertEquals( "$plugin_dir/exists", $actual_plugin_path, "$label: Cannot find file based on plugin URI path" );
|
| 95 |
+
} else {
|
| 96 |
+
// Plugins are not under site URL. We expect a resolution failure.
|
| 97 |
+
$this->assertFalse( $actual_plugin_path, "$label: Should have failed for plugin URI path outside of site URL" );
|
| 98 |
+
}
|
| 99 |
+
$this->assertFalse( $dpm->uri_path_to_fs_path( "$plugin_uri_path/nonexistent" ), "$label: Should have failed for nonexistent file based on plugin URI path" );
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
function provide_test_data() {
|
| 103 |
+
return array(
|
| 104 |
+
array(
|
| 105 |
+
'Nested site->content->plugin dirs',
|
| 106 |
+
'https://example.com',
|
| 107 |
+
'/subdir',
|
| 108 |
+
'/site',
|
| 109 |
+
'https://example.com',
|
| 110 |
+
'/subdir/wp-content',
|
| 111 |
+
'/site/content',
|
| 112 |
+
'https://example.com',
|
| 113 |
+
'/subdir/wp-content/plugins',
|
| 114 |
+
'/site/content/plugins',
|
| 115 |
+
),
|
| 116 |
+
array(
|
| 117 |
+
'Nested content->plugin dirs, separate from ABSPATH',
|
| 118 |
+
'https://example.com',
|
| 119 |
+
'/subdir',
|
| 120 |
+
'/site',
|
| 121 |
+
'https://example.com',
|
| 122 |
+
'/subdir/wp-content',
|
| 123 |
+
'/content',
|
| 124 |
+
'https://example.com',
|
| 125 |
+
'/subdir/wp-content/plugins',
|
| 126 |
+
'/content/plugins'
|
| 127 |
+
),
|
| 128 |
+
array(
|
| 129 |
+
'Content and plugin dirs separate from ABSPATH and each other',
|
| 130 |
+
'https://example.com',
|
| 131 |
+
'/subdir',
|
| 132 |
+
'/site',
|
| 133 |
+
'https://example.com',
|
| 134 |
+
'/subdir/wp-content',
|
| 135 |
+
'/content',
|
| 136 |
+
'https://example.com',
|
| 137 |
+
'/subdir/wp-content/plugins',
|
| 138 |
+
'/plugins'
|
| 139 |
+
),
|
| 140 |
+
array(
|
| 141 |
+
'Content and plugin URLs have same host but are not under the site URL',
|
| 142 |
+
'https://example.com',
|
| 143 |
+
'/subdir',
|
| 144 |
+
'/site',
|
| 145 |
+
'https://example.com',
|
| 146 |
+
'/wp-content', // Not descended from site URL path
|
| 147 |
+
'/site/content',
|
| 148 |
+
'https://example.com',
|
| 149 |
+
'/wp-content/plugins', // Not descended from site URL path
|
| 150 |
+
'/site/content/plugins'
|
| 151 |
+
),
|
| 152 |
+
array(
|
| 153 |
+
'Content and plugin URLs have different host from site URL',
|
| 154 |
+
'https://example.com',
|
| 155 |
+
'/subdir',
|
| 156 |
+
'/site',
|
| 157 |
+
'https://example.com:1234',
|
| 158 |
+
'/subdir/wp-content',
|
| 159 |
+
'/site/content',
|
| 160 |
+
'https://other1.com',
|
| 161 |
+
'/subdir/wp-content/plugins',
|
| 162 |
+
'/site/content/plugins',
|
| 163 |
+
),
|
| 164 |
+
);
|
| 165 |
+
}
|
| 166 |
+
}
|
