diff --git a/composer.json b/composer.json
index 89f435c9..abac4455 100644
--- a/composer.json
+++ b/composer.json
@@ -11,14 +11,14 @@
"sergeytsalkov/meekrodb": "^2.3",
"league/plates": "^3.3",
"guzzlehttp/guzzle": "^6.3",
- "scssphp/scssphp": "^1.0",
+ "leafo/scssphp": "^0.7.5",
"monolog/monolog": "^1.23",
"firephp/firephp-core": "^0.4.0",
"vlucas/valitron": "^1.4",
"php-extended/php-tail": "^2.1",
"pguardiario/phpuri": "^1.0",
"symfony/lock": "^4.1",
- "ezyang/htmlpurifier": "^4.12",
+ "ezyang/htmlpurifier": "^4.10",
"xemlock/htmlpurifier-html5": "^0.1.7",
"catfan/medoo": "^1.5"
},
diff --git a/composer.lock b/composer.lock
index 40782c04..38688521 100644
--- a/composer.lock
+++ b/composer.lock
@@ -1,10 +1,10 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
- "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "content-hash": "b3449508d08a0a23e0b942d060b5b5b1",
+ "content-hash": "3fceaf3c2925068c7e757ab12036e29e",
"packages": [
{
"name": "brandonwamboldt/utilphp",
@@ -54,16 +54,16 @@
},
{
"name": "catfan/medoo",
- "version": "v1.7.8",
+ "version": "v1.5.7",
"source": {
"type": "git",
"url": "https://github.com/catfan/Medoo.git",
- "reference": "dd9d570584cfb1e09ec470608479b86e41d5b60d"
+ "reference": "8d90cba0e8ff176028847527d0ea76fe41a06ecf"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/catfan/Medoo/zipball/dd9d570584cfb1e09ec470608479b86e41d5b60d",
- "reference": "dd9d570584cfb1e09ec470608479b86e41d5b60d",
+ "url": "https://api.github.com/repos/catfan/Medoo/zipball/8d90cba0e8ff176028847527d0ea76fe41a06ecf",
+ "reference": "8d90cba0e8ff176028847527d0ea76fe41a06ecf",
"shasum": ""
},
"require": {
@@ -77,7 +77,7 @@
"ext-pdo_oci8": "For Oracle version 8 database",
"ext-pdo_pqsql": "For PostgreSQL database",
"ext-pdo_sqlite": "For SQLite database",
- "ext-pdo_sqlsrv": "For MSSQL database on both Window/Liunx platform"
+ "ext-pdo_sqlsrv": "For MSSQL database"
},
"type": "framework",
"autoload": {
@@ -95,11 +95,10 @@
"email": "angel@catfan.me"
}
],
- "description": "The lightweight PHP database framework to accelerate development",
+ "description": "The lightest PHP database framework to accelerate development",
"homepage": "https://medoo.in",
"keywords": [
"database",
- "database library",
"lightweight",
"mariadb",
"mssql",
@@ -110,27 +109,27 @@
"sql",
"sqlite"
],
- "time": "2019-12-19T05:04:34+00:00"
+ "time": "2018-06-14T18:59:08+00:00"
},
{
"name": "ezyang/htmlpurifier",
- "version": "v4.12.0",
+ "version": "v4.10.0",
"source": {
"type": "git",
"url": "https://github.com/ezyang/htmlpurifier.git",
- "reference": "a617e55bc62a87eec73bd456d146d134ad716f03"
+ "reference": "d85d39da4576a6934b72480be6978fb10c860021"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/a617e55bc62a87eec73bd456d146d134ad716f03",
- "reference": "a617e55bc62a87eec73bd456d146d134ad716f03",
+ "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/d85d39da4576a6934b72480be6978fb10c860021",
+ "reference": "d85d39da4576a6934b72480be6978fb10c860021",
"shasum": ""
},
"require": {
"php": ">=5.2"
},
"require-dev": {
- "simpletest/simpletest": "dev-master#72de02a7b80c6bb8864ef9bf66d41d2f58f826bd"
+ "simpletest/simpletest": "^1.1"
},
"type": "library",
"autoload": {
@@ -143,7 +142,7 @@
},
"notification-url": "https://packagist.org/downloads/",
"license": [
- "LGPL-2.1-or-later"
+ "LGPL"
],
"authors": [
{
@@ -157,7 +156,7 @@
"keywords": [
"html"
],
- "time": "2019-10-28T03:44:26+00:00"
+ "time": "2018-02-23T01:58:20+00:00"
},
{
"name": "firephp/firephp-core",
@@ -197,46 +196,44 @@
},
{
"name": "guzzlehttp/guzzle",
- "version": "6.5.2",
+ "version": "6.3.3",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
- "reference": "43ece0e75098b7ecd8d13918293029e555a50f82"
+ "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/43ece0e75098b7ecd8d13918293029e555a50f82",
- "reference": "43ece0e75098b7ecd8d13918293029e555a50f82",
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba",
+ "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba",
"shasum": ""
},
"require": {
- "ext-json": "*",
"guzzlehttp/promises": "^1.0",
- "guzzlehttp/psr7": "^1.6.1",
+ "guzzlehttp/psr7": "^1.4",
"php": ">=5.5"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
- "psr/log": "^1.1"
+ "psr/log": "^1.0"
},
"suggest": {
- "ext-intl": "Required for Internationalized Domain Name (IDN) support",
"psr/log": "Required for using the Log middleware"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "6.5-dev"
+ "dev-master": "6.3-dev"
}
},
"autoload": {
- "psr-4": {
- "GuzzleHttp\\": "src/"
- },
"files": [
"src/functions_include.php"
- ]
+ ],
+ "psr-4": {
+ "GuzzleHttp\\": "src/"
+ }
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -260,7 +257,7 @@
"rest",
"web service"
],
- "time": "2019-12-23T11:57:10+00:00"
+ "time": "2018-04-22T15:46:56+00:00"
},
{
"name": "guzzlehttp/promises",
@@ -315,37 +312,32 @@
},
{
"name": "guzzlehttp/psr7",
- "version": "1.6.1",
+ "version": "1.4.2",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
- "reference": "239400de7a173fe9901b9ac7c06497751f00727a"
+ "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a",
- "reference": "239400de7a173fe9901b9ac7c06497751f00727a",
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
+ "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
"shasum": ""
},
"require": {
"php": ">=5.4.0",
- "psr/http-message": "~1.0",
- "ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
+ "psr/http-message": "~1.0"
},
"provide": {
"psr/http-message-implementation": "1.0"
},
"require-dev": {
- "ext-zlib": "*",
- "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8"
- },
- "suggest": {
- "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses"
+ "phpunit/phpunit": "~4.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.6-dev"
+ "dev-master": "1.4-dev"
}
},
"autoload": {
@@ -375,14 +367,65 @@
"keywords": [
"http",
"message",
- "psr-7",
"request",
"response",
"stream",
"uri",
"url"
],
- "time": "2019-07-01T23:21:34+00:00"
+ "time": "2017-03-20T17:10:46+00:00"
+ },
+ {
+ "name": "leafo/scssphp",
+ "version": "v0.7.7",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/leafo/scssphp.git",
+ "reference": "1d656f8c02a3a69404bba6b28ec4e06edddf0f49"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/leafo/scssphp/zipball/1d656f8c02a3a69404bba6b28ec4e06edddf0f49",
+ "reference": "1d656f8c02a3a69404bba6b28ec4e06edddf0f49",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.6",
+ "squizlabs/php_codesniffer": "~2.5"
+ },
+ "bin": [
+ "bin/pscss"
+ ],
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Leafo\\ScssPhp\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Leaf Corcoran",
+ "email": "leafot@gmail.com",
+ "homepage": "http://leafo.net"
+ }
+ ],
+ "description": "scssphp is a compiler for SCSS written in PHP.",
+ "homepage": "http://leafo.github.io/scssphp/",
+ "keywords": [
+ "css",
+ "less",
+ "sass",
+ "scss",
+ "stylesheet"
+ ],
+ "time": "2018-07-22T01:22:08+00:00"
},
{
"name": "league/plates",
@@ -441,16 +484,16 @@
},
{
"name": "monolog/monolog",
- "version": "1.25.3",
+ "version": "1.23.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
- "reference": "fa82921994db851a8becaf3787a9e73c5976b6f1"
+ "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fa82921994db851a8becaf3787a9e73c5976b6f1",
- "reference": "fa82921994db851a8becaf3787a9e73c5976b6f1",
+ "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4",
+ "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4",
"shasum": ""
},
"require": {
@@ -515,7 +558,7 @@
"logging",
"psr-3"
],
- "time": "2019-12-20T14:15:16+00:00"
+ "time": "2017-06-19T01:22:40+00:00"
},
{
"name": "pguardiario/phpuri",
@@ -677,16 +720,16 @@
},
{
"name": "psr/log",
- "version": "1.1.2",
+ "version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
- "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801"
+ "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801",
- "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
+ "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"shasum": ""
},
"require": {
@@ -695,7 +738,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.1.x-dev"
+ "dev-master": "1.0.x-dev"
}
},
"autoload": {
@@ -720,108 +763,7 @@
"psr",
"psr-3"
],
- "time": "2019-11-01T11:05:21+00:00"
- },
- {
- "name": "ralouphie/getallheaders",
- "version": "3.0.3",
- "source": {
- "type": "git",
- "url": "https://github.com/ralouphie/getallheaders.git",
- "reference": "120b605dfeb996808c31b6477290a714d356e822"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
- "reference": "120b605dfeb996808c31b6477290a714d356e822",
- "shasum": ""
- },
- "require": {
- "php": ">=5.6"
- },
- "require-dev": {
- "php-coveralls/php-coveralls": "^2.1",
- "phpunit/phpunit": "^5 || ^6.5"
- },
- "type": "library",
- "autoload": {
- "files": [
- "src/getallheaders.php"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Ralph Khattar",
- "email": "ralph.khattar@gmail.com"
- }
- ],
- "description": "A polyfill for getallheaders.",
- "time": "2019-03-08T08:55:37+00:00"
- },
- {
- "name": "scssphp/scssphp",
- "version": "1.0.6",
- "source": {
- "type": "git",
- "url": "https://github.com/scssphp/scssphp.git",
- "reference": "5b3c9d704950d8f9637f5110c36c281ec47dc13c"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/scssphp/scssphp/zipball/5b3c9d704950d8f9637f5110c36c281ec47dc13c",
- "reference": "5b3c9d704950d8f9637f5110c36c281ec47dc13c",
- "shasum": ""
- },
- "require": {
- "ext-ctype": "*",
- "ext-json": "*",
- "php": ">=5.6.0"
- },
- "require-dev": {
- "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.3",
- "squizlabs/php_codesniffer": "~2.5",
- "twbs/bootstrap": "~4.3",
- "zurb/foundation": "~6.5"
- },
- "bin": [
- "bin/pscss"
- ],
- "type": "library",
- "autoload": {
- "psr-4": {
- "ScssPhp\\ScssPhp\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Anthon Pang",
- "email": "apang@softwaredevelopment.ca",
- "homepage": "https://github.com/robocoder"
- },
- {
- "name": "Cédric Morin",
- "email": "cedric@yterium.com",
- "homepage": "https://github.com/Cerdic"
- }
- ],
- "description": "scssphp is a compiler for SCSS written in PHP.",
- "homepage": "http://scssphp.github.io/scssphp/",
- "keywords": [
- "css",
- "less",
- "sass",
- "scss",
- "stylesheet"
- ],
- "time": "2019-12-12T05:00:52+00:00"
+ "time": "2016-10-10T12:19:37+00:00"
},
{
"name": "sergeytsalkov/meekrodb",
@@ -868,34 +810,29 @@
},
{
"name": "symfony/lock",
- "version": "v4.4.3",
+ "version": "v4.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/lock.git",
- "reference": "6c4f5b620871cfef5b004fc57f2ca74572ae03b3"
+ "reference": "d508b5dd92272cb74300396ecaadde969d0f7976"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/lock/zipball/6c4f5b620871cfef5b004fc57f2ca74572ae03b3",
- "reference": "6c4f5b620871cfef5b004fc57f2ca74572ae03b3",
+ "url": "https://api.github.com/repos/symfony/lock/zipball/d508b5dd92272cb74300396ecaadde969d0f7976",
+ "reference": "d508b5dd92272cb74300396ecaadde969d0f7976",
"shasum": ""
},
"require": {
"php": "^7.1.3",
"psr/log": "~1.0"
},
- "conflict": {
- "doctrine/dbal": "<2.5"
- },
"require-dev": {
- "doctrine/dbal": "~2.5",
- "mongodb/mongodb": "~1.1",
"predis/predis": "~1.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "4.4-dev"
+ "dev-master": "4.1-dev"
}
},
"autoload": {
@@ -911,13 +848,13 @@
"MIT"
],
"authors": [
- {
- "name": "Jérémy Derussé",
- "email": "jeremy@derusse.com"
- },
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
+ },
+ {
+ "name": "Jérémy Derussé",
+ "email": "jeremy@derusse.com"
}
],
"description": "Symfony Lock Component",
@@ -930,20 +867,20 @@
"redlock",
"semaphore"
],
- "time": "2020-01-04T13:00:46+00:00"
+ "time": "2018-06-21T11:15:46+00:00"
},
{
"name": "vlucas/valitron",
- "version": "v1.4.7",
+ "version": "v1.4.3",
"source": {
"type": "git",
"url": "https://github.com/vlucas/valitron.git",
- "reference": "a03072bed1679660200766d134507a30193eaf6d"
+ "reference": "3c5463315bfa23b17f8949b100a960d035234e43"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/vlucas/valitron/zipball/a03072bed1679660200766d134507a30193eaf6d",
- "reference": "a03072bed1679660200766d134507a30193eaf6d",
+ "url": "https://api.github.com/repos/vlucas/valitron/zipball/3c5463315bfa23b17f8949b100a960d035234e43",
+ "reference": "3c5463315bfa23b17f8949b100a960d035234e43",
"shasum": ""
},
"require": {
@@ -979,29 +916,28 @@
"validation",
"validator"
],
- "time": "2019-08-29T19:49:43+00:00"
+ "time": "2018-05-06T10:45:26+00:00"
},
{
"name": "xemlock/htmlpurifier-html5",
- "version": "v0.1.11",
+ "version": "v0.1.7",
"source": {
"type": "git",
"url": "https://github.com/xemlock/htmlpurifier-html5.git",
- "reference": "f0d563f9fd4a82a3d759043483f9a94c0d8c2255"
+ "reference": "b4b35e51ec75e0207c23035f7d9a354bdcdac359"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/xemlock/htmlpurifier-html5/zipball/f0d563f9fd4a82a3d759043483f9a94c0d8c2255",
- "reference": "f0d563f9fd4a82a3d759043483f9a94c0d8c2255",
+ "url": "https://api.github.com/repos/xemlock/htmlpurifier-html5/zipball/b4b35e51ec75e0207c23035f7d9a354bdcdac359",
+ "reference": "b4b35e51ec75e0207c23035f7d9a354bdcdac359",
"shasum": ""
},
"require": {
- "ezyang/htmlpurifier": "^4.8",
+ "ezyang/htmlpurifier": "^4.7",
"php": ">=5.2"
},
"require-dev": {
- "php-coveralls/php-coveralls": "^1.1|^2.1",
- "phpunit/phpunit": ">=4.7 <8.0"
+ "phpunit/phpunit": "4.7.*|5.7.*"
},
"type": "library",
"autoload": {
@@ -1019,18 +955,8 @@
"email": "xemlock@gmail.com"
}
],
- "description": "HTML5 element definitions for HTML Purifier",
- "keywords": [
- "HTML5",
- "Purifier",
- "html",
- "htmlpurifier",
- "security",
- "tidy",
- "validator",
- "xss"
- ],
- "time": "2019-08-07T17:19:21+00:00"
+ "description": "HTML Purifier definitions for HTML5 elements",
+ "time": "2018-06-07T14:30:17+00:00"
}
],
"packages-dev": [],
diff --git a/composer.phar b/composer.phar
index 57fce957..4055d874 100644
Binary files a/composer.phar and b/composer.phar differ
diff --git a/vendor/bin/pscss b/vendor/bin/pscss
index 2879dcb9..9539281c 100644
--- a/vendor/bin/pscss
+++ b/vendor/bin/pscss
@@ -1,14 +1,10 @@
#!/usr/bin/env sh
-dir=$(cd "${0%[/\\]*}" > /dev/null; cd "../scssphp/scssphp/bin" && pwd)
+dir=$(cd "${0%[/\\]*}" > /dev/null; cd "../leafo/scssphp/bin" && pwd)
-if [ -d /proc/cygdrive ]; then
- case $(which php) in
- $(readlink -n /proc/cygdrive)/*)
- # We are in Cygwin using Windows php, so the path must be translated
- dir=$(cygpath -m "$dir");
- ;;
- esac
+if [ -d /proc/cygdrive ] && [[ $(which php) == $(readlink -n /proc/cygdrive)/* ]]; then
+ # We are in Cgywin using Windows php, so the path must be translated
+ dir=$(cygpath -m "$dir");
fi
"${dir}/pscss" "$@"
diff --git a/vendor/bin/pscss.bat b/vendor/bin/pscss.bat
index 1e368dc9..cadaeea9 100644
--- a/vendor/bin/pscss.bat
+++ b/vendor/bin/pscss.bat
@@ -1,4 +1,4 @@
@ECHO OFF
setlocal DISABLEDELAYEDEXPANSION
-SET BIN_TARGET=%~dp0/../scssphp/scssphp/bin/pscss
+SET BIN_TARGET=%~dp0/../leafo/scssphp/bin/pscss
php "%BIN_TARGET%" %*
diff --git a/vendor/catfan/medoo/.github/FUNDING.yml b/vendor/catfan/medoo/.github/FUNDING.yml
deleted file mode 100644
index d3400156..00000000
--- a/vendor/catfan/medoo/.github/FUNDING.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-# These are supported funding model platforms
-
-open_collective: medoo
diff --git a/vendor/catfan/medoo/.github/ISSUE_TEMPLATE/bug_report.md b/vendor/catfan/medoo/.github/ISSUE_TEMPLATE/bug_report.md
deleted file mode 100644
index 160e7e0f..00000000
--- a/vendor/catfan/medoo/.github/ISSUE_TEMPLATE/bug_report.md
+++ /dev/null
@@ -1,19 +0,0 @@
----
-name: Bug report
-about: Create a report to help us improve
-
----
-
-**Describe the bug**
-A clear and concise description of what the bug is.
-
-**Information**
-- Version of Medoo:
-- Type of Database (MySQL, MSSQL, SQLite...):
-- System (Liunx\Windows\Mac):
-
-**Detail Code**
-The detail code causes the problem.
-
-**Expected output**
-A clear and concise description of what output you expected.
diff --git a/vendor/catfan/medoo/LICENSE.md b/vendor/catfan/medoo/LICENSE.md
index e63dae83..a681c880 100644
--- a/vendor/catfan/medoo/LICENSE.md
+++ b/vendor/catfan/medoo/LICENSE.md
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2019 Angel Lai
+Copyright (c) 2018 Angel Lai
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/vendor/catfan/medoo/README.md b/vendor/catfan/medoo/README.md
index 5288a756..f31e1d06 100644
--- a/vendor/catfan/medoo/README.md
+++ b/vendor/catfan/medoo/README.md
@@ -6,11 +6,9 @@
-
-
-> The lightweight PHP database framework to accelerate development
+> The Lightest PHP database framework to accelerate development
## Features
@@ -28,7 +26,7 @@
## Requirement
-PHP 5.4+ and PDO extension installed, recommend PHP 7.0+
+PHP 5.4+ and PDO extension installed
## Get Started
@@ -36,7 +34,7 @@ PHP 5.4+ and PDO extension installed, recommend PHP 7.0+
Add Medoo to composer.json configuration file.
```
-$ composer require catfan/medoo
+$ composer require catfan/Medoo
```
And update the composer
@@ -45,7 +43,7 @@ $ composer update
```
```php
-// If you installed via composer, just use this code to require autoloader on the top of your projects.
+// If you installed via composer, just use this code to requrie autoloader on the top of your projects.
require 'vendor/autoload.php';
// Using Medoo namespace
diff --git a/vendor/catfan/medoo/composer.json b/vendor/catfan/medoo/composer.json
index 2bb0d08f..39c1a9de 100644
--- a/vendor/catfan/medoo/composer.json
+++ b/vendor/catfan/medoo/composer.json
@@ -1,8 +1,8 @@
{
"name": "catfan/medoo",
"type": "framework",
- "description": "The lightweight PHP database framework to accelerate development",
- "keywords": ["database", "database library", "lightweight", "PHP framework", "SQL", "MySQL", "MSSQL", "SQLite", "PostgreSQL", "MariaDB", "Oracle"],
+ "description": "The lightest PHP database framework to accelerate development",
+ "keywords": ["database", "lightweight", "PHP framework", "SQL", "MySQL", "MSSQL", "SQLite", "PostgreSQL", "MariaDB", "Oracle"],
"homepage": "https://medoo.in",
"license": "MIT",
"support": {
@@ -18,10 +18,10 @@
},
"suggest": {
"ext-pdo_mysql": "For MySQL or MariaDB database",
- "ext-pdo_sqlsrv": "For MSSQL database on both Window/Liunx platform",
+ "ext-pdo_sqlsrv": "For MSSQL database",
"ext-pdo_dblib": "For MSSQL or Sybase database on Linux/UNIX platform",
"ext-pdo_oci": "For Oracle database",
- "ext-pdo_oci8": "For Oracle version 8 database",
+ "ext-pdo_oci8": "For Oracle version 8 database",
"ext-pdo_pqsql": "For PostgreSQL database",
"ext-pdo_sqlite": "For SQLite database"
},
diff --git a/vendor/catfan/medoo/src/Medoo.php b/vendor/catfan/medoo/src/Medoo.php
index ae3cf41e..b97b8b8c 100644
--- a/vendor/catfan/medoo/src/Medoo.php
+++ b/vendor/catfan/medoo/src/Medoo.php
@@ -2,9 +2,9 @@
/*!
* Medoo database framework
* https://medoo.in
- * Version 1.7.8
+ * Version 1.5.7
*
- * Copyright 2019, Angel Lai
+ * Copyright 2018, Angel Lai
* Released under the MIT license
*/
@@ -13,7 +13,6 @@ namespace Medoo;
use PDO;
use Exception;
use PDOException;
-use InvalidArgumentException;
class Raw {
public $map;
@@ -30,7 +29,7 @@ class Medoo
protected $statement;
- protected $dsn;
+ protected $option = [];
protected $logs = [];
@@ -40,18 +39,16 @@ class Medoo
protected $guid = 0;
- protected $errorInfo = null;
-
- public function __construct(array $options)
+ public function __construct($options = null)
{
+ if (!is_array($options))
+ {
+ return false;
+ }
+
if (isset($options[ 'database_type' ]))
{
$this->type = strtolower($options[ 'database_type' ]);
-
- if ($this->type === 'mariadb')
- {
- $this->type = 'mysql';
- }
}
if (isset($options[ 'prefix' ]))
@@ -59,47 +56,23 @@ class Medoo
$this->prefix = $options[ 'prefix' ];
}
+ if (isset($options[ 'option' ]))
+ {
+ $this->option = $options[ 'option' ];
+ }
+
if (isset($options[ 'logging' ]) && is_bool($options[ 'logging' ]))
{
$this->logging = $options[ 'logging' ];
}
- $option = isset($options[ 'option' ]) ? $options[ 'option' ] : [];
- $commands = (isset($options[ 'command' ]) && is_array($options[ 'command' ])) ? $options[ 'command' ] : [];
-
- switch ($this->type)
+ if (isset($options[ 'command' ]) && is_array($options[ 'command' ]))
{
- case 'mysql':
- // Make MySQL using standard quoted identifier
- $commands[] = 'SET SQL_MODE=ANSI_QUOTES';
-
- break;
-
- case 'mssql':
- // Keep MSSQL QUOTED_IDENTIFIER is ON for standard quoting
- $commands[] = 'SET QUOTED_IDENTIFIER ON';
-
- // Make ANSI_NULLS is ON for NULL value
- $commands[] = 'SET ANSI_NULLS ON';
-
- break;
+ $commands = $options[ 'command' ];
}
-
- if (isset($options[ 'pdo' ]))
+ else
{
- if (!$options[ 'pdo' ] instanceof PDO)
- {
- throw new InvalidArgumentException('Invalid PDO object supplied');
- }
-
- $this->pdo = $options[ 'pdo' ];
-
- foreach ($commands as $value)
- {
- $this->pdo->exec($value);
- }
-
- return;
+ $commands = [];
}
if (isset($options[ 'dsn' ]))
@@ -110,7 +83,7 @@ class Medoo
}
else
{
- throw new InvalidArgumentException('Invalid DSN option supplied');
+ return false;
}
}
else
@@ -127,6 +100,7 @@ class Medoo
switch ($this->type)
{
+ case 'mariadb':
case 'mysql':
$attr = [
'driver' => 'mysql',
@@ -147,6 +121,8 @@ class Medoo
}
}
+ // Make MySQL using standard quoted identifier
+ $commands[] = 'SET SQL_MODE=ANSI_QUOTES';
break;
case 'pgsql':
@@ -200,16 +176,6 @@ class Medoo
'host' => $options[ 'server' ] . ($is_port ? ':' . $port : ''),
'dbname' => $options[ 'database_name' ]
];
-
- if (isset($options[ 'appname' ]))
- {
- $attr[ 'appname' ] = $options[ 'appname' ];
- }
-
- if (isset($options[ 'charset' ]))
- {
- $attr[ 'charset' ] = $options[ 'charset' ];
- }
}
else
{
@@ -218,46 +184,13 @@ class Medoo
'Server' => $options[ 'server' ] . ($is_port ? ',' . $port : ''),
'Database' => $options[ 'database_name' ]
];
-
- if (isset($options[ 'appname' ]))
- {
- $attr[ 'APP' ] = $options[ 'appname' ];
- }
-
- $config = [
- 'ApplicationIntent',
- 'AttachDBFileName',
- 'Authentication',
- 'ColumnEncryption',
- 'ConnectionPooling',
- 'Encrypt',
- 'Failover_Partner',
- 'KeyStoreAuthentication',
- 'KeyStorePrincipalId',
- 'KeyStoreSecret',
- 'LoginTimeout',
- 'MultipleActiveResultSets',
- 'MultiSubnetFailover',
- 'Scrollable',
- 'TraceFile',
- 'TraceOn',
- 'TransactionIsolation',
- 'TransparentNetworkIPResolution',
- 'TrustServerCertificate',
- 'WSID',
- ];
-
- foreach ($config as $value)
- {
- $keyname = strtolower(preg_replace(['/([a-z\d])([A-Z])/', '/([^_])([A-Z][a-z])/'], '$1_$2', $value));
-
- if (isset($options[ $keyname ]))
- {
- $attr[ $value ] = $options[ $keyname ];
- }
- }
}
+ // Keep MSSQL QUOTED_IDENTIFIER is ON for standard quoting
+ $commands[] = 'SET QUOTED_IDENTIFIER ON';
+
+ // Make ANSI_NULLS is ON for NULL value
+ $commands[] = 'SET ANSI_NULLS ON';
break;
case 'sqlite':
@@ -270,18 +203,8 @@ class Medoo
}
}
- if (!isset($attr))
- {
- throw new InvalidArgumentException('Incorrect connection options');
- }
-
$driver = $attr[ 'driver' ];
- if (!in_array($driver, PDO::getAvailableDrivers()))
- {
- throw new InvalidArgumentException("Unsupported PDO driver: {$driver}");
- }
-
unset($attr[ 'driver' ]);
$stack = [];
@@ -291,27 +214,22 @@ class Medoo
$stack[] = is_int($key) ? $value : $key . '=' . $value;
}
- $dsn = $driver . ':' . implode(';', $stack);
+ $dsn = $driver . ':' . implode($stack, ';');
if (
- in_array($this->type, ['mysql', 'pgsql', 'sybase', 'mssql']) &&
+ in_array($this->type, ['mariadb', 'mysql', 'pgsql', 'sybase', 'mssql']) &&
isset($options[ 'charset' ])
)
{
- $commands[] = "SET NAMES '{$options[ 'charset' ]}'" . (
- $this->type === 'mysql' && isset($options[ 'collation' ]) ?
- " COLLATE '{$options[ 'collation' ]}'" : ''
- );
+ $commands[] = "SET NAMES '" . $options[ 'charset' ] . "'";
}
- $this->dsn = $dsn;
-
try {
$this->pdo = new PDO(
$dsn,
isset($options[ 'username' ]) ? $options[ 'username' ] : null,
isset($options[ 'password' ]) ? $options[ 'password' ] : null,
- $option
+ $this->option
);
foreach ($commands as $value)
@@ -324,6 +242,18 @@ class Medoo
}
}
+ public function __call($name, $arguments)
+ {
+ $aggregation = ['avg', 'count', 'max', 'min', 'sum'];
+
+ if (in_array($name, $aggregation))
+ {
+ array_unshift($arguments, $name);
+
+ return call_user_func_array([$this, 'aggregate'], $arguments);
+ }
+ }
+
public function query($query, $map = [])
{
$raw = $this->raw($query, $map);
@@ -335,8 +265,6 @@ class Medoo
public function exec($query, $map = [])
{
- $this->statement = null;
-
if ($this->debug_mode)
{
echo $this->generate($query, $map);
@@ -357,37 +285,28 @@ class Medoo
$statement = $this->pdo->prepare($query);
- if (!$statement)
+ if ($statement)
{
- $this->errorInfo = $this->pdo->errorInfo();
- $this->statement = null;
+ foreach ($map as $key => $value)
+ {
+ $statement->bindValue($key, $value[ 0 ], $value[ 1 ]);
+ }
- return false;
+ $statement->execute();
+
+ $this->statement = $statement;
+
+ return $statement;
}
- $this->statement = $statement;
-
- foreach ($map as $key => $value)
- {
- $statement->bindValue($key, $value[ 0 ], $value[ 1 ]);
- }
-
- $execute = $statement->execute();
-
- $this->errorInfo = $statement->errorInfo();
-
- if (!$execute)
- {
- $this->statement = null;
- }
-
- return $statement;
+ return false;
}
protected function generate($query, $map)
{
$identifier = [
'mysql' => '`$1`',
+ 'mariadb' => '`$1`',
'mssql' => '[$1]'
];
@@ -477,11 +396,6 @@ class Medoo
protected function tableQuote($table)
{
- if (!preg_match('/^[a-zA-Z0-9_]+$/i', $table))
- {
- throw new InvalidArgumentException("Incorrect table name \"$table\"");
- }
-
return '"' . $this->prefix . $table . '"';
}
@@ -516,11 +430,6 @@ class Medoo
protected function columnQuote($string)
{
- if (!preg_match('/^[a-zA-Z0-9_]+(\.?[a-zA-Z0-9_]+)?$/i', $string))
- {
- throw new InvalidArgumentException("Incorrect column name \"$string\"");
- }
-
if (strpos($string, '.') !== false)
{
return '"' . $this->prefix . str_replace('.', '"."', $string) . '"';
@@ -529,7 +438,7 @@ class Medoo
return '"' . $string . '"';
}
- protected function columnPush(&$columns, &$map, $root, $is_join = false)
+ protected function columnPush(&$columns, &$map)
{
if ($columns === '*')
{
@@ -545,34 +454,23 @@ class Medoo
foreach ($columns as $key => $value)
{
- if (!is_int($key) && is_array($value) && $root && count(array_keys($columns)) === 1)
+ if (is_array($value))
{
- $stack[] = $this->columnQuote($key);
-
- $stack[] = $this->columnPush($value, $map, false, $is_join);
- }
- elseif (is_array($value))
- {
- $stack[] = $this->columnPush($value, $map, false, $is_join);
+ $stack[] = $this->columnPush($value, $map);
}
elseif (!is_int($key) && $raw = $this->buildRaw($value, $map))
{
preg_match('/(?[a-zA-Z0-9_\.]+)(\s*\[(?(String|Bool|Int|Number))\])?/i', $key, $match);
- $stack[] = $raw . ' AS ' . $this->columnQuote($match[ 'column' ]);
+ $stack[] = $raw . ' AS ' . $this->columnQuote( $match[ 'column' ] );
}
elseif (is_int($key) && is_string($value))
{
- if ($is_join && strpos($value, '*') !== false)
- {
- throw new InvalidArgumentException('Cannot use table.* to select all columns while joining table');
- }
-
preg_match('/(?[a-zA-Z0-9_\.]+)(?:\s*\((?[a-zA-Z0-9_]+)\))?(?:\s*\[(?(?:String|Bool|Int|Number|Object|JSON))\])?/i', $value, $match);
if (!empty($match[ 'alias' ]))
{
- $stack[] = $this->columnQuote($match[ 'column' ]) . ' AS ' . $this->columnQuote($match[ 'alias' ]);
+ $stack[] = $this->columnQuote( $match[ 'column' ] ) . ' AS ' . $this->columnQuote( $match[ 'alias' ] );
$columns[ $key ] = $match[ 'alias' ];
@@ -583,12 +481,12 @@ class Medoo
}
else
{
- $stack[] = $this->columnQuote($match[ 'column' ]);
+ $stack[] = $this->columnQuote( $match[ 'column' ] );
}
}
}
- return implode(',', $stack);
+ return implode($stack, ',');
}
protected function arrayQuote($array)
@@ -600,7 +498,7 @@ class Medoo
$stack[] = is_int($value) ? $value : $this->pdo->quote($value);
}
- return implode(',', $stack);
+ return implode($stack, ',');
}
protected function innerConjunct($data, $map, $conjunctor, $outer_conjunctor)
@@ -662,7 +560,7 @@ class Medoo
if (is_numeric($value))
{
$condition .= $map_key;
- $map[ $map_key ] = [$value, is_float($value) ? PDO::PARAM_STR : PDO::PARAM_INT];
+ $map[ $map_key ] = [$value, PDO::PARAM_INT];
}
elseif ($raw = $this->buildRaw($value, $map))
{
@@ -689,10 +587,8 @@ class Medoo
foreach ($value as $index => $item)
{
- $stack_key = $map_key . $index . '_i';
-
- $placeholders[] = $stack_key;
- $map[ $stack_key ] = $this->typeMap($item, gettype($item));
+ $placeholders[] = $map_key . $index . '_i';
+ $map[ $map_key . $index . '_i' ] = $this->typeMap($item, gettype($item));
}
$stack[] = $column . ' NOT IN (' . implode(', ', $placeholders) . ')';
@@ -739,7 +635,7 @@ class Medoo
{
$item = strval($item);
- if (!preg_match('/(\[.+\]|[\*\?\!\%#^-_]|%.+|.+%)/', $item))
+ if (!preg_match('/(\[.+\]|_|%.+|.+%)/', $item))
{
$item = '%' . $item . '%';
}
@@ -786,10 +682,8 @@ class Medoo
foreach ($value as $index => $item)
{
- $stack_key = $map_key . $index . '_i';
-
- $placeholders[] = $stack_key;
- $map[ $stack_key ] = $this->typeMap($item, gettype($item));
+ $placeholders[] = $map_key . $index . '_i';
+ $map[ $map_key . $index . '_i' ] = $this->typeMap($item, gettype($item));
}
$stack[] = $column . ' IN (' . implode(', ', $placeholders) . ')';
@@ -834,7 +728,7 @@ class Medoo
$where_clause = ' WHERE ' . $this->dataImplode($conditions, $map, ' AND');
}
- if (isset($where[ 'MATCH' ]) && $this->type === 'mysql')
+ if (isset($where[ 'MATCH' ]))
{
$MATCH = $where[ 'MATCH' ];
@@ -854,7 +748,7 @@ class Medoo
$mode = ' ' . $mode_array[ $MATCH[ 'mode' ] ];
}
- $columns = implode(', ', array_map([$this, 'columnQuote'], $MATCH[ 'columns' ]));
+ $columns = implode(array_map([$this, 'columnQuote'], $MATCH[ 'columns' ]), ', ');
$map_key = $this->mapKey();
$map[ $map_key ] = [$MATCH[ 'keyword' ], PDO::PARAM_STR];
@@ -875,7 +769,7 @@ class Medoo
$stack[] = $this->columnQuote($value);
}
- $where_clause .= ' GROUP BY ' . implode(',', $stack);
+ $where_clause .= ' GROUP BY ' . implode($stack, ',');
}
elseif ($raw = $this->buildRaw($GROUP, $map))
{
@@ -923,7 +817,7 @@ class Medoo
}
}
- $where_clause .= ' ORDER BY ' . implode(',', $stack);
+ $where_clause .= ' ORDER BY ' . implode($stack, ',');
}
elseif ($raw = $this->buildRaw($ORDER, $map))
{
@@ -1000,7 +894,6 @@ class Medoo
$table_query = $table;
}
- $is_join = false;
$join_key = is_array($join) ? array_keys($join) : null;
if (
@@ -1008,8 +901,67 @@ class Medoo
strpos($join_key[ 0 ], '[') === 0
)
{
- $is_join = true;
- $table_query .= ' ' . $this->buildJoin($table, $join);
+ $table_join = [];
+
+ $join_array = [
+ '>' => 'LEFT',
+ '<' => 'RIGHT',
+ '<>' => 'FULL',
+ '><' => 'INNER'
+ ];
+
+ foreach($join as $sub_table => $relation)
+ {
+ preg_match('/(\[(?\<\>?|\>\)\])?(?[a-zA-Z0-9_]+)\s?(\((?[a-zA-Z0-9_]+)\))?/', $sub_table, $match);
+
+ if ($match[ 'join' ] !== '' && $match[ 'table' ] !== '')
+ {
+ if (is_string($relation))
+ {
+ $relation = 'USING ("' . $relation . '")';
+ }
+
+ if (is_array($relation))
+ {
+ // For ['column1', 'column2']
+ if (isset($relation[ 0 ]))
+ {
+ $relation = 'USING ("' . implode($relation, '", "') . '")';
+ }
+ else
+ {
+ $joins = [];
+
+ foreach ($relation as $key => $value)
+ {
+ $joins[] = (
+ strpos($key, '.') > 0 ?
+ // For ['tableB.column' => 'column']
+ $this->columnQuote($key) :
+
+ // For ['column1' => 'column2']
+ $table . '."' . $key . '"'
+ ) .
+ ' = ' .
+ $this->tableQuote(isset($match[ 'alias' ]) ? $match[ 'alias' ] : $match[ 'table' ]) . '."' . $value . '"';
+ }
+
+ $relation = 'ON ' . implode($joins, ' AND ');
+ }
+ }
+
+ $table_name = $this->tableQuote($match[ 'table' ]) . ' ';
+
+ if (isset($match[ 'alias' ]))
+ {
+ $table_name .= 'AS ' . $this->tableQuote($match[ 'alias' ]) . ' ';
+ }
+
+ $table_join[] = $join_array[ $match[ 'join' ] ] . ' JOIN ' . $table_name . $relation;
+ }
+ }
+
+ $table_query .= ' ' . implode($table_join, ' ');
}
else
{
@@ -1047,10 +999,6 @@ class Medoo
$where = $columns;
}
}
- elseif ($raw = $this->buildRaw($column_fn, $map))
- {
- $column = $raw;
- }
else
{
if (empty($columns) || $this->isRaw($columns))
@@ -1059,83 +1007,18 @@ class Medoo
$where = $join;
}
- $column = $column_fn . '(' . $this->columnPush($columns, $map, true) . ')';
+ $column = $column_fn . '(' . $this->columnPush($columns, $map) . ')';
}
}
else
{
- $column = $this->columnPush($columns, $map, true, $is_join);
+ $column = $this->columnPush($columns, $map);
}
return 'SELECT ' . $column . ' FROM ' . $table_query . $this->whereClause($where, $map);
}
- protected function buildJoin($table, $join)
- {
- $table_join = [];
-
- $join_array = [
- '>' => 'LEFT',
- '<' => 'RIGHT',
- '<>' => 'FULL',
- '><' => 'INNER'
- ];
-
- foreach($join as $sub_table => $relation)
- {
- preg_match('/(\[(?\<\>?|\>\)\])?(?[a-zA-Z0-9_]+)\s?(\((?[a-zA-Z0-9_]+)\))?/', $sub_table, $match);
-
- if ($match[ 'join' ] !== '' && $match[ 'table' ] !== '')
- {
- if (is_string($relation))
- {
- $relation = 'USING ("' . $relation . '")';
- }
-
- if (is_array($relation))
- {
- // For ['column1', 'column2']
- if (isset($relation[ 0 ]))
- {
- $relation = 'USING ("' . implode('", "', $relation) . '")';
- }
- else
- {
- $joins = [];
-
- foreach ($relation as $key => $value)
- {
- $joins[] = (
- strpos($key, '.') > 0 ?
- // For ['tableB.column' => 'column']
- $this->columnQuote($key) :
-
- // For ['column1' => 'column2']
- $table . '."' . $key . '"'
- ) .
- ' = ' .
- $this->tableQuote(isset($match[ 'alias' ]) ? $match[ 'alias' ] : $match[ 'table' ]) . '."' . $value . '"';
- }
-
- $relation = 'ON ' . implode(' AND ', $joins);
- }
- }
-
- $table_name = $this->tableQuote($match[ 'table' ]) . ' ';
-
- if (isset($match[ 'alias' ]))
- {
- $table_name .= 'AS ' . $this->tableQuote($match[ 'alias' ]) . ' ';
- }
-
- $table_join[] = $join_array[ $match[ 'join' ] ] . ' JOIN ' . $table_name . $relation;
- }
- }
-
- return implode(' ', $table_join);
- }
-
- protected function columnMap($columns, &$stack, $root)
+ protected function columnMap($columns, &$stack)
{
if ($columns === '*')
{
@@ -1178,52 +1061,15 @@ class Medoo
}
elseif (!is_int($key) && is_array($value))
{
- if ($root && count(array_keys($columns)) === 1)
- {
- $stack[ $key ] = [$key, 'String'];
- }
-
- $this->columnMap($value, $stack, false);
+ $this->columnMap($value, $stack);
}
}
return $stack;
}
- protected function dataMap($data, $columns, $column_map, &$stack, $root, &$result)
+ protected function dataMap($data, $columns, $column_map, &$stack)
{
- if ($root)
- {
- $columns_key = array_keys($columns);
-
- if (count($columns_key) === 1 && is_array($columns[$columns_key[0]]))
- {
- $index_key = array_keys($columns)[0];
- $data_key = preg_replace("/^[a-zA-Z0-9_]+\./i", "", $index_key);
-
- $current_stack = [];
-
- foreach ($data as $item)
- {
- $this->dataMap($data, $columns[ $index_key ], $column_map, $current_stack, false, $result);
-
- $index = $data[ $data_key ];
-
- $result[ $index ] = $current_stack;
- }
- }
- else
- {
- $current_stack = [];
-
- $this->dataMap($data, $columns, $column_map, $current_stack, false, $result);
-
- $result[] = $current_stack;
- }
-
- return;
- }
-
foreach ($columns as $key => $value)
{
$isRaw = $this->isRaw($value);
@@ -1234,7 +1080,7 @@ class Medoo
$column_key = $map[ 0 ];
- $item = $data[ $column_key ];
+ $result = $data[ $column_key ];
if (isset($map[ 1 ]))
{
@@ -1243,7 +1089,7 @@ class Medoo
continue;
}
- if (is_null($item))
+ if (is_null($result))
{
$stack[ $column_key ] = null;
continue;
@@ -1252,103 +1098,50 @@ class Medoo
switch ($map[ 1 ])
{
case 'Number':
- $stack[ $column_key ] = (double) $item;
+ $stack[ $column_key ] = (double) $result;
break;
case 'Int':
- $stack[ $column_key ] = (int) $item;
+ $stack[ $column_key ] = (int) $result;
break;
case 'Bool':
- $stack[ $column_key ] = (bool) $item;
+ $stack[ $column_key ] = (bool) $result;
break;
case 'Object':
- $stack[ $column_key ] = unserialize($item);
+ $stack[ $column_key ] = unserialize($result);
break;
case 'JSON':
- $stack[ $column_key ] = json_decode($item, true);
+ $stack[ $column_key ] = json_decode($result, true);
break;
case 'String':
- $stack[ $column_key ] = $item;
+ $stack[ $column_key ] = $result;
break;
}
}
else
{
- $stack[ $column_key ] = $item;
+ $stack[ $column_key ] = $result;
}
}
else
{
$current_stack = [];
- $this->dataMap($data, $value, $column_map, $current_stack, false, $result);
+ $this->dataMap($data, $value, $column_map, $current_stack);
$stack[ $key ] = $current_stack;
}
}
}
- public function create($table, $columns, $options = null)
- {
- $stack = [];
-
- $tableName = $this->prefix . $table;
-
- foreach ($columns as $name => $definition)
- {
- if (is_int($name))
- {
- $stack[] = preg_replace('/\<([a-zA-Z0-9_]+)\>/i', '"$1"', $definition);
- }
- elseif (is_array($definition))
- {
- $stack[] = $name . ' ' . implode(' ', $definition);
- }
- elseif (is_string($definition))
- {
- $stack[] = $name . ' ' . $this->query($definition);
- }
- }
-
- $table_option = '';
-
- if (is_array($options))
- {
- $option_stack = [];
-
- foreach ($options as $key => $value)
- {
- if (is_string($value) || is_int($value))
- {
- $option_stack[] = "$key = $value";
- }
- }
-
- $table_option = ' ' . implode(', ', $option_stack);
- }
- elseif (is_string($options))
- {
- $table_option = ' ' . $options;
- }
-
- return $this->exec("CREATE TABLE IF NOT EXISTS $tableName (" . implode(', ', $stack) . ")$table_option");
- }
-
- public function drop($table)
- {
- $tableName = $this->prefix . $table;
-
- return $this->exec("DROP TABLE IF EXISTS $tableName");
- }
-
public function select($table, $join, $columns = null, $where = null)
{
$map = [];
- $result = [];
+ $stack = [];
$column_map = [];
$index = 0;
@@ -1359,9 +1152,9 @@ class Medoo
$query = $this->exec($this->selectContext($table, $map, $join, $columns, $where), $map);
- $this->columnMap($columns, $column_map, true);
+ $this->columnMap($columns, $column_map);
- if (!$this->statement)
+ if (!$query)
{
return false;
}
@@ -1371,27 +1164,23 @@ class Medoo
return $query->fetchAll(PDO::FETCH_ASSOC);
}
+ if ($is_single)
+ {
+ return $query->fetchAll(PDO::FETCH_COLUMN);
+ }
+
while ($data = $query->fetch(PDO::FETCH_ASSOC))
{
$current_stack = [];
- $this->dataMap($data, $columns, $column_map, $current_stack, true, $result);
+ $this->dataMap($data, $columns, $column_map, $current_stack);
+
+ $stack[ $index ] = $current_stack;
+
+ $index++;
}
- if ($is_single)
- {
- $single_result = [];
- $result_key = $column_map[ $column ][ 0 ];
-
- foreach ($result as $item)
- {
- $single_result[] = $item[ $result_key ];
- }
-
- return $single_result;
- }
-
- return $result;
+ return $stack;
}
public function insert($table, $datas)
@@ -1428,7 +1217,7 @@ class Medoo
continue;
}
- $map_key = $this->mapKey();
+ $map_key =$this->mapKey();
$values[] = $map_key;
@@ -1468,7 +1257,7 @@ class Medoo
}
}
- $stack[] = '(' . implode(', ', $values) . ')';
+ $stack[] = '(' . implode($values, ', ') . ')';
}
foreach ($columns as $key)
@@ -1584,9 +1373,8 @@ class Medoo
public function get($table, $join = null, $columns = null, $where = null)
{
$map = [];
- $result = [];
+ $stack = [];
$column_map = [];
- $current_stack = [];
if ($where === null)
{
@@ -1603,31 +1391,33 @@ class Medoo
$query = $this->exec($this->selectContext($table, $map, $join, $columns, $where) . ' LIMIT 1', $map);
- if (!$this->statement)
+ if ($query)
{
+ $data = $query->fetchAll(PDO::FETCH_ASSOC);
+
+ if (isset($data[ 0 ]))
+ {
+ if ($column === '*')
+ {
+ return $data[ 0 ];
+ }
+
+ $this->columnMap($columns, $column_map);
+
+ $this->dataMap($data[ 0 ], $columns, $column_map, $stack);
+
+ if ($is_single)
+ {
+ return $stack[ $column_map[ $column ][ 0 ] ];
+ }
+
+ return $stack;
+ }
+
return false;
}
- $data = $query->fetchAll(PDO::FETCH_ASSOC);
-
- if (isset($data[ 0 ]))
- {
- if ($column === '*')
- {
- return $data[ 0 ];
- }
-
- $this->columnMap($columns, $column_map, true);
-
- $this->dataMap($data[ 0 ], $columns, $column_map, $current_stack, true, $result);
-
- if ($is_single)
- {
- return $result[ 0 ][ $column_map[ $column ][ 0 ] ];
- }
-
- return $result[ 0 ];
- }
+ return false;
}
public function has($table, $join, $where = null)
@@ -1635,66 +1425,16 @@ class Medoo
$map = [];
$column = null;
- if ($this->type === 'mssql')
+ $query = $this->exec('SELECT EXISTS(' . $this->selectContext($table, $map, $join, $column, $where, 1) . ')', $map);
+
+ if ($query)
{
- $query = $this->exec($this->selectContext($table, $map, $join, $column, $where, Medoo::raw('TOP 1 1')), $map);
- }
- else
- {
- $query = $this->exec('SELECT EXISTS(' . $this->selectContext($table, $map, $join, $column, $where, 1) . ')', $map);
+ $result = $query->fetchColumn();
+
+ return $result === '1' || $result === true;
}
- if (!$this->statement)
- {
- return false;
- }
-
- $result = $query->fetchColumn();
-
- return $result === '1' || $result === 1 || $result === true;
- }
-
- public function rand($table, $join = null, $columns = null, $where = null)
- {
- $type = $this->type;
-
- $order = 'RANDOM()';
-
- if ($type === 'mysql')
- {
- $order = 'RAND()';
- }
- elseif ($type === 'mssql')
- {
- $order = 'NEWID()';
- }
-
- $order_raw = $this->raw($order);
-
- if ($where === null)
- {
- if ($columns === null)
- {
- $columns = [
- 'ORDER' => $order_raw
- ];
- }
- else
- {
- $column = $join;
- unset($columns[ 'ORDER' ]);
-
- $columns[ 'ORDER' ] = $order_raw;
- }
- }
- else
- {
- unset($where[ 'ORDER' ]);
-
- $where[ 'ORDER' ] = $order_raw;
- }
-
- return $this->select($table, $join, $columns, $where);
+ return false;
}
private function aggregate($type, $table, $join = null, $column = null, $where = null)
@@ -1703,39 +1443,14 @@ class Medoo
$query = $this->exec($this->selectContext($table, $map, $join, $column, $where, strtoupper($type)), $map);
- if (!$this->statement)
+ if ($query)
{
- return false;
+ $number = $query->fetchColumn();
+
+ return is_numeric($number) ? $number + 0 : $number;
}
- $number = $query->fetchColumn();
-
- return is_numeric($number) ? $number + 0 : $number;
- }
-
- public function count($table, $join = null, $column = null, $where = null)
- {
- return $this->aggregate('count', $table, $join, $column, $where);
- }
-
- public function avg($table, $join, $column = null, $where = null)
- {
- return $this->aggregate('avg', $table, $join, $column, $where);
- }
-
- public function max($table, $join, $column = null, $where = null)
- {
- return $this->aggregate('max', $table, $join, $column, $where);
- }
-
- public function min($table, $join, $column = null, $where = null)
- {
- return $this->aggregate('min', $table, $join, $column, $where);
- }
-
- public function sum($table, $join, $column = null, $where = null)
- {
- return $this->aggregate('sum', $table, $join, $column, $where);
+ return false;
}
public function action($actions)
@@ -1770,30 +1485,22 @@ class Medoo
public function id()
{
- if ($this->statement == null)
- {
- return null;
- }
-
$type = $this->type;
if ($type === 'oracle')
{
return 0;
}
+ elseif ($type === 'mssql')
+ {
+ return $this->pdo->query('SELECT SCOPE_IDENTITY()')->fetchColumn();
+ }
elseif ($type === 'pgsql')
{
return $this->pdo->query('SELECT LASTVAL()')->fetchColumn();
}
- $lastId = $this->pdo->lastInsertId();
-
- if ($lastId != "0" && $lastId != "")
- {
- return $lastId;
- }
-
- return null;
+ return $this->pdo->lastInsertId();
}
public function debug()
@@ -1805,7 +1512,7 @@ class Medoo
public function error()
{
- return $this->errorInfo;
+ return $this->statement ? $this->statement->errorInfo() : null;
}
public function last()
@@ -1840,8 +1547,7 @@ class Medoo
$output[ $key ] = @$this->pdo->getAttribute(constant('PDO::ATTR_' . $value));
}
- $output[ 'dsn' ] = $this->dsn;
-
return $output;
}
-}
\ No newline at end of file
+}
+?>
\ No newline at end of file
diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php
index fce8549f..dc02dfb1 100644
--- a/vendor/composer/ClassLoader.php
+++ b/vendor/composer/ClassLoader.php
@@ -279,7 +279,7 @@ class ClassLoader
*/
public function setApcuPrefix($apcuPrefix)
{
- $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
+ $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
}
/**
@@ -377,7 +377,7 @@ class ClassLoader
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
- $search = $subPath . '\\';
+ $search = $subPath.'\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php
index 13991c13..f698c3fd 100644
--- a/vendor/composer/autoload_classmap.php
+++ b/vendor/composer/autoload_classmap.php
@@ -11,40 +11,19 @@ return array(
'DBTransaction' => $vendorDir . '/sergeytsalkov/meekrodb/db.class.php',
'FB' => $vendorDir . '/firephp/firephp-core/lib/FirePHPCore/fb.php',
'FirePHP' => $vendorDir . '/firephp/firephp-core/lib/FirePHPCore/FirePHP.class.php',
- 'HTMLPurifier_AttrDef_Float' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrDef/Float.php',
- 'HTMLPurifier_AttrDef_HTML5_ARel' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrDef/HTML5/ARel.php',
- 'HTMLPurifier_AttrDef_HTML5_Datetime' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrDef/HTML5/Datetime.php',
- 'HTMLPurifier_AttrDef_HTML5_Duration' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrDef/HTML5/Duration.php',
- 'HTMLPurifier_AttrDef_HTML5_Week' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrDef/HTML5/Week.php',
- 'HTMLPurifier_AttrDef_HTML5_YearlessDate' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrDef/HTML5/YearlessDate.php',
'HTMLPurifier_AttrDef_HTML_Bool2' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrDef/HTML/Bool2.php',
- 'HTMLPurifier_AttrTransform_HTML5_Dialog' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrTransform/HTML5/Dialog.php',
- 'HTMLPurifier_AttrTransform_HTML5_Progress' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrTransform/HTML5/Progress.php',
- 'HTMLPurifier_AttrTransform_HTML5_Script' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrTransform/HTML5/Script.php',
- 'HTMLPurifier_ChildDef_HTML5_Abstract' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/HTML5/Abstract.php',
- 'HTMLPurifier_ChildDef_HTML5_Details' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/HTML5/Details.php',
- 'HTMLPurifier_ChildDef_HTML5_Fieldset' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/HTML5/Fieldset.php',
- 'HTMLPurifier_ChildDef_HTML5_Figure' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/HTML5/Figure.php',
- 'HTMLPurifier_ChildDef_HTML5_Media' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/HTML5/Media.php',
- 'HTMLPurifier_ChildDef_HTML5_Picture' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/HTML5/Picture.php',
- 'HTMLPurifier_ChildDef_HTML5_Script' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/HTML5/Script.php',
- 'HTMLPurifier_ChildDef_HTML5_Time' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/HTML5/Time.php',
+ 'HTMLPurifier_AttrDef_Regexp' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrDef/Regexp.php',
+ 'HTMLPurifier_ChildDef_Details' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/Details.php',
+ 'HTMLPurifier_ChildDef_Figure' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/Figure.php',
+ 'HTMLPurifier_ChildDef_Media' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/Media.php',
+ 'HTMLPurifier_ChildDef_Picture' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/Picture.php',
'HTMLPurifier_HTML5Config' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTML5Config.php',
'HTMLPurifier_HTML5Definition' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTML5Definition.php',
- 'HTMLPurifier_HTMLModule_HTML5_Bdo' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/Bdo.php',
- 'HTMLPurifier_HTMLModule_HTML5_Edit' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/Edit.php',
- 'HTMLPurifier_HTMLModule_HTML5_Forms' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/Forms.php',
- 'HTMLPurifier_HTMLModule_HTML5_Hypertext' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/Hypertext.php',
- 'HTMLPurifier_HTMLModule_HTML5_Iframe' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/Iframe.php',
- 'HTMLPurifier_HTMLModule_HTML5_Interactive' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/Interactive.php',
- 'HTMLPurifier_HTMLModule_HTML5_List' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/List.php',
- 'HTMLPurifier_HTMLModule_HTML5_Media' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/Media.php',
- 'HTMLPurifier_HTMLModule_HTML5_Ruby' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/Ruby.php',
- 'HTMLPurifier_HTMLModule_HTML5_SafeScripting' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/SafeScripting.php',
- 'HTMLPurifier_HTMLModule_HTML5_Scripting' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/Scripting.php',
- 'HTMLPurifier_HTMLModule_HTML5_Text' => $vendorDir . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/Text.php',
'MeekroDB' => $vendorDir . '/sergeytsalkov/meekrodb/db.class.php',
'MeekroDBEval' => $vendorDir . '/sergeytsalkov/meekrodb/db.class.php',
'MeekroDBException' => $vendorDir . '/sergeytsalkov/meekrodb/db.class.php',
'WhereClause' => $vendorDir . '/sergeytsalkov/meekrodb/db.class.php',
+ 'kakao\\KakaoKey' => $baseDir . '/d_setting/KakaoKey.php',
+ 'sammo\\RootDB' => $baseDir . '/d_setting/RootDB.php',
+ 'sammo\\ServConfig' => $baseDir . '/d_setting/ServConfig.php',
);
diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php
index e8faaee3..c61c1246 100644
--- a/vendor/composer/autoload_files.php
+++ b/vendor/composer/autoload_files.php
@@ -6,7 +6,6 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
- '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
'2cffec82183ee1cea088009cef9a6fc3' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php
index 9f668b24..9bd88669 100644
--- a/vendor/composer/autoload_psr4.php
+++ b/vendor/composer/autoload_psr4.php
@@ -10,7 +10,6 @@ return array(
'kakao\\' => array($baseDir . '/src/kakao'),
'Valitron\\' => array($vendorDir . '/vlucas/valitron/src/Valitron'),
'Symfony\\Component\\Lock\\' => array($vendorDir . '/symfony/lock'),
- 'ScssPhp\\ScssPhp\\' => array($vendorDir . '/scssphp/scssphp/src'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
'PhpExtended\\Tail\\' => array($vendorDir . '/php-extended/php-tail/src'),
@@ -18,6 +17,7 @@ return array(
'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
'Medoo\\' => array($vendorDir . '/catfan/medoo/src'),
'League\\Plates\\' => array($vendorDir . '/league/plates/src'),
+ 'Leafo\\ScssPhp\\' => array($vendorDir . '/leafo/scssphp/src'),
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php
index 3f96f6c6..85e66636 100644
--- a/vendor/composer/autoload_static.php
+++ b/vendor/composer/autoload_static.php
@@ -7,7 +7,6 @@ namespace Composer\Autoload;
class ComposerStaticInit67b09c83b85c3bc0027caefe5bba171a
{
public static $files = array (
- '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
'2cffec82183ee1cea088009cef9a6fc3' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
@@ -32,7 +31,6 @@ class ComposerStaticInit67b09c83b85c3bc0027caefe5bba171a
'S' =>
array (
'Symfony\\Component\\Lock\\' => 23,
- 'ScssPhp\\ScssPhp\\' => 16,
),
'P' =>
array (
@@ -49,6 +47,7 @@ class ComposerStaticInit67b09c83b85c3bc0027caefe5bba171a
'L' =>
array (
'League\\Plates\\' => 14,
+ 'Leafo\\ScssPhp\\' => 14,
),
'G' =>
array (
@@ -75,10 +74,6 @@ class ComposerStaticInit67b09c83b85c3bc0027caefe5bba171a
array (
0 => __DIR__ . '/..' . '/symfony/lock',
),
- 'ScssPhp\\ScssPhp\\' =>
- array (
- 0 => __DIR__ . '/..' . '/scssphp/scssphp/src',
- ),
'Psr\\Log\\' =>
array (
0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
@@ -107,6 +102,10 @@ class ComposerStaticInit67b09c83b85c3bc0027caefe5bba171a
array (
0 => __DIR__ . '/..' . '/league/plates/src',
),
+ 'Leafo\\ScssPhp\\' =>
+ array (
+ 0 => __DIR__ . '/..' . '/leafo/scssphp/src',
+ ),
'GuzzleHttp\\Psr7\\' =>
array (
0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src',
@@ -144,42 +143,21 @@ class ComposerStaticInit67b09c83b85c3bc0027caefe5bba171a
'DBTransaction' => __DIR__ . '/..' . '/sergeytsalkov/meekrodb/db.class.php',
'FB' => __DIR__ . '/..' . '/firephp/firephp-core/lib/FirePHPCore/fb.php',
'FirePHP' => __DIR__ . '/..' . '/firephp/firephp-core/lib/FirePHPCore/FirePHP.class.php',
- 'HTMLPurifier_AttrDef_Float' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrDef/Float.php',
- 'HTMLPurifier_AttrDef_HTML5_ARel' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrDef/HTML5/ARel.php',
- 'HTMLPurifier_AttrDef_HTML5_Datetime' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrDef/HTML5/Datetime.php',
- 'HTMLPurifier_AttrDef_HTML5_Duration' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrDef/HTML5/Duration.php',
- 'HTMLPurifier_AttrDef_HTML5_Week' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrDef/HTML5/Week.php',
- 'HTMLPurifier_AttrDef_HTML5_YearlessDate' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrDef/HTML5/YearlessDate.php',
'HTMLPurifier_AttrDef_HTML_Bool2' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrDef/HTML/Bool2.php',
- 'HTMLPurifier_AttrTransform_HTML5_Dialog' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrTransform/HTML5/Dialog.php',
- 'HTMLPurifier_AttrTransform_HTML5_Progress' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrTransform/HTML5/Progress.php',
- 'HTMLPurifier_AttrTransform_HTML5_Script' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrTransform/HTML5/Script.php',
- 'HTMLPurifier_ChildDef_HTML5_Abstract' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/HTML5/Abstract.php',
- 'HTMLPurifier_ChildDef_HTML5_Details' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/HTML5/Details.php',
- 'HTMLPurifier_ChildDef_HTML5_Fieldset' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/HTML5/Fieldset.php',
- 'HTMLPurifier_ChildDef_HTML5_Figure' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/HTML5/Figure.php',
- 'HTMLPurifier_ChildDef_HTML5_Media' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/HTML5/Media.php',
- 'HTMLPurifier_ChildDef_HTML5_Picture' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/HTML5/Picture.php',
- 'HTMLPurifier_ChildDef_HTML5_Script' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/HTML5/Script.php',
- 'HTMLPurifier_ChildDef_HTML5_Time' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/HTML5/Time.php',
+ 'HTMLPurifier_AttrDef_Regexp' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/AttrDef/Regexp.php',
+ 'HTMLPurifier_ChildDef_Details' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/Details.php',
+ 'HTMLPurifier_ChildDef_Figure' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/Figure.php',
+ 'HTMLPurifier_ChildDef_Media' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/Media.php',
+ 'HTMLPurifier_ChildDef_Picture' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/ChildDef/Picture.php',
'HTMLPurifier_HTML5Config' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTML5Config.php',
'HTMLPurifier_HTML5Definition' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTML5Definition.php',
- 'HTMLPurifier_HTMLModule_HTML5_Bdo' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/Bdo.php',
- 'HTMLPurifier_HTMLModule_HTML5_Edit' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/Edit.php',
- 'HTMLPurifier_HTMLModule_HTML5_Forms' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/Forms.php',
- 'HTMLPurifier_HTMLModule_HTML5_Hypertext' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/Hypertext.php',
- 'HTMLPurifier_HTMLModule_HTML5_Iframe' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/Iframe.php',
- 'HTMLPurifier_HTMLModule_HTML5_Interactive' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/Interactive.php',
- 'HTMLPurifier_HTMLModule_HTML5_List' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/List.php',
- 'HTMLPurifier_HTMLModule_HTML5_Media' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/Media.php',
- 'HTMLPurifier_HTMLModule_HTML5_Ruby' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/Ruby.php',
- 'HTMLPurifier_HTMLModule_HTML5_SafeScripting' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/SafeScripting.php',
- 'HTMLPurifier_HTMLModule_HTML5_Scripting' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/Scripting.php',
- 'HTMLPurifier_HTMLModule_HTML5_Text' => __DIR__ . '/..' . '/xemlock/htmlpurifier-html5/library/HTMLPurifier/HTMLModule/HTML5/Text.php',
'MeekroDB' => __DIR__ . '/..' . '/sergeytsalkov/meekrodb/db.class.php',
'MeekroDBEval' => __DIR__ . '/..' . '/sergeytsalkov/meekrodb/db.class.php',
'MeekroDBException' => __DIR__ . '/..' . '/sergeytsalkov/meekrodb/db.class.php',
'WhereClause' => __DIR__ . '/..' . '/sergeytsalkov/meekrodb/db.class.php',
+ 'kakao\\KakaoKey' => __DIR__ . '/../..' . '/d_setting/KakaoKey.php',
+ 'sammo\\RootDB' => __DIR__ . '/../..' . '/d_setting/RootDB.php',
+ 'sammo\\ServConfig' => __DIR__ . '/../..' . '/d_setting/ServConfig.php',
);
public static function getInitializer(ClassLoader $loader)
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index dd219e8c..7b29a9ee 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -49,17 +49,17 @@
},
{
"name": "catfan/medoo",
- "version": "v1.7.8",
- "version_normalized": "1.7.8.0",
+ "version": "v1.5.7",
+ "version_normalized": "1.5.7.0",
"source": {
"type": "git",
"url": "https://github.com/catfan/Medoo.git",
- "reference": "dd9d570584cfb1e09ec470608479b86e41d5b60d"
+ "reference": "8d90cba0e8ff176028847527d0ea76fe41a06ecf"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/catfan/Medoo/zipball/dd9d570584cfb1e09ec470608479b86e41d5b60d",
- "reference": "dd9d570584cfb1e09ec470608479b86e41d5b60d",
+ "url": "https://api.github.com/repos/catfan/Medoo/zipball/8d90cba0e8ff176028847527d0ea76fe41a06ecf",
+ "reference": "8d90cba0e8ff176028847527d0ea76fe41a06ecf",
"shasum": ""
},
"require": {
@@ -73,9 +73,9 @@
"ext-pdo_oci8": "For Oracle version 8 database",
"ext-pdo_pqsql": "For PostgreSQL database",
"ext-pdo_sqlite": "For SQLite database",
- "ext-pdo_sqlsrv": "For MSSQL database on both Window/Liunx platform"
+ "ext-pdo_sqlsrv": "For MSSQL database"
},
- "time": "2019-12-19T05:04:34+00:00",
+ "time": "2018-06-14T18:59:08+00:00",
"type": "framework",
"installation-source": "dist",
"autoload": {
@@ -93,11 +93,10 @@
"email": "angel@catfan.me"
}
],
- "description": "The lightweight PHP database framework to accelerate development",
+ "description": "The lightest PHP database framework to accelerate development",
"homepage": "https://medoo.in",
"keywords": [
"database",
- "database library",
"lightweight",
"mariadb",
"mssql",
@@ -111,26 +110,26 @@
},
{
"name": "ezyang/htmlpurifier",
- "version": "v4.12.0",
- "version_normalized": "4.12.0.0",
+ "version": "v4.10.0",
+ "version_normalized": "4.10.0.0",
"source": {
"type": "git",
"url": "https://github.com/ezyang/htmlpurifier.git",
- "reference": "a617e55bc62a87eec73bd456d146d134ad716f03"
+ "reference": "d85d39da4576a6934b72480be6978fb10c860021"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/a617e55bc62a87eec73bd456d146d134ad716f03",
- "reference": "a617e55bc62a87eec73bd456d146d134ad716f03",
+ "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/d85d39da4576a6934b72480be6978fb10c860021",
+ "reference": "d85d39da4576a6934b72480be6978fb10c860021",
"shasum": ""
},
"require": {
"php": ">=5.2"
},
"require-dev": {
- "simpletest/simpletest": "dev-master#72de02a7b80c6bb8864ef9bf66d41d2f58f826bd"
+ "simpletest/simpletest": "^1.1"
},
- "time": "2019-10-28T03:44:26+00:00",
+ "time": "2018-02-23T01:58:20+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@@ -143,7 +142,7 @@
},
"notification-url": "https://packagist.org/downloads/",
"license": [
- "LGPL-2.1-or-later"
+ "LGPL"
],
"authors": [
{
@@ -198,49 +197,47 @@
},
{
"name": "guzzlehttp/guzzle",
- "version": "6.5.2",
- "version_normalized": "6.5.2.0",
+ "version": "6.3.3",
+ "version_normalized": "6.3.3.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
- "reference": "43ece0e75098b7ecd8d13918293029e555a50f82"
+ "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/43ece0e75098b7ecd8d13918293029e555a50f82",
- "reference": "43ece0e75098b7ecd8d13918293029e555a50f82",
+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba",
+ "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba",
"shasum": ""
},
"require": {
- "ext-json": "*",
"guzzlehttp/promises": "^1.0",
- "guzzlehttp/psr7": "^1.6.1",
+ "guzzlehttp/psr7": "^1.4",
"php": ">=5.5"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
- "psr/log": "^1.1"
+ "psr/log": "^1.0"
},
"suggest": {
- "ext-intl": "Required for Internationalized Domain Name (IDN) support",
"psr/log": "Required for using the Log middleware"
},
- "time": "2019-12-23T11:57:10+00:00",
+ "time": "2018-04-22T15:46:56+00:00",
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "6.5-dev"
+ "dev-master": "6.3-dev"
}
},
"installation-source": "dist",
"autoload": {
- "psr-4": {
- "GuzzleHttp\\": "src/"
- },
"files": [
"src/functions_include.php"
- ]
+ ],
+ "psr-4": {
+ "GuzzleHttp\\": "src/"
+ }
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -320,39 +317,34 @@
},
{
"name": "guzzlehttp/psr7",
- "version": "1.6.1",
- "version_normalized": "1.6.1.0",
+ "version": "1.4.2",
+ "version_normalized": "1.4.2.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
- "reference": "239400de7a173fe9901b9ac7c06497751f00727a"
+ "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a",
- "reference": "239400de7a173fe9901b9ac7c06497751f00727a",
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
+ "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
"shasum": ""
},
"require": {
"php": ">=5.4.0",
- "psr/http-message": "~1.0",
- "ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
+ "psr/http-message": "~1.0"
},
"provide": {
"psr/http-message-implementation": "1.0"
},
"require-dev": {
- "ext-zlib": "*",
- "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8"
+ "phpunit/phpunit": "~4.0"
},
- "suggest": {
- "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses"
- },
- "time": "2019-07-01T23:21:34+00:00",
+ "time": "2017-03-20T17:10:46+00:00",
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.6-dev"
+ "dev-master": "1.4-dev"
}
},
"installation-source": "dist",
@@ -383,7 +375,6 @@
"keywords": [
"http",
"message",
- "psr-7",
"request",
"response",
"stream",
@@ -391,6 +382,60 @@
"url"
]
},
+ {
+ "name": "leafo/scssphp",
+ "version": "v0.7.7",
+ "version_normalized": "0.7.7.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/leafo/scssphp.git",
+ "reference": "1d656f8c02a3a69404bba6b28ec4e06edddf0f49"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/leafo/scssphp/zipball/1d656f8c02a3a69404bba6b28ec4e06edddf0f49",
+ "reference": "1d656f8c02a3a69404bba6b28ec4e06edddf0f49",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.6",
+ "squizlabs/php_codesniffer": "~2.5"
+ },
+ "time": "2018-07-22T01:22:08+00:00",
+ "bin": [
+ "bin/pscss"
+ ],
+ "type": "library",
+ "installation-source": "dist",
+ "autoload": {
+ "psr-4": {
+ "Leafo\\ScssPhp\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Leaf Corcoran",
+ "email": "leafot@gmail.com",
+ "homepage": "http://leafo.net"
+ }
+ ],
+ "description": "scssphp is a compiler for SCSS written in PHP.",
+ "homepage": "http://leafo.github.io/scssphp/",
+ "keywords": [
+ "css",
+ "less",
+ "sass",
+ "scss",
+ "stylesheet"
+ ]
+ },
{
"name": "league/plates",
"version": "3.3.0",
@@ -450,17 +495,17 @@
},
{
"name": "monolog/monolog",
- "version": "1.25.3",
- "version_normalized": "1.25.3.0",
+ "version": "1.23.0",
+ "version_normalized": "1.23.0.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
- "reference": "fa82921994db851a8becaf3787a9e73c5976b6f1"
+ "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fa82921994db851a8becaf3787a9e73c5976b6f1",
- "reference": "fa82921994db851a8becaf3787a9e73c5976b6f1",
+ "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4",
+ "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4",
"shasum": ""
},
"require": {
@@ -496,7 +541,7 @@
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
"sentry/sentry": "Allow sending log messages to a Sentry server"
},
- "time": "2019-12-20T14:15:16+00:00",
+ "time": "2017-06-19T01:22:40+00:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -696,27 +741,27 @@
},
{
"name": "psr/log",
- "version": "1.1.2",
- "version_normalized": "1.1.2.0",
+ "version": "1.0.2",
+ "version_normalized": "1.0.2.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
- "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801"
+ "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801",
- "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
+ "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
- "time": "2019-11-01T11:05:21+00:00",
+ "time": "2016-10-10T12:19:37+00:00",
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.1.x-dev"
+ "dev-master": "1.0.x-dev"
}
},
"installation-source": "dist",
@@ -743,111 +788,6 @@
"psr-3"
]
},
- {
- "name": "ralouphie/getallheaders",
- "version": "3.0.3",
- "version_normalized": "3.0.3.0",
- "source": {
- "type": "git",
- "url": "https://github.com/ralouphie/getallheaders.git",
- "reference": "120b605dfeb996808c31b6477290a714d356e822"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
- "reference": "120b605dfeb996808c31b6477290a714d356e822",
- "shasum": ""
- },
- "require": {
- "php": ">=5.6"
- },
- "require-dev": {
- "php-coveralls/php-coveralls": "^2.1",
- "phpunit/phpunit": "^5 || ^6.5"
- },
- "time": "2019-03-08T08:55:37+00:00",
- "type": "library",
- "installation-source": "dist",
- "autoload": {
- "files": [
- "src/getallheaders.php"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Ralph Khattar",
- "email": "ralph.khattar@gmail.com"
- }
- ],
- "description": "A polyfill for getallheaders."
- },
- {
- "name": "scssphp/scssphp",
- "version": "1.0.6",
- "version_normalized": "1.0.6.0",
- "source": {
- "type": "git",
- "url": "https://github.com/scssphp/scssphp.git",
- "reference": "5b3c9d704950d8f9637f5110c36c281ec47dc13c"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/scssphp/scssphp/zipball/5b3c9d704950d8f9637f5110c36c281ec47dc13c",
- "reference": "5b3c9d704950d8f9637f5110c36c281ec47dc13c",
- "shasum": ""
- },
- "require": {
- "ext-ctype": "*",
- "ext-json": "*",
- "php": ">=5.6.0"
- },
- "require-dev": {
- "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5 || ^8.3",
- "squizlabs/php_codesniffer": "~2.5",
- "twbs/bootstrap": "~4.3",
- "zurb/foundation": "~6.5"
- },
- "time": "2019-12-12T05:00:52+00:00",
- "bin": [
- "bin/pscss"
- ],
- "type": "library",
- "installation-source": "dist",
- "autoload": {
- "psr-4": {
- "ScssPhp\\ScssPhp\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Anthon Pang",
- "email": "apang@softwaredevelopment.ca",
- "homepage": "https://github.com/robocoder"
- },
- {
- "name": "Cédric Morin",
- "email": "cedric@yterium.com",
- "homepage": "https://github.com/Cerdic"
- }
- ],
- "description": "scssphp is a compiler for SCSS written in PHP.",
- "homepage": "http://scssphp.github.io/scssphp/",
- "keywords": [
- "css",
- "less",
- "sass",
- "scss",
- "stylesheet"
- ]
- },
{
"name": "sergeytsalkov/meekrodb",
"version": "v2.3",
@@ -895,36 +835,31 @@
},
{
"name": "symfony/lock",
- "version": "v4.4.3",
- "version_normalized": "4.4.3.0",
+ "version": "v4.1.1",
+ "version_normalized": "4.1.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/lock.git",
- "reference": "6c4f5b620871cfef5b004fc57f2ca74572ae03b3"
+ "reference": "d508b5dd92272cb74300396ecaadde969d0f7976"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/lock/zipball/6c4f5b620871cfef5b004fc57f2ca74572ae03b3",
- "reference": "6c4f5b620871cfef5b004fc57f2ca74572ae03b3",
+ "url": "https://api.github.com/repos/symfony/lock/zipball/d508b5dd92272cb74300396ecaadde969d0f7976",
+ "reference": "d508b5dd92272cb74300396ecaadde969d0f7976",
"shasum": ""
},
"require": {
"php": "^7.1.3",
"psr/log": "~1.0"
},
- "conflict": {
- "doctrine/dbal": "<2.5"
- },
"require-dev": {
- "doctrine/dbal": "~2.5",
- "mongodb/mongodb": "~1.1",
"predis/predis": "~1.0"
},
- "time": "2020-01-04T13:00:46+00:00",
+ "time": "2018-06-21T11:15:46+00:00",
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "4.4-dev"
+ "dev-master": "4.1-dev"
}
},
"installation-source": "dist",
@@ -941,13 +876,13 @@
"MIT"
],
"authors": [
- {
- "name": "Jérémy Derussé",
- "email": "jeremy@derusse.com"
- },
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
+ },
+ {
+ "name": "Jérémy Derussé",
+ "email": "jeremy@derusse.com"
}
],
"description": "Symfony Lock Component",
@@ -963,17 +898,17 @@
},
{
"name": "vlucas/valitron",
- "version": "v1.4.7",
- "version_normalized": "1.4.7.0",
+ "version": "v1.4.3",
+ "version_normalized": "1.4.3.0",
"source": {
"type": "git",
"url": "https://github.com/vlucas/valitron.git",
- "reference": "a03072bed1679660200766d134507a30193eaf6d"
+ "reference": "3c5463315bfa23b17f8949b100a960d035234e43"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/vlucas/valitron/zipball/a03072bed1679660200766d134507a30193eaf6d",
- "reference": "a03072bed1679660200766d134507a30193eaf6d",
+ "url": "https://api.github.com/repos/vlucas/valitron/zipball/3c5463315bfa23b17f8949b100a960d035234e43",
+ "reference": "3c5463315bfa23b17f8949b100a960d035234e43",
"shasum": ""
},
"require": {
@@ -985,7 +920,7 @@
"suggest": {
"ext-mbstring": "It can support the multiple bytes string length."
},
- "time": "2019-08-29T19:49:43+00:00",
+ "time": "2018-05-06T10:45:26+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@@ -1014,28 +949,27 @@
},
{
"name": "xemlock/htmlpurifier-html5",
- "version": "v0.1.11",
- "version_normalized": "0.1.11.0",
+ "version": "v0.1.7",
+ "version_normalized": "0.1.7.0",
"source": {
"type": "git",
"url": "https://github.com/xemlock/htmlpurifier-html5.git",
- "reference": "f0d563f9fd4a82a3d759043483f9a94c0d8c2255"
+ "reference": "b4b35e51ec75e0207c23035f7d9a354bdcdac359"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/xemlock/htmlpurifier-html5/zipball/f0d563f9fd4a82a3d759043483f9a94c0d8c2255",
- "reference": "f0d563f9fd4a82a3d759043483f9a94c0d8c2255",
+ "url": "https://api.github.com/repos/xemlock/htmlpurifier-html5/zipball/b4b35e51ec75e0207c23035f7d9a354bdcdac359",
+ "reference": "b4b35e51ec75e0207c23035f7d9a354bdcdac359",
"shasum": ""
},
"require": {
- "ezyang/htmlpurifier": "^4.8",
+ "ezyang/htmlpurifier": "^4.7",
"php": ">=5.2"
},
"require-dev": {
- "php-coveralls/php-coveralls": "^1.1|^2.1",
- "phpunit/phpunit": ">=4.7 <8.0"
+ "phpunit/phpunit": "4.7.*|5.7.*"
},
- "time": "2019-08-07T17:19:21+00:00",
+ "time": "2018-06-07T14:30:17+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@@ -1053,16 +987,6 @@
"email": "xemlock@gmail.com"
}
],
- "description": "HTML5 element definitions for HTML Purifier",
- "keywords": [
- "HTML5",
- "Purifier",
- "html",
- "htmlpurifier",
- "security",
- "tidy",
- "validator",
- "xss"
- ]
+ "description": "HTML Purifier definitions for HTML5 elements"
}
]
diff --git a/vendor/ezyang/htmlpurifier/INSTALL b/vendor/ezyang/htmlpurifier/INSTALL
index 5f6a965f..e6dd02af 100644
--- a/vendor/ezyang/htmlpurifier/INSTALL
+++ b/vendor/ezyang/htmlpurifier/INSTALL
@@ -15,7 +15,7 @@ with these contents.
---------------------------------------------------------------------------
1. Compatibility
-HTML Purifier is PHP 5 and PHP 7, and is actively tested from PHP 5.3
+HTML Purifier is PHP 5 and PHP 7, and is actively tested from PHP 5.0.5
and up. It has no core dependencies with other libraries.
These optional extensions can enhance the capabilities of HTML Purifier:
@@ -101,6 +101,31 @@ Autoload compatibility
autoloader, but there are some cases where you will need to change
your own code to accomodate HTML Purifier. These are those cases:
+ PHP VERSION IS LESS THAN 5.1.2, AND YOU'VE DEFINED __autoload
+ Because spl_autoload_register() doesn't exist in early versions
+ of PHP 5, HTML Purifier has no way of adding itself to the autoload
+ stack. Modify your __autoload function to test
+ HTMLPurifier_Bootstrap::autoload($class)
+
+ For example, suppose your autoload function looks like this:
+
+ function __autoload($class) {
+ require str_replace('_', '/', $class) . '.php';
+ return true;
+ }
+
+ A modified version with HTML Purifier would look like this:
+
+ function __autoload($class) {
+ if (HTMLPurifier_Bootstrap::autoload($class)) return true;
+ require str_replace('_', '/', $class) . '.php';
+ return true;
+ }
+
+ Note that there *is* some custom behavior in our autoloader; the
+ original autoloader in our example would work for 99% of the time,
+ but would fail when including language files.
+
AN __autoload FUNCTION IS DECLARED AFTER OUR AUTOLOADER IS REGISTERED
spl_autoload_register() has the curious behavior of disabling
the existing __autoload() handler. Users need to explicitly
@@ -113,6 +138,11 @@ Autoload compatibility
spl_autoload_register('__autoload')
+ Users should also be on guard if they use a version of PHP previous
+ to 5.1.2 without an autoloader--HTML Purifier will define __autoload()
+ for you, which can collide with an autoloader that was added by *you*
+ later.
+
For better performance
----------------------
@@ -174,7 +204,9 @@ For advanced users
HTMLPurifier.autoload.php
Registers our autoload handler HTMLPurifier_Bootstrap::autoload($class).
- You can do these operations by yourself, if you like.
+ You can do these operations by yourself--in fact, you must modify your own
+ autoload handler if you are using a version of PHP earlier than PHP 5.1.2
+ (See "Autoload compatibility" above).
---------------------------------------------------------------------------
diff --git a/vendor/ezyang/htmlpurifier/INSTALL.fr.utf8 b/vendor/ezyang/htmlpurifier/INSTALL.fr.utf8
index 629387e2..95164abb 100644
--- a/vendor/ezyang/htmlpurifier/INSTALL.fr.utf8
+++ b/vendor/ezyang/htmlpurifier/INSTALL.fr.utf8
@@ -11,7 +11,7 @@ pied de page, mais je recommande de lire le document.
1. Compatibilité
-HTML Purifier fonctionne avec PHP 5. PHP 5.3 est la dernière version testée.
+HTML Purifier fonctionne avec PHP 5. PHP 5.0.5 est la dernière version testée.
Il ne dépend pas d'autres librairies.
Les extensions optionnelles sont iconv (généralement déjà installée) et tidy
diff --git a/vendor/ezyang/htmlpurifier/NEWS b/vendor/ezyang/htmlpurifier/NEWS
index 35283501..9b6e1023 100644
--- a/vendor/ezyang/htmlpurifier/NEWS
+++ b/vendor/ezyang/htmlpurifier/NEWS
@@ -9,40 +9,6 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
. Internal change
==========================
-4.12.0, released 2019-10-27
-! PHP 7.4 is supported, thank you Witold Wasiczko, Mateuz Turcza and
- Edi Modrić
-- PHPDocs for HTMLModule::addElement() and Bool attr are fixed (thanks
- Mateusz)
-
-4.11.0, released 2019-07-14
-# SafeScripting now matches case-sensitively against its whitelist (previously it was
- case-insensitive.) Thanks Dimitri Gritsajuk
- for reporting.
-! New directive %Core.AllowParseManyTags which allows parsing of many nested tags.
- Thanks M. Suzuki for contributing the patch.
-! purifyArray now supports multidimensional arrays. Thanks
- Sandro Miguel Marques for contributing this patch.
-! initial and inherit settings available for width, height, and the min-/max-
- versions thereof. Thanks Michael Kliewe for contributing
- this patch.
-! More color names are supported. Thanks Daijobou for contributing.
-- Compatibility fixes for PHP 7.3, including new CI for PHP 7.3
- (thank you Lukas Neumann ) and removal of
- reserved words in our constants (thanks Darko Hrgovic
-- Compatibility fixes for HHVM. Thanks Mateusz Turcza for contributing
- this fix.
-- HTML Purifier now never defines __autoload, fixing #196. Thanks
- Michael Kliewe for reporting.
-- In some situations, Config.php would report an undefined index: class
- error; this has been fixed. Thanks DiLong Fa for contributing
- this fix.
-- We no longer produce tags; we always explicitly write
- out the open and close tag. Thanks Dimitri Gritsajuk
- for contributing this fix.
-- Better compatibility when IDNA constants are not present. Thanks
- Mateusz Turcza for contributing this fix.
-
4.10.0, released 2018-02-22
# PHP 5.3 is no longer officially supported by HTML Purifier
(we did not specifically break support, but we are no longer
diff --git a/vendor/ezyang/htmlpurifier/README.md b/vendor/ezyang/htmlpurifier/README.md
index 9e0becc0..37715c60 100644
--- a/vendor/ezyang/htmlpurifier/README.md
+++ b/vendor/ezyang/htmlpurifier/README.md
@@ -26,4 +26,4 @@ Package available on [Composer](https://packagist.org/packages/ezyang/htmlpurifi
If you're using Composer to manage dependencies, you can use
- $ composer require ezyang/htmlpurifier
+ $ composer require "ezyang/htmlpurifier":"dev-master"
diff --git a/vendor/ezyang/htmlpurifier/VERSION b/vendor/ezyang/htmlpurifier/VERSION
index bcd250ed..1910ba9d 100644
--- a/vendor/ezyang/htmlpurifier/VERSION
+++ b/vendor/ezyang/htmlpurifier/VERSION
@@ -1 +1 @@
-4.12.0
\ No newline at end of file
+4.10.0
\ No newline at end of file
diff --git a/vendor/ezyang/htmlpurifier/WHATSNEW b/vendor/ezyang/htmlpurifier/WHATSNEW
index aec9b37c..810086f2 100644
--- a/vendor/ezyang/htmlpurifier/WHATSNEW
+++ b/vendor/ezyang/htmlpurifier/WHATSNEW
@@ -1,2 +1,13 @@
-HTML Purifier 4.12.x is a maintenance release which makes
-compatibility fixes for PHP 7.4.
+HTML Purifier 4.9.x is a maintenance release, collecting a year
+of accumulated bug fixes plus a few new features. New features
+include support for min/max-width/height CSS, and rgba/hsl/hsla
+in color specifications. Major bugfixes include improvements
+in the Serializer cache to avoid chmod'ing directories, better
+entity decoding (we won't accidentally encode entities that occur
+in URLs) and rel="noopener" on links with target attributes,
+to prevent them from overwriting the original frame.
+
+4.9.3 works around an infinite loop bug in PHP 7.1 with the opcode
+cache (and has one other, minor bugfix, avoiding using autoloading
+when testing for DOMDocument presence). If these bugs do not
+affect you, you do not need to upgrade.
diff --git a/vendor/ezyang/htmlpurifier/composer.json b/vendor/ezyang/htmlpurifier/composer.json
index ef4134fd..80fee3db 100644
--- a/vendor/ezyang/htmlpurifier/composer.json
+++ b/vendor/ezyang/htmlpurifier/composer.json
@@ -4,7 +4,7 @@
"type": "library",
"keywords": ["html"],
"homepage": "http://htmlpurifier.org/",
- "license": "LGPL-2.1-or-later",
+ "license": "LGPL",
"authors": [
{
"name": "Edward Z. Yang",
@@ -16,7 +16,7 @@
"php": ">=5.2"
},
"require-dev": {
- "simpletest/simpletest": "dev-master#72de02a7b80c6bb8864ef9bf66d41d2f58f826bd"
+ "simpletest/simpletest": "^1.1"
},
"autoload": {
"psr-0": { "HTMLPurifier": "library/" },
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier.includes.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier.includes.php
index 3158b2b8..321bdc56 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier.includes.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier.includes.php
@@ -7,7 +7,7 @@
* primary concern and you are using an opcode cache. PLEASE DO NOT EDIT THIS
* FILE, changes will be overwritten the next time the script is run.
*
- * @version 4.12.0
+ * @version 4.10.0
*
* @warning
* You must *not* include any other HTML Purifier files before this file,
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier.php
index 58bbddb0..bada5188 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier.php
@@ -19,7 +19,7 @@
*/
/*
- HTML Purifier 4.12.0 - Standards Compliant HTML Filtering
+ HTML Purifier 4.10.0 - Standards Compliant HTML Filtering
Copyright (C) 2006-2008 Edward Z. Yang
This library is free software; you can redistribute it and/or
@@ -58,12 +58,12 @@ class HTMLPurifier
* Version of HTML Purifier.
* @type string
*/
- public $version = '4.12.0';
+ public $version = '4.10.0';
/**
* Constant with version of HTML Purifier.
*/
- const VERSION = '4.12.0';
+ const VERSION = '4.10.0';
/**
* Global configuration object.
@@ -240,16 +240,12 @@ class HTMLPurifier
public function purifyArray($array_of_html, $config = null)
{
$context_array = array();
- foreach($array_of_html as $key=>$value){
- if (is_array($value)) {
- $array[$key] = $this->purifyArray($value, $config);
- } else {
- $array[$key] = $this->purify($value, $config);
- }
+ foreach ($array_of_html as $key => $html) {
+ $array_of_html[$key] = $this->purify($html, $config);
$context_array[$key] = $this->context;
}
$this->context = $context_array;
- return $array;
+ return $array_of_html;
}
/**
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Bool.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Bool.php
index be3bbc8d..dea15d2c 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Bool.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/HTML/Bool.php
@@ -7,7 +7,7 @@ class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef
{
/**
- * @type string
+ * @type bool
*/
protected $name;
@@ -17,7 +17,7 @@ class HTMLPurifier_AttrDef_HTML_Bool extends HTMLPurifier_AttrDef
public $minimized = true;
/**
- * @param bool|string $name
+ * @param bool $name
*/
public function __construct($name = false)
{
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Host.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Host.php
index 1beeaa5d..e54a3344 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Host.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Host.php
@@ -97,11 +97,7 @@ class HTMLPurifier_AttrDef_URI_Host extends HTMLPurifier_AttrDef
// PHP 5.3 and later support this functionality natively
if (function_exists('idn_to_ascii')) {
- if (defined('IDNA_NONTRANSITIONAL_TO_ASCII') && defined('INTL_IDNA_VARIANT_UTS46')) {
- $string = idn_to_ascii($string, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46);
- } else {
- $string = idn_to_ascii($string);
- }
+ $string = idn_to_ascii($string, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46);
// If we have Net_IDNA2 support, we can support IRIs by
// punycoding them. (This is the most portable thing to do,
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/CSSDefinition.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/CSSDefinition.php
index 21f1a589..47dfd1f6 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/CSSDefinition.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/CSSDefinition.php
@@ -220,25 +220,15 @@ class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition
array(
new HTMLPurifier_AttrDef_CSS_Length('0'),
new HTMLPurifier_AttrDef_CSS_Percentage(true),
- new HTMLPurifier_AttrDef_Enum(array('auto', 'initial', 'inherit'))
- )
- );
- $trusted_min_wh = new HTMLPurifier_AttrDef_CSS_Composite(
- array(
- new HTMLPurifier_AttrDef_CSS_Length('0'),
- new HTMLPurifier_AttrDef_CSS_Percentage(true),
- new HTMLPurifier_AttrDef_Enum(array('initial', 'inherit'))
- )
- );
- $trusted_max_wh = new HTMLPurifier_AttrDef_CSS_Composite(
- array(
- new HTMLPurifier_AttrDef_CSS_Length('0'),
- new HTMLPurifier_AttrDef_CSS_Percentage(true),
- new HTMLPurifier_AttrDef_Enum(array('none', 'initial', 'inherit'))
+ new HTMLPurifier_AttrDef_Enum(array('auto'))
)
);
$max = $config->get('CSS.MaxImgLength');
+ $this->info['min-width'] =
+ $this->info['max-width'] =
+ $this->info['min-height'] =
+ $this->info['max-height'] =
$this->info['width'] =
$this->info['height'] =
$max === null ?
@@ -255,38 +245,6 @@ class HTMLPurifier_CSSDefinition extends HTMLPurifier_Definition
// For everyone else:
$trusted_wh
);
- $this->info['min-width'] =
- $this->info['min-height'] =
- $max === null ?
- $trusted_min_wh :
- new HTMLPurifier_AttrDef_Switch(
- 'img',
- // For img tags:
- new HTMLPurifier_AttrDef_CSS_Composite(
- array(
- new HTMLPurifier_AttrDef_CSS_Length('0', $max),
- new HTMLPurifier_AttrDef_Enum(array('initial', 'inherit'))
- )
- ),
- // For everyone else:
- $trusted_min_wh
- );
- $this->info['max-width'] =
- $this->info['max-height'] =
- $max === null ?
- $trusted_max_wh :
- new HTMLPurifier_AttrDef_Switch(
- 'img',
- // For img tags:
- new HTMLPurifier_AttrDef_CSS_Composite(
- array(
- new HTMLPurifier_AttrDef_CSS_Length('0', $max),
- new HTMLPurifier_AttrDef_Enum(array('none', 'initial', 'inherit'))
- )
- ),
- // For everyone else:
- $trusted_max_wh
- );
$this->info['text-decoration'] = new HTMLPurifier_AttrDef_CSS_TextDecoration();
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/Custom.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/Custom.php
index f515888a..128132e9 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/Custom.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ChildDef/Custom.php
@@ -45,7 +45,7 @@ class HTMLPurifier_ChildDef_Custom extends HTMLPurifier_ChildDef
protected function _compileRegex()
{
$raw = str_replace(' ', '', $this->dtd_regex);
- if ($raw[0] != '(') {
+ if ($raw{0} != '(') {
$raw = "($raw)";
}
$el = '[#a-zA-Z0-9_.-]+';
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Config.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Config.php
index f569d40c..f37cf371 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Config.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Config.php
@@ -21,7 +21,7 @@ class HTMLPurifier_Config
* HTML Purifier's version
* @type string
*/
- public $version = '4.12.0';
+ public $version = '4.10.0';
/**
* Whether or not to automatically finalize
@@ -890,7 +890,7 @@ class HTMLPurifier_Config
// zip(tail(trace), trace) -- but PHP is not Haskell har har
for ($i = 0, $c = count($trace); $i < $c - 1; $i++) {
// XXX this is not correct on some versions of HTML Purifier
- if (isset($trace[$i + 1]['class']) && $trace[$i + 1]['class'] === 'HTMLPurifier_Config') {
+ if ($trace[$i + 1]['class'] === 'HTMLPurifier_Config') {
continue;
}
$frame = $trace[$i];
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema.php
index c3fe8cd4..655c0e97 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema.php
@@ -100,7 +100,7 @@ class HTMLPurifier_ConfigSchema
* @param string $key Name of directive
* @param mixed $default Default value of directive
* @param string $type Allowed type of the directive. See
- * HTMLPurifier_VarParser::$types for allowed values
+ * HTMLPurifier_DirectiveDef::$type for allowed values
* @param bool $allow_null Whether or not to allow null values
*/
public function add($key, $default, $type, $allow_null)
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema.ser b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema.ser
index 47bd259b..371e948f 100644
Binary files a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema.ser and b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema.ser differ
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.RemoveNbsp.txt b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.RemoveNbsp.txt
index 9228dee2..ca17eb1d 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.RemoveNbsp.txt
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/AutoFormat.RemoveEmpty.RemoveNbsp.txt
@@ -6,7 +6,7 @@ DEFAULT: false
When enabled, HTML Purifier will treat any elements that contain only
non-breaking spaces as well as regular whitespace as empty, and remove
- them when %AutoFormat.RemoveEmpty is enabled.
+ them when %AutoForamt.RemoveEmpty is enabled.
See %AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions for a list of elements
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.AllowParseManyTags.txt b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.AllowParseManyTags.txt
deleted file mode 100644
index 06278f82..00000000
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.AllowParseManyTags.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-Core.AllowParseManyTags
-TYPE: bool
-DEFAULT: false
-VERSION: 4.10.1
---DESCRIPTION--
-
- This directive allows parsing of many nested tags.
- If you set true, relaxes any hardcoded limit from the parser.
- However, in that case it may cause a Dos attack.
- Be careful when enabling it.
-
---# vim: et sw=4 sts=4
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.ColorKeywords.txt b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.ColorKeywords.txt
index a75844cd..c572c14e 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.ColorKeywords.txt
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/ConfigSchema/schema/Core.ColorKeywords.txt
@@ -3,154 +3,23 @@ TYPE: hash
VERSION: 2.0.0
--DEFAULT--
array (
- 'aliceblue' => '#F0F8FF',
- 'antiquewhite' => '#FAEBD7',
- 'aqua' => '#00FFFF',
- 'aquamarine' => '#7FFFD4',
- 'azure' => '#F0FFFF',
- 'beige' => '#F5F5DC',
- 'bisque' => '#FFE4C4',
- 'black' => '#000000',
- 'blanchedalmond' => '#FFEBCD',
- 'blue' => '#0000FF',
- 'blueviolet' => '#8A2BE2',
- 'brown' => '#A52A2A',
- 'burlywood' => '#DEB887',
- 'cadetblue' => '#5F9EA0',
- 'chartreuse' => '#7FFF00',
- 'chocolate' => '#D2691E',
- 'coral' => '#FF7F50',
- 'cornflowerblue' => '#6495ED',
- 'cornsilk' => '#FFF8DC',
- 'crimson' => '#DC143C',
- 'cyan' => '#00FFFF',
- 'darkblue' => '#00008B',
- 'darkcyan' => '#008B8B',
- 'darkgoldenrod' => '#B8860B',
- 'darkgray' => '#A9A9A9',
- 'darkgrey' => '#A9A9A9',
- 'darkgreen' => '#006400',
- 'darkkhaki' => '#BDB76B',
- 'darkmagenta' => '#8B008B',
- 'darkolivegreen' => '#556B2F',
- 'darkorange' => '#FF8C00',
- 'darkorchid' => '#9932CC',
- 'darkred' => '#8B0000',
- 'darksalmon' => '#E9967A',
- 'darkseagreen' => '#8FBC8F',
- 'darkslateblue' => '#483D8B',
- 'darkslategray' => '#2F4F4F',
- 'darkslategrey' => '#2F4F4F',
- 'darkturquoise' => '#00CED1',
- 'darkviolet' => '#9400D3',
- 'deeppink' => '#FF1493',
- 'deepskyblue' => '#00BFFF',
- 'dimgray' => '#696969',
- 'dimgrey' => '#696969',
- 'dodgerblue' => '#1E90FF',
- 'firebrick' => '#B22222',
- 'floralwhite' => '#FFFAF0',
- 'forestgreen' => '#228B22',
- 'fuchsia' => '#FF00FF',
- 'gainsboro' => '#DCDCDC',
- 'ghostwhite' => '#F8F8FF',
- 'gold' => '#FFD700',
- 'goldenrod' => '#DAA520',
- 'gray' => '#808080',
- 'grey' => '#808080',
- 'green' => '#008000',
- 'greenyellow' => '#ADFF2F',
- 'honeydew' => '#F0FFF0',
- 'hotpink' => '#FF69B4',
- 'indianred' => '#CD5C5C',
- 'indigo' => '#4B0082',
- 'ivory' => '#FFFFF0',
- 'khaki' => '#F0E68C',
- 'lavender' => '#E6E6FA',
- 'lavenderblush' => '#FFF0F5',
- 'lawngreen' => '#7CFC00',
- 'lemonchiffon' => '#FFFACD',
- 'lightblue' => '#ADD8E6',
- 'lightcoral' => '#F08080',
- 'lightcyan' => '#E0FFFF',
- 'lightgoldenrodyellow' => '#FAFAD2',
- 'lightgray' => '#D3D3D3',
- 'lightgrey' => '#D3D3D3',
- 'lightgreen' => '#90EE90',
- 'lightpink' => '#FFB6C1',
- 'lightsalmon' => '#FFA07A',
- 'lightseagreen' => '#20B2AA',
- 'lightskyblue' => '#87CEFA',
- 'lightslategray' => '#778899',
- 'lightslategrey' => '#778899',
- 'lightsteelblue' => '#B0C4DE',
- 'lightyellow' => '#FFFFE0',
- 'lime' => '#00FF00',
- 'limegreen' => '#32CD32',
- 'linen' => '#FAF0E6',
- 'magenta' => '#FF00FF',
'maroon' => '#800000',
- 'mediumaquamarine' => '#66CDAA',
- 'mediumblue' => '#0000CD',
- 'mediumorchid' => '#BA55D3',
- 'mediumpurple' => '#9370DB',
- 'mediumseagreen' => '#3CB371',
- 'mediumslateblue' => '#7B68EE',
- 'mediumspringgreen' => '#00FA9A',
- 'mediumturquoise' => '#48D1CC',
- 'mediumvioletred' => '#C71585',
- 'midnightblue' => '#191970',
- 'mintcream' => '#F5FFFA',
- 'mistyrose' => '#FFE4E1',
- 'moccasin' => '#FFE4B5',
- 'navajowhite' => '#FFDEAD',
- 'navy' => '#000080',
- 'oldlace' => '#FDF5E6',
- 'olive' => '#808000',
- 'olivedrab' => '#6B8E23',
- 'orange' => '#FFA500',
- 'orangered' => '#FF4500',
- 'orchid' => '#DA70D6',
- 'palegoldenrod' => '#EEE8AA',
- 'palegreen' => '#98FB98',
- 'paleturquoise' => '#AFEEEE',
- 'palevioletred' => '#DB7093',
- 'papayawhip' => '#FFEFD5',
- 'peachpuff' => '#FFDAB9',
- 'peru' => '#CD853F',
- 'pink' => '#FFC0CB',
- 'plum' => '#DDA0DD',
- 'powderblue' => '#B0E0E6',
- 'purple' => '#800080',
- 'rebeccapurple' => '#663399',
'red' => '#FF0000',
- 'rosybrown' => '#BC8F8F',
- 'royalblue' => '#4169E1',
- 'saddlebrown' => '#8B4513',
- 'salmon' => '#FA8072',
- 'sandybrown' => '#F4A460',
- 'seagreen' => '#2E8B57',
- 'seashell' => '#FFF5EE',
- 'sienna' => '#A0522D',
- 'silver' => '#C0C0C0',
- 'skyblue' => '#87CEEB',
- 'slateblue' => '#6A5ACD',
- 'slategray' => '#708090',
- 'slategrey' => '#708090',
- 'snow' => '#FFFAFA',
- 'springgreen' => '#00FF7F',
- 'steelblue' => '#4682B4',
- 'tan' => '#D2B48C',
- 'teal' => '#008080',
- 'thistle' => '#D8BFD8',
- 'tomato' => '#FF6347',
- 'turquoise' => '#40E0D0',
- 'violet' => '#EE82EE',
- 'wheat' => '#F5DEB3',
- 'white' => '#FFFFFF',
- 'whitesmoke' => '#F5F5F5',
+ 'orange' => '#FFA500',
'yellow' => '#FFFF00',
- 'yellowgreen' => '#9ACD32'
+ 'olive' => '#808000',
+ 'purple' => '#800080',
+ 'fuchsia' => '#FF00FF',
+ 'white' => '#FFFFFF',
+ 'lime' => '#00FF00',
+ 'green' => '#008000',
+ 'navy' => '#000080',
+ 'blue' => '#0000FF',
+ 'aqua' => '#00FFFF',
+ 'teal' => '#008080',
+ 'black' => '#000000',
+ 'silver' => '#C0C0C0',
+ 'gray' => '#808080',
)
--DESCRIPTION--
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Encoder.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Encoder.php
index 40a24266..b94f1754 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Encoder.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Encoder.php
@@ -159,7 +159,7 @@ class HTMLPurifier_Encoder
$len = strlen($str);
for ($i = 0; $i < $len; $i++) {
- $in = ord($str[$i]);
+ $in = ord($str{$i});
$char .= $str[$i]; // append byte to char
if (0 == $mState) {
// When mState is zero we expect either a US-ASCII character
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/EntityParser.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/EntityParser.php
index 3ef2d09e..c372b5a6 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/EntityParser.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/EntityParser.php
@@ -118,7 +118,7 @@ class HTMLPurifier_EntityParser
$entity = $matches[0];
$hex_part = @$matches[1];
$dec_part = @$matches[2];
- $named_part = empty($matches[3]) ? (empty($matches[4]) ? "" : $matches[4]) : $matches[3];
+ $named_part = empty($matches[3]) ? @$matches[4] : $matches[3];
if ($hex_part !== NULL && $hex_part !== "") {
return HTMLPurifier_Encoder::unichr(hexdec($hex_part));
} elseif ($dec_part !== NULL && $dec_part !== "") {
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule.php
index 6d898f80..bb3a9230 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule.php
@@ -132,9 +132,9 @@ class HTMLPurifier_HTMLModule
* @param string $element Name of element to add
* @param string|bool $type What content set should element be registered to?
* Set as false to skip this step.
- * @param string|HTMLPurifier_ChildDef $contents Allowed children in form of:
+ * @param string $contents Allowed children in form of:
* "$content_model_type: $content_model"
- * @param array|string $attr_includes What attribute collections to register to
+ * @param array $attr_includes What attribute collections to register to
* element?
* @param array $attr What unique attributes does the element define?
* @see HTMLPurifier_ElementDef:: for in-depth descriptions of these parameters.
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/SafeScripting.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/SafeScripting.php
index aea7584c..0330cd97 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/SafeScripting.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/HTMLModule/SafeScripting.php
@@ -23,13 +23,13 @@ class HTMLPurifier_HTMLModule_SafeScripting extends HTMLPurifier_HTMLModule
$script = $this->addElement(
'script',
'Inline',
- 'Optional:', // Not `Empty` to not allow to autoclose the tag @see https://www.w3.org/TR/html4/interact/scripts.html
+ 'Empty',
null,
array(
// While technically not required by the spec, we're forcing
// it to this value.
'type' => 'Enum#text/javascript',
- 'src*' => new HTMLPurifier_AttrDef_Enum(array_keys($allowed), /*case sensitive*/ true)
+ 'src*' => new HTMLPurifier_AttrDef_Enum(array_keys($allowed))
)
);
$script->attr_transform_pre[] =
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Language/messages/en-x-test.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Language/messages/en-x-test.php
index dd5f5024..1c046f37 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Language/messages/en-x-test.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Language/messages/en-x-test.php
@@ -8,6 +8,4 @@ $messages = array(
'HTMLPurifier' => 'HTML Purifier X'
);
-$errorNames = array();
-
// vim: et sw=4 sts=4
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Language/messages/en-x-testmini.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Language/messages/en-x-testmini.php
index e1e7db50..806c83fb 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Language/messages/en-x-testmini.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Language/messages/en-x-testmini.php
@@ -9,6 +9,4 @@ $messages = array(
'HTMLPurifier' => 'HTML Purifier XNone'
);
-$errorNames = array();
-
// vim: et sw=4 sts=4
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Lexer/DOMLex.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Lexer/DOMLex.php
index ca5f25b8..6238a99e 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Lexer/DOMLex.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Lexer/DOMLex.php
@@ -68,18 +68,8 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
$doc = new DOMDocument();
$doc->encoding = 'UTF-8'; // theoretically, the above has this covered
- $options = 0;
- if ($config->get('Core.AllowParseManyTags') && defined('LIBXML_PARSEHUGE')) {
- $options |= LIBXML_PARSEHUGE;
- }
-
set_error_handler(array($this, 'muteErrorHandler'));
- // loadHTML() fails on PHP 5.3 when second parameter is given
- if ($options) {
- $doc->loadHTML($html, $options);
- } else {
- $doc->loadHTML($html);
- }
+ $doc->loadHTML($html);
restore_error_handler();
$body = $doc->getElementsByTagName('html')->item(0)-> //
@@ -143,11 +133,11 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
*/
protected function getTagName($node)
{
- if (isset($node->tagName)) {
+ if (property_exists($node, 'tagName')) {
return $node->tagName;
- } else if (isset($node->nodeName)) {
+ } else if (property_exists($node, 'nodeName')) {
return $node->nodeName;
- } else if (isset($node->localName)) {
+ } else if (property_exists($node, 'localName')) {
return $node->localName;
}
return null;
@@ -160,11 +150,11 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
*/
protected function getData($node)
{
- if (isset($node->data)) {
+ if (property_exists($node, 'data')) {
return $node->data;
- } else if (isset($node->nodeValue)) {
+ } else if (property_exists($node, 'nodeValue')) {
return $node->nodeValue;
- } else if (isset($node->textContent)) {
+ } else if (property_exists($node, 'textContent')) {
return $node->textContent;
}
return null;
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Printer/ConfigForm.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Printer/ConfigForm.php
index 33ae1139..65a77790 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Printer/ConfigForm.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/Printer/ConfigForm.php
@@ -48,7 +48,7 @@ class HTMLPurifier_Printer_ConfigForm extends HTMLPurifier_Printer
$this->compress = $compress;
// initialize sub-printers
$this->fields[0] = new HTMLPurifier_Printer_ConfigForm_default();
- $this->fields[HTMLPurifier_VarParser::C_BOOL] = new HTMLPurifier_Printer_ConfigForm_bool();
+ $this->fields[HTMLPurifier_VarParser::BOOL] = new HTMLPurifier_Printer_ConfigForm_bool();
}
/**
@@ -339,7 +339,7 @@ class HTMLPurifier_Printer_ConfigForm_default extends HTMLPurifier_Printer
$value = '';
}
}
- if ($type === HTMLPurifier_VarParser::C_MIXED) {
+ if ($type === HTMLPurifier_VarParser::MIXED) {
return 'Not supported';
$value = serialize($value);
}
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/TagTransform/Font.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/TagTransform/Font.php
index 768c9b15..7853d90b 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/TagTransform/Font.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/TagTransform/Font.php
@@ -75,7 +75,7 @@ class HTMLPurifier_TagTransform_Font extends HTMLPurifier_TagTransform
if (isset($attr['size'])) {
// normalize large numbers
if ($attr['size'] !== '') {
- if ($attr['size'][0] == '+' || $attr['size'][0] == '-') {
+ if ($attr['size']{0} == '+' || $attr['size']{0} == '-') {
$size = (int)$attr['size'];
if ($size < -2) {
$attr['size'] = '-2';
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/VarParser.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/VarParser.php
index 0c97c828..50cba691 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/VarParser.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/VarParser.php
@@ -7,34 +7,34 @@
class HTMLPurifier_VarParser
{
- const C_STRING = 1;
+ const STRING = 1;
const ISTRING = 2;
const TEXT = 3;
const ITEXT = 4;
- const C_INT = 5;
- const C_FLOAT = 6;
- const C_BOOL = 7;
+ const INT = 5;
+ const FLOAT = 6;
+ const BOOL = 7;
const LOOKUP = 8;
const ALIST = 9;
const HASH = 10;
- const C_MIXED = 11;
+ const MIXED = 11;
/**
* Lookup table of allowed types. Mainly for backwards compatibility, but
* also convenient for transforming string type names to the integer constants.
*/
public static $types = array(
- 'string' => self::C_STRING,
+ 'string' => self::STRING,
'istring' => self::ISTRING,
'text' => self::TEXT,
'itext' => self::ITEXT,
- 'int' => self::C_INT,
- 'float' => self::C_FLOAT,
- 'bool' => self::C_BOOL,
+ 'int' => self::INT,
+ 'float' => self::FLOAT,
+ 'bool' => self::BOOL,
'lookup' => self::LOOKUP,
'list' => self::ALIST,
'hash' => self::HASH,
- 'mixed' => self::C_MIXED
+ 'mixed' => self::MIXED
);
/**
@@ -42,7 +42,7 @@ class HTMLPurifier_VarParser
* allowed value lists.
*/
public static $stringTypes = array(
- self::C_STRING => true,
+ self::STRING => true,
self::ISTRING => true,
self::TEXT => true,
self::ITEXT => true,
@@ -74,7 +74,7 @@ class HTMLPurifier_VarParser
// These are basic checks, to make sure nothing horribly wrong
// happened in our implementations.
switch ($type) {
- case (self::C_STRING):
+ case (self::STRING):
case (self::ISTRING):
case (self::TEXT):
case (self::ITEXT):
@@ -85,17 +85,17 @@ class HTMLPurifier_VarParser
$var = strtolower($var);
}
return $var;
- case (self::C_INT):
+ case (self::INT):
if (!is_int($var)) {
break;
}
return $var;
- case (self::C_FLOAT):
+ case (self::FLOAT):
if (!is_float($var)) {
break;
}
return $var;
- case (self::C_BOOL):
+ case (self::BOOL):
if (!is_bool($var)) {
break;
}
@@ -119,7 +119,7 @@ class HTMLPurifier_VarParser
}
}
return $var;
- case (self::C_MIXED):
+ case (self::MIXED):
return $var;
default:
$this->errorInconsistent(get_class($this), $type);
diff --git a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/VarParser/Flexible.php b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/VarParser/Flexible.php
index 3bfbe838..b15016c5 100644
--- a/vendor/ezyang/htmlpurifier/library/HTMLPurifier/VarParser/Flexible.php
+++ b/vendor/ezyang/htmlpurifier/library/HTMLPurifier/VarParser/Flexible.php
@@ -23,23 +23,23 @@ class HTMLPurifier_VarParser_Flexible extends HTMLPurifier_VarParser
// Note: if code "breaks" from the switch, it triggers a generic
// exception to be thrown. Specific errors can be specifically
// done here.
- case self::C_MIXED:
+ case self::MIXED:
case self::ISTRING:
- case self::C_STRING:
+ case self::STRING:
case self::TEXT:
case self::ITEXT:
return $var;
- case self::C_INT:
+ case self::INT:
if (is_string($var) && ctype_digit($var)) {
$var = (int)$var;
}
return $var;
- case self::C_FLOAT:
+ case self::FLOAT:
if ((is_string($var) && is_numeric($var)) || is_int($var)) {
$var = (float)$var;
}
return $var;
- case self::C_BOOL:
+ case self::BOOL:
if (is_int($var) && ($var === 0 || $var === 1)) {
$var = (bool)$var;
} elseif (is_string($var)) {
diff --git a/vendor/ezyang/htmlpurifier/maintenance/.htaccess b/vendor/ezyang/htmlpurifier/maintenance/.htaccess
index 8f6c1414..3a428827 100644
--- a/vendor/ezyang/htmlpurifier/maintenance/.htaccess
+++ b/vendor/ezyang/htmlpurifier/maintenance/.htaccess
@@ -1,7 +1 @@
-
- Require all denied
-
-
-
- Deny from all
-
+Deny from all
diff --git a/vendor/ezyang/htmlpurifier/maintenance/flush.php b/vendor/ezyang/htmlpurifier/maintenance/flush.php
new file mode 100644
index 00000000..c0853d23
--- /dev/null
+++ b/vendor/ezyang/htmlpurifier/maintenance/flush.php
@@ -0,0 +1,30 @@
+#!/usr/bin/php
+/dev/null && pwd )"
-php "$DIR/generate-includes.php"
-php "$DIR/generate-schema-cache.php"
-php "$DIR/flush-definition-cache.php"
-php "$DIR/generate-standalone.php"
-php "$DIR/config-scanner.php"
diff --git a/vendor/ezyang/htmlpurifier/maintenance/update-config.php b/vendor/ezyang/htmlpurifier/maintenance/update-config.php
new file mode 100644
index 00000000..2d8a7a9c
--- /dev/null
+++ b/vendor/ezyang/htmlpurifier/maintenance/update-config.php
@@ -0,0 +1,34 @@
+#!/usr/bin/php
+set and $config->get to the new
+ * format, as described by docs/dev-config-bcbreaks.txt
+ */
+
+$FS = new FSTools();
+chdir(dirname(__FILE__) . '/..');
+$raw_files = $FS->globr('.', '*.php');
+foreach ($raw_files as $file) {
+ $file = substr($file, 2); // rm leading './'
+ if (strpos($file, 'library/standalone/') === 0) continue;
+ if (strpos($file, 'maintenance/update-config.php') === 0) continue;
+ if (strpos($file, 'test-settings.php') === 0) continue;
+ if (substr_count($file, '.') > 1) continue; // rm meta files
+ // process the file
+ $contents = file_get_contents($file);
+ $contents = preg_replace(
+ "#config->(set|get)\('(.+?)', '(.+?)'#",
+ "config->\\1('\\2.\\3'",
+ $contents
+ );
+ if ($contents === '') continue;
+ file_put_contents($file, $contents);
+}
+
+// vim: et sw=4 sts=4
diff --git a/vendor/ezyang/htmlpurifier/plugins/phorum/config.default.php b/vendor/ezyang/htmlpurifier/plugins/phorum/config.default.php
index 29c1b749..e047c0b4 100644
--- a/vendor/ezyang/htmlpurifier/plugins/phorum/config.default.php
+++ b/vendor/ezyang/htmlpurifier/plugins/phorum/config.default.php
@@ -53,6 +53,5 @@ $config->set('Core.Encoding', $GLOBALS['PHORUM']['DATA']['CHARSET']); // we'll c
if (strtolower($GLOBALS['PHORUM']['DATA']['CHARSET']) !== 'utf-8') {
$config->set('Core.EscapeNonASCIICharacters', true);
}
-$config->set('Core.AllowParseManyTags', false);
// vim: et sw=4 sts=4
diff --git a/vendor/ezyang/htmlpurifier/update-for-release b/vendor/ezyang/htmlpurifier/release1-update.php
similarity index 98%
rename from vendor/ezyang/htmlpurifier/update-for-release
rename to vendor/ezyang/htmlpurifier/release1-update.php
index 32709d25..834d3856 100644
--- a/vendor/ezyang/htmlpurifier/update-for-release
+++ b/vendor/ezyang/htmlpurifier/release1-update.php
@@ -102,7 +102,7 @@ if (!$c) {
}
file_put_contents('library/HTMLPurifier/Config.php', $config_c);
-passthru('maintenance/flush.sh');
+passthru('php maintenance/flush.php');
if ($is_dev) echo "Review changes, write something in WHATSNEW and FOCUS, and then commit with log 'Release $version.'" . PHP_EOL;
else echo "Numbers updated to dev, no other modifications necessary!";
diff --git a/vendor/ezyang/htmlpurifier/release2-tag.php b/vendor/ezyang/htmlpurifier/release2-tag.php
new file mode 100644
index 00000000..25e5300d
--- /dev/null
+++ b/vendor/ezyang/htmlpurifier/release2-tag.php
@@ -0,0 +1,22 @@
+setRiskyAllowed(true)
- ->setRules([
- '@PSR2' => true,
- 'array_syntax' => ['syntax' => 'short'],
- 'declare_strict_types' => false,
- 'concat_space' => ['spacing'=>'one'],
- 'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
- 'ordered_imports' => true,
- // 'phpdoc_align' => ['align'=>'vertical'],
- // 'native_function_invocation' => true,
- ])
- ->setFinder(
- PhpCsFixer\Finder::create()
- ->in(__DIR__.'/src')
- ->in(__DIR__.'/tests')
- ->name('*.php')
- )
-;
-
-return $config;
diff --git a/vendor/guzzlehttp/guzzle/CHANGELOG.md b/vendor/guzzlehttp/guzzle/CHANGELOG.md
index a2b61e71..17badd75 100644
--- a/vendor/guzzlehttp/guzzle/CHANGELOG.md
+++ b/vendor/guzzlehttp/guzzle/CHANGELOG.md
@@ -1,40 +1,5 @@
# Change Log
-## 6.5.2 - 2019-12-23
-
-* idn_to_ascii() fix for old PHP versions [#2489](https://github.com/guzzle/guzzle/pull/2489)
-
-## 6.5.1 - 2019-12-21
-
-* Better defaults for PHP installations with old ICU lib [#2454](https://github.com/guzzle/guzzle/pull/2454)
-* IDN support for redirects [#2424](https://github.com/guzzle/guzzle/pull/2424)
-
-## 6.5.0 - 2019-12-07
-
-* Improvement: Added support for reset internal queue in MockHandler. [#2143](https://github.com/guzzle/guzzle/pull/2143)
-* Improvement: Added support to pass arbitrary options to `curl_multi_init`. [#2287](https://github.com/guzzle/guzzle/pull/2287)
-* Fix: Gracefully handle passing `null` to the `header` option. [#2132](https://github.com/guzzle/guzzle/pull/2132)
-* Fix: `RetryMiddleware` did not do exponential delay between retires due unit mismatch. [#2132](https://github.com/guzzle/guzzle/pull/2132)
-* Fix: Prevent undefined offset when using array for ssl_key options. [#2348](https://github.com/guzzle/guzzle/pull/2348)
-* Deprecated `ClientInterface::VERSION`
-
-## 6.4.1 - 2019-10-23
-
-* No `guzzle.phar` was created in 6.4.0 due expired API token. This release will fix that
-* Added `parent::__construct()` to `FileCookieJar` and `SessionCookieJar`
-
-## 6.4.0 - 2019-10-23
-
-* Improvement: Improved error messages when using curl < 7.21.2 [#2108](https://github.com/guzzle/guzzle/pull/2108)
-* Fix: Test if response is readable before returning a summary in `RequestException::getResponseBodySummary()` [#2081](https://github.com/guzzle/guzzle/pull/2081)
-* Fix: Add support for GUZZLE_CURL_SELECT_TIMEOUT environment variable [#2161](https://github.com/guzzle/guzzle/pull/2161)
-* Improvement: Added `GuzzleHttp\Exception\InvalidArgumentException` [#2163](https://github.com/guzzle/guzzle/pull/2163)
-* Improvement: Added `GuzzleHttp\_current_time()` to use `hrtime()` if that function exists. [#2242](https://github.com/guzzle/guzzle/pull/2242)
-* Improvement: Added curl's `appconnect_time` in `TransferStats` [#2284](https://github.com/guzzle/guzzle/pull/2284)
-* Improvement: Make GuzzleException extend Throwable wherever it's available [#2273](https://github.com/guzzle/guzzle/pull/2273)
-* Fix: Prevent concurrent writes to file when saving `CookieJar` [#2335](https://github.com/guzzle/guzzle/pull/2335)
-* Improvement: Update `MockHandler` so we can test transfer time [#2362](https://github.com/guzzle/guzzle/pull/2362)
-
## 6.3.3 - 2018-04-22
* Fix: Default headers when decode_content is specified
diff --git a/vendor/guzzlehttp/guzzle/Dockerfile b/vendor/guzzlehttp/guzzle/Dockerfile
deleted file mode 100644
index f6a09523..00000000
--- a/vendor/guzzlehttp/guzzle/Dockerfile
+++ /dev/null
@@ -1,18 +0,0 @@
-FROM composer:latest as setup
-
-RUN mkdir /guzzle
-
-WORKDIR /guzzle
-
-RUN set -xe \
- && composer init --name=guzzlehttp/test --description="Simple project for testing Guzzle scripts" --author="Márk Sági-Kazár " --no-interaction \
- && composer require guzzlehttp/guzzle
-
-
-FROM php:7.3
-
-RUN mkdir /guzzle
-
-WORKDIR /guzzle
-
-COPY --from=setup /guzzle /guzzle
diff --git a/vendor/guzzlehttp/guzzle/README.md b/vendor/guzzlehttp/guzzle/README.md
index 5fdb6c5f..bcd18b8e 100644
--- a/vendor/guzzlehttp/guzzle/README.md
+++ b/vendor/guzzlehttp/guzzle/README.md
@@ -21,18 +21,19 @@ trivial to integrate with web services.
```php
$client = new \GuzzleHttp\Client();
-$response = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle');
+$res = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle');
+echo $res->getStatusCode();
+// 200
+echo $res->getHeaderLine('content-type');
+// 'application/json; charset=utf8'
+echo $res->getBody();
+// '{"id": 1420053, "name": "guzzle", ...}'
-echo $response->getStatusCode(); # 200
-echo $response->getHeaderLine('content-type'); # 'application/json; charset=utf8'
-echo $response->getBody(); # '{"id": 1420053, "name": "guzzle", ...}'
-
-# Send an asynchronous request.
+// Send an asynchronous request.
$request = new \GuzzleHttp\Psr7\Request('GET', 'http://httpbin.org');
$promise = $client->sendAsync($request)->then(function ($response) {
echo 'I completed! ' . $response->getBody();
});
-
$promise->wait();
```
@@ -56,7 +57,7 @@ curl -sS https://getcomposer.org/installer | php
Next, run the Composer command to install the latest stable version of Guzzle:
```bash
-composer require guzzlehttp/guzzle
+php composer.phar require guzzlehttp/guzzle
```
After installing, you need to require Composer's autoloader:
@@ -68,7 +69,7 @@ require 'vendor/autoload.php';
You can then later update Guzzle using composer:
```bash
-composer update
+composer.phar update
```
@@ -78,13 +79,13 @@ composer update
|---------|------------|---------------------|--------------|---------------------|---------------------|-------|-------------|
| 3.x | EOL | `guzzle/guzzle` | `Guzzle` | [v3][guzzle-3-repo] | [v3][guzzle-3-docs] | No | >= 5.3.3 |
| 4.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | [v4][guzzle-4-repo] | N/A | No | >= 5.4 |
-| 5.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | [v5][guzzle-5-repo] | [v5][guzzle-5-docs] | No | >= 5.4 |
+| 5.x | Maintained | `guzzlehttp/guzzle` | `GuzzleHttp` | [v5][guzzle-5-repo] | [v5][guzzle-5-docs] | No | >= 5.4 |
| 6.x | Latest | `guzzlehttp/guzzle` | `GuzzleHttp` | [v6][guzzle-6-repo] | [v6][guzzle-6-docs] | Yes | >= 5.5 |
[guzzle-3-repo]: https://github.com/guzzle/guzzle3
[guzzle-4-repo]: https://github.com/guzzle/guzzle/tree/4.x
[guzzle-5-repo]: https://github.com/guzzle/guzzle/tree/5.3
[guzzle-6-repo]: https://github.com/guzzle/guzzle
-[guzzle-3-docs]: http://guzzle3.readthedocs.org
+[guzzle-3-docs]: http://guzzle3.readthedocs.org/en/latest/
[guzzle-5-docs]: http://guzzle.readthedocs.org/en/5.3/
[guzzle-6-docs]: http://guzzle.readthedocs.org/en/latest/
diff --git a/vendor/guzzlehttp/guzzle/composer.json b/vendor/guzzlehttp/guzzle/composer.json
index bbf0ff20..1f328e30 100644
--- a/vendor/guzzlehttp/guzzle/composer.json
+++ b/vendor/guzzlehttp/guzzle/composer.json
@@ -2,15 +2,7 @@
"name": "guzzlehttp/guzzle",
"type": "library",
"description": "Guzzle is a PHP HTTP client library",
- "keywords": [
- "framework",
- "http",
- "rest",
- "web service",
- "curl",
- "client",
- "HTTP client"
- ],
+ "keywords": ["framework", "http", "rest", "web service", "curl", "client", "HTTP client"],
"homepage": "http://guzzlephp.org/",
"license": "MIT",
"authors": [
@@ -22,38 +14,31 @@
],
"require": {
"php": ">=5.5",
- "ext-json": "*",
- "guzzlehttp/promises": "^1.0",
- "guzzlehttp/psr7": "^1.6.1"
+ "guzzlehttp/psr7": "^1.4",
+ "guzzlehttp/promises": "^1.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
- "psr/log": "^1.1"
- },
- "suggest": {
- "psr/log": "Required for using the Log middleware",
- "ext-intl": "Required for Internationalized Domain Name (IDN) support"
- },
- "config": {
- "sort-packages": true
- },
- "extra": {
- "branch-alias": {
- "dev-master": "6.5-dev"
- }
+ "psr/log": "^1.0"
},
"autoload": {
+ "files": ["src/functions_include.php"],
"psr-4": {
"GuzzleHttp\\": "src/"
- },
- "files": [
- "src/functions_include.php"
- ]
+ }
},
"autoload-dev": {
"psr-4": {
"GuzzleHttp\\Tests\\": "tests/"
}
+ },
+ "suggest": {
+ "psr/log": "Required for using the Log middleware"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "6.3-dev"
+ }
}
}
diff --git a/vendor/guzzlehttp/guzzle/src/Client.php b/vendor/guzzlehttp/guzzle/src/Client.php
index f2bf2044..80417918 100644
--- a/vendor/guzzlehttp/guzzle/src/Client.php
+++ b/vendor/guzzlehttp/guzzle/src/Client.php
@@ -2,12 +2,11 @@
namespace GuzzleHttp;
use GuzzleHttp\Cookie\CookieJar;
-use GuzzleHttp\Exception\InvalidArgumentException;
use GuzzleHttp\Promise;
use GuzzleHttp\Psr7;
+use Psr\Http\Message\UriInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
-use Psr\Http\Message\UriInterface;
/**
* @method ResponseInterface get(string|UriInterface $uri, array $options = [])
@@ -76,12 +75,6 @@ class Client implements ClientInterface
$this->configureDefaults($config);
}
- /**
- * @param string $method
- * @param array $args
- *
- * @return Promise\PromiseInterface
- */
public function __call($method, $args)
{
if (count($args) < 1) {
@@ -96,14 +89,6 @@ class Client implements ClientInterface
: $this->request($method, $uri, $opts);
}
- /**
- * Asynchronously send an HTTP request.
- *
- * @param array $options Request options to apply to the given
- * request and to the transfer. See \GuzzleHttp\RequestOptions.
- *
- * @return Promise\PromiseInterface
- */
public function sendAsync(RequestInterface $request, array $options = [])
{
// Merge the base URI into the request URI if needed.
@@ -115,35 +100,12 @@ class Client implements ClientInterface
);
}
- /**
- * Send an HTTP request.
- *
- * @param array $options Request options to apply to the given
- * request and to the transfer. See \GuzzleHttp\RequestOptions.
- *
- * @return ResponseInterface
- * @throws GuzzleException
- */
public function send(RequestInterface $request, array $options = [])
{
$options[RequestOptions::SYNCHRONOUS] = true;
return $this->sendAsync($request, $options)->wait();
}
- /**
- * Create and send an asynchronous HTTP request.
- *
- * Use an absolute path to override the base path of the client, or a
- * relative path to append to the base path of the client. The URL can
- * contain the query string as well. Use an array to provide a URL
- * template and additional variables to use in the URL template expansion.
- *
- * @param string $method HTTP method
- * @param string|UriInterface $uri URI object or string.
- * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions.
- *
- * @return Promise\PromiseInterface
- */
public function requestAsync($method, $uri = '', array $options = [])
{
$options = $this->prepareDefaults($options);
@@ -163,37 +125,12 @@ class Client implements ClientInterface
return $this->transfer($request, $options);
}
- /**
- * Create and send an HTTP request.
- *
- * Use an absolute path to override the base path of the client, or a
- * relative path to append to the base path of the client. The URL can
- * contain the query string as well.
- *
- * @param string $method HTTP method.
- * @param string|UriInterface $uri URI object or string.
- * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions.
- *
- * @return ResponseInterface
- * @throws GuzzleException
- */
public function request($method, $uri = '', array $options = [])
{
$options[RequestOptions::SYNCHRONOUS] = true;
return $this->requestAsync($method, $uri, $options)->wait();
}
- /**
- * Get a client configuration option.
- *
- * These options include default request options of the client, a "handler"
- * (if utilized by the concrete client), and a "base_uri" if utilized by
- * the concrete client.
- *
- * @param string|null $option The config option to retrieve.
- *
- * @return mixed
- */
public function getConfig($option = null)
{
return $option === null
@@ -201,11 +138,6 @@ class Client implements ClientInterface
: (isset($this->config[$option]) ? $this->config[$option] : null);
}
- /**
- * @param string|null $uri
- *
- * @return UriInterface
- */
private function buildUri($uri, array $config)
{
// for BC we accept null which would otherwise fail in uri_for
@@ -215,11 +147,6 @@ class Client implements ClientInterface
$uri = Psr7\UriResolver::resolve(Psr7\uri_for($config['base_uri']), $uri);
}
- if (isset($config['idn_conversion']) && ($config['idn_conversion'] !== false)) {
- $idnOptions = ($config['idn_conversion'] === true) ? IDNA_DEFAULT : $config['idn_conversion'];
- $uri = _idn_uri_convert($uri, $idnOptions);
- }
-
return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri;
}
@@ -227,7 +154,6 @@ class Client implements ClientInterface
* Configures the default options for a client.
*
* @param array $config
- * @return void
*/
private function configureDefaults(array $config)
{
@@ -239,22 +165,12 @@ class Client implements ClientInterface
'cookies' => false
];
- // idn_to_ascii() is a part of ext-intl and might be not available
- $defaults['idn_conversion'] = function_exists('idn_to_ascii')
- // Old ICU versions don't have this constant, so we are basically stuck (see https://github.com/guzzle/guzzle/pull/2424
- // and https://github.com/guzzle/guzzle/issues/2448 for details)
- && (
- defined('INTL_IDNA_VARIANT_UTS46')
- ||
- PHP_VERSION_ID < 70200
- );
-
// Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set.
// We can only trust the HTTP_PROXY environment variable in a CLI
// process due to the fact that PHP has no reliable mechanism to
// get environment variables that start with "HTTP_".
- if (php_sapi_name() === 'cli' && getenv('HTTP_PROXY')) {
+ if (php_sapi_name() == 'cli' && getenv('HTTP_PROXY')) {
$defaults['proxy']['http'] = getenv('HTTP_PROXY');
}
@@ -294,7 +210,7 @@ class Client implements ClientInterface
*
* @return array
*/
- private function prepareDefaults(array $options)
+ private function prepareDefaults($options)
{
$defaults = $this->config;
@@ -309,7 +225,7 @@ class Client implements ClientInterface
if (array_key_exists('headers', $options)) {
// Allows default headers to be unset.
if ($options['headers'] === null) {
- $defaults['_conditional'] = [];
+ $defaults['_conditional'] = null;
unset($options['headers']);
} elseif (!is_array($options['headers'])) {
throw new \InvalidArgumentException('headers must be an array');
@@ -335,7 +251,8 @@ class Client implements ClientInterface
* The URI of the request is not modified and the request options are used
* as-is without merging in default options.
*
- * @param array $options See \GuzzleHttp\RequestOptions.
+ * @param RequestInterface $request
+ * @param array $options
*
* @return Promise\PromiseInterface
*/
@@ -354,7 +271,6 @@ class Client implements ClientInterface
}
$request = $this->applyOptions($request, $options);
- /** @var HandlerStack $handler */
$handler = $options['handler'];
try {
@@ -495,11 +411,6 @@ class Client implements ClientInterface
return $request;
}
- /**
- * Throw Exception with pre-set message.
- * @return void
- * @throws InvalidArgumentException Invalid body.
- */
private function invalidBody()
{
throw new \InvalidArgumentException('Passing in the "body" request '
diff --git a/vendor/guzzlehttp/guzzle/src/ClientInterface.php b/vendor/guzzlehttp/guzzle/src/ClientInterface.php
index 0c8d42a1..2dbcffa4 100644
--- a/vendor/guzzlehttp/guzzle/src/ClientInterface.php
+++ b/vendor/guzzlehttp/guzzle/src/ClientInterface.php
@@ -1,8 +1,8 @@
cookies as $cookie) {
@@ -103,8 +103,6 @@ class CookieJar implements CookieJarInterface
return $cookie;
}
}
-
- return null;
}
public function toArray()
@@ -122,7 +120,7 @@ class CookieJar implements CookieJarInterface
} elseif (!$path) {
$this->cookies = array_filter(
$this->cookies,
- function (SetCookie $cookie) use ($domain) {
+ function (SetCookie $cookie) use ($path, $domain) {
return !$cookie->matchesDomain($domain);
}
);
diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php
index 6ee11885..2cf298a8 100644
--- a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php
+++ b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php
@@ -58,9 +58,9 @@ interface CookieJarInterface extends \Countable, \IteratorAggregate
* arguments, then the cookie with the specified name, path and domain is
* removed.
*
- * @param string|null $domain Clears cookies matching a domain
- * @param string|null $path Clears cookies matching a domain and path
- * @param string|null $name Clears cookies matching a domain, path, and name
+ * @param string $domain Clears cookies matching a domain
+ * @param string $path Clears cookies matching a domain and path
+ * @param string $name Clears cookies matching a domain, path, and name
*
* @return CookieJarInterface
*/
diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php b/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php
index 3fb8600e..9887c1d5 100644
--- a/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php
+++ b/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php
@@ -23,7 +23,6 @@ class FileCookieJar extends CookieJar
*/
public function __construct($cookieFile, $storeSessionCookies = false)
{
- parent::__construct();
$this->filename = $cookieFile;
$this->storeSessionCookies = $storeSessionCookies;
@@ -57,7 +56,7 @@ class FileCookieJar extends CookieJar
}
$jsonStr = \GuzzleHttp\json_encode($json);
- if (false === file_put_contents($filename, $jsonStr, LOCK_EX)) {
+ if (false === file_put_contents($filename, $jsonStr)) {
throw new \RuntimeException("Unable to save file {$filename}");
}
}
diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php b/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php
index 0224a244..4497bcf0 100644
--- a/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php
+++ b/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php
@@ -22,7 +22,6 @@ class SessionCookieJar extends CookieJar
*/
public function __construct($sessionKey, $storeSessionCookies = false)
{
- parent::__construct();
$this->sessionKey = $sessionKey;
$this->storeSessionCookies = $storeSessionCookies;
$this->load();
diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php b/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php
index 3d776a70..f6993943 100644
--- a/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php
+++ b/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php
@@ -227,7 +227,7 @@ class SetCookie
/**
* Get whether or not this is a secure cookie
*
- * @return bool|null
+ * @return null|bool
*/
public function getSecure()
{
@@ -247,7 +247,7 @@ class SetCookie
/**
* Get whether or not this is a session cookie
*
- * @return bool|null
+ * @return null|bool
*/
public function getDiscard()
{
diff --git a/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php b/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php
index 4cfd393c..f95c09f2 100644
--- a/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php
+++ b/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php
@@ -4,6 +4,4 @@ namespace GuzzleHttp\Exception;
/**
* Exception when a client error is encountered (4xx codes)
*/
-class ClientException extends BadResponseException
-{
-}
+class ClientException extends BadResponseException {}
diff --git a/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php b/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php
index 27b2722b..510778f6 100644
--- a/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php
+++ b/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php
@@ -1,23 +1,13 @@
getBody();
+
+ if (!$body->isSeekable()) {
+ return null;
+ }
+
+ $size = $body->getSize();
+
+ if ($size === 0) {
+ return null;
+ }
+
+ $summary = $body->read(120);
+ $body->rewind();
+
+ if ($size > 120) {
+ $summary .= ' (truncated...)';
+ }
+
+ // Matches any printable character, including unicode characters:
+ // letters, marks, numbers, punctuation, spacing, and separators.
+ if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/', $summary)) {
+ return null;
+ }
+
+ return $summary;
}
/**
- * Obfuscates URI if there is a username and a password present
+ * Obfuscates URI if there is an username and a password present
*
* @param UriInterface $uri
*
* @return UriInterface
*/
- private static function obfuscateUri(UriInterface $uri)
+ private static function obfuscateUri($uri)
{
$userInfo = $uri->getUserInfo();
diff --git a/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php b/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php
index 127094c1..7cdd3408 100644
--- a/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php
+++ b/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php
@@ -4,6 +4,4 @@ namespace GuzzleHttp\Exception;
/**
* Exception when a server error is encountered (5xx codes)
*/
-class ServerException extends BadResponseException
-{
-}
+class ServerException extends BadResponseException {}
diff --git a/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php b/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php
index fff05251..b60a9678 100644
--- a/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php
+++ b/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php
@@ -1,6 +1,4 @@
handle);
- $curlStats['appconnect_time'] = curl_getinfo($easy->handle, CURLINFO_APPCONNECT_TIME);
$stats = new TransferStats(
$easy->request,
$easy->response,
@@ -140,9 +136,7 @@ class CurlFactory implements CurlFactoryInterface
$ctx = [
'errno' => $easy->errno,
'error' => curl_error($easy->handle),
- 'appconnect_time' => curl_getinfo($easy->handle, CURLINFO_APPCONNECT_TIME),
] + curl_getinfo($easy->handle);
- $ctx[self::CURL_VERSION_STR] = curl_version()['version'];
$factory->release($easy);
// Retry when nothing is present or when curl failed to rewind.
@@ -178,22 +172,13 @@ class CurlFactory implements CurlFactoryInterface
)
);
}
- if (version_compare($ctx[self::CURL_VERSION_STR], self::LOW_CURL_VERSION_NUMBER)) {
- $message = sprintf(
- 'cURL error %s: %s (%s)',
- $ctx['errno'],
- $ctx['error'],
- 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html'
- );
- } else {
- $message = sprintf(
- 'cURL error %s: %s (%s) for %s',
- $ctx['errno'],
- $ctx['error'],
- 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html',
- $easy->request->getUri()
- );
- }
+
+ $message = sprintf(
+ 'cURL error %s: %s (%s)',
+ $ctx['errno'],
+ $ctx['error'],
+ 'see http://curl.haxx.se/libcurl/c/libcurl-errors.html'
+ );
// Create a connection exception if it was a specific error code.
$error = isset($connectionErrors[$easy->errno])
@@ -454,16 +439,11 @@ class CurlFactory implements CurlFactoryInterface
}
if (isset($options['ssl_key'])) {
- if (is_array($options['ssl_key'])) {
- if (count($options['ssl_key']) === 2) {
- list($sslKey, $conf[CURLOPT_SSLKEYPASSWD]) = $options['ssl_key'];
- } else {
- list($sslKey) = $options['ssl_key'];
- }
+ $sslKey = $options['ssl_key'];
+ if (is_array($sslKey)) {
+ $conf[CURLOPT_SSLKEYPASSWD] = $sslKey[1];
+ $sslKey = $sslKey[0];
}
-
- $sslKey = isset($sslKey) ? $sslKey: $options['ssl_key'];
-
if (!file_exists($sslKey)) {
throw new \InvalidArgumentException(
"SSL private key not found: {$sslKey}"
diff --git a/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php
index b73e5c72..2754d8e4 100644
--- a/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php
+++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php
@@ -1,9 +1,9 @@
factory = isset($options['handle_factory'])
? $options['handle_factory'] : new CurlFactory(50);
-
- if (isset($options['select_timeout'])) {
- $this->selectTimeout = $options['select_timeout'];
- } elseif ($selectTimeout = getenv('GUZZLE_CURL_SELECT_TIMEOUT')) {
- $this->selectTimeout = $selectTimeout;
- } else {
- $this->selectTimeout = 1;
- }
-
- $this->options = isset($options['options']) ? $options['options'] : [];
+ $this->selectTimeout = isset($options['select_timeout'])
+ ? $options['select_timeout'] : 1;
}
public function __get($name)
{
if ($name === '_mh') {
- $this->_mh = curl_multi_init();
-
- foreach ($this->options as $option => $value) {
- // A warning is raised in case of a wrong option.
- curl_multi_setopt($this->_mh, $option, $value);
- }
-
- // Further calls to _mh will return the value directly, without entering the
- // __get() method at all.
- return $this->_mh;
+ return $this->_mh = curl_multi_init();
}
throw new \BadMethodCallException();
@@ -102,7 +82,7 @@ class CurlMultiHandler
{
// Add any delayed handles if needed.
if ($this->delays) {
- $currentTime = \GuzzleHttp\_current_time();
+ $currentTime = microtime(true);
foreach ($this->delays as $id => $delay) {
if ($currentTime >= $delay) {
unset($this->delays[$id]);
@@ -154,7 +134,7 @@ class CurlMultiHandler
if (empty($easy->options['delay'])) {
curl_multi_add_handle($this->_mh, $easy->handle);
} else {
- $this->delays[$id] = \GuzzleHttp\_current_time() + ($easy->options['delay'] / 1000);
+ $this->delays[$id] = microtime(true) + ($easy->options['delay'] / 1000);
}
}
@@ -206,7 +186,7 @@ class CurlMultiHandler
private function timeToNext()
{
- $currentTime = \GuzzleHttp\_current_time();
+ $currentTime = microtime(true);
$nextTime = PHP_INT_MAX;
foreach ($this->delays as $time) {
if ($time < $nextTime) {
diff --git a/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php
index 5b312bc0..d892061c 100644
--- a/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php
+++ b/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php
@@ -66,7 +66,7 @@ class MockHandler implements \Countable
throw new \OutOfBoundsException('Mock queue is empty');
}
- if (isset($options['delay']) && is_numeric($options['delay'])) {
+ if (isset($options['delay'])) {
usleep($options['delay'] * 1000);
}
@@ -175,11 +175,6 @@ class MockHandler implements \Countable
return count($this->queue);
}
- public function reset()
- {
- $this->queue = [];
- }
-
private function invokeStats(
RequestInterface $request,
array $options,
@@ -187,8 +182,7 @@ class MockHandler implements \Countable
$reason = null
) {
if (isset($options['on_stats'])) {
- $transferTime = isset($options['transfer_time']) ? $options['transfer_time'] : 0;
- $stats = new TransferStats($request, $response, $transferTime, $reason);
+ $stats = new TransferStats($request, $response, 0, $reason);
call_user_func($options['on_stats'], $stats);
}
}
diff --git a/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
index a8eba378..b686545e 100644
--- a/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
+++ b/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
@@ -1,8 +1,8 @@
getBody()->getSize()) {
- $request = $request->withHeader('Content-Length', '0');
+ $request = $request->withHeader('Content-Length', 0);
}
return $this->createResponse(
@@ -82,7 +82,7 @@ class StreamHandler
$stats = new TransferStats(
$request,
$response,
- \GuzzleHttp\_current_time() - $startTime,
+ microtime(true) - $startTime,
$error,
[]
);
@@ -343,25 +343,13 @@ class StreamHandler
if ('v4' === $options['force_ip_resolve']) {
$records = dns_get_record($uri->getHost(), DNS_A);
if (!isset($records[0]['ip'])) {
- throw new ConnectException(
- sprintf(
- "Could not resolve IPv4 address for host '%s'",
- $uri->getHost()
- ),
- $request
- );
+ throw new ConnectException(sprintf("Could not resolve IPv4 address for host '%s'", $uri->getHost()), $request);
}
$uri = $uri->withHost($records[0]['ip']);
} elseif ('v6' === $options['force_ip_resolve']) {
$records = dns_get_record($uri->getHost(), DNS_AAAA);
if (!isset($records[0]['ipv6'])) {
- throw new ConnectException(
- sprintf(
- "Could not resolve IPv6 address for host '%s'",
- $uri->getHost()
- ),
- $request
- );
+ throw new ConnectException(sprintf("Could not resolve IPv6 address for host '%s'", $uri->getHost()), $request);
}
$uri = $uri->withHost('[' . $records[0]['ipv6'] . ']');
}
diff --git a/vendor/guzzlehttp/guzzle/src/HandlerStack.php b/vendor/guzzlehttp/guzzle/src/HandlerStack.php
index 6a49cc06..24c46fd9 100644
--- a/vendor/guzzlehttp/guzzle/src/HandlerStack.php
+++ b/vendor/guzzlehttp/guzzle/src/HandlerStack.php
@@ -1,9 +1,7 @@
extractCookies($request, $response);
return $response;
}
- );
+ );
};
};
}
@@ -57,7 +58,7 @@ final class Middleware
return $handler($request, $options);
}
return $handler($request, $options)->then(
- function (ResponseInterface $response) use ($request) {
+ function (ResponseInterface $response) use ($request, $handler) {
$code = $response->getStatusCode();
if ($code < 400) {
return $response;
@@ -182,7 +183,7 @@ final class Middleware
*
* @return callable Returns a function that accepts the next handler.
*/
- public static function log(LoggerInterface $logger, MessageFormatter $formatter, $logLevel = 'info' /* \Psr\Log\LogLevel::INFO */)
+ public static function log(LoggerInterface $logger, MessageFormatter $formatter, $logLevel = LogLevel::INFO)
{
return function (callable $handler) use ($logger, $formatter, $logLevel) {
return function ($request, array $options) use ($handler, $logger, $formatter, $logLevel) {
diff --git a/vendor/guzzlehttp/guzzle/src/Pool.php b/vendor/guzzlehttp/guzzle/src/Pool.php
index 5838db4f..8f1be33c 100644
--- a/vendor/guzzlehttp/guzzle/src/Pool.php
+++ b/vendor/guzzlehttp/guzzle/src/Pool.php
@@ -1,13 +1,12 @@
each = new EachPromise($requests(), $config);
}
- /**
- * Get promise
- *
- * @return PromiseInterface
- */
public function promise()
{
return $this->each->promise();
@@ -112,11 +106,6 @@ class Pool implements PromisorInterface
return $res;
}
- /**
- * Execute callback(s)
- *
- * @return void
- */
private static function cmpCallback(array &$options, $name, array &$results)
{
if (!isset($options[$name])) {
diff --git a/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php b/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php
index 568a1e90..2eb95f9b 100644
--- a/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php
+++ b/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php
@@ -66,11 +66,6 @@ class PrepareBodyMiddleware
return $fn(Psr7\modify_request($request, $modify), $options);
}
- /**
- * Add expect header
- *
- * @return void
- */
private function addExpectHeader(
RequestInterface $request,
array $options,
diff --git a/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php b/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php
index 2f301261..131b7717 100644
--- a/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php
+++ b/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php
@@ -13,7 +13,7 @@ use Psr\Http\Message\UriInterface;
* Request redirect middleware.
*
* Apply this middleware like other middleware using
- * {@see \GuzzleHttp\Middleware::redirect()}.
+ * {@see GuzzleHttp\Middleware::redirect()}.
*/
class RedirectMiddleware
{
@@ -76,7 +76,7 @@ class RedirectMiddleware
/**
* @param RequestInterface $request
* @param array $options
- * @param ResponseInterface $response
+ * @param ResponseInterface|PromiseInterface $response
*
* @return ResponseInterface|PromiseInterface
*/
@@ -118,11 +118,6 @@ class RedirectMiddleware
return $promise;
}
- /**
- * Enable tracking on promise.
- *
- * @return PromiseInterface
- */
private function withTracking(PromiseInterface $promise, $uri, $statusCode)
{
return $promise->then(
@@ -140,13 +135,6 @@ class RedirectMiddleware
);
}
- /**
- * Check for too many redirects
- *
- * @return void
- *
- * @throws TooManyRedirectsException Too many redirects.
- */
private function guardMax(RequestInterface $request, array &$options)
{
$current = isset($options['__redirect_count'])
@@ -184,19 +172,13 @@ class RedirectMiddleware
// would do.
$statusCode = $response->getStatusCode();
if ($statusCode == 303 ||
- ($statusCode <= 302 && !$options['allow_redirects']['strict'])
+ ($statusCode <= 302 && $request->getBody() && !$options['allow_redirects']['strict'])
) {
$modify['method'] = 'GET';
$modify['body'] = '';
}
- $uri = $this->redirectUri($request, $response, $protocols);
- if (isset($options['idn_conversion']) && ($options['idn_conversion'] !== false)) {
- $idnOptions = ($options['idn_conversion'] === true) ? IDNA_DEFAULT : $options['idn_conversion'];
- $uri = _idn_uri_convert($uri, $idnOptions);
- }
-
- $modify['uri'] = $uri;
+ $modify['uri'] = $this->redirectUri($request, $response, $protocols);
Psr7\rewind_body($request);
// Add the Referer header if it is told to do so and only
@@ -204,7 +186,7 @@ class RedirectMiddleware
if ($options['allow_redirects']['referer']
&& $modify['uri']->getScheme() === $request->getUri()->getScheme()
) {
- $uri = $request->getUri()->withUserInfo('');
+ $uri = $request->getUri()->withUserInfo('', '');
$modify['set_headers']['Referer'] = (string) $uri;
} else {
$modify['remove_headers'][] = 'Referer';
diff --git a/vendor/guzzlehttp/guzzle/src/RequestOptions.php b/vendor/guzzlehttp/guzzle/src/RequestOptions.php
index 355f658f..c6aacfb1 100644
--- a/vendor/guzzlehttp/guzzle/src/RequestOptions.php
+++ b/vendor/guzzlehttp/guzzle/src/RequestOptions.php
@@ -22,7 +22,7 @@ final class RequestOptions
* - strict: (bool, default=false) Set to true to use strict redirects
* meaning redirect POST requests with POST requests vs. doing what most
* browsers do which is redirect POST requests with GET requests
- * - referer: (bool, default=false) Set to true to enable the Referer
+ * - referer: (bool, default=true) Set to false to disable the Referer
* header.
* - protocols: (array, default=['http', 'https']) Allowed redirect
* protocols.
@@ -132,14 +132,6 @@ final class RequestOptions
*/
const HTTP_ERRORS = 'http_errors';
- /**
- * idn: (bool|int, default=true) A combination of IDNA_* constants for
- * idn_to_ascii() PHP's function (see "options" parameter). Set to false to
- * disable IDN support completely, or to true to use the default
- * configuration (IDNA_DEFAULT constant).
- */
- const IDN_CONVERSION = 'idn_conversion';
-
/**
* json: (mixed) Adds JSON data to a request. The provided value is JSON
* encoded and a Content-Type header of application/json will be added to
diff --git a/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php b/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php
index 5acc8c5c..f27090fd 100644
--- a/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php
+++ b/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php
@@ -19,9 +19,6 @@ class RetryMiddleware
/** @var callable */
private $decider;
- /** @var callable */
- private $delay;
-
/**
* @param callable $decider Function that accepts the number of retries,
* a request, [response], and [exception] and
@@ -45,13 +42,13 @@ class RetryMiddleware
/**
* Default exponential backoff delay function.
*
- * @param int $retries
+ * @param $retries
*
- * @return int milliseconds.
+ * @return int
*/
public static function exponentialDelay($retries)
{
- return (int) pow(2, $retries - 1) * 1000;
+ return (int) pow(2, $retries - 1);
}
/**
@@ -74,11 +71,6 @@ class RetryMiddleware
);
}
- /**
- * Execute fulfilled closure
- *
- * @return mixed
- */
private function onFulfilled(RequestInterface $req, array $options)
{
return function ($value) use ($req, $options) {
@@ -95,11 +87,6 @@ class RetryMiddleware
};
}
- /**
- * Execute rejected closure
- *
- * @return callable
- */
private function onRejected(RequestInterface $req, array $options)
{
return function ($reason) use ($req, $options) {
@@ -116,9 +103,6 @@ class RetryMiddleware
};
}
- /**
- * @return self
- */
private function doRetry(RequestInterface $request, array $options, ResponseInterface $response = null)
{
$options['delay'] = call_user_func($this->delay, ++$options['retries'], $response);
diff --git a/vendor/guzzlehttp/guzzle/src/TransferStats.php b/vendor/guzzlehttp/guzzle/src/TransferStats.php
index 87fb3c00..15f717e1 100644
--- a/vendor/guzzlehttp/guzzle/src/TransferStats.php
+++ b/vendor/guzzlehttp/guzzle/src/TransferStats.php
@@ -18,11 +18,11 @@ final class TransferStats
private $handlerErrorData;
/**
- * @param RequestInterface $request Request that was sent.
- * @param ResponseInterface|null $response Response received (if any)
- * @param float|null $transferTime Total handler transfer time.
- * @param mixed $handlerErrorData Handler error data.
- * @param array $handlerStats Handler specific stats.
+ * @param RequestInterface $request Request that was sent.
+ * @param ResponseInterface $response Response received (if any)
+ * @param null $transferTime Total handler transfer time.
+ * @param mixed $handlerErrorData Handler error data.
+ * @param array $handlerStats Handler specific stats.
*/
public function __construct(
RequestInterface $request,
@@ -93,7 +93,7 @@ final class TransferStats
/**
* Get the estimated time the request was being transferred by the handler.
*
- * @return float|null Time in seconds.
+ * @return float Time in seconds.
*/
public function getTransferTime()
{
diff --git a/vendor/guzzlehttp/guzzle/src/functions.php b/vendor/guzzlehttp/guzzle/src/functions.php
index 5e806f63..a3ac450d 100644
--- a/vendor/guzzlehttp/guzzle/src/functions.php
+++ b/vendor/guzzlehttp/guzzle/src/functions.php
@@ -1,12 +1,10 @@
getHost()) {
- $idnaVariant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : 0;
- $asciiHost = $idnaVariant === 0
- ? idn_to_ascii($uri->getHost(), $options)
- : idn_to_ascii($uri->getHost(), $options, $idnaVariant, $info);
- if ($asciiHost === false) {
- $errorBitSet = isset($info['errors']) ? $info['errors'] : 0;
-
- $errorConstants = array_filter(array_keys(get_defined_constants()), function ($name) {
- return substr($name, 0, 11) === 'IDNA_ERROR_';
- });
-
- $errors = [];
- foreach ($errorConstants as $errorConstant) {
- if ($errorBitSet & constant($errorConstant)) {
- $errors[] = $errorConstant;
- }
- }
-
- $errorMessage = 'IDN conversion failed';
- if ($errors) {
- $errorMessage .= ' (errors: ' . implode(', ', $errors) . ')';
- }
-
- throw new InvalidArgumentException($errorMessage);
- } else {
- if ($uri->getHost() !== $asciiHost) {
- // Replace URI only if the ASCII version is different
- $uri = $uri->withHost($asciiHost);
- }
- }
- }
-
- return $uri;
-}
diff --git a/vendor/guzzlehttp/psr7/CHANGELOG.md b/vendor/guzzlehttp/psr7/CHANGELOG.md
index 8a3743db..5c252b3a 100644
--- a/vendor/guzzlehttp/psr7/CHANGELOG.md
+++ b/vendor/guzzlehttp/psr7/CHANGELOG.md
@@ -1,102 +1,32 @@
-# Change Log
+# CHANGELOG
+## 1.4.2 - 2017-03-20
-All notable changes to this project will be documented in this file.
-
-The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
-and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
-
-
-## [Unreleased]
-
-
-## [1.6.0]
-
-### Added
-
-- Allowed version `^3.0` of `ralouphie/getallheaders` dependency (#244)
-- Added MIME type for WEBP image format (#246)
-- Added more validation of values according to PSR-7 and RFC standards, e.g. status code range (#250, #272)
-
-### Changed
-
-- Tests don't pass with HHVM 4.0, so HHVM support got dropped. Other libraries like composer have done the same. (#262)
-- Accept port number 0 to be valid (#270)
-
-### Fixed
-
-- Fixed subsequent reads from `php://input` in ServerRequest (#247)
-- Fixed readable/writable detection for certain stream modes (#248)
-- Fixed encoding of special characters in the `userInfo` component of an URI (#253)
-
-
-## [1.5.2] - 2018-12-04
-
-### Fixed
-
-- Check body size when getting the message summary
-
-
-## [1.5.1] - 2018-12-04
-
-### Fixed
-
-- Get the summary of a body only if it is readable
-
-
-## [1.5.0] - 2018-12-03
-
-### Added
-
-- Response first-line to response string exception (fixes #145)
-- A test for #129 behavior
-- `get_message_body_summary` function in order to get the message summary
-- `3gp` and `mkv` mime types
-
-### Changed
-
-- Clarify exception message when stream is detached
-
-### Deprecated
-
-- Deprecated parsing folded header lines as per RFC 7230
-
-### Fixed
-
-- Fix `AppendStream::detach` to not close streams
-- `InflateStream` preserves `isSeekable` attribute of the underlying stream
-- `ServerRequest::getUriFromGlobals` to support URLs in query parameters
-
-
-Several other fixes and improvements.
-
-
-## [1.4.2] - 2017-03-20
-
-### Fixed
-
-- Reverted BC break to `Uri::resolve` and `Uri::removeDotSegments` by removing
+* Reverted BC break to `Uri::resolve` and `Uri::removeDotSegments` by removing
calls to `trigger_error` when deprecated methods are invoked.
+## 1.4.1 - 2017-02-27
-## [1.4.1] - 2017-02-27
-
-### Added
-
-- Rriggering of silenced deprecation warnings.
-
-### Fixed
-
-- Reverted BC break by reintroducing behavior to automagically fix a URI with a
+* Reverted BC break by reintroducing behavior to automagically fix a URI with a
relative path and an authority by adding a leading slash to the path. It's only
deprecated now.
+* Added triggering of silenced deprecation warnings.
+## 1.4.0 - 2017-02-21
-## [1.4.0] - 2017-02-21
-
-### Added
-
-- Added common URI utility methods based on RFC 3986 (see documentation in the readme):
+* Fix `Stream::read` when length parameter <= 0.
+* `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory.
+* Fix `ServerRequest::getUriFromGlobals` when `Host` header contains port.
+* Ensure `ServerRequest::getUriFromGlobals` returns a URI in absolute form.
+* Allow `parse_response` to parse a response without delimiting space and reason.
+* Ensure each URI modification results in a valid URI according to PSR-7 discussions.
+ Invalid modifications will throw an exception instead of returning a wrong URI or
+ doing some magic.
+ - `(new Uri)->withPath('foo')->withHost('example.com')` will throw an exception
+ because the path of a URI with an authority must start with a slash "/" or be empty
+ - `(new Uri())->withScheme('http')` will return `'http://localhost'`
+* Fix compatibility of URIs with `file` scheme and empty host.
+* Added common URI utility methods based on RFC 3986 (see documentation in the readme):
- `Uri::isDefaultPort`
- `Uri::isAbsolute`
- `Uri::isNetworkPathReference`
@@ -107,117 +37,69 @@ Several other fixes and improvements.
- `UriNormalizer::normalize`
- `UriNormalizer::isEquivalent`
- `UriResolver::relativize`
+* Deprecated `Uri::resolve` in favor of `UriResolver::resolve`
+* Deprecated `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments`
-### Changed
+## 1.3.1 - 2016-06-25
-- Ensure `ServerRequest::getUriFromGlobals` returns a URI in absolute form.
-- Allow `parse_response` to parse a response without delimiting space and reason.
-- Ensure each URI modification results in a valid URI according to PSR-7 discussions.
- Invalid modifications will throw an exception instead of returning a wrong URI or
- doing some magic.
- - `(new Uri)->withPath('foo')->withHost('example.com')` will throw an exception
- because the path of a URI with an authority must start with a slash "/" or be empty
- - `(new Uri())->withScheme('http')` will return `'http://localhost'`
-
-### Deprecated
-
-- `Uri::resolve` in favor of `UriResolver::resolve`
-- `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments`
-
-### Fixed
-
-- `Stream::read` when length parameter <= 0.
-- `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory.
-- `ServerRequest::getUriFromGlobals` when `Host` header contains port.
-- Compatibility of URIs with `file` scheme and empty host.
-
-
-## [1.3.1] - 2016-06-25
-
-### Fixed
-
-- `Uri::__toString` for network path references, e.g. `//example.org`.
-- Missing lowercase normalization for host.
-- Handling of URI components in case they are `'0'` in a lot of places,
+* Fix `Uri::__toString` for network path references, e.g. `//example.org`.
+* Fix missing lowercase normalization for host.
+* Fix handling of URI components in case they are `'0'` in a lot of places,
e.g. as a user info password.
-- `Uri::withAddedHeader` to correctly merge headers with different case.
-- Trimming of header values in `Uri::withAddedHeader`. Header values may
+* Fix `Uri::withAddedHeader` to correctly merge headers with different case.
+* Fix trimming of header values in `Uri::withAddedHeader`. Header values may
be surrounded by whitespace which should be ignored according to RFC 7230
Section 3.2.4. This does not apply to header names.
-- `Uri::withAddedHeader` with an array of header values.
-- `Uri::resolve` when base path has no slash and handling of fragment.
-- Handling of encoding in `Uri::with(out)QueryValue` so one can pass the
+* Fix `Uri::withAddedHeader` with an array of header values.
+* Fix `Uri::resolve` when base path has no slash and handling of fragment.
+* Fix handling of encoding in `Uri::with(out)QueryValue` so one can pass the
key/value both in encoded as well as decoded form to those methods. This is
consistent with withPath, withQuery etc.
-- `ServerRequest::withoutAttribute` when attribute value is null.
+* Fix `ServerRequest::withoutAttribute` when attribute value is null.
+## 1.3.0 - 2016-04-13
-## [1.3.0] - 2016-04-13
-
-### Added
-
-- Remaining interfaces needed for full PSR7 compatibility
+* Added remaining interfaces needed for full PSR7 compatibility
(ServerRequestInterface, UploadedFileInterface, etc.).
-- Support for stream_for from scalars.
+* Added support for stream_for from scalars.
+* Can now extend Uri.
+* Fixed a bug in validating request methods by making it more permissive.
-### Changed
+## 1.2.3 - 2016-02-18
-- Can now extend Uri.
-
-### Fixed
-- A bug in validating request methods by making it more permissive.
-
-
-## [1.2.3] - 2016-02-18
-
-### Fixed
-
-- Support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote
+* Fixed support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote
streams, which can sometimes return fewer bytes than requested with `fread`.
-- Handling of gzipped responses with FNAME headers.
+* Fixed handling of gzipped responses with FNAME headers.
+## 1.2.2 - 2016-01-22
-## [1.2.2] - 2016-01-22
+* Added support for URIs without any authority.
+* Added support for HTTP 451 'Unavailable For Legal Reasons.'
+* Added support for using '0' as a filename.
+* Added support for including non-standard ports in Host headers.
-### Added
+## 1.2.1 - 2015-11-02
-- Support for URIs without any authority.
-- Support for HTTP 451 'Unavailable For Legal Reasons.'
-- Support for using '0' as a filename.
-- Support for including non-standard ports in Host headers.
+* Now supporting negative offsets when seeking to SEEK_END.
+## 1.2.0 - 2015-08-15
-## [1.2.1] - 2015-11-02
-
-### Changes
-
-- Now supporting negative offsets when seeking to SEEK_END.
-
-
-## [1.2.0] - 2015-08-15
-
-### Changed
-
-- Body as `"0"` is now properly added to a response.
-- Now allowing forward seeking in CachingStream.
-- Now properly parsing HTTP requests that contain proxy targets in
+* Body as `"0"` is now properly added to a response.
+* Now allowing forward seeking in CachingStream.
+* Now properly parsing HTTP requests that contain proxy targets in
`parse_request`.
-- functions.php is now conditionally required.
-- user-info is no longer dropped when resolving URIs.
+* functions.php is now conditionally required.
+* user-info is no longer dropped when resolving URIs.
+## 1.1.0 - 2015-06-24
-## [1.1.0] - 2015-06-24
-
-### Changed
-
-- URIs can now be relative.
-- `multipart/form-data` headers are now overridden case-insensitively.
-- URI paths no longer encode the following characters because they are allowed
+* URIs can now be relative.
+* `multipart/form-data` headers are now overridden case-insensitively.
+* URI paths no longer encode the following characters because they are allowed
in URIs: "(", ")", "*", "!", "'"
-- A port is no longer added to a URI when the scheme is missing and no port is
+* A port is no longer added to a URI when the scheme is missing and no port is
present.
-
## 1.0.0 - 2015-05-19
Initial release.
@@ -226,21 +108,3 @@ Currently unsupported:
- `Psr\Http\Message\ServerRequestInterface`
- `Psr\Http\Message\UploadedFileInterface`
-
-
-
-[Unreleased]: https://github.com/guzzle/psr7/compare/1.6.0...HEAD
-[1.6.0]: https://github.com/guzzle/psr7/compare/1.5.2...1.6.0
-[1.5.2]: https://github.com/guzzle/psr7/compare/1.5.1...1.5.2
-[1.5.1]: https://github.com/guzzle/psr7/compare/1.5.0...1.5.1
-[1.5.0]: https://github.com/guzzle/psr7/compare/1.4.2...1.5.0
-[1.4.2]: https://github.com/guzzle/psr7/compare/1.4.1...1.4.2
-[1.4.1]: https://github.com/guzzle/psr7/compare/1.4.0...1.4.1
-[1.4.0]: https://github.com/guzzle/psr7/compare/1.3.1...1.4.0
-[1.3.1]: https://github.com/guzzle/psr7/compare/1.3.0...1.3.1
-[1.3.0]: https://github.com/guzzle/psr7/compare/1.2.3...1.3.0
-[1.2.3]: https://github.com/guzzle/psr7/compare/1.2.2...1.2.3
-[1.2.2]: https://github.com/guzzle/psr7/compare/1.2.1...1.2.2
-[1.2.1]: https://github.com/guzzle/psr7/compare/1.2.0...1.2.1
-[1.2.0]: https://github.com/guzzle/psr7/compare/1.1.0...1.2.0
-[1.1.0]: https://github.com/guzzle/psr7/compare/1.0.0...1.1.0
diff --git a/vendor/guzzlehttp/psr7/README.md b/vendor/guzzlehttp/psr7/README.md
index c60a6a38..16499358 100644
--- a/vendor/guzzlehttp/psr7/README.md
+++ b/vendor/guzzlehttp/psr7/README.md
@@ -372,7 +372,7 @@ This method accepts the following `$resource` types:
$stream = GuzzleHttp\Psr7\stream_for('foo');
$stream = GuzzleHttp\Psr7\stream_for(fopen('/path/to/file', 'r'));
-$generator = function ($bytes) {
+$generator function ($bytes) {
for ($i = 0; $i < $bytes; $i++) {
yield ' ';
}
@@ -606,12 +606,6 @@ Creates a new URI with a specific query string value. Any existing query string
provided key are removed and replaced with the given key value pair. A value of null will set the query string
key without a value, e.g. "key" instead of "key=value".
-### `GuzzleHttp\Psr7\Uri::withQueryValues`
-
-`public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface`
-
-Creates a new URI with multiple query string values. It has the same behavior as `withQueryValue()` but for an
-associative array of key => value.
### `GuzzleHttp\Psr7\Uri::withoutQueryValue`
diff --git a/vendor/guzzlehttp/psr7/composer.json b/vendor/guzzlehttp/psr7/composer.json
index 168a055b..b1c5a90b 100644
--- a/vendor/guzzlehttp/psr7/composer.json
+++ b/vendor/guzzlehttp/psr7/composer.json
@@ -2,7 +2,7 @@
"name": "guzzlehttp/psr7",
"type": "library",
"description": "PSR-7 message implementation that also provides common utility methods",
- "keywords": ["request", "response", "message", "stream", "http", "uri", "url", "psr-7"],
+ "keywords": ["request", "response", "message", "stream", "http", "uri", "url"],
"license": "MIT",
"authors": [
{
@@ -17,33 +17,23 @@
],
"require": {
"php": ">=5.4.0",
- "psr/http-message": "~1.0",
- "ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
+ "psr/http-message": "~1.0"
},
"require-dev": {
- "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8",
- "ext-zlib": "*"
+ "phpunit/phpunit": "~4.0"
},
"provide": {
"psr/http-message-implementation": "1.0"
},
- "suggest": {
- "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses"
- },
"autoload": {
"psr-4": {
"GuzzleHttp\\Psr7\\": "src/"
},
"files": ["src/functions_include.php"]
},
- "autoload-dev": {
- "psr-4": {
- "GuzzleHttp\\Tests\\Psr7\\": "tests/"
- }
- },
"extra": {
"branch-alias": {
- "dev-master": "1.6-dev"
+ "dev-master": "1.4-dev"
}
}
}
diff --git a/vendor/guzzlehttp/psr7/src/AppendStream.php b/vendor/guzzlehttp/psr7/src/AppendStream.php
index 472a0d61..23039fd7 100644
--- a/vendor/guzzlehttp/psr7/src/AppendStream.php
+++ b/vendor/guzzlehttp/psr7/src/AppendStream.php
@@ -16,6 +16,7 @@ class AppendStream implements StreamInterface
private $seekable = true;
private $current = 0;
private $pos = 0;
+ private $detached = false;
/**
* @param StreamInterface[] $streams Streams to decorate. Each stream must
@@ -72,7 +73,6 @@ class AppendStream implements StreamInterface
public function close()
{
$this->pos = $this->current = 0;
- $this->seekable = true;
foreach ($this->streams as $stream) {
$stream->close();
@@ -82,22 +82,14 @@ class AppendStream implements StreamInterface
}
/**
- * Detaches each attached stream.
- *
- * Returns null as it's not clear which underlying stream resource to return.
+ * Detaches each attached stream
*
* {@inheritdoc}
*/
public function detach()
{
- $this->pos = $this->current = 0;
- $this->seekable = true;
-
- foreach ($this->streams as $stream) {
- $stream->detach();
- }
-
- $this->streams = [];
+ $this->close();
+ $this->detached = true;
}
public function tell()
diff --git a/vendor/guzzlehttp/psr7/src/FnStream.php b/vendor/guzzlehttp/psr7/src/FnStream.php
index 73daea6f..cc9b4453 100644
--- a/vendor/guzzlehttp/psr7/src/FnStream.php
+++ b/vendor/guzzlehttp/psr7/src/FnStream.php
@@ -52,15 +52,6 @@ class FnStream implements StreamInterface
}
}
- /**
- * An unserialize would allow the __destruct to run when the unserialized value goes out of scope.
- * @throws \LogicException
- */
- public function __wakeup()
- {
- throw new \LogicException('FnStream should never be unserialized');
- }
-
/**
* Adds custom functionality to an underlying stream by intercepting
* specific method calls.
diff --git a/vendor/guzzlehttp/psr7/src/InflateStream.php b/vendor/guzzlehttp/psr7/src/InflateStream.php
index 5e4f6028..0051d3fe 100644
--- a/vendor/guzzlehttp/psr7/src/InflateStream.php
+++ b/vendor/guzzlehttp/psr7/src/InflateStream.php
@@ -27,7 +27,7 @@ class InflateStream implements StreamInterface
$stream = new LimitStream($stream, -1, 10 + $filenameHeaderLength);
$resource = StreamWrapper::getResource($stream);
stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ);
- $this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource));
+ $this->stream = new Stream($resource);
}
/**
diff --git a/vendor/guzzlehttp/psr7/src/LimitStream.php b/vendor/guzzlehttp/psr7/src/LimitStream.php
index e4f239e3..3c13d4f4 100644
--- a/vendor/guzzlehttp/psr7/src/LimitStream.php
+++ b/vendor/guzzlehttp/psr7/src/LimitStream.php
@@ -72,7 +72,7 @@ class LimitStream implements StreamInterface
{
if ($whence !== SEEK_SET || $offset < 0) {
throw new \RuntimeException(sprintf(
- 'Cannot seek to offset %s with whence %s',
+ 'Cannot seek to offset % with whence %s',
$offset,
$whence
));
diff --git a/vendor/guzzlehttp/psr7/src/MessageTrait.php b/vendor/guzzlehttp/psr7/src/MessageTrait.php
index a7966d10..1e4da649 100644
--- a/vendor/guzzlehttp/psr7/src/MessageTrait.php
+++ b/vendor/guzzlehttp/psr7/src/MessageTrait.php
@@ -66,8 +66,11 @@ trait MessageTrait
public function withHeader($header, $value)
{
- $this->assertHeader($header);
- $value = $this->normalizeHeaderValue($value);
+ if (!is_array($value)) {
+ $value = [$value];
+ }
+
+ $value = $this->trimHeaderValues($value);
$normalized = strtolower($header);
$new = clone $this;
@@ -82,8 +85,11 @@ trait MessageTrait
public function withAddedHeader($header, $value)
{
- $this->assertHeader($header);
- $value = $this->normalizeHeaderValue($value);
+ if (!is_array($value)) {
+ $value = [$value];
+ }
+
+ $value = $this->trimHeaderValues($value);
$normalized = strtolower($header);
$new = clone $this;
@@ -138,13 +144,11 @@ trait MessageTrait
{
$this->headerNames = $this->headers = [];
foreach ($headers as $header => $value) {
- if (is_int($header)) {
- // Numeric array keys are converted to int by PHP but having a header name '123' is not forbidden by the spec
- // and also allowed in withHeader(). So we need to cast it to string again for the following assertion to pass.
- $header = (string) $header;
+ if (!is_array($value)) {
+ $value = [$value];
}
- $this->assertHeader($header);
- $value = $this->normalizeHeaderValue($value);
+
+ $value = $this->trimHeaderValues($value);
$normalized = strtolower($header);
if (isset($this->headerNames[$normalized])) {
$header = $this->headerNames[$normalized];
@@ -156,19 +160,6 @@ trait MessageTrait
}
}
- private function normalizeHeaderValue($value)
- {
- if (!is_array($value)) {
- return $this->trimHeaderValues([$value]);
- }
-
- if (count($value) === 0) {
- throw new \InvalidArgumentException('Header value can not be an empty array.');
- }
-
- return $this->trimHeaderValues($value);
- }
-
/**
* Trims whitespace from the header values.
*
@@ -186,28 +177,7 @@ trait MessageTrait
private function trimHeaderValues(array $values)
{
return array_map(function ($value) {
- if (!is_scalar($value) && null !== $value) {
- throw new \InvalidArgumentException(sprintf(
- 'Header value must be scalar or null but %s provided.',
- is_object($value) ? get_class($value) : gettype($value)
- ));
- }
-
- return trim((string) $value, " \t");
+ return trim($value, " \t");
}, $values);
}
-
- private function assertHeader($header)
- {
- if (!is_string($header)) {
- throw new \InvalidArgumentException(sprintf(
- 'Header name must be a string but %s provided.',
- is_object($header) ? get_class($header) : gettype($header)
- ));
- }
-
- if ($header === '') {
- throw new \InvalidArgumentException('Header name can not be empty.');
- }
- }
}
diff --git a/vendor/guzzlehttp/psr7/src/Request.php b/vendor/guzzlehttp/psr7/src/Request.php
index 59f337db..08285484 100644
--- a/vendor/guzzlehttp/psr7/src/Request.php
+++ b/vendor/guzzlehttp/psr7/src/Request.php
@@ -36,7 +36,6 @@ class Request implements RequestInterface
$body = null,
$version = '1.1'
) {
- $this->assertMethod($method);
if (!($uri instanceof UriInterface)) {
$uri = new Uri($uri);
}
@@ -46,7 +45,7 @@ class Request implements RequestInterface
$this->setHeaders($headers);
$this->protocol = $version;
- if (!isset($this->headerNames['host'])) {
+ if (!$this->hasHeader('Host')) {
$this->updateHostFromUri();
}
@@ -92,7 +91,6 @@ class Request implements RequestInterface
public function withMethod($method)
{
- $this->assertMethod($method);
$new = clone $this;
$new->method = strtoupper($method);
return $new;
@@ -112,7 +110,7 @@ class Request implements RequestInterface
$new = clone $this;
$new->uri = $uri;
- if (!$preserveHost || !isset($this->headerNames['host'])) {
+ if (!$preserveHost) {
$new->updateHostFromUri();
}
@@ -141,11 +139,4 @@ class Request implements RequestInterface
// See: http://tools.ietf.org/html/rfc7230#section-5.4
$this->headers = [$header => [$host]] + $this->headers;
}
-
- private function assertMethod($method)
- {
- if (!is_string($method) || $method === '') {
- throw new \InvalidArgumentException('Method must be a non-empty string.');
- }
- }
}
diff --git a/vendor/guzzlehttp/psr7/src/Response.php b/vendor/guzzlehttp/psr7/src/Response.php
index e7e04d86..2830c6c9 100644
--- a/vendor/guzzlehttp/psr7/src/Response.php
+++ b/vendor/guzzlehttp/psr7/src/Response.php
@@ -93,11 +93,7 @@ class Response implements ResponseInterface
$version = '1.1',
$reason = null
) {
- $this->assertStatusCodeIsInteger($status);
- $status = (int) $status;
- $this->assertStatusCodeRange($status);
-
- $this->statusCode = $status;
+ $this->statusCode = (int) $status;
if ($body !== '' && $body !== null) {
$this->stream = stream_for($body);
@@ -125,30 +121,12 @@ class Response implements ResponseInterface
public function withStatus($code, $reasonPhrase = '')
{
- $this->assertStatusCodeIsInteger($code);
- $code = (int) $code;
- $this->assertStatusCodeRange($code);
-
$new = clone $this;
- $new->statusCode = $code;
+ $new->statusCode = (int) $code;
if ($reasonPhrase == '' && isset(self::$phrases[$new->statusCode])) {
$reasonPhrase = self::$phrases[$new->statusCode];
}
$new->reasonPhrase = $reasonPhrase;
return $new;
}
-
- private function assertStatusCodeIsInteger($statusCode)
- {
- if (filter_var($statusCode, FILTER_VALIDATE_INT) === false) {
- throw new \InvalidArgumentException('Status code must be an integer value.');
- }
- }
-
- private function assertStatusCodeRange($statusCode)
- {
- if ($statusCode < 100 || $statusCode >= 600) {
- throw new \InvalidArgumentException('Status code must be an integer value between 1xx and 5xx.');
- }
- }
}
diff --git a/vendor/guzzlehttp/psr7/src/Rfc7230.php b/vendor/guzzlehttp/psr7/src/Rfc7230.php
deleted file mode 100644
index 505e4742..00000000
--- a/vendor/guzzlehttp/psr7/src/Rfc7230.php
+++ /dev/null
@@ -1,18 +0,0 @@
-@,;:\\\"/[\]?={}\x01-\x20\x7F]++):[ \t]*+((?:[ \t]*+[\x21-\x7E\x80-\xFF]++)*+)[ \t]*+\r?\n)m";
- const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)";
-}
diff --git a/vendor/guzzlehttp/psr7/src/ServerRequest.php b/vendor/guzzlehttp/psr7/src/ServerRequest.php
index 1a09a6c8..575aab84 100644
--- a/vendor/guzzlehttp/psr7/src/ServerRequest.php
+++ b/vendor/guzzlehttp/psr7/src/ServerRequest.php
@@ -166,9 +166,9 @@ class ServerRequest extends Request implements ServerRequestInterface
public static function fromGlobals()
{
$method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
- $headers = getallheaders();
+ $headers = function_exists('getallheaders') ? getallheaders() : [];
$uri = self::getUriFromGlobals();
- $body = new CachingStream(new LazyOpenStream('php://input', 'r+'));
+ $body = new LazyOpenStream('php://input', 'r+');
$protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1';
$serverRequest = new ServerRequest($method, $uri, $headers, $body, $protocol, $_SERVER);
@@ -180,41 +180,23 @@ class ServerRequest extends Request implements ServerRequestInterface
->withUploadedFiles(self::normalizeFiles($_FILES));
}
- private static function extractHostAndPortFromAuthority($authority)
- {
- $uri = 'http://'.$authority;
- $parts = parse_url($uri);
- if (false === $parts) {
- return [null, null];
- }
-
- $host = isset($parts['host']) ? $parts['host'] : null;
- $port = isset($parts['port']) ? $parts['port'] : null;
-
- return [$host, $port];
- }
-
/**
* Get a Uri populated with values from $_SERVER.
*
* @return UriInterface
*/
- public static function getUriFromGlobals()
- {
+ public static function getUriFromGlobals() {
$uri = new Uri('');
$uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http');
$hasPort = false;
if (isset($_SERVER['HTTP_HOST'])) {
- list($host, $port) = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']);
- if ($host !== null) {
- $uri = $uri->withHost($host);
- }
-
- if ($port !== null) {
+ $hostHeaderParts = explode(':', $_SERVER['HTTP_HOST']);
+ $uri = $uri->withHost($hostHeaderParts[0]);
+ if (isset($hostHeaderParts[1])) {
$hasPort = true;
- $uri = $uri->withPort($port);
+ $uri = $uri->withPort($hostHeaderParts[1]);
}
} elseif (isset($_SERVER['SERVER_NAME'])) {
$uri = $uri->withHost($_SERVER['SERVER_NAME']);
@@ -228,7 +210,7 @@ class ServerRequest extends Request implements ServerRequestInterface
$hasQuery = false;
if (isset($_SERVER['REQUEST_URI'])) {
- $requestUriParts = explode('?', $_SERVER['REQUEST_URI'], 2);
+ $requestUriParts = explode('?', $_SERVER['REQUEST_URI']);
$uri = $uri->withPath($requestUriParts[0]);
if (isset($requestUriParts[1])) {
$hasQuery = true;
diff --git a/vendor/guzzlehttp/psr7/src/Stream.php b/vendor/guzzlehttp/psr7/src/Stream.php
index d9e7409c..e3366287 100644
--- a/vendor/guzzlehttp/psr7/src/Stream.php
+++ b/vendor/guzzlehttp/psr7/src/Stream.php
@@ -10,17 +10,6 @@ use Psr\Http\Message\StreamInterface;
*/
class Stream implements StreamInterface
{
- /**
- * Resource modes.
- *
- * @var string
- *
- * @see http://php.net/manual/function.fopen.php
- * @see http://php.net/manual/en/function.gzopen.php
- */
- const READABLE_MODES = '/r|a\+|ab\+|w\+|wb\+|x\+|xb\+|c\+|cb\+/';
- const WRITABLE_MODES = '/a|w|r\+|rb\+|rw|x|c/';
-
private $stream;
private $size;
private $seekable;
@@ -29,6 +18,22 @@ class Stream implements StreamInterface
private $uri;
private $customMetadata;
+ /** @var array Hash of readable and writable stream types */
+ private static $readWriteHash = [
+ 'read' => [
+ 'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true,
+ 'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true,
+ 'c+b' => true, 'rt' => true, 'w+t' => true, 'r+t' => true,
+ 'x+t' => true, 'c+t' => true, 'a+' => true
+ ],
+ 'write' => [
+ 'w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true,
+ 'c+' => true, 'wb' => true, 'w+b' => true, 'r+b' => true,
+ 'x+b' => true, 'c+b' => true, 'w+t' => true, 'r+t' => true,
+ 'x+t' => true, 'c+t' => true, 'a' => true, 'a+' => true
+ ]
+ ];
+
/**
* This constructor accepts an associative array of options.
*
@@ -60,11 +65,20 @@ class Stream implements StreamInterface
$this->stream = $stream;
$meta = stream_get_meta_data($this->stream);
$this->seekable = $meta['seekable'];
- $this->readable = (bool)preg_match(self::READABLE_MODES, $meta['mode']);
- $this->writable = (bool)preg_match(self::WRITABLE_MODES, $meta['mode']);
+ $this->readable = isset(self::$readWriteHash['read'][$meta['mode']]);
+ $this->writable = isset(self::$readWriteHash['write'][$meta['mode']]);
$this->uri = $this->getMetadata('uri');
}
+ public function __get($name)
+ {
+ if ($name == 'stream') {
+ throw new \RuntimeException('The stream is detached');
+ }
+
+ throw new \BadMethodCallException('No value for ' . $name);
+ }
+
/**
* Closes the stream when the destructed
*/
@@ -85,10 +99,6 @@ class Stream implements StreamInterface
public function getContents()
{
- if (!isset($this->stream)) {
- throw new \RuntimeException('Stream is detached');
- }
-
$contents = stream_get_contents($this->stream);
if ($contents === false) {
@@ -163,19 +173,11 @@ class Stream implements StreamInterface
public function eof()
{
- if (!isset($this->stream)) {
- throw new \RuntimeException('Stream is detached');
- }
-
- return feof($this->stream);
+ return !$this->stream || feof($this->stream);
}
public function tell()
{
- if (!isset($this->stream)) {
- throw new \RuntimeException('Stream is detached');
- }
-
$result = ftell($this->stream);
if ($result === false) {
@@ -192,15 +194,9 @@ class Stream implements StreamInterface
public function seek($offset, $whence = SEEK_SET)
{
- $whence = (int) $whence;
-
- if (!isset($this->stream)) {
- throw new \RuntimeException('Stream is detached');
- }
if (!$this->seekable) {
throw new \RuntimeException('Stream is not seekable');
- }
- if (fseek($this->stream, $offset, $whence) === -1) {
+ } elseif (fseek($this->stream, $offset, $whence) === -1) {
throw new \RuntimeException('Unable to seek to stream position '
. $offset . ' with whence ' . var_export($whence, true));
}
@@ -208,9 +204,6 @@ class Stream implements StreamInterface
public function read($length)
{
- if (!isset($this->stream)) {
- throw new \RuntimeException('Stream is detached');
- }
if (!$this->readable) {
throw new \RuntimeException('Cannot read from non-readable stream');
}
@@ -232,9 +225,6 @@ class Stream implements StreamInterface
public function write($string)
{
- if (!isset($this->stream)) {
- throw new \RuntimeException('Stream is detached');
- }
if (!$this->writable) {
throw new \RuntimeException('Cannot write to a non-writable stream');
}
diff --git a/vendor/guzzlehttp/psr7/src/StreamWrapper.php b/vendor/guzzlehttp/psr7/src/StreamWrapper.php
index 0f3a2856..cf7b2232 100644
--- a/vendor/guzzlehttp/psr7/src/StreamWrapper.php
+++ b/vendor/guzzlehttp/psr7/src/StreamWrapper.php
@@ -38,21 +38,9 @@ class StreamWrapper
. 'writable, or both.');
}
- return fopen('guzzle://stream', $mode, null, self::createStreamContext($stream));
- }
-
- /**
- * Creates a stream context that can be used to open a stream as a php stream resource.
- *
- * @param StreamInterface $stream
- *
- * @return resource
- */
- public static function createStreamContext(StreamInterface $stream)
- {
- return stream_context_create([
+ return fopen('guzzle://stream', $mode, null, stream_context_create([
'guzzle' => ['stream' => $stream]
- ]);
+ ]));
}
/**
@@ -106,21 +94,12 @@ class StreamWrapper
return true;
}
- public function stream_cast($cast_as)
- {
- $stream = clone($this->stream);
-
- return $stream->detach();
- }
-
public function stream_stat()
{
static $modeMap = [
'r' => 33060,
- 'rb' => 33060,
'r+' => 33206,
- 'w' => 33188,
- 'wb' => 33188
+ 'w' => 33188
];
return [
@@ -139,23 +118,4 @@ class StreamWrapper
'blocks' => 0
];
}
-
- public function url_stat($path, $flags)
- {
- return [
- 'dev' => 0,
- 'ino' => 0,
- 'mode' => 0,
- 'nlink' => 0,
- 'uid' => 0,
- 'gid' => 0,
- 'rdev' => 0,
- 'size' => 0,
- 'atime' => 0,
- 'mtime' => 0,
- 'ctime' => 0,
- 'blksize' => 0,
- 'blocks' => 0
- ];
- }
}
diff --git a/vendor/guzzlehttp/psr7/src/Uri.php b/vendor/guzzlehttp/psr7/src/Uri.php
index 825a25ee..f46c1db9 100644
--- a/vendor/guzzlehttp/psr7/src/Uri.php
+++ b/vendor/guzzlehttp/psr7/src/Uri.php
@@ -301,7 +301,15 @@ class Uri implements UriInterface
*/
public static function withoutQueryValue(UriInterface $uri, $key)
{
- $result = self::getFilteredQueryString($uri, [$key]);
+ $current = $uri->getQuery();
+ if ($current === '') {
+ return $uri;
+ }
+
+ $decodedKey = rawurldecode($key);
+ $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) {
+ return rawurldecode(explode('=', $part)[0]) !== $decodedKey;
+ });
return $uri->withQuery(implode('&', $result));
}
@@ -323,29 +331,26 @@ class Uri implements UriInterface
*/
public static function withQueryValue(UriInterface $uri, $key, $value)
{
- $result = self::getFilteredQueryString($uri, [$key]);
+ $current = $uri->getQuery();
- $result[] = self::generateQueryString($key, $value);
+ if ($current === '') {
+ $result = [];
+ } else {
+ $decodedKey = rawurldecode($key);
+ $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) {
+ return rawurldecode(explode('=', $part)[0]) !== $decodedKey;
+ });
+ }
- return $uri->withQuery(implode('&', $result));
- }
+ // Query string separators ("=", "&") within the key or value need to be encoded
+ // (while preventing double-encoding) before setting the query string. All other
+ // chars that need percent-encoding will be encoded by withQuery().
+ $key = strtr($key, self::$replaceQuery);
- /**
- * Creates a new URI with multiple specific query string values.
- *
- * It has the same behavior as withQueryValue() but for an associative array of key => value.
- *
- * @param UriInterface $uri URI to use as a base.
- * @param array $keyValueArray Associative array of key and values
- *
- * @return UriInterface
- */
- public static function withQueryValues(UriInterface $uri, array $keyValueArray)
- {
- $result = self::getFilteredQueryString($uri, array_keys($keyValueArray));
-
- foreach ($keyValueArray as $key => $value) {
- $result[] = self::generateQueryString($key, $value);
+ if ($value !== null) {
+ $result[] = $key . '=' . strtr($value, self::$replaceQuery);
+ } else {
+ $result[] = $key;
}
return $uri->withQuery(implode('&', $result));
@@ -437,9 +442,9 @@ class Uri implements UriInterface
public function withUserInfo($user, $password = null)
{
- $info = $this->filterUserInfoComponent($user);
- if ($password !== null) {
- $info .= ':' . $this->filterUserInfoComponent($password);
+ $info = $user;
+ if ($password != '') {
+ $info .= ':' . $password;
}
if ($this->userInfo === $info) {
@@ -537,9 +542,7 @@ class Uri implements UriInterface
$this->scheme = isset($parts['scheme'])
? $this->filterScheme($parts['scheme'])
: '';
- $this->userInfo = isset($parts['user'])
- ? $this->filterUserInfoComponent($parts['user'])
- : '';
+ $this->userInfo = isset($parts['user']) ? $parts['user'] : '';
$this->host = isset($parts['host'])
? $this->filterHost($parts['host'])
: '';
@@ -556,7 +559,7 @@ class Uri implements UriInterface
? $this->filterQueryAndFragment($parts['fragment'])
: '';
if (isset($parts['pass'])) {
- $this->userInfo .= ':' . $this->filterUserInfoComponent($parts['pass']);
+ $this->userInfo .= ':' . $parts['pass'];
}
$this->removeDefaultPort();
@@ -578,26 +581,6 @@ class Uri implements UriInterface
return strtolower($scheme);
}
- /**
- * @param string $component
- *
- * @return string
- *
- * @throws \InvalidArgumentException If the user info is invalid.
- */
- private function filterUserInfoComponent($component)
- {
- if (!is_string($component)) {
- throw new \InvalidArgumentException('User info must be a string');
- }
-
- return preg_replace_callback(
- '/(?:[^%' . self::$charUnreserved . self::$charSubDelims . ']+|%(?![A-Fa-f0-9]{2}))/',
- [$this, 'rawurlencodeMatchZero'],
- $component
- );
- }
-
/**
* @param string $host
*
@@ -628,56 +611,15 @@ class Uri implements UriInterface
}
$port = (int) $port;
- if (0 > $port || 0xffff < $port) {
+ if (1 > $port || 0xffff < $port) {
throw new \InvalidArgumentException(
- sprintf('Invalid port: %d. Must be between 0 and 65535', $port)
+ sprintf('Invalid port: %d. Must be between 1 and 65535', $port)
);
}
return $port;
}
- /**
- * @param UriInterface $uri
- * @param array $keys
- *
- * @return array
- */
- private static function getFilteredQueryString(UriInterface $uri, array $keys)
- {
- $current = $uri->getQuery();
-
- if ($current === '') {
- return [];
- }
-
- $decodedKeys = array_map('rawurldecode', $keys);
-
- return array_filter(explode('&', $current), function ($part) use ($decodedKeys) {
- return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true);
- });
- }
-
- /**
- * @param string $key
- * @param string|null $value
- *
- * @return string
- */
- private static function generateQueryString($key, $value)
- {
- // Query string separators ("=", "&") within the key or value need to be encoded
- // (while preventing double-encoding) before setting the query string. All other
- // chars that need percent-encoding will be encoded by withQuery().
- $queryString = strtr($key, self::$replaceQuery);
-
- if ($value !== null) {
- $queryString .= '=' . strtr($value, self::$replaceQuery);
- }
-
- return $queryString;
- }
-
private function removeDefaultPort()
{
if ($this->port !== null && self::isDefaultPort($this)) {
diff --git a/vendor/guzzlehttp/psr7/src/functions.php b/vendor/guzzlehttp/psr7/src/functions.php
index 8e6dafe6..e40348d6 100644
--- a/vendor/guzzlehttp/psr7/src/functions.php
+++ b/vendor/guzzlehttp/psr7/src/functions.php
@@ -69,10 +69,10 @@ function uri_for($uri)
* - metadata: Array of custom metadata.
* - size: Size of the stream.
*
- * @param resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource Entity body data
- * @param array $options Additional options
+ * @param resource|string|null|int|float|bool|StreamInterface|callable $resource Entity body data
+ * @param array $options Additional options
*
- * @return StreamInterface
+ * @return Stream
* @throws \InvalidArgumentException if the $resource arg is not valid.
*/
function stream_for($resource = '', array $options = [])
@@ -238,7 +238,7 @@ function modify_request(RequestInterface $request, array $changes)
}
if ($request instanceof ServerRequestInterface) {
- return (new ServerRequest(
+ return new ServerRequest(
isset($changes['method']) ? $changes['method'] : $request->getMethod(),
$uri,
$headers,
@@ -247,11 +247,7 @@ function modify_request(RequestInterface $request, array $changes)
? $changes['version']
: $request->getProtocolVersion(),
$request->getServerParams()
- ))
- ->withParsedBody($request->getParsedBody())
- ->withQueryParams($request->getQueryParams())
- ->withCookieParams($request->getCookieParams())
- ->withUploadedFiles($request->getUploadedFiles());
+ );
}
return new Request(
@@ -435,7 +431,7 @@ function hash(
* @param StreamInterface $stream Stream to read from
* @param int $maxLength Maximum buffer length
*
- * @return string
+ * @return string|bool
*/
function readline(StreamInterface $stream, $maxLength = null)
{
@@ -499,7 +495,7 @@ function parse_response($message)
// between status-code and reason-phrase is required. But browsers accept
// responses without space and reason as well.
if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) {
- throw new \InvalidArgumentException('Invalid response string: ' . $data['start-line']);
+ throw new \InvalidArgumentException('Invalid response string');
}
$parts = explode(' ', $data['start-line'], 3);
@@ -520,8 +516,8 @@ function parse_response($message)
* PHP style arrays into an associative array (e.g., foo[a]=1&foo[b]=2 will
* be parsed into ['foo[a]' => '1', 'foo[b]' => '2']).
*
- * @param string $str Query string to parse
- * @param int|bool $urlEncoding How the query string is encoded
+ * @param string $str Query string to parse
+ * @param bool|string $urlEncoding How the query string is encoded
*
* @return array
*/
@@ -537,9 +533,9 @@ function parse_query($str, $urlEncoding = true)
$decoder = function ($value) {
return rawurldecode(str_replace('+', ' ', $value));
};
- } elseif ($urlEncoding === PHP_QUERY_RFC3986) {
+ } elseif ($urlEncoding == PHP_QUERY_RFC3986) {
$decoder = 'rawurldecode';
- } elseif ($urlEncoding === PHP_QUERY_RFC1738) {
+ } elseif ($urlEncoding == PHP_QUERY_RFC1738) {
$decoder = 'urldecode';
} else {
$decoder = function ($str) { return $str; };
@@ -637,7 +633,6 @@ function mimetype_from_filename($filename)
function mimetype_from_extension($extension)
{
static $mimetypes = [
- '3gp' => 'video/3gpp',
'7z' => 'application/x-7z-compressed',
'aac' => 'audio/x-aac',
'ai' => 'application/postscript',
@@ -685,7 +680,6 @@ function mimetype_from_extension($extension)
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mov' => 'video/quicktime',
- 'mkv' => 'video/x-matroska',
'mp3' => 'audio/mpeg',
'mp4' => 'video/mp4',
'mp4a' => 'audio/mp4',
@@ -724,7 +718,6 @@ function mimetype_from_extension($extension)
'txt' => 'text/plain',
'wav' => 'audio/x-wav',
'webm' => 'video/webm',
- 'webp' => 'image/webp',
'wma' => 'audio/x-ms-wma',
'wmv' => 'video/x-ms-wmv',
'woff' => 'application/x-font-woff',
@@ -765,53 +758,29 @@ function _parse_message($message)
throw new \InvalidArgumentException('Invalid message');
}
- $message = ltrim($message, "\r\n");
+ // Iterate over each line in the message, accounting for line endings
+ $lines = preg_split('/(\\r?\\n)/', $message, -1, PREG_SPLIT_DELIM_CAPTURE);
+ $result = ['start-line' => array_shift($lines), 'headers' => [], 'body' => ''];
+ array_shift($lines);
- $messageParts = preg_split("/\r?\n\r?\n/", $message, 2);
-
- if ($messageParts === false || count($messageParts) !== 2) {
- throw new \InvalidArgumentException('Invalid message: Missing header delimiter');
- }
-
- list($rawHeaders, $body) = $messageParts;
- $rawHeaders .= "\r\n"; // Put back the delimiter we split previously
- $headerParts = preg_split("/\r?\n/", $rawHeaders, 2);
-
- if ($headerParts === false || count($headerParts) !== 2) {
- throw new \InvalidArgumentException('Invalid message: Missing status line');
- }
-
- list($startLine, $rawHeaders) = $headerParts;
-
- if (preg_match("/(?:^HTTP\/|^[A-Z]+ \S+ HTTP\/)(\d+(?:\.\d+)?)/i", $startLine, $matches) && $matches[1] === '1.0') {
- // Header folding is deprecated for HTTP/1.1, but allowed in HTTP/1.0
- $rawHeaders = preg_replace(Rfc7230::HEADER_FOLD_REGEX, ' ', $rawHeaders);
- }
-
- /** @var array[] $headerLines */
- $count = preg_match_all(Rfc7230::HEADER_REGEX, $rawHeaders, $headerLines, PREG_SET_ORDER);
-
- // If these aren't the same, then one line didn't match and there's an invalid header.
- if ($count !== substr_count($rawHeaders, "\n")) {
- // Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4
- if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) {
- throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding');
+ for ($i = 0, $totalLines = count($lines); $i < $totalLines; $i += 2) {
+ $line = $lines[$i];
+ // If two line breaks were encountered, then this is the end of body
+ if (empty($line)) {
+ if ($i < $totalLines - 1) {
+ $result['body'] = implode('', array_slice($lines, $i + 2));
+ }
+ break;
+ }
+ if (strpos($line, ':')) {
+ $parts = explode(':', $line, 2);
+ $key = trim($parts[0]);
+ $value = isset($parts[1]) ? trim($parts[1]) : '';
+ $result['headers'][$key][] = $value;
}
-
- throw new \InvalidArgumentException('Invalid header syntax');
}
- $headers = [];
-
- foreach ($headerLines as $headerLine) {
- $headers[$headerLine[1]][] = $headerLine[2];
- }
-
- return [
- 'start-line' => $startLine,
- 'headers' => $headers,
- 'body' => $body,
- ];
+ return $result;
}
/**
@@ -840,46 +809,6 @@ function _parse_request_uri($path, array $headers)
return $scheme . '://' . $host . '/' . ltrim($path, '/');
}
-/**
- * Get a short summary of the message body
- *
- * Will return `null` if the response is not printable.
- *
- * @param MessageInterface $message The message to get the body summary
- * @param int $truncateAt The maximum allowed size of the summary
- *
- * @return null|string
- */
-function get_message_body_summary(MessageInterface $message, $truncateAt = 120)
-{
- $body = $message->getBody();
-
- if (!$body->isSeekable() || !$body->isReadable()) {
- return null;
- }
-
- $size = $body->getSize();
-
- if ($size === 0) {
- return null;
- }
-
- $summary = $body->read($truncateAt);
- $body->rewind();
-
- if ($size > $truncateAt) {
- $summary .= ' (truncated...)';
- }
-
- // Matches any printable character, including unicode characters:
- // letters, marks, numbers, punctuation, spacing, and separators.
- if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/', $summary)) {
- return null;
- }
-
- return $summary;
-}
-
/** @internal */
function _caseless_remove($keys, array $data)
{
diff --git a/vendor/scssphp/scssphp/LICENSE.md b/vendor/leafo/scssphp/LICENSE.md
similarity index 93%
rename from vendor/scssphp/scssphp/LICENSE.md
rename to vendor/leafo/scssphp/LICENSE.md
index afcfdfb2..2f5412f9 100644
--- a/vendor/scssphp/scssphp/LICENSE.md
+++ b/vendor/leafo/scssphp/LICENSE.md
@@ -1,4 +1,4 @@
-Copyright (c) 2015 Leaf Corcoran, http://scssphp.github.io/scssphp
+Copyright (c) 2015 Leaf Corcoran, http://leafo.github.io/scssphp
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/vendor/scssphp/scssphp/README.md b/vendor/leafo/scssphp/README.md
similarity index 81%
rename from vendor/scssphp/scssphp/README.md
rename to vendor/leafo/scssphp/README.md
index f541e488..53a4c7a4 100644
--- a/vendor/scssphp/scssphp/README.md
+++ b/vendor/leafo/scssphp/README.md
@@ -1,12 +1,12 @@
# scssphp
-###
+###
-[](http://travis-ci.org/scssphp/scssphp)
-[](https://packagist.org/packages/scssphp/scssphp)
+[](http://travis-ci.org/leafo/scssphp)
+[](https://packagist.org/packages/leafo/scssphp)
`scssphp` is a compiler for SCSS written in PHP.
-Checkout the homepage, , for directions on how to use.
+Checkout the homepage, , for directions on how to use.
## Running Tests
diff --git a/vendor/scssphp/scssphp/bin/pscss b/vendor/leafo/scssphp/bin/pscss
similarity index 73%
rename from vendor/scssphp/scssphp/bin/pscss
rename to vendor/leafo/scssphp/bin/pscss
index f944b632..be1cb51c 100644
--- a/vendor/scssphp/scssphp/bin/pscss
+++ b/vendor/leafo/scssphp/bin/pscss
@@ -3,24 +3,24 @@
/**
* SCSSPHP
*
- * @copyright 2012-2019 Leaf Corcoran
+ * @copyright 2012-2015 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
- * @link http://scssphp.github.io/scssphp
+ * @link http://leafo.github.io/scssphp
*/
error_reporting(E_ALL);
-if (version_compare(PHP_VERSION, '5.6') < 0) {
- die('Requires PHP 5.6 or above');
+if (version_compare(PHP_VERSION, '5.4') < 0) {
+ die('Requires PHP 5.4 or above');
}
include __DIR__ . '/../scss.inc.php';
-use ScssPhp\ScssPhp\Compiler;
-use ScssPhp\ScssPhp\Parser;
-use ScssPhp\ScssPhp\Version;
+use Leafo\ScssPhp\Compiler;
+use Leafo\ScssPhp\Parser;
+use Leafo\ScssPhp\Version;
$style = null;
$loadPaths = null;
@@ -62,7 +62,7 @@ function parseArgument(&$i, $options) {
}
for ($i = 1; $i < $argc; $i++) {
- if ($argv[$i] === '-?' || $argv[$i] === '-h' || $argv[$i] === '--help') {
+ if ($argv[$i] === '-h' || $argv[$i] === '--help') {
$exe = $argv[0];
$HELP = <<setFormatter('ScssPhp\\ScssPhp\\Formatter\\' . ucfirst($style));
+ $scss->setFormatter('Leafo\\ScssPhp\\Formatter\\' . ucfirst($style));
}
if ($sourceMap) {
- $scss->setSourceMap(Compiler::SOURCE_MAP_INLINE);
+ $scss->setSourceMap(Compiler::SOURCE_MAP_FILE);
}
if ($encoding) {
diff --git a/vendor/leafo/scssphp/composer.json b/vendor/leafo/scssphp/composer.json
new file mode 100644
index 00000000..95118a32
--- /dev/null
+++ b/vendor/leafo/scssphp/composer.json
@@ -0,0 +1,41 @@
+{
+ "name": "leafo/scssphp",
+ "type": "library",
+ "description": "scssphp is a compiler for SCSS written in PHP.",
+ "keywords": ["css", "stylesheet", "scss", "sass", "less"],
+ "homepage": "http://leafo.github.io/scssphp/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Leaf Corcoran",
+ "email": "leafot@gmail.com",
+ "homepage": "http://leafo.net"
+ }
+ ],
+ "autoload": {
+ "psr-4": { "Leafo\\ScssPhp\\": "src/" }
+ },
+ "autoload-dev": {
+ "psr-4": { "Leafo\\ScssPhp\\Test\\": "tests/" }
+ },
+ "require": {
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "squizlabs/php_codesniffer": "~2.5",
+ "phpunit/phpunit": "~4.6"
+ },
+ "bin": ["bin/pscss"],
+ "archive": {
+ "exclude": [
+ "/Makefile",
+ "/.gitattributes",
+ "/.gitignore",
+ "/.travis.yml",
+ "/phpunit.xml.dist",
+ "/tests"
+ ]
+ }
+}
diff --git a/vendor/scssphp/scssphp/example/Server.php b/vendor/leafo/scssphp/example/Server.php
similarity index 90%
rename from vendor/scssphp/scssphp/example/Server.php
rename to vendor/leafo/scssphp/example/Server.php
index 6fa11e3a..6ea97018 100644
--- a/vendor/scssphp/scssphp/example/Server.php
+++ b/vendor/leafo/scssphp/example/Server.php
@@ -2,18 +2,18 @@
/**
* SCSSPHP
*
- * @copyright 2012-2019 Leaf Corcoran
+ * @copyright 2012-2017 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
- * @link http://scssphp.github.io/scssphp
+ * @link http://leafo.github.io/scssphp
*/
-namespace ScssPhp\ScssPhp;
+namespace Leafo\ScssPhp;
-use ScssPhp\ScssPhp\Compiler;
-use ScssPhp\ScssPhp\Exception\ServerException;
-use ScssPhp\ScssPhp\Version;
+use Leafo\ScssPhp\Compiler;
+use Leafo\ScssPhp\Exception\ServerException;
+use Leafo\ScssPhp\Version;
/**
* Server
@@ -38,7 +38,7 @@ class Server
private $cacheDir;
/**
- * @var \ScssPhp\ScssPhp\Compiler
+ * @var \Leafo\ScssPhp\Compiler
*/
private $scss;
@@ -62,16 +62,13 @@ class Server
*/
protected function inputName()
{
- if (isset($_GET['p'])) {
- return $_GET['p'];
- }
-
- if (isset($_SERVER['PATH_INFO'])) {
- return $_SERVER['PATH_INFO'];
- }
-
- if (isset($_SERVER['DOCUMENT_URI'])) {
- return substr($_SERVER['DOCUMENT_URI'], strlen($_SERVER['SCRIPT_NAME']));
+ switch (true) {
+ case isset($_GET['p']):
+ return $_GET['p'];
+ case isset($_SERVER['PATH_INFO']):
+ return $_SERVER['PATH_INFO'];
+ case isset($_SERVER['DOCUMENT_URI']):
+ return substr($_SERVER['DOCUMENT_URI'], strlen($_SERVER['SCRIPT_NAME']));
}
}
@@ -99,8 +96,6 @@ class Server
/**
* Get path to cached .css file
*
- * @param string $fname
- *
* @return string
*/
protected function cacheName($fname)
@@ -111,8 +106,6 @@ class Server
/**
* Get path to meta data
*
- * @param string $out
- *
* @return string
*/
protected function metadataName($out)
@@ -277,7 +270,7 @@ class Server
*
* @return string|bool
*
- * @throws \ScssPhp\ScssPhp\Exception\ServerException
+ * @throws \Leafo\ScssPhp\Exception\ServerException
*/
public function compileFile($in, $out = null)
{
@@ -291,11 +284,11 @@ class Server
$compiled = $this->scss->compile(file_get_contents($in), $in);
- if (is_null($out)) {
- return $compiled;
+ if ($out !== null) {
+ return file_put_contents($out, $compiled);
}
- return file_put_contents($out, $compiled);
+ return $compiled;
}
/**
@@ -402,7 +395,7 @@ class Server
*
* @return string Compiled CSS results
*
- * @throws \ScssPhp\ScssPhp\Exception\ServerException
+ * @throws \Leafo\ScssPhp\Exception\ServerException
*/
public function checkedCachedCompile($in, $out, $force = false)
{
@@ -473,28 +466,27 @@ class Server
return null;
}
- if (is_null($root)) {
+ if ($root !== null) {
+ // If we have a root value which means we should rebuild.
+ $out = array();
+ $out['root'] = $root;
+ $out['compiled'] = $this->compileFile($root);
+ $out['files'] = $this->scss->getParsedFiles();
+ $out['updated'] = time();
+ return $out;
+ } else {
// No changes, pass back the structure
// we were given initially.
return $in;
}
-
- // If we have a root value which means we should rebuild.
- $out = [];
- $out['root'] = $root;
- $out['compiled'] = $this->compileFile($root);
- $out['files'] = $this->scss->getParsedFiles();
- $out['updated'] = time();
-
- return $out;
}
/**
* Constructor
*
- * @param string $dir Root directory to .scss files
- * @param string $cacheDir Cache directory
- * @param \ScssPhp\ScssPhp\Compiler|null $scss SCSS compiler instance
+ * @param string $dir Root directory to .scss files
+ * @param string $cacheDir Cache directory
+ * @param \Leafo\ScssPhp\Compiler|null $scss SCSS compiler instance
*/
public function __construct($dir, $cacheDir = null, $scss = null)
{
diff --git a/vendor/scssphp/scssphp/scss.inc.php b/vendor/leafo/scssphp/scss.inc.php
similarity index 80%
rename from vendor/scssphp/scssphp/scss.inc.php
rename to vendor/leafo/scssphp/scss.inc.php
index e4ec7f18..13c84bf5 100644
--- a/vendor/scssphp/scssphp/scss.inc.php
+++ b/vendor/leafo/scssphp/scss.inc.php
@@ -1,12 +1,11 @@
'240,248,255',
'antiquewhite' => '250,235,215',
'aqua' => '0,255,255',
@@ -176,71 +176,4 @@ class Colors
'yellow' => '255,255,0',
'yellowgreen' => '154,205,50',
];
-
- /**
- * Convert named color in a [r,g,b[,a]] array
- *
- * @param string $colorName
- *
- * @return array|null
- */
- public static function colorNameToRGBa($colorName)
- {
- if (is_string($colorName) && isset(static::$cssColors[$colorName])) {
- $rgba = explode(',', static::$cssColors[$colorName]);
-
- // only case with opacity is transparent, with opacity=0, so we can intval on opacity also
- $rgba = array_map('intval', $rgba);
-
- return $rgba;
- }
-
- return null;
- }
-
- /**
- * Reverse conversion : from RGBA to a color name if possible
- *
- * @param integer $r
- * @param integer $g
- * @param integer $b
- * @param integer $a
- *
- * @return string|null
- */
- public static function RGBaToColorName($r, $g, $b, $a = 1)
- {
- static $reverseColorTable = null;
-
- if (! is_numeric($r) || ! is_numeric($g) || ! is_numeric($b) || ! is_numeric($a)) {
- return null;
- }
-
- if ($a < 1) {
- # specific case we dont' revert according to spec
- #if (! $a && ! $r && ! $g && ! $b) {
- # return 'transparent';
- #}
-
- return null;
- }
-
- if (is_null($reverseColorTable)) {
- $reverseColorTable = [];
-
- foreach (static::$cssColors as $name => $rgb_str) {
- $rgb_str = explode(',', $rgb_str);
-
- if (count($rgb_str) == 3) {
- $reverseColorTable[intval($rgb_str[0])][intval($rgb_str[1])][intval($rgb_str[2])] = $name;
- }
- }
- }
-
- if (isset($reverseColorTable[intval($r)][intval($g)][intval($b)])) {
- return $reverseColorTable[intval($r)][intval($g)][intval($b)];
- }
-
- return null;
- }
}
diff --git a/vendor/scssphp/scssphp/src/Compiler.php b/vendor/leafo/scssphp/src/Compiler.php
similarity index 52%
rename from vendor/scssphp/scssphp/src/Compiler.php
rename to vendor/leafo/scssphp/src/Compiler.php
index 711d3382..637f1c1c 100644
--- a/vendor/scssphp/scssphp/src/Compiler.php
+++ b/vendor/leafo/scssphp/src/Compiler.php
@@ -2,27 +2,26 @@
/**
* SCSSPHP
*
- * @copyright 2012-2019 Leaf Corcoran
+ * @copyright 2012-2018 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
- * @link http://scssphp.github.io/scssphp
+ * @link http://leafo.github.io/scssphp
*/
-namespace ScssPhp\ScssPhp;
+namespace Leafo\ScssPhp;
-use ScssPhp\ScssPhp\Base\Range;
-use ScssPhp\ScssPhp\Block;
-use ScssPhp\ScssPhp\Cache;
-use ScssPhp\ScssPhp\Colors;
-use ScssPhp\ScssPhp\Compiler\Environment;
-use ScssPhp\ScssPhp\Exception\CompilerException;
-use ScssPhp\ScssPhp\Formatter\OutputBlock;
-use ScssPhp\ScssPhp\Node;
-use ScssPhp\ScssPhp\SourceMap\SourceMapGenerator;
-use ScssPhp\ScssPhp\Type;
-use ScssPhp\ScssPhp\Parser;
-use ScssPhp\ScssPhp\Util;
+use Leafo\ScssPhp\Base\Range;
+use Leafo\ScssPhp\Block;
+use Leafo\ScssPhp\Colors;
+use Leafo\ScssPhp\Compiler\Environment;
+use Leafo\ScssPhp\Exception\CompilerException;
+use Leafo\ScssPhp\Formatter\OutputBlock;
+use Leafo\ScssPhp\Node;
+use Leafo\ScssPhp\SourceMap\SourceMapGenerator;
+use Leafo\ScssPhp\Type;
+use Leafo\ScssPhp\Parser;
+use Leafo\ScssPhp\Util;
/**
* The scss compiler and parser.
@@ -99,17 +98,17 @@ class Compiler
'function' => '^',
];
- static public $true = [Type::T_KEYWORD, 'true'];
- static public $false = [Type::T_KEYWORD, 'false'];
- static public $null = [Type::T_NULL];
- static public $nullString = [Type::T_STRING, '', []];
+ static public $true = [Type::T_KEYWORD, 'true'];
+ static public $false = [Type::T_KEYWORD, 'false'];
+ static public $null = [Type::T_NULL];
+ static public $nullString = [Type::T_STRING, '', []];
static public $defaultValue = [Type::T_KEYWORD, ''];
static public $selfSelector = [Type::T_SELF];
- static public $emptyList = [Type::T_LIST, '', []];
- static public $emptyMap = [Type::T_MAP, [], []];
- static public $emptyString = [Type::T_STRING, '"', []];
- static public $with = [Type::T_KEYWORD, 'with'];
- static public $without = [Type::T_KEYWORD, 'without'];
+ static public $emptyList = [Type::T_LIST, '', []];
+ static public $emptyMap = [Type::T_MAP, [], []];
+ static public $emptyString = [Type::T_STRING, '"', []];
+ static public $with = [Type::T_KEYWORD, 'with'];
+ static public $without = [Type::T_KEYWORD, 'without'];
protected $importPaths = [''];
protected $importCache = [];
@@ -130,15 +129,15 @@ class Compiler
protected $sourceMapOptions = [];
/**
- * @var string|\ScssPhp\ScssPhp\Formatter
+ * @var string|\Leafo\ScssPhp\Formatter
*/
- protected $formatter = 'ScssPhp\ScssPhp\Formatter\Nested';
+ protected $formatter = 'Leafo\ScssPhp\Formatter\Nested';
protected $rootEnv;
protected $rootBlock;
/**
- * @var \ScssPhp\ScssPhp\Compiler\Environment
+ * @var \Leafo\ScssPhp\Compiler\Environment
*/
protected $env;
protected $scope;
@@ -146,67 +145,26 @@ class Compiler
protected $charsetSeen;
protected $sourceNames;
- protected $cache;
-
- protected $indentLevel;
- protected $extends;
- protected $extendsMap;
- protected $parsedFiles;
- protected $parser;
- protected $sourceIndex;
- protected $sourceLine;
- protected $sourceColumn;
- protected $stderr;
- protected $shouldEvaluate;
- protected $ignoreErrors;
-
- protected $callStack = [];
+ private $indentLevel;
+ private $commentsSeen;
+ private $extends;
+ private $extendsMap;
+ private $parsedFiles;
+ private $parser;
+ private $sourceIndex;
+ private $sourceLine;
+ private $sourceColumn;
+ private $stderr;
+ private $shouldEvaluate;
+ private $ignoreErrors;
/**
* Constructor
- *
- * @param array|null $cacheOptions
*/
- public function __construct($cacheOptions = null)
+ public function __construct()
{
$this->parsedFiles = [];
$this->sourceNames = [];
-
- if ($cacheOptions) {
- $this->cache = new Cache($cacheOptions);
- }
-
- $this->stderr = fopen('php://stderr', 'w');
- }
-
- /**
- * Get compiler options
- *
- * @return array
- */
- public function getCompileOptions()
- {
- $options = [
- 'importPaths' => $this->importPaths,
- 'registeredVars' => $this->registeredVars,
- 'registeredFeatures' => $this->registeredFeatures,
- 'encoding' => $this->encoding,
- 'sourceMap' => serialize($this->sourceMap),
- 'sourceMapOptions' => $this->sourceMapOptions,
- 'formatter' => $this->formatter,
- ];
-
- return $options;
- }
-
- /**
- * Set an alternative error output stream, for testing purpose only
- *
- * @param resource $handle
- */
- public function setErrorOuput($handle)
- {
- $this->stderr = $handle;
}
/**
@@ -221,28 +179,8 @@ class Compiler
*/
public function compile($code, $path = null)
{
- if ($this->cache) {
- $cacheKey = ($path ? $path : "(stdin)") . ":" . md5($code);
- $compileOptions = $this->getCompileOptions();
- $cache = $this->cache->getCache("compile", $cacheKey, $compileOptions);
-
- if (is_array($cache) && isset($cache['dependencies']) && isset($cache['out'])) {
- // check if any dependency file changed before accepting the cache
- foreach ($cache['dependencies'] as $file => $mtime) {
- if (! is_file($file) || filemtime($file) !== $mtime) {
- unset($cache);
- break;
- }
- }
-
- if (isset($cache)) {
- return $cache['out'];
- }
- }
- }
-
-
$this->indentLevel = -1;
+ $this->commentsSeen = [];
$this->extends = [];
$this->extendsMap = [];
$this->sourceIndex = null;
@@ -253,9 +191,10 @@ class Compiler
$this->storeEnv = null;
$this->charsetSeen = null;
$this->shouldEvaluate = null;
+ $this->stderr = fopen('php://stderr', 'w');
$this->parser = $this->parserFactory($path);
- $tree = $this->parser->parse($code);
+ $tree = $this->parser->parse($code);
$this->parser = null;
$this->formatter = new $this->formatter();
@@ -296,15 +235,6 @@ class Compiler
$out .= sprintf('/*# sourceMappingURL=%s */', $sourceMapUrl);
}
- if ($this->cache && isset($cacheKey) && isset($compileOptions)) {
- $v = [
- 'dependencies' => $this->getParsedFiles(),
- 'out' => &$out,
- ];
-
- $this->cache->setCache("compile", $cacheKey, $v, $compileOptions);
- }
-
return $out;
}
@@ -313,11 +243,11 @@ class Compiler
*
* @param string $path
*
- * @return \ScssPhp\ScssPhp\Parser
+ * @return \Leafo\ScssPhp\Parser
*/
protected function parserFactory($path)
{
- $parser = new Parser($path, count($this->sourceNames), $this->encoding, $this->cache);
+ $parser = new Parser($path, count($this->sourceNames), $this->encoding);
$this->sourceNames[] = $path;
$this->addParsedFile($path);
@@ -347,9 +277,9 @@ class Compiler
/**
* Push extends
*
- * @param array $target
- * @param array $origin
- * @param array|null $block
+ * @param array $target
+ * @param array $origin
+ * @param \stdClass $block
*/
protected function pushExtends($target, $origin, $block)
{
@@ -375,17 +305,17 @@ class Compiler
* @param string $type
* @param array $selectors
*
- * @return \ScssPhp\ScssPhp\Formatter\OutputBlock
+ * @return \Leafo\ScssPhp\Formatter\OutputBlock
*/
protected function makeOutputBlock($type, $selectors = null)
{
$out = new OutputBlock;
- $out->type = $type;
- $out->lines = [];
- $out->children = [];
- $out->parent = $this->scope;
- $out->selectors = $selectors;
- $out->depth = $this->env->depth;
+ $out->type = $type;
+ $out->lines = [];
+ $out->children = [];
+ $out->parent = $this->scope;
+ $out->selectors = $selectors;
+ $out->depth = $this->env->depth;
if ($this->env->block instanceof Block) {
$out->sourceName = $this->env->block->sourceName;
@@ -403,7 +333,7 @@ class Compiler
/**
* Compile root
*
- * @param \ScssPhp\ScssPhp\Block $rootBlock
+ * @param \Leafo\ScssPhp\Block $rootBlock
*/
protected function compileRoot(Block $rootBlock)
{
@@ -442,8 +372,8 @@ class Compiler
/**
* Flatten selectors
*
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
- * @param string $parentKey
+ * @param \Leafo\ScssPhp\Formatter\OutputBlock $block
+ * @param string $parentKey
*/
protected function flattenSelectors(OutputBlock $block, $parentKey = null)
{
@@ -498,40 +428,6 @@ class Compiler
}
}
- /**
- * Glue parts of :not( or :nth-child( ... that are in general splitted in selectors parts
- *
- * @param array $parts
- *
- * @return array
- */
- protected function glueFunctionSelectors($parts)
- {
- $new = [];
-
- foreach ($parts as $part) {
- if (is_array($part)) {
- $part = $this->glueFunctionSelectors($part);
- $new[] = $part;
- } else {
- // a selector part finishing with a ) is the last part of a :not( or :nth-child(
- // and need to be joined to this
- if (count($new) && is_string($new[count($new) - 1]) &&
- strlen($part) && substr($part, -1) === ')' && strpos($part, '(') === false
- ) {
- while (count($new)>1 && substr($new[count($new) - 1], -1) !== '(') {
- $part = array_pop($new) . $part;
- }
- $new[count($new) - 1] .= $part;
- } else {
- $new[] = $part;
- }
- }
- }
-
- return $new;
- }
-
/**
* Match extends
*
@@ -542,60 +438,32 @@ class Compiler
*/
protected function matchExtends($selector, &$out, $from = 0, $initial = true)
{
- static $partsPile = [];
- $selector = $this->glueFunctionSelectors($selector);
-
- if (count($selector) == 1 && in_array(reset($selector), $partsPile)) {
- return;
- }
-
- $outRecurs = [];
foreach ($selector as $i => $part) {
if ($i < $from) {
continue;
}
- // check that we are not building an infinite loop of extensions
- // if the new part is just including a previous part don't try to extend anymore
- if (count($part) > 1) {
- foreach ($partsPile as $previousPart) {
- if (! count(array_diff($previousPart, $part))) {
- continue 2;
- }
- }
- }
+ if ($this->matchExtendsSingle($part, $origin)) {
+ $after = array_slice($selector, $i + 1);
+ $before = array_slice($selector, 0, $i);
- $partsPile[] = $part;
- if ($this->matchExtendsSingle($part, $origin, $initial)) {
- $after = array_slice($selector, $i + 1);
- $before = array_slice($selector, 0, $i);
list($before, $nonBreakableBefore) = $this->extractRelationshipFromFragment($before);
foreach ($origin as $new) {
$k = 0;
// remove shared parts
- if (count($new) > 1) {
+ if ($initial) {
while ($k < $i && isset($new[$k]) && $selector[$k] === $new[$k]) {
$k++;
}
}
- if (count($nonBreakableBefore) and $k == count($new)) {
- $k--;
- }
$replacement = [];
$tempReplacement = $k > 0 ? array_slice($new, $k) : $new;
for ($l = count($tempReplacement) - 1; $l >= 0; $l--) {
- $slice = [];
-
- foreach ($tempReplacement[$l] as $chunk) {
- if (! in_array($chunk, $slice)) {
- $slice[] = $chunk;
- }
- }
-
+ $slice = $tempReplacement[$l];
array_unshift($replacement, $slice);
if (! $this->isImmediateRelationshipCombinator(end($slice))) {
@@ -619,93 +487,33 @@ class Compiler
continue;
}
- $this->pushOrMergeExtentedSelector($out, $result);
+ $out[] = $result;
// recursively check for more matches
- $startRecurseFrom = count($before) + min(count($nonBreakableBefore), count($mergedBefore));
- if (count($origin) > 1) {
- $this->matchExtends($result, $out, $startRecurseFrom, false);
- } else {
- $this->matchExtends($result, $outRecurs, $startRecurseFrom, false);
- }
+ $this->matchExtends($result, $out, count($before) + count($mergedBefore), false);
// selector sequence merging
if (! empty($before) && count($new) > 1) {
- $preSharedParts = $k > 0 ? array_slice($before, 0, $k) : [];
+ $sharedParts = $k > 0 ? array_slice($before, 0, $k) : [];
$postSharedParts = $k > 0 ? array_slice($before, $k) : $before;
- list($betweenSharedParts, $nonBreakabl2) = $this->extractRelationshipFromFragment($afterBefore);
+ list($injectBetweenSharedParts, $nonBreakable2) = $this->extractRelationshipFromFragment($afterBefore);
$result2 = array_merge(
- $preSharedParts,
- $betweenSharedParts,
+ $sharedParts,
+ $injectBetweenSharedParts,
$postSharedParts,
- $nonBreakabl2,
+ $nonBreakable2,
$nonBreakableBefore,
$replacement,
$after
);
- $this->pushOrMergeExtentedSelector($out, $result2);
- }
- }
- }
- array_pop($partsPile);
- }
- while (count($outRecurs)) {
- $result = array_shift($outRecurs);
- $this->pushOrMergeExtentedSelector($out, $result);
- }
- }
-
- /**
- * Test a part for being a pseudo selector
- * @param string $part
- * @param array $matches
- * @return bool
- */
- protected function isPseudoSelector($part, &$matches)
- {
- if (strpos($part, ":") === 0
- && preg_match(",^::?([\w-]+)\((.+)\)$,", $part, $matches)) {
- return true;
- }
- return false;
- }
-
- /**
- * Push extended selector except if
- * - this is a pseudo selector
- * - same as previous
- * - in a white list
- * in this case we merge the pseudo selector content
- * @param array $out
- * @param array $extended
- */
- protected function pushOrMergeExtentedSelector(&$out, $extended)
- {
- if (count($out) && count($extended) === 1 && count(reset($extended)) === 1) {
- $single = reset($extended);
- $part = reset($single);
- if ($this->isPseudoSelector($part, $matchesExtended)
- && in_array($matchesExtended[1], [ 'slotted' ])) {
- $prev = end($out);
- $prev = $this->glueFunctionSelectors($prev);
- if (count($prev) === 1 && count(reset($prev)) === 1) {
- $single = reset($prev);
- $part = reset($single);
- if ($this->isPseudoSelector($part, $matchesPrev)
- && $matchesPrev[1] === $matchesExtended[1]) {
- $extended = explode($matchesExtended[1] . '(', $matchesExtended[0], 2);
- $extended[1] = $matchesPrev[2] . ", " . $extended[1];
- $extended = implode($matchesExtended[1] . '(', $extended);
- $extended = [ [ $extended ]];
- array_pop($out);
+ $out[] = $result2;
}
}
}
}
- $out[] = $extended;
}
/**
@@ -713,20 +521,14 @@ class Compiler
*
* @param array $rawSingle
* @param array $outOrigin
- * @param bool $initial
*
* @return boolean
*/
- protected function matchExtendsSingle($rawSingle, &$outOrigin, $initial = true)
+ protected function matchExtendsSingle($rawSingle, &$outOrigin)
{
$counts = [];
$single = [];
- // simple usual cases, no need to do the whole trick
- if (in_array($rawSingle, [['>'],['+'],['~']])) {
- return false;
- }
-
foreach ($rawSingle as $part) {
// matches Number
if (! is_string($part)) {
@@ -747,46 +549,20 @@ class Compiler
$extendingDecoratedTag = preg_match('/^[a-z0-9]+$/i', $single[0], $matches) ? $matches[0] : false;
}
- $outOrigin = [];
- $found = false;
-
- foreach ($single as $k => $part) {
+ foreach ($single as $part) {
if (isset($this->extendsMap[$part])) {
foreach ($this->extendsMap[$part] as $idx) {
$counts[$idx] = isset($counts[$idx]) ? $counts[$idx] + 1 : 1;
}
}
- if ($initial
- && $this->isPseudoSelector($part, $matches)
- && ! in_array($matches[1], [ 'not' ])) {
- $buffer = $matches[2];
- $parser = $this->parserFactory(__METHOD__);
- if ($parser->parseSelector($buffer, $subSelectors)) {
- foreach ($subSelectors as $ksub => $subSelector) {
- $subExtended = [];
- $this->matchExtends($subSelector, $subExtended, 0, false);
- if ($subExtended) {
- $subSelectorsExtended = $subSelectors;
- $subSelectorsExtended[$ksub] = $subExtended;
- foreach ($subSelectorsExtended as $ksse => $sse) {
- $subSelectorsExtended[$ksse] = $this->collapseSelectors($sse);
- }
- $subSelectorsExtended = implode(', ', $subSelectorsExtended);
- $singleExtended = $single;
- $singleExtended[$k] = str_replace("(".$buffer.")", "($subSelectorsExtended)", $part);
- $outOrigin[] = [ $singleExtended ];
- $found = true;
- }
- }
- }
- }
}
+ $outOrigin = [];
+ $found = false;
+
foreach ($counts as $idx => $count) {
list($target, $origin, /* $block */) = $this->extends[$idx];
- $origin = $this->glueFunctionSelectors($origin);
-
// check count
if ($count !== count($target)) {
continue;
@@ -827,6 +603,7 @@ class Compiler
return $found;
}
+
/**
* Extract a relationship from the fragment.
*
@@ -836,20 +613,18 @@ class Compiler
* the rest.
*
* @param array $fragment The selector fragment maybe ending with a direction relationship combinator.
- *
* @return array The selector without the relationship fragment if any, the relationship fragment.
*/
protected function extractRelationshipFromFragment(array $fragment)
{
$parents = [];
$children = [];
-
$j = $i = count($fragment);
for (;;) {
$children = $j != $i ? array_slice($fragment, $j, $i - $j) : [];
- $parents = array_slice($fragment, 0, $j);
- $slice = end($parents);
+ $parents = array_slice($fragment, 0, $j);
+ $slice = end($parents);
if (empty($slice) || ! $this->isImmediateRelationshipCombinator($slice[0])) {
break;
@@ -871,25 +646,22 @@ class Compiler
*/
protected function combineSelectorSingle($base, $other)
{
- $tag = [];
- $out = [];
- $wasTag = false;
+ $tag = [];
+ $out = [];
+ $wasTag = true;
- foreach ([array_reverse($base), array_reverse($other)] as $single) {
+ foreach ([$base, $other] as $single) {
foreach ($single as $part) {
- if (preg_match('/^[\[:]/', $part)) {
+ if (preg_match('/^[\[.:#]/', $part)) {
$out[] = $part;
$wasTag = false;
- } elseif (preg_match('/^[\.#]/', $part)) {
- array_unshift($out, $part);
- $wasTag = false;
} elseif (preg_match('/^[^_-]/', $part)) {
$tag[] = $part;
$wasTag = true;
} elseif ($wasTag) {
$tag[count($tag) - 1] .= $part;
} else {
- $out[] = $part;
+ $out[count($out) - 1] .= $part;
}
}
}
@@ -904,24 +676,19 @@ class Compiler
/**
* Compile media
*
- * @param \ScssPhp\ScssPhp\Block $media
+ * @param \Leafo\ScssPhp\Block $media
*/
protected function compileMedia(Block $media)
{
$this->pushEnv($media);
- $mediaQueries = $this->compileMediaQuery($this->multiplyMedia($this->env));
+ $mediaQuery = $this->compileMediaQuery($this->multiplyMedia($this->env));
+
+ if (! empty($mediaQuery)) {
+ $this->scope = $this->makeOutputBlock(Type::T_MEDIA, [$mediaQuery]);
- if (! empty($mediaQueries) && $mediaQueries) {
- $previousScope = $this->scope;
$parentScope = $this->mediaParent($this->scope);
-
- foreach ($mediaQueries as $mediaQuery) {
- $this->scope = $this->makeOutputBlock(Type::T_MEDIA, [$mediaQuery]);
-
- $parentScope->children[] = $this->scope;
- $parentScope = $this->scope;
- }
+ $parentScope->children[] = $this->scope;
// top level properties in a media cause it to be wrapped
$needsWrap = false;
@@ -951,35 +718,11 @@ class Compiler
$wrapped->children = $media->children;
$media->children = [[Type::T_BLOCK, $wrapped]];
-
- if (isset($this->lineNumberStyle)) {
- $annotation = $this->makeOutputBlock(Type::T_COMMENT);
- $annotation->depth = 0;
-
- $file = $this->sourceNames[$media->sourceIndex];
- $line = $media->sourceLine;
-
- switch ($this->lineNumberStyle) {
- case static::LINE_COMMENTS:
- $annotation->lines[] = '/* line ' . $line
- . ($file ? ', ' . $file : '')
- . ' */';
- break;
-
- case static::DEBUG_INFO:
- $annotation->lines[] = '@media -sass-debug-info{'
- . ($file ? 'filename{font-family:"' . $file . '"}' : '')
- . 'line{font-family:' . $line . '}}';
- break;
- }
-
- $this->scope->children[] = $annotation;
- }
}
$this->compileChildrenNoReturn($media->children, $this->scope);
- $this->scope = $previousScope;
+ $this->scope = $this->scope->parent;
}
$this->popEnv();
@@ -988,9 +731,9 @@ class Compiler
/**
* Media parent
*
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $scope
+ * @param \Leafo\ScssPhp\Formatter\OutputBlock $scope
*
- * @return \ScssPhp\ScssPhp\Formatter\OutputBlock
+ * @return \Leafo\ScssPhp\Formatter\OutputBlock
*/
protected function mediaParent(OutputBlock $scope)
{
@@ -1008,42 +751,33 @@ class Compiler
/**
* Compile directive
*
- * @param \ScssPhp\ScssPhp\Block|array $block
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $out
+ * @param \Leafo\ScssPhp\Block $block
*/
- protected function compileDirective($directive, OutputBlock $out)
+ protected function compileDirective(Block $block)
{
- if (is_array($directive)) {
- $s = '@' . $directive[0];
- if (! empty($directive[1])) {
- $s .= ' ' . $this->compileValue($directive[1]);
- }
- $this->appendRootDirective($s . ';', $out);
+ $s = '@' . $block->name;
+
+ if (! empty($block->value)) {
+ $s .= ' ' . $this->compileValue($block->value);
+ }
+
+ if ($block->name === 'keyframes' || substr($block->name, -10) === '-keyframes') {
+ $this->compileKeyframeBlock($block, [$s]);
} else {
- $s = '@' . $directive->name;
-
- if (! empty($directive->value)) {
- $s .= ' ' . $this->compileValue($directive->value);
- }
-
- if ($directive->name === 'keyframes' || substr($directive->name, -10) === '-keyframes') {
- $this->compileKeyframeBlock($directive, [$s]);
- } else {
- $this->compileNestedBlock($directive, [$s]);
- }
+ $this->compileNestedBlock($block, [$s]);
}
}
/**
* Compile at-root
*
- * @param \ScssPhp\ScssPhp\Block $block
+ * @param \Leafo\ScssPhp\Block $block
*/
protected function compileAtRoot(Block $block)
{
$env = $this->pushEnv($block);
$envs = $this->compactEnv($env);
- list($with, $without) = $this->compileWith(isset($block->with) ? $block->with : null);
+ $without = isset($block->with) ? $this->compileWith($block->with) : static::WITH_RULE;
// wrap inline selector
if ($block->selector) {
@@ -1056,29 +790,18 @@ class Compiler
$wrapped->comments = [];
$wrapped->parent = $block;
$wrapped->children = $block->children;
- $wrapped->selfParent = $block->selfParent;
$block->children = [[Type::T_BLOCK, $wrapped]];
- $block->selector = null;
}
- $selfParent = $block->selfParent;
-
- if (! $block->selfParent->selectors && isset($block->parent) && $block->parent &&
- isset($block->parent->selectors) && $block->parent->selectors
- ) {
- $selfParent = $block->parent;
- }
-
- $this->env = $this->filterWithWithout($envs, $with, $without);
+ $this->env = $this->filterWithout($envs, $without);
+ $newBlock = $this->spliceTree($envs, $block, $without);
$saveScope = $this->scope;
- $this->scope = $this->filterScopeWithWithout($saveScope, $with, $without);
+ $this->scope = $this->rootBlock;
- // propagate selfParent to the children where they still can be useful
- $this->compileChildrenNoReturn($block->children, $this->scope, $selfParent);
+ $this->compileChild($newBlock, $this->scope);
- $this->scope = $this->completeScope($this->scope, $saveScope);
$this->scope = $saveScope;
$this->env = $this->extractEnv($envs);
@@ -1086,190 +809,152 @@ class Compiler
}
/**
- * Filter at-root scope depending of with/without option
+ * Splice parse tree
*
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $scope
- * @param array $with
- * @param array $without
- *
- * @return mixed
- */
- protected function filterScopeWithWithout($scope, $with, $without)
- {
- $filteredScopes = [];
- $childStash = [];
-
- if ($scope->type === TYPE::T_ROOT) {
- return $scope;
- }
-
- // start from the root
- while ($scope->parent && $scope->parent->type !== TYPE::T_ROOT) {
- array_unshift($childStash, $scope);
- $scope = $scope->parent;
- }
-
- for (;;) {
- if (! $scope) {
- break;
- }
-
- if ($this->isWith($scope, $with, $without)) {
- $s = clone $scope;
- $s->children = [];
- $s->lines = [];
- $s->parent = null;
-
- if ($s->type !== Type::T_MEDIA && $s->type !== Type::T_DIRECTIVE) {
- $s->selectors = [];
- }
-
- $filteredScopes[] = $s;
- }
-
- if (count($childStash)) {
- $scope = array_shift($childStash);
- } elseif ($scope->children) {
- $scope = end($scope->children);
- } else {
- $scope = null;
- }
- }
-
- if (! count($filteredScopes)) {
- return $this->rootBlock;
- }
-
- $newScope = array_shift($filteredScopes);
- $newScope->parent = $this->rootBlock;
-
- $this->rootBlock->children[] = $newScope;
-
- $p = &$newScope;
-
- while (count($filteredScopes)) {
- $s = array_shift($filteredScopes);
- $s->parent = $p;
- $p->children[] = $s;
- $newScope = &$p->children[0];
- $p = &$p->children[0];
- }
-
- return $newScope;
- }
-
- /**
- * found missing selector from a at-root compilation in the previous scope
- * (if at-root is just enclosing a property, the selector is in the parent tree)
- *
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $scope
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $previousScope
- *
- * @return mixed
- */
- protected function completeScope($scope, $previousScope)
- {
- if (! $scope->type && (! $scope->selectors || ! count($scope->selectors)) && count($scope->lines)) {
- $scope->selectors = $this->findScopeSelectors($previousScope, $scope->depth);
- }
-
- if ($scope->children) {
- foreach ($scope->children as $k => $c) {
- $scope->children[$k] = $this->completeScope($c, $previousScope);
- }
- }
-
- return $scope;
- }
-
- /**
- * Find a selector by the depth node in the scope
- *
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $scope
- * @param integer $depth
+ * @param array $envs
+ * @param \Leafo\ScssPhp\Block $block
+ * @param integer $without
*
* @return array
*/
- protected function findScopeSelectors($scope, $depth)
+ private function spliceTree($envs, Block $block, $without)
{
- if ($scope->depth === $depth && $scope->selectors) {
- return $scope->selectors;
- }
+ $newBlock = null;
- if ($scope->children) {
- foreach (array_reverse($scope->children) as $c) {
- if ($s = $this->findScopeSelectors($c, $depth)) {
- return $s;
- }
+ foreach ($envs as $e) {
+ if (! isset($e->block)) {
+ continue;
}
+
+ if ($e->block === $block) {
+ continue;
+ }
+
+ if (isset($e->block->type) && $e->block->type === Type::T_AT_ROOT) {
+ continue;
+ }
+
+ if ($e->block && $this->isWithout($without, $e->block)) {
+ continue;
+ }
+
+ $b = new Block;
+ $b->sourceName = $e->block->sourceName;
+ $b->sourceIndex = $e->block->sourceIndex;
+ $b->sourceLine = $e->block->sourceLine;
+ $b->sourceColumn = $e->block->sourceColumn;
+ $b->selectors = [];
+ $b->comments = $e->block->comments;
+ $b->parent = null;
+
+ if ($newBlock) {
+ $type = isset($newBlock->type) ? $newBlock->type : Type::T_BLOCK;
+
+ $b->children = [[$type, $newBlock]];
+
+ $newBlock->parent = $b;
+ } elseif (count($block->children)) {
+ foreach ($block->children as $child) {
+ if ($child[0] === Type::T_BLOCK) {
+ $child[1]->parent = $b;
+ }
+ }
+
+ $b->children = $block->children;
+ }
+
+ if (isset($e->block->type)) {
+ $b->type = $e->block->type;
+ }
+
+ if (isset($e->block->name)) {
+ $b->name = $e->block->name;
+ }
+
+ if (isset($e->block->queryList)) {
+ $b->queryList = $e->block->queryList;
+ }
+
+ if (isset($e->block->value)) {
+ $b->value = $e->block->value;
+ }
+
+ $newBlock = $b;
}
- return [];
+ $type = isset($newBlock->type) ? $newBlock->type : Type::T_BLOCK;
+
+ return [$type, $newBlock];
}
/**
- * Compile @at-root's with: inclusion / without: exclusion into 2 lists uses to filter scope/env later
+ * Compile @at-root's with: inclusion / without: exclusion into filter flags
*
- * @param array $withCondition
+ * @param array $with
*
- * @return array
+ * @return integer
*/
- protected function compileWith($withCondition)
+ private function compileWith($with)
{
- // just compile what we have in 2 lists
- $with = [];
- $without = ['rule' => true];
+ static $mapping = [
+ 'rule' => self::WITH_RULE,
+ 'media' => self::WITH_MEDIA,
+ 'supports' => self::WITH_SUPPORTS,
+ 'all' => self::WITH_ALL,
+ ];
- if ($withCondition) {
- if ($this->libMapHasKey([$withCondition, static::$with])) {
- $without = []; // cancel the default
- $list = $this->coerceList($this->libMapGet([$withCondition, static::$with]));
+ // exclude selectors by default
+ $without = static::WITH_RULE;
- foreach ($list[2] as $item) {
- $keyword = $this->compileStringContent($this->coerceString($item));
+ if ($this->libMapHasKey([$with, static::$with])) {
+ $without = static::WITH_ALL;
- $with[$keyword] = true;
- }
- }
+ $list = $this->coerceList($this->libMapGet([$with, static::$with]));
- if ($this->libMapHasKey([$withCondition, static::$without])) {
- $without = []; // cancel the default
- $list = $this->coerceList($this->libMapGet([$withCondition, static::$without]));
+ foreach ($list[2] as $item) {
+ $keyword = $this->compileStringContent($this->coerceString($item));
- foreach ($list[2] as $item) {
- $keyword = $this->compileStringContent($this->coerceString($item));
-
- $without[$keyword] = true;
+ if (array_key_exists($keyword, $mapping)) {
+ $without &= ~($mapping[$keyword]);
}
}
}
- return [$with, $without];
+ if ($this->libMapHasKey([$with, static::$without])) {
+ $without = 0;
+
+ $list = $this->coerceList($this->libMapGet([$with, static::$without]));
+
+ foreach ($list[2] as $item) {
+ $keyword = $this->compileStringContent($this->coerceString($item));
+
+ if (array_key_exists($keyword, $mapping)) {
+ $without |= $mapping[$keyword];
+ }
+ }
+ }
+
+ return $without;
}
/**
* Filter env stack
*
* @param array $envs
- * @param array $with
- * @param array $without
+ * @param integer $without
*
- * @return \ScssPhp\ScssPhp\Compiler\Environment
+ * @return \Leafo\ScssPhp\Compiler\Environment
*/
- protected function filterWithWithout($envs, $with, $without)
+ private function filterWithout($envs, $without)
{
$filtered = [];
foreach ($envs as $e) {
- if ($e->block && ! $this->isWith($e->block, $with, $without)) {
- $ec = clone $e;
- $ec->block = null;
- $ec->selectors = [];
-
- $filtered[] = $ec;
- } else {
- $filtered[] = $e;
+ if ($e->block && $this->isWithout($without, $e->block)) {
+ continue;
}
+
+ $filtered[] = $e;
}
return $this->extractEnv($filtered);
@@ -1278,76 +963,31 @@ class Compiler
/**
* Filter WITH rules
*
- * @param \ScssPhp\ScssPhp\Block|\ScssPhp\ScssPhp\Formatter\OutputBlock $block
- * @param array $with
- * @param array $without
+ * @param integer $without
+ * @param \Leafo\ScssPhp\Block $block
*
* @return boolean
*/
- protected function isWith($block, $with, $without)
+ private function isWithout($without, Block $block)
{
- if (isset($block->type)) {
- if ($block->type === Type::T_MEDIA) {
- return $this->testWithWithout('media', $with, $without);
- }
-
- if ($block->type === Type::T_DIRECTIVE) {
- if (isset($block->name)) {
- return $this->testWithWithout($block->name, $with, $without);
- } elseif (isset($block->selectors) && preg_match(',@(\w+),ims', json_encode($block->selectors), $m)) {
- return $this->testWithWithout($m[1], $with, $without);
- } else {
- return $this->testWithWithout('???', $with, $without);
- }
- }
- } elseif (isset($block->selectors)) {
- // a selector starting with number is a keyframe rule
- if (count($block->selectors)) {
- $s = reset($block->selectors);
-
- while (is_array($s)) {
- $s = reset($s);
- }
-
- if (is_object($s) && $s instanceof Node\Number) {
- return $this->testWithWithout('keyframes', $with, $without);
- }
- }
-
- return $this->testWithWithout('rule', $with, $without);
+ if ((($without & static::WITH_RULE) && isset($block->selectors)) ||
+ (($without & static::WITH_MEDIA) &&
+ isset($block->type) && $block->type === Type::T_MEDIA) ||
+ (($without & static::WITH_SUPPORTS) &&
+ isset($block->type) && $block->type === Type::T_DIRECTIVE &&
+ isset($block->name) && $block->name === 'supports')
+ ) {
+ return true;
}
- return true;
+ return false;
}
- /**
- * Test a single type of block against with/without lists
- *
- * @param string $what
- * @param array $with
- * @param array $without
- *
- * @return boolean
- * true if the block should be kept, false to reject
- */
- protected function testWithWithout($what, $with, $without)
- {
-
- // if without, reject only if in the list (or 'all' is in the list)
- if (count($without)) {
- return (isset($without[$what]) || isset($without['all'])) ? false : true;
- }
-
- // otherwise reject all what is not in the with list
- return (isset($with[$what]) || isset($with['all'])) ? true : false;
- }
-
-
/**
* Compile keyframe block
*
- * @param \ScssPhp\ScssPhp\Block $block
- * @param array $selectors
+ * @param \Leafo\ScssPhp\Block $block
+ * @param array $selectors
*/
protected function compileKeyframeBlock(Block $block, $selectors)
{
@@ -1371,45 +1011,11 @@ class Compiler
$this->popEnv();
}
- /**
- * Compile nested properties lines
- *
- * @param \ScssPhp\ScssPhp\Block $block
- * @param OutputBlock $out
- */
- protected function compileNestedPropertiesBlock(Block $block, OutputBlock $out)
- {
- $prefix = $this->compileValue($block->prefix) . '-';
-
- $nested = $this->makeOutputBlock($block->type);
- $nested->parent = $out;
-
- if ($block->hasValue) {
- $nested->depth = $out->depth + 1;
- }
-
- $out->children[] = $nested;
-
- foreach ($block->children as $child) {
- switch ($child[0]) {
- case Type::T_ASSIGN:
- array_unshift($child[1][2], $prefix);
- break;
-
- case Type::T_NESTED_PROPERTY:
- array_unshift($child[1]->prefix[2], $prefix);
- break;
- }
-
- $this->compileChild($child, $nested);
- }
- }
-
/**
* Compile nested block
*
- * @param \ScssPhp\ScssPhp\Block $block
- * @param array $selectors
+ * @param \Leafo\ScssPhp\Block $block
+ * @param array $selectors
*/
protected function compileNestedBlock(Block $block, $selectors)
{
@@ -1418,35 +1024,6 @@ class Compiler
$this->scope = $this->makeOutputBlock($block->type, $selectors);
$this->scope->parent->children[] = $this->scope;
- // wrap assign children in a block
- // except for @font-face
- if ($block->type !== Type::T_DIRECTIVE || $block->name !== "font-face") {
- // need wrapping?
- $needWrapping = false;
-
- foreach ($block->children as $child) {
- if ($child[0] === Type::T_ASSIGN) {
- $needWrapping = true;
- break;
- }
- }
-
- if ($needWrapping) {
- $wrapped = new Block;
- $wrapped->sourceName = $block->sourceName;
- $wrapped->sourceIndex = $block->sourceIndex;
- $wrapped->sourceLine = $block->sourceLine;
- $wrapped->sourceColumn = $block->sourceColumn;
- $wrapped->selectors = [];
- $wrapped->comments = [];
- $wrapped->parent = $block;
- $wrapped->children = $block->children;
- $wrapped->selfParent = $block->selfParent;
-
- $block->children = [[Type::T_BLOCK, $wrapped]];
- }
- }
-
$this->compileChildrenNoReturn($block->children, $this->scope);
$this->scope = $this->scope->parent;
@@ -1470,7 +1047,7 @@ class Compiler
*
* @see Compiler::compileChild()
*
- * @param \ScssPhp\ScssPhp\Block $block
+ * @param \Leafo\ScssPhp\Block $block
*/
protected function compileBlock(Block $block)
{
@@ -1506,62 +1083,16 @@ class Compiler
$this->scope->children[] = $out;
if (count($block->children)) {
- $out->selectors = $this->multiplySelectors($env, $block->selfParent);
+ $out->selectors = $this->multiplySelectors($env);
- // propagate selfParent to the children where they still can be useful
- $selfParentSelectors = null;
-
- if (isset($block->selfParent->selectors)) {
- $selfParentSelectors = $block->selfParent->selectors;
- $block->selfParent->selectors = $out->selectors;
- }
-
- $this->compileChildrenNoReturn($block->children, $out, $block->selfParent);
-
- // and revert for the following children of the same block
- if ($selfParentSelectors) {
- $block->selfParent->selectors = $selfParentSelectors;
- }
+ $this->compileChildrenNoReturn($block->children, $out);
}
+ $this->formatter->stripSemicolon($out->lines);
+
$this->popEnv();
}
-
- /**
- * Compile the value of a comment that can have interpolation
- *
- * @param array $value
- * @param boolean $pushEnv
- *
- * @return array|mixed|string
- */
- protected function compileCommentValue($value, $pushEnv = false)
- {
- $c = $value[1];
-
- if (isset($value[2])) {
- if ($pushEnv) {
- $this->pushEnv();
- $storeEnv = $this->storeEnv;
- $this->storeEnv = $this->env;
- }
-
- try {
- $c = $this->compileValue($value[2]);
- } catch (\Exception $e) {
- // ignore error in comment compilation which are only interpolation
- }
-
- if ($pushEnv) {
- $this->storeEnv = $storeEnv;
- $this->popEnv();
- }
- }
-
- return $c;
- }
-
/**
* Compile root level comment
*
@@ -1570,8 +1101,7 @@ class Compiler
protected function compileComment($block)
{
$out = $this->makeOutputBlock(Type::T_COMMENT);
- $out->lines[] = $this->compileCommentValue($block, true);
-
+ $out->lines[] = $block[1];
$this->scope->children[] = $out;
}
@@ -1590,9 +1120,8 @@ class Compiler
// after evaluating interpolates, we might need a second pass
if ($this->shouldEvaluate) {
- $selectors = $this->revertSelfSelector($selectors);
- $buffer = $this->collapseSelectors($selectors);
- $parser = $this->parserFactory(__METHOD__);
+ $buffer = $this->collapseSelectors($selectors);
+ $parser = $this->parserFactory(__METHOD__);
if ($parser->parseSelector($buffer, $newSelectors)) {
$selectors = array_map([$this, 'evalSelector'], $newSelectors);
@@ -1645,89 +1174,28 @@ class Compiler
/**
* Collapse selectors
*
- * @param array $selectors
- * @param boolean $selectorFormat
- * if false return a collapsed string
- * if true return an array description of a structured selector
+ * @param array $selectors
*
* @return string
*/
- protected function collapseSelectors($selectors, $selectorFormat = false)
+ protected function collapseSelectors($selectors)
{
$parts = [];
foreach ($selectors as $selector) {
- $output = [];
- $glueNext = false;
+ $output = '';
- foreach ($selector as $node) {
- $compound = '';
-
- array_walk_recursive(
- $node,
- function ($value, $key) use (&$compound) {
- $compound .= $value;
- }
- );
-
- if ($selectorFormat && $this->isImmediateRelationshipCombinator($compound)) {
- if (count($output)) {
- $output[count($output) - 1] .= ' ' . $compound;
- } else {
- $output[] = $compound;
- }
-
- $glueNext = true;
- } elseif ($glueNext) {
- $output[count($output) - 1] .= ' ' . $compound;
- $glueNext = false;
- } else {
- $output[] = $compound;
+ array_walk_recursive(
+ $selector,
+ function ($value, $key) use (&$output) {
+ $output .= $value;
}
- }
-
- if ($selectorFormat) {
- foreach ($output as &$o) {
- $o = [Type::T_STRING, '', [$o]];
- }
-
- $output = [Type::T_LIST, ' ', $output];
- } else {
- $output = implode(' ', $output);
- }
+ );
$parts[] = $output;
}
- if ($selectorFormat) {
- $parts = [Type::T_LIST, ',', $parts];
- } else {
- $parts = implode(', ', $parts);
- }
-
- return $parts;
- }
-
- /**
- * Parse down the selector and revert [self] to "&" before a reparsing
- *
- * @param array $selectors
- *
- * @return array
- */
- protected function revertSelfSelector($selectors)
- {
- foreach ($selectors as &$part) {
- if (is_array($part)) {
- if ($part === [Type::T_SELF]) {
- $part = '&';
- } else {
- $part = $this->revertSelfSelector($part);
- }
- }
- }
-
- return $selectors;
+ return implode(', ', $parts);
}
/**
@@ -1834,43 +1302,16 @@ class Compiler
return false;
}
- protected function pushCallStack($name = '')
- {
- $this->callStack[] = [
- 'n' => $name,
- Parser::SOURCE_INDEX => $this->sourceIndex,
- Parser::SOURCE_LINE => $this->sourceLine,
- Parser::SOURCE_COLUMN => $this->sourceColumn
- ];
-
- // infinite calling loop
- if (count($this->callStack) > 25000) {
- // not displayed but you can var_dump it to deep debug
- $msg = $this->callStackMessage(true, 100);
- $msg = "Infinite calling loop";
-
- $this->throwError($msg);
- }
- }
-
- protected function popCallStack()
- {
- array_pop($this->callStack);
- }
-
/**
* Compile children and return result
*
- * @param array $stms
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $out
- * @param string $traceName
+ * @param array $stms
+ * @param \Leafo\ScssPhp\Formatter\OutputBlock $out
*
- * @return array|null
+ * @return array
*/
- protected function compileChildren($stms, OutputBlock $out, $traceName = '')
+ protected function compileChildren($stms, OutputBlock $out)
{
- $this->pushCallStack($traceName);
-
foreach ($stms as $stm) {
$ret = $this->compileChild($stm, $out);
@@ -1878,38 +1319,20 @@ class Compiler
return $ret;
}
}
-
- $this->popCallStack();
-
- return null;
}
/**
* Compile children and throw exception if unexpected @return
*
- * @param array $stms
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $out
- * @param \ScssPhp\ScssPhp\Block $selfParent
- * @param string $traceName
+ * @param array $stms
+ * @param \Leafo\ScssPhp\Formatter\OutputBlock $out
*
* @throws \Exception
*/
- protected function compileChildrenNoReturn($stms, OutputBlock $out, $selfParent = null, $traceName = '')
+ protected function compileChildrenNoReturn($stms, OutputBlock $out)
{
- $this->pushCallStack($traceName);
-
foreach ($stms as $stm) {
- if ($selfParent && isset($stm[1]) && is_object($stm[1]) && $stm[1] instanceof Block) {
- $stm[1]->selfParent = $selfParent;
- $ret = $this->compileChild($stm, $out);
- $stm[1]->selfParent = null;
- } elseif ($selfParent && in_array($stm[0], [TYPE::T_INCLUDE, TYPE::T_EXTEND])) {
- $stm['selfParent'] = $selfParent;
- $ret = $this->compileChild($stm, $out);
- unset($stm['selfParent']);
- } else {
- $ret = $this->compileChild($stm, $out);
- }
+ $ret = $this->compileChild($stm, $out);
if (isset($ret)) {
$this->throwError('@return may only be used within a function');
@@ -1917,74 +1340,6 @@ class Compiler
return;
}
}
-
- $this->popCallStack();
- }
-
-
- /**
- * evaluate media query : compile internal value keeping the structure inchanged
- *
- * @param array $queryList
- *
- * @return array
- */
- protected function evaluateMediaQuery($queryList)
- {
- static $parser = null;
-
- $outQueryList = [];
-
- foreach ($queryList as $kql => $query) {
- $shouldReparse = false;
-
- foreach ($query as $kq => $q) {
- for ($i = 1; $i < count($q); $i++) {
- $value = $this->compileValue($q[$i]);
-
- // the parser had no mean to know if media type or expression if it was an interpolation
- // so you need to reparse if the T_MEDIA_TYPE looks like anything else a media type
- if ($q[0] == Type::T_MEDIA_TYPE &&
- (strpos($value, '(') !== false ||
- strpos($value, ')') !== false ||
- strpos($value, ':') !== false ||
- strpos($value, ',') !== false)
- ) {
- $shouldReparse = true;
- }
-
- $queryList[$kql][$kq][$i] = [Type::T_KEYWORD, $value];
- }
- }
-
- if ($shouldReparse) {
- if (is_null($parser)) {
- $parser = $this->parserFactory(__METHOD__);
- }
-
- $queryString = $this->compileMediaQuery([$queryList[$kql]]);
- $queryString = reset($queryString);
-
- if (strpos($queryString, '@media ') === 0) {
- $queryString = substr($queryString, 7);
- $queries = [];
-
- if ($parser->parseMediaQueryList($queryString, $queries)) {
- $queries = $this->evaluateMediaQuery($queries[2]);
-
- while (count($queries)) {
- $outQueryList[] = array_shift($queries);
- }
-
- continue;
- }
- }
- }
-
- $outQueryList[] = $queryList[$kql];
- }
-
- return $outQueryList;
}
/**
@@ -1992,76 +1347,31 @@ class Compiler
*
* @param array $queryList
*
- * @return array
+ * @return string
*/
protected function compileMediaQuery($queryList)
{
- $start = '@media ';
- $default = trim($start);
- $out = [];
- $current = "";
+ $out = '@media';
+ $first = true;
foreach ($queryList as $query) {
$type = null;
$parts = [];
- $mediaTypeOnly = true;
-
- foreach ($query as $q) {
- if ($q[0] !== Type::T_MEDIA_TYPE) {
- $mediaTypeOnly = false;
- break;
- }
- }
-
foreach ($query as $q) {
switch ($q[0]) {
case Type::T_MEDIA_TYPE:
- $newType = array_map([$this, 'compileValue'], array_slice($q, 1));
+ if ($type) {
+ $type = $this->mergeMediaTypes(
+ $type,
+ array_map([$this, 'compileValue'], array_slice($q, 1))
+ );
- // combining not and anything else than media type is too risky and should be avoided
- if (! $mediaTypeOnly) {
- if (in_array(Type::T_NOT, $newType) || ($type && in_array(Type::T_NOT, $type) )) {
- if ($type) {
- array_unshift($parts, implode(' ', array_filter($type)));
- }
-
- if (! empty($parts)) {
- if (strlen($current)) {
- $current .= $this->formatter->tagSeparator;
- }
-
- $current .= implode(' and ', $parts);
- }
-
- if ($current) {
- $out[] = $start . $current;
- }
-
- $current = "";
- $type = null;
- $parts = [];
- }
- }
-
- if ($newType === ['all'] && $default) {
- $default = $start . 'all';
- }
-
- // all can be safely ignored and mixed with whatever else
- if ($newType !== ['all']) {
- if ($type) {
- $type = $this->mergeMediaTypes($type, $newType);
-
- if (empty($type)) {
- // merge failed : ignore this query that is not valid, skip to the next one
- $parts = [];
- $default = ''; // if everything fail, no @media at all
- continue 3;
- }
- } else {
- $type = $newType;
+ if (empty($type)) { // merge failed
+ return null;
}
+ } else {
+ $type = array_map([$this, 'compileValue'], array_slice($q, 1));
}
break;
@@ -2090,34 +1400,20 @@ class Compiler
}
if (! empty($parts)) {
- if (strlen($current)) {
- $current .= $this->formatter->tagSeparator;
+ if ($first) {
+ $first = false;
+ $out .= ' ';
+ } else {
+ $out .= $this->formatter->tagSeparator;
}
- $current .= implode(' and ', $parts);
+ $out .= implode(' and ', $parts);
}
}
- if ($current) {
- $out[] = $start . $current;
- }
-
- // no @media type except all, and no conflict?
- if (! $out && $default) {
- $out[] = $default;
- }
-
return $out;
}
- /**
- * Merge direct relationships between selectors
- *
- * @param array $selectors1
- * @param array $selectors2
- *
- * @return array
- */
protected function mergeDirectRelationships($selectors1, $selectors2)
{
if (empty($selectors1) || empty($selectors2)) {
@@ -2127,7 +1423,7 @@ class Compiler
$part1 = end($selectors1);
$part2 = end($selectors2);
- if (! $this->isImmediateRelationshipCombinator($part1[0]) && $part1 !== $part2) {
+ if (! $this->isImmediateRelationshipCombinator($part1[0]) || $part1 !== $part2) {
return array_merge($selectors1, $selectors2);
}
@@ -2137,18 +1433,13 @@ class Compiler
$part1 = array_pop($selectors1);
$part2 = array_pop($selectors2);
- if (! $this->isImmediateRelationshipCombinator($part1[0]) && $part1 !== $part2) {
- if ($this->isImmediateRelationshipCombinator(reset($merged)[0])) {
- array_unshift($merged, [$part1[0] . $part2[0]]);
- $merged = array_merge($selectors1, $selectors2, $merged);
- } else {
- $merged = array_merge($selectors1, [$part1], $selectors2, [$part2], $merged);
- }
-
+ if ($this->isImmediateRelationshipCombinator($part1[0]) && $part1 !== $part2) {
+ $merged = array_merge($selectors1, [$part1], $selectors2, [$part2], $merged);
break;
}
array_unshift($merged, $part1);
+ array_unshift($merged, [array_pop($selectors1)[0] . array_pop($selectors2)[0]]);
} while (! empty($selectors1) && ! empty($selectors2));
return $merged;
@@ -2172,19 +1463,23 @@ class Compiler
return $type1;
}
+ $m1 = '';
+ $t1 = '';
+
if (count($type1) > 1) {
- $m1 = strtolower($type1[0]);
- $t1 = strtolower($type1[1]);
+ $m1= strtolower($type1[0]);
+ $t1= strtolower($type1[1]);
} else {
- $m1 = '';
$t1 = strtolower($type1[0]);
}
+ $m2 = '';
+ $t2 = '';
+
if (count($type2) > 1) {
$m2 = strtolower($type2[0]);
$t2 = strtolower($type2[1]);
} else {
- $m2 = '';
$t2 = strtolower($type2[0]);
}
@@ -2219,13 +1514,13 @@ class Compiler
/**
* Compile import; returns true if the value was something that could be imported
*
- * @param array $rawPath
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $out
- * @param boolean $once
+ * @param array $rawPath
+ * @param array $out
+ * @param boolean $once
*
* @return boolean
*/
- protected function compileImport($rawPath, OutputBlock $out, $once = false)
+ protected function compileImport($rawPath, $out, $once = false)
{
if ($rawPath[0] === Type::T_STRING) {
$path = $this->compileStringContent($rawPath);
@@ -2239,8 +1534,6 @@ class Compiler
return true;
}
- $this->appendRootDirective('@import ' . $this->compileValue($rawPath). ';', $out);
-
return false;
}
@@ -2252,155 +1545,57 @@ class Compiler
foreach ($rawPath[2] as $path) {
if ($path[0] !== Type::T_STRING) {
- $this->appendRootDirective('@import ' . $this->compileValue($rawPath) . ';', $out);
-
return false;
}
}
foreach ($rawPath[2] as $path) {
- $this->compileImport($path, $out, $once);
+ $this->compileImport($path, $out);
}
return true;
}
- $this->appendRootDirective('@import ' . $this->compileValue($rawPath) . ';', $out);
-
return false;
}
-
- /**
- * Append a root directive like @import or @charset as near as the possible from the source code
- * (keeping before comments, @import and @charset coming before in the source code)
- *
- * @param string $line
- * @param @param \ScssPhp\ScssPhp\Formatter\OutputBlock $out
- * @param array $allowed
- */
- protected function appendRootDirective($line, $out, $allowed = [Type::T_COMMENT])
- {
- $root = $out;
-
- while ($root->parent) {
- $root = $root->parent;
- }
-
- $i = 0;
-
- while ($i < count($root->children)) {
- if (! isset($root->children[$i]->type) || ! in_array($root->children[$i]->type, $allowed)) {
- break;
- }
-
- $i++;
- }
-
- // remove incompatible children from the bottom of the list
- $saveChildren = [];
-
- while ($i < count($root->children)) {
- $saveChildren[] = array_pop($root->children);
- }
-
- // insert the directive as a comment
- $child = $this->makeOutputBlock(Type::T_COMMENT);
- $child->lines[] = $line;
- $child->sourceName = $this->sourceNames[$this->sourceIndex];
- $child->sourceLine = $this->sourceLine;
- $child->sourceColumn = $this->sourceColumn;
-
- $root->children[] = $child;
-
- // repush children
- while (count($saveChildren)) {
- $root->children[] = array_pop($saveChildren);
- }
- }
-
- /**
- * Append lines to the current output block:
- * directly to the block or through a child if necessary
- *
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $out
- * @param string $type
- * @param string|mixed $line
- */
- protected function appendOutputLine(OutputBlock $out, $type, $line)
- {
- $outWrite = &$out;
-
- if ($type === Type::T_COMMENT) {
- $parent = $out->parent;
-
- if (end($parent->children) !== $out) {
- $outWrite = &$parent->children[count($parent->children) - 1];
- }
- }
-
- // check if it's a flat output or not
- if (count($out->children)) {
- $lastChild = &$out->children[count($out->children) - 1];
-
- if ($lastChild->depth === $out->depth && is_null($lastChild->selectors) && ! count($lastChild->children)) {
- $outWrite = $lastChild;
- } else {
- $nextLines = $this->makeOutputBlock($type);
- $nextLines->parent = $out;
- $nextLines->depth = $out->depth;
-
- $out->children[] = $nextLines;
- $outWrite = &$nextLines;
- }
- }
-
- $outWrite->lines[] = $line;
- }
-
/**
* Compile child; returns a value to halt execution
*
- * @param array $child
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $out
+ * @param array $child
+ * @param \Leafo\ScssPhp\Formatter\OutputBlock $out
*
* @return array
*/
protected function compileChild($child, OutputBlock $out)
{
- if (isset($child[Parser::SOURCE_LINE])) {
- $this->sourceIndex = isset($child[Parser::SOURCE_INDEX]) ? $child[Parser::SOURCE_INDEX] : null;
- $this->sourceLine = isset($child[Parser::SOURCE_LINE]) ? $child[Parser::SOURCE_LINE] : -1;
- $this->sourceColumn = isset($child[Parser::SOURCE_COLUMN]) ? $child[Parser::SOURCE_COLUMN] : -1;
- } elseif (is_array($child) && isset($child[1]->sourceLine)) {
- $this->sourceIndex = $child[1]->sourceIndex;
- $this->sourceLine = $child[1]->sourceLine;
- $this->sourceColumn = $child[1]->sourceColumn;
- } elseif (! empty($out->sourceLine) && ! empty($out->sourceName)) {
- $this->sourceLine = $out->sourceLine;
- $this->sourceIndex = array_search($out->sourceName, $this->sourceNames);
- $this->sourceColumn = $out->sourceColumn;
-
- if ($this->sourceIndex === false) {
- $this->sourceIndex = null;
- }
- }
+ $this->sourceIndex = isset($child[Parser::SOURCE_INDEX]) ? $child[Parser::SOURCE_INDEX] : null;
+ $this->sourceLine = isset($child[Parser::SOURCE_LINE]) ? $child[Parser::SOURCE_LINE] : -1;
+ $this->sourceColumn = isset($child[Parser::SOURCE_COLUMN]) ? $child[Parser::SOURCE_COLUMN] : -1;
switch ($child[0]) {
case Type::T_SCSSPHP_IMPORT_ONCE:
- $rawPath = $this->reduce($child[1]);
+ list(, $rawPath) = $child;
- $this->compileImport($rawPath, $out, true);
+ $rawPath = $this->reduce($rawPath);
+
+ if (! $this->compileImport($rawPath, $out, true)) {
+ $out->lines[] = '@import ' . $this->compileValue($rawPath) . ';';
+ }
break;
case Type::T_IMPORT:
- $rawPath = $this->reduce($child[1]);
+ list(, $rawPath) = $child;
- $this->compileImport($rawPath, $out);
+ $rawPath = $this->reduce($rawPath);
+
+ if (! $this->compileImport($rawPath, $out)) {
+ $out->lines[] = '@import ' . $this->compileValue($rawPath) . ';';
+ }
break;
case Type::T_DIRECTIVE:
- $this->compileDirective($child[1], $out);
+ $this->compileDirective($child[1]);
break;
case Type::T_AT_ROOT:
@@ -2418,7 +1613,8 @@ class Compiler
case Type::T_CHARSET:
if (! $this->charsetSeen) {
$this->charsetSeen = true;
- $this->appendRootDirective('@charset ' . $this->compileValue($child[1]) . ';', $out);
+
+ $out->lines[] = '@charset ' . $this->compileValue($child[1]) . ';';
}
break;
@@ -2426,98 +1622,35 @@ class Compiler
list(, $name, $value) = $child;
if ($name[0] === Type::T_VARIABLE) {
- $flags = isset($child[3]) ? $child[3] : [];
+ $flags = isset($child[3]) ? $child[3] : [];
$isDefault = in_array('!default', $flags);
- $isGlobal = in_array('!global', $flags);
+ $isGlobal = in_array('!global', $flags);
if ($isGlobal) {
- $this->set($name[1], $this->reduce($value), false, $this->rootEnv, $value);
+ $this->set($name[1], $this->reduce($value), false, $this->rootEnv);
break;
}
$shouldSet = $isDefault &&
- (is_null($result = $this->get($name[1], false)) ||
- $result === static::$null);
+ (($result = $this->get($name[1], false)) === null
+ || $result === static::$null);
if (! $isDefault || $shouldSet) {
- $this->set($name[1], $this->reduce($value), true, null, $value);
+ $this->set($name[1], $this->reduce($value));
}
break;
}
$compiledName = $this->compileValue($name);
- // handle shorthand syntaxes : size / line-height...
- if (in_array($compiledName, ['font', 'grid-row', 'grid-column', 'border-radius'])) {
- if ($value[0] === Type::T_VARIABLE) {
- // if the font value comes from variable, the content is already reduced
- // (i.e., formulas were already calculated), so we need the original unreduced value
- $value = $this->get($value[1], true, null, true);
- }
-
- $shorthandValue=&$value;
-
- $shorthandDividerNeedsUnit = false;
- $maxListElements = null;
- $maxShorthandDividers = 1;
-
- switch ($compiledName) {
- case 'border-radius':
- $maxListElements = 4;
- $shorthandDividerNeedsUnit = true;
- break;
- }
-
- if ($compiledName === 'font' and $value[0] === Type::T_LIST && $value[1]==',') {
- // this is the case if more than one font is given: example: "font: 400 1em/1.3 arial,helvetica"
- // we need to handle the first list element
- $shorthandValue=&$value[2][0];
- }
-
- if ($shorthandValue[0] === Type::T_EXPRESSION && $shorthandValue[1] === '/') {
- $revert = true;
-
- if ($shorthandDividerNeedsUnit) {
- $divider = $shorthandValue[3];
-
- if (is_array($divider)) {
- $divider = $this->reduce($divider, true);
- }
-
- if (intval($divider->dimension) and !count($divider->units)) {
- $revert = false;
- }
- }
-
- if ($revert) {
- $shorthandValue = $this->expToString($shorthandValue);
- }
- } elseif ($shorthandValue[0] === Type::T_LIST) {
- foreach ($shorthandValue[2] as &$item) {
+ // handle shorthand syntax: size / line-height
+ if ($compiledName === 'font') {
+ if ($value[0] === Type::T_EXPRESSION && $value[1] === '/') {
+ $value = $this->expToString($value);
+ } elseif ($value[0] === Type::T_LIST) {
+ foreach ($value[2] as &$item) {
if ($item[0] === Type::T_EXPRESSION && $item[1] === '/') {
- if ($maxShorthandDividers > 0) {
- $revert = true;
- // if the list of values is too long, this has to be a shorthand,
- // otherwise it could be a real division
- if (is_null($maxListElements) or count($shorthandValue[2]) <= $maxListElements) {
- if ($shorthandDividerNeedsUnit) {
- $divider = $item[3];
-
- if (is_array($divider)) {
- $divider = $this->reduce($divider, true);
- }
-
- if (intval($divider->dimension) and !count($divider->units)) {
- $revert = false;
- }
- }
- }
-
- if ($revert) {
- $item = $this->expToString($item);
- $maxShorthandDividers--;
- }
- }
+ $item = $this->expToString($item);
}
}
}
@@ -2535,11 +1668,10 @@ class Compiler
$compiledValue = $this->compileValue($value);
- $line = $this->formatter->property(
+ $out->lines[] = $this->formatter->property(
$compiledName,
$compiledValue
);
- $this->appendOutputLine($out, Type::T_ASSIGN, $line);
break;
case Type::T_COMMENT:
@@ -2548,32 +1680,27 @@ class Compiler
break;
}
- $line = $this->compileCommentValue($child, true);
- $this->appendOutputLine($out, Type::T_COMMENT, $line);
+ $out->lines[] = $child[1];
break;
case Type::T_MIXIN:
case Type::T_FUNCTION:
list(, $block) = $child;
- // the block need to be able to go up to it's parent env to resolve vars
- $block->parentEnv = $this->getStoreEnv();
- $this->set(static::$namespaces[$block->type] . $block->name, $block, true);
+
+ $this->set(static::$namespaces[$block->type] . $block->name, $block);
break;
case Type::T_EXTEND:
- foreach ($child[1] as $sel) {
+ list(, $selectors) = $child;
+
+ foreach ($selectors as $sel) {
$results = $this->evalSelectors([$sel]);
foreach ($results as $result) {
// only use the first one
$result = current($result);
- $selectors = $out->selectors;
- if (! $selectors && isset($child['selfParent'])) {
- $selectors = $this->multiplySelectors($this->env, $child['selfParent']);
- }
-
- $this->pushExtends($result, $selectors, $child);
+ $this->pushExtends($result, $out->selectors, $child);
}
}
break;
@@ -2700,12 +1827,31 @@ class Compiler
return $this->reduce($child[1], true);
case Type::T_NESTED_PROPERTY:
- $this->compileNestedPropertiesBlock($child[1], $out);
+ list(, $prop) = $child;
+
+ $prefixed = [];
+ $prefix = $this->compileValue($prop->prefix) . '-';
+
+ foreach ($prop->children as $child) {
+ switch ($child[0]) {
+ case Type::T_ASSIGN:
+ array_unshift($child[1][2], $prefix);
+ break;
+
+ case Type::T_NESTED_PROPERTY:
+ array_unshift($child[1]->prefix[2], $prefix);
+ break;
+ }
+
+ $prefixed[] = $child;
+ }
+
+ $this->compileChildrenNoReturn($prefixed, $out);
break;
case Type::T_INCLUDE:
// including a mixin
- list(, $name, $argValues, $content, $argUsing) = $child;
+ list(, $name, $argValues, $content) = $child;
$mixin = $this->get(static::$namespaces['mixin'] . $name, false);
@@ -2723,43 +1869,10 @@ class Compiler
$storeEnv = $this->storeEnv;
$this->storeEnv = $this->env;
- // Find the parent selectors in the env to be able to know what '&' refers to in the mixin
- // and assign this fake parent to childs
- $selfParent = null;
-
- if (isset($child['selfParent']) && isset($child['selfParent']->selectors)) {
- $selfParent = $child['selfParent'];
- } else {
- $parentSelectors = $this->multiplySelectors($this->env);
-
- if ($parentSelectors) {
- $parent = new Block();
- $parent->selectors = $parentSelectors;
-
- foreach ($mixin->children as $k => $child) {
- if (isset($child[1]) && is_object($child[1]) && $child[1] instanceof Block) {
- $mixin->children[$k][1]->parent = $parent;
- }
- }
- }
- }
-
- // clone the stored content to not have its scope spoiled by a further call to the same mixin
- // i.e., recursive @include of the same mixin
if (isset($content)) {
- $copyContent = clone $content;
- $copyContent->scope = clone $callingScope;
+ $content->scope = $callingScope;
- $this->setRaw(static::$namespaces['special'] . 'content', $copyContent, $this->env);
- } else {
- $this->setRaw(static::$namespaces['special'] . 'content', null, $this->env);
- }
-
- // save the "using" argument list for applying it to when "@content" is invoked
- if (isset($argUsing)) {
- $this->setRaw(static::$namespaces['special'] . 'using', $argUsing, $this->env);
- } else {
- $this->setRaw(static::$namespaces['special'] . 'using', null, $this->env);
+ $this->setRaw(static::$namespaces['special'] . 'content', $content, $this->env);
}
if (isset($mixin->args)) {
@@ -2768,13 +1881,7 @@ class Compiler
$this->env->marker = 'mixin';
- if (! empty($mixin->parentEnv)) {
- $this->env->declarationScopeParent = $mixin->parentEnv;
- } else {
- $this->throwError("@mixin $name() without parentEnv");
- }
-
- $this->compileChildrenNoReturn($mixin->children, $out, $selfParent, $this->env->marker . " " . $name);
+ $this->compileChildrenNoReturn($mixin->children, $out);
$this->storeEnv = $storeEnv;
@@ -2782,35 +1889,19 @@ class Compiler
break;
case Type::T_MIXIN_CONTENT:
- $env = isset($this->storeEnv) ? $this->storeEnv : $this->env;
- $content = $this->get(static::$namespaces['special'] . 'content', false, $env);
- $argUsing = $this->get(static::$namespaces['special'] . 'using', false, $env);
- $argContent = $child[1];
+ $content = $this->get(static::$namespaces['special'] . 'content', false, $this->getStoreEnv())
+ ?: $this->get(static::$namespaces['special'] . 'content', false, $this->env);
if (! $content) {
$content = new \stdClass();
- $content->scope = new \stdClass();
- $content->children = $env->parent->block->children;
+ $content->scope = new \stdClass();
+ $content->children = $this->storeEnv->parent->block->children;
break;
}
$storeEnv = $this->storeEnv;
- $varsUsing = [];
-
- if (isset($argUsing) && isset($argContent)) {
- // Get the arguments provided for the content with the names provided in the "using" argument list
- $this->storeEnv = $this->env;
- $varsUsing = $this->applyArguments($argUsing, $argContent, false);
- }
-
- // restore the scope from the @content
$this->storeEnv = $content->scope;
- // append the vars from using if any
- foreach ($varsUsing as $name => $val) {
- $this->set($name, $val, true, $this->storeEnv);
- }
-
$this->compileChildrenNoReturn($content->children, $out);
$this->storeEnv = $storeEnv;
@@ -2819,31 +1910,25 @@ class Compiler
case Type::T_DEBUG:
list(, $value) = $child;
- $fname = $this->sourceNames[$this->sourceIndex];
- $line = $this->sourceLine;
+ $line = $this->sourceLine;
$value = $this->compileValue($this->reduce($value, true));
-
- fwrite($this->stderr, "File $fname on line $line DEBUG: $value\n");
+ fwrite($this->stderr, "Line $line DEBUG: $value\n");
break;
case Type::T_WARN:
list(, $value) = $child;
- $fname = $this->sourceNames[$this->sourceIndex];
- $line = $this->sourceLine;
+ $line = $this->sourceLine;
$value = $this->compileValue($this->reduce($value, true));
-
- fwrite($this->stderr, "File $fname on line $line WARN: $value\n");
+ fwrite($this->stderr, "Line $line WARN: $value\n");
break;
case Type::T_ERROR:
list(, $value) = $child;
- $fname = $this->sourceNames[$this->sourceIndex];
- $line = $this->sourceLine;
+ $line = $this->sourceLine;
$value = $this->compileValue($this->reduce($value, true));
-
- $this->throwError("File $fname on line $line ERROR: $value\n");
+ $this->throwError("Line $line ERROR: $value\n");
break;
case Type::T_CONTROL:
@@ -2888,7 +1973,7 @@ class Compiler
*
* @param array $value
*
- * @return boolean
+ * @return array
*/
protected function isTruthy($value)
{
@@ -2919,7 +2004,7 @@ class Compiler
switch ($value[0]) {
case Type::T_EXPRESSION:
if ($value[1] === '/') {
- return $this->shouldEval($value[2]) || $this->shouldEval($value[3]);
+ return $this->shouldEval($value[2], $value[3]);
}
// fall-thru
@@ -2937,15 +2022,13 @@ class Compiler
* @param array $value
* @param boolean $inExp
*
- * @return null|string|array|\ScssPhp\ScssPhp\Node\Number
+ * @return array|\Leafo\ScssPhp\Node\Number
*/
protected function reduce($value, $inExp = false)
{
- if (is_null($value)) {
- return null;
- }
+ list($type) = $value;
- switch ($value[0]) {
+ switch ($type) {
case Type::T_EXPRESSION:
list(, $op, $left, $right, $inParens) = $value;
@@ -2959,15 +2042,16 @@ class Compiler
}
// special case: looks like css shorthand
- if ($opName == 'div' && ! $inParens && ! $inExp && isset($right[2]) &&
- (($right[0] !== Type::T_NUMBER && $right[2] != '') ||
- ($right[0] === Type::T_NUMBER && ! $right->unitless()))
+ if ($opName == 'div' && ! $inParens && ! $inExp && isset($right[2])
+ && (($right[0] !== Type::T_NUMBER && $right[2] != '')
+ || ($right[0] === Type::T_NUMBER && ! $right->unitless()))
) {
return $this->expToString($value);
}
- $left = $this->coerceForExpression($left);
+ $left = $this->coerceForExpression($left);
$right = $this->coerceForExpression($right);
+
$ltype = $left[0];
$rtype = $right[0];
@@ -3077,7 +2161,9 @@ class Compiler
return [Type::T_STRING, '', [$op, $exp]];
case Type::T_VARIABLE:
- return $this->reduce($this->get($value[1]));
+ list(, $name) = $value;
+
+ return $this->reduce($this->get($name));
case Type::T_LIST:
foreach ($value[2] as &$item) {
@@ -3109,20 +2195,12 @@ class Compiler
case Type::T_INTERPOLATE:
$value[1] = $this->reduce($value[1]);
- if ($inExp) {
- return $value[1];
- }
-
return $value;
case Type::T_FUNCTION_CALL:
- return $this->fncall($value[1], $value[2]);
+ list(, $name, $argValues) = $value;
- case Type::T_SELF:
- $selfSelector = $this->multiplySelectors($this->env);
- $selfSelector = $this->collapseSelectors($selfSelector, true);
-
- return $selfSelector;
+ return $this->fncall($name, $argValues);
default:
return $value;
@@ -3137,7 +2215,7 @@ class Compiler
*
* @return array|null
*/
- protected function fncall($name, $argValues)
+ private function fncall($name, $argValues)
{
// SCSS @function
if ($this->callScssFunction($name, $argValues, $returnValue)) {
@@ -3183,8 +2261,9 @@ class Compiler
public function normalizeValue($value)
{
$value = $this->coerceForExpression($this->reduce($value));
+ list($type) = $value;
- switch ($value[0]) {
+ switch ($type) {
case Type::T_LIST:
$value = $this->extractInterpolation($value);
@@ -3196,14 +2275,10 @@ class Compiler
$value[2][$key] = $this->normalizeValue($item);
}
- if (! empty($value['enclosing'])) {
- unset($value['enclosing']);
- }
-
return $value;
case Type::T_STRING:
- return [$value[0], '"', [$this->compileStringContent($value)]];
+ return [$type, '"', [$this->compileStringContent($value)]];
case Type::T_NUMBER:
return $value->normalize();
@@ -3222,7 +2297,7 @@ class Compiler
* @param array $left
* @param array $right
*
- * @return \ScssPhp\ScssPhp\Node\Number
+ * @return \Leafo\ScssPhp\Node\Number
*/
protected function opAddNumberNumber($left, $right)
{
@@ -3235,7 +2310,7 @@ class Compiler
* @param array $left
* @param array $right
*
- * @return \ScssPhp\ScssPhp\Node\Number
+ * @return \Leafo\ScssPhp\Node\Number
*/
protected function opMulNumberNumber($left, $right)
{
@@ -3248,7 +2323,7 @@ class Compiler
* @param array $left
* @param array $right
*
- * @return \ScssPhp\ScssPhp\Node\Number
+ * @return \Leafo\ScssPhp\Node\Number
*/
protected function opSubNumberNumber($left, $right)
{
@@ -3261,7 +2336,7 @@ class Compiler
* @param array $left
* @param array $right
*
- * @return array|\ScssPhp\ScssPhp\Node\Number
+ * @return array|\Leafo\ScssPhp\Node\Number
*/
protected function opDivNumberNumber($left, $right)
{
@@ -3278,7 +2353,7 @@ class Compiler
* @param array $left
* @param array $right
*
- * @return \ScssPhp\ScssPhp\Node\Number
+ * @return \Leafo\ScssPhp\Node\Number
*/
protected function opModNumberNumber($left, $right)
{
@@ -3291,7 +2366,7 @@ class Compiler
* @param array $left
* @param array $right
*
- * @return array|null
+ * @return array
*/
protected function opAdd($left, $right)
{
@@ -3314,8 +2389,6 @@ class Compiler
return $strRight;
}
-
- return null;
}
/**
@@ -3325,21 +2398,15 @@ class Compiler
* @param array $right
* @param boolean $shouldEval
*
- * @return array|null
+ * @return array
*/
protected function opAnd($left, $right, $shouldEval)
{
- $truthy = ($left === static::$null || $right === static::$null) ||
- ($left === static::$false || $left === static::$true) &&
- ($right === static::$false || $right === static::$true);
-
if (! $shouldEval) {
- if (! $truthy) {
- return null;
- }
+ return;
}
- if ($left !== static::$false && $left !== static::$null) {
+ if ($left !== static::$false and $left !== static::$null) {
return $this->reduce($right, true);
}
@@ -3353,21 +2420,15 @@ class Compiler
* @param array $right
* @param boolean $shouldEval
*
- * @return array|null
+ * @return array
*/
protected function opOr($left, $right, $shouldEval)
{
- $truthy = ($left === static::$null || $right === static::$null) ||
- ($left === static::$false || $left === static::$true) &&
- ($right === static::$false || $right === static::$true);
-
if (! $shouldEval) {
- if (! $truthy) {
- return null;
- }
+ return;
}
- if ($left !== static::$false && $left !== static::$null) {
+ if ($left !== static::$false and $left !== static::$null) {
return $left;
}
@@ -3578,7 +2639,7 @@ class Compiler
* @param array $left
* @param array $right
*
- * @return \ScssPhp\ScssPhp\Node\Number
+ * @return \Leafo\ScssPhp\Node\Number
*/
protected function opCmpNumberNumber($left, $right)
{
@@ -3616,13 +2677,15 @@ class Compiler
*
* @param array $value
*
- * @return string|array
+ * @return string
*/
public function compileValue($value)
{
$value = $this->reduce($value);
- switch ($value[0]) {
+ list($type) = $value;
+
+ switch ($type) {
case Type::T_KEYWORD:
return $value[1];
@@ -3633,38 +2696,14 @@ class Compiler
// [4] - optional alpha component
list(, $r, $g, $b) = $value;
- $r = $this->compileRGBAValue($r);
- $g = $this->compileRGBAValue($g);
- $b = $this->compileRGBAValue($b);
+ $r = round($r);
+ $g = round($g);
+ $b = round($b);
- if (count($value) === 5) {
- $alpha = $this->compileRGBAValue($value[4], true);
+ if (count($value) === 5 && $value[4] !== 1) { // rgba
+ $a = new Node\Number($value[4], '');
- if (! is_numeric($alpha) || $alpha < 1) {
- $colorName = Colors::RGBaToColorName($r, $g, $b, $alpha);
-
- if (! is_null($colorName)) {
- return $colorName;
- }
-
- if (is_numeric($alpha)) {
- $a = new Node\Number($alpha, '');
- } else {
- $a = $alpha;
- }
-
- return 'rgba(' . $r . ', ' . $g . ', ' . $b . ', ' . $a . ')';
- }
- }
-
- if (! is_numeric($r) || ! is_numeric($g) || ! is_numeric($b)) {
- return 'rgb(' . $r . ', ' . $g . ', ' . $b . ')';
- }
-
- $colorName = Colors::RGBaToColorName($r, $g, $b);
-
- if (! is_null($colorName)) {
- return $colorName;
+ return 'rgba(' . $r . ', ' . $g . ', ' . $b . ', ' . $a . ')';
}
$h = sprintf('#%02x%02x%02x', $r, $g, $b);
@@ -3695,28 +2734,9 @@ class Compiler
}
list(, $delim, $items) = $value;
- $pre = $post = "";
- if (! empty($value['enclosing'])) {
- switch ($value['enclosing']) {
- case 'parent':
- //$pre = "(";
- //$post = ")";
- break;
- case 'forced_parent':
- $pre = "(";
- $post = ")";
- break;
- case 'bracket':
- case 'forced_bracket':
- $pre = "[";
- $post = "]";
- break;
- }
- }
- $prefix_value = '';
if ($delim !== ' ') {
- $prefix_value = ' ';
+ $delim .= ' ';
}
$filtered = [];
@@ -3726,18 +2746,14 @@ class Compiler
continue;
}
- $compiled = $this->compileValue($item);
- if ($prefix_value && strlen($compiled)) {
- $compiled = $prefix_value . $compiled;
- }
- $filtered[] = $compiled;
+ $filtered[] = $this->compileValue($item);
}
- return $pre . substr(implode("$delim", $filtered), strlen($prefix_value)) . $post;
+ return implode("$delim", $filtered);
case Type::T_MAP:
- $keys = $value[1];
- $values = $value[2];
+ $keys = $value[1];
+ $values = $value[2];
$filtered = [];
for ($i = 0, $s = count($keys); $i < $s; $i++) {
@@ -3755,29 +2771,20 @@ class Compiler
list(, $interpolate, $left, $right) = $value;
list(,, $whiteLeft, $whiteRight) = $interpolate;
- $delim = $left[1];
-
- if ($delim && $delim !== ' ' && ! $whiteLeft) {
- $delim .= ' ';
- }
-
$left = count($left[2]) > 0 ?
- $this->compileValue($left) . $delim . $whiteLeft: '';
-
- $delim = $right[1];
-
- if ($delim && $delim !== ' ') {
- $delim .= ' ';
- }
+ $this->compileValue($left) . $whiteLeft : '';
$right = count($right[2]) > 0 ?
- $whiteRight . $delim . $this->compileValue($right) : '';
+ $whiteRight . $this->compileValue($right) : '';
return $left . $this->compileValue($interpolate) . $right;
case Type::T_INTERPOLATE:
+ // raw parse node
+ list(, $exp) = $value;
+
// strip quotes if it's a string
- $reduced = $this->reduce($value[1]);
+ $reduced = $this->reduce($exp);
switch ($reduced[0]) {
case Type::T_LIST:
@@ -3801,7 +2808,6 @@ class Compiler
}
$temp = $this->compileValue([Type::T_KEYWORD, $item]);
-
if ($temp[0] === Type::T_STRING) {
$filtered[] = $this->compileStringContent($temp);
} elseif ($temp[0] === Type::T_KEYWORD) {
@@ -3827,11 +2833,8 @@ class Compiler
case Type::T_NULL:
return 'null';
- case Type::T_COMMENT:
- return $this->compileCommentValue($value);
-
default:
- $this->throwError("unknown value type: ".json_encode($value));
+ $this->throwError("unknown value type: $type");
}
}
@@ -3895,70 +2898,44 @@ class Compiler
/**
* Find the final set of selectors
*
- * @param \ScssPhp\ScssPhp\Compiler\Environment $env
- * @param \ScssPhp\ScssPhp\Block $selfParent
+ * @param \Leafo\ScssPhp\Compiler\Environment $env
*
* @return array
*/
- protected function multiplySelectors(Environment $env, $selfParent = null)
+ protected function multiplySelectors(Environment $env)
{
$envs = $this->compactEnv($env);
$selectors = [];
$parentSelectors = [[]];
- $selfParentSelectors = null;
-
- if (! is_null($selfParent) && $selfParent->selectors) {
- $selfParentSelectors = $this->evalSelectors($selfParent->selectors);
- }
-
while ($env = array_pop($envs)) {
if (empty($env->selectors)) {
continue;
}
- $selectors = $env->selectors;
+ $selectors = [];
- do {
- $stillHasSelf = false;
- $prevSelectors = $selectors;
- $selectors = [];
-
- foreach ($prevSelectors as $selector) {
- foreach ($parentSelectors as $parent) {
- if ($selfParentSelectors) {
- foreach ($selfParentSelectors as $selfParent) {
- // if no '&' in the selector, each call will give same result, only add once
- $s = $this->joinSelectors($parent, $selector, $stillHasSelf, $selfParent);
- $selectors[serialize($s)] = $s;
- }
- } else {
- $s = $this->joinSelectors($parent, $selector, $stillHasSelf);
- $selectors[serialize($s)] = $s;
- }
- }
+ foreach ($env->selectors as $selector) {
+ foreach ($parentSelectors as $parent) {
+ $selectors[] = $this->joinSelectors($parent, $selector);
}
- } while ($stillHasSelf);
+ }
$parentSelectors = $selectors;
}
- $selectors = array_values($selectors);
-
return $selectors;
}
/**
* Join selectors; looks for & to replace, or append parent before child
*
- * @param array $parent
- * @param array $child
- * @param boolean &$stillHasSelf
- * @param array $selfParentSelectors
-
+ * @param array $parent
+ * @param array $child
+ *
* @return array
*/
- protected function joinSelectors($parent, $child, &$stillHasSelf, $selfParentSelectors = null)
+ protected function joinSelectors($parent, $child)
{
$setSelf = false;
$out = [];
@@ -3967,35 +2944,16 @@ class Compiler
$newPart = [];
foreach ($part as $p) {
- // only replace & once and should be recalled to be able to make combinations
- if ($p === static::$selfSelector && $setSelf) {
- $stillHasSelf = true;
- }
-
- if ($p === static::$selfSelector && ! $setSelf) {
+ if ($p === static::$selfSelector) {
$setSelf = true;
- if (is_null($selfParentSelectors)) {
- $selfParentSelectors = $parent;
- }
-
- foreach ($selfParentSelectors as $i => $parentPart) {
+ foreach ($parent as $i => $parentPart) {
if ($i > 0) {
$out[] = $newPart;
$newPart = [];
}
foreach ($parentPart as $pp) {
- if (is_array($pp)) {
- $flatten = [];
-
- array_walk_recursive($pp, function ($a) use (&$flatten) {
- $flatten[] = $a;
- });
-
- $pp = implode($flatten);
- }
-
$newPart[] = $pp;
}
}
@@ -4013,8 +2971,8 @@ class Compiler
/**
* Multiply media
*
- * @param \ScssPhp\ScssPhp\Compiler\Environment $env
- * @param array $childQueries
+ * @param \Leafo\ScssPhp\Compiler\Environment $env
+ * @param array $childQueries
*
* @return array
*/
@@ -4035,15 +2993,7 @@ class Compiler
? $env->block->queryList
: [[[Type::T_MEDIA_VALUE, $env->block->value]]];
- $store = [$this->env, $this->storeEnv];
-
- $this->env = $env;
- $this->storeEnv = null;
- $parentQueries = $this->evaluateMediaQuery($parentQueries);
-
- list($this->env, $this->storeEnv) = $store;
-
- if (is_null($childQueries)) {
+ if ($childQueries === null) {
$childQueries = $parentQueries;
} else {
$originalQueries = $childQueries;
@@ -4051,11 +3001,7 @@ class Compiler
foreach ($parentQueries as $parentQuery) {
foreach ($originalQueries as $childQuery) {
- $childQueries[] = array_merge(
- $parentQuery,
- [[Type::T_MEDIA_TYPE, [Type::T_KEYWORD, 'all']]],
- $childQuery
- );
+ $childQueries []= array_merge($parentQuery, $childQuery);
}
}
}
@@ -4066,11 +3012,11 @@ class Compiler
/**
* Convert env linked list to stack
*
- * @param \ScssPhp\ScssPhp\Compiler\Environment $env
+ * @param \Leafo\ScssPhp\Compiler\Environment $env
*
* @return array
*/
- protected function compactEnv(Environment $env)
+ private function compactEnv(Environment $env)
{
for ($envs = []; $env; $env = $env->parent) {
$envs[] = $env;
@@ -4084,9 +3030,9 @@ class Compiler
*
* @param array $envs
*
- * @return \ScssPhp\ScssPhp\Compiler\Environment
+ * @return \Leafo\ScssPhp\Compiler\Environment
*/
- protected function extractEnv($envs)
+ private function extractEnv($envs)
{
for ($env = null; $e = array_pop($envs);) {
$e->parent = $env;
@@ -4099,9 +3045,9 @@ class Compiler
/**
* Push environment
*
- * @param \ScssPhp\ScssPhp\Block $block
+ * @param \Leafo\ScssPhp\Block $block
*
- * @return \ScssPhp\ScssPhp\Compiler\Environment
+ * @return \Leafo\ScssPhp\Compiler\Environment
*/
protected function pushEnv(Block $block = null)
{
@@ -4127,7 +3073,7 @@ class Compiler
/**
* Get store environment
*
- * @return \ScssPhp\ScssPhp\Compiler\Environment
+ * @return \Leafo\ScssPhp\Compiler\Environment
*/
protected function getStoreEnv()
{
@@ -4137,13 +3083,12 @@ class Compiler
/**
* Set variable
*
- * @param string $name
- * @param mixed $value
- * @param boolean $shadow
- * @param \ScssPhp\ScssPhp\Compiler\Environment $env
- * @param mixed $valueUnreduced
+ * @param string $name
+ * @param mixed $value
+ * @param boolean $shadow
+ * @param \Leafo\ScssPhp\Compiler\Environment $env
*/
- protected function set($name, $value, $shadow = false, Environment $env = null, $valueUnreduced = null)
+ protected function set($name, $value, $shadow = false, Environment $env = null)
{
$name = $this->normalizeName($name);
@@ -4152,21 +3097,20 @@ class Compiler
}
if ($shadow) {
- $this->setRaw($name, $value, $env, $valueUnreduced);
+ $this->setRaw($name, $value, $env);
} else {
- $this->setExisting($name, $value, $env, $valueUnreduced);
+ $this->setExisting($name, $value, $env);
}
}
/**
* Set existing variable
*
- * @param string $name
- * @param mixed $value
- * @param \ScssPhp\ScssPhp\Compiler\Environment $env
- * @param mixed $valueUnreduced
+ * @param string $name
+ * @param mixed $value
+ * @param \Leafo\ScssPhp\Compiler\Environment $env
*/
- protected function setExisting($name, $value, Environment $env, $valueUnreduced = null)
+ protected function setExisting($name, $value, Environment $env)
{
$storeEnv = $env;
@@ -4191,27 +3135,18 @@ class Compiler
}
$env->store[$name] = $value;
-
- if ($valueUnreduced) {
- $env->storeUnreduced[$name] = $valueUnreduced;
- }
}
/**
* Set raw variable
*
- * @param string $name
- * @param mixed $value
- * @param \ScssPhp\ScssPhp\Compiler\Environment $env
- * @param mixed $valueUnreduced
+ * @param string $name
+ * @param mixed $value
+ * @param \Leafo\ScssPhp\Compiler\Environment $env
*/
- protected function setRaw($name, $value, Environment $env, $valueUnreduced = null)
+ protected function setRaw($name, $value, Environment $env)
{
$env->store[$name] = $value;
-
- if ($valueUnreduced) {
- $env->storeUnreduced[$name] = $valueUnreduced;
- }
}
/**
@@ -4219,14 +3154,13 @@ class Compiler
*
* @api
*
- * @param string $name
- * @param boolean $shouldThrow
- * @param \ScssPhp\ScssPhp\Compiler\Environment $env
- * @param boolean $unreduced
+ * @param string $name
+ * @param boolean $shouldThrow
+ * @param \Leafo\ScssPhp\Compiler\Environment $env
*
- * @return mixed|null
+ * @return mixed
*/
- public function get($name, $shouldThrow = true, Environment $env = null, $unreduced = false)
+ public function get($name, $shouldThrow = true, Environment $env = null)
{
$normalizedName = $this->normalizeName($name);
$specialContentKey = static::$namespaces['special'] . 'content';
@@ -4235,34 +3169,22 @@ class Compiler
$env = $this->getStoreEnv();
}
+ $nextIsRoot = false;
$hasNamespace = $normalizedName[0] === '^' || $normalizedName[0] === '@' || $normalizedName[0] === '%';
- $maxDepth = 10000;
-
for (;;) {
- if ($maxDepth-- <= 0) {
- break;
- }
-
if (array_key_exists($normalizedName, $env->store)) {
- if ($unreduced && isset($env->storeUnreduced[$normalizedName])) {
- return $env->storeUnreduced[$normalizedName];
- }
-
return $env->store[$normalizedName];
}
if (! $hasNamespace && isset($env->marker)) {
- if (! empty($env->store[$specialContentKey])) {
+ if (! $nextIsRoot && ! empty($env->store[$specialContentKey])) {
$env = $env->store[$specialContentKey]->scope;
+ $nextIsRoot = true;
continue;
}
- if (! empty($env->declarationScopeParent)) {
- $env = $env->declarationScopeParent;
- } else {
- $env = $this->rootEnv;
- }
+ $env = $this->rootEnv;
continue;
}
@@ -4274,24 +3196,23 @@ class Compiler
}
if ($shouldThrow) {
- $this->throwError("Undefined variable \$$name" . ($maxDepth <= 0 ? " (infinite recursion)" : ""));
+ $this->throwError("Undefined variable \$$name");
}
// found nothing
- return null;
}
/**
* Has variable?
*
- * @param string $name
- * @param \ScssPhp\ScssPhp\Compiler\Environment $env
+ * @param string $name
+ * @param \Leafo\ScssPhp\Compiler\Environment $env
*
* @return boolean
*/
protected function has($name, Environment $env = null)
{
- return ! is_null($this->get($name, false, $env));
+ return $this->get($name, false, $env) !== null;
}
/**
@@ -4365,7 +3286,7 @@ class Compiler
*/
public function addParsedFile($path)
{
- if (isset($path) && is_file($path)) {
+ if (isset($path) && file_exists($path)) {
$this->parsedFiles[realpath($path)] = filemtime($path);
}
}
@@ -4387,7 +3308,7 @@ class Compiler
*
* @api
*
- * @param string|callable $path
+ * @param string $path
*/
public function addImportPath($path)
{
@@ -4509,10 +3430,10 @@ class Compiler
/**
* Import file
*
- * @param string $path
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $out
+ * @param string $path
+ * @param array $out
*/
- protected function importFile($path, OutputBlock $out)
+ protected function importFile($path, $out)
{
// see if tree is cached
$realPath = realpath($path);
@@ -4530,7 +3451,6 @@ class Compiler
}
$pi = pathinfo($path);
-
array_unshift($this->importPaths, $pi['dirname']);
$this->compileChildrenNoReturn($tree->children, $out);
array_shift($this->importPaths);
@@ -4550,9 +3470,9 @@ class Compiler
$urls = [];
// for "normal" scss imports (ignore vanilla css and external requests)
- if (! preg_match('~\.css$|^https?://~', $url)) {
+ if (! preg_match('/\.css$|^https?:\/\//', $url)) {
// try both normal and the _partial filename
- $urls = [$url, preg_replace('~[^/]+$~', '_\0', $url)];
+ $urls = [$url, preg_replace('/[^\/]+$/', '_\0', $url)];
}
$hasExtension = preg_match('/[.]s?css$/', $url);
@@ -4561,15 +3481,12 @@ class Compiler
if (is_string($dir)) {
// check urls for normal import paths
foreach ($urls as $full) {
- $separator = (
- ! empty($dir) &&
- substr($dir, -1) !== '/' &&
- substr($full, 0, 1) !== '/'
- ) ? '/' : '';
- $full = $dir . $separator . $full;
+ $full = $dir
+ . (! empty($dir) && substr($dir, -1) !== '/' ? '/' : '')
+ . $full;
- if (is_file($file = $full . '.scss') ||
- ($hasExtension && is_file($file = $full))
+ if ($this->fileExists($file = $full . '.scss') ||
+ ($hasExtension && $this->fileExists($file = $full))
) {
return $file;
}
@@ -4578,7 +3495,7 @@ class Compiler
// check custom callback for import path
$file = call_user_func($dir, $url);
- if (! is_null($file)) {
+ if ($file !== null) {
return $file;
}
}
@@ -4606,13 +3523,11 @@ class Compiler
*
* @param boolean $ignoreErrors
*
- * @return \ScssPhp\ScssPhp\Compiler
+ * @return \Leafo\ScssPhp\Compiler
*/
public function setIgnoreErrors($ignoreErrors)
{
$this->ignoreErrors = $ignoreErrors;
-
- return $this;
}
/**
@@ -4622,7 +3537,7 @@ class Compiler
*
* @param string $msg Message with optional sprintf()-style vararg parameters
*
- * @throws \ScssPhp\ScssPhp\Exception\CompilerException
+ * @throws \Leafo\ScssPhp\Exception\CompilerException
*/
public function throwError($msg)
{
@@ -4630,62 +3545,16 @@ class Compiler
return;
}
- $line = $this->sourceLine;
- $column = $this->sourceColumn;
-
- $loc = isset($this->sourceNames[$this->sourceIndex])
- ? $this->sourceNames[$this->sourceIndex] . " on line $line, at column $column"
- : "line: $line, column: $column";
-
if (func_num_args() > 1) {
$msg = call_user_func_array('sprintf', func_get_args());
}
- $msg = "$msg: $loc";
-
- $callStackMsg = $this->callStackMessage();
-
- if ($callStackMsg) {
- $msg .= "\nCall Stack:\n" . $callStackMsg;
- }
+ $line = $this->sourceLine;
+ $msg = "$msg: line: $line";
throw new CompilerException($msg);
}
- /**
- * Beautify call stack for output
- *
- * @param boolean $all
- * @param null $limit
- *
- * @return string
- */
- protected function callStackMessage($all = false, $limit = null)
- {
- $callStackMsg = [];
- $ncall = 0;
-
- if ($this->callStack) {
- foreach (array_reverse($this->callStack) as $call) {
- if ($all || (isset($call['n']) && $call['n'])) {
- $msg = "#" . $ncall++ . " " . $call['n'] . " ";
- $msg .= (isset($this->sourceNames[$call[Parser::SOURCE_INDEX]])
- ? $this->sourceNames[$call[Parser::SOURCE_INDEX]]
- : '(unknown file)');
- $msg .= " on line " . $call[Parser::SOURCE_LINE];
-
- $callStackMsg[] = $msg;
-
- if (! is_null($limit) && $ncall > $limit) {
- break;
- }
- }
- }
- }
-
- return implode("\n", $callStackMsg);
- }
-
/**
* Handle import loop
*
@@ -4696,10 +3565,6 @@ class Compiler
protected function handleImportLoop($name)
{
for ($env = $this->env; $env; $env = $env->parent) {
- if (! $env->block) {
- continue;
- }
-
$file = $this->sourceNames[$env->block->sourceIndex];
if (realpath($file) === $name) {
@@ -4709,6 +3574,18 @@ class Compiler
}
}
+ /**
+ * Does file exist?
+ *
+ * @param string $name
+ *
+ * @return boolean
+ */
+ protected function fileExists($name)
+ {
+ return file_exists($name) && is_file($name);
+ }
+
/**
* Call SCSS @function
*
@@ -4742,13 +3619,8 @@ class Compiler
$tmp->children = [];
$this->env->marker = 'function';
- if (! empty($func->parentEnv)) {
- $this->env->declarationScopeParent = $func->parentEnv;
- } else {
- $this->throwError("@function $name() without parentEnv");
- }
- $ret = $this->compileChildren($func->children, $tmp, $this->env->marker . " " . $name);
+ $ret = $this->compileChildren($func->children, $tmp);
$this->storeEnv = $storeEnv;
@@ -4783,17 +3655,11 @@ class Compiler
return false;
}
- @list($sorted, $kwargs) = $this->sortNativeFunctionArgs($libName, $prototype, $args);
+ @list($sorted, $kwargs) = $this->sortArgs($prototype, $args);
if ($name !== 'if' && $name !== 'call') {
- $inExp = true;
-
- if ($name === 'join') {
- $inExp = false;
- }
-
foreach ($sorted as &$val) {
- $val = $this->reduce($val, $inExp);
+ $val = $this->reduce($val, true);
}
}
@@ -4831,170 +3697,62 @@ class Compiler
/**
* Sorts keyword arguments
*
- * @param string $functionName
- * @param array $prototypes
- * @param array $args
+ * @param array $prototype
+ * @param array $args
*
* @return array
*/
- protected function sortNativeFunctionArgs($functionName, $prototypes, $args)
+ protected function sortArgs($prototype, $args)
{
- static $parser = null;
+ $keyArgs = [];
+ $posArgs = [];
- if (! isset($prototypes)) {
- $keyArgs = [];
- $posArgs = [];
+ // separate positional and keyword arguments
+ foreach ($args as $arg) {
+ list($key, $value) = $arg;
- // separate positional and keyword arguments
- foreach ($args as $arg) {
- list($key, $value) = $arg;
+ $key = $key[1];
- $key = $key[1];
-
- if (empty($key)) {
- $posArgs[] = empty($arg[2]) ? $value : $arg;
- } else {
- $keyArgs[$key] = $value;
- }
+ if (empty($key)) {
+ $posArgs[] = empty($arg[2]) ? $value : $arg;
+ } else {
+ $keyArgs[$key] = $value;
}
+ }
+ if (! isset($prototype)) {
return [$posArgs, $keyArgs];
}
- // specific cases ?
- if (in_array($functionName, ['libRgb', 'libRgba', 'libHsl', 'libHsla'])) {
- // notation 100 127 255 / 0 is in fact a simple list of 4 values
- foreach ($args as $k => $arg) {
- if ($arg[1][0] === Type::T_LIST && count($arg[1][2]) === 3) {
- $last = end($arg[1][2]);
+ // copy positional args
+ $finalArgs = array_pad($posArgs, count($prototype), null);
- if ($last[0] === Type::T_EXPRESSION && $last[1] === '/') {
- array_pop($arg[1][2]);
- $arg[1][2][] = $last[2];
- $arg[1][2][] = $last[3];
- $args[$k] = $arg;
- }
+ // overwrite positional args with keyword args
+ foreach ($prototype as $i => $names) {
+ foreach ((array) $names as $name) {
+ if (isset($keyArgs[$name])) {
+ $finalArgs[$i] = $keyArgs[$name];
}
}
}
- $finalArgs = [];
-
- if (! is_array(reset($prototypes))) {
- $prototypes = [$prototypes];
- }
-
- $keyArgs = [];
-
- // trying each prototypes
- $prototypeHasMatch = false;
- $exceptionMessage = '';
-
- foreach ($prototypes as $prototype) {
- $argDef = [];
-
- foreach ($prototype as $i => $p) {
- $default = null;
- $p = explode(':', $p, 2);
- $name = array_shift($p);
-
- if (count($p)) {
- $p = trim(reset($p));
-
- if ($p === 'null') {
- // differentiate this null from the static::$null
- $default = [Type::T_KEYWORD, 'null'];
- } else {
- if (is_null($parser)) {
- $parser = $this->parserFactory(__METHOD__);
- }
-
- $parser->parseValue($p, $default);
- }
- }
-
- $isVariable = false;
-
- if (substr($name, -3) === '...') {
- $isVariable = true;
- $name = substr($name, 0, -3);
- }
-
- $argDef[] = [$name, $default, $isVariable];
- }
-
- try {
- $vars = $this->applyArguments($argDef, $args, false, false);
-
- // ensure all args are populated
- foreach ($prototype as $i => $p) {
- $name = explode(':', $p)[0];
-
- if (! isset($finalArgs[$i])) {
- $finalArgs[$i] = null;
- }
- }
-
- // apply positional args
- foreach (array_values($vars) as $i => $val) {
- $finalArgs[$i] = $val;
- }
-
- $keyArgs = array_merge($keyArgs, $vars);
- $prototypeHasMatch = true;
-
- // overwrite positional args with keyword args
- foreach ($prototype as $i => $p) {
- $name = explode(':', $p)[0];
-
- if (isset($keyArgs[$name])) {
- $finalArgs[$i] = $keyArgs[$name];
- }
-
- // special null value as default: translate to real null here
- if ($finalArgs[$i] === [Type::T_KEYWORD, 'null']) {
- $finalArgs[$i] = null;
- }
- }
- // should we break if this prototype seems fulfilled?
- } catch (CompilerException $e) {
- $exceptionMessage = $e->getMessage();
- }
- }
-
- if ($exceptionMessage && ! $prototypeHasMatch) {
- $this->throwError($exceptionMessage);
- }
-
return [$finalArgs, $keyArgs];
}
/**
* Apply argument values per definition
*
- * @param array $argDef
- * @param array $argValues
- * @param boolean $storeInEnv
- * @param boolean $reduce
- * only used if $storeInEnv = false
- *
- * @return array
+ * @param array $argDef
+ * @param array $argValues
*
* @throws \Exception
*/
- protected function applyArguments($argDef, $argValues, $storeInEnv = true, $reduce = true)
+ protected function applyArguments($argDef, $argValues)
{
- $output = [];
- if (is_array($argValues) && count($argValues) && end($argValues) === static::$null) {
- array_pop($argValues);
- }
+ $storeEnv = $this->getStoreEnv();
- if ($storeInEnv) {
- $storeEnv = $this->getStoreEnv();
-
- $env = new Environment;
- $env->store = $storeEnv->store;
- }
+ $env = new Environment;
+ $env->store = $storeEnv->store;
$hasVariable = false;
$args = [];
@@ -5006,64 +3764,37 @@ class Compiler
$hasVariable |= $isVariable;
}
- $splatSeparator = null;
- $keywordArgs = [];
+ $keywordArgs = [];
$deferredKeywordArgs = [];
- $remaining = [];
- $hasKeywordArgument = false;
+ $remaining = [];
// assign the keyword args
foreach ((array) $argValues as $arg) {
if (! empty($arg[0])) {
- $hasKeywordArgument = true;
-
- $name = $arg[0][1];
- if (! isset($args[$name])) {
- foreach (array_keys($args) as $an) {
- if (str_replace("_", "-", $an) === str_replace("_", "-", $name)) {
- $name = $an;
- break;
- }
- }
- }
- if (! isset($args[$name]) || $args[$name][3]) {
+ if (! isset($args[$arg[0][1]])) {
if ($hasVariable) {
- $deferredKeywordArgs[$name] = $arg[1];
+ $deferredKeywordArgs[$arg[0][1]] = $arg[1];
} else {
$this->throwError("Mixin or function doesn't have an argument named $%s.", $arg[0][1]);
break;
}
- } elseif ($args[$name][0] < count($remaining)) {
+ } elseif ($args[$arg[0][1]][0] < count($remaining)) {
$this->throwError("The argument $%s was passed both by position and by name.", $arg[0][1]);
break;
} else {
- $keywordArgs[$name] = $arg[1];
+ $keywordArgs[$arg[0][1]] = $arg[1];
}
+ } elseif (count($keywordArgs)) {
+ $this->throwError('Positional arguments must come before keyword arguments.');
+ break;
} elseif ($arg[2] === true) {
$val = $this->reduce($arg[1], true);
if ($val[0] === Type::T_LIST) {
foreach ($val[2] as $name => $item) {
if (! is_numeric($name)) {
- if (! isset($args[$name])) {
- foreach (array_keys($args) as $an) {
- if (str_replace("_", "-", $an) === str_replace("_", "-", $name)) {
- $name = $an;
- break;
- }
- }
- }
-
- if ($hasVariable) {
- $deferredKeywordArgs[$name] = $item;
- } else {
- $keywordArgs[$name] = $item;
- }
+ $keywordArgs[$name] = $item;
} else {
- if (is_null($splatSeparator)) {
- $splatSeparator = $val[1];
- }
-
$remaining[] = $item;
}
}
@@ -5073,34 +3804,14 @@ class Compiler
$item = $val[2][$i];
if (! is_numeric($name)) {
- if (! isset($args[$name])) {
- foreach (array_keys($args) as $an) {
- if (str_replace("_", "-", $an) === str_replace("_", "-", $name)) {
- $name = $an;
- break;
- }
- }
- }
-
- if ($hasVariable) {
- $deferredKeywordArgs[$name] = $item;
- } else {
- $keywordArgs[$name] = $item;
- }
+ $keywordArgs[$name] = $item;
} else {
- if (is_null($splatSeparator)) {
- $splatSeparator = $val[1];
- }
-
$remaining[] = $item;
}
}
} else {
$remaining[] = $val;
}
- } elseif ($hasKeywordArgument) {
- $this->throwError('Positional arguments must come before keyword arguments.');
- break;
} else {
$remaining[] = $arg[1];
}
@@ -5110,7 +3821,7 @@ class Compiler
list($i, $name, $default, $isVariable) = $arg;
if ($isVariable) {
- $val = [Type::T_LIST, is_null($splatSeparator) ? ',' : $splatSeparator , [], $isVariable];
+ $val = [Type::T_LIST, ',', [], $isVariable];
for ($count = count($remaining); $i < $count; $i++) {
$val[2][] = $remaining[$i];
@@ -5130,16 +3841,10 @@ class Compiler
break;
}
- if ($storeInEnv) {
- $this->set($name, $this->reduce($val, true), true, $env);
- } else {
- $output[$name] = ($reduce ? $this->reduce($val, true) : $val);
- }
+ $this->set($name, $this->reduce($val, true), true, $env);
}
- if ($storeInEnv) {
- $storeEnv->store = $env->store;
- }
+ $storeEnv->store = $env->store;
foreach ($args as $arg) {
list($i, $name, $default, $isVariable) = $arg;
@@ -5148,14 +3853,8 @@ class Compiler
continue;
}
- if ($storeInEnv) {
- $this->set($name, $this->reduce($default, true), true);
- } else {
- $output[$name] = ($reduce ? $this->reduce($default, true) : $default);
- }
+ $this->set($name, $this->reduce($default, true), true);
}
-
- return $output;
}
/**
@@ -5163,9 +3862,9 @@ class Compiler
*
* @param mixed $value
*
- * @return array|\ScssPhp\ScssPhp\Node\Number
+ * @return array|\Leafo\ScssPhp\Node\Number
*/
- protected function coerceValue($value)
+ private function coerceValue($value)
{
if (is_array($value) || $value instanceof \ArrayAccess) {
return $value;
@@ -5175,7 +3874,7 @@ class Compiler
return $this->toBool($value);
}
- if (is_null($value)) {
+ if ($value === null) {
return static::$null;
}
@@ -5187,14 +3886,30 @@ class Compiler
return static::$emptyString;
}
- $value = [Type::T_KEYWORD, $value];
- $color = $this->coerceColor($value);
+ if (preg_match('/^(#([0-9a-f]{6})|#([0-9a-f]{3}))$/i', $value, $m)) {
+ $color = [Type::T_COLOR];
+
+ if (isset($m[3])) {
+ $num = hexdec($m[3]);
+
+ foreach ([3, 2, 1] as $i) {
+ $t = $num & 0xf;
+ $color[$i] = $t << 4 | $t;
+ $num >>= 4;
+ }
+ } else {
+ $num = hexdec($m[2]);
+
+ foreach ([3, 2, 1] as $i) {
+ $color[$i] = $num & 0xff;
+ $num >>= 8;
+ }
+ }
- if ($color) {
return $color;
}
- return $value;
+ return [Type::T_KEYWORD, $value];
}
/**
@@ -5210,9 +3925,7 @@ class Compiler
return $item;
}
- if ($item[0] === static::$emptyList[0]
- && $item[1] === static::$emptyList[1]
- && $item[2] === static::$emptyList[2]) {
+ if ($item === static::$emptyList) {
return static::$emptyMap;
}
@@ -5242,21 +3955,10 @@ class Compiler
$key = $keys[$i];
$value = $values[$i];
- switch ($key[0]) {
- case Type::T_LIST:
- case Type::T_MAP:
- case Type::T_STRING:
- break;
-
- default:
- $key = [Type::T_KEYWORD, $this->compileStringContent($this->coerceString($key))];
- break;
- }
-
$list[] = [
Type::T_LIST,
'',
- [$key, $value]
+ [[Type::T_KEYWORD, $this->compileStringContent($this->coerceString($key))], $value]
];
}
@@ -5289,106 +3991,21 @@ class Compiler
*
* @return array|null
*/
- protected function coerceColor($value, $inRGBFunction = false)
+ protected function coerceColor($value)
{
switch ($value[0]) {
case Type::T_COLOR:
- for ($i = 1; $i <= 3; $i++) {
- if (! is_numeric($value[$i])) {
- $cv = $this->compileRGBAValue($value[$i]);
-
- if (! is_numeric($cv)) {
- return null;
- }
-
- $value[$i] = $cv;
- }
-
- if (isset($value[4])) {
- if (! is_numeric($value[4])) {
- $cv = $this->compileRGBAValue($value[4], true);
-
- if (! is_numeric($cv)) {
- return null;
- }
-
- $value[4] = $cv;
- }
- }
- }
-
return $value;
- case Type::T_LIST:
- if ($inRGBFunction) {
- if (count($value[2]) == 3 || count($value[2]) == 4) {
- $color = $value[2];
- array_unshift($color, Type::T_COLOR);
-
- return $this->coerceColor($color);
- }
- }
-
- return null;
-
case Type::T_KEYWORD:
- if (! is_string($value[1])) {
- return null;
- }
-
$name = strtolower($value[1]);
- // hexa color?
- if (preg_match('/^#([0-9a-f]+)$/i', $name, $m)) {
- $nofValues = strlen($m[1]);
- if (in_array($nofValues, [3, 4, 6, 8])) {
- $nbChannels = 3;
- $color = [];
- $num = hexdec($m[1]);
+ if (isset(Colors::$cssColors[$name])) {
+ $rgba = explode(',', Colors::$cssColors[$name]);
- switch ($nofValues) {
- case 4:
- $nbChannels = 4;
- // then continuing with the case 3:
- case 3:
- for ($i = 0; $i < $nbChannels; $i++) {
- $t = $num & 0xf;
- array_unshift($color, $t << 4 | $t);
- $num >>= 4;
- }
-
- break;
-
- case 8:
- $nbChannels = 4;
- // then continuing with the case 6:
- case 6:
- for ($i = 0; $i < $nbChannels; $i++) {
- array_unshift($color, $num & 0xff);
- $num >>= 8;
- }
-
- break;
- }
-
- if ($nbChannels === 4) {
- if ($color[3] === 255) {
- $color[3] = 1; // fully opaque
- } else {
- $color[3] = round($color[3] / 255, 3);
- }
- }
-
- array_unshift($color, Type::T_COLOR);
-
- return $color;
- }
- }
-
- if ($rgba = Colors::colorNameToRGBa($name)) {
return isset($rgba[3])
- ? [Type::T_COLOR, $rgba[0], $rgba[1], $rgba[2], $rgba[3]]
- : [Type::T_COLOR, $rgba[0], $rgba[1], $rgba[2]];
+ ? [Type::T_COLOR, (int) $rgba[0], (int) $rgba[1], (int) $rgba[2], (int) $rgba[3]]
+ : [Type::T_COLOR, (int) $rgba[0], (int) $rgba[1], (int) $rgba[2]];
}
return null;
@@ -5397,88 +4014,6 @@ class Compiler
return null;
}
- /**
- * @param integer|\ScssPhp\ScssPhp\Node\Number $value
- * @param boolean $isAlpha
- *
- * @return integer|mixed
- */
- protected function compileRGBAValue($value, $isAlpha = false)
- {
- if ($isAlpha) {
- return $this->compileColorPartValue($value, 0, 1, false);
- }
-
- return $this->compileColorPartValue($value, 0, 255, true);
- }
-
- /**
- * @param mixed $value
- * @param integer|float $min
- * @param integer|float $max
- * @param boolean $isInt
- * @param boolean $clamp
- * @param boolean $modulo
- *
- * @return integer|mixed
- */
- protected function compileColorPartValue($value, $min, $max, $isInt = true, $clamp = true, $modulo = false)
- {
- if (! is_numeric($value)) {
- if (is_array($value)) {
- $reduced = $this->reduce($value);
-
- if (is_object($reduced) && $value->type === Type::T_NUMBER) {
- $value = $reduced;
- }
- }
-
- if (is_object($value) && $value->type === Type::T_NUMBER) {
- $num = $value->dimension;
-
- if (count($value->units)) {
- $unit = array_keys($value->units);
- $unit = reset($unit);
-
- switch ($unit) {
- case '%':
- $num *= $max / 100;
- break;
- default:
- break;
- }
- }
-
- $value = $num;
- } elseif (is_array($value)) {
- $value = $this->compileValue($value);
- }
- }
-
- if (is_numeric($value)) {
- if ($isInt) {
- $value = round($value);
- }
-
- if ($clamp) {
- $value = min($max, max($min, $value));
- }
-
- if ($modulo) {
- $value = $value % $max;
-
- // still negative?
- while ($value < $min) {
- $value += $max;
- }
- }
-
- return $value;
- }
-
- return $value;
- }
-
/**
* Coerce value to string
*
@@ -5531,7 +4066,7 @@ class Compiler
$value = $this->coerceMap($value);
if ($value[0] !== Type::T_MAP) {
- $this->throwError('expecting map, %s received', $value[0]);
+ $this->throwError('expecting map');
}
return $value;
@@ -5551,7 +4086,7 @@ class Compiler
public function assertList($value)
{
if ($value[0] !== Type::T_LIST) {
- $this->throwError('expecting list, %s received', $value[0]);
+ $this->throwError('expecting list');
}
return $value;
@@ -5574,7 +4109,7 @@ class Compiler
return $color;
}
- $this->throwError('expecting color, %s received', $value[0]);
+ $this->throwError('expecting color');
}
/**
@@ -5591,7 +4126,7 @@ class Compiler
public function assertNumber($value)
{
if ($value[0] !== Type::T_NUMBER) {
- $this->throwError('expecting number, %s received', $value[0]);
+ $this->throwError('expecting number');
}
return $value[1];
@@ -5668,7 +4203,7 @@ class Compiler
*
* @return float
*/
- protected function hueToRGB($m1, $m2, $h)
+ private function hueToRGB($m1, $m2, $h)
{
if ($h < 0) {
$h += 1;
@@ -5726,27 +4261,46 @@ class Compiler
// Built in functions
- protected static $libCall = ['name', 'args...'];
+ //protected static $libCall = ['name', 'args...'];
protected function libCall($args, $kwargs)
{
$name = $this->compileStringContent($this->coerceString($this->reduce(array_shift($args), true)));
- $callArgs = [];
- // $kwargs['args'] is [Type::T_LIST, ',', [..]]
- foreach ($kwargs['args'][2] as $varname => $arg) {
- if (is_numeric($varname)) {
- $varname = null;
- } else {
- $varname = [ 'var', $varname];
+ $posArgs = [];
+
+ foreach ($args as $arg) {
+ if (empty($arg[0])) {
+ if ($arg[2] === true) {
+ $tmp = $this->reduce($arg[1]);
+
+ if ($tmp[0] === Type::T_LIST) {
+ foreach ($tmp[2] as $item) {
+ $posArgs[] = [null, $item, false];
+ }
+ } else {
+ $posArgs[] = [null, $tmp, true];
+ }
+
+ continue;
+ }
+
+ $posArgs[] = [null, $this->reduce($arg), false];
+ continue;
}
- $callArgs[] = [$varname, $arg, false];
+ $posArgs[] = [null, $arg, false];
}
- return $this->reduce([Type::T_FUNCTION_CALL, $name, $callArgs]);
+ if (count($kwargs)) {
+ foreach ($kwargs as $key => $value) {
+ $posArgs[] = [[Type::T_VARIABLE, $key], $value, false];
+ }
+ }
+
+ return $this->reduce([Type::T_FUNCTION_CALL, $name, $posArgs]);
}
- protected static $libIf = ['condition', 'if-true', 'if-false:'];
+ protected static $libIf = ['condition', 'if-true', 'if-false'];
protected function libIf($args)
{
list($cond, $t, $f) = $args;
@@ -5790,68 +4344,30 @@ class Compiler
return false === $key ? static::$null : $key + 1;
}
- protected static $libRgb = [
- ['color'],
- ['color', 'alpha'],
- ['channels'],
- ['red', 'green', 'blue'],
- ['red', 'green', 'blue', 'alpha'] ];
- protected function libRgb($args, $kwargs, $funcName = 'rgb')
+ protected static $libRgb = ['red', 'green', 'blue'];
+ protected function libRgb($args)
{
- switch (count($args)) {
- case 1:
- if (! $color = $this->coerceColor($args[0], true)) {
- $color = [Type::T_STRING, '', [$funcName . '(', $args[0], ')']];
- }
- break;
+ list($r, $g, $b) = $args;
- case 3:
- $color = [Type::T_COLOR, $args[0], $args[1], $args[2]];
-
- if (! $color = $this->coerceColor($color)) {
- $color = [Type::T_STRING, '', [$funcName .'(', $args[0], ', ', $args[1], ', ', $args[2], ')']];
- }
-
- return $color;
-
- case 2:
- if ($color = $this->coerceColor($args[0], true)) {
- $alpha = $this->compileRGBAValue($args[1], true);
-
- if (is_numeric($alpha)) {
- $color[4] = $alpha;
- } else {
- $color = [Type::T_STRING, '',
- [$funcName . '(', $color[1], ', ', $color[2], ', ', $color[3], ', ', $alpha, ')']];
- }
- } else {
- $color = [Type::T_STRING, '', [$funcName . '(', $args[0], ')']];
- }
- break;
-
- case 4:
- default:
- $color = [Type::T_COLOR, $args[0], $args[1], $args[2], $args[3]];
-
- if (! $color = $this->coerceColor($color)) {
- $color = [Type::T_STRING, '',
- [$funcName . '(', $args[0], ', ', $args[1], ', ', $args[2], ', ', $args[3], ')']];
- }
- break;
- }
-
- return $color;
+ return [Type::T_COLOR, $r[1], $g[1], $b[1]];
}
protected static $libRgba = [
- ['color'],
- ['color', 'alpha'],
- ['channels'],
- ['red', 'green', 'blue'],
- ['red', 'green', 'blue', 'alpha'] ];
- protected function libRgba($args, $kwargs)
+ ['red', 'color'],
+ 'green', 'blue', 'alpha'];
+ protected function libRgba($args)
{
- return $this->libRgb($args, $kwargs, 'rgba');
+ if ($color = $this->coerceColor($args[0])) {
+ $num = isset($args[3]) ? $args[3] : $args[1];
+ $alpha = $this->assertNumber($num);
+ $color[4] = $alpha;
+
+ return $color;
+ }
+
+ list($r, $g, $b, $a) = $args;
+
+ return [Type::T_COLOR, $r[1], $g[1], $b[1], $a[1]];
}
// helper function for adjust_color, change_color, and scale_color
@@ -5859,25 +4375,21 @@ class Compiler
{
$color = $this->assertColor($args[0]);
- foreach ([1 => 1, 2 => 2, 3 => 3, 7 => 4] as $iarg => $irgba) {
- if (isset($args[$iarg])) {
- $val = $this->assertNumber($args[$iarg]);
-
- if (! isset($color[$irgba])) {
- $color[$irgba] = (($irgba < 4) ? 0 : 1);
- }
-
- $color[$irgba] = call_user_func($fn, $color[$irgba], $val, $iarg);
+ foreach ([1, 2, 3, 7] as $i) {
+ if (isset($args[$i])) {
+ $val = $this->assertNumber($args[$i]);
+ $ii = $i === 7 ? 4 : $i; // alpha
+ $color[$ii] = call_user_func($fn, isset($color[$ii]) ? $color[$ii] : 0, $val, $i);
}
}
- if (! empty($args[4]) || ! empty($args[5]) || ! empty($args[6])) {
+ if (isset($args[4]) || isset($args[5]) || isset($args[6])) {
$hsl = $this->toHSL($color[1], $color[2], $color[3]);
- foreach ([4 => 1, 5 => 2, 6 => 3] as $iarg => $ihsl) {
- if (! empty($args[$iarg])) {
- $val = $this->assertNumber($args[$iarg]);
- $hsl[$ihsl] = call_user_func($fn, $hsl[$ihsl], $val, $iarg);
+ foreach ([4, 5, 6] as $i) {
+ if (isset($args[$i])) {
+ $val = $this->assertNumber($args[$i]);
+ $hsl[$i - 3] = call_user_func($fn, $hsl[$i - 3], $val, $i);
}
}
@@ -5894,8 +4406,8 @@ class Compiler
}
protected static $libAdjustColor = [
- 'color', 'red:null', 'green:null', 'blue:null',
- 'hue:null', 'saturation:null', 'lightness:null', 'alpha:null'
+ 'color', 'red', 'green', 'blue',
+ 'hue', 'saturation', 'lightness', 'alpha'
];
protected function libAdjustColor($args)
{
@@ -5905,8 +4417,8 @@ class Compiler
}
protected static $libChangeColor = [
- 'color', 'red:null', 'green:null', 'blue:null',
- 'hue:null', 'saturation:null', 'lightness:null', 'alpha:null'
+ 'color', 'red', 'green', 'blue',
+ 'hue', 'saturation', 'lightness', 'alpha'
];
protected function libChangeColor($args)
{
@@ -5916,8 +4428,8 @@ class Compiler
}
protected static $libScaleColor = [
- 'color', 'red:null', 'green:null', 'blue:null',
- 'hue:null', 'saturation:null', 'lightness:null', 'alpha:null'
+ 'color', 'red', 'green', 'blue',
+ 'hue', 'saturation', 'lightness', 'alpha'
];
protected function libScaleColor($args)
{
@@ -5960,7 +4472,7 @@ class Compiler
$color = $this->coerceColor($args[0]);
$color[4] = isset($color[4]) ? round(255 * $color[4]) : 255;
- return [Type::T_STRING, '', [sprintf('#%02X%02X%02X%02X', $color[4], $color[1], $color[2], $color[3])]];
+ return sprintf('#%02X%02X%02X%02X', $color[4], $color[1], $color[2], $color[3]);
}
protected static $libRed = ['color'];
@@ -6011,7 +4523,7 @@ class Compiler
}
// mix two colors
- protected static $libMix = ['color-1', 'color-2', 'weight:0.5'];
+ protected static $libMix = ['color-1', 'color-2', 'weight'];
protected function libMix($args)
{
list($first, $second, $weight) = $args;
@@ -6047,54 +4559,23 @@ class Compiler
return $this->fixColor($new);
}
- protected static $libHsl =[
- ['channels'],
- ['hue', 'saturation', 'lightness'],
- ['hue', 'saturation', 'lightness', 'alpha'] ];
- protected function libHsl($args, $kwargs, $funcName = 'hsl')
+ protected static $libHsl = ['hue', 'saturation', 'lightness'];
+ protected function libHsl($args)
{
- if (count($args) == 1) {
- if ($args[0][0] !== Type::T_LIST || count($args[0][2]) < 3 || count($args[0][2]) > 4) {
- return [Type::T_STRING, '', [$funcName . '(', $args[0], ')']];
- }
+ list($h, $s, $l) = $args;
- $args = $args[0][2];
- }
-
- $hue = $this->compileColorPartValue($args[0], 0, 360, false, false, true);
- $saturation = $this->compileColorPartValue($args[1], 0, 100, false);
- $lightness = $this->compileColorPartValue($args[2], 0, 100, false);
-
- $alpha = null;
-
- if (count($args) === 4) {
- $alpha = $this->compileColorPartValue($args[3], 0, 100, false);
-
- if (! is_numeric($hue) || ! is_numeric($saturation) || ! is_numeric($lightness) || ! is_numeric($alpha)) {
- return [Type::T_STRING, '',
- [$funcName . '(', $args[0], ', ', $args[1], ', ', $args[2], ', ', $args[3], ')']];
- }
- } else {
- if (! is_numeric($hue) || ! is_numeric($saturation) || ! is_numeric($lightness)) {
- return [Type::T_STRING, '', [$funcName . '(', $args[0], ', ', $args[1], ', ', $args[2], ')']];
- }
- }
-
- $color = $this->toRGB($hue, $saturation, $lightness);
-
- if (! is_null($alpha)) {
- $color[4] = $alpha;
- }
-
- return $color;
+ return $this->toRGB($h[1], $s[1], $l[1]);
}
- protected static $libHsla = [
- ['channels'],
- ['hue', 'saturation', 'lightness', 'alpha:1'] ];
- protected function libHsla($args, $kwargs)
+ protected static $libHsla = ['hue', 'saturation', 'lightness', 'alpha'];
+ protected function libHsla($args)
{
- return $this->libHsl($args, $kwargs, 'hsla');
+ list($h, $s, $l, $a) = $args;
+
+ $color = $this->toRGB($h[1], $s[1], $l[1]);
+ $color[4] = $a[1];
+
+ return $color;
}
protected static $libHue = ['color'];
@@ -6164,7 +4645,7 @@ class Compiler
return $this->adjustHsl($color, 3, -$amount);
}
- protected static $libSaturate = [['color', 'amount'], ['number']];
+ protected static $libSaturate = ['color', 'amount'];
protected function libSaturate($args)
{
$value = $args[0];
@@ -6206,32 +4687,21 @@ class Compiler
return $this->adjustHsl($this->assertColor($args[0]), 1, 180);
}
- protected static $libInvert = ['color', 'weight:1'];
+ protected static $libInvert = ['color'];
protected function libInvert($args)
{
- list($value, $weight) = $args;
-
- if (! isset($weight)) {
- $weight = 1;
- } else {
- $weight = $this->coercePercent($weight);
- }
+ $value = $args[0];
if ($value[0] === Type::T_NUMBER) {
return null;
}
$color = $this->assertColor($value);
- $inverted = $color;
- $inverted[1] = 255 - $inverted[1];
- $inverted[2] = 255 - $inverted[2];
- $inverted[3] = 255 - $inverted[3];
+ $color[1] = 255 - $color[1];
+ $color[2] = 255 - $color[2];
+ $color[3] = 255 - $color[3];
- if ($weight < 1) {
- return $this->libMix([$inverted, $color, [Type::T_NUMBER, $weight]]);
- }
-
- return $inverted;
+ return $color;
}
// increases opacity by amount
@@ -6340,7 +4810,7 @@ class Compiler
$min = null;
foreach ($numbers as $key => $number) {
- if (is_null($min) || $number[1] <= $min[1]) {
+ if (null === $min || $number[1] <= $min[1]) {
$min = [$key, $number[1]];
}
}
@@ -6354,7 +4824,7 @@ class Compiler
$max = null;
foreach ($numbers as $key => $number) {
- if (is_null($max) || $number[1] >= $max[1]) {
+ if (null === $max || $number[1] >= $max[1]) {
$max = [$key, $number[1]];
}
}
@@ -6371,9 +4841,9 @@ class Compiler
*/
protected function getNormalizedNumbers($args)
{
- $unit = null;
+ $unit = null;
$originalUnit = null;
- $numbers = [];
+ $numbers = [];
foreach ($args as $key => $item) {
if ($item[0] !== Type::T_NUMBER) {
@@ -6383,7 +4853,7 @@ class Compiler
$number = $item->normalize();
- if (is_null($unit)) {
+ if (null === $unit) {
$unit = $number[2];
$originalUnit = $item->unitStr();
} elseif ($number[1] && $unit !== $number[2]) {
@@ -6455,7 +4925,7 @@ class Compiler
if (! isset($list[2][$n])) {
$this->throwError('Invalid argument for "n"');
- return null;
+ return;
}
$list[2][$n] = $args[2];
@@ -6467,15 +4937,11 @@ class Compiler
protected function libMapGet($args)
{
$map = $this->assertMap($args[0]);
- $key = $args[1];
+ $key = $this->compileStringContent($this->coerceString($args[1]));
- if (! is_null($key)) {
- $key = $this->compileStringContent($this->coerceString($key));
-
- for ($i = count($map[1]) - 1; $i >= 0; $i--) {
- if ($key === $this->compileStringContent($this->coerceString($map[1][$i]))) {
- return $map[2][$i];
- }
+ for ($i = count($map[1]) - 1; $i >= 0; $i--) {
+ if ($key === $this->compileStringContent($this->coerceString($map[1][$i]))) {
+ return $map[2][$i];
}
}
@@ -6570,18 +5036,6 @@ class Compiler
return [Type::T_MAP, $keys, $values];
}
- protected static $libIsBracketed = ['list'];
- protected function libIsBracketed($args)
- {
- $list = $args[0];
- $this->coerceList($list, ' ');
- if (! empty($list['enclosing']) && $list['enclosing'] === 'bracket') {
- return true;
- }
- return false;
- }
-
-
protected function listSeparatorForJoin($list1, $sep)
{
if (! isset($sep)) {
@@ -6593,56 +5047,26 @@ class Compiler
return ',';
case 'space':
- return ' ';
+ return '';
default:
return $list1[1];
}
}
- protected static $libJoin = ['list1', 'list2', 'separator:null', 'bracketed:auto'];
+ protected static $libJoin = ['list1', 'list2', 'separator'];
protected function libJoin($args)
{
- list($list1, $list2, $sep, $bracketed) = $args;
+ list($list1, $list2, $sep) = $args;
$list1 = $this->coerceList($list1, ' ');
$list2 = $this->coerceList($list2, ' ');
- $sep = $this->listSeparatorForJoin($list1, $sep);
+ $sep = $this->listSeparatorForJoin($list1, $sep);
- if ($bracketed === static::$true) {
- $bracketed = true;
- } elseif ($bracketed === static::$false) {
- $bracketed = false;
- } elseif ($bracketed === [Type::T_KEYWORD, 'auto']) {
- $bracketed = 'auto';
- } elseif ($bracketed === static::$null) {
- $bracketed = false;
- } else {
- $bracketed = $this->compileValue($bracketed);
- $bracketed = ! ! $bracketed;
- if ($bracketed === true) {
- $bracketed = true;
- }
- }
-
- if ($bracketed === 'auto') {
- $bracketed = false;
- if (! empty($list1['enclosing']) && $list1['enclosing'] === 'bracket') {
- $bracketed = true;
- }
- }
-
- $res = [Type::T_LIST, $sep, array_merge($list1[2], $list2[2])];
- if (isset($list1['enclosing'])) {
- $res['enlcosing'] = $list1['enclosing'];
- }
- if ($bracketed) {
- $res['enclosing'] = 'bracket';
- }
- return $res;
+ return [Type::T_LIST, $sep, array_merge($list1[2], $list2[2])];
}
- protected static $libAppend = ['list', 'val', 'separator:null'];
+ protected static $libAppend = ['list', 'val', 'separator'];
protected function libAppend($args)
{
list($list1, $value, $sep) = $args;
@@ -6650,17 +5074,13 @@ class Compiler
$list1 = $this->coerceList($list1, ' ');
$sep = $this->listSeparatorForJoin($list1, $sep);
- $res = [Type::T_LIST, $sep, array_merge($list1[2], [$value])];
- if (isset($list1['enclosing'])) {
- $res['enclosing'] = $list1['enclosing'];
- }
- return $res;
+ return [Type::T_LIST, $sep, array_merge($list1[2], [$value])];
}
protected function libZip($args)
{
- foreach ($args as $key => $arg) {
- $args[$key] = $this->coerceList($arg);
+ foreach ($args as $arg) {
+ $this->assertList($arg);
}
$lists = [];
@@ -6743,7 +5163,7 @@ class Compiler
) {
$this->throwError('Invalid argument(s) for "comparable"');
- return null;
+ return;
}
$number1 = $number1->normalize();
@@ -6791,10 +5211,10 @@ class Compiler
return new Node\Number(strlen($stringContent), '');
}
- protected static $libStrSlice = ['string', 'start-at', 'end-at:-1'];
+ protected static $libStrSlice = ['string', 'start-at', 'end-at'];
protected function libStrSlice($args)
{
- if (isset($args[2]) && ! $args[2][1]) {
+ if (isset($args[2]) && $args[2][1] == 0) {
return static::$nullString;
}
@@ -6807,7 +5227,7 @@ class Compiler
$start--;
}
- $end = isset($args[2]) ? (int) $args[2][1] : -1;
+ $end = (int) $args[2][1];
$length = $end < 0 ? $end + 1 : ($end > 0 ? $end - $start : $end);
$string[2] = $length
@@ -6923,7 +5343,7 @@ class Compiler
if ($n < 1) {
$this->throwError("limit must be greater than or equal to 1");
- return null;
+ return;
}
return new Node\Number(mt_rand(1, $n), '');
@@ -6945,670 +5365,13 @@ class Compiler
return [Type::T_STRING, '', ['u' . str_pad(base_convert($id, 10, 36), 8, '0', STR_PAD_LEFT)]];
}
- protected function inspectFormatValue($value, $force_enclosing_display = false)
- {
- if ($value === static::$null) {
- $value = [Type::T_KEYWORD, 'null'];
- }
- $stringValue = [$value];
- if ($value[0] === Type::T_LIST) {
- if (end($value[2]) === static::$null) {
- array_pop($value[2]);
- $value[2][] = [Type::T_STRING, '', ['']];
- $force_enclosing_display = true;
- }
- if (! empty($value['enclosing'])) {
- if ($force_enclosing_display
- || ($value['enclosing'] === 'bracket' )
- || !count($value[2])) {
- $value['enclosing'] = 'forced_'.$value['enclosing'];
- $force_enclosing_display = true;
- }
- }
- foreach ($value[2] as $k => $listelement) {
- $value[2][$k] = $this->inspectFormatValue($listelement, $force_enclosing_display);
- }
- $stringValue = [$value];
- }
-
- return [Type::T_STRING, '', $stringValue];
- }
-
protected static $libInspect = ['value'];
protected function libInspect($args)
{
- $value = $args[0];
- return $this->inspectFormatValue($value);
- }
-
- /**
- * Preprocess selector args
- *
- * @param array $arg
- *
- * @return array|boolean
- */
- protected function getSelectorArg($arg)
- {
- static $parser = null;
-
- if (is_null($parser)) {
- $parser = $this->parserFactory(__METHOD__);
+ if ($args[0] === static::$null) {
+ return [Type::T_KEYWORD, 'null'];
}
- $arg = $this->libUnquote([$arg]);
- $arg = $this->compileValue($arg);
-
- $parsedSelector = [];
-
- if ($parser->parseSelector($arg, $parsedSelector)) {
- $selector = $this->evalSelectors($parsedSelector);
- $gluedSelector = $this->glueFunctionSelectors($selector);
-
- return $gluedSelector;
- }
-
- return false;
- }
-
- /**
- * Postprocess selector to output in right format
- *
- * @param array $selectors
- *
- * @return string
- */
- protected function formatOutputSelector($selectors)
- {
- $selectors = $this->collapseSelectors($selectors, true);
-
- return $selectors;
- }
-
- protected static $libIsSuperselector = ['super', 'sub'];
- protected function libIsSuperselector($args)
- {
- list($super, $sub) = $args;
-
- $super = $this->getSelectorArg($super);
- $sub = $this->getSelectorArg($sub);
-
- return $this->isSuperSelector($super, $sub);
- }
-
- /**
- * Test a $super selector again $sub
- *
- * @param array $super
- * @param array $sub
- *
- * @return boolean
- */
- protected function isSuperSelector($super, $sub)
- {
- // one and only one selector for each arg
- if (! $super || count($super) !== 1) {
- $this->throwError("Invalid super selector for isSuperSelector()");
- }
-
- if (! $sub || count($sub) !== 1) {
- $this->throwError("Invalid sub selector for isSuperSelector()");
- }
-
- $super = reset($super);
- $sub = reset($sub);
-
- $i = 0;
- $nextMustMatch = false;
-
- foreach ($super as $node) {
- $compound = '';
-
- array_walk_recursive(
- $node,
- function ($value, $key) use (&$compound) {
- $compound .= $value;
- }
- );
-
- if ($this->isImmediateRelationshipCombinator($compound)) {
- if ($node !== $sub[$i]) {
- return false;
- }
-
- $nextMustMatch = true;
- $i++;
- } else {
- while ($i < count($sub) && ! $this->isSuperPart($node, $sub[$i])) {
- if ($nextMustMatch) {
- return false;
- }
-
- $i++;
- }
-
- if ($i >= count($sub)) {
- return false;
- }
-
- $nextMustMatch = false;
- $i++;
- }
- }
-
- return true;
- }
-
- /**
- * Test a part of super selector again a part of sub selector
- *
- * @param array $superParts
- * @param array $subParts
- *
- * @return boolean
- */
- protected function isSuperPart($superParts, $subParts)
- {
- $i = 0;
-
- foreach ($superParts as $superPart) {
- while ($i < count($subParts) && $subParts[$i] !== $superPart) {
- $i++;
- }
-
- if ($i >= count($subParts)) {
- return false;
- }
-
- $i++;
- }
-
- return true;
- }
-
- protected static $libSelectorAppend = ['selector...'];
- protected function libSelectorAppend($args)
- {
- // get the selector... list
- $args = reset($args);
- $args = $args[2];
-
- if (count($args) < 1) {
- $this->throwError("selector-append() needs at least 1 argument");
- }
-
- $selectors = array_map([$this, 'getSelectorArg'], $args);
-
- return $this->formatOutputSelector($this->selectorAppend($selectors));
- }
-
- /**
- * Append parts of the last selector in the list to the previous, recursively
- *
- * @param array $selectors
- *
- * @return array
- *
- * @throws \ScssPhp\ScssPhp\Exception\CompilerException
- */
- protected function selectorAppend($selectors)
- {
- $lastSelectors = array_pop($selectors);
-
- if (! $lastSelectors) {
- $this->throwError("Invalid selector list in selector-append()");
- }
-
- while (count($selectors)) {
- $previousSelectors = array_pop($selectors);
-
- if (! $previousSelectors) {
- $this->throwError("Invalid selector list in selector-append()");
- }
-
- // do the trick, happening $lastSelector to $previousSelector
- $appended = [];
-
- foreach ($lastSelectors as $lastSelector) {
- $previous = $previousSelectors;
-
- foreach ($lastSelector as $lastSelectorParts) {
- foreach ($lastSelectorParts as $lastSelectorPart) {
- foreach ($previous as $i => $previousSelector) {
- foreach ($previousSelector as $j => $previousSelectorParts) {
- $previous[$i][$j][] = $lastSelectorPart;
- }
- }
- }
- }
-
- foreach ($previous as $ps) {
- $appended[] = $ps;
- }
- }
-
- $lastSelectors = $appended;
- }
-
- return $lastSelectors;
- }
-
- protected static $libSelectorExtend = ['selectors', 'extendee', 'extender'];
- protected function libSelectorExtend($args)
- {
- list($selectors, $extendee, $extender) = $args;
-
- $selectors = $this->getSelectorArg($selectors);
- $extendee = $this->getSelectorArg($extendee);
- $extender = $this->getSelectorArg($extender);
-
- if (! $selectors || ! $extendee || ! $extender) {
- $this->throwError("selector-extend() invalid arguments");
- }
-
- $extended = $this->extendOrReplaceSelectors($selectors, $extendee, $extender);
-
- return $this->formatOutputSelector($extended);
- }
-
- protected static $libSelectorReplace = ['selectors', 'original', 'replacement'];
- protected function libSelectorReplace($args)
- {
- list($selectors, $original, $replacement) = $args;
-
- $selectors = $this->getSelectorArg($selectors);
- $original = $this->getSelectorArg($original);
- $replacement = $this->getSelectorArg($replacement);
-
- if (! $selectors || ! $original || ! $replacement) {
- $this->throwError("selector-replace() invalid arguments");
- }
-
- $replaced = $this->extendOrReplaceSelectors($selectors, $original, $replacement, true);
-
- return $this->formatOutputSelector($replaced);
- }
-
- /**
- * Extend/replace in selectors
- * used by selector-extend and selector-replace that use the same logic
- *
- * @param array $selectors
- * @param array $extendee
- * @param array $extender
- * @param boolean $replace
- *
- * @return array
- */
- protected function extendOrReplaceSelectors($selectors, $extendee, $extender, $replace = false)
- {
- $saveExtends = $this->extends;
- $saveExtendsMap = $this->extendsMap;
-
- $this->extends = [];
- $this->extendsMap = [];
-
- foreach ($extendee as $es) {
- // only use the first one
- $this->pushExtends(reset($es), $extender, null);
- }
-
- $extended = [];
-
- foreach ($selectors as $selector) {
- if (! $replace) {
- $extended[] = $selector;
- }
-
- $n = count($extended);
-
- $this->matchExtends($selector, $extended);
-
- // if didnt match, keep the original selector if we are in a replace operation
- if ($replace and count($extended) === $n) {
- $extended[] = $selector;
- }
- }
-
- $this->extends = $saveExtends;
- $this->extendsMap = $saveExtendsMap;
-
- return $extended;
- }
-
- protected static $libSelectorNest = ['selector...'];
- protected function libSelectorNest($args)
- {
- // get the selector... list
- $args = reset($args);
- $args = $args[2];
-
- if (count($args) < 1) {
- $this->throwError("selector-nest() needs at least 1 argument");
- }
-
- $selectorsMap = array_map([$this, 'getSelectorArg'], $args);
- $envs = [];
-
- foreach ($selectorsMap as $selectors) {
- $env = new Environment();
- $env->selectors = $selectors;
-
- $envs[] = $env;
- }
-
- $envs = array_reverse($envs);
- $env = $this->extractEnv($envs);
- $outputSelectors = $this->multiplySelectors($env);
-
- return $this->formatOutputSelector($outputSelectors);
- }
-
- protected static $libSelectorParse = ['selectors'];
- protected function libSelectorParse($args)
- {
- $selectors = reset($args);
- $selectors = $this->getSelectorArg($selectors);
-
- return $this->formatOutputSelector($selectors);
- }
-
- protected static $libSelectorUnify = ['selectors1', 'selectors2'];
- protected function libSelectorUnify($args)
- {
- list($selectors1, $selectors2) = $args;
-
- $selectors1 = $this->getSelectorArg($selectors1);
- $selectors2 = $this->getSelectorArg($selectors2);
-
- if (! $selectors1 || ! $selectors2) {
- $this->throwError("selector-unify() invalid arguments");
- }
-
- // only consider the first compound of each
- $compound1 = reset($selectors1);
- $compound2 = reset($selectors2);
-
- // unify them and that's it
- $unified = $this->unifyCompoundSelectors($compound1, $compound2);
-
- return $this->formatOutputSelector($unified);
- }
-
- /**
- * The selector-unify magic as its best
- * (at least works as expected on test cases)
- *
- * @param array $compound1
- * @param array $compound2
- *
- * @return array|mixed
- */
- protected function unifyCompoundSelectors($compound1, $compound2)
- {
- if (! count($compound1)) {
- return $compound2;
- }
-
- if (! count($compound2)) {
- return $compound1;
- }
-
- // check that last part are compatible
- $lastPart1 = array_pop($compound1);
- $lastPart2 = array_pop($compound2);
- $last = $this->mergeParts($lastPart1, $lastPart2);
-
- if (! $last) {
- return [[]];
- }
-
- $unifiedCompound = [$last];
- $unifiedSelectors = [$unifiedCompound];
-
- // do the rest
- while (count($compound1) || count($compound2)) {
- $part1 = end($compound1);
- $part2 = end($compound2);
-
- if ($part1 && ($match2 = $this->matchPartInCompound($part1, $compound2))) {
- list($compound2, $part2, $after2) = $match2;
-
- if ($after2) {
- $unifiedSelectors = $this->prependSelectors($unifiedSelectors, $after2);
- }
-
- $c = $this->mergeParts($part1, $part2);
- $unifiedSelectors = $this->prependSelectors($unifiedSelectors, [$c]);
-
- $part1 = $part2 = null;
-
- array_pop($compound1);
- }
-
- if ($part2 && ($match1 = $this->matchPartInCompound($part2, $compound1))) {
- list($compound1, $part1, $after1) = $match1;
-
- if ($after1) {
- $unifiedSelectors = $this->prependSelectors($unifiedSelectors, $after1);
- }
-
- $c = $this->mergeParts($part2, $part1);
- $unifiedSelectors = $this->prependSelectors($unifiedSelectors, [$c]);
-
- $part1 = $part2 = null;
-
- array_pop($compound2);
- }
-
- $new = [];
-
- if ($part1 && $part2) {
- array_pop($compound1);
- array_pop($compound2);
-
- $s = $this->prependSelectors($unifiedSelectors, [$part2]);
- $new = array_merge($new, $this->prependSelectors($s, [$part1]));
- $s = $this->prependSelectors($unifiedSelectors, [$part1]);
- $new = array_merge($new, $this->prependSelectors($s, [$part2]));
- } elseif ($part1) {
- array_pop($compound1);
-
- $new = array_merge($new, $this->prependSelectors($unifiedSelectors, [$part1]));
- } elseif ($part2) {
- array_pop($compound2);
-
- $new = array_merge($new, $this->prependSelectors($unifiedSelectors, [$part2]));
- }
-
- if ($new) {
- $unifiedSelectors = $new;
- }
- }
-
- return $unifiedSelectors;
- }
-
- /**
- * Prepend each selector from $selectors with $parts
- *
- * @param array $selectors
- * @param array $parts
- *
- * @return array
- */
- protected function prependSelectors($selectors, $parts)
- {
- $new = [];
-
- foreach ($selectors as $compoundSelector) {
- array_unshift($compoundSelector, $parts);
-
- $new[] = $compoundSelector;
- }
-
- return $new;
- }
-
- /**
- * Try to find a matching part in a compound:
- * - with same html tag name
- * - with some class or id or something in common
- *
- * @param array $part
- * @param array $compound
- *
- * @return array|boolean
- */
- protected function matchPartInCompound($part, $compound)
- {
- $partTag = $this->findTagName($part);
- $before = $compound;
- $after = [];
-
- // try to find a match by tag name first
- while (count($before)) {
- $p = array_pop($before);
-
- if ($partTag && $partTag !== '*' && $partTag == $this->findTagName($p)) {
- return [$before, $p, $after];
- }
-
- $after[] = $p;
- }
-
- // try again matching a non empty intersection and a compatible tagname
- $before = $compound;
- $after = [];
-
- while (count($before)) {
- $p = array_pop($before);
-
- if ($this->checkCompatibleTags($partTag, $this->findTagName($p))) {
- if (count(array_intersect($part, $p))) {
- return [$before, $p, $after];
- }
- }
-
- $after[] = $p;
- }
-
- return false;
- }
-
- /**
- * Merge two part list taking care that
- * - the html tag is coming first - if any
- * - the :something are coming last
- *
- * @param array $parts1
- * @param array $parts2
- *
- * @return array
- */
- protected function mergeParts($parts1, $parts2)
- {
- $tag1 = $this->findTagName($parts1);
- $tag2 = $this->findTagName($parts2);
- $tag = $this->checkCompatibleTags($tag1, $tag2);
-
- // not compatible tags
- if ($tag === false) {
- return [];
- }
-
- if ($tag) {
- if ($tag1) {
- $parts1 = array_diff($parts1, [$tag1]);
- }
-
- if ($tag2) {
- $parts2 = array_diff($parts2, [$tag2]);
- }
- }
-
- $mergedParts = array_merge($parts1, $parts2);
- $mergedOrderedParts = [];
-
- foreach ($mergedParts as $part) {
- if (strpos($part, ':') === 0) {
- $mergedOrderedParts[] = $part;
- }
- }
-
- $mergedParts = array_diff($mergedParts, $mergedOrderedParts);
- $mergedParts = array_merge($mergedParts, $mergedOrderedParts);
-
- if ($tag) {
- array_unshift($mergedParts, $tag);
- }
-
- return $mergedParts;
- }
-
- /**
- * Check the compatibility between two tag names:
- * if both are defined they should be identical or one has to be '*'
- *
- * @param string $tag1
- * @param string $tag2
- *
- * @return array|boolean
- */
- protected function checkCompatibleTags($tag1, $tag2)
- {
- $tags = [$tag1, $tag2];
- $tags = array_unique($tags);
- $tags = array_filter($tags);
-
- if (count($tags) > 1) {
- $tags = array_diff($tags, ['*']);
- }
-
- // not compatible nodes
- if (count($tags) > 1) {
- return false;
- }
-
- return $tags;
- }
-
- /**
- * Find the html tag name in a selector parts list
- *
- * @param array $parts
- *
- * @return mixed|string
- */
- protected function findTagName($parts)
- {
- foreach ($parts as $part) {
- if (! preg_match('/^[\[.:#%_-]/', $part)) {
- return $part;
- }
- }
-
- return '';
- }
-
- protected static $libSimpleSelectors = ['selector'];
- protected function libSimpleSelectors($args)
- {
- $selector = reset($args);
- $selector = $this->getSelectorArg($selector);
-
- // remove selectors list layer, keeping the first one
- $selector = reset($selector);
-
- // remove parts list layer, keeping the first part
- $part = reset($selector);
-
- $listParts = [];
-
- foreach ($part as $p) {
- $listParts[] = [Type::T_STRING, '', [$p]];
- }
-
- return [Type::T_LIST, ',', $listParts];
+ return $args[0];
}
}
diff --git a/vendor/scssphp/scssphp/src/Compiler/Environment.php b/vendor/leafo/scssphp/src/Compiler/Environment.php
similarity index 58%
rename from vendor/scssphp/scssphp/src/Compiler/Environment.php
rename to vendor/leafo/scssphp/src/Compiler/Environment.php
index 03eb86a5..fe309dd3 100644
--- a/vendor/scssphp/scssphp/src/Compiler/Environment.php
+++ b/vendor/leafo/scssphp/src/Compiler/Environment.php
@@ -2,14 +2,14 @@
/**
* SCSSPHP
*
- * @copyright 2012-2019 Leaf Corcoran
+ * @copyright 2012-2018 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
- * @link http://scssphp.github.io/scssphp
+ * @link http://leafo.github.io/scssphp
*/
-namespace ScssPhp\ScssPhp\Compiler;
+namespace Leafo\ScssPhp\Compiler;
/**
* Compiler environment
@@ -19,12 +19,12 @@ namespace ScssPhp\ScssPhp\Compiler;
class Environment
{
/**
- * @var \ScssPhp\ScssPhp\Block
+ * @var \Leafo\ScssPhp\Block
*/
public $block;
/**
- * @var \ScssPhp\ScssPhp\Compiler\Environment
+ * @var \Leafo\ScssPhp\Compiler\Environment
*/
public $parent;
@@ -33,11 +33,6 @@ class Environment
*/
public $store;
- /**
- * @var array
- */
- public $storeUnreduced;
-
/**
* @var integer
*/
diff --git a/vendor/scssphp/scssphp/src/Exception/CompilerException.php b/vendor/leafo/scssphp/src/Exception/CompilerException.php
similarity index 65%
rename from vendor/scssphp/scssphp/src/Exception/CompilerException.php
rename to vendor/leafo/scssphp/src/Exception/CompilerException.php
index a9d134fc..7ca2e2b3 100644
--- a/vendor/scssphp/scssphp/src/Exception/CompilerException.php
+++ b/vendor/leafo/scssphp/src/Exception/CompilerException.php
@@ -2,14 +2,14 @@
/**
* SCSSPHP
*
- * @copyright 2012-2019 Leaf Corcoran
+ * @copyright 2012-2018 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
- * @link http://scssphp.github.io/scssphp
+ * @link http://leafo.github.io/scssphp
*/
-namespace ScssPhp\ScssPhp\Exception;
+namespace Leafo\ScssPhp\Exception;
/**
* Compiler exception
diff --git a/vendor/scssphp/scssphp/src/Exception/ParserException.php b/vendor/leafo/scssphp/src/Exception/ParserException.php
similarity index 64%
rename from vendor/scssphp/scssphp/src/Exception/ParserException.php
rename to vendor/leafo/scssphp/src/Exception/ParserException.php
index 2fa12dd7..6d64335f 100644
--- a/vendor/scssphp/scssphp/src/Exception/ParserException.php
+++ b/vendor/leafo/scssphp/src/Exception/ParserException.php
@@ -2,14 +2,14 @@
/**
* SCSSPHP
*
- * @copyright 2012-2019 Leaf Corcoran
+ * @copyright 2012-2018 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
- * @link http://scssphp.github.io/scssphp
+ * @link http://leafo.github.io/scssphp
*/
-namespace ScssPhp\ScssPhp\Exception;
+namespace Leafo\ScssPhp\Exception;
/**
* Parser Exception
diff --git a/vendor/scssphp/scssphp/src/Exception/RangeException.php b/vendor/leafo/scssphp/src/Exception/RangeException.php
similarity index 64%
rename from vendor/scssphp/scssphp/src/Exception/RangeException.php
rename to vendor/leafo/scssphp/src/Exception/RangeException.php
index ee36c97e..3ba6bf14 100644
--- a/vendor/scssphp/scssphp/src/Exception/RangeException.php
+++ b/vendor/leafo/scssphp/src/Exception/RangeException.php
@@ -2,14 +2,14 @@
/**
* SCSSPHP
*
- * @copyright 2012-2019 Leaf Corcoran
+ * @copyright 2012-2018 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
- * @link http://scssphp.github.io/scssphp
+ * @link http://leafo.github.io/scssphp
*/
-namespace ScssPhp\ScssPhp\Exception;
+namespace Leafo\ScssPhp\Exception;
/**
* Range exception
diff --git a/vendor/scssphp/scssphp/src/Exception/ServerException.php b/vendor/leafo/scssphp/src/Exception/ServerException.php
similarity index 64%
rename from vendor/scssphp/scssphp/src/Exception/ServerException.php
rename to vendor/leafo/scssphp/src/Exception/ServerException.php
index d4a207af..d0ed0842 100644
--- a/vendor/scssphp/scssphp/src/Exception/ServerException.php
+++ b/vendor/leafo/scssphp/src/Exception/ServerException.php
@@ -2,14 +2,14 @@
/**
* SCSSPHP
*
- * @copyright 2012-2019 Leaf Corcoran
+ * @copyright 2012-2018 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
- * @link http://scssphp.github.io/scssphp
+ * @link http://leafo.github.io/scssphp
*/
-namespace ScssPhp\ScssPhp\Exception;
+namespace Leafo\ScssPhp\Exception;
/**
* Server Exception
diff --git a/vendor/scssphp/scssphp/src/Formatter.php b/vendor/leafo/scssphp/src/Formatter.php
similarity index 63%
rename from vendor/scssphp/scssphp/src/Formatter.php
rename to vendor/leafo/scssphp/src/Formatter.php
index e1777045..b4f90aa9 100644
--- a/vendor/scssphp/scssphp/src/Formatter.php
+++ b/vendor/leafo/scssphp/src/Formatter.php
@@ -2,17 +2,17 @@
/**
* SCSSPHP
*
- * @copyright 2012-2019 Leaf Corcoran
+ * @copyright 2012-2018 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
- * @link http://scssphp.github.io/scssphp
+ * @link http://leafo.github.io/scssphp
*/
-namespace ScssPhp\ScssPhp;
+namespace Leafo\ScssPhp;
-use ScssPhp\ScssPhp\Formatter\OutputBlock;
-use ScssPhp\ScssPhp\SourceMap\SourceMapGenerator;
+use Leafo\ScssPhp\Formatter\OutputBlock;
+use Leafo\ScssPhp\SourceMap\SourceMapGenerator;
/**
* Base formatter
@@ -62,7 +62,7 @@ abstract class Formatter
public $keepSemicolons;
/**
- * @var \ScssPhp\ScssPhp\Formatter\OutputBlock
+ * @var \Leafo\ScssPhp\Formatter\OutputBlock
*/
protected $currentBlock;
@@ -77,15 +77,10 @@ abstract class Formatter
protected $currentColumn;
/**
- * @var \ScssPhp\ScssPhp\SourceMap\SourceMapGenerator
+ * @var \Leafo\ScssPhp\SourceMap\SourceMapGenerator
*/
protected $sourceMapGenerator;
- /**
- * @var string
- */
- protected $strippedSemicolon;
-
/**
* Initialize formatter
*
@@ -118,10 +113,30 @@ abstract class Formatter
return rtrim($name) . $this->assignSeparator . $value . ';';
}
+ /**
+ * Strip semi-colon appended by property(); it's a separator, not a terminator
+ *
+ * @api
+ *
+ * @param array $lines
+ */
+ public function stripSemicolon(&$lines)
+ {
+ if ($this->keepSemicolons) {
+ return;
+ }
+
+ if (($count = count($lines))
+ && substr($lines[$count - 1], -1) === ';'
+ ) {
+ $lines[$count - 1] = substr($lines[$count - 1], 0, -1);
+ }
+ }
+
/**
* Output lines inside a block
*
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
+ * @param \Leafo\ScssPhp\Formatter\OutputBlock $block
*/
protected function blockLines(OutputBlock $block)
{
@@ -139,7 +154,7 @@ abstract class Formatter
/**
* Output block selectors
*
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
+ * @param \Leafo\ScssPhp\Formatter\OutputBlock $block
*/
protected function blockSelectors(OutputBlock $block)
{
@@ -153,7 +168,7 @@ abstract class Formatter
/**
* Output block children
*
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
+ * @param \Leafo\ScssPhp\Formatter\OutputBlock $block
*/
protected function blockChildren(OutputBlock $block)
{
@@ -165,7 +180,7 @@ abstract class Formatter
/**
* Output non-empty block
*
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
+ * @param \Leafo\ScssPhp\Formatter\OutputBlock $block
*/
protected function block(OutputBlock $block)
{
@@ -194,10 +209,6 @@ abstract class Formatter
if (! empty($block->selectors)) {
$this->indentLevel--;
- if (! $this->keepSemicolons) {
- $this->strippedSemicolon = '';
- }
-
if (empty($block->children)) {
$this->write($this->break);
}
@@ -206,41 +217,13 @@ abstract class Formatter
}
}
- /**
- * Test and clean safely empty children
- *
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
- *
- * @return boolean
- */
- protected function testEmptyChildren($block)
- {
- $isEmpty = empty($block->lines);
-
- if ($block->children) {
- foreach ($block->children as $k => &$child) {
- if (! $this->testEmptyChildren($child)) {
- $isEmpty = false;
- continue;
- }
-
- if ($child->type === Type::T_MEDIA || $child->type === Type::T_DIRECTIVE) {
- $child->children = [];
- $child->selectors = null;
- }
- }
- }
-
- return $isEmpty;
- }
-
/**
* Entry point to formatting a block
*
* @api
*
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block An abstract syntax tree
- * @param \ScssPhp\ScssPhp\SourceMap\SourceMapGenerator|null $sourceMapGenerator Optional source map generator
+ * @param \Leafo\ScssPhp\Formatter\OutputBlock $block An abstract syntax tree
+ * @param \Leafo\ScssPhp\SourceMap\SourceMapGenerator|null $sourceMapGenerator Optional source map generator
*
* @return string
*/
@@ -249,13 +232,11 @@ abstract class Formatter
$this->sourceMapGenerator = null;
if ($sourceMapGenerator) {
- $this->currentLine = 1;
- $this->currentColumn = 0;
+ $this->currentLine = 1;
+ $this->currentColumn = 0;
$this->sourceMapGenerator = $sourceMapGenerator;
}
- $this->testEmptyChildren($block);
-
ob_start();
$this->block($block);
@@ -266,39 +247,16 @@ abstract class Formatter
}
/**
- * Output content
- *
* @param string $str
*/
protected function write($str)
{
- if (! empty($this->strippedSemicolon)) {
- echo $this->strippedSemicolon;
-
- $this->strippedSemicolon = '';
- }
-
- /*
- * Maybe Strip semi-colon appended by property(); it's a separator, not a terminator
- * will be striped for real before a closing, otherwise displayed unchanged starting the next write
- */
- if (! $this->keepSemicolons &&
- $str &&
- (strpos($str, ';') !== false) &&
- (substr($str, -1) === ';')
- ) {
- $str = substr($str, 0, -1);
-
- $this->strippedSemicolon = ';';
- }
-
if ($this->sourceMapGenerator) {
$this->sourceMapGenerator->addMapping(
$this->currentLine,
$this->currentColumn,
$this->currentBlock->sourceLine,
- //columns from parser are off by one
- $this->currentBlock->sourceColumn > 0 ? $this->currentBlock->sourceColumn - 1 : 0,
+ $this->currentBlock->sourceColumn - 1, //columns from parser are off by one
$this->currentBlock->sourceName
);
diff --git a/vendor/scssphp/scssphp/src/Formatter/Compact.php b/vendor/leafo/scssphp/src/Formatter/Compact.php
similarity index 81%
rename from vendor/scssphp/scssphp/src/Formatter/Compact.php
rename to vendor/leafo/scssphp/src/Formatter/Compact.php
index 591f0c92..4efa1a08 100644
--- a/vendor/scssphp/scssphp/src/Formatter/Compact.php
+++ b/vendor/leafo/scssphp/src/Formatter/Compact.php
@@ -2,16 +2,16 @@
/**
* SCSSPHP
*
- * @copyright 2012-2019 Leaf Corcoran
+ * @copyright 2012-2018 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
- * @link http://scssphp.github.io/scssphp
+ * @link http://leafo.github.io/scssphp
*/
-namespace ScssPhp\ScssPhp\Formatter;
+namespace Leafo\ScssPhp\Formatter;
-use ScssPhp\ScssPhp\Formatter;
+use Leafo\ScssPhp\Formatter;
/**
* Compact formatter
diff --git a/vendor/scssphp/scssphp/src/Formatter/Compressed.php b/vendor/leafo/scssphp/src/Formatter/Compressed.php
similarity index 64%
rename from vendor/scssphp/scssphp/src/Formatter/Compressed.php
rename to vendor/leafo/scssphp/src/Formatter/Compressed.php
index ec4722ea..1faa7e11 100644
--- a/vendor/scssphp/scssphp/src/Formatter/Compressed.php
+++ b/vendor/leafo/scssphp/src/Formatter/Compressed.php
@@ -2,17 +2,17 @@
/**
* SCSSPHP
*
- * @copyright 2012-2019 Leaf Corcoran
+ * @copyright 2012-2018 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
- * @link http://scssphp.github.io/scssphp
+ * @link http://leafo.github.io/scssphp
*/
-namespace ScssPhp\ScssPhp\Formatter;
+namespace Leafo\ScssPhp\Formatter;
-use ScssPhp\ScssPhp\Formatter;
-use ScssPhp\ScssPhp\Formatter\OutputBlock;
+use Leafo\ScssPhp\Formatter;
+use Leafo\ScssPhp\Formatter\OutputBlock;
/**
* Compressed formatter
@@ -59,23 +59,4 @@ class Compressed extends Formatter
$this->write($this->break);
}
}
-
- /**
- * Output block selectors
- *
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
- */
- protected function blockSelectors(OutputBlock $block)
- {
- $inner = $this->indentStr();
-
- $this->write(
- $inner
- . implode(
- $this->tagSeparator,
- str_replace([' > ', ' + ', ' ~ '], ['>', '+', '~'], $block->selectors)
- )
- . $this->open . $this->break
- );
- }
}
diff --git a/vendor/scssphp/scssphp/src/Formatter/Crunched.php b/vendor/leafo/scssphp/src/Formatter/Crunched.php
similarity index 61%
rename from vendor/scssphp/scssphp/src/Formatter/Crunched.php
rename to vendor/leafo/scssphp/src/Formatter/Crunched.php
index 51ccb516..42d77b5f 100644
--- a/vendor/scssphp/scssphp/src/Formatter/Crunched.php
+++ b/vendor/leafo/scssphp/src/Formatter/Crunched.php
@@ -2,17 +2,17 @@
/**
* SCSSPHP
*
- * @copyright 2012-2019 Leaf Corcoran
+ * @copyright 2012-2018 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
- * @link http://scssphp.github.io/scssphp
+ * @link http://leafo.github.io/scssphp
*/
-namespace ScssPhp\ScssPhp\Formatter;
+namespace Leafo\ScssPhp\Formatter;
-use ScssPhp\ScssPhp\Formatter;
-use ScssPhp\ScssPhp\Formatter\OutputBlock;
+use Leafo\ScssPhp\Formatter;
+use Leafo\ScssPhp\Formatter\OutputBlock;
/**
* Crunched formatter
@@ -57,23 +57,4 @@ class Crunched extends Formatter
$this->write($this->break);
}
}
-
- /**
- * Output block selectors
- *
- * @param \ScssPhp\ScssPhp\Formatter\OutputBlock $block
- */
- protected function blockSelectors(OutputBlock $block)
- {
- $inner = $this->indentStr();
-
- $this->write(
- $inner
- . implode(
- $this->tagSeparator,
- str_replace([' > ', ' + ', ' ~ '], ['>', '+', '~'], $block->selectors)
- )
- . $this->open . $this->break
- );
- }
}
diff --git a/vendor/scssphp/scssphp/src/Formatter/Debug.php b/vendor/leafo/scssphp/src/Formatter/Debug.php
similarity index 92%
rename from vendor/scssphp/scssphp/src/Formatter/Debug.php
rename to vendor/leafo/scssphp/src/Formatter/Debug.php
index 94e70c81..bfcbf41a 100644
--- a/vendor/scssphp/scssphp/src/Formatter/Debug.php
+++ b/vendor/leafo/scssphp/src/Formatter/Debug.php
@@ -2,17 +2,17 @@
/**
* SCSSPHP
*
- * @copyright 2012-2019 Leaf Corcoran
+ * @copyright 2012-2018 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
- * @link http://scssphp.github.io/scssphp
+ * @link http://leafo.github.io/scssphp
*/
-namespace ScssPhp\ScssPhp\Formatter;
+namespace Leafo\ScssPhp\Formatter;
-use ScssPhp\ScssPhp\Formatter;
-use ScssPhp\ScssPhp\Formatter\OutputBlock;
+use Leafo\ScssPhp\Formatter;
+use Leafo\ScssPhp\Formatter\OutputBlock;
/**
* Debug formatter
diff --git a/vendor/scssphp/scssphp/src/Formatter/Expanded.php b/vendor/leafo/scssphp/src/Formatter/Expanded.php
similarity index 81%
rename from vendor/scssphp/scssphp/src/Formatter/Expanded.php
rename to vendor/leafo/scssphp/src/Formatter/Expanded.php
index 9549c6cf..d8c1e887 100644
--- a/vendor/scssphp/scssphp/src/Formatter/Expanded.php
+++ b/vendor/leafo/scssphp/src/Formatter/Expanded.php
@@ -2,17 +2,17 @@
/**
* SCSSPHP
*
- * @copyright 2012-2019 Leaf Corcoran
+ * @copyright 2012-2018 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
- * @link http://scssphp.github.io/scssphp
+ * @link http://leafo.github.io/scssphp
*/
-namespace ScssPhp\ScssPhp\Formatter;
+namespace Leafo\ScssPhp\Formatter;
-use ScssPhp\ScssPhp\Formatter;
-use ScssPhp\ScssPhp\Formatter\OutputBlock;
+use Leafo\ScssPhp\Formatter;
+use Leafo\ScssPhp\Formatter\OutputBlock;
/**
* Expanded formatter
@@ -55,7 +55,7 @@ class Expanded extends Formatter
foreach ($block->lines as $index => $line) {
if (substr($line, 0, 2) === '/*') {
- $block->lines[$index] = preg_replace('/[\r\n]+/', $glue, $line);
+ $block->lines[$index] = preg_replace('/(\r|\n)+/', $glue, $line);
}
}
diff --git a/vendor/leafo/scssphp/src/Formatter/Nested.php b/vendor/leafo/scssphp/src/Formatter/Nested.php
new file mode 100644
index 00000000..8f72206f
--- /dev/null
+++ b/vendor/leafo/scssphp/src/Formatter/Nested.php
@@ -0,0 +1,201 @@
+
+ */
+class Nested extends Formatter
+{
+ /**
+ * @var integer
+ */
+ private $depth;
+
+ /**
+ * {@inheritdoc}
+ */
+ public function __construct()
+ {
+ $this->indentLevel = 0;
+ $this->indentChar = ' ';
+ $this->break = "\n";
+ $this->open = ' {';
+ $this->close = ' }';
+ $this->tagSeparator = ', ';
+ $this->assignSeparator = ': ';
+ $this->keepSemicolons = true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function indentStr()
+ {
+ $n = $this->depth - 1;
+
+ return str_repeat($this->indentChar, max($this->indentLevel + $n, 0));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function blockLines(OutputBlock $block)
+ {
+ $inner = $this->indentStr();
+
+ $glue = $this->break . $inner;
+
+ foreach ($block->lines as $index => $line) {
+ if (substr($line, 0, 2) === '/*') {
+ $block->lines[$index] = preg_replace('/(\r|\n)+/', $glue, $line);
+ }
+ }
+
+ $this->write($inner . implode($glue, $block->lines));
+
+ if (! empty($block->children)) {
+ $this->write($this->break);
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function blockSelectors(OutputBlock $block)
+ {
+ $inner = $this->indentStr();
+
+ $this->write($inner
+ . implode($this->tagSeparator, $block->selectors)
+ . $this->open . $this->break);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function blockChildren(OutputBlock $block)
+ {
+ foreach ($block->children as $i => $child) {
+ $this->block($child);
+
+ if ($i < count($block->children) - 1) {
+ $this->write($this->break);
+
+ if (isset($block->children[$i + 1])) {
+ $next = $block->children[$i + 1];
+
+ if ($next->depth === max($block->depth, 1) && $child->depth >= $next->depth) {
+ $this->write($this->break);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function block(OutputBlock $block)
+ {
+ if ($block->type === 'root') {
+ $this->adjustAllChildren($block);
+ }
+
+ if (empty($block->lines) && empty($block->children)) {
+ return;
+ }
+
+ $this->currentBlock = $block;
+
+
+ $this->depth = $block->depth;
+
+ if (! empty($block->selectors)) {
+ $this->blockSelectors($block);
+
+ $this->indentLevel++;
+ }
+
+ if (! empty($block->lines)) {
+ $this->blockLines($block);
+ }
+
+ if (! empty($block->children)) {
+ $this->blockChildren($block);
+ }
+
+ if (! empty($block->selectors)) {
+ $this->indentLevel--;
+
+ $this->write($this->close);
+ }
+
+ if ($block->type === 'root') {
+ $this->write($this->break);
+ }
+ }
+
+ /**
+ * Adjust the depths of all children, depth first
+ *
+ * @param \Leafo\ScssPhp\Formatter\OutputBlock $block
+ */
+ private function adjustAllChildren(OutputBlock $block)
+ {
+ // flatten empty nested blocks
+ $children = [];
+
+ foreach ($block->children as $i => $child) {
+ if (empty($child->lines) && empty($child->children)) {
+ if (isset($block->children[$i + 1])) {
+ $block->children[$i + 1]->depth = $child->depth;
+ }
+
+ continue;
+ }
+
+ $children[] = $child;
+ }
+
+ $count = count($children);
+
+ for ($i = 0; $i < $count; $i++) {
+ $depth = $children[$i]->depth;
+ $j = $i + 1;
+
+ if (isset($children[$j]) && $depth < $children[$j]->depth) {
+ $childDepth = $children[$j]->depth;
+
+ for (; $j < $count; $j++) {
+ if ($depth < $children[$j]->depth && $childDepth >= $children[$j]->depth) {
+ $children[$j]->depth = $depth + 1;
+ }
+ }
+ }
+ }
+
+ $block->children = $children;
+
+ // make relative to parent
+ foreach ($block->children as $child) {
+ $this->adjustAllChildren($child);
+
+ $child->depth = $child->depth - $block->depth;
+ }
+ }
+}
diff --git a/vendor/scssphp/scssphp/src/Formatter/OutputBlock.php b/vendor/leafo/scssphp/src/Formatter/OutputBlock.php
similarity index 80%
rename from vendor/scssphp/scssphp/src/Formatter/OutputBlock.php
rename to vendor/leafo/scssphp/src/Formatter/OutputBlock.php
index 3e6fd928..5eb589c9 100644
--- a/vendor/scssphp/scssphp/src/Formatter/OutputBlock.php
+++ b/vendor/leafo/scssphp/src/Formatter/OutputBlock.php
@@ -2,14 +2,14 @@
/**
* SCSSPHP
*
- * @copyright 2012-2019 Leaf Corcoran
+ * @copyright 2012-2018 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
- * @link http://scssphp.github.io/scssphp
+ * @link http://leafo.github.io/scssphp
*/
-namespace ScssPhp\ScssPhp\Formatter;
+namespace Leafo\ScssPhp\Formatter;
/**
* Output block
@@ -44,7 +44,7 @@ class OutputBlock
public $children;
/**
- * @var \ScssPhp\ScssPhp\Formatter\OutputBlock
+ * @var \Leafo\ScssPhp\Formatter\OutputBlock
*/
public $parent;
diff --git a/vendor/scssphp/scssphp/src/Node.php b/vendor/leafo/scssphp/src/Node.php
similarity index 79%
rename from vendor/scssphp/scssphp/src/Node.php
rename to vendor/leafo/scssphp/src/Node.php
index dab565a6..b9f7945a 100644
--- a/vendor/scssphp/scssphp/src/Node.php
+++ b/vendor/leafo/scssphp/src/Node.php
@@ -2,14 +2,14 @@
/**
* SCSSPHP
*
- * @copyright 2012-2019 Leaf Corcoran
+ * @copyright 2012-2018 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
- * @link http://scssphp.github.io/scssphp
+ * @link http://leafo.github.io/scssphp
*/
-namespace ScssPhp\ScssPhp;
+namespace Leafo\ScssPhp;
/**
* Base node
diff --git a/vendor/scssphp/scssphp/src/Node/Number.php b/vendor/leafo/scssphp/src/Node/Number.php
similarity index 93%
rename from vendor/scssphp/scssphp/src/Node/Number.php
rename to vendor/leafo/scssphp/src/Node/Number.php
index acbabff7..42c16803 100644
--- a/vendor/scssphp/scssphp/src/Node/Number.php
+++ b/vendor/leafo/scssphp/src/Node/Number.php
@@ -2,18 +2,18 @@
/**
* SCSSPHP
*
- * @copyright 2012-2019 Leaf Corcoran
+ * @copyright 2012-2018 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
- * @link http://scssphp.github.io/scssphp
+ * @link http://leafo.github.io/scssphp
*/
-namespace ScssPhp\ScssPhp\Node;
+namespace Leafo\ScssPhp\Node;
-use ScssPhp\ScssPhp\Compiler;
-use ScssPhp\ScssPhp\Node;
-use ScssPhp\ScssPhp\Type;
+use Leafo\ScssPhp\Compiler;
+use Leafo\ScssPhp\Node;
+use Leafo\ScssPhp\Type;
/**
* Dimension + optional units
@@ -100,7 +100,7 @@ class Number extends Node implements \ArrayAccess
*
* @param array $units
*
- * @return \ScssPhp\ScssPhp\Node\Number
+ * @return \Leafo\ScssPhp\Node\Number
*/
public function coerce($units)
{
@@ -123,7 +123,7 @@ class Number extends Node implements \ArrayAccess
/**
* Normalize number
*
- * @return \ScssPhp\ScssPhp\Node\Number
+ * @return \Leafo\ScssPhp\Node\Number
*/
public function normalize()
{
@@ -141,17 +141,17 @@ class Number extends Node implements \ArrayAccess
public function offsetExists($offset)
{
if ($offset === -3) {
- return ! is_null($this->sourceColumn);
+ return $this->sourceColumn !== null;
}
if ($offset === -2) {
- return ! is_null($this->sourceLine);
+ return $this->sourceLine !== null;
}
- if ($offset === -1 ||
- $offset === 0 ||
- $offset === 1 ||
- $offset === 2
+ if ($offset === -1
+ || $offset === 0
+ || $offset === 1
+ || $offset === 2
) {
return true;
}
@@ -259,7 +259,7 @@ class Number extends Node implements \ArrayAccess
/**
* Output number
*
- * @param \ScssPhp\ScssPhp\Compiler $compiler
+ * @param \Leafo\ScssPhp\Compiler $compiler
*
* @return string
*/
diff --git a/vendor/scssphp/scssphp/src/Parser.php b/vendor/leafo/scssphp/src/Parser.php
similarity index 57%
rename from vendor/scssphp/scssphp/src/Parser.php
rename to vendor/leafo/scssphp/src/Parser.php
index 6a30af12..de86f094 100644
--- a/vendor/scssphp/scssphp/src/Parser.php
+++ b/vendor/leafo/scssphp/src/Parser.php
@@ -2,21 +2,20 @@
/**
* SCSSPHP
*
- * @copyright 2012-2019 Leaf Corcoran
+ * @copyright 2012-2018 Leaf Corcoran
*
* @license http://opensource.org/licenses/MIT MIT
*
- * @link http://scssphp.github.io/scssphp
+ * @link http://leafo.github.io/scssphp
*/
-namespace ScssPhp\ScssPhp;
+namespace Leafo\ScssPhp;
-use ScssPhp\ScssPhp\Block;
-use ScssPhp\ScssPhp\Cache;
-use ScssPhp\ScssPhp\Compiler;
-use ScssPhp\ScssPhp\Exception\ParserException;
-use ScssPhp\ScssPhp\Node;
-use ScssPhp\ScssPhp\Type;
+use Leafo\ScssPhp\Block;
+use Leafo\ScssPhp\Compiler;
+use Leafo\ScssPhp\Exception\ParserException;
+use Leafo\ScssPhp\Node;
+use Leafo\ScssPhp\Type;
/**
* Parser
@@ -54,8 +53,6 @@ class Parser
protected static $operatorPattern;
protected static $whitePattern;
- protected $cache;
-
private $sourceName;
private $sourceIndex;
private $sourcePositions;
@@ -64,32 +61,27 @@ class Parser
private $env;
private $inParens;
private $eatWhiteDefault;
- private $discardComments;
private $buffer;
private $utf8;
private $encoding;
private $patternModifiers;
- private $commentsSeen;
/**
* Constructor
*
* @api
*
- * @param string $sourceName
- * @param integer $sourceIndex
- * @param string $encoding
- * @param \ScssPhp\ScssPhp\Cache $cache
+ * @param string $sourceName
+ * @param integer $sourceIndex
+ * @param string $encoding
*/
- public function __construct($sourceName, $sourceIndex = 0, $encoding = 'utf-8', $cache = null)
+ public function __construct($sourceName, $sourceIndex = 0, $encoding = 'utf-8')
{
$this->sourceName = $sourceName ?: '(stdin)';
$this->sourceIndex = $sourceIndex;
$this->charset = null;
$this->utf8 = ! $encoding || strtolower($encoding) === 'utf-8';
$this->patternModifiers = $this->utf8 ? 'Aisu' : 'Ais';
- $this->commentsSeen = [];
- $this->discardComments = false;
if (empty(static::$operatorPattern)) {
static::$operatorPattern = '([*\/%+-]|[!=]\=|\>\=?|\<\=\>|\<\=?|and|or)';
@@ -103,10 +95,6 @@ class Parser
? '/' . $commentSingle . '[^\n]*\s*|(' . static::$commentPattern . ')\s*|\s+/AisuS'
: '/' . $commentSingle . '[^\n]*\s*|(' . static::$commentPattern . ')\s*|\s+/AisS';
}
-
- if ($cache) {
- $this->cache = $cache;
- }
}
/**
@@ -128,15 +116,13 @@ class Parser
*
* @param string $msg
*
- * @throws \ScssPhp\ScssPhp\Exception\ParserException
+ * @throws \Leafo\ScssPhp\Exception\ParserException
*/
public function throwParseError($msg = 'parse error')
{
- list($line, $column) = $this->getSourcePosition($this->count);
+ list($line, /* $column */) = $this->getSourcePosition($this->count);
- $loc = empty($this->sourceName)
- ? "line: $line, column: $column"
- : "$this->sourceName on line $line, at column $column";
+ $loc = empty($this->sourceName) ? "line: $line" : "$this->sourceName on line $line";
if ($this->peek("(.*?)(\n|$)", $m, $this->count)) {
throw new ParserException("$msg: failed at `$m[1]` $loc");
@@ -152,23 +138,10 @@ class Parser
*
* @param string $buffer
*
- * @return \ScssPhp\ScssPhp\Block
+ * @return \Leafo\ScssPhp\Block
*/
public function parse($buffer)
{
- if ($this->cache) {
- $cacheKey = $this->sourceName . ":" . md5($buffer);
- $parseOptions = [
- 'charset' => $this->charset,
- 'utf8' => $this->utf8,
- ];
- $v = $this->cache->getCache("parse", $cacheKey, $parseOptions);
-
- if (! is_null($v)) {
- return $v;
- }
- }
-
// strip BOM (byte order marker)
if (substr($buffer, 0, 3) === "\xef\xbb\xbf") {
$buffer = substr($buffer, 3);
@@ -204,11 +177,9 @@ class Parser
array_unshift($this->env->children, $this->charset);
}
- $this->restoreEncoding();
+ $this->env->isRoot = true;
- if ($this->cache) {
- $this->cache->setCache("parse", $cacheKey, $this->env, $parseOptions);
- }
+ $this->restoreEncoding();
return $this->env;
}
@@ -218,8 +189,8 @@ class Parser
*
* @api
*
- * @param string $buffer
- * @param string|array $out
+ * @param string $buffer
+ * @param string $out
*
* @return boolean
*/
@@ -245,8 +216,8 @@ class Parser
*
* @api
*
- * @param string $buffer
- * @param string|array $out
+ * @param string $buffer
+ * @param string $out
*
* @return boolean
*/
@@ -267,33 +238,6 @@ class Parser
return $selector;
}
- /**
- * Parse a media Query
- *
- * @api
- *
- * @param string $buffer
- * @param string|array $out
- *
- * @return boolean
- */
- public function parseMediaQueryList($buffer, &$out)
- {
- $this->count = 0;
- $this->env = null;
- $this->inParens = false;
- $this->eatWhiteDefault = true;
- $this->buffer = (string) $buffer;
-
- $this->saveEncoding();
-
- $isMediaQuery = $this->mediaQueryList($out);
-
- $this->restoreEncoding();
-
- return $isMediaQuery;
- }
-
/**
* Parse a single chunk off the head of the buffer and append it to the
* current parse environment.
@@ -327,7 +271,7 @@ class Parser
* the buffer position will be left at an invalid state. In order to
* avoid this, Compiler::seek() is used to remember and set buffer positions.
*
- * Before parsing a chain, use $s = $this->count to remember the current
+ * Before parsing a chain, use $s = $this->seek() to remember the current
* position into $s. Then if a chain fails, use $this->seek($s) to
* go back where we started.
*
@@ -335,28 +279,25 @@ class Parser
*/
protected function parseChunk()
{
- $s = $this->count;
+ $s = $this->seek();
// the directives
if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] === '@') {
- if ($this->literal('@at-root', 8) &&
+ if ($this->literal('@at-root') &&
($this->selectors($selector) || true) &&
($this->map($with) || true) &&
- (($this->matchChar('(')
- && $this->interpolation($with)
- && $this->matchChar(')')) || true) &&
- $this->matchChar('{', false)
+ $this->literal('{')
) {
$atRoot = $this->pushSpecialBlock(Type::T_AT_ROOT, $s);
$atRoot->selector = $selector;
- $atRoot->with = $with;
+ $atRoot->with = $with;
return true;
}
$this->seek($s);
- if ($this->literal('@media', 6) && $this->mediaQueryList($mediaQueryList) && $this->matchChar('{', false)) {
+ if ($this->literal('@media') && $this->mediaQueryList($mediaQueryList) && $this->literal('{')) {
$media = $this->pushSpecialBlock(Type::T_MEDIA, $s);
$media->queryList = $mediaQueryList[2];
@@ -365,10 +306,10 @@ class Parser
$this->seek($s);
- if ($this->literal('@mixin', 6) &&
+ if ($this->literal('@mixin') &&
$this->keyword($mixinName) &&
($this->argumentDef($args) || true) &&
- $this->matchChar('{', false)
+ $this->literal('{')
) {
$mixin = $this->pushSpecialBlock(Type::T_MIXIN, $s);
$mixin->name = $mixinName;
@@ -379,24 +320,15 @@ class Parser
$this->seek($s);
- if ($this->literal('@include', 8) &&
+ if ($this->literal('@include') &&
$this->keyword($mixinName) &&
- ($this->matchChar('(') &&
+ ($this->literal('(') &&
($this->argValues($argValues) || true) &&
- $this->matchChar(')') || true) &&
+ $this->literal(')') || true) &&
($this->end() ||
- ($this->literal('using', 5) &&
- $this->argumentDef($argUsing) &&
- ($this->end() || $this->matchChar('{') && $hasBlock = true)) ||
- $this->matchChar('{') && $hasBlock = true)
+ $this->literal('{') && $hasBlock = true)
) {
- $child = [
- Type::T_INCLUDE,
- $mixinName,
- isset($argValues) ? $argValues : null,
- null,
- isset($argUsing) ? $argUsing : null
- ];
+ $child = [Type::T_INCLUDE, $mixinName, isset($argValues) ? $argValues : null, null];
if (! empty($hasBlock)) {
$include = $this->pushSpecialBlock(Type::T_INCLUDE, $s);
@@ -410,7 +342,7 @@ class Parser
$this->seek($s);
- if ($this->literal('@scssphp-import-once', 20) &&
+ if ($this->literal('@scssphp-import-once') &&
$this->valueList($importPath) &&
$this->end()
) {
@@ -421,7 +353,7 @@ class Parser
$this->seek($s);
- if ($this->literal('@import', 7) &&
+ if ($this->literal('@import') &&
$this->valueList($importPath) &&
$this->end()
) {
@@ -432,7 +364,7 @@ class Parser
$this->seek($s);
- if ($this->literal('@import', 7) &&
+ if ($this->literal('@import') &&
$this->url($importPath) &&
$this->end()
) {
@@ -443,7 +375,7 @@ class Parser
$this->seek($s);
- if ($this->literal('@extend', 7) &&
+ if ($this->literal('@extend') &&
$this->selectors($selectors) &&
$this->end()
) {
@@ -456,10 +388,10 @@ class Parser
$this->seek($s);
- if ($this->literal('@function', 9) &&
+ if ($this->literal('@function') &&
$this->keyword($fnName) &&
$this->argumentDef($args) &&
- $this->matchChar('{', false)
+ $this->literal('{')
) {
$func = $this->pushSpecialBlock(Type::T_FUNCTION, $s);
$func->name = $fnName;
@@ -470,7 +402,7 @@ class Parser
$this->seek($s);
- if ($this->literal('@break', 6) && $this->end()) {
+ if ($this->literal('@break') && $this->end()) {
$this->append([Type::T_BREAK], $s);
return true;
@@ -478,7 +410,7 @@ class Parser
$this->seek($s);
- if ($this->literal('@continue', 9) && $this->end()) {
+ if ($this->literal('@continue') && $this->end()) {
$this->append([Type::T_CONTINUE], $s);
return true;
@@ -486,7 +418,8 @@ class Parser
$this->seek($s);
- if ($this->literal('@return', 7) && ($this->valueList($retVal) || true) && $this->end()) {
+
+ if ($this->literal('@return') && ($this->valueList($retVal) || true) && $this->end()) {
$this->append([Type::T_RETURN, isset($retVal) ? $retVal : [Type::T_NULL]], $s);
return true;
@@ -494,11 +427,11 @@ class Parser
$this->seek($s);
- if ($this->literal('@each', 5) &&
+ if ($this->literal('@each') &&
$this->genericList($varNames, 'variable', ',', false) &&
- $this->literal('in', 2) &&
+ $this->literal('in') &&
$this->valueList($list) &&
- $this->matchChar('{', false)
+ $this->literal('{')
) {
$each = $this->pushSpecialBlock(Type::T_EACH, $s);
@@ -513,9 +446,9 @@ class Parser
$this->seek($s);
- if ($this->literal('@while', 6) &&
+ if ($this->literal('@while') &&
$this->expression($cond) &&
- $this->matchChar('{', false)
+ $this->literal('{')
) {
$while = $this->pushSpecialBlock(Type::T_WHILE, $s);
$while->cond = $cond;
@@ -525,19 +458,19 @@ class Parser
$this->seek($s);
- if ($this->literal('@for', 4) &&
+ if ($this->literal('@for') &&
$this->variable($varName) &&
- $this->literal('from', 4) &&
+ $this->literal('from') &&
$this->expression($start) &&
- ($this->literal('through', 7) ||
- ($forUntil = true && $this->literal('to', 2))) &&
+ ($this->literal('through') ||
+ ($forUntil = true && $this->literal('to'))) &&
$this->expression($end) &&
- $this->matchChar('{', false)
+ $this->literal('{')
) {
$for = $this->pushSpecialBlock(Type::T_FOR, $s);
- $for->var = $varName[1];
+ $for->var = $varName[1];
$for->start = $start;
- $for->end = $end;
+ $for->end = $end;
$for->until = isset($forUntil);
return true;
@@ -545,15 +478,9 @@ class Parser
$this->seek($s);
- if ($this->literal('@if', 3) && $this->valueList($cond) && $this->matchChar('{', false)) {
+ if ($this->literal('@if') && $this->valueList($cond) && $this->literal('{')) {
$if = $this->pushSpecialBlock(Type::T_IF, $s);
- while ($cond[0] === Type::T_LIST
- && !empty($cond['enclosing'])
- && $cond['enclosing'] === 'parent'
- && count($cond[2]) == 1) {
- $cond = reset($cond[2]);
- }
- $if->cond = $cond;
+ $if->cond = $cond;
$if->cases = [];
return true;
@@ -561,7 +488,7 @@ class Parser
$this->seek($s);
- if ($this->literal('@debug', 6) &&
+ if ($this->literal('@debug') &&
$this->valueList($value) &&
$this->end()
) {
@@ -572,7 +499,7 @@ class Parser
$this->seek($s);
- if ($this->literal('@warn', 5) &&
+ if ($this->literal('@warn') &&
$this->valueList($value) &&
$this->end()
) {
@@ -583,7 +510,7 @@ class Parser
$this->seek($s);
- if ($this->literal('@error', 6) &&
+ if ($this->literal('@error') &&
$this->valueList($value) &&
$this->end()
) {
@@ -594,15 +521,8 @@ class Parser
$this->seek($s);
- #if ($this->literal('@content', 8))
-
- if ($this->literal('@content', 8) &&
- ($this->end() ||
- $this->matchChar('(') &&
- $this->argValues($argContent) &&
- $this->matchChar(')') &&
- $this->end())) {
- $this->append([Type::T_MIXIN_CONTENT, isset($argContent) ? $argContent : null], $s);
+ if ($this->literal('@content') && $this->end()) {
+ $this->append([Type::T_MIXIN_CONTENT], $s);
return true;
}
@@ -614,10 +534,10 @@ class Parser
if (isset($last) && $last[0] === Type::T_IF) {
list(, $if) = $last;
- if ($this->literal('@else', 5)) {
- if ($this->matchChar('{', false)) {
+ if ($this->literal('@else')) {
+ if ($this->literal('{')) {
$else = $this->pushSpecialBlock(Type::T_ELSE, $s);
- } elseif ($this->literal('if', 2) && $this->valueList($cond) && $this->matchChar('{', false)) {
+ } elseif ($this->literal('if') && $this->valueList($cond) && $this->literal('{')) {
$else = $this->pushSpecialBlock(Type::T_ELSEIF, $s);
$else->cond = $cond;
}
@@ -634,7 +554,7 @@ class Parser
}
// only retain the first @charset directive encountered
- if ($this->literal('@charset', 8) &&
+ if ($this->literal('@charset') &&
$this->valueList($charset) &&
$this->end()
) {
@@ -655,24 +575,11 @@ class Parser
$this->seek($s);
- if ($this->literal('@supports', 9) &&
- ($t1=$this->supportsQuery($supportQuery)) &&
- ($t2=$this->matchChar('{', false))
- ) {
- $directive = $this->pushSpecialBlock(Type::T_DIRECTIVE, $s);
- $directive->name = 'supports';
- $directive->value = $supportQuery;
-
- return true;
- }
-
- $this->seek($s);
-
// doesn't match built in directive, do generic one
- if ($this->matchChar('@', false) &&
+ if ($this->literal('@', false) &&
$this->keyword($dirName) &&
($this->variable($dirValue) || $this->openString('{', $dirValue) || true) &&
- $this->matchChar('{', false)
+ $this->literal('{')
) {
if ($dirName === 'media') {
$directive = $this->pushSpecialBlock(Type::T_MEDIA, $s);
@@ -690,26 +597,13 @@ class Parser
$this->seek($s);
- // maybe it's a generic blockless directive
- if ($this->matchChar('@', false) &&
- $this->keyword($dirName) &&
- $this->valueList($dirValue) &&
- $this->end()
- ) {
- $this->append([Type::T_DIRECTIVE, [$dirName, $dirValue]], $s);
-
- return true;
- }
-
- $this->seek($s);
-
return false;
}
// property shortcut
// captures most properties before having to parse a selector
if ($this->keyword($name, false) &&
- $this->literal(': ', 2) &&
+ $this->literal(': ') &&
$this->valueList($value) &&
$this->end()
) {
@@ -723,7 +617,7 @@ class Parser
// variable assigns
if ($this->variable($name) &&
- $this->matchChar(':') &&
+ $this->literal(':') &&
$this->valueList($value) &&
$this->end()
) {
@@ -737,42 +631,31 @@ class Parser
$this->seek($s);
// misc
- if ($this->literal('-->', 3)) {
+ if ($this->literal('-->')) {
return true;
}
// opening css block
- if ($this->selectors($selectors) && $this->matchChar('{', false)) {
+ if ($this->selectors($selectors) && $this->literal('{')) {
$this->pushBlock($selectors, $s);
- if ($this->eatWhiteDefault) {
- $this->whitespace();
- $this->append(null); // collect comments at the beginning if needed
- }
-
return true;
}
$this->seek($s);
// property assign, or nested assign
- if ($this->propertyName($name) && $this->matchChar(':')) {
+ if ($this->propertyName($name) && $this->literal(':')) {
$foundSomething = false;
if ($this->valueList($value)) {
- if (empty($this->env->parent)) {
- $this->throwParseError('expected "{"');
- }
-
$this->append([Type::T_ASSIGN, $name, $value], $s);
$foundSomething = true;
}
- if ($this->matchChar('{', false)) {
+ if ($this->literal('{')) {
$propBlock = $this->pushSpecialBlock(Type::T_NESTED_PROPERTY, $s);
$propBlock->prefix = $name;
- $propBlock->hasValue = $foundSomething;
-
$foundSomething = true;
} elseif ($foundSomething) {
$foundSomething = $this->end();
@@ -786,15 +669,9 @@ class Parser
$this->seek($s);
// closing a block
- if ($this->matchChar('}', false)) {
+ if ($this->literal('}')) {
$block = $this->popBlock();
- if (! isset($block->type) || $block->type !== Type::T_IF) {
- if ($this->env->parent) {
- $this->append(null); // collect comments before next statement if needed
- }
- }
-
if (isset($block->type) && $block->type === Type::T_INCLUDE) {
$include = $block->child;
unset($block->child);
@@ -805,21 +682,12 @@ class Parser
$this->append([$type, $block], $s);
}
- // collect comments just after the block closing if needed
- if ($this->eatWhiteDefault) {
- $this->whitespace();
-
- if ($this->env->comments) {
- $this->append(null);
- }
- }
-
return true;
}
// extra stuff
- if ($this->matchChar(';') ||
- $this->literal('