From 99c1331867c964332138f7bc08984259596cf2c5 Mon Sep 17 00:00:00 2001 From: Maxime St-Pierre Date: Fri, 23 Feb 2018 00:10:19 -0500 Subject: [PATCH] Add composer as dependency manager --- autoload.php | 2 +- composer.json | 10 +- dev.sh | 2 + docker.sh | 3 +- lib/vendor/Emogrifier.class.php | 1501 ----- lib/vendor/Parsedown.class.php | 1538 ----- lib/vendor/ParsedownExtra.class.php | 526 -- lib/vendor/Spyc.class.php | 1155 ---- lib/vendor/scss/Base/Range.class.php | 47 - lib/vendor/scss/Block.class.php | 65 - lib/vendor/scss/Colors.class.php | 179 - lib/vendor/scss/Compiler.class.php | 5326 ----------------- .../scss/Compiler/Environment.class.php | 40 - .../Exception/CompilerException.class.php | 21 - .../scss/Exception/ParserException.class.php | 21 - .../scss/Exception/RangeException.class.php | 21 - .../scss/Exception/ServerException.class.php | 21 - lib/vendor/scss/Formatter.class.php | 274 - lib/vendor/scss/Formatter/Compact.class.php | 45 - .../scss/Formatter/Compressed.class.php | 62 - lib/vendor/scss/Formatter/Crunched.class.php | 60 - lib/vendor/scss/Formatter/Debug.class.php | 121 - lib/vendor/scss/Formatter/Expanded.class.php | 68 - lib/vendor/scss/Formatter/Nested.class.php | 201 - .../scss/Formatter/OutputBlock.class.php | 65 - lib/vendor/scss/Node.class.php | 40 - lib/vendor/scss/Node/Number.class.php | 330 - lib/vendor/scss/Parser.class.php | 2494 -------- .../scss/SourceMap/Base64VLQEncoder.class.php | 217 - .../SourceMap/SourceMapGenerator.class.php | 337 -- lib/vendor/scss/Type.class.php | 69 - lib/vendor/scss/Util.class.php | 70 - lib/vendor/scss/Version.class.php | 22 - update.php | 3 +- 34 files changed, 15 insertions(+), 14941 deletions(-) delete mode 100644 lib/vendor/Emogrifier.class.php delete mode 100644 lib/vendor/Parsedown.class.php delete mode 100644 lib/vendor/ParsedownExtra.class.php delete mode 100644 lib/vendor/Spyc.class.php delete mode 100644 lib/vendor/scss/Base/Range.class.php delete mode 100644 lib/vendor/scss/Block.class.php delete mode 100644 lib/vendor/scss/Colors.class.php delete mode 100644 lib/vendor/scss/Compiler.class.php delete mode 100644 lib/vendor/scss/Compiler/Environment.class.php delete mode 100644 lib/vendor/scss/Exception/CompilerException.class.php delete mode 100644 lib/vendor/scss/Exception/ParserException.class.php delete mode 100644 lib/vendor/scss/Exception/RangeException.class.php delete mode 100644 lib/vendor/scss/Exception/ServerException.class.php delete mode 100644 lib/vendor/scss/Formatter.class.php delete mode 100644 lib/vendor/scss/Formatter/Compact.class.php delete mode 100644 lib/vendor/scss/Formatter/Compressed.class.php delete mode 100644 lib/vendor/scss/Formatter/Crunched.class.php delete mode 100644 lib/vendor/scss/Formatter/Debug.class.php delete mode 100644 lib/vendor/scss/Formatter/Expanded.class.php delete mode 100644 lib/vendor/scss/Formatter/Nested.class.php delete mode 100644 lib/vendor/scss/Formatter/OutputBlock.class.php delete mode 100644 lib/vendor/scss/Node.class.php delete mode 100644 lib/vendor/scss/Node/Number.class.php delete mode 100644 lib/vendor/scss/Parser.class.php delete mode 100644 lib/vendor/scss/SourceMap/Base64VLQEncoder.class.php delete mode 100644 lib/vendor/scss/SourceMap/SourceMapGenerator.class.php delete mode 100644 lib/vendor/scss/Type.class.php delete mode 100644 lib/vendor/scss/Util.class.php delete mode 100644 lib/vendor/scss/Version.class.php diff --git a/autoload.php b/autoload.php index 53f5ceed..d25383f7 100644 --- a/autoload.php +++ b/autoload.php @@ -39,7 +39,7 @@ class Autoloader $dir = new RecursiveDirectoryIterator(ROOT_DIR, RecursiveDirectoryIterator::SKIP_DOTS); $ite = new RecursiveIteratorIterator($dir); - $pathIterator = new RegexIterator($ite, '/.*\.class\.php$/', RegexIterator::GET_MATCH); + $pathIterator = new RegexIterator($ite, '/.*\.php$/', RegexIterator::GET_MATCH); foreach($pathIterator as $paths) { foreach($paths as $path) diff --git a/composer.json b/composer.json index 9ecee711..0a087866 100644 --- a/composer.json +++ b/composer.json @@ -4,6 +4,12 @@ "php": ">=7.0", "ext-curl": "*", "ext-mbstring": "*", - "ext-xml": "*" + "ext-xml": "*", + "leafo/scssphp": "0.7.4", + "erusev/parsedown": "^1.6", + "erusev/parsedown-extra": "^0.7.1", + "pelago/emogrifier": "^2.0", + "mustangostang/spyc": "^0.6.2", + "phpunit/phpunit": "^6.5" } -} \ No newline at end of file +} diff --git a/dev.sh b/dev.sh index 06fe5fb4..891beed6 100755 --- a/dev.sh +++ b/dev.sh @@ -13,4 +13,6 @@ if ! which $PHPBIN 2>/dev/null; then PHPBIN=php fi +$PHPBIN composer.phar install + $PHPBIN --server localhost:8000 --docroot "$DIR/web" "$DIR/web/index.php" diff --git a/docker.sh b/docker.sh index 7bf021df..72f4572c 100755 --- a/docker.sh +++ b/docker.sh @@ -13,4 +13,5 @@ docker run --rm -it --name "dev.lbry.io" \ -p "127.0.0.1:8000:8000" \ -u "$(id -u):$(id -g)" \ php:7-alpine \ - php --server "0.0.0.0:8000" --docroot "web/" "web/index.php" + php composer.phar install + php --server "0.0.0.0:8000" --docroot "web/" "index.php" diff --git a/lib/vendor/Emogrifier.class.php b/lib/vendor/Emogrifier.class.php deleted file mode 100644 index f448fab2..00000000 --- a/lib/vendor/Emogrifier.class.php +++ /dev/null @@ -1,1501 +0,0 @@ - - * @author Roman Ožana - * @author Sander Kruger - */ -class Emogrifier -{ - /** - * @var int - */ - const CACHE_KEY_CSS = 0; - - /** - * @var int - */ - const CACHE_KEY_SELECTOR = 1; - - /** - * @var int - */ - const CACHE_KEY_XPATH = 2; - - /** - * @var int - */ - const CACHE_KEY_CSS_DECLARATIONS_BLOCK = 3; - - /** - * @var int - */ - const CACHE_KEY_COMBINED_STYLES = 4; - - /** - * for calculating nth-of-type and nth-child selectors - * - * @var int - */ - const INDEX = 0; - - /** - * for calculating nth-of-type and nth-child selectors - * - * @var int - */ - const MULTIPLIER = 1; - - /** - * @var string - */ - const ID_ATTRIBUTE_MATCHER = '/(\\w+)?\\#([\\w\\-]+)/'; - - /** - * @var string - */ - const CLASS_ATTRIBUTE_MATCHER = '/(\\w+|[\\*\\]])?((\\.[\\w\\-]+)+)/'; - - /** - * @var string - */ - const CONTENT_TYPE_META_TAG = ''; - - /** - * @var string - */ - const DEFAULT_DOCUMENT_TYPE = ''; - - /** - * @var string - */ - private $html = ''; - - /** - * @var string - */ - private $css = ''; - - /** - * @var bool[] - */ - private $excludedSelectors = []; - - /** - * @var string[] - */ - private $unprocessableHtmlTags = ['wbr']; - - /** - * @var bool[] - */ - private $allowedMediaTypes = ['all' => true, 'screen' => true, 'print' => true]; - - /** - * @var mixed[] - */ - private $caches = [ - self::CACHE_KEY_CSS => [], - self::CACHE_KEY_SELECTOR => [], - self::CACHE_KEY_XPATH => [], - self::CACHE_KEY_CSS_DECLARATIONS_BLOCK => [], - self::CACHE_KEY_COMBINED_STYLES => [], - ]; - - /** - * the visited nodes with the XPath paths as array keys - * - * @var \DOMElement[] - */ - private $visitedNodes = []; - - /** - * the styles to apply to the nodes with the XPath paths as array keys for the outer array - * and the attribute names/values as key/value pairs for the inner array - * - * @var string[][] - */ - private $styleAttributesForNodes = []; - - /** - * Determines whether the "style" attributes of tags in the the HTML passed to this class should be preserved. - * If set to false, the value of the style attributes will be discarded. - * - * @var bool - */ - private $isInlineStyleAttributesParsingEnabled = true; - - /** - * Determines whether the