From 882a6c4a269df3e0fd99ee3d26193075e987e057 Mon Sep 17 00:00:00 2001 From: dgt41 Date: Thu, 13 Aug 2015 01:57:41 +0300 Subject: [PATCH 1/8] Sync with leafo's repo ver 0.5 --- .../templates/hathor/css/colour_brown.css | 106 +- .../hathor/less/colour_baseline.less | 32 +- .../templates/hathor/less/colour_brown.less | 4 +- .../hathor/less/hathor_variables.less | 4 +- .../templates/isis/css/template-rtl.css | 3 + administrator/templates/isis/css/template.css | 3 + libraries/cms/less/less.php | 32 + libraries/vendor/leafo/lessphp/LICENSE | 11 +- libraries/vendor/leafo/lessphp/lessc.inc.php | 1284 ++++++++++------- libraries/vendor/leafo/lessphp/lessify | 6 +- .../vendor/leafo/lessphp/lessify.inc.php | 62 +- libraries/vendor/leafo/lessphp/plessc | 4 +- templates/beez3/css/turq.css | 1 - templates/protostar/css/template.css | 3 + 14 files changed, 942 insertions(+), 613 deletions(-) diff --git a/administrator/templates/hathor/css/colour_brown.css b/administrator/templates/hathor/css/colour_brown.css index 8f98d221f0316..2f4bc3da605f1 100644 --- a/administrator/templates/hathor/css/colour_brown.css +++ b/administrator/templates/hathor/css/colour_brown.css @@ -522,33 +522,33 @@ div.toolbar-list li { color: #2c2c2c; } div.toolbar-list li.divider { - border-right: 1px dotted #e5d9c3; + border-right: 1px dotted #e1d3c8; } div.toolbar-list a { - border-left: 1px solid #e5d9c3; - border-top: 1px solid #e5d9c3; + border-left: 1px solid #e1d3c8; + border-top: 1px solid #e1d3c8; border-right: 1px solid #000000; border-bottom: 1px solid #000000; background: #d5c1b2; } div.toolbar-list a:hover { - border-left: 1px solid #868778; - border-top: 1px solid #868778; - border-right: 1px solid #f6f7db; - border-bottom: 1px solid #f6f7db; - background: #e5d9c3; - color: #054993; + border-left: 1px solid #000000; + border-top: 1px solid #000000; + border-right: 1px solid #000000; + border-bottom: 1px solid #000000; + background: #e1d3c8; + color: #000000; } div.btn-toolbar { margin-left: 5px; padding-top: 3px; } div.btn-toolbar li.divider { - border-right: 1px dotted #e5d9c3; + border-right: 1px dotted #e1d3c8; } div.btn-toolbar div.btn-group button { - border-left: 1px solid #e5d9c3; - border-top: 1px solid #e5d9c3; + border-left: 1px solid #e1d3c8; + border-top: 1px solid #e1d3c8; border-right: 1px solid #000000; border-bottom: 1px solid #000000; background-color: #d5c1b2; @@ -562,17 +562,17 @@ div.btn-toolbar div.btn-group button { padding: 5px 4px 5px 4px; } div.btn-toolbar div.btn-group button:hover { - border-left: 1px solid #868778; - border-top: 1px solid #868778; - border-right: 1px solid #f6f7db; - border-bottom: 1px solid #f6f7db; - background: #e5d9c3; - color: #054993; + border-left: 1px solid #000000; + border-top: 1px solid #000000; + border-right: 1px solid #000000; + border-bottom: 1px solid #000000; + background: #e1d3c8; + color: #000000; cursor: pointer; } div.btn-toolbar a { - border-left: 1px solid #e5d9c3; - border-top: 1px solid #e5d9c3; + border-left: 1px solid #e1d3c8; + border-top: 1px solid #e1d3c8; border-right: 1px solid #000000; border-bottom: 1px solid #000000; background-color: #d5c1b2; @@ -590,12 +590,12 @@ div.btn-toolbar a { text-decoration: none; } div.btn-toolbar a:hover { - border-left: 1px solid #868778; - border-top: 1px solid #868778; - border-right: 1px solid #f6f7db; - border-bottom: 1px solid #f6f7db; - background: #e5d9c3; - color: #054993; + border-left: 1px solid #000000; + border-top: 1px solid #000000; + border-right: 1px solid #000000; + border-bottom: 1px solid #000000; + background: #e1d3c8; + color: #000000; cursor: pointer; } div.btn-toolbar div.btn-group button.inactive { @@ -619,7 +619,7 @@ div.btn-toolbar div.btn-group button.inactive { color: #054993; } .pane-sliders .panel h3:hover { - background: #e5d9c3; + background: #e1d3c8; } .pane-sliders .panel h3:hover a { text-decoration: none; @@ -652,7 +652,7 @@ dl.tabs dt { color: #054993; } dl.tabs dt:hover { - background: #e5d9c3; + background: #e1d3c8; } dl.tabs dt.open { background: #ffffff; @@ -710,8 +710,8 @@ div.current fieldset.adminform { #cpanel div.icon a, .cpanel div.icon a { color: #054993; - border-left: 1px solid #e5d9c3; - border-top: 1px solid #e5d9c3; + border-left: 1px solid #e1d3c8; + border-top: 1px solid #e1d3c8; border-right: 1px solid #000000; border-bottom: 1px solid #000000; background-color: #d5c1b2; @@ -727,12 +727,12 @@ div.current fieldset.adminform { #cpanel div.icon a:focus, .cpanel div.icon a:hover, .cpanel div.icon a:focus { - border-left: 1px solid #868778; - border-top: 1px solid #868778; - border-right: 1px solid #f6f7db; - border-bottom: 1px solid #f6f7db; + border-left: 1px solid #000000; + border-top: 1px solid #000000; + border-right: 1px solid #000000; + border-bottom: 1px solid #000000; color: #054993; - background: #e5d9c3; + background: #e1d3c8; } fieldset { border: 1px #000000 solid; @@ -798,7 +798,7 @@ input[type="submit"]:hover, input[type="submit"]:focus, input[type="reset"]:hover, input[type="reset"]:focus { - background: #e5d9c3; + background: #e1d3c8; } textarea { background-color: #ffffff; @@ -812,7 +812,7 @@ input:hover, select:hover, textarea:hover, option:hover { - background-color: #e5d9c3; + background-color: #e1d3c8; color: #054993; } .paramrules { @@ -844,7 +844,7 @@ table.adminform tr.row0 { background-color: #ffffff; } table.adminform tr.row1 { - background-color: #e5d9c3; + background-color: #e1d3c8; } table.adminform th { color: #2c2c2c; @@ -889,7 +889,7 @@ table.adminlist tbody tr.row0:focus td, table.adminlist tbody tr.row1:focus td, table.adminlist tbody tr.row0:focus th, table.adminlist tbody tr.row1:focus th { - background-color: #e5d9c3; + background-color: #e1d3c8; } table.adminlist tbody tr td, table.adminlist tbody tr th { @@ -951,7 +951,7 @@ fieldset.batch { background: #ffffff; } button { - color: #054993; + color: #000000; border: 1px solid #000000; background-color: #d5c1b2; background-image: -moz-linear-gradient(top,#d5c1b2,#d5c1b2); @@ -964,7 +964,7 @@ button { } button:hover, button:focus { - background: #e5d9c3; + background: #e1d3c8; } .invalid { color: #ff0000; @@ -986,7 +986,7 @@ button:focus { } .button1 a:hover, .button1 a:focus { - background: #e5d9c3; + background: #e1d3c8; } .button2-left, .button2-right { @@ -1018,7 +1018,7 @@ button:focus { .button2-right a:hover, .button2-left a:focus, .button2-right a:focus { - background: #e5d9c3; + background: #e1d3c8; } .pagination .page span { color: #999999; @@ -1541,7 +1541,7 @@ li.acl-editgroups:hover, li.acl-resetbtn:hover, li.acl-editgroups:focus, li.acl-resetbtn:focus { - background-color: #e5d9c3; + background-color: #e1d3c8; } table#acl-config { border: 1px solid #000000; @@ -1589,7 +1589,7 @@ ul#rules li .pane-sliders .panel h3.title { border-bottom: solid 1px #000000; } #permissions-sliders ul#rules table.group-rules th { - background: #e5d9c3; + background: #e1d3c8; border-right: solid 1px #000000; border-bottom: solid 1px #000000; color: #2c2c2c; @@ -1656,7 +1656,7 @@ table.adminlist tbody td.check-d { border-bottom: 1px dotted #000000; } #menu a { - color: #054993; + color: #000000; background-repeat: no-repeat; background-position: left 50%; } @@ -1666,7 +1666,7 @@ table.adminlist tbody td.check-d { } #menu li a:hover, #menu li a:focus { - background-color: #e5d9c3; + background-color: #e1d3c8; } #menu li.disabled a:hover, #menu li.disabled a:focus, @@ -1688,28 +1688,28 @@ table.adminlist tbody td.check-d { background-color: transparent; } #menu li.sfhover a { - background-color: #e5d9c3; + background-color: #e1d3c8; } #menu li.sfhover li a { background-color: transparent; } #menu li.sfhover li.sfhover a, #menu li li a:focus { - background-color: #e5d9c3; + background-color: #e1d3c8; } #menu li.sfhover li.sfhover li a { background-color: transparent; } #menu li.sfhover li.sfhover li.sfhover a, #menu li li li a:focus { - background-color: #e5d9c3; + background-color: #e1d3c8; } #menu li li a:focus, #menu li li li a:focus { - background-color: #e5d9c3; + background-color: #e1d3c8; } #menu li li li a:focus { - background-color: #e5d9c3; + background-color: #e1d3c8; } #submenu { border-bottom: 1px solid #000000; @@ -1729,7 +1729,7 @@ table.adminlist tbody td.check-d { } #submenu li:hover, #submenu li:focus { - background: #e5d9c3; + background: #e1d3c8; } #submenu li.active, #submenu span.nolink.active { diff --git a/administrator/templates/hathor/less/colour_baseline.less b/administrator/templates/hathor/less/colour_baseline.less index 0e2e4bc024646..bab0cfdab89cf 100644 --- a/administrator/templates/hathor/less/colour_baseline.less +++ b/administrator/templates/hathor/less/colour_baseline.less @@ -174,10 +174,10 @@ div.toolbar-list a { } div.toolbar-list a:hover { - border-left: 1px solid @NWBorder; - border-top: 1px solid @NWBorder; - border-right: 1px solid @SEBorder; - border-bottom: 1px solid @SEBorder; + border-left: 1px solid @nwBorder; + border-top: 1px solid @nwBorder; + border-right: 1px solid @seBorder; + border-bottom: 1px solid @seBorder; background: @hoverBackground; color: @toolbarColor; } @@ -201,10 +201,10 @@ div.btn-toolbar div.btn-group button { } div.btn-toolbar div.btn-group button:hover { - border-left: 1px solid @NWBorder; - border-top: 1px solid @NWBorder; - border-right: 1px solid @SEBorder; - border-bottom: 1px solid @SEBorder; + border-left: 1px solid @nwBorder; + border-top: 1px solid @nwBorder; + border-right: 1px solid @seBorder; + border-bottom: 1px solid @seBorder; background: @hoverBackground; color: @toolbarColor; cursor: pointer; @@ -224,10 +224,10 @@ div.btn-toolbar a { } div.btn-toolbar a:hover { - border-left: 1px solid @NWBorder; - border-top: 1px solid @NWBorder; - border-right: 1px solid @SEBorder; - border-bottom: 1px solid @SEBorder; + border-left: 1px solid @nwBorder; + border-top: 1px solid @nwBorder; + border-right: 1px solid @seBorder; + border-bottom: 1px solid @seBorder; background: @hoverBackground; color: @toolbarColor; cursor: pointer; @@ -376,10 +376,10 @@ div.current fieldset.adminform { #cpanel div.icon a:focus, .cpanel div.icon a:hover, .cpanel div.icon a:focus { - border-left: 1px solid @NWBorder; - border-top: 1px solid @NWBorder; - border-right: 1px solid @SEBorder; - border-bottom: 1px solid @SEBorder; + border-left: 1px solid @nwBorder; + border-top: 1px solid @nwBorder; + border-right: 1px solid @seBorder; + border-bottom: 1px solid @seBorder; color: @linkColor; background: @hoverBackground; } diff --git a/administrator/templates/hathor/less/colour_brown.less b/administrator/templates/hathor/less/colour_brown.less index 3d267cea75d55..ab5f37dd80c29 100644 --- a/administrator/templates/hathor/less/colour_brown.less +++ b/administrator/templates/hathor/less/colour_brown.less @@ -35,8 +35,8 @@ @mainBorder: #000000; @toolbarColor: #000000; @hoverBackground: #e1d3c8; -@NWBorder: #000000; -@SEBorder: #000000; +@nwBorder: #000000; +@seBorder: #000000; // Import the baseline to compile the CSS @import "colour_baseline.less"; diff --git a/administrator/templates/hathor/less/hathor_variables.less b/administrator/templates/hathor/less/hathor_variables.less index 8e4eb7144b920..b2c0715b62ace 100644 --- a/administrator/templates/hathor/less/hathor_variables.less +++ b/administrator/templates/hathor/less/hathor_variables.less @@ -131,8 +131,8 @@ // ------------------------- @toolbarColor: @linkColor; @hoverBackground: #e5d9c3; -@NWBorder: #868778; -@SEBorder: #f6f7db; +@nwBorder: #868778; +@seBorder: #f6f7db; @fadedText: #cccccc; @disabledBackground: #eeeeee; @permissionDefault: #ffffcf; diff --git a/administrator/templates/isis/css/template-rtl.css b/administrator/templates/isis/css/template-rtl.css index a50d5fa4ca508..9434de61c0772 100644 --- a/administrator/templates/isis/css/template-rtl.css +++ b/administrator/templates/isis/css/template-rtl.css @@ -4706,6 +4706,9 @@ a.badge:focus { .affix { position: fixed; } +@-ms-viewport { + width: device-width; +} .hidden { display: none; visibility: hidden; diff --git a/administrator/templates/isis/css/template.css b/administrator/templates/isis/css/template.css index fa27790ee7a31..b18235c598021 100644 --- a/administrator/templates/isis/css/template.css +++ b/administrator/templates/isis/css/template.css @@ -4706,6 +4706,9 @@ a.badge:focus { .affix { position: fixed; } +@-ms-viewport { + width: device-width; +} .hidden { display: none; visibility: hidden; diff --git a/libraries/cms/less/less.php b/libraries/cms/less/less.php index b2499035b180f..a1f31e021fbe0 100644 --- a/libraries/cms/less/less.php +++ b/libraries/cms/less/less.php @@ -37,4 +37,36 @@ public function __construct($fname = null, $formatter = null) $this->setFormatter($formatter); } + + /* + * Override compile because $this->allParsedFiles needs to be an array + * + * For documentation on this please see /vendor/leafo/lessc.inc.php + */ + public function compile($string, $name = null) { + $locale = setlocale(LC_NUMERIC, 0); + setlocale(LC_NUMERIC, "C"); + + $this->parser = $this->makeParser($name); + $root = $this->parser->parse($string); + + $this->env = null; + $this->scope = null; + $this->allParsedFiles = array(); + + $this->formatter = $this->newFormatter(); + + if (!empty($this->registeredVars)) { + $this->injectVariables($this->registeredVars); + } + + $this->sourceParser = $this->parser; // used for error messages + $this->compileBlock($root); + + ob_start(); + $this->formatter->block($this->scope); + $out = ob_get_clean(); + setlocale(LC_NUMERIC, $locale); + return $out; + } } diff --git a/libraries/vendor/leafo/lessphp/LICENSE b/libraries/vendor/leafo/lessphp/LICENSE index b2338b1c8ac54..7fea33f231e0c 100644 --- a/libraries/vendor/leafo/lessphp/LICENSE +++ b/libraries/vendor/leafo/lessphp/LICENSE @@ -1,4 +1,4 @@ -For ease of distribution, lessphp 0.2.0 is under a dual license. +For ease of distribution, lessphp 0.4.0 is under a dual license. You are free to pick which one suits your needs. @@ -9,8 +9,8 @@ MIT LICENSE -Copyright (c) 2010 Leaf Corcoran, http://leafo.net/lessphp - +Copyright (c) 2013 Leaf Corcoran, http://leafo.net/lessphp + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including @@ -18,10 +18,10 @@ without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -657,4 +657,3 @@ reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. - diff --git a/libraries/vendor/leafo/lessphp/lessc.inc.php b/libraries/vendor/leafo/lessphp/lessc.inc.php index 411ca2fab8890..e93d9eee7e901 100644 --- a/libraries/vendor/leafo/lessphp/lessc.inc.php +++ b/libraries/vendor/leafo/lessphp/lessc.inc.php @@ -1,18 +1,18 @@ + * Copyright 2013, Leaf Corcoran * Licensed under MIT or GPLv3, see LICENSE */ /** - * The less compiler and parser. + * The LESS compiler and parser. * * Converting LESS to CSS is a three stage process. The incoming file is parsed * by `lessc_parser` into a syntax tree, then it is compiled into another tree @@ -27,7 +27,7 @@ * * In summary: * - * The `lessc` class creates an intstance of the parser, feeds it LESS code, + * The `lessc` class creates an instance of the parser, feeds it LESS code, * then transforms the resulting tree to a CSS tree. This class also holds the * evaluation context, such as all available mixins and variables at any given * time. @@ -38,9 +38,10 @@ * handling things like indentation. */ class lessc { - static public $VERSION = "v0.3.9"; - static protected $TRUE = array("keyword", "true"); - static protected $FALSE = array("keyword", "false"); + static public $VERSION = "v0.5.0"; + + static public $TRUE = array("keyword", "true"); + static public $FALSE = array("keyword", "false"); protected $libFunctions = array(); protected $registeredVars = array(); @@ -55,13 +56,13 @@ class lessc { protected $numberPrecision = null; + protected $allParsedFiles = array(); + // set to the parser that generated the current line when compiling // so we know how to create error messages protected $sourceParser = null; protected $sourceLoc = null; - static public $defaultValue = array("keyword", ""); - static protected $nextImportId = 0; // uniquely identify imports // attempts to find the path of an import url, returns null for css files @@ -103,12 +104,17 @@ protected function tryImport($importPath, $parentBlock, $out) { if (substr_compare($url, '.css', -4, 4) === 0) return false; $realPath = $this->findImport($url); + if ($realPath === null) return false; if ($this->importDisabled) { return array(false, "/* import disabled */"); } + if (isset($this->allParsedFiles[realpath($realPath)])) { + return array(false, null); + } + $this->addParsedFile($realPath); $parser = $this->makeParser($realPath); $root = $parser->parse(file_get_contents($realPath)); @@ -182,25 +188,25 @@ protected function compileImportedProps($props, $block, $out, $sourceParser, $im */ protected function compileBlock($block) { switch ($block->type) { - case "root": - $this->compileRoot($block); - break; - case null: - $this->compileCSSBlock($block); - break; - case "media": - $this->compileMedia($block); - break; - case "directive": - $name = "@" . $block->name; - if (!empty($block->value)) { - $name .= " " . $this->compileValue($this->reduce($block->value)); - } + case "root": + $this->compileRoot($block); + break; + case null: + $this->compileCSSBlock($block); + break; + case "media": + $this->compileMedia($block); + break; + case "directive": + $name = "@" . $block->name; + if (!empty($block->value)) { + $name .= " " . $this->compileValue($this->reduce($block->value)); + } - $this->compileNestedBlock($block, array($name)); - break; - default: - $this->throwError("unknown block type: $block->type\n"); + $this->compileNestedBlock($block, array($name)); + break; + default: + $this->throwError("unknown block type: $block->type\n"); } } @@ -276,37 +282,73 @@ protected function compileProps($block, $out) { foreach ($this->sortProps($block->props) as $prop) { $this->compileProp($prop, $block, $out); } + $out->lines = $this->deduplicate($out->lines); + } + + /** + * Deduplicate lines in a block. Comments are not deduplicated. If a + * duplicate rule is detected, the comments immediately preceding each + * occurence are consolidated. + */ + protected function deduplicate($lines) { + $unique = array(); + $comments = array(); + + foreach($lines as $line) { + if (strpos($line, '/*') === 0) { + $comments[] = $line; + continue; + } + if (!in_array($line, $unique)) { + $unique[] = $line; + } + array_splice($unique, array_search($line, $unique), 0, $comments); + $comments = array(); + } + return array_merge($unique, $comments); } protected function sortProps($props, $split = false) { $vars = array(); $imports = array(); $other = array(); + $stack = array(); foreach ($props as $prop) { switch ($prop[0]) { - case "assign": - if (isset($prop[1][0]) && $prop[1][0] == $this->vPrefix) { - $vars[] = $prop; - } else { - $other[] = $prop; - } - break; - case "import": - $id = self::$nextImportId++; - $prop[] = $id; - $imports[] = $prop; - $other[] = array("import_mixin", $id); - break; - default: - $other[] = $prop; + case "comment": + $stack[] = $prop; + break; + case "assign": + $stack[] = $prop; + if (isset($prop[1][0]) && $prop[1][0] == $this->vPrefix) { + $vars = array_merge($vars, $stack); + } else { + $other = array_merge($other, $stack); + } + $stack = array(); + break; + case "import": + $id = self::$nextImportId++; + $prop[] = $id; + $stack[] = $prop; + $imports = array_merge($imports, $stack); + $other[] = array("import_mixin", $id); + $stack = array(); + break; + default: + $stack[] = $prop; + $other = array_merge($other, $stack); + $stack = array(); + break; } } + $other = array_merge($other, $stack); if ($split) { - return array(array_merge($vars, $imports), $other); + return array(array_merge($imports, $vars), $other); } else { - return array_merge($vars, $imports, $other); + return array_merge($imports, $vars, $other); } } @@ -316,20 +358,20 @@ protected function compileMediaQuery($queries) { $parts = array(); foreach ($query as $q) { switch ($q[0]) { - case "mediaType": - $parts[] = implode(" ", array_slice($q, 1)); - break; - case "mediaExp": - if (isset($q[2])) { - $parts[] = "($q[1]: " . - $this->compileValue($this->reduce($q[2])) . ")"; - } else { - $parts[] = "($q[1])"; - } - break; - case "variable": - $parts[] = $this->compileValue($this->reduce($q)); - break; + case "mediaType": + $parts[] = implode(" ", array_slice($q, 1)); + break; + case "mediaExp": + if (isset($q[2])) { + $parts[] = "($q[1]: " . + $this->compileValue($this->reduce($q[2])) . ")"; + } else { + $parts[] = "($q[1])"; + } + break; + case "variable": + $parts[] = $this->compileValue($this->reduce($q)); + break; } } @@ -450,7 +492,7 @@ protected function eq($left, $right) { return $left == $right; } - protected function patternMatch($block, $callingArgs) { + protected function patternMatch($block, $orderedArgs, $keywordArgs) { // match the guards if it has them // any one of the groups must have all its guards pass for a match if (!empty($block->guards)) { @@ -458,7 +500,7 @@ protected function patternMatch($block, $callingArgs) { foreach ($block->guards as $guardGroup) { foreach ($guardGroup as $guard) { $this->pushEnv(); - $this->zipSetArgs($block->args, $callingArgs); + $this->zipSetArgs($block->args, $orderedArgs, $keywordArgs); $negate = false; if ($guard[0] == "negate") { @@ -487,30 +529,40 @@ protected function patternMatch($block, $callingArgs) { } } - $numCalling = count($callingArgs); - if (empty($block->args)) { - return $block->isVararg || $numCalling == 0; + return $block->isVararg || empty($orderedArgs) && empty($keywordArgs); + } + + $remainingArgs = $block->args; + if ($keywordArgs) { + $remainingArgs = array(); + foreach ($block->args as $arg) { + if ($arg[0] == "arg" && isset($keywordArgs[$arg[1]])) { + continue; + } + + $remainingArgs[] = $arg; + } } $i = -1; // no args // try to match by arity or by argument literal - foreach ($block->args as $i => $arg) { + foreach ($remainingArgs as $i => $arg) { switch ($arg[0]) { - case "lit": - if (empty($callingArgs[$i]) || !$this->eq($arg[1], $callingArgs[$i])) { - return false; - } - break; - case "arg": - // no arg and no default value - if (!isset($callingArgs[$i]) && !isset($arg[2])) { - return false; - } - break; - case "rest": - $i--; // rest can be empty - break 2; + case "lit": + if (empty($orderedArgs[$i]) || !$this->eq($arg[1], $orderedArgs[$i])) { + return false; + } + break; + case "arg": + // no arg and no default value + if (!isset($orderedArgs[$i]) && !isset($arg[2])) { + return false; + } + break; + case "rest": + $i--; // rest can be empty + break 2; } } @@ -519,14 +571,19 @@ protected function patternMatch($block, $callingArgs) { } else { $numMatched = $i + 1; // greater than becuase default values always match - return $numMatched >= $numCalling; + return $numMatched >= count($orderedArgs); } } - protected function patternMatchAll($blocks, $callingArgs) { + protected function patternMatchAll($blocks, $orderedArgs, $keywordArgs, $skip=array()) { $matches = null; foreach ($blocks as $block) { - if ($this->patternMatch($block, $callingArgs)) { + // skip seen blocks that don't have arguments + if (isset($skip[$block->id]) && !isset($block->args)) { + continue; + } + + if ($this->patternMatch($block, $orderedArgs, $keywordArgs)) { $matches[] = $block; } } @@ -535,7 +592,7 @@ protected function patternMatchAll($blocks, $callingArgs) { } // attempt to find blocks matched by path and args - protected function findBlocks($searchIn, $path, $args, $seen=array()) { + protected function findBlocks($searchIn, $path, $orderedArgs, $keywordArgs, $seen=array()) { if ($searchIn == null) return null; if (isset($seen[$searchIn->id])) return null; $seen[$searchIn->id] = true; @@ -545,7 +602,7 @@ protected function findBlocks($searchIn, $path, $args, $seen=array()) { if (isset($searchIn->children[$name])) { $blocks = $searchIn->children[$name]; if (count($path) == 1) { - $matches = $this->patternMatchAll($blocks, $args); + $matches = $this->patternMatchAll($blocks, $orderedArgs, $keywordArgs, $seen); if (!empty($matches)) { // This will return all blocks that match in the closest // scope that has any matching block, like lessjs @@ -555,7 +612,7 @@ protected function findBlocks($searchIn, $path, $args, $seen=array()) { $matches = array(); foreach ($blocks as $subBlock) { $subMatches = $this->findBlocks($subBlock, - array_slice($path, 1), $args, $seen); + array_slice($path, 1), $orderedArgs, $keywordArgs, $seen); if (!is_null($subMatches)) { foreach ($subMatches as $sm) { @@ -567,39 +624,51 @@ protected function findBlocks($searchIn, $path, $args, $seen=array()) { return count($matches) > 0 ? $matches : null; } } - if ($searchIn->parent === $searchIn) return null; - return $this->findBlocks($searchIn->parent, $path, $args, $seen); + return $this->findBlocks($searchIn->parent, $path, $orderedArgs, $keywordArgs, $seen); } // sets all argument names in $args to either the default value // or the one passed in through $values - protected function zipSetArgs($args, $values) { - $i = 0; + protected function zipSetArgs($args, $orderedValues, $keywordValues) { $assignedValues = array(); - foreach ($args as $a) { + + $i = 0; + foreach ($args as $a) { if ($a[0] == "arg") { - if ($i < count($values) && !is_null($values[$i])) { - $value = $values[$i]; + if (isset($keywordValues[$a[1]])) { + // has keyword arg + $value = $keywordValues[$a[1]]; + } elseif (isset($orderedValues[$i])) { + // has ordered arg + $value = $orderedValues[$i]; + $i++; } elseif (isset($a[2])) { + // has default value $value = $a[2]; - } else $value = null; + } else { + $this->throwError("Failed to assign arg " . $a[1]); + $value = null; // :( + } $value = $this->reduce($value); $this->set($a[1], $value); $assignedValues[] = $value; + } else { + // a lit + $i++; } - $i++; } // check for a rest $last = end($args); if ($last[0] == "rest") { - $rest = array_slice($values, count($args) - 1); + $rest = array_slice($orderedValues, count($args) - 1); $this->set($last[1], $this->reduce(array("list", " ", $rest))); } - $this->env->arguments = $assignedValues; + // wow is this the only true use of PHP's + operator for arrays? + $this->env->arguments = $assignedValues + $orderedValues; } // compile a prop and update $lines or $blocks appropriately @@ -608,108 +677,133 @@ protected function compileProp($prop, $block, $out) { $this->sourceLoc = isset($prop[-1]) ? $prop[-1] : -1; switch ($prop[0]) { - case 'assign': - list(, $name, $value) = $prop; - if ($name[0] == $this->vPrefix) { - $this->set($name, $value); - } else { - $out->lines[] = $this->formatter->property($name, + case 'assign': + list(, $name, $value) = $prop; + if ($name[0] == $this->vPrefix) { + $this->set($name, $value); + } else { + $out->lines[] = $this->formatter->property($name, $this->compileValue($this->reduce($value))); - } - break; - case 'block': - list(, $child) = $prop; - $this->compileBlock($child); - break; - case 'mixin': - list(, $path, $args, $suffix) = $prop; + } + break; + case 'block': + list(, $child) = $prop; + $this->compileBlock($child); + break; + case 'mixin': + list(, $path, $args, $suffix) = $prop; + + $orderedArgs = array(); + $keywordArgs = array(); + foreach ((array)$args as $arg) { + $argval = null; + switch ($arg[0]) { + case "arg": + if (!isset($arg[2])) { + $orderedArgs[] = $this->reduce(array("variable", $arg[1])); + } else { + $keywordArgs[$arg[1]] = $this->reduce($arg[2]); + } + break; - $args = array_map(array($this, "reduce"), (array)$args); - $mixins = $this->findBlocks($block, $path, $args); + case "lit": + $orderedArgs[] = $this->reduce($arg[1]); + break; + default: + $this->throwError("Unknown arg type: " . $arg[0]); + } + } - if ($mixins === null) { - // fwrite(STDERR,"failed to find block: ".implode(" > ", $path)."\n"); - break; // throw error here?? - } + $mixins = $this->findBlocks($block, $path, $orderedArgs, $keywordArgs); - foreach ($mixins as $mixin) { - $haveScope = false; - if (isset($mixin->parent->scope)) { - $haveScope = true; - $mixinParentEnv = $this->pushEnv(); - $mixinParentEnv->storeParent = $mixin->parent->scope; + if ($mixins === null) { + $this->throwError("{$prop[1][0]} is undefined"); } - $haveArgs = false; - if (isset($mixin->args)) { - $haveArgs = true; - $this->pushEnv(); - $this->zipSetArgs($mixin->args, $args); - } + foreach ($mixins as $mixin) { + if ($mixin === $block && !$orderedArgs) { + continue; + } - $oldParent = $mixin->parent; - if ($mixin != $block) $mixin->parent = $block; + $haveScope = false; + if (isset($mixin->parent->scope)) { + $haveScope = true; + $mixinParentEnv = $this->pushEnv(); + $mixinParentEnv->storeParent = $mixin->parent->scope; + } - foreach ($this->sortProps($mixin->props) as $subProp) { - if ($suffix !== null && - $subProp[0] == "assign" && - is_string($subProp[1]) && - $subProp[1]{0} != $this->vPrefix) - { - $subProp[2] = array( - 'list', ' ', - array($subProp[2], array('keyword', $suffix)) - ); + $haveArgs = false; + if (isset($mixin->args)) { + $haveArgs = true; + $this->pushEnv(); + $this->zipSetArgs($mixin->args, $orderedArgs, $keywordArgs); } - $this->compileProp($subProp, $mixin, $out); - } + $oldParent = $mixin->parent; + if ($mixin != $block) $mixin->parent = $block; + + foreach ($this->sortProps($mixin->props) as $subProp) { + if ($suffix !== null && + $subProp[0] == "assign" && + is_string($subProp[1]) && + $subProp[1]{0} != $this->vPrefix) + { + $subProp[2] = array( + 'list', ' ', + array($subProp[2], array('keyword', $suffix)) + ); + } - $mixin->parent = $oldParent; + $this->compileProp($subProp, $mixin, $out); + } - if ($haveArgs) $this->popEnv(); - if ($haveScope) $this->popEnv(); - } + $mixin->parent = $oldParent; - break; - case 'raw': - $out->lines[] = $prop[1]; - break; - case "directive": - list(, $name, $value) = $prop; - $out->lines[] = "@$name " . $this->compileValue($this->reduce($value)).';'; - break; - case "comment": - $out->lines[] = $prop[1]; - break; - case "import"; - list(, $importPath, $importId) = $prop; - $importPath = $this->reduce($importPath); + if ($haveArgs) $this->popEnv(); + if ($haveScope) $this->popEnv(); + } - if (!isset($this->env->imports)) { - $this->env->imports = array(); - } + break; + case 'raw': + $out->lines[] = $prop[1]; + break; + case "directive": + list(, $name, $value) = $prop; + $out->lines[] = "@$name " . $this->compileValue($this->reduce($value)).';'; + break; + case "comment": + $out->lines[] = $prop[1]; + break; + case "import"; + list(, $importPath, $importId) = $prop; + $importPath = $this->reduce($importPath); - $result = $this->tryImport($importPath, $block, $out); + if (!isset($this->env->imports)) { + $this->env->imports = array(); + } - $this->env->imports[$importId] = $result === false ? - array(false, "@import " . $this->compileValue($importPath).";") : - $result; + $result = $this->tryImport($importPath, $block, $out); - break; - case "import_mixin": - list(,$importId) = $prop; - $import = $this->env->imports[$importId]; - if ($import[0] === false) { - $out->lines[] = $import[1]; - } else { - list(, $bottom, $parser, $importDir) = $import; - $this->compileImportedProps($bottom, $block, $out, $parser, $importDir); - } + $this->env->imports[$importId] = $result === false ? + array(false, "@import " . $this->compileValue($importPath).";") : + $result; - break; - default: - $this->throwError("unknown op: {$prop[0]}\n"); + break; + case "import_mixin": + list(,$importId) = $prop; + $import = $this->env->imports[$importId]; + if ($import[0] === false) { + if (isset($import[1])) { + $out->lines[] = $import[1]; + } + } else { + list(, $bottom, $parser, $importDir) = $import; + $this->compileImportedProps($bottom, $block, $out, $parser, $importDir); + } + + break; + default: + $this->throwError("unknown op: {$prop[0]}\n"); } } @@ -725,67 +819,121 @@ protected function compileProp($prop, $block, $out) { * The input is expected to be reduced. This function will not work on * things like expressions and variables. */ - protected function compileValue($value) { + public function compileValue($value) { switch ($value[0]) { - case 'list': - // [1] - delimiter - // [2] - array of values - return implode($value[1], array_map(array($this, 'compileValue'), $value[2])); - case 'raw_color': - if (!empty($this->formatter->compressColors)) { - return $this->compileValue($this->coerceColor($value)); - } - return $value[1]; - case 'keyword': - // [1] - the keyword - return $value[1]; - case 'number': - list(, $num, $unit) = $value; - // [1] - the number - // [2] - the unit - if ($this->numberPrecision !== null) { - $num = round($num, $this->numberPrecision); - } - return $num . $unit; - case 'string': - // [1] - contents of string (includes quotes) - list(, $delim, $content) = $value; - foreach ($content as &$part) { - if (is_array($part)) { - $part = $this->compileValue($part); + case 'list': + // [1] - delimiter + // [2] - array of values + return implode($value[1], array_map(array($this, 'compileValue'), $value[2])); + case 'raw_color': + if (!empty($this->formatter->compressColors)) { + return $this->compileValue($this->coerceColor($value)); + } + return $value[1]; + case 'keyword': + // [1] - the keyword + return $value[1]; + case 'number': + list(, $num, $unit) = $value; + // [1] - the number + // [2] - the unit + if ($this->numberPrecision !== null) { + $num = round($num, $this->numberPrecision); + } + return $num . $unit; + case 'string': + // [1] - contents of string (includes quotes) + list(, $delim, $content) = $value; + foreach ($content as &$part) { + if (is_array($part)) { + $part = $this->compileValue($part); + } + } + return $delim . implode($content) . $delim; + case 'color': + // [1] - red component (either number or a %) + // [2] - green component + // [3] - blue component + // [4] - optional alpha component + list(, $r, $g, $b) = $value; + $r = round($r); + $g = round($g); + $b = round($b); + + if (count($value) == 5 && $value[4] != 1) { // rgba + return 'rgba('.$r.','.$g.','.$b.','.$value[4].')'; } - } - return $delim . implode($content) . $delim; - case 'color': - // [1] - red component (either number or a %) - // [2] - green component - // [3] - blue component - // [4] - optional alpha component - list(, $r, $g, $b) = $value; - $r = round($r); - $g = round($g); - $b = round($b); - - if (count($value) == 5 && $value[4] != 1) { // rgba - return 'rgba('.$r.','.$g.','.$b.','.$value[4].')'; - } - $h = sprintf("#%02x%02x%02x", $r, $g, $b); + $h = sprintf("#%02x%02x%02x", $r, $g, $b); - if (!empty($this->formatter->compressColors)) { - // Converting hex color to short notation (e.g. #003399 to #039) - if ($h[1] === $h[2] && $h[3] === $h[4] && $h[5] === $h[6]) { - $h = '#' . $h[1] . $h[3] . $h[5]; + if (!empty($this->formatter->compressColors)) { + // Converting hex color to short notation (e.g. #003399 to #039) + if ($h[1] === $h[2] && $h[3] === $h[4] && $h[5] === $h[6]) { + $h = '#' . $h[1] . $h[3] . $h[5]; + } } - } - return $h; + return $h; - case 'function': - list(, $name, $args) = $value; - return $name.'('.$this->compileValue($args).')'; - default: // assumed to be unit - $this->throwError("unknown value type: $value[0]"); + case 'function': + list(, $name, $args) = $value; + return $name.'('.$this->compileValue($args).')'; + default: // assumed to be unit + $this->throwError("unknown value type: $value[0]"); + } + } + + protected function lib_pow($args) { + list($base, $exp) = $this->assertArgs($args, 2, "pow"); + return pow($this->assertNumber($base), $this->assertNumber($exp)); + } + + protected function lib_pi() { + return pi(); + } + + protected function lib_mod($args) { + list($a, $b) = $this->assertArgs($args, 2, "mod"); + return $this->assertNumber($a) % $this->assertNumber($b); + } + + protected function lib_tan($num) { + return tan($this->assertNumber($num)); + } + + protected function lib_sin($num) { + return sin($this->assertNumber($num)); + } + + protected function lib_cos($num) { + return cos($this->assertNumber($num)); + } + + protected function lib_atan($num) { + $num = atan($this->assertNumber($num)); + return array("number", $num, "rad"); + } + + protected function lib_asin($num) { + $num = asin($this->assertNumber($num)); + return array("number", $num, "rad"); + } + + protected function lib_acos($num) { + $num = acos($this->assertNumber($num)); + return array("number", $num, "rad"); + } + + protected function lib_sqrt($num) { + return sqrt($this->assertNumber($num)); + } + + protected function lib_extract($value) { + list($list, $idx) = $this->assertArgs($value, 2, "extract"); + $idx = $this->assertNumber($idx); + // 1 indexed + if ($list[0] == "list" && isset($list[2][$idx - 1])) { + return $list[2][$idx - 1]; } } @@ -835,6 +983,39 @@ protected function lib_argb($color){ return $this->lib_rgbahex($color); } + /** + * Given an url, decide whether to output a regular link or the base64-encoded contents of the file + * + * @param array $value either an argument list (two strings) or a single string + * @return string formatted url(), either as a link or base64-encoded + */ + protected function lib_data_uri($value) { + $mime = ($value[0] === 'list') ? $value[2][0][2] : null; + $url = ($value[0] === 'list') ? $value[2][1][2][0] : $value[2][0]; + + $fullpath = $this->findImport($url); + + if($fullpath && ($fsize = filesize($fullpath)) !== false) { + // IE8 can't handle data uris larger than 32KB + if($fsize/1024 < 32) { + if(is_null($mime)) { + if(class_exists('finfo')) { // php 5.3+ + $finfo = new finfo(FILEINFO_MIME); + $mime = explode('; ', $finfo->file($fullpath)); + $mime = $mime[0]; + } elseif(function_exists('mime_content_type')) { // PHP 5.2 + $mime = mime_content_type($fullpath); + } + } + + if(!is_null($mime)) // fallback if the mime type is still unknown + $url = sprintf('data:%s;base64,%s', $mime, base64_encode(file_get_contents($fullpath))); + } + } + + return 'url("'.$url.'")'; + } + // utility func to unquote a string protected function lib_e($arg) { switch ($arg[0]) { @@ -843,7 +1024,7 @@ protected function lib_e($arg) { if (isset($items[0])) { return $this->lib_e($items[0]); } - return self::$defaultValue; + $this->throwError("unrecognised input"); case "string": $arg[1] = ""; return $arg; @@ -893,8 +1074,14 @@ protected function lib_ceil($arg) { } protected function lib_round($arg) { - $value = $this->assertNumber($arg); - return array("number", round($value), $arg[2]); + if($arg[0] != "list") { + $value = $this->assertNumber($arg); + return array("number", round($value), $arg[2]); + } else { + $value = $this->assertNumber($arg[2][0]); + $precision = $this->assertNumber($arg[2][1]); + return array("number", round($value, $precision), $arg[2][0][2]); + } } protected function lib_unit($arg) { @@ -911,7 +1098,7 @@ protected function lib_unit($arg) { * Helper function to get arguments for color manipulation functions. * takes a list that contains a color like thing and a percentage */ - protected function colorArgs($args) { + public function colorArgs($args) { if ($args[0] != 'list' || count($args[2]) < 2) { return array(array('color', 0, 0, 0), 0); } @@ -1013,19 +1200,24 @@ protected function lib_percentage($arg) { } // mixes two colors by weight - // mix(@color1, @color2, @weight); + // mix(@color1, @color2, [@weight: 50%]); // http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html#mix-instance_method protected function lib_mix($args) { - if ($args[0] != "list" || count($args[2]) < 3) + if ($args[0] != "list" || count($args[2]) < 2) $this->throwError("mix expects (color1, color2, weight)"); - list($first, $second, $weight) = $args[2]; + list($first, $second) = $args[2]; $first = $this->assertColor($first); $second = $this->assertColor($second); $first_a = $this->lib_alpha($first); $second_a = $this->lib_alpha($second); - $weight = $weight[1] / 100.0; + + if (isset($args[2][2])) { + $weight = $args[2][2][1] / 100.0; + } else { + $weight = 0.5; + } $w = $weight * 2 - 1; $a = $first_a - $second_a; @@ -1047,35 +1239,74 @@ protected function lib_mix($args) { } protected function lib_contrast($args) { - if ($args[0] != 'list' || count($args[2]) < 3) { - return array(array('color', 0, 0, 0), 0); + $darkColor = array('color', 0, 0, 0); + $lightColor = array('color', 255, 255, 255); + $threshold = 0.43; + + if ( $args[0] == 'list' ) { + $inputColor = ( isset($args[2][0]) ) ? $this->assertColor($args[2][0]) : $lightColor; + $darkColor = ( isset($args[2][1]) ) ? $this->assertColor($args[2][1]) : $darkColor; + $lightColor = ( isset($args[2][2]) ) ? $this->assertColor($args[2][2]) : $lightColor; + $threshold = ( isset($args[2][3]) ) ? $this->assertNumber($args[2][3]) : $threshold; + } + else { + $inputColor = $this->assertColor($args); } - list($inputColor, $darkColor, $lightColor) = $args[2]; + $inputColor = $this->coerceColor($inputColor); + $darkColor = $this->coerceColor($darkColor); + $lightColor = $this->coerceColor($lightColor); - $inputColor = $this->assertColor($inputColor); - $darkColor = $this->assertColor($darkColor); - $lightColor = $this->assertColor($lightColor); - $hsl = $this->toHSL($inputColor); + //Figure out which is actually light and dark! + if ( $this->lib_luma($darkColor) > $this->lib_luma($lightColor) ) { + $t = $lightColor; + $lightColor = $darkColor; + $darkColor = $t; + } - if ($hsl[3] > 50) { - return $darkColor; + $inputColor_alpha = $this->lib_alpha($inputColor); + if ( ( $this->lib_luma($inputColor) * $inputColor_alpha) < $threshold) { + return $lightColor; } + return $darkColor; + } - return $lightColor; + protected function lib_luma($color) { + $color = $this->coerceColor($color); + return (0.2126 * $color[0] / 255) + (0.7152 * $color[1] / 255) + (0.0722 * $color[2] / 255); } - protected function assertColor($value, $error = "expected color value") { + + public function assertColor($value, $error = "expected color value") { $color = $this->coerceColor($value); if (is_null($color)) $this->throwError($error); return $color; } - protected function assertNumber($value, $error = "expecting number") { + public function assertNumber($value, $error = "expecting number") { if ($value[0] == "number") return $value[1]; $this->throwError($error); } + public function assertArgs($value, $expectedArgs, $name="") { + if ($expectedArgs == 1) { + return $value; + } else { + if ($value[0] !== "list" || $value[1] != ",") $this->throwError("expecting list"); + $values = $value[2]; + $numValues = count($values); + if ($expectedArgs != $numValues) { + if ($name) { + $name = $name . ": "; + } + + $this->throwError("${name}expecting $expectedArgs arguments, got $numValues"); + } + + return $values; + } + } + protected function toHSL($color) { if ($color[0] == 'hsl') return $color; @@ -1215,106 +1446,111 @@ protected function funcToColor($func) { protected function reduce($value, $forExpression = false) { switch ($value[0]) { - case "interpolate": - $reduced = $this->reduce($value[1]); - $var = $this->compileValue($reduced); - $res = $this->reduce(array("variable", $this->vPrefix . $var)); + case "interpolate": + $reduced = $this->reduce($value[1]); + $var = $this->compileValue($reduced); + $res = $this->reduce(array("variable", $this->vPrefix . $var)); - if (empty($value[2])) $res = $this->lib_e($res); + if ($res[0] == "raw_color") { + $res = $this->coerceColor($res); + } - return $res; - case "variable": - $key = $value[1]; - if (is_array($key)) { - $key = $this->reduce($key); - $key = $this->vPrefix . $this->compileValue($this->lib_e($key)); - } + if (empty($value[2])) $res = $this->lib_e($res); - $seen =& $this->env->seenNames; + return $res; + case "variable": + $key = $value[1]; + if (is_array($key)) { + $key = $this->reduce($key); + $key = $this->vPrefix . $this->compileValue($this->lib_e($key)); + } - if (!empty($seen[$key])) { - $this->throwError("infinite loop detected: $key"); - } + $seen =& $this->env->seenNames; - $seen[$key] = true; - $out = $this->reduce($this->get($key, self::$defaultValue)); - $seen[$key] = false; - return $out; - case "list": - foreach ($value[2] as &$item) { - $item = $this->reduce($item, $forExpression); - } - return $value; - case "expression": - return $this->evaluate($value); - case "string": - foreach ($value[2] as &$part) { - if (is_array($part)) { - $strip = $part[0] == "variable"; - $part = $this->reduce($part); - if ($strip) $part = $this->lib_e($part); + if (!empty($seen[$key])) { + $this->throwError("infinite loop detected: $key"); } - } - return $value; - case "escape": - list(,$inner) = $value; - return $this->lib_e($this->reduce($inner)); - case "function": - $color = $this->funcToColor($value); - if ($color) return $color; - - list(, $name, $args) = $value; - if ($name == "%") $name = "_sprintf"; - $f = isset($this->libFunctions[$name]) ? - $this->libFunctions[$name] : array($this, 'lib_'.$name); - - if (is_callable($f)) { - if ($args[0] == 'list') - $args = self::compressList($args[2], $args[1]); - - $ret = call_user_func($f, $this->reduce($args, true), $this); - - if (is_null($ret)) { - return array("string", "", array( - $name, "(", $args, ")" - )); + + $seen[$key] = true; + $out = $this->reduce($this->get($key)); + $seen[$key] = false; + return $out; + case "list": + foreach ($value[2] as &$item) { + $item = $this->reduce($item, $forExpression); + } + return $value; + case "expression": + return $this->evaluate($value); + case "string": + foreach ($value[2] as &$part) { + if (is_array($part)) { + $strip = $part[0] == "variable"; + $part = $this->reduce($part); + if ($strip) $part = $this->lib_e($part); + } } + return $value; + case "escape": + list(,$inner) = $value; + return $this->lib_e($this->reduce($inner)); + case "function": + $color = $this->funcToColor($value); + if ($color) return $color; + + list(, $name, $args) = $value; + if ($name == "%") $name = "_sprintf"; + + $f = isset($this->libFunctions[$name]) ? + $this->libFunctions[$name] : array($this, 'lib_'.str_replace('-', '_', $name)); + + if (is_callable($f)) { + if ($args[0] == 'list') + $args = self::compressList($args[2], $args[1]); + + $ret = call_user_func($f, $this->reduce($args, true), $this); + + if (is_null($ret)) { + return array("string", "", array( + $name, "(", $args, ")" + )); + } - // convert to a typed value if the result is a php primitive - if (is_numeric($ret)) $ret = array('number', $ret, ""); - elseif (!is_array($ret)) $ret = array('keyword', $ret); + // convert to a typed value if the result is a php primitive + if (is_numeric($ret)) $ret = array('number', $ret, ""); + elseif (!is_array($ret)) $ret = array('keyword', $ret); - return $ret; - } + return $ret; + } - // plain function, reduce args - $value[2] = $this->reduce($value[2]); - return $value; - case "unary": - list(, $op, $exp) = $value; - $exp = $this->reduce($exp); - - if ($exp[0] == "number") { - switch ($op) { - case "+": - return $exp; - case "-": - $exp[1] *= -1; - return $exp; + // plain function, reduce args + $value[2] = $this->reduce($value[2]); + return $value; + case "unary": + list(, $op, $exp) = $value; + $exp = $this->reduce($exp); + + if ($exp[0] == "number") { + switch ($op) { + case "+": + return $exp; + case "-": + $exp[1] *= -1; + return $exp; + } } - } - return array("string", "", array($op, $exp)); + return array("string", "", array($op, $exp)); } if ($forExpression) { switch ($value[0]) { - case "keyword": - if ($color = $this->coerceColor($value)) { - return $color; - } - break; - case "raw_color": - return $this->coerceColor($value); + case "keyword": + if ($color = $this->coerceColor($value)) { + return $color; + } + break; + case "raw_color": + return $this->coerceColor($value); } } @@ -1357,10 +1593,10 @@ protected function coerceColor($value) { // make something string like into a string protected function coerceString($value) { switch ($value[0]) { - case "string": - return $value; - case "keyword": - return array("string", "", array($value[1])); + case "string": + return $value; + case "keyword": + return array("string", "", array($value[1])); } return null; } @@ -1373,7 +1609,7 @@ protected function flattenList($value) { return $value; } - protected function toBool($a) { + public function toBool($a) { if ($a) return self::$TRUE; else return self::$FALSE; } @@ -1470,24 +1706,24 @@ protected function op_color_color($op, $left, $right) { $lval = isset($left[$i]) ? $left[$i] : 0; $rval = isset($right[$i]) ? $right[$i] : 0; switch ($op) { - case '+': - $out[] = $lval + $rval; - break; - case '-': - $out[] = $lval - $rval; - break; - case '*': - $out[] = $lval * $rval; - break; - case '%': - $out[] = $lval % $rval; - break; - case '/': - if ($rval == 0) $this->throwError("evaluate error: can't divide by zero"); - $out[] = $lval / $rval; - break; - default: - $this->throwError('evaluate error: color op number failed on op '.$op); + case '+': + $out[] = $lval + $rval; + break; + case '-': + $out[] = $lval - $rval; + break; + case '*': + $out[] = $lval * $rval; + break; + case '%': + $out[] = $lval % $rval; + break; + case '/': + if ($rval == 0) $this->throwError("evaluate error: can't divide by zero"); + $out[] = $lval / $rval; + break; + default: + $this->throwError('evaluate error: color op number failed on op '.$op); } } return $this->fixColor($out); @@ -1527,32 +1763,32 @@ protected function op_number_number($op, $left, $right) { $value = 0; switch ($op) { - case '+': - $value = $left[1] + $right[1]; - break; - case '*': - $value = $left[1] * $right[1]; - break; - case '-': - $value = $left[1] - $right[1]; - break; - case '%': - $value = $left[1] % $right[1]; - break; - case '/': - if ($right[1] == 0) $this->throwError('parse error: divide by zero'); - $value = $left[1] / $right[1]; - break; - case '<': - return $this->toBool($left[1] < $right[1]); - case '>': - return $this->toBool($left[1] > $right[1]); - case '>=': - return $this->toBool($left[1] >= $right[1]); - case '=<': - return $this->toBool($left[1] <= $right[1]); - default: - $this->throwError('parse error: unknown number operator: '.$op); + case '+': + $value = $left[1] + $right[1]; + break; + case '*': + $value = $left[1] * $right[1]; + break; + case '-': + $value = $left[1] - $right[1]; + break; + case '%': + $value = $left[1] % $right[1]; + break; + case '/': + if ($right[1] == 0) $this->throwError('parse error: divide by zero'); + $value = $left[1] / $right[1]; + break; + case '<': + return $this->toBool($left[1] < $right[1]); + case '>': + return $this->toBool($left[1] > $right[1]); + case '>=': + return $this->toBool($left[1] >= $right[1]); + case '=<': + return $this->toBool($left[1] <= $right[1]); + default: + $this->throwError('parse error: unknown number operator: '.$op); } return array("number", $value, $unit); @@ -1596,7 +1832,7 @@ protected function set($name, $value) { // get the highest occurrence entry for a name - protected function get($name, $default=null) { + protected function get($name) { $current = $this->env; $isArguments = $name == $this->vPrefix . 'arguments'; @@ -1613,7 +1849,7 @@ protected function get($name, $default=null) { } } - return $default; + $this->throwError("variable $name is undefined"); } // inject array of unparsed strings into environment as variables @@ -1681,7 +1917,6 @@ public function compileFile($fname, $outFname = null) { $this->importDir = (array)$this->importDir; $this->importDir[] = $pi['dirname'].'/'; - $this->allParsedFiles = array(); $this->addParsedFile($fname); $out = $this->compile(file_get_contents($fname), $fname); @@ -1850,14 +2085,14 @@ public function allParsedFiles() { return $this->allParsedFiles; } - protected function addParsedFile($file) { + public function addParsedFile($file) { $this->allParsedFiles[realpath($file)] = filemtime($file); } /** * Uses the current value of $this->count to show line and line number */ - protected function throwError($msg = null) { + public function throwError($msg = null) { if ($this->sourceLoc >= 0) { $this->sourceParser->throwError($msg, $this->sourceLoc); } @@ -2065,7 +2300,7 @@ class lessc_parser { static protected $supressDivisionProps = array('/border-radius$/i', '/^font$/i'); - protected $blockDirectives = array("font-face", "keyframes", "page", "-moz-document"); + protected $blockDirectives = array("font-face", "keyframes", "page", "-moz-document", "viewport", "-moz-viewport", "-o-viewport", "-ms-viewport"); protected $lineDirectives = array("charset"); /** @@ -2123,14 +2358,13 @@ public function parse($buffer) { $this->whitespace(); // parse the entire file - $lastCount = $this->count; while (false !== $this->parseChunk()); if ($this->count != strlen($this->buffer)) $this->throwError(); // TODO report where the block was opened - if (!is_null($this->env->parent)) + if ( !property_exists($this->env, 'parent') || !is_null($this->env->parent) ) throw new exception('parse error: unclosed block'); return $this->env; @@ -2176,6 +2410,10 @@ protected function parseChunk() { if (empty($this->buffer)) return false; $s = $this->seek(); + if ($this->whitespace()) { + return true; + } + // setting a property if ($this->keyword($key) && $this->assign() && $this->propertyValue($value, $key) && $this->end()) @@ -2256,7 +2494,7 @@ protected function parseChunk() { } // opening a simple block - if ($this->tags($tags) && $this->literal('{')) { + if ($this->tags($tags) && $this->literal('{', false)) { $tags = $this->fixTags($tags); $this->pushBlock($tags); return true; @@ -2304,7 +2542,7 @@ protected function parseChunk() { // mixin if ($this->mixinTags($tags) && - ($this->argumentValues($argv) || true) && + ($this->argumentDef($argv, $isVararg) || true) && ($this->keyword($suffix) || true) && $this->end()) { $tags = $this->fixTags($tags); @@ -2483,8 +2721,8 @@ protected function value(&$value) { // negation if ($this->literal("-", false) && (($this->variable($inner) && $inner = array("variable", $inner)) || - $this->unit($inner) || - $this->parenValue($inner))) + $this->unit($inner) || + $this->parenValue($inner))) { $value = array("unary", "-", $inner); return true; @@ -2531,7 +2769,6 @@ protected function value(&$value) { // an import statement protected function import(&$out) { - $s = $this->seek(); if (!$this->literal('@import')) return false; // @import "something.css" media; @@ -2653,7 +2890,6 @@ protected function openString($end, &$out, $nestingOpen=null, $rejectStrs = null } if (!empty($rejectStrs) && in_array($tok, $rejectStrs)) { - $ount = null; break; } @@ -2773,38 +3009,18 @@ protected function color(&$out) { return false; } - // consume a list of property values delimited by ; and wrapped in () - protected function argumentValues(&$args, $delim = ',') { - $s = $this->seek(); - if (!$this->literal('(')) return false; - - $values = array(); - while (true) { - if ($this->expressionList($value)) $values[] = $value; - if (!$this->literal($delim)) break; - else { - if ($value == null) $values[] = null; - $value = null; - } - } - - if (!$this->literal(')')) { - $this->seek($s); - return false; - } - - $args = $values; - return true; - } - // consume an argument definition list surrounded by () // each argument is a variable name with optional value // or at the end a ... or a variable named followed by ... - protected function argumentDef(&$args, &$isVararg, $delim = ',') { + // arguments are separated by , unless a ; is in the list, then ; is the + // delimiter. + protected function argumentDef(&$args, &$isVararg) { $s = $this->seek(); if (!$this->literal('(')) return false; $values = array(); + $delim = ","; + $method = "expressionList"; $isVararg = false; while (true) { @@ -2813,28 +3029,77 @@ protected function argumentDef(&$args, &$isVararg, $delim = ',') { break; } - if ($this->variable($vname)) { - $arg = array("arg", $vname); - $ss = $this->seek(); - if ($this->assign() && $this->expressionList($value)) { - $arg[] = $value; - } else { - $this->seek($ss); - if ($this->literal("...")) { - $arg[0] = "rest"; - $isVararg = true; + if ($this->$method($value)) { + if ($value[0] == "variable") { + $arg = array("arg", $value[1]); + $ss = $this->seek(); + + if ($this->assign() && $this->$method($rhs)) { + $arg[] = $rhs; + } else { + $this->seek($ss); + if ($this->literal("...")) { + $arg[0] = "rest"; + $isVararg = true; + } } + + $values[] = $arg; + if ($isVararg) break; + continue; + } else { + $values[] = array("lit", $value); } - $values[] = $arg; - if ($isVararg) break; - continue; } - if ($this->value($literal)) { - $values[] = array("lit", $literal); - } - if (!$this->literal($delim)) break; + if (!$this->literal($delim)) { + if ($delim == "," && $this->literal(";")) { + // found new delim, convert existing args + $delim = ";"; + $method = "propertyValue"; + + // transform arg list + if (isset($values[1])) { // 2 items + $newList = array(); + foreach ($values as $i => $arg) { + switch($arg[0]) { + case "arg": + if ($i) { + $this->throwError("Cannot mix ; and , as delimiter types"); + } + $newList[] = $arg[2]; + break; + case "lit": + $newList[] = $arg[1]; + break; + case "rest": + $this->throwError("Unexpected rest before semicolon"); + } + } + + $newList = array("list", ", ", $newList); + + switch ($values[0][0]) { + case "arg": + $newArg = array("arg", $values[0][1], $newList); + break; + case "lit": + $newArg = array("lit", $newList); + break; + } + + } elseif ($values) { // 1 item + $newArg = $values[0]; + } + + if ($newArg) { + $values = array($newArg); + } + } else { + break; + } + } } if (!$this->literal(')')) { @@ -2863,7 +3128,6 @@ protected function tags(&$tags, $simple = false, $delim = ',') { // list of tags of specifying mixin path // optionally separated by > (lazy, accepts extra >) protected function mixinTags(&$tags) { - $s = $this->seek(); $tags = array(); while ($this->tag($tt, true)) { $tags[] = $tt; @@ -2876,32 +3140,69 @@ protected function mixinTags(&$tags) { } // a bracketed value (contained within in a tag definition) - protected function tagBracket(&$value) { + protected function tagBracket(&$parts, &$hasExpression) { // speed shortcut if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] != "[") { return false; } $s = $this->seek(); - if ($this->literal('[') && $this->to(']', $c, true) && $this->literal(']', false)) { - $value = '['.$c.']'; - // whitespace? - if ($this->whitespace()) $value .= " "; - // escape parent selector, (yuck) - $value = str_replace($this->lessc->parentSelector, "$&$", $value); - return true; - } + $hasInterpolation = false; - $this->seek($s); - return false; - } + if ($this->literal("[", false)) { + $attrParts = array("["); + // keyword, string, operator + while (true) { + if ($this->literal("]", false)) { + $this->count--; + break; // get out early + } - protected function tagExpression(&$value) { - $s = $this->seek(); - if ($this->literal("(") && $this->expression($exp) && $this->literal(")")) { - $value = array('exp', $exp); - return true; + if ($this->match('\s+', $m)) { + $attrParts[] = " "; + continue; + } + if ($this->string($str)) { + // escape parent selector, (yuck) + foreach ($str[2] as &$chunk) { + $chunk = str_replace($this->lessc->parentSelector, "$&$", $chunk); + } + + $attrParts[] = $str; + $hasInterpolation = true; + continue; + } + + if ($this->keyword($word)) { + $attrParts[] = $word; + continue; + } + + if ($this->interpolation($inter, false)) { + $attrParts[] = $inter; + $hasInterpolation = true; + continue; + } + + // operator, handles attr namespace too + if ($this->match('[|-~\$\*\^=]+', $m)) { + $attrParts[] = $m[0]; + continue; + } + + break; + } + + if ($this->literal("]", false)) { + $attrParts[] = "]"; + foreach ($attrParts as $part) { + $parts[] = $part; + } + $hasExpression = $hasExpression || $hasInterpolation; + return true; + } + $this->seek($s); } $this->seek($s); @@ -2917,13 +3218,9 @@ protected function tag(&$tag, $simple = false) { $s = $this->seek(); - if (!$simple && $this->tagExpression($tag)) { - return true; - } - $hasExpression = false; $parts = array(); - while ($this->tagBracket($first)) $parts[] = $first; + while ($this->tagBracket($parts, $hasExpression)); $oldWhite = $this->eatWhiteDefault; $this->eatWhiteDefault = false; @@ -2933,9 +3230,7 @@ protected function tag(&$tag, $simple = false) { $parts[] = $m[1]; if ($simple) break; - while ($this->tagBracket($brack)) { - $parts[] = $brack; - } + while ($this->tagBracket($parts, $hasExpression)); continue; } @@ -3060,9 +3355,9 @@ protected function keyword(&$word) { // consume an end of statement delimiter protected function end() { - if ($this->literal(';')) { + if ($this->literal(';', false)) { return true; - } elseif ($this->count == strlen($this->buffer) || $this->buffer{$this->count} == '}') { + } elseif ($this->count == strlen($this->buffer) || $this->buffer[$this->count] == '}') { // if there is end of file or a closing block next then we don't need a ; return true; } @@ -3209,9 +3504,9 @@ protected function whitespace() { if ($this->writeComments) { $gotWhite = false; while (preg_match(self::$whitePattern, $this->buffer, $m, null, $this->count)) { - if (isset($m[1]) && empty($this->commentsSeen[$this->count])) { + if (isset($m[1]) && empty($this->seenComments[$this->count])) { $this->append(array("comment", $m[1])); - $this->commentsSeen[$this->count] = true; + $this->seenComments[$this->count] = true; } $this->count += strlen($m[0]); $gotWhite = true; @@ -3320,26 +3615,26 @@ protected function removeComments($text) { $skip = 0; $newlines = 0; switch ($min[0]) { - case 'url(': - if (preg_match('/url\(.*?\)/', $text, $m, 0, $count)) - $count += strlen($m[0]) - strlen($min[0]); - break; - case '"': - case "'": - if (preg_match('/'.$min[0].'.*?'.$min[0].'/', $text, $m, 0, $count)) - $count += strlen($m[0]) - 1; - break; - case '//': - $skip = strpos($text, "\n", $count); - if ($skip === false) $skip = strlen($text) - $count; - else $skip -= $count; - break; - case '/*': - if (preg_match('/\/\*.*?\*\//s', $text, $m, 0, $count)) { - $skip = strlen($m[0]); - $newlines = substr_count($m[0], "\n"); - } - break; + case 'url(': + if (preg_match('/url\(.*?\)/', $text, $m, 0, $count)) + $count += strlen($m[0]) - strlen($min[0]); + break; + case '"': + case "'": + if (preg_match('/'.$min[0].'.*?(?parse(); diff --git a/libraries/vendor/leafo/lessphp/lessify.inc.php b/libraries/vendor/leafo/lessphp/lessify.inc.php index 96d7d2a923139..56b0e7a0b8d5a 100644 --- a/libraries/vendor/leafo/lessphp/lessify.inc.php +++ b/libraries/vendor/leafo/lessphp/lessify.inc.php @@ -49,7 +49,7 @@ function match($regex, &$out, $eatWhitespace = true) { } function literal($what, $eatWhitespace = true) { - // this is here mainly prevent notice from { } string accessor + // this is here mainly prevent notice from { } string accessor if ($this->count >= strlen($this->buffer)) return false; // shortcut on single letter @@ -73,9 +73,9 @@ class tagparse extends easyparse { function parse() { if (empty(self::$combinators)) { self::$combinators = '('.implode('|', array_map(array($this, 'preg_quote'), - array('+', '>', '~'))).')'; + array('+', '>', '~'))).')'; self::$match_opts = '('.implode('|', array_map(array($this, 'preg_quote'), - array('=', '~=', '|=', '$=', '*='))).')'; + array('=', '~=', '|=', '$=', '*='))).')'; } // crush whitespace @@ -137,36 +137,36 @@ function string(&$out) { for ($i = $this->count; $i < strlen($this->buffer); $i++) { $char = $this->buffer[$i]; switch ($char) { - case $delim: - if ($escapeNext) { + case $delim: + if ($escapeNext) { + $buff .= $char; + $escapeNext = false; + break; + } + $finished = true; + break 2; + case "\\": + if ($escapeNext) { + $buff .= $char; + $escapeNext = false; + } else { + $escapeNext = true; + } + break; + case "\n": + if (!$escapeNext) { + break 3; + } + $buff .= $char; $escapeNext = false; break; - } - $finished = true; - break 2; - case "\\": - if ($escapeNext) { + default: + if ($escapeNext) { + $buff .= "\\"; + $escapeNext = false; + } $buff .= $char; - $escapeNext = false; - } else { - $escapeNext = true; - } - break; - case "\n": - if (!$escapeNext) { - break 3; - } - - $buff .= $char; - $escapeNext = false; - break; - default: - if ($escapeNext) { - $buff .= "\\"; - $escapeNext = false; - } - $buff .= $char; } } if (!$finished) break; @@ -419,7 +419,7 @@ public function parse($str = null) { $order[] = array('compressed', $common, $block); continue; } - + } $order[] = array('none', $block['__tags'], $block); @@ -444,4 +444,4 @@ public function parse($str = null) { } } } -} +} \ No newline at end of file diff --git a/libraries/vendor/leafo/lessphp/plessc b/libraries/vendor/leafo/lessphp/plessc index 6337f996ce260..bba0e439da995 100755 --- a/libraries/vendor/leafo/lessphp/plessc +++ b/libraries/vendor/leafo/lessphp/plessc @@ -1,7 +1,7 @@ #!/usr/bin/env php , 2012 +// Leaf Corcoran , 2013 $exe = array_shift($argv); // remove filename @@ -247,4 +247,4 @@ try { exit(1); } -?> +?> \ No newline at end of file diff --git a/templates/beez3/css/turq.css b/templates/beez3/css/turq.css index 2f0eb0099b679..29a743bdd3370 100644 --- a/templates/beez3/css/turq.css +++ b/templates/beez3/css/turq.css @@ -65,7 +65,6 @@ a:focus { text-decoration: none; padding: 0px 10px; margin: 0; - display: inline-block; margin: 0 0 0; padding: 12px 15px; position: relative; diff --git a/templates/protostar/css/template.css b/templates/protostar/css/template.css index 2f880bb4631ce..7a5d689187808 100644 --- a/templates/protostar/css/template.css +++ b/templates/protostar/css/template.css @@ -4692,6 +4692,9 @@ a.badge:focus { .affix { position: fixed; } +@-ms-viewport { + width: device-width; +} .hidden { display: none; visibility: hidden; From 5846280c47a078589f460ef900f328e99d9bd124 Mon Sep 17 00:00:00 2001 From: dgt41 Date: Thu, 13 Aug 2015 02:18:49 +0300 Subject: [PATCH 2/8] CS --- libraries/cms/less/less.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libraries/cms/less/less.php b/libraries/cms/less/less.php index a1f31e021fbe0..12e516dee47b7 100644 --- a/libraries/cms/less/less.php +++ b/libraries/cms/less/less.php @@ -38,12 +38,13 @@ public function __construct($fname = null, $formatter = null) $this->setFormatter($formatter); } - /* + /** * Override compile because $this->allParsedFiles needs to be an array * * For documentation on this please see /vendor/leafo/lessc.inc.php */ - public function compile($string, $name = null) { + public function compile($string, $name = null) + { $locale = setlocale(LC_NUMERIC, 0); setlocale(LC_NUMERIC, "C"); @@ -56,11 +57,12 @@ public function compile($string, $name = null) { $this->formatter = $this->newFormatter(); - if (!empty($this->registeredVars)) { + if (!empty($this->registeredVars)) + { $this->injectVariables($this->registeredVars); } - $this->sourceParser = $this->parser; // used for error messages + $this->sourceParser = $this->parser; // Used for error messages $this->compileBlock($root); ob_start(); From 7350f59847106f69fb0d7ef3c2495247c148c4f6 Mon Sep 17 00:00:00 2001 From: dgt41 Date: Thu, 13 Aug 2015 03:03:27 +0300 Subject: [PATCH 3/8] composer update --- composer.json | 2 +- libraries/vendor/autoload.php | 2 +- libraries/vendor/composer/include_paths.php | 16 + libraries/vendor/leafo/lessphp/LICENSE | 1 + libraries/vendor/leafo/lessphp/lessc.inc.php | 877 +++++++++--------- libraries/vendor/leafo/lessphp/lessify | 4 + .../vendor/leafo/lessphp/lessify.inc.php | 58 +- libraries/vendor/leafo/lessphp/plessc | 2 +- 8 files changed, 492 insertions(+), 470 deletions(-) create mode 100644 libraries/vendor/composer/include_paths.php diff --git a/composer.json b/composer.json index 12d67fd0c6715..ba4e4930ec1d9 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "joomla/uri": "~1.1", "joomla/utilities": "~1.3 >=1.3.3", "ircmaxell/password-compat": "1.*", - "leafo/lessphp": "0.3.9", + "leafo/lessphp": "0.5.0", "paragonie/random_compat": "~1.0", "phpmailer/phpmailer": "5.2.14", "symfony/polyfill-php56": "~1.0", diff --git a/libraries/vendor/autoload.php b/libraries/vendor/autoload.php index 4cc388d9f7229..60a7a17121ed1 100644 --- a/libraries/vendor/autoload.php +++ b/libraries/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer' . '/autoload_real.php'; -return ComposerAutoloaderInit0efb534ee20646bcb987f4359c38b3aa::getLoader(); +return ComposerAutoloaderInit48348541022a81b1fa5c954ec4a92d1e::getLoader(); diff --git a/libraries/vendor/composer/include_paths.php b/libraries/vendor/composer/include_paths.php new file mode 100644 index 0000000000000..7956cd3bd48f9 --- /dev/null +++ b/libraries/vendor/composer/include_paths.php @@ -0,0 +1,16 @@ +type) { - case "root": - $this->compileRoot($block); - break; - case null: - $this->compileCSSBlock($block); - break; - case "media": - $this->compileMedia($block); - break; - case "directive": - $name = "@" . $block->name; - if (!empty($block->value)) { - $name .= " " . $this->compileValue($this->reduce($block->value)); - } + case "root": + $this->compileRoot($block); + break; + case null: + $this->compileCSSBlock($block); + break; + case "media": + $this->compileMedia($block); + break; + case "directive": + $name = "@" . $block->name; + if (!empty($block->value)) { + $name .= " " . $this->compileValue($this->reduce($block->value)); + } - $this->compileNestedBlock($block, array($name)); - break; - default: - $this->throwError("unknown block type: $block->type\n"); + $this->compileNestedBlock($block, array($name)); + break; + default: + $this->throwError("unknown block type: $block->type\n"); } } @@ -316,31 +316,31 @@ protected function sortProps($props, $split = false) { foreach ($props as $prop) { switch ($prop[0]) { - case "comment": - $stack[] = $prop; - break; - case "assign": - $stack[] = $prop; - if (isset($prop[1][0]) && $prop[1][0] == $this->vPrefix) { - $vars = array_merge($vars, $stack); - } else { - $other = array_merge($other, $stack); - } - $stack = array(); - break; - case "import": - $id = self::$nextImportId++; - $prop[] = $id; - $stack[] = $prop; - $imports = array_merge($imports, $stack); - $other[] = array("import_mixin", $id); - $stack = array(); - break; - default: - $stack[] = $prop; + case "comment": + $stack[] = $prop; + break; + case "assign": + $stack[] = $prop; + if (isset($prop[1][0]) && $prop[1][0] == $this->vPrefix) { + $vars = array_merge($vars, $stack); + } else { $other = array_merge($other, $stack); - $stack = array(); - break; + } + $stack = array(); + break; + case "import": + $id = self::$nextImportId++; + $prop[] = $id; + $stack[] = $prop; + $imports = array_merge($imports, $stack); + $other[] = array("import_mixin", $id); + $stack = array(); + break; + default: + $stack[] = $prop; + $other = array_merge($other, $stack); + $stack = array(); + break; } } $other = array_merge($other, $stack); @@ -358,20 +358,20 @@ protected function compileMediaQuery($queries) { $parts = array(); foreach ($query as $q) { switch ($q[0]) { - case "mediaType": - $parts[] = implode(" ", array_slice($q, 1)); - break; - case "mediaExp": - if (isset($q[2])) { - $parts[] = "($q[1]: " . - $this->compileValue($this->reduce($q[2])) . ")"; - } else { - $parts[] = "($q[1])"; - } - break; - case "variable": - $parts[] = $this->compileValue($this->reduce($q)); - break; + case "mediaType": + $parts[] = implode(" ", array_slice($q, 1)); + break; + case "mediaExp": + if (isset($q[2])) { + $parts[] = "($q[1]: " . + $this->compileValue($this->reduce($q[2])) . ")"; + } else { + $parts[] = "($q[1])"; + } + break; + case "variable": + $parts[] = $this->compileValue($this->reduce($q)); + break; } } @@ -549,20 +549,20 @@ protected function patternMatch($block, $orderedArgs, $keywordArgs) { // try to match by arity or by argument literal foreach ($remainingArgs as $i => $arg) { switch ($arg[0]) { - case "lit": - if (empty($orderedArgs[$i]) || !$this->eq($arg[1], $orderedArgs[$i])) { - return false; - } - break; - case "arg": - // no arg and no default value - if (!isset($orderedArgs[$i]) && !isset($arg[2])) { - return false; - } - break; - case "rest": - $i--; // rest can be empty - break 2; + case "lit": + if (empty($orderedArgs[$i]) || !$this->eq($arg[1], $orderedArgs[$i])) { + return false; + } + break; + case "arg": + // no arg and no default value + if (!isset($orderedArgs[$i]) && !isset($arg[2])) { + return false; + } + break; + case "rest": + $i--; // rest can be empty + break 2; } } @@ -677,133 +677,133 @@ protected function compileProp($prop, $block, $out) { $this->sourceLoc = isset($prop[-1]) ? $prop[-1] : -1; switch ($prop[0]) { - case 'assign': - list(, $name, $value) = $prop; - if ($name[0] == $this->vPrefix) { - $this->set($name, $value); - } else { - $out->lines[] = $this->formatter->property($name, + case 'assign': + list(, $name, $value) = $prop; + if ($name[0] == $this->vPrefix) { + $this->set($name, $value); + } else { + $out->lines[] = $this->formatter->property($name, $this->compileValue($this->reduce($value))); - } - break; - case 'block': - list(, $child) = $prop; - $this->compileBlock($child); - break; - case 'mixin': - list(, $path, $args, $suffix) = $prop; - - $orderedArgs = array(); - $keywordArgs = array(); - foreach ((array)$args as $arg) { - $argval = null; - switch ($arg[0]) { - case "arg": - if (!isset($arg[2])) { - $orderedArgs[] = $this->reduce(array("variable", $arg[1])); - } else { - $keywordArgs[$arg[1]] = $this->reduce($arg[2]); - } - break; - - case "lit": - $orderedArgs[] = $this->reduce($arg[1]); - break; - default: - $this->throwError("Unknown arg type: " . $arg[0]); + } + break; + case 'block': + list(, $child) = $prop; + $this->compileBlock($child); + break; + case 'mixin': + list(, $path, $args, $suffix) = $prop; + + $orderedArgs = array(); + $keywordArgs = array(); + foreach ((array)$args as $arg) { + $argval = null; + switch ($arg[0]) { + case "arg": + if (!isset($arg[2])) { + $orderedArgs[] = $this->reduce(array("variable", $arg[1])); + } else { + $keywordArgs[$arg[1]] = $this->reduce($arg[2]); } + break; + + case "lit": + $orderedArgs[] = $this->reduce($arg[1]); + break; + default: + $this->throwError("Unknown arg type: " . $arg[0]); } + } - $mixins = $this->findBlocks($block, $path, $orderedArgs, $keywordArgs); + $mixins = $this->findBlocks($block, $path, $orderedArgs, $keywordArgs); - if ($mixins === null) { - $this->throwError("{$prop[1][0]} is undefined"); - } + if ($mixins === null) { + $this->throwError("{$prop[1][0]} is undefined"); + } - foreach ($mixins as $mixin) { - if ($mixin === $block && !$orderedArgs) { - continue; - } + foreach ($mixins as $mixin) { + if ($mixin === $block && !$orderedArgs) { + continue; + } - $haveScope = false; - if (isset($mixin->parent->scope)) { - $haveScope = true; - $mixinParentEnv = $this->pushEnv(); - $mixinParentEnv->storeParent = $mixin->parent->scope; - } + $haveScope = false; + if (isset($mixin->parent->scope)) { + $haveScope = true; + $mixinParentEnv = $this->pushEnv(); + $mixinParentEnv->storeParent = $mixin->parent->scope; + } - $haveArgs = false; - if (isset($mixin->args)) { - $haveArgs = true; - $this->pushEnv(); - $this->zipSetArgs($mixin->args, $orderedArgs, $keywordArgs); - } + $haveArgs = false; + if (isset($mixin->args)) { + $haveArgs = true; + $this->pushEnv(); + $this->zipSetArgs($mixin->args, $orderedArgs, $keywordArgs); + } - $oldParent = $mixin->parent; - if ($mixin != $block) $mixin->parent = $block; - - foreach ($this->sortProps($mixin->props) as $subProp) { - if ($suffix !== null && - $subProp[0] == "assign" && - is_string($subProp[1]) && - $subProp[1]{0} != $this->vPrefix) - { - $subProp[2] = array( - 'list', ' ', - array($subProp[2], array('keyword', $suffix)) - ); - } + $oldParent = $mixin->parent; + if ($mixin != $block) $mixin->parent = $block; - $this->compileProp($subProp, $mixin, $out); + foreach ($this->sortProps($mixin->props) as $subProp) { + if ($suffix !== null && + $subProp[0] == "assign" && + is_string($subProp[1]) && + $subProp[1]{0} != $this->vPrefix) + { + $subProp[2] = array( + 'list', ' ', + array($subProp[2], array('keyword', $suffix)) + ); } - $mixin->parent = $oldParent; - - if ($haveArgs) $this->popEnv(); - if ($haveScope) $this->popEnv(); + $this->compileProp($subProp, $mixin, $out); } - break; - case 'raw': - $out->lines[] = $prop[1]; - break; - case "directive": - list(, $name, $value) = $prop; - $out->lines[] = "@$name " . $this->compileValue($this->reduce($value)).';'; - break; - case "comment": - $out->lines[] = $prop[1]; - break; - case "import"; - list(, $importPath, $importId) = $prop; - $importPath = $this->reduce($importPath); + $mixin->parent = $oldParent; - if (!isset($this->env->imports)) { - $this->env->imports = array(); - } + if ($haveArgs) $this->popEnv(); + if ($haveScope) $this->popEnv(); + } + + break; + case 'raw': + $out->lines[] = $prop[1]; + break; + case "directive": + list(, $name, $value) = $prop; + $out->lines[] = "@$name " . $this->compileValue($this->reduce($value)).';'; + break; + case "comment": + $out->lines[] = $prop[1]; + break; + case "import"; + list(, $importPath, $importId) = $prop; + $importPath = $this->reduce($importPath); - $result = $this->tryImport($importPath, $block, $out); + if (!isset($this->env->imports)) { + $this->env->imports = array(); + } - $this->env->imports[$importId] = $result === false ? - array(false, "@import " . $this->compileValue($importPath).";") : - $result; + $result = $this->tryImport($importPath, $block, $out); - break; - case "import_mixin": - list(,$importId) = $prop; - $import = $this->env->imports[$importId]; - if ($import[0] === false) { - if (isset($import[1])) { - $out->lines[] = $import[1]; - } - } else { - list(, $bottom, $parser, $importDir) = $import; - $this->compileImportedProps($bottom, $block, $out, $parser, $importDir); + $this->env->imports[$importId] = $result === false ? + array(false, "@import " . $this->compileValue($importPath).";") : + $result; + + break; + case "import_mixin": + list(,$importId) = $prop; + $import = $this->env->imports[$importId]; + if ($import[0] === false) { + if (isset($import[1])) { + $out->lines[] = $import[1]; } + } else { + list(, $bottom, $parser, $importDir) = $import; + $this->compileImportedProps($bottom, $block, $out, $parser, $importDir); + } - break; - default: - $this->throwError("unknown op: {$prop[0]}\n"); + break; + default: + $this->throwError("unknown op: {$prop[0]}\n"); } } @@ -821,65 +821,65 @@ protected function compileProp($prop, $block, $out) { */ public function compileValue($value) { switch ($value[0]) { - case 'list': - // [1] - delimiter - // [2] - array of values - return implode($value[1], array_map(array($this, 'compileValue'), $value[2])); - case 'raw_color': - if (!empty($this->formatter->compressColors)) { - return $this->compileValue($this->coerceColor($value)); - } - return $value[1]; - case 'keyword': - // [1] - the keyword - return $value[1]; - case 'number': - list(, $num, $unit) = $value; - // [1] - the number - // [2] - the unit - if ($this->numberPrecision !== null) { - $num = round($num, $this->numberPrecision); - } - return $num . $unit; - case 'string': - // [1] - contents of string (includes quotes) - list(, $delim, $content) = $value; - foreach ($content as &$part) { - if (is_array($part)) { - $part = $this->compileValue($part); - } - } - return $delim . implode($content) . $delim; - case 'color': - // [1] - red component (either number or a %) - // [2] - green component - // [3] - blue component - // [4] - optional alpha component - list(, $r, $g, $b) = $value; - $r = round($r); - $g = round($g); - $b = round($b); - - if (count($value) == 5 && $value[4] != 1) { // rgba - return 'rgba('.$r.','.$g.','.$b.','.$value[4].')'; + case 'list': + // [1] - delimiter + // [2] - array of values + return implode($value[1], array_map(array($this, 'compileValue'), $value[2])); + case 'raw_color': + if (!empty($this->formatter->compressColors)) { + return $this->compileValue($this->coerceColor($value)); + } + return $value[1]; + case 'keyword': + // [1] - the keyword + return $value[1]; + case 'number': + list(, $num, $unit) = $value; + // [1] - the number + // [2] - the unit + if ($this->numberPrecision !== null) { + $num = round($num, $this->numberPrecision); + } + return $num . $unit; + case 'string': + // [1] - contents of string (includes quotes) + list(, $delim, $content) = $value; + foreach ($content as &$part) { + if (is_array($part)) { + $part = $this->compileValue($part); } + } + return $delim . implode($content) . $delim; + case 'color': + // [1] - red component (either number or a %) + // [2] - green component + // [3] - blue component + // [4] - optional alpha component + list(, $r, $g, $b) = $value; + $r = round($r); + $g = round($g); + $b = round($b); - $h = sprintf("#%02x%02x%02x", $r, $g, $b); + if (count($value) == 5 && $value[4] != 1) { // rgba + return 'rgba('.$r.','.$g.','.$b.','.$value[4].')'; + } - if (!empty($this->formatter->compressColors)) { - // Converting hex color to short notation (e.g. #003399 to #039) - if ($h[1] === $h[2] && $h[3] === $h[4] && $h[5] === $h[6]) { - $h = '#' . $h[1] . $h[3] . $h[5]; - } + $h = sprintf("#%02x%02x%02x", $r, $g, $b); + + if (!empty($this->formatter->compressColors)) { + // Converting hex color to short notation (e.g. #003399 to #039) + if ($h[1] === $h[2] && $h[3] === $h[4] && $h[5] === $h[6]) { + $h = '#' . $h[1] . $h[3] . $h[5]; } + } - return $h; + return $h; - case 'function': - list(, $name, $args) = $value; - return $name.'('.$this->compileValue($args).')'; - default: // assumed to be unit - $this->throwError("unknown value type: $value[0]"); + case 'function': + list(, $name, $args) = $value; + return $name.'('.$this->compileValue($args).')'; + default: // assumed to be unit + $this->throwError("unknown value type: $value[0]"); } } @@ -1239,41 +1239,41 @@ protected function lib_mix($args) { } protected function lib_contrast($args) { - $darkColor = array('color', 0, 0, 0); - $lightColor = array('color', 255, 255, 255); - $threshold = 0.43; - - if ( $args[0] == 'list' ) { - $inputColor = ( isset($args[2][0]) ) ? $this->assertColor($args[2][0]) : $lightColor; - $darkColor = ( isset($args[2][1]) ) ? $this->assertColor($args[2][1]) : $darkColor; - $lightColor = ( isset($args[2][2]) ) ? $this->assertColor($args[2][2]) : $lightColor; - $threshold = ( isset($args[2][3]) ) ? $this->assertNumber($args[2][3]) : $threshold; - } - else { - $inputColor = $this->assertColor($args); - } - - $inputColor = $this->coerceColor($inputColor); - $darkColor = $this->coerceColor($darkColor); - $lightColor = $this->coerceColor($lightColor); - - //Figure out which is actually light and dark! - if ( $this->lib_luma($darkColor) > $this->lib_luma($lightColor) ) { - $t = $lightColor; - $lightColor = $darkColor; - $darkColor = $t; - } - - $inputColor_alpha = $this->lib_alpha($inputColor); - if ( ( $this->lib_luma($inputColor) * $inputColor_alpha) < $threshold) { - return $lightColor; - } - return $darkColor; + $darkColor = array('color', 0, 0, 0); + $lightColor = array('color', 255, 255, 255); + $threshold = 0.43; + + if ( $args[0] == 'list' ) { + $inputColor = ( isset($args[2][0]) ) ? $this->assertColor($args[2][0]) : $lightColor; + $darkColor = ( isset($args[2][1]) ) ? $this->assertColor($args[2][1]) : $darkColor; + $lightColor = ( isset($args[2][2]) ) ? $this->assertColor($args[2][2]) : $lightColor; + $threshold = ( isset($args[2][3]) ) ? $this->assertNumber($args[2][3]) : $threshold; + } + else { + $inputColor = $this->assertColor($args); + } + + $inputColor = $this->coerceColor($inputColor); + $darkColor = $this->coerceColor($darkColor); + $lightColor = $this->coerceColor($lightColor); + + //Figure out which is actually light and dark! + if ( $this->lib_luma($darkColor) > $this->lib_luma($lightColor) ) { + $t = $lightColor; + $lightColor = $darkColor; + $darkColor = $t; + } + + $inputColor_alpha = $this->lib_alpha($inputColor); + if ( ( $this->lib_luma($inputColor) * $inputColor_alpha) < $threshold) { + return $lightColor; + } + return $darkColor; } protected function lib_luma($color) { - $color = $this->coerceColor($color); - return (0.2126 * $color[0] / 255) + (0.7152 * $color[1] / 255) + (0.0722 * $color[2] / 255); + $color = $this->coerceColor($color); + return (0.2126 * $color[0] / 255) + (0.7152 * $color[1] / 255) + (0.0722 * $color[2] / 255); } @@ -1446,111 +1446,111 @@ protected function funcToColor($func) { protected function reduce($value, $forExpression = false) { switch ($value[0]) { - case "interpolate": - $reduced = $this->reduce($value[1]); - $var = $this->compileValue($reduced); - $res = $this->reduce(array("variable", $this->vPrefix . $var)); + case "interpolate": + $reduced = $this->reduce($value[1]); + $var = $this->compileValue($reduced); + $res = $this->reduce(array("variable", $this->vPrefix . $var)); - if ($res[0] == "raw_color") { - $res = $this->coerceColor($res); - } + if ($res[0] == "raw_color") { + $res = $this->coerceColor($res); + } - if (empty($value[2])) $res = $this->lib_e($res); + if (empty($value[2])) $res = $this->lib_e($res); - return $res; - case "variable": - $key = $value[1]; - if (is_array($key)) { - $key = $this->reduce($key); - $key = $this->vPrefix . $this->compileValue($this->lib_e($key)); - } + return $res; + case "variable": + $key = $value[1]; + if (is_array($key)) { + $key = $this->reduce($key); + $key = $this->vPrefix . $this->compileValue($this->lib_e($key)); + } - $seen =& $this->env->seenNames; + $seen =& $this->env->seenNames; - if (!empty($seen[$key])) { - $this->throwError("infinite loop detected: $key"); - } + if (!empty($seen[$key])) { + $this->throwError("infinite loop detected: $key"); + } - $seen[$key] = true; - $out = $this->reduce($this->get($key)); - $seen[$key] = false; - return $out; - case "list": - foreach ($value[2] as &$item) { - $item = $this->reduce($item, $forExpression); - } - return $value; - case "expression": - return $this->evaluate($value); - case "string": - foreach ($value[2] as &$part) { - if (is_array($part)) { - $strip = $part[0] == "variable"; - $part = $this->reduce($part); - if ($strip) $part = $this->lib_e($part); - } + $seen[$key] = true; + $out = $this->reduce($this->get($key)); + $seen[$key] = false; + return $out; + case "list": + foreach ($value[2] as &$item) { + $item = $this->reduce($item, $forExpression); + } + return $value; + case "expression": + return $this->evaluate($value); + case "string": + foreach ($value[2] as &$part) { + if (is_array($part)) { + $strip = $part[0] == "variable"; + $part = $this->reduce($part); + if ($strip) $part = $this->lib_e($part); } - return $value; - case "escape": - list(,$inner) = $value; - return $this->lib_e($this->reduce($inner)); - case "function": - $color = $this->funcToColor($value); - if ($color) return $color; - - list(, $name, $args) = $value; - if ($name == "%") $name = "_sprintf"; - - $f = isset($this->libFunctions[$name]) ? - $this->libFunctions[$name] : array($this, 'lib_'.str_replace('-', '_', $name)); - - if (is_callable($f)) { - if ($args[0] == 'list') - $args = self::compressList($args[2], $args[1]); - - $ret = call_user_func($f, $this->reduce($args, true), $this); - - if (is_null($ret)) { - return array("string", "", array( - $name, "(", $args, ")" - )); - } + } + return $value; + case "escape": + list(,$inner) = $value; + return $this->lib_e($this->reduce($inner)); + case "function": + $color = $this->funcToColor($value); + if ($color) return $color; - // convert to a typed value if the result is a php primitive - if (is_numeric($ret)) $ret = array('number', $ret, ""); - elseif (!is_array($ret)) $ret = array('keyword', $ret); + list(, $name, $args) = $value; + if ($name == "%") $name = "_sprintf"; - return $ret; + $f = isset($this->libFunctions[$name]) ? + $this->libFunctions[$name] : array($this, 'lib_'.str_replace('-', '_', $name)); + + if (is_callable($f)) { + if ($args[0] == 'list') + $args = self::compressList($args[2], $args[1]); + + $ret = call_user_func($f, $this->reduce($args, true), $this); + + if (is_null($ret)) { + return array("string", "", array( + $name, "(", $args, ")" + )); } - // plain function, reduce args - $value[2] = $this->reduce($value[2]); - return $value; - case "unary": - list(, $op, $exp) = $value; - $exp = $this->reduce($exp); - - if ($exp[0] == "number") { - switch ($op) { - case "+": - return $exp; - case "-": - $exp[1] *= -1; - return $exp; - } + // convert to a typed value if the result is a php primitive + if (is_numeric($ret)) $ret = array('number', $ret, ""); + elseif (!is_array($ret)) $ret = array('keyword', $ret); + + return $ret; + } + + // plain function, reduce args + $value[2] = $this->reduce($value[2]); + return $value; + case "unary": + list(, $op, $exp) = $value; + $exp = $this->reduce($exp); + + if ($exp[0] == "number") { + switch ($op) { + case "+": + return $exp; + case "-": + $exp[1] *= -1; + return $exp; } - return array("string", "", array($op, $exp)); + } + return array("string", "", array($op, $exp)); } if ($forExpression) { switch ($value[0]) { - case "keyword": - if ($color = $this->coerceColor($value)) { - return $color; - } - break; - case "raw_color": - return $this->coerceColor($value); + case "keyword": + if ($color = $this->coerceColor($value)) { + return $color; + } + break; + case "raw_color": + return $this->coerceColor($value); } } @@ -1593,10 +1593,10 @@ protected function coerceColor($value) { // make something string like into a string protected function coerceString($value) { switch ($value[0]) { - case "string": - return $value; - case "keyword": - return array("string", "", array($value[1])); + case "string": + return $value; + case "keyword": + return array("string", "", array($value[1])); } return null; } @@ -1706,24 +1706,24 @@ protected function op_color_color($op, $left, $right) { $lval = isset($left[$i]) ? $left[$i] : 0; $rval = isset($right[$i]) ? $right[$i] : 0; switch ($op) { - case '+': - $out[] = $lval + $rval; - break; - case '-': - $out[] = $lval - $rval; - break; - case '*': - $out[] = $lval * $rval; - break; - case '%': - $out[] = $lval % $rval; - break; - case '/': - if ($rval == 0) $this->throwError("evaluate error: can't divide by zero"); - $out[] = $lval / $rval; - break; - default: - $this->throwError('evaluate error: color op number failed on op '.$op); + case '+': + $out[] = $lval + $rval; + break; + case '-': + $out[] = $lval - $rval; + break; + case '*': + $out[] = $lval * $rval; + break; + case '%': + $out[] = $lval % $rval; + break; + case '/': + if ($rval == 0) $this->throwError("evaluate error: can't divide by zero"); + $out[] = $lval / $rval; + break; + default: + $this->throwError('evaluate error: color op number failed on op '.$op); } } return $this->fixColor($out); @@ -1763,32 +1763,32 @@ protected function op_number_number($op, $left, $right) { $value = 0; switch ($op) { - case '+': - $value = $left[1] + $right[1]; - break; - case '*': - $value = $left[1] * $right[1]; - break; - case '-': - $value = $left[1] - $right[1]; - break; - case '%': - $value = $left[1] % $right[1]; - break; - case '/': - if ($right[1] == 0) $this->throwError('parse error: divide by zero'); - $value = $left[1] / $right[1]; - break; - case '<': - return $this->toBool($left[1] < $right[1]); - case '>': - return $this->toBool($left[1] > $right[1]); - case '>=': - return $this->toBool($left[1] >= $right[1]); - case '=<': - return $this->toBool($left[1] <= $right[1]); - default: - $this->throwError('parse error: unknown number operator: '.$op); + case '+': + $value = $left[1] + $right[1]; + break; + case '*': + $value = $left[1] * $right[1]; + break; + case '-': + $value = $left[1] - $right[1]; + break; + case '%': + $value = $left[1] % $right[1]; + break; + case '/': + if ($right[1] == 0) $this->throwError('parse error: divide by zero'); + $value = $left[1] / $right[1]; + break; + case '<': + return $this->toBool($left[1] < $right[1]); + case '>': + return $this->toBool($left[1] > $right[1]); + case '>=': + return $this->toBool($left[1] >= $right[1]); + case '=<': + return $this->toBool($left[1] <= $right[1]); + default: + $this->throwError('parse error: unknown number operator: '.$op); } return array("number", $value, $unit); @@ -2721,8 +2721,8 @@ protected function value(&$value) { // negation if ($this->literal("-", false) && (($this->variable($inner) && $inner = array("variable", $inner)) || - $this->unit($inner) || - $this->parenValue($inner))) + $this->unit($inner) || + $this->parenValue($inner))) { $value = array("unary", "-", $inner); return true; @@ -3064,29 +3064,29 @@ protected function argumentDef(&$args, &$isVararg) { $newList = array(); foreach ($values as $i => $arg) { switch($arg[0]) { - case "arg": - if ($i) { - $this->throwError("Cannot mix ; and , as delimiter types"); - } - $newList[] = $arg[2]; - break; - case "lit": - $newList[] = $arg[1]; - break; - case "rest": - $this->throwError("Unexpected rest before semicolon"); + case "arg": + if ($i) { + $this->throwError("Cannot mix ; and , as delimiter types"); + } + $newList[] = $arg[2]; + break; + case "lit": + $newList[] = $arg[1]; + break; + case "rest": + $this->throwError("Unexpected rest before semicolon"); } } $newList = array("list", ", ", $newList); switch ($values[0][0]) { - case "arg": - $newArg = array("arg", $values[0][1], $newList); - break; - case "lit": - $newArg = array("lit", $newList); - break; + case "arg": + $newArg = array("arg", $values[0][1], $newList); + break; + case "lit": + $newArg = array("lit", $newList); + break; } } elseif ($values) { // 1 item @@ -3615,26 +3615,26 @@ protected function removeComments($text) { $skip = 0; $newlines = 0; switch ($min[0]) { - case 'url(': - if (preg_match('/url\(.*?\)/', $text, $m, 0, $count)) - $count += strlen($m[0]) - strlen($min[0]); - break; - case '"': - case "'": - if (preg_match('/'.$min[0].'.*?(?parse(); diff --git a/libraries/vendor/leafo/lessphp/lessify.inc.php b/libraries/vendor/leafo/lessphp/lessify.inc.php index 56b0e7a0b8d5a..91c144230c582 100644 --- a/libraries/vendor/leafo/lessphp/lessify.inc.php +++ b/libraries/vendor/leafo/lessphp/lessify.inc.php @@ -73,9 +73,9 @@ class tagparse extends easyparse { function parse() { if (empty(self::$combinators)) { self::$combinators = '('.implode('|', array_map(array($this, 'preg_quote'), - array('+', '>', '~'))).')'; + array('+', '>', '~'))).')'; self::$match_opts = '('.implode('|', array_map(array($this, 'preg_quote'), - array('=', '~=', '|=', '$=', '*='))).')'; + array('=', '~=', '|=', '$=', '*='))).')'; } // crush whitespace @@ -137,36 +137,36 @@ function string(&$out) { for ($i = $this->count; $i < strlen($this->buffer); $i++) { $char = $this->buffer[$i]; switch ($char) { - case $delim: - if ($escapeNext) { - $buff .= $char; - $escapeNext = false; - break; - } - $finished = true; - break 2; - case "\\": - if ($escapeNext) { - $buff .= $char; - $escapeNext = false; - } else { - $escapeNext = true; - } - break; - case "\n": - if (!$escapeNext) { - break 3; - } - + case $delim: + if ($escapeNext) { $buff .= $char; $escapeNext = false; break; - default: - if ($escapeNext) { - $buff .= "\\"; - $escapeNext = false; - } + } + $finished = true; + break 2; + case "\\": + if ($escapeNext) { $buff .= $char; + $escapeNext = false; + } else { + $escapeNext = true; + } + break; + case "\n": + if (!$escapeNext) { + break 3; + } + + $buff .= $char; + $escapeNext = false; + break; + default: + if ($escapeNext) { + $buff .= "\\"; + $escapeNext = false; + } + $buff .= $char; } } if (!$finished) break; @@ -444,4 +444,4 @@ public function parse($str = null) { } } } -} \ No newline at end of file +} diff --git a/libraries/vendor/leafo/lessphp/plessc b/libraries/vendor/leafo/lessphp/plessc index bba0e439da995..1871dc77b8994 100755 --- a/libraries/vendor/leafo/lessphp/plessc +++ b/libraries/vendor/leafo/lessphp/plessc @@ -247,4 +247,4 @@ try { exit(1); } -?> \ No newline at end of file +?> From ce6bd095e9776b2ffc1220701cc4a7c8fa840bb8 Mon Sep 17 00:00:00 2001 From: dgt41 Date: Thu, 13 Aug 2015 03:10:23 +0300 Subject: [PATCH 4/8] docblock --- .../templates/hathor/css/colour_brown.css | 106 +++++++++--------- .../templates/hathor/less/colour_brown.less | 8 +- libraries/cms/less/less.php | 9 +- templates/beez3/css/turq.css | 2 +- templates/beez3/css/turq.less | 1 - 5 files changed, 65 insertions(+), 61 deletions(-) diff --git a/administrator/templates/hathor/css/colour_brown.css b/administrator/templates/hathor/css/colour_brown.css index 2f4bc3da605f1..8f98d221f0316 100644 --- a/administrator/templates/hathor/css/colour_brown.css +++ b/administrator/templates/hathor/css/colour_brown.css @@ -522,33 +522,33 @@ div.toolbar-list li { color: #2c2c2c; } div.toolbar-list li.divider { - border-right: 1px dotted #e1d3c8; + border-right: 1px dotted #e5d9c3; } div.toolbar-list a { - border-left: 1px solid #e1d3c8; - border-top: 1px solid #e1d3c8; + border-left: 1px solid #e5d9c3; + border-top: 1px solid #e5d9c3; border-right: 1px solid #000000; border-bottom: 1px solid #000000; background: #d5c1b2; } div.toolbar-list a:hover { - border-left: 1px solid #000000; - border-top: 1px solid #000000; - border-right: 1px solid #000000; - border-bottom: 1px solid #000000; - background: #e1d3c8; - color: #000000; + border-left: 1px solid #868778; + border-top: 1px solid #868778; + border-right: 1px solid #f6f7db; + border-bottom: 1px solid #f6f7db; + background: #e5d9c3; + color: #054993; } div.btn-toolbar { margin-left: 5px; padding-top: 3px; } div.btn-toolbar li.divider { - border-right: 1px dotted #e1d3c8; + border-right: 1px dotted #e5d9c3; } div.btn-toolbar div.btn-group button { - border-left: 1px solid #e1d3c8; - border-top: 1px solid #e1d3c8; + border-left: 1px solid #e5d9c3; + border-top: 1px solid #e5d9c3; border-right: 1px solid #000000; border-bottom: 1px solid #000000; background-color: #d5c1b2; @@ -562,17 +562,17 @@ div.btn-toolbar div.btn-group button { padding: 5px 4px 5px 4px; } div.btn-toolbar div.btn-group button:hover { - border-left: 1px solid #000000; - border-top: 1px solid #000000; - border-right: 1px solid #000000; - border-bottom: 1px solid #000000; - background: #e1d3c8; - color: #000000; + border-left: 1px solid #868778; + border-top: 1px solid #868778; + border-right: 1px solid #f6f7db; + border-bottom: 1px solid #f6f7db; + background: #e5d9c3; + color: #054993; cursor: pointer; } div.btn-toolbar a { - border-left: 1px solid #e1d3c8; - border-top: 1px solid #e1d3c8; + border-left: 1px solid #e5d9c3; + border-top: 1px solid #e5d9c3; border-right: 1px solid #000000; border-bottom: 1px solid #000000; background-color: #d5c1b2; @@ -590,12 +590,12 @@ div.btn-toolbar a { text-decoration: none; } div.btn-toolbar a:hover { - border-left: 1px solid #000000; - border-top: 1px solid #000000; - border-right: 1px solid #000000; - border-bottom: 1px solid #000000; - background: #e1d3c8; - color: #000000; + border-left: 1px solid #868778; + border-top: 1px solid #868778; + border-right: 1px solid #f6f7db; + border-bottom: 1px solid #f6f7db; + background: #e5d9c3; + color: #054993; cursor: pointer; } div.btn-toolbar div.btn-group button.inactive { @@ -619,7 +619,7 @@ div.btn-toolbar div.btn-group button.inactive { color: #054993; } .pane-sliders .panel h3:hover { - background: #e1d3c8; + background: #e5d9c3; } .pane-sliders .panel h3:hover a { text-decoration: none; @@ -652,7 +652,7 @@ dl.tabs dt { color: #054993; } dl.tabs dt:hover { - background: #e1d3c8; + background: #e5d9c3; } dl.tabs dt.open { background: #ffffff; @@ -710,8 +710,8 @@ div.current fieldset.adminform { #cpanel div.icon a, .cpanel div.icon a { color: #054993; - border-left: 1px solid #e1d3c8; - border-top: 1px solid #e1d3c8; + border-left: 1px solid #e5d9c3; + border-top: 1px solid #e5d9c3; border-right: 1px solid #000000; border-bottom: 1px solid #000000; background-color: #d5c1b2; @@ -727,12 +727,12 @@ div.current fieldset.adminform { #cpanel div.icon a:focus, .cpanel div.icon a:hover, .cpanel div.icon a:focus { - border-left: 1px solid #000000; - border-top: 1px solid #000000; - border-right: 1px solid #000000; - border-bottom: 1px solid #000000; + border-left: 1px solid #868778; + border-top: 1px solid #868778; + border-right: 1px solid #f6f7db; + border-bottom: 1px solid #f6f7db; color: #054993; - background: #e1d3c8; + background: #e5d9c3; } fieldset { border: 1px #000000 solid; @@ -798,7 +798,7 @@ input[type="submit"]:hover, input[type="submit"]:focus, input[type="reset"]:hover, input[type="reset"]:focus { - background: #e1d3c8; + background: #e5d9c3; } textarea { background-color: #ffffff; @@ -812,7 +812,7 @@ input:hover, select:hover, textarea:hover, option:hover { - background-color: #e1d3c8; + background-color: #e5d9c3; color: #054993; } .paramrules { @@ -844,7 +844,7 @@ table.adminform tr.row0 { background-color: #ffffff; } table.adminform tr.row1 { - background-color: #e1d3c8; + background-color: #e5d9c3; } table.adminform th { color: #2c2c2c; @@ -889,7 +889,7 @@ table.adminlist tbody tr.row0:focus td, table.adminlist tbody tr.row1:focus td, table.adminlist tbody tr.row0:focus th, table.adminlist tbody tr.row1:focus th { - background-color: #e1d3c8; + background-color: #e5d9c3; } table.adminlist tbody tr td, table.adminlist tbody tr th { @@ -951,7 +951,7 @@ fieldset.batch { background: #ffffff; } button { - color: #000000; + color: #054993; border: 1px solid #000000; background-color: #d5c1b2; background-image: -moz-linear-gradient(top,#d5c1b2,#d5c1b2); @@ -964,7 +964,7 @@ button { } button:hover, button:focus { - background: #e1d3c8; + background: #e5d9c3; } .invalid { color: #ff0000; @@ -986,7 +986,7 @@ button:focus { } .button1 a:hover, .button1 a:focus { - background: #e1d3c8; + background: #e5d9c3; } .button2-left, .button2-right { @@ -1018,7 +1018,7 @@ button:focus { .button2-right a:hover, .button2-left a:focus, .button2-right a:focus { - background: #e1d3c8; + background: #e5d9c3; } .pagination .page span { color: #999999; @@ -1541,7 +1541,7 @@ li.acl-editgroups:hover, li.acl-resetbtn:hover, li.acl-editgroups:focus, li.acl-resetbtn:focus { - background-color: #e1d3c8; + background-color: #e5d9c3; } table#acl-config { border: 1px solid #000000; @@ -1589,7 +1589,7 @@ ul#rules li .pane-sliders .panel h3.title { border-bottom: solid 1px #000000; } #permissions-sliders ul#rules table.group-rules th { - background: #e1d3c8; + background: #e5d9c3; border-right: solid 1px #000000; border-bottom: solid 1px #000000; color: #2c2c2c; @@ -1656,7 +1656,7 @@ table.adminlist tbody td.check-d { border-bottom: 1px dotted #000000; } #menu a { - color: #000000; + color: #054993; background-repeat: no-repeat; background-position: left 50%; } @@ -1666,7 +1666,7 @@ table.adminlist tbody td.check-d { } #menu li a:hover, #menu li a:focus { - background-color: #e1d3c8; + background-color: #e5d9c3; } #menu li.disabled a:hover, #menu li.disabled a:focus, @@ -1688,28 +1688,28 @@ table.adminlist tbody td.check-d { background-color: transparent; } #menu li.sfhover a { - background-color: #e1d3c8; + background-color: #e5d9c3; } #menu li.sfhover li a { background-color: transparent; } #menu li.sfhover li.sfhover a, #menu li li a:focus { - background-color: #e1d3c8; + background-color: #e5d9c3; } #menu li.sfhover li.sfhover li a { background-color: transparent; } #menu li.sfhover li.sfhover li.sfhover a, #menu li li li a:focus { - background-color: #e1d3c8; + background-color: #e5d9c3; } #menu li li a:focus, #menu li li li a:focus { - background-color: #e1d3c8; + background-color: #e5d9c3; } #menu li li li a:focus { - background-color: #e1d3c8; + background-color: #e5d9c3; } #submenu { border-bottom: 1px solid #000000; @@ -1729,7 +1729,7 @@ table.adminlist tbody td.check-d { } #submenu li:hover, #submenu li:focus { - background: #e1d3c8; + background: #e5d9c3; } #submenu li.active, #submenu span.nolink.active { diff --git a/administrator/templates/hathor/less/colour_brown.less b/administrator/templates/hathor/less/colour_brown.less index ab5f37dd80c29..ffa966561bf37 100644 --- a/administrator/templates/hathor/less/colour_brown.less +++ b/administrator/templates/hathor/less/colour_brown.less @@ -33,10 +33,10 @@ @gradientTop: #d5c1b2; @gradientBottom: #d5c1b2; @mainBorder: #000000; -@toolbarColor: #000000; -@hoverBackground: #e1d3c8; -@nwBorder: #000000; -@seBorder: #000000; +@toolbarColor: #054993; +@hoverBackground: #e5d9c3; +@nwBorder: #868778; +@seBorder: #f6f7db; // Import the baseline to compile the CSS @import "colour_baseline.less"; diff --git a/libraries/cms/less/less.php b/libraries/cms/less/less.php index 12e516dee47b7..1ef0a977212a3 100644 --- a/libraries/cms/less/less.php +++ b/libraries/cms/less/less.php @@ -40,8 +40,12 @@ public function __construct($fname = null, $formatter = null) /** * Override compile because $this->allParsedFiles needs to be an array - * * For documentation on this please see /vendor/leafo/lessc.inc.php + * + * @param string $string + * @param string $name + * + * @return string $out */ public function compile($string, $name = null) { @@ -62,7 +66,8 @@ public function compile($string, $name = null) $this->injectVariables($this->registeredVars); } - $this->sourceParser = $this->parser; // Used for error messages + // Used for error messages + $this->sourceParser = $this->parser; $this->compileBlock($root); ob_start(); diff --git a/templates/beez3/css/turq.css b/templates/beez3/css/turq.css index 29a743bdd3370..aabf15a7a6329 100644 --- a/templates/beez3/css/turq.css +++ b/templates/beez3/css/turq.css @@ -60,11 +60,11 @@ a:focus { #header ul.menu a:link, #header ul.menu a:visited { color: #333; - display: inline-block; font-weight: bold; text-decoration: none; padding: 0px 10px; margin: 0; + display: inline-block; margin: 0 0 0; padding: 12px 15px; position: relative; diff --git a/templates/beez3/css/turq.less b/templates/beez3/css/turq.less index 2860cd618db14..bcd2f39c8df93 100644 --- a/templates/beez3/css/turq.less +++ b/templates/beez3/css/turq.less @@ -85,7 +85,6 @@ a:hover,a:active,a:focus { #header ul.menu a:link,#header ul.menu a:visited { color: #333; - display: inline-block; font-weight: bold; text-decoration: none; padding: 0px 10px; From adaedf8835f51bfbb219077f4f168c2647bb88e0 Mon Sep 17 00:00:00 2001 From: Sven Versteegen Date: Thu, 13 Aug 2015 11:08:52 +0200 Subject: [PATCH 5/8] Update less.php --- libraries/cms/less/less.php | 36 ++++++++---------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/libraries/cms/less/less.php b/libraries/cms/less/less.php index 1ef0a977212a3..8d278bf81537a 100644 --- a/libraries/cms/less/less.php +++ b/libraries/cms/less/less.php @@ -39,41 +39,21 @@ public function __construct($fname = null, $formatter = null) } /** - * Override compile because $this->allParsedFiles needs to be an array + * Override compile to reset $this->allParsedFiles array to allow + * parsing multiple files/strings using same imports. + * PR: https://github.com/leafo/lessphp/pull/607 + * * For documentation on this please see /vendor/leafo/lessc.inc.php * - * @param string $string - * @param string $name + * @param string $string LESS string to parse. + * @param string $name The sourceName used for error messages. * - * @return string $out + * @return string $out The compiled css output. */ public function compile($string, $name = null) { - $locale = setlocale(LC_NUMERIC, 0); - setlocale(LC_NUMERIC, "C"); - - $this->parser = $this->makeParser($name); - $root = $this->parser->parse($string); - - $this->env = null; - $this->scope = null; $this->allParsedFiles = array(); - $this->formatter = $this->newFormatter(); - - if (!empty($this->registeredVars)) - { - $this->injectVariables($this->registeredVars); - } - - // Used for error messages - $this->sourceParser = $this->parser; - $this->compileBlock($root); - - ob_start(); - $this->formatter->block($this->scope); - $out = ob_get_clean(); - setlocale(LC_NUMERIC, $locale); - return $out; + return parent::compile($string, $name); } } From e83e847a0a21bb3e8c41145938795f3b498d4c9a Mon Sep 17 00:00:00 2001 From: dgt41 Date: Thu, 13 Aug 2015 12:58:49 +0300 Subject: [PATCH 6/8] cs --- libraries/cms/less/less.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/cms/less/less.php b/libraries/cms/less/less.php index 8d278bf81537a..da7f48339fc77 100644 --- a/libraries/cms/less/less.php +++ b/libraries/cms/less/less.php @@ -45,10 +45,10 @@ public function __construct($fname = null, $formatter = null) * * For documentation on this please see /vendor/leafo/lessc.inc.php * - * @param string $string LESS string to parse. - * @param string $name The sourceName used for error messages. + * @param string $string LESS string to parse. + * @param string $name The sourceName used for error messages. * - * @return string $out The compiled css output. + * @return string $out The compiled css output. */ public function compile($string, $name = null) { From ff1fdacab85ef0bd130840c8c98bb6007b942a6c Mon Sep 17 00:00:00 2001 From: dgt41 Date: Wed, 4 Nov 2015 17:38:56 +0200 Subject: [PATCH 7/8] update --- libraries/vendor/autoload.php | 2 +- libraries/vendor/composer/include_paths.php | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/libraries/vendor/autoload.php b/libraries/vendor/autoload.php index 60a7a17121ed1..efeceae5ae2ba 100644 --- a/libraries/vendor/autoload.php +++ b/libraries/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer' . '/autoload_real.php'; -return ComposerAutoloaderInit48348541022a81b1fa5c954ec4a92d1e::getLoader(); +return ComposerAutoloaderInit205c915b9c7d3e718e7c95793ee67ffe::getLoader(); diff --git a/libraries/vendor/composer/include_paths.php b/libraries/vendor/composer/include_paths.php index 7956cd3bd48f9..58450e5bfb78a 100644 --- a/libraries/vendor/composer/include_paths.php +++ b/libraries/vendor/composer/include_paths.php @@ -7,10 +7,6 @@ return array( $vendorDir . '/pear/cache_lite', - $vendorDir . '/phpunit/phpunit-mock-objects', - $vendorDir . '/phpunit/php-file-iterator', - $vendorDir . '/phpunit/phpunit', - $vendorDir . '/symfony/yaml', $vendorDir . '/phpunit/dbunit', $vendorDir . '/symfony/yaml', ); From 675a87876d9e19074854a7a44f786f33fc6b9338 Mon Sep 17 00:00:00 2001 From: dgt41 Date: Sun, 17 Jan 2016 03:29:27 +0200 Subject: [PATCH 8/8] udate again --- composer.lock | 201 ++++++++++---------- libraries/vendor/composer/autoload_real.php | 10 +- libraries/vendor/composer/include_paths.php | 12 -- libraries/vendor/composer/installed.json | 86 ++++----- 4 files changed, 149 insertions(+), 160 deletions(-) delete mode 100644 libraries/vendor/composer/include_paths.php diff --git a/composer.lock b/composer.lock index 3da1e6518d629..e4fb43e3f960d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "684c7db12dc7f9de7e939f46930cd9be", - "content-hash": "3fe2809a805463b5353fd2cf269e2ee6", + "hash": "d500f4784ce37841dad0b29e32660849", + "content-hash": "800b07fe877fd7416bf7c046ad42a55a", "packages": [ { "name": "ircmaxell/password-compat", @@ -564,22 +564,22 @@ }, { "name": "leafo/lessphp", - "version": "v0.3.9", + "version": "v0.5.0", "source": { "type": "git", "url": "https://github.com/leafo/lessphp.git", - "reference": "a11a6141b5715162b933c405379765d817891c5d" + "reference": "0f5a7f5545d2bcf4e9fad9a228c8ad89cc9aa283" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/leafo/lessphp/zipball/a11a6141b5715162b933c405379765d817891c5d", - "reference": "a11a6141b5715162b933c405379765d817891c5d", + "url": "https://api.github.com/repos/leafo/lessphp/zipball/0f5a7f5545d2bcf4e9fad9a228c8ad89cc9aa283", + "reference": "0f5a7f5545d2bcf4e9fad9a228c8ad89cc9aa283", "shasum": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "0.3-dev" + "dev-master": "0.4.x-dev" } }, "autoload": { @@ -601,7 +601,7 @@ ], "description": "lessphp is a compiler for LESS written in PHP.", "homepage": "http://leafo.net/lessphp/", - "time": "2013-03-02 16:13:31" + "time": "2014-11-24 18:39:20" }, { "name": "paragonie/random_compat", @@ -908,16 +908,16 @@ "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.0.4", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119" + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f976e5de371104877ebc89bd8fecb0019ed9c119", - "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", "shasum": "" }, "require": { @@ -928,7 +928,7 @@ "ext-pdo": "*", "ext-phar": "*", "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "2.0.*@ALPHA" + "squizlabs/php_codesniffer": "~2.0" }, "type": "library", "extra": { @@ -937,8 +937,8 @@ } }, "autoload": { - "psr-0": { - "Doctrine\\Instantiator\\": "src" + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" } }, "notification-url": "https://packagist.org/downloads/", @@ -958,7 +958,7 @@ "constructor", "instantiate" ], - "time": "2014-10-13 12:58:55" + "time": "2015-06-14 21:17:01" }, { "name": "pear/cache_lite", @@ -1061,16 +1061,16 @@ }, { "name": "phpspec/prophecy", - "version": "v1.4.1", + "version": "v1.5.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373" + "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373", - "reference": "3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7", + "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7", "shasum": "" }, "require": { @@ -1117,7 +1117,7 @@ "spy", "stub" ], - "time": "2015-04-27 22:15:08" + "time": "2015-08-13 10:07:40" }, { "name": "phpunit/dbunit", @@ -1180,16 +1180,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "2.1.5", + "version": "2.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "be2286cb8c7e1773eded49d9719219e6f74f9e3e" + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/be2286cb8c7e1773eded49d9719219e6f74f9e3e", - "reference": "be2286cb8c7e1773eded49d9719219e6f74f9e3e", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", "shasum": "" }, "require": { @@ -1197,7 +1197,7 @@ "phpunit/php-file-iterator": "~1.3", "phpunit/php-text-template": "~1.2", "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "~1.0", + "sebastian/environment": "^1.3.2", "sebastian/version": "~1.0" }, "require-dev": { @@ -1212,7 +1212,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "2.2.x-dev" } }, "autoload": { @@ -1238,20 +1238,20 @@ "testing", "xunit" ], - "time": "2015-06-09 13:05:42" + "time": "2015-10-06 15:47:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb" + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a923bb15680d0089e2316f7a4af8f437046e96bb", - "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", "shasum": "" }, "require": { @@ -1285,20 +1285,20 @@ "filesystem", "iterator" ], - "time": "2015-04-02 05:19:05" + "time": "2015-06-21 13:08:43" }, { "name": "phpunit/php-text-template", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a" + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", - "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", "shasum": "" }, "require": { @@ -1307,20 +1307,17 @@ "type": "library", "autoload": { "classmap": [ - "Text/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1329,20 +1326,20 @@ "keywords": [ "template" ], - "time": "2014-01-30 17:20:04" + "time": "2015-06-21 13:50:34" }, { "name": "phpunit/php-timer", - "version": "1.0.6", + "version": "1.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d" + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/83fe1bdc5d47658b727595c14da140da92b3d66d", - "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", "shasum": "" }, "require": { @@ -1370,20 +1367,20 @@ "keywords": [ "timer" ], - "time": "2015-06-13 07:35:30" + "time": "2015-06-21 08:01:12" }, { "name": "phpunit/php-token-stream", - "version": "1.4.2", + "version": "1.4.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "db63be1159c81df649cd0260e30249a586d4129e" + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/db63be1159c81df649cd0260e30249a586d4129e", - "reference": "db63be1159c81df649cd0260e30249a586d4129e", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", "shasum": "" }, "require": { @@ -1419,7 +1416,7 @@ "keywords": [ "tokenizer" ], - "time": "2015-06-12 07:34:24" + "time": "2015-09-15 10:49:45" }, { "name": "phpunit/phpunit", @@ -1495,22 +1492,23 @@ }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.4", + "version": "2.3.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "92408bb1968a81b3217a6fdf6c1a198da83caa35" + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/92408bb1968a81b3217a6fdf6c1a198da83caa35", - "reference": "92408bb1968a81b3217a6fdf6c1a198da83caa35", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", "shasum": "" }, "require": { - "doctrine/instantiator": "~1.0,>=1.0.2", + "doctrine/instantiator": "^1.0.2", "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2" + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" }, "require-dev": { "phpunit/phpunit": "~4.4" @@ -1546,20 +1544,20 @@ "mock", "xunit" ], - "time": "2015-06-11 15:55:48" + "time": "2015-10-02 06:51:40" }, { "name": "sebastian/comparator", - "version": "1.1.1", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1dd8869519a225f7f2b9eb663e225298fade819e" + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dd8869519a225f7f2b9eb663e225298fade819e", - "reference": "1dd8869519a225f7f2b9eb663e225298fade819e", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", "shasum": "" }, "require": { @@ -1573,7 +1571,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -1610,32 +1608,32 @@ "compare", "equality" ], - "time": "2015-01-29 16:28:08" + "time": "2015-07-26 15:48:44" }, { "name": "sebastian/diff", - "version": "1.3.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", - "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "~4.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -1658,24 +1656,24 @@ } ], "description": "Diff implementation", - "homepage": "http://www.github.com/sebastianbergmann/diff", + "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ "diff" ], - "time": "2015-02-22 15:13:53" + "time": "2015-12-08 07:14:41" }, { "name": "sebastian/environment", - "version": "1.3.2", + "version": "1.3.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44" + "reference": "6e7133793a8e5a5714a551a8324337374be209df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44", - "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e7133793a8e5a5714a551a8324337374be209df", + "reference": "6e7133793a8e5a5714a551a8324337374be209df", "shasum": "" }, "require": { @@ -1712,20 +1710,20 @@ "environment", "hhvm" ], - "time": "2015-08-03 06:14:51" + "time": "2015-12-02 08:37:27" }, { "name": "sebastian/exporter", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "84839970d05254c73cde183a721c7af13aede943" + "reference": "7ae5513327cb536431847bcc0c10edba2701064e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/84839970d05254c73cde183a721c7af13aede943", - "reference": "84839970d05254c73cde183a721c7af13aede943", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", + "reference": "7ae5513327cb536431847bcc0c10edba2701064e", "shasum": "" }, "require": { @@ -1778,20 +1776,20 @@ "export", "exporter" ], - "time": "2015-01-27 07:23:06" + "time": "2015-06-21 07:55:53" }, { "name": "sebastian/global-state", - "version": "1.0.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", - "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", "shasum": "" }, "require": { @@ -1829,20 +1827,20 @@ "keywords": [ "global state" ], - "time": "2014-10-06 09:23:50" + "time": "2015-10-12 03:26:01" }, { "name": "sebastian/recursion-context", - "version": "1.0.0", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "3989662bbb30a29d20d9faa04a846af79b276252" + "reference": "913401df809e99e4f47b27cdd781f4a258d58791" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/3989662bbb30a29d20d9faa04a846af79b276252", - "reference": "3989662bbb30a29d20d9faa04a846af79b276252", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", + "reference": "913401df809e99e4f47b27cdd781f4a258d58791", "shasum": "" }, "require": { @@ -1882,20 +1880,20 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-01-24 09:48:32" + "time": "2015-11-11 19:50:13" }, { "name": "sebastian/version", - "version": "1.0.5", + "version": "1.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4" + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/ab931d46cd0d3204a91e1b9a40c4bc13032b58e4", - "reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", "shasum": "" }, "type": "library", @@ -1917,7 +1915,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-02-24 06:35:25" + "time": "2015-06-21 13:59:46" }, { "name": "squizlabs/php_codesniffer", @@ -2003,5 +2001,8 @@ "platform": { "php": ">=5.3.10" }, - "platform-dev": [] + "platform-dev": [], + "platform-overrides": { + "php": "5.3.10" + } } diff --git a/libraries/vendor/composer/autoload_real.php b/libraries/vendor/composer/autoload_real.php index 191a3f253b576..1298690b3bb5d 100644 --- a/libraries/vendor/composer/autoload_real.php +++ b/libraries/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit0efb534ee20646bcb987f4359c38b3aa +class ComposerAutoloaderInit205c915b9c7d3e718e7c95793ee67ffe { private static $loader; @@ -19,9 +19,9 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit0efb534ee20646bcb987f4359c38b3aa', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit205c915b9c7d3e718e7c95793ee67ffe', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit0efb534ee20646bcb987f4359c38b3aa', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit205c915b9c7d3e718e7c95793ee67ffe', 'loadClassLoader')); $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -42,14 +42,14 @@ public static function getLoader() $includeFiles = require __DIR__ . '/autoload_files.php'; foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire0efb534ee20646bcb987f4359c38b3aa($fileIdentifier, $file); + composerRequire205c915b9c7d3e718e7c95793ee67ffe($fileIdentifier, $file); } return $loader; } } -function composerRequire0efb534ee20646bcb987f4359c38b3aa($fileIdentifier, $file) +function composerRequire205c915b9c7d3e718e7c95793ee67ffe($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/libraries/vendor/composer/include_paths.php b/libraries/vendor/composer/include_paths.php deleted file mode 100644 index 58450e5bfb78a..0000000000000 --- a/libraries/vendor/composer/include_paths.php +++ /dev/null @@ -1,12 +0,0 @@ -