From 6685dadddf4a5d32b1d96659f9bd6c9d31d65fb1 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Wed, 10 May 2017 10:21:01 +0300 Subject: [PATCH 001/141] Oops, accidentally merged local 2.0 branch into develop, revert GravTrait deprecation and add back new Framework classes --- CHANGELOG.md | 9 + composer.lock | 102 ++--- system/src/Grav/Common/GravTrait.php | 7 +- .../Framework/ContentBlock/ContentBlock.php | 229 +++++++++++ .../ContentBlock/ContentBlockInterface.php | 75 ++++ .../Grav/Framework/ContentBlock/HtmlBlock.php | 374 +++++++++++++++++ .../ContentBlock/HtmlBlockInterface.php | 94 +++++ .../Grav/Framework/Object/AbstractObject.php | 185 +++++++++ .../Object/AbstractObjectCollection.php | 35 ++ .../Object/ObjectCollectionInterface.php | 45 ++ .../Object/ObjectCollectionTrait.php | 96 +++++ .../Grav/Framework/Object/ObjectInterface.php | 62 +++ .../Framework/Object/ObjectStorageTrait.php | 385 ++++++++++++++++++ .../Object/Storage/FilesystemStorage.php | 145 +++++++ .../Object/Storage/StorageInterface.php | 47 +++ .../Object/StoredObjectInterface.php | 58 +++ .../Grav/Framework/Page/FilePageInterface.php | 37 ++ .../Page/PageCollectionInterface.php | 14 + .../Framework/Page/PageHeaderInterface.php | 12 + .../src/Grav/Framework/Page/PageInterface.php | 98 +++++ .../Page/PageMediaCollectionInterface.php | 14 + 21 files changed, 2072 insertions(+), 51 deletions(-) create mode 100644 system/src/Grav/Framework/ContentBlock/ContentBlock.php create mode 100644 system/src/Grav/Framework/ContentBlock/ContentBlockInterface.php create mode 100644 system/src/Grav/Framework/ContentBlock/HtmlBlock.php create mode 100644 system/src/Grav/Framework/ContentBlock/HtmlBlockInterface.php create mode 100644 system/src/Grav/Framework/Object/AbstractObject.php create mode 100644 system/src/Grav/Framework/Object/AbstractObjectCollection.php create mode 100644 system/src/Grav/Framework/Object/ObjectCollectionInterface.php create mode 100644 system/src/Grav/Framework/Object/ObjectCollectionTrait.php create mode 100644 system/src/Grav/Framework/Object/ObjectInterface.php create mode 100644 system/src/Grav/Framework/Object/ObjectStorageTrait.php create mode 100644 system/src/Grav/Framework/Object/Storage/FilesystemStorage.php create mode 100644 system/src/Grav/Framework/Object/Storage/StorageInterface.php create mode 100644 system/src/Grav/Framework/Object/StoredObjectInterface.php create mode 100644 system/src/Grav/Framework/Page/FilePageInterface.php create mode 100644 system/src/Grav/Framework/Page/PageCollectionInterface.php create mode 100644 system/src/Grav/Framework/Page/PageHeaderInterface.php create mode 100644 system/src/Grav/Framework/Page/PageInterface.php create mode 100644 system/src/Grav/Framework/Page/PageMediaCollectionInterface.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 58cab13dd..1177bd10c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# v2.0.0-dev +## mm/dd/2017 + +1. [](#new) + * Added `Grav\Framework\ContentBlock` classes which add better support for nested HTML blocks with assets + * Added `Grav\Framework\Object` classes to support general objects and their collections + * Added `Grav\Framework\Page` interfaces + * Deprecated GravTrait + # v1.2.5 ## mm/dd/2017 diff --git a/composer.lock b/composer.lock index 0c876ab34..28474e547 100644 --- a/composer.lock +++ b/composer.lock @@ -967,16 +967,16 @@ }, { "name": "symfony/console", - "version": "v2.8.19", + "version": "v2.8.20", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "86407ff20855a5eaa2a7219bd815e9c40a88633e" + "reference": "2cfcbced8e39e2313ed4da8896fc8c59a56c0d7e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/86407ff20855a5eaa2a7219bd815e9c40a88633e", - "reference": "86407ff20855a5eaa2a7219bd815e9c40a88633e", + "url": "https://api.github.com/repos/symfony/console/zipball/2cfcbced8e39e2313ed4da8896fc8c59a56c0d7e", + "reference": "2cfcbced8e39e2313ed4da8896fc8c59a56c0d7e", "shasum": "" }, "require": { @@ -1024,7 +1024,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-04-03T20:37:06+00:00" + "time": "2017-04-26T01:38:53+00:00" }, { "name": "symfony/debug", @@ -1085,16 +1085,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.8.19", + "version": "v2.8.20", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "88b65f0ac25355090e524aba4ceb066025df8bd2" + "reference": "7fc8e2b4118ff316550596357325dfd92a51f531" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/88b65f0ac25355090e524aba4ceb066025df8bd2", - "reference": "88b65f0ac25355090e524aba4ceb066025df8bd2", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7fc8e2b4118ff316550596357325dfd92a51f531", + "reference": "7fc8e2b4118ff316550596357325dfd92a51f531", "shasum": "" }, "require": { @@ -1141,7 +1141,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-04-03T20:37:06+00:00" + "time": "2017-04-26T16:56:54+00:00" }, { "name": "symfony/polyfill-iconv", @@ -1263,16 +1263,16 @@ }, { "name": "symfony/var-dumper", - "version": "v2.8.19", + "version": "v2.8.20", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "f8ff23ad5352f96e66c1df5468d492d2f37f3ac4" + "reference": "18ab1b833d2d82eb40a707bc002cbe62a1c22d0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/f8ff23ad5352f96e66c1df5468d492d2f37f3ac4", - "reference": "f8ff23ad5352f96e66c1df5468d492d2f37f3ac4", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/18ab1b833d2d82eb40a707bc002cbe62a1c22d0b", + "reference": "18ab1b833d2d82eb40a707bc002cbe62a1c22d0b", "shasum": "" }, "require": { @@ -1283,9 +1283,11 @@ "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" }, "require-dev": { + "ext-iconv": "*", "twig/twig": "~1.20|~2.0" }, "suggest": { + "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", "ext-symfony_debug": "" }, "type": "library", @@ -1325,20 +1327,20 @@ "debug", "dump" ], - "time": "2017-03-12T16:01:59+00:00" + "time": "2017-04-28T06:26:40+00:00" }, { "name": "symfony/yaml", - "version": "v2.8.19", + "version": "v2.8.20", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "286d84891690b0e2515874717e49360d1c98a703" + "reference": "93ccdde79f4b079c7558da4656a3cb1c50c68e02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/286d84891690b0e2515874717e49360d1c98a703", - "reference": "286d84891690b0e2515874717e49360d1c98a703", + "url": "https://api.github.com/repos/symfony/yaml/zipball/93ccdde79f4b079c7558da4656a3cb1c50c68e02", + "reference": "93ccdde79f4b079c7558da4656a3cb1c50c68e02", "shasum": "" }, "require": { @@ -1374,7 +1376,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-03-20T09:41:44+00:00" + "time": "2017-05-01T14:31:55+00:00" }, { "name": "twig/twig", @@ -1648,16 +1650,16 @@ }, { "name": "facebook/webdriver", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/facebook/php-webdriver.git", - "reference": "3ea034c056189e11c0ce7985332a9f4b5b2b5db2" + "reference": "eadb0b7a7c3e6578185197fd40158b08c3164c83" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/3ea034c056189e11c0ce7985332a9f4b5b2b5db2", - "reference": "3ea034c056189e11c0ce7985332a9f4b5b2b5db2", + "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/eadb0b7a7c3e6578185197fd40158b08c3164c83", + "reference": "eadb0b7a7c3e6578185197fd40158b08c3164c83", "shasum": "" }, "require": { @@ -1696,7 +1698,7 @@ "selenium", "webdriver" ], - "time": "2017-03-22T10:56:03+00:00" + "time": "2017-04-28T14:54:49+00:00" }, { "name": "fzaninotto/faker", @@ -2978,16 +2980,16 @@ }, { "name": "symfony/browser-kit", - "version": "v3.2.7", + "version": "v3.2.8", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "2fe0caa60c1a1dfeefd0425741182687a9b382b8" + "reference": "9fab1ab6f77b77f3df5fc5250fc6956811699b57" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/2fe0caa60c1a1dfeefd0425741182687a9b382b8", - "reference": "2fe0caa60c1a1dfeefd0425741182687a9b382b8", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/9fab1ab6f77b77f3df5fc5250fc6956811699b57", + "reference": "9fab1ab6f77b77f3df5fc5250fc6956811699b57", "shasum": "" }, "require": { @@ -3031,20 +3033,20 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2017-02-21T09:12:04+00:00" + "time": "2017-04-12T14:13:17+00:00" }, { "name": "symfony/css-selector", - "version": "v3.2.7", + "version": "v3.2.8", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "a48f13dc83c168f1253a5d2a5a4fb46c36244c4c" + "reference": "02983c144038e697c959e6b06ef6666de759ccbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/a48f13dc83c168f1253a5d2a5a4fb46c36244c4c", - "reference": "a48f13dc83c168f1253a5d2a5a4fb46c36244c4c", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/02983c144038e697c959e6b06ef6666de759ccbc", + "reference": "02983c144038e697c959e6b06ef6666de759ccbc", "shasum": "" }, "require": { @@ -3084,20 +3086,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2017-02-21T09:12:04+00:00" + "time": "2017-05-01T14:55:58+00:00" }, { "name": "symfony/dom-crawler", - "version": "v3.2.7", + "version": "v3.2.8", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "403944e294cf4ceb3b8447f54cbad88ea7b99cee" + "reference": "f1ad34e8af09ed17570e027cf0c58a12eddec286" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/403944e294cf4ceb3b8447f54cbad88ea7b99cee", - "reference": "403944e294cf4ceb3b8447f54cbad88ea7b99cee", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/f1ad34e8af09ed17570e027cf0c58a12eddec286", + "reference": "f1ad34e8af09ed17570e027cf0c58a12eddec286", "shasum": "" }, "require": { @@ -3140,20 +3142,20 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2017-02-21T09:12:04+00:00" + "time": "2017-04-12T14:13:17+00:00" }, { "name": "symfony/finder", - "version": "v3.2.7", + "version": "v3.2.8", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "b20900ce5ea164cd9314af52725b0bb5a758217a" + "reference": "9cf076f8f492f4b1ffac40aae9c2d287b4ca6930" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/b20900ce5ea164cd9314af52725b0bb5a758217a", - "reference": "b20900ce5ea164cd9314af52725b0bb5a758217a", + "url": "https://api.github.com/repos/symfony/finder/zipball/9cf076f8f492f4b1ffac40aae9c2d287b4ca6930", + "reference": "9cf076f8f492f4b1ffac40aae9c2d287b4ca6930", "shasum": "" }, "require": { @@ -3189,20 +3191,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-03-20T09:32:19+00:00" + "time": "2017-04-12T14:13:17+00:00" }, { "name": "symfony/process", - "version": "v3.2.7", + "version": "v3.2.8", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "57fdaa55827ae14d617550ebe71a820f0a5e2282" + "reference": "999c2cf5061e627e6cd551dc9ebf90dd1d11d9f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/57fdaa55827ae14d617550ebe71a820f0a5e2282", - "reference": "57fdaa55827ae14d617550ebe71a820f0a5e2282", + "url": "https://api.github.com/repos/symfony/process/zipball/999c2cf5061e627e6cd551dc9ebf90dd1d11d9f0", + "reference": "999c2cf5061e627e6cd551dc9ebf90dd1d11d9f0", "shasum": "" }, "require": { @@ -3238,7 +3240,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-03-27T18:07:02+00:00" + "time": "2017-04-12T14:13:17+00:00" }, { "name": "webmozart/assert", diff --git a/system/src/Grav/Common/GravTrait.php b/system/src/Grav/Common/GravTrait.php index 36692d6cc..99848d224 100644 --- a/system/src/Grav/Common/GravTrait.php +++ b/system/src/Grav/Common/GravTrait.php @@ -8,6 +8,9 @@ namespace Grav\Common; +/** + * @deprecated in Grav 2.0 + */ trait GravTrait { protected static $grav; @@ -21,7 +24,9 @@ trait GravTrait self::$grav = Grav::instance(); } + $caller = self::$grav['debugger']->getCaller(); + self::$grav['debugger']->addMessage("Deprecated GravTrait used in {$caller['file']}", 'deprecated'); + return self::$grav; } } - diff --git a/system/src/Grav/Framework/ContentBlock/ContentBlock.php b/system/src/Grav/Framework/ContentBlock/ContentBlock.php new file mode 100644 index 000000000..c446c3a1b --- /dev/null +++ b/system/src/Grav/Framework/ContentBlock/ContentBlock.php @@ -0,0 +1,229 @@ +setContent('my inner content'); + * $outerBlock = ContentBlock::create(); + * $outerBlock->setContent(sprintf('Inside my outer block I have %s.', $innerBlock->getToken())); + * $outerBlock->addBlock($innerBlock); + * echo $outerBlock; + * + * @package Grav\Framework\ContentBlock + */ +class ContentBlock implements ContentBlockInterface +{ + protected $version = 1; + protected $id; + protected $tokenTemplate = '@@BLOCK-%s@@'; + protected $content = ''; + protected $blocks = []; + + /** + * @param string $id + * @return static + */ + public static function create($id = null) + { + return new static($id); + } + + /** + * @param array $serialized + * @return ContentBlockInterface + */ + public static function fromArray(array $serialized) + { + try { + $type = isset($serialized['_type']) ? $serialized['_type'] : null; + $id = isset($serialized['id']) ? $serialized['id'] : null; + + if (!$type || !$id || !is_a($type, 'Grav\Framework\ContentBlock\ContentBlockInterface', true)) { + throw new \RuntimeException('Bad data'); + } + + /** @var ContentBlockInterface $instance */ + $instance = new $type($id); + $instance->build($serialized); + } catch (\Exception $e) { + throw new \RuntimeException(sprintf('Cannot unserialize Block: %s', $e->getMessage()), $e->getCode(), $e); + } + + return $instance; + } + + /** + * Block constructor. + * + * @param string $id + */ + public function __construct($id = null) + { + $this->id = $id ? (string) $id : $this->generateId(); + } + + /** + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * @return string + */ + public function getToken() + { + return sprintf($this->tokenTemplate, $this->getId()); + } + + /** + * @return array + */ + public function toArray() + { + $blocks = []; + /** + * @var string $id + * @var ContentBlockInterface $block + */ + foreach ($this->blocks as $block) { + $blocks[$block->getId()] = $block->toArray(); + } + + $array = [ + '_type' => get_class($this), + '_version' => $this->version, + 'id' => $this->id, + ]; + + if ($this->content) { + $array['content'] = $this->content; + } + + if ($blocks) { + $array['blocks'] = $blocks; + } + + return $array; + } + + /** + * @return string + */ + public function toString() + { + if (!$this->blocks) { + return (string) $this->content; + } + + $tokens = []; + $replacements = []; + foreach ($this->blocks as $block) { + $tokens[] = $block->getToken(); + $replacements[] = $block->toString(); + } + + return str_replace($tokens, $replacements, (string) $this->content); + } + + /** + * @return string + */ + public function __toString() + { + try { + return $this->toString(); + } catch (\Exception $e) { + return sprintf('Error while rendering block: %s', $e->getMessage()); + } + } + + /** + * @param array $serialized + */ + public function build(array $serialized) + { + $this->checkVersion($serialized); + + $this->id = isset($serialized['id']) ? $serialized['id'] : $this->generateId(); + + if (isset($serialized['content'])) { + $this->setContent($serialized['content']); + } + + $blocks = isset($serialized['blocks']) ? (array) $serialized['blocks'] : []; + foreach ($blocks as $block) { + $this->addBlock(self::fromArray($block)); + } + } + + /** + * @param string $content + * @return $this + */ + public function setContent($content) + { + $this->content = $content; + + return $this; + } + + /** + * @param ContentBlockInterface $block + * @return $this + */ + public function addBlock(ContentBlockInterface $block) + { + $this->blocks[$block->getId()] = $block; + + return $this; + } + + /** + * @return string + */ + public function serialize() + { + return serialize($this->toArray()); + } + + /** + * @param string $serialized + */ + public function unserialize($serialized) + { + $array = unserialize($serialized); + $this->build($array); + } + + /** + * @return string + */ + protected function generateId() + { + return uniqid('', true); + } + + /** + * @param array $serialized + * @throws \RuntimeException + */ + protected function checkVersion(array $serialized) + { + $version = isset($serialized['_version']) ? (string) $serialized['_version'] : 1; + if ($version != $this->version) { + throw new \RuntimeException(sprintf('Unsupported version %s', $version)); + } + } +} \ No newline at end of file diff --git a/system/src/Grav/Framework/ContentBlock/ContentBlockInterface.php b/system/src/Grav/Framework/ContentBlock/ContentBlockInterface.php new file mode 100644 index 000000000..9412ef82f --- /dev/null +++ b/system/src/Grav/Framework/ContentBlock/ContentBlockInterface.php @@ -0,0 +1,75 @@ +getAssetsFast(); + + $this->sortAssets($assets['styles']); + $this->sortAssets($assets['scripts']); + $this->sortAssets($assets['html']); + + return $assets; + } + + /** + * @return array + */ + public function getFrameworks() + { + $assets = $this->getAssetsFast(); + + return array_keys($assets['frameworks']); + } + + /** + * @param string $location + * @return array + */ + public function getStyles($location = 'head') + { + return $this->getAssetsInLocation('styles', $location); + } + + /** + * @param string $location + * @return array + */ + public function getScripts($location = 'head') + { + return $this->getAssetsInLocation('scripts', $location); + } + + /** + * @param string $location + * @return array + */ + public function getHtml($location = 'bottom') + { + return $this->getAssetsInLocation('html', $location); + } + + /** + * @return array + */ + public function toArray() + { + $array = parent::toArray(); + + if ($this->frameworks) { + $array['frameworks'] = $this->frameworks; + } + if ($this->styles) { + $array['styles'] = $this->styles; + } + if ($this->scripts) { + $array['scripts'] = $this->scripts; + } + if ($this->html) { + $array['html'] = $this->html; + } + + return $array; + } + + /** + * @param array $serialized + */ + public function build(array $serialized) + { + parent::build($serialized); + + $this->frameworks = isset($serialized['frameworks']) ? (array) $serialized['frameworks'] : []; + $this->styles = isset($serialized['styles']) ? (array) $serialized['styles'] : []; + $this->scripts = isset($serialized['scripts']) ? (array) $serialized['scripts'] : []; + $this->html = isset($serialized['html']) ? (array) $serialized['html'] : []; + } + + /** + * @param string $framework + * @return $this + */ + public function addFramework($framework) + { + $this->frameworks[$framework] = 1; + + return $this; + } + + /** + * @param string|array $element + * @param int $priority + * @param string $location + * @return bool + * + * @example $block->addStyle('assets/js/my.js'); + * @example $block->addStyle(['href' => 'assets/js/my.js', 'media' => 'screen']); + */ + public function addStyle($element, $priority = 0, $location = 'head') + { + if (!is_array($element)) { + $element = ['href' => (string) $element]; + } + if (empty($element['href'])) { + return false; + } + if (!isset($this->styles[$location])) { + $this->styles[$location] = []; + } + + $id = !empty($element['id']) ? ['id' => (string) $element['id']] : []; + $href = $element['href']; + $type = !empty($element['type']) ? (string) $element['type'] : 'text/css'; + $media = !empty($element['media']) ? (string) $element['media'] : null; + unset($element['tag'], $element['id'], $element['rel'], $element['content'], $element['href'], $element['type'], $element['media']); + + $this->styles[$location][md5($href) . sha1($href)] = [ + ':type' => 'file', + ':priority' => (int) $priority, + 'href' => $href, + 'type' => $type, + 'media' => $media, + 'element' => $element + ] + $id; + + return true; + } + + /** + * @param string|array $element + * @param int $priority + * @param string $location + * @return bool + */ + public function addInlineStyle($element, $priority = 0, $location = 'head') + { + if (!is_array($element)) { + $element = ['content' => (string) $element]; + } + if (empty($element['content'])) { + return false; + } + if (!isset($this->styles[$location])) { + $this->styles[$location] = []; + } + + $content = (string) $element['content']; + $type = !empty($element['type']) ? (string) $element['type'] : 'text/css'; + + $this->styles[$location][md5($content) . sha1($content)] = [ + ':type' => 'inline', + ':priority' => (int) $priority, + 'content' => $content, + 'type' => $type + ]; + + return true; + } + + /** + * @param string|array $element + * @param int $priority + * @param string $location + * @return bool + */ + public function addScript($element, $priority = 0, $location = 'head') + { + if (!is_array($element)) { + $element = ['src' => (string) $element]; + } + if (empty($element['src'])) { + return false; + } + if (!isset($this->scripts[$location])) { + $this->scripts[$location] = []; + } + + $src = $element['src']; + $type = !empty($element['type']) ? (string) $element['type'] : 'text/javascript'; + $defer = isset($element['defer']) ? true : false; + $async = isset($element['async']) ? true : false; + $handle = !empty($element['handle']) ? (string) $element['handle'] : ''; + + $this->scripts[$location][md5($src) . sha1($src)] = [ + ':type' => 'file', + ':priority' => (int) $priority, + 'src' => $src, + 'type' => $type, + 'defer' => $defer, + 'async' => $async, + 'handle' => $handle + ]; + + return true; + } + + /** + * @param string|array $element + * @param int $priority + * @param string $location + * @return bool + */ + public function addInlineScript($element, $priority = 0, $location = 'head') + { + if (!is_array($element)) { + $element = ['content' => (string) $element]; + } + if (empty($element['content'])) { + return false; + } + if (!isset($this->scripts[$location])) { + $this->scripts[$location] = []; + } + + $content = (string) $element['content']; + $type = !empty($element['type']) ? (string) $element['type'] : 'text/javascript'; + + $this->scripts[$location][md5($content) . sha1($content)] = [ + ':type' => 'inline', + ':priority' => (int) $priority, + 'content' => $content, + 'type' => $type + ]; + + return true; + } + + /** + * @param string $html + * @param int $priority + * @param string $location + * @return bool + */ + public function addHtml($html, $priority = 0, $location = 'bottom') + { + if (empty($html) || !is_string($html)) { + return false; + } + if (!isset($this->html[$location])) { + $this->html[$location] = []; + } + + $this->html[$location][md5($html) . sha1($html)] = [ + ':priority' => (int) $priority, + 'html' => $html + ]; + + return true; + } + + /** + * @return array + */ + protected function getAssetsFast() + { + $assets = [ + 'frameworks' => $this->frameworks, + 'styles' => $this->styles, + 'scripts' => $this->scripts, + 'html' => $this->html + ]; + + foreach ($this->blocks as $block) { + if ($block instanceof HtmlBlock) { + $blockAssets = $block->getAssetsFast(); + $assets['frameworks'] += $blockAssets['frameworks']; + + foreach ($blockAssets['styles'] as $location => $styles) { + if (!isset($assets['styles'][$location])) { + $assets['styles'][$location] = $styles; + } elseif ($styles) { + $assets['styles'][$location] += $styles; + } + } + + foreach ($blockAssets['scripts'] as $location => $scripts) { + if (!isset($assets['scripts'][$location])) { + $assets['scripts'][$location] = $scripts; + } elseif ($scripts) { + $assets['scripts'][$location] += $scripts; + } + } + + foreach ($blockAssets['html'] as $location => $htmls) { + if (!isset($assets['html'][$location])) { + $assets['html'][$location] = $htmls; + } elseif ($htmls) { + $assets['html'][$location] += $htmls; + } + } + } + } + + return $assets; + } + + /** + * @param string $type + * @param string $location + * @return array + */ + protected function getAssetsInLocation($type, $location) + { + $assets = $this->getAssetsFast(); + + if (empty($assets[$type][$location])) { + return []; + } + + $styles = $assets[$type][$location]; + $this->sortAssetsInLocation($styles); + + return $styles; + } + + /** + * @param array $items + */ + protected function sortAssetsInLocation(array &$items) + { + $count = 0; + foreach ($items as &$item) { + $item[':order'] = ++$count; + } + uasort( + $items, + function ($a, $b) { + return ($a[':priority'] == $b[':priority']) ? $a[':order'] - $b[':order'] : $a[':priority'] - $b[':priority']; + } + ); + } + + /** + * @param array $array + */ + protected function sortAssets(array &$array) + { + foreach ($array as $location => &$items) { + $this->sortAssetsInLocation($items); + } + } +} \ No newline at end of file diff --git a/system/src/Grav/Framework/ContentBlock/HtmlBlockInterface.php b/system/src/Grav/Framework/ContentBlock/HtmlBlockInterface.php new file mode 100644 index 000000000..08e4caad3 --- /dev/null +++ b/system/src/Grav/Framework/ContentBlock/HtmlBlockInterface.php @@ -0,0 +1,94 @@ +addStyle('assets/js/my.js'); + * @example $block->addStyle(['href' => 'assets/js/my.js', 'media' => 'screen']); + */ + public function addStyle($element, $priority = 0, $location = 'head'); + + /** + * @param string|array $element + * @param int $priority + * @param string $location + * @return bool + */ + public function addInlineStyle($element, $priority = 0, $location = 'head'); + + /** + * @param string|array $element + * @param int $priority + * @param string $location + * @return bool + */ + public function addScript($element, $priority = 0, $location = 'head'); + + + /** + * @param string|array $element + * @param int $priority + * @param string $location + * @return bool + */ + public function addInlineScript($element, $priority = 0, $location = 'head'); + + /** + * @param string $html + * @param int $priority + * @param string $location + * @return bool + */ + public function addHtml($html, $priority = 0, $location = 'bottom'); +} diff --git a/system/src/Grav/Framework/Object/AbstractObject.php b/system/src/Grav/Framework/Object/AbstractObject.php new file mode 100644 index 000000000..0508162e2 --- /dev/null +++ b/system/src/Grav/Framework/Object/AbstractObject.php @@ -0,0 +1,185 @@ + null + ]; + + /** + * Default properties for the object. + * @var array + */ + static protected $defaults = []; + + /** + * @var string + */ + static protected $collectionClass = 'Grav\\Framework\\Object\\AbstractObjectCollection'; + + /** + * Properties of the object. + * @var array + */ + protected $items; + + /** + * @param array $ids List of primary Ids or null to return everything that has been loaded. + * @param bool $readonly + * @return AbstractObjectCollection + */ + static public function instances(array $ids = null, $readonly = true) + { + $collectionClass = static::$collectionClass; + + if (is_null($ids)) { + return new $collectionClass(static::$instances); + } + + if (empty($ids)) { + return new $collectionClass([]); + } + + $results = []; + $list = []; + + foreach ($ids as $id) { + if (!isset(static::$instances[$id])) { + $list[] = $id; + } + } + + if ($list) { + $c = get_called_class(); + $storage = static::getStorage(); + $list = $storage->loadList($list); + foreach ($list as $keys) { + /** @var static $instance */ + $instance = new $c(); + $instance->doLoad($keys); + $id = $instance->getId(); + if ($id && !isset(static::$instances[$id])) { + $instance->initialize(); + static::$instances[$id] = $instance; + } + } + } + + foreach ($ids as $id) { + if (isset(static::$instances[$id])) { + $results[$id] = $readonly ? clone static::$instances[$id] : static::$instances[$id]; + } + } + + return new $collectionClass($results); + } + + /** + * Method to perform sanity checks on the instance properties to ensure they are safe to store in the storage. + * + * Child classes should override this method to make sure the data they are storing in the storage is safe and as + * expected before saving the object. + * + * @return bool True if the instance is sane and able to be stored in the storage. + */ + public function check($includeChildren = false) + { + return $this->checkKeys() && $this->traitCheck($includeChildren); + } + + /** + * @param array $keys + * @return array + */ + public function getKeys(array $keys = []) + { + foreach (static::$primaryKey as $key => $value) { + if (!isset($keys[$key])) { + if (isset($this->items[$key])) { + $keys[$key] = $this->items[$key]; + } else { + $keys[$key] = $value; + } + + } + } + + return $keys; + } + + /** + * @param array $keys + * @return bool + */ + public function checkKeys(array $keys = []) + { + if (!$keys) { + $keys = $this->getKeys(); + } + + foreach ($keys as $key => $value) { + if ($value === null) { + return false; + } + } + + return true; + } + + /** + * Implementes JsonSerializable interface. + * + * @return array + */ + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * Returns a string representation of this object. + * + * @return string + */ + public function __toString() + { + return __CLASS__ . '@' . spl_object_hash($this); + } + + // Internal functions + + /** + * @param array $items + * @param array $keys + */ + protected function doLoad(array $items, array $keys = []) + { + $this->items = array_replace(static::$defaults, $this->items, $this->getKeys($keys), $items); + } +} diff --git a/system/src/Grav/Framework/Object/AbstractObjectCollection.php b/system/src/Grav/Framework/Object/AbstractObjectCollection.php new file mode 100644 index 000000000..ecad694d9 --- /dev/null +++ b/system/src/Grav/Framework/Object/AbstractObjectCollection.php @@ -0,0 +1,35 @@ +id = $id; + } + + public function getId() + { + return $this->id ?: $this->getParentId(); + } +} diff --git a/system/src/Grav/Framework/Object/ObjectCollectionInterface.php b/system/src/Grav/Framework/Object/ObjectCollectionInterface.php new file mode 100644 index 000000000..ecacee917 --- /dev/null +++ b/system/src/Grav/Framework/Object/ObjectCollectionInterface.php @@ -0,0 +1,45 @@ + $value) { + $list[$key] = is_object($value) ? clone $value : $value; + } + + return $this->createFrom($list); + } + + /** + * @param string $property Object property to be fetched. + * @return array Key/Value pairs of the properties. + */ + public function getProperty($property) + { + $list = []; + + foreach ($this as $id => $element) { + $list[$id] = isset($element->{$property}) ? $element->{$property} : null; + } + + return $list; + } + + /** + * @param string $property Object property to be updated. + * @param string $value New value. + */ + public function setProperty($property, $value) + { + foreach ($this as $element) { + $element->{$property} = $value; + } + } + + /** + * @param string $method Method name. + * @param array $arguments List of arguments passed to the function. + * @return array Return values. + */ + public function call($method, array $arguments) + { + $list = []; + + foreach ($this as $id => $element) { + $list[$id] = method_exists($element, $method) ? call_user_func_array([$element, $method], $arguments) : null; + } + + return $list; + } + + + /** + * Group items in the collection by a field. + * + * @param string $property + * @return array + */ + public function group($property) + { + $list = []; + foreach ($this as $element) { + $list[$element->{$property}][] = $element; + } + + return $list; + } +} diff --git a/system/src/Grav/Framework/Object/ObjectInterface.php b/system/src/Grav/Framework/Object/ObjectInterface.php new file mode 100644 index 000000000..b4ed09ef3 --- /dev/null +++ b/system/src/Grav/Framework/Object/ObjectInterface.php @@ -0,0 +1,62 @@ + (string) $keys]; + } + $id = $keys ? static::getInstanceId($keys) : null; + + // If we are creating or loading a new item or we load instance by alternative keys, we need to create a new object. + if (!$id || !isset(static::$instances[$id])) { + $c = get_called_class(); + + /** @var ObjectStorageTrait|ObjectInterface $instance */ + $instance = new $c(); + if (!$instance->load($keys)) { + return $instance; + } + + // Instance exists in storage: make sure that we return the global instance. + $id = $instance->getId(); + $reload = false; + } + + // Return global instance from the identifier. + $instance = static::$instances[$id]; + + if ($reload) { + $instance->load(); + } + + return $instance; + } + + /** + * Removes all or selected instances from the object cache. + * + * @param null|string|array $ids An optional primary key or list of keys. + */ + static public function freeInstances($ids = null) + { + if ($ids === null) { + $ids = array_keys(static::$instances); + } + $ids = (array) $ids; + + foreach ($ids as $id) { + unset(static::$instances[$id]); + } + } + + /** + * Override this function if you need to initialize object right after creating it. + * + * Can be used for example if the fields need to be converted from json strings to array. + * + * @return bool True if initialization was done, false if object was already initialized. + */ + public function initialize() + { + $initialized = $this->initialized; + $this->initialized = true; + + return !$initialized; + } + + /** + * Convert instance to a read only object. + * + * @return $this + */ + public function readonly() + { + $this->readonly = true; + + return $this; + } + + /** + * Returns true if the object has been stored. + * + * @return boolean True if object exists in storage. + */ + public function isSaved() + { + return $this->getStorage()->exists($this->getStorageKey()); + } + + /** + * Method to load object from the storage. + * + * @param mixed $keys An optional primary key value to load the object by, or an array of fields to match. If not + * set the instance key value is used. + * @param bool $getKey Internal parameter, please do not use. + * + * @return bool True on success, false if the object doesn't exist. + */ + public function load($keys = null, $getKey = true) + { + if ($getKey) { + if (is_scalar($keys)) { + $keys = ['id' => (string) $keys]; + } + + // Fetch internal key. + $key = $keys ? $this->getStorageKey($keys) : null; + + } else { + // Internal key was passed. + $key = $keys; + $keys = []; + } + + $this->doLoad($this->getStorage()->load($key), $keys); + $this->initialize(); + + $id = $this->getId(); + if ($id) { + if (!isset(static::$instances[$id])) { + static::$instances[$id] = $this; + } + } + + return $this->isSaved(); + } + + /** + * Method to save the object to the storage. + * + * Before saving the object, this method checks if object can be safely saved. + * + * @param bool $includeChildren + * @return bool True on success. + */ + public function save($includeChildren = false) + { + // Check the object. + if ($this->readonly || !$this->check($includeChildren) || !$this->onBeforeSave()) { + return false; + } + + // Get storage. + $storage = $this->getStorage(); + $key = $this->getStorageKey(); + + // Get data to be saved. + $data = $this->prepareSave(); + + // Save the object. + $exists = $storage->exists($key); + $id = $storage->save($key, $data); + + if (!$id) { + throw new \LogicException('No id specified'); + } + + // If item was created, load the object (making sure it has been properly initialized). + if (!$exists) { + $this->load($id, false); + } + + if ($includeChildren) { + $this->saveChildren(); + } + + $this->onAfterSave(); + + return true; + } + + /** + * Method to delete the object from the database. + * + * @param bool $includeChildren + * @return bool True on success. + */ + public function delete($includeChildren = false) + { + if ($this->readonly || !$this->isSaved() || !$this->onBeforeDelete()) { + return false; + } + + if ($includeChildren) { + $this->deleteChildren(); + } + + // Get storage. + $storage = $this->getStorage(); + + if (!$storage->delete($this->getStorageKey())) { + return false; + } + + $this->onAfterDelete(); + + return true; + } + + /** + * Method to perform sanity checks on the instance properties to ensure they are safe to store in the storage. + * + * Child classes should override this method to make sure the data they are storing in the storage is safe and as + * expected before saving the object. + * + * @return bool True if the instance is sane and able to be stored in the storage. + */ + public function check($includeChildren = false) + { + $result = true; + + if ($includeChildren) { + foreach ($this->toArray() as $field => $value) { + if (is_object($value) && method_exists($value, 'check')) { + $result = $result && $value->check(); + } + } + } + + return $result; + } + + // Internal functions + + abstract protected function doLoad(array $items, array $keys = []); + + /** + * @return bool + */ + protected function onBeforeSave() + { + return true; + } + + protected function onAfterSave() + { + } + + /** + * @return bool + */ + protected function onBeforeDelete() + { + return true; + } + + protected function onAfterDelete() + { + } + + protected function saveChildren() + { + foreach ($this->toArray() as $field => $value) { + if (is_object($value) && method_exists($value, 'save')) { + $value->save(true); + } + } + } + + protected function deleteChildren() + { + foreach ($this->toArray() as $field => $value) { + if (is_object($value) && method_exists($value, 'delete')) { + $value->delete(true); + } + } + } + + protected function prepareSave(array $data = null) + { + if ($data === null) { + $data = $this->toArray(); + } + + foreach ($data as $field => $value) { + if (is_object($value) && method_exists($value, 'save')) { + unset($data[$field]); + } + } + + return $data; + } + + /** + * Method to get the storage key for the object. + * + * @param array + * @return string + */ + abstract public function getStorageKey(array $keys = []); + + /** + * @param array $keys + * @return string + */ + public function getInstanceId(array $keys) + { + return $this->getStorageKey($keys); + } + + /** + * @return string + */ + public function getId() + { + return $this->getStorageKey(); + } + + /** + * @return StorageInterface + */ + protected static function getStorage() + { + if (!static::$storage) { + static::loadStorage(); + } + + return static::$storage; + } + + protected static function loadStorage() + { + throw new \RuntimeException('Storage has not been set.'); + } +} diff --git a/system/src/Grav/Framework/Object/Storage/FilesystemStorage.php b/system/src/Grav/Framework/Object/Storage/FilesystemStorage.php new file mode 100644 index 000000000..671827acc --- /dev/null +++ b/system/src/Grav/Framework/Object/Storage/FilesystemStorage.php @@ -0,0 +1,145 @@ +path = $path; + if ($type) { + $this->type = $type; + } + if ($extension) { + $this->extension = $extension; + } + } + + /** + * @param string $key + * @return bool + */ + public function exists($key) + { + if ($key === null) { + return false; + } + + $file = $this->getFile($key); + + return $file->exists(); + } + + /** + * @param string $key + * @return array + */ + public function load($key) + { + if ($key === null) { + return []; + } + + $file = $this->getFile($key); + $content = (array)$file->content(); + $file->free(); + + return $content; + } + + /** + * @param string $key + * @param array $data + * @return string + */ + public function save($key, array $data) + { + $file = $this->getFile($key); + $file->save($data); + $file->free(); + + return $key; + } + + /** + * @param string $key + * @return bool + */ + public function delete($key) + { + $file = $this->getFile($key); + $result = $file->delete(); + $file->free(); + + return $result; + } + + /** + * @param string[] $list + * @return array + */ + public function loadList(array $list) + { + $results = []; + foreach ($list as $id) { + $results[$id] = $this->load($id); + } + + return $results; + } + + /** + * @param string $key + * @return FileInterface + */ + protected function getFile($key) + { + if ($key === null) { + throw new \RuntimeException('Storage key not defined'); + } + + $filename = "{$this->path}/{$key}{$this->extension}"; + + /** @var UniformResourceLocator $locator */ + $locator = Grav::instance()['locator']; + + /** @var FileInterface $type */ + $type = $this->type; + + return $type::instance($locator->findResource($filename, true) ?: $locator->findResource($filename, true, true)); + } +} diff --git a/system/src/Grav/Framework/Object/Storage/StorageInterface.php b/system/src/Grav/Framework/Object/Storage/StorageInterface.php new file mode 100644 index 000000000..e53cbcc8e --- /dev/null +++ b/system/src/Grav/Framework/Object/Storage/StorageInterface.php @@ -0,0 +1,47 @@ + Date: Wed, 10 May 2017 11:02:51 +0300 Subject: [PATCH 002/141] Use older version of doctrine/collections (PHP 5.5 support) --- composer.json | 2 +- composer.lock | 19 +++++++++---------- .../Framework/Collection/ArrayCollection.php | 14 ++++++++++++-- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 1f299804e..b62501ade 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "symfony/var-dumper": "~2.8", "symfony/polyfill-iconv": "~1.0", "doctrine/cache": "~1.5", - "doctrine/collections": "^1.4", + "doctrine/collections": "1.3", "filp/whoops": "~2.0", "matthiasmullie/minify": "^1.3", "monolog/monolog": "~1.0", diff --git a/composer.lock b/composer.lock index 28474e547..963e7db90 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "acef808d0660c4938b26a2348ca26191", + "content-hash": "ac28b87fd76873a857a604de772e1e72", "packages": [ { "name": "antoligy/dom-string-iterators", @@ -122,29 +122,28 @@ }, { "name": "doctrine/collections", - "version": "v1.4.0", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/doctrine/collections.git", - "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba" + "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/1a4fb7e902202c33cce8c55989b945612943c2ba", - "reference": "1a4fb7e902202c33cce8c55989b945612943c2ba", + "url": "https://api.github.com/repos/doctrine/collections/zipball/6c1e4eef75f310ea1b3e30945e9f06e652128b8a", + "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": ">=5.3.2" }, "require-dev": { - "doctrine/coding-standard": "~0.1@dev", - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -185,7 +184,7 @@ "collections", "iterator" ], - "time": "2017-01-03T10:49:41+00:00" + "time": "2015-04-14T22:21:58+00:00" }, { "name": "donatj/phpuseragentparser", diff --git a/system/src/Grav/Framework/Collection/ArrayCollection.php b/system/src/Grav/Framework/Collection/ArrayCollection.php index d123f8926..917abd6b7 100644 --- a/system/src/Grav/Framework/Collection/ArrayCollection.php +++ b/system/src/Grav/Framework/Collection/ArrayCollection.php @@ -24,7 +24,12 @@ class ArrayCollection extends BaseArrayCollection implements CollectionInterface */ public function reverse() { - return $this->createFrom(array_reverse($this->toArray())); + if (method_exists($this, 'createFrom')) { + return $this->createFrom(array_reverse($this->toArray())); + } else { + // TODO: remove when PHP 5.6 is minimum (with doctrine/collections v1.4). + return new static(array_reverse($this->toArray())); + } } /** @@ -37,7 +42,12 @@ class ArrayCollection extends BaseArrayCollection implements CollectionInterface $keys = $this->getKeys(); shuffle($keys); - return $this->createFrom(array_replace(array_flip($keys), $this->toArray())); + if (method_exists($this, 'createFrom')) { + return $this->createFrom(array_replace(array_flip($keys), $this->toArray())); + } else { + // TODO: remove when PHP 5.6 is minimum (with doctrine/collections v1.4). + return new static(array_replace(array_flip($keys), $this->toArray())); + } } /** From ec4d451d7f904581e7271531a8fe73d4e170e759 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Wed, 10 May 2017 11:34:23 +0300 Subject: [PATCH 003/141] Fix for PHP 5.5 support in ObjectCollectionTrait --- .../Grav/Framework/Object/ObjectCollectionTrait.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/system/src/Grav/Framework/Object/ObjectCollectionTrait.php b/system/src/Grav/Framework/Object/ObjectCollectionTrait.php index 51e48061b..bcfa41408 100644 --- a/system/src/Grav/Framework/Object/ObjectCollectionTrait.php +++ b/system/src/Grav/Framework/Object/ObjectCollectionTrait.php @@ -14,12 +14,6 @@ namespace Grav\Framework\Object; */ trait ObjectCollectionTrait { - /** - * @param array $elements - * @return static - */ - abstract public function createFrom(array $elements); - /** * Create a copy from this collection by cloning all objects in the collection. * @@ -32,7 +26,12 @@ trait ObjectCollectionTrait $list[$key] = is_object($value) ? clone $value : $value; } - return $this->createFrom($list); + if (method_exists($this, 'createFrom')) { + return $this->createFrom($list); + } else { + // TODO: remove when PHP 5.6 is minimum (with doctrine/collections v1.4). + return new static($list); + } } /** From 77c2e47b9566263b6925aa046eb4c61ddc95c155 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Thu, 11 May 2017 13:20:01 +0300 Subject: [PATCH 004/141] Greatly simplify Object classes --- .../Grav/Framework/Object/AbstractObject.php | 185 --------- .../Object/AbstractObjectCollection.php | 35 -- system/src/Grav/Framework/Object/Object.php | 58 +++ .../Framework/Object/ObjectCollection.php | 50 +++ .../Object/ObjectCollectionInterface.php | 15 +- .../Object/ObjectCollectionTrait.php | 20 +- .../Grav/Framework/Object/ObjectInterface.php | 45 +- .../Framework/Object/ObjectStorageTrait.php | 385 ------------------ .../src/Grav/Framework/Object/ObjectTrait.php | 64 +++ .../Object/Storage/FilesystemStorage.php | 145 ------- .../Object/Storage/StorageInterface.php | 47 --- .../Object/StoredObjectInterface.php | 58 --- 12 files changed, 206 insertions(+), 901 deletions(-) delete mode 100644 system/src/Grav/Framework/Object/AbstractObject.php delete mode 100644 system/src/Grav/Framework/Object/AbstractObjectCollection.php create mode 100644 system/src/Grav/Framework/Object/Object.php create mode 100644 system/src/Grav/Framework/Object/ObjectCollection.php delete mode 100644 system/src/Grav/Framework/Object/ObjectStorageTrait.php create mode 100644 system/src/Grav/Framework/Object/ObjectTrait.php delete mode 100644 system/src/Grav/Framework/Object/Storage/FilesystemStorage.php delete mode 100644 system/src/Grav/Framework/Object/Storage/StorageInterface.php delete mode 100644 system/src/Grav/Framework/Object/StoredObjectInterface.php diff --git a/system/src/Grav/Framework/Object/AbstractObject.php b/system/src/Grav/Framework/Object/AbstractObject.php deleted file mode 100644 index 0508162e2..000000000 --- a/system/src/Grav/Framework/Object/AbstractObject.php +++ /dev/null @@ -1,185 +0,0 @@ - null - ]; - - /** - * Default properties for the object. - * @var array - */ - static protected $defaults = []; - - /** - * @var string - */ - static protected $collectionClass = 'Grav\\Framework\\Object\\AbstractObjectCollection'; - - /** - * Properties of the object. - * @var array - */ - protected $items; - - /** - * @param array $ids List of primary Ids or null to return everything that has been loaded. - * @param bool $readonly - * @return AbstractObjectCollection - */ - static public function instances(array $ids = null, $readonly = true) - { - $collectionClass = static::$collectionClass; - - if (is_null($ids)) { - return new $collectionClass(static::$instances); - } - - if (empty($ids)) { - return new $collectionClass([]); - } - - $results = []; - $list = []; - - foreach ($ids as $id) { - if (!isset(static::$instances[$id])) { - $list[] = $id; - } - } - - if ($list) { - $c = get_called_class(); - $storage = static::getStorage(); - $list = $storage->loadList($list); - foreach ($list as $keys) { - /** @var static $instance */ - $instance = new $c(); - $instance->doLoad($keys); - $id = $instance->getId(); - if ($id && !isset(static::$instances[$id])) { - $instance->initialize(); - static::$instances[$id] = $instance; - } - } - } - - foreach ($ids as $id) { - if (isset(static::$instances[$id])) { - $results[$id] = $readonly ? clone static::$instances[$id] : static::$instances[$id]; - } - } - - return new $collectionClass($results); - } - - /** - * Method to perform sanity checks on the instance properties to ensure they are safe to store in the storage. - * - * Child classes should override this method to make sure the data they are storing in the storage is safe and as - * expected before saving the object. - * - * @return bool True if the instance is sane and able to be stored in the storage. - */ - public function check($includeChildren = false) - { - return $this->checkKeys() && $this->traitCheck($includeChildren); - } - - /** - * @param array $keys - * @return array - */ - public function getKeys(array $keys = []) - { - foreach (static::$primaryKey as $key => $value) { - if (!isset($keys[$key])) { - if (isset($this->items[$key])) { - $keys[$key] = $this->items[$key]; - } else { - $keys[$key] = $value; - } - - } - } - - return $keys; - } - - /** - * @param array $keys - * @return bool - */ - public function checkKeys(array $keys = []) - { - if (!$keys) { - $keys = $this->getKeys(); - } - - foreach ($keys as $key => $value) { - if ($value === null) { - return false; - } - } - - return true; - } - - /** - * Implementes JsonSerializable interface. - * - * @return array - */ - public function jsonSerialize() - { - return $this->toArray(); - } - - /** - * Returns a string representation of this object. - * - * @return string - */ - public function __toString() - { - return __CLASS__ . '@' . spl_object_hash($this); - } - - // Internal functions - - /** - * @param array $items - * @param array $keys - */ - protected function doLoad(array $items, array $keys = []) - { - $this->items = array_replace(static::$defaults, $this->items, $this->getKeys($keys), $items); - } -} diff --git a/system/src/Grav/Framework/Object/AbstractObjectCollection.php b/system/src/Grav/Framework/Object/AbstractObjectCollection.php deleted file mode 100644 index ecad694d9..000000000 --- a/system/src/Grav/Framework/Object/AbstractObjectCollection.php +++ /dev/null @@ -1,35 +0,0 @@ -id = $id; - } - - public function getId() - { - return $this->id ?: $this->getParentId(); - } -} diff --git a/system/src/Grav/Framework/Object/Object.php b/system/src/Grav/Framework/Object/Object.php new file mode 100644 index 000000000..90ff4e667 --- /dev/null +++ b/system/src/Grav/Framework/Object/Object.php @@ -0,0 +1,58 @@ +items = $elements; + $this->key = $key !== null ? $key : $this->getKey(); + + if ($this->key === null) { + throw new \InvalidArgumentException('Object cannot be created without assigning a key'); + } + } + + /** + * Implements JsonSerializable interface. + * + * @return array + */ + public function jsonSerialize() + { + return ['key' => $this->getKey(), 'object' => $this->toArray()]; + } +} diff --git a/system/src/Grav/Framework/Object/ObjectCollection.php b/system/src/Grav/Framework/Object/ObjectCollection.php new file mode 100644 index 000000000..764b6ff13 --- /dev/null +++ b/system/src/Grav/Framework/Object/ObjectCollection.php @@ -0,0 +1,50 @@ +key = $key !== null ? $key : $this->getKey(); + + if ($this->key === null) { + throw new \InvalidArgumentException('Object cannot be created without assigning a key'); + } + } + + /** + * Implements JsonSerializable interface. + * + * @return array + */ + public function jsonSerialize() + { + return ['key' => $this->getKey(), 'objects' => $this->toArray()]; + } +} diff --git a/system/src/Grav/Framework/Object/ObjectCollectionInterface.php b/system/src/Grav/Framework/Object/ObjectCollectionInterface.php index ecacee917..2248417be 100644 --- a/system/src/Grav/Framework/Object/ObjectCollectionInterface.php +++ b/system/src/Grav/Framework/Object/ObjectCollectionInterface.php @@ -14,7 +14,7 @@ use Grav\Framework\Collection\CollectionInterface; * ObjectCollection Interface * @package Grav\Framework\Collection */ -interface ObjectCollectionInterface extends CollectionInterface +interface ObjectCollectionInterface extends CollectionInterface, ObjectInterface { /** * Create a copy from this collection by cloning all objects in the collection. @@ -23,6 +23,11 @@ interface ObjectCollectionInterface extends CollectionInterface */ public function copy(); + /** + * @return array + */ + public function getObjectKeys(); + /** * @param string $property Object property to be fetched. * @return array Values of the property. @@ -42,4 +47,12 @@ interface ObjectCollectionInterface extends CollectionInterface * @return array Return values. */ public function call($name, array $arguments); + + /** + * Group items in the collection by a field. + * + * @param string $property + * @return array + */ + public function group($property); } diff --git a/system/src/Grav/Framework/Object/ObjectCollectionTrait.php b/system/src/Grav/Framework/Object/ObjectCollectionTrait.php index bcfa41408..861ce2de1 100644 --- a/system/src/Grav/Framework/Object/ObjectCollectionTrait.php +++ b/system/src/Grav/Framework/Object/ObjectCollectionTrait.php @@ -14,6 +14,8 @@ namespace Grav\Framework\Object; */ trait ObjectCollectionTrait { + use ObjectTrait; + /** * Create a copy from this collection by cloning all objects in the collection. * @@ -26,12 +28,20 @@ trait ObjectCollectionTrait $list[$key] = is_object($value) ? clone $value : $value; } - if (method_exists($this, 'createFrom')) { - return $this->createFrom($list); - } else { - // TODO: remove when PHP 5.6 is minimum (with doctrine/collections v1.4). + // TODO: remove when PHP 5.6 is minimum (with doctrine/collections v1.4). + if (!method_exists($this, 'createFrom')) { return new static($list); } + + return $this->createFrom($list); + } + + /** + * @return array + */ + public function getObjectKeys() + { + return $this->call('getKey'); } /** @@ -65,7 +75,7 @@ trait ObjectCollectionTrait * @param array $arguments List of arguments passed to the function. * @return array Return values. */ - public function call($method, array $arguments) + public function call($method, array $arguments = []) { $list = []; diff --git a/system/src/Grav/Framework/Object/ObjectInterface.php b/system/src/Grav/Framework/Object/ObjectInterface.php index b4ed09ef3..26c7a27b7 100644 --- a/system/src/Grav/Framework/Object/ObjectInterface.php +++ b/system/src/Grav/Framework/Object/ObjectInterface.php @@ -15,48 +15,13 @@ namespace Grav\Framework\Object; interface ObjectInterface extends \ArrayAccess, \JsonSerializable { /** - * Returns the global instance to the object. - * - * Note that using array of fields will always make a query, but it's very useful feature if you want to search one - * item by using arbitrary set of matching fields. If there are more than one matching object, first one gets returned. - * - * @param null|int|string|array $keys An optional primary key value to load the object by, or an array of fields to match. - * @param boolean $reload Force object to reload. - * - * @return Object + * @param array $elements + * @param string $key */ - static public function instance($keys = null, $reload = false); + public function __construct(array $elements = [], $key = null); /** - * @param array $ids List of primary Ids or null to return everything that has been loaded. - * @param bool $readonly - * @return AbstractObjectCollection + * @return string */ - static public function instances(array $ids = null, $readonly = true); - - /** - * Removes all or selected instances from the object cache. - * - * @param null|int|string|array $ids An optional primary key or list of keys. - */ - static public function freeInstances($ids = null); - - /** - * Override this function if you need to initialize object right after creating it. - * - * Can be used for example if the fields need to be converted from json strings to array. - * - * @return bool True if initialization was done, false if object was already initialized. - */ - public function initialize(); - - /** - * Method to perform sanity checks on the instance properties to ensure they are safe to store in the storage. - * - * Child classes should override this method to make sure the data they are storing in the storage is safe and as - * expected before saving the object. - * - * @return boolean True if the instance is sane and able to be stored in the storage. - */ - public function check(); + public function getKey(); } diff --git a/system/src/Grav/Framework/Object/ObjectStorageTrait.php b/system/src/Grav/Framework/Object/ObjectStorageTrait.php deleted file mode 100644 index 96ab28f74..000000000 --- a/system/src/Grav/Framework/Object/ObjectStorageTrait.php +++ /dev/null @@ -1,385 +0,0 @@ - (string) $keys]; - } - $id = $keys ? static::getInstanceId($keys) : null; - - // If we are creating or loading a new item or we load instance by alternative keys, we need to create a new object. - if (!$id || !isset(static::$instances[$id])) { - $c = get_called_class(); - - /** @var ObjectStorageTrait|ObjectInterface $instance */ - $instance = new $c(); - if (!$instance->load($keys)) { - return $instance; - } - - // Instance exists in storage: make sure that we return the global instance. - $id = $instance->getId(); - $reload = false; - } - - // Return global instance from the identifier. - $instance = static::$instances[$id]; - - if ($reload) { - $instance->load(); - } - - return $instance; - } - - /** - * Removes all or selected instances from the object cache. - * - * @param null|string|array $ids An optional primary key or list of keys. - */ - static public function freeInstances($ids = null) - { - if ($ids === null) { - $ids = array_keys(static::$instances); - } - $ids = (array) $ids; - - foreach ($ids as $id) { - unset(static::$instances[$id]); - } - } - - /** - * Override this function if you need to initialize object right after creating it. - * - * Can be used for example if the fields need to be converted from json strings to array. - * - * @return bool True if initialization was done, false if object was already initialized. - */ - public function initialize() - { - $initialized = $this->initialized; - $this->initialized = true; - - return !$initialized; - } - - /** - * Convert instance to a read only object. - * - * @return $this - */ - public function readonly() - { - $this->readonly = true; - - return $this; - } - - /** - * Returns true if the object has been stored. - * - * @return boolean True if object exists in storage. - */ - public function isSaved() - { - return $this->getStorage()->exists($this->getStorageKey()); - } - - /** - * Method to load object from the storage. - * - * @param mixed $keys An optional primary key value to load the object by, or an array of fields to match. If not - * set the instance key value is used. - * @param bool $getKey Internal parameter, please do not use. - * - * @return bool True on success, false if the object doesn't exist. - */ - public function load($keys = null, $getKey = true) - { - if ($getKey) { - if (is_scalar($keys)) { - $keys = ['id' => (string) $keys]; - } - - // Fetch internal key. - $key = $keys ? $this->getStorageKey($keys) : null; - - } else { - // Internal key was passed. - $key = $keys; - $keys = []; - } - - $this->doLoad($this->getStorage()->load($key), $keys); - $this->initialize(); - - $id = $this->getId(); - if ($id) { - if (!isset(static::$instances[$id])) { - static::$instances[$id] = $this; - } - } - - return $this->isSaved(); - } - - /** - * Method to save the object to the storage. - * - * Before saving the object, this method checks if object can be safely saved. - * - * @param bool $includeChildren - * @return bool True on success. - */ - public function save($includeChildren = false) - { - // Check the object. - if ($this->readonly || !$this->check($includeChildren) || !$this->onBeforeSave()) { - return false; - } - - // Get storage. - $storage = $this->getStorage(); - $key = $this->getStorageKey(); - - // Get data to be saved. - $data = $this->prepareSave(); - - // Save the object. - $exists = $storage->exists($key); - $id = $storage->save($key, $data); - - if (!$id) { - throw new \LogicException('No id specified'); - } - - // If item was created, load the object (making sure it has been properly initialized). - if (!$exists) { - $this->load($id, false); - } - - if ($includeChildren) { - $this->saveChildren(); - } - - $this->onAfterSave(); - - return true; - } - - /** - * Method to delete the object from the database. - * - * @param bool $includeChildren - * @return bool True on success. - */ - public function delete($includeChildren = false) - { - if ($this->readonly || !$this->isSaved() || !$this->onBeforeDelete()) { - return false; - } - - if ($includeChildren) { - $this->deleteChildren(); - } - - // Get storage. - $storage = $this->getStorage(); - - if (!$storage->delete($this->getStorageKey())) { - return false; - } - - $this->onAfterDelete(); - - return true; - } - - /** - * Method to perform sanity checks on the instance properties to ensure they are safe to store in the storage. - * - * Child classes should override this method to make sure the data they are storing in the storage is safe and as - * expected before saving the object. - * - * @return bool True if the instance is sane and able to be stored in the storage. - */ - public function check($includeChildren = false) - { - $result = true; - - if ($includeChildren) { - foreach ($this->toArray() as $field => $value) { - if (is_object($value) && method_exists($value, 'check')) { - $result = $result && $value->check(); - } - } - } - - return $result; - } - - // Internal functions - - abstract protected function doLoad(array $items, array $keys = []); - - /** - * @return bool - */ - protected function onBeforeSave() - { - return true; - } - - protected function onAfterSave() - { - } - - /** - * @return bool - */ - protected function onBeforeDelete() - { - return true; - } - - protected function onAfterDelete() - { - } - - protected function saveChildren() - { - foreach ($this->toArray() as $field => $value) { - if (is_object($value) && method_exists($value, 'save')) { - $value->save(true); - } - } - } - - protected function deleteChildren() - { - foreach ($this->toArray() as $field => $value) { - if (is_object($value) && method_exists($value, 'delete')) { - $value->delete(true); - } - } - } - - protected function prepareSave(array $data = null) - { - if ($data === null) { - $data = $this->toArray(); - } - - foreach ($data as $field => $value) { - if (is_object($value) && method_exists($value, 'save')) { - unset($data[$field]); - } - } - - return $data; - } - - /** - * Method to get the storage key for the object. - * - * @param array - * @return string - */ - abstract public function getStorageKey(array $keys = []); - - /** - * @param array $keys - * @return string - */ - public function getInstanceId(array $keys) - { - return $this->getStorageKey($keys); - } - - /** - * @return string - */ - public function getId() - { - return $this->getStorageKey(); - } - - /** - * @return StorageInterface - */ - protected static function getStorage() - { - if (!static::$storage) { - static::loadStorage(); - } - - return static::$storage; - } - - protected static function loadStorage() - { - throw new \RuntimeException('Storage has not been set.'); - } -} diff --git a/system/src/Grav/Framework/Object/ObjectTrait.php b/system/src/Grav/Framework/Object/ObjectTrait.php new file mode 100644 index 000000000..c20a12aee --- /dev/null +++ b/system/src/Grav/Framework/Object/ObjectTrait.php @@ -0,0 +1,64 @@ +items = $elements; + $this->key = $key !== null ? $key : $this->getKey(); + + if ($this->key === null) { + throw new \InvalidArgumentException('Object cannot be created without assigning a key'); + } + } + + /** + * @return string + */ + public function getKey() + { + return $this->key; + } + + /** + * Returns a string representation of this object. + * + * @return string + */ + public function __toString() + { + return __CLASS__ . '@' . spl_object_hash($this); + } +} diff --git a/system/src/Grav/Framework/Object/Storage/FilesystemStorage.php b/system/src/Grav/Framework/Object/Storage/FilesystemStorage.php deleted file mode 100644 index 671827acc..000000000 --- a/system/src/Grav/Framework/Object/Storage/FilesystemStorage.php +++ /dev/null @@ -1,145 +0,0 @@ -path = $path; - if ($type) { - $this->type = $type; - } - if ($extension) { - $this->extension = $extension; - } - } - - /** - * @param string $key - * @return bool - */ - public function exists($key) - { - if ($key === null) { - return false; - } - - $file = $this->getFile($key); - - return $file->exists(); - } - - /** - * @param string $key - * @return array - */ - public function load($key) - { - if ($key === null) { - return []; - } - - $file = $this->getFile($key); - $content = (array)$file->content(); - $file->free(); - - return $content; - } - - /** - * @param string $key - * @param array $data - * @return string - */ - public function save($key, array $data) - { - $file = $this->getFile($key); - $file->save($data); - $file->free(); - - return $key; - } - - /** - * @param string $key - * @return bool - */ - public function delete($key) - { - $file = $this->getFile($key); - $result = $file->delete(); - $file->free(); - - return $result; - } - - /** - * @param string[] $list - * @return array - */ - public function loadList(array $list) - { - $results = []; - foreach ($list as $id) { - $results[$id] = $this->load($id); - } - - return $results; - } - - /** - * @param string $key - * @return FileInterface - */ - protected function getFile($key) - { - if ($key === null) { - throw new \RuntimeException('Storage key not defined'); - } - - $filename = "{$this->path}/{$key}{$this->extension}"; - - /** @var UniformResourceLocator $locator */ - $locator = Grav::instance()['locator']; - - /** @var FileInterface $type */ - $type = $this->type; - - return $type::instance($locator->findResource($filename, true) ?: $locator->findResource($filename, true, true)); - } -} diff --git a/system/src/Grav/Framework/Object/Storage/StorageInterface.php b/system/src/Grav/Framework/Object/Storage/StorageInterface.php deleted file mode 100644 index e53cbcc8e..000000000 --- a/system/src/Grav/Framework/Object/Storage/StorageInterface.php +++ /dev/null @@ -1,47 +0,0 @@ - Date: Thu, 11 May 2017 13:34:43 +0300 Subject: [PATCH 005/141] Added `Grav\Framework\Cache` classes providing PSR-16 `Simple Cache` implementation --- CHANGELOG.md | 7 +- composer.json | 1 + composer.lock | 50 +++- .../Grav/Framework/Cache/AbstractCache.php | 29 +++ .../Framework/Cache/Adapter/DoctrineCache.php | 96 +++++++ .../Grav/Framework/Cache/CacheInterface.php | 19 ++ .../src/Grav/Framework/Cache/CacheTrait.php | 240 ++++++++++++++++++ .../Cache/Exception/CacheException.php | 19 ++ .../Exception/InvalidArgumentException.php | 19 ++ 9 files changed, 476 insertions(+), 4 deletions(-) create mode 100644 system/src/Grav/Framework/Cache/AbstractCache.php create mode 100644 system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php create mode 100644 system/src/Grav/Framework/Cache/CacheInterface.php create mode 100644 system/src/Grav/Framework/Cache/CacheTrait.php create mode 100644 system/src/Grav/Framework/Cache/Exception/CacheException.php create mode 100644 system/src/Grav/Framework/Cache/Exception/InvalidArgumentException.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 1177bd10c..108aebcb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,10 @@ ## mm/dd/2017 1. [](#new) - * Added `Grav\Framework\ContentBlock` classes which add better support for nested HTML blocks with assets - * Added `Grav\Framework\Object` classes to support general objects and their collections - * Added `Grav\Framework\Page` interfaces + * Added `Grav\Framework\Cache` classes providing PSR-16 `Simple Cache` implementation + * Added `Grav\Framework\ContentBlock` classes for nested HTML blocks with CSS/JS assets + * Added `Grav\Framework\Object` classes for creating collections of objects + * Added `Grav\Framework\Page` interfaces * Deprecated GravTrait # v1.2.5 diff --git a/composer.json b/composer.json index b62501ade..e8151b18d 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,7 @@ "symfony/polyfill-iconv": "~1.0", "doctrine/cache": "~1.5", "doctrine/collections": "1.3", + "psr/simple-cache": "^1.0", "filp/whoops": "~2.0", "matthiasmullie/minify": "^1.3", "monolog/monolog": "~1.0", diff --git a/composer.lock b/composer.lock index 963e7db90..bafa8c4b7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "ac28b87fd76873a857a604de772e1e72", + "content-hash": "f9e602a9833bae4ef67c9545e72fcfbc", "packages": [ { "name": "antoligy/dom-string-iterators", @@ -868,6 +868,54 @@ ], "time": "2016-10-10T12:19:37+00:00" }, + { + "name": "psr/simple-cache", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "753fa598e8f3b9966c886fe13f370baa45ef0e24" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/753fa598e8f3b9966c886fe13f370baa45ef0e24", + "reference": "753fa598e8f3b9966c886fe13f370baa45ef0e24", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "time": "2017-01-02T13:31:39+00:00" + }, { "name": "rockettheme/toolbox", "version": "1.3.3", diff --git a/system/src/Grav/Framework/Cache/AbstractCache.php b/system/src/Grav/Framework/Cache/AbstractCache.php new file mode 100644 index 000000000..1713b754c --- /dev/null +++ b/system/src/Grav/Framework/Cache/AbstractCache.php @@ -0,0 +1,29 @@ +init($namespace, $defaultLifetime); + } +} diff --git a/system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php b/system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php new file mode 100644 index 000000000..57b127391 --- /dev/null +++ b/system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php @@ -0,0 +1,96 @@ +getNamespace(); + $namespace && $doctrineCache->setNamespace($namespace); + + $this->driver = $doctrineCache; + } + + protected function doGet($key, $default) + { + $value = $this->driver->fetch($key); + + // Doctrine cache does not differentiate between no result and cached 'false'. Make sure that we do. + return $value !== false || $this->driver->contains($key) ? $value : $default; + } + + protected function doSet($key, $value, $ttl) + { + return $this->driver->save($key, $value, (int) $ttl); + } + + protected function doDelete($key) + { + return $this->driver->delete($key); + } + + protected function doClear() + { + return $this->driver->deleteAll(); + } + + protected function doGetMultiple($keys, $default) + { + return $this->driver->fetchMultiple($keys); + } + + protected function doSetMultiple($values, $ttl) + { + return $this->driver->saveMultiple($values, (int) $ttl); + } + + protected function doDeleteMultiple($keys) + { + // TODO: Remove when Doctrine Cache has been updated to support the feature. + if (!method_exists($this->driver, 'deleteMultiple')) { + $success = true; + foreach ($keys as $key) { + $success = $this->delete($key) && $success; + } + + return $success; + } + + return $this->driver->deleteMultiple($keys); + } + + protected function doHas($key) + { + return $this->driver->contains($key); + } +} diff --git a/system/src/Grav/Framework/Cache/CacheInterface.php b/system/src/Grav/Framework/Cache/CacheInterface.php new file mode 100644 index 000000000..fe573013a --- /dev/null +++ b/system/src/Grav/Framework/Cache/CacheInterface.php @@ -0,0 +1,19 @@ +namespace = (string) $namespace; + $this->defaultLifetime = $this->convertTtl($defaultLifetime, true); + } + + /** + * @return string + */ + protected function getNamespace() + { + return $this->namespace; + } + + /** + * @return int|null + */ + protected function getDefaultLifetime() + { + return $this->defaultLifetime; + } + + /** + * @inheritdoc + */ + public function get($key, $default = null) + { + $this->validateKey($key); + + return $this->doGet($key, $default); + } + + /** + * @inheritdoc + */ + public function set($key, $value, $ttl = null) + { + $this->validateKey($key); + + $ttl = $this->convertTtl($ttl); + + // If a negative or zero TTL is provided, the item MUST be deleted from the cache. + return $ttl <= 0 ? $this->doDelete($key) : $this->doSet($key, $value, $ttl); + } + + /** + * @inheritdoc + */ + public function delete($key) + { + $this->validateKey($key); + + return $this->doDelete($key); + } + + /** + * @inheritdoc + */ + public function clear() + { + return $this->doClear(); + } + + /** + * @inheritdoc + */ + public function getMultiple($keys, $default = null) + { + if ($keys instanceof \Traversable) { + $keys = iterator_to_array($keys, false); + } elseif (!is_array($keys)) { + throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', is_object($keys) ? get_class($keys) : gettype($keys))); + } + + if (empty($keys)) { + return []; + } + + $this->validateKeys($keys); + + $list = $this->doGetMultiple($keys, $default); + + if (count($list) !== count($keys)) { + // Return all values, with default value if they do not exist. + return array_replace(array_fill_keys($keys, $default), $list); + } + + // Make sure that results are returned in the same order as the keys were given. + ksort($list); + + return $list; + } + + /** + * @inheritdoc + */ + public function setMultiple($values, $ttl = null) + { + if ($values instanceof \Traversable) { + $values = iterator_to_array($values, true); + } elseif (!is_array($values)) { + throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', is_object($values) ? get_class($values) : gettype($values))); + } + + $keys = array_keys($values); + + if (empty($keys)) { + return true; + } + + $this->validateKeys($keys); + + $ttl = $this->convertTtl($ttl); + + // If a negative or zero TTL is provided, the item MUST be deleted from the cache. + return $ttl <= 0 ? $this->doDeleteMultiple($keys) : $this->doSetMultiple($values, $ttl); + } + + /** + * @inheritdoc + */ + public function deleteMultiple($keys) + { + if ($keys instanceof \Traversable) { + $keys = iterator_to_array($keys, false); + } elseif (!is_array($keys)) { + throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', is_object($keys) ? get_class($keys) : gettype($keys))); + } + + if (empty($keys)) { + return true; + } + + $this->validateKeys($keys); + + return $this->doDeleteMultiple($keys); + } + + /** + * @inheritdoc + */ + public function has($key) + { + $this->validateKey($key); + + return $this->doHas($key); + } + + /** + * @param string $key + */ + protected function validateKey($key) + { + if (!is_string($key)) { + throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given', is_object($key) ? get_class($key) : gettype($key))); + } + if (!isset($key[0])) { + throw new InvalidArgumentException('Cache key length must be greater than zero'); + } + if (strlen($key) > 64) { + throw new InvalidArgumentException(sprintf('Cache key length must be less than 65 characters, key had %s characters', strlen($key))); + } + if (strpbrk($key, '{}()/\@:') !== false) { + throw new InvalidArgumentException(sprintf('Cache key "%s" contains reserved characters {}()/\@:', $key)); + } + } + + protected function validateKeys($keys) + { + foreach ($keys as $key) { + $this->validateKey($key); + } + } + + /** + * @param null|int|\DateInterval $ttl + * @param bool $ignoreDefault Used internally inside $this->init(). + * @return int|null + */ + protected function convertTtl($ttl, $ignoreDefault = false) + { + if (!$ignoreDefault && $ttl === null) { + return $this->getDefaultLifetime(); + } + + if (is_int($ttl)) { + return $ttl; + } + + if ($ttl instanceof \DateInterval) { + $ttl = (int) \DateTime::createFromFormat('U', 0)->add($ttl)->format('U'); + } + + throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given', is_object($ttl) ? get_class($ttl) : gettype($ttl))); + } + + abstract protected function doGet($key, $default); + abstract protected function doSet($key, $value, $ttl); + abstract protected function doDelete($key); + abstract protected function doClear(); + abstract protected function doGetMultiple($keys, $default); + abstract protected function doSetMultiple($values, $ttl); + abstract protected function doDeleteMultiple($keys); + abstract protected function doHas($key); +} diff --git a/system/src/Grav/Framework/Cache/Exception/CacheException.php b/system/src/Grav/Framework/Cache/Exception/CacheException.php new file mode 100644 index 000000000..d4bc175f5 --- /dev/null +++ b/system/src/Grav/Framework/Cache/Exception/CacheException.php @@ -0,0 +1,19 @@ + Date: Tue, 16 May 2017 12:00:49 +0300 Subject: [PATCH 006/141] Add support for loading properties in Object class --- system/src/Grav/Framework/Object/Object.php | 31 ++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/system/src/Grav/Framework/Object/Object.php b/system/src/Grav/Framework/Object/Object.php index 90ff4e667..ded4f148b 100644 --- a/system/src/Grav/Framework/Object/Object.php +++ b/system/src/Grav/Framework/Object/Object.php @@ -18,7 +18,10 @@ use RocketTheme\Toolbox\ArrayTraits\Export; */ class Object implements ObjectInterface { - use ObjectTrait, ArrayAccessWithGetters, Export; + use ObjectTrait, ArrayAccessWithGetters, Export { + ArrayAccessWithGetters::offsetExists as private parentOffsetExists; + ArrayAccessWithGetters::offsetGet as private parentOffsetGet; + } /** * Properties of the object. @@ -46,6 +49,32 @@ class Object implements ObjectInterface } } + /** + * Checks whether or not an offset exists with a possibility to load the field by $this->loadField{offset}(). + * + * @param mixed $offset An offset to check for. + * @return bool Returns TRUE on success or FALSE on failure. + */ + public function offsetExists($offset) + { + return $this->parentOffsetExists($offset) || method_exists($this, "loadOffset_{$offset}"); + } + + /** + * Returns the value at specified offset with a possibility to load the field by $this->loadField{offset}(). + * + * @param mixed $offset The offset to retrieve. + * @return mixed Can return all value types. + */ + public function offsetGet($offset) + { + if (!$this->parentOffsetExists($offset) && method_exists($this, "loadOffset_{$offset}")) { + $this->offsetSet($offset, call_user_func([$this, "loadOffset_{$offset}"])); + } + + return $this->parentOffsetGet($offset); + } + /** * Implements JsonSerializable interface. * From b4801560be0b9c7cf18c51d1bed82b09149f5aef Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Tue, 16 May 2017 12:24:41 +0300 Subject: [PATCH 007/141] Update docblocks --- system/src/Grav/Framework/Object/Object.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/src/Grav/Framework/Object/Object.php b/system/src/Grav/Framework/Object/Object.php index ded4f148b..bd11927d8 100644 --- a/system/src/Grav/Framework/Object/Object.php +++ b/system/src/Grav/Framework/Object/Object.php @@ -50,7 +50,7 @@ class Object implements ObjectInterface } /** - * Checks whether or not an offset exists with a possibility to load the field by $this->loadField{offset}(). + * Checks whether or not an offset exists with a possibility to load the field by $this->loadOffset_{$offset}(). * * @param mixed $offset An offset to check for. * @return bool Returns TRUE on success or FALSE on failure. @@ -61,7 +61,7 @@ class Object implements ObjectInterface } /** - * Returns the value at specified offset with a possibility to load the field by $this->loadField{offset}(). + * Returns the value at specified offset with a possibility to load the field by $this->loadOffset_{$offset}(). * * @param mixed $offset The offset to retrieve. * @return mixed Can return all value types. From 91a6224156d020ac5c592aac82fa06963d3670c6 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Tue, 16 May 2017 19:03:23 +0300 Subject: [PATCH 008/141] Rename Object::offsetLoad_*() functions, nested array access --- system/src/Grav/Framework/Object/Object.php | 35 +++++++++++++++------ 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/system/src/Grav/Framework/Object/Object.php b/system/src/Grav/Framework/Object/Object.php index bd11927d8..e09cdf32a 100644 --- a/system/src/Grav/Framework/Object/Object.php +++ b/system/src/Grav/Framework/Object/Object.php @@ -8,8 +8,8 @@ namespace Grav\Framework\Object; -use RocketTheme\Toolbox\ArrayTraits\ArrayAccessWithGetters; use RocketTheme\Toolbox\ArrayTraits\Export; +use RocketTheme\Toolbox\ArrayTraits\NestedArrayAccessWithGetters; /** * Object class. @@ -18,9 +18,10 @@ use RocketTheme\Toolbox\ArrayTraits\Export; */ class Object implements ObjectInterface { - use ObjectTrait, ArrayAccessWithGetters, Export { - ArrayAccessWithGetters::offsetExists as private parentOffsetExists; - ArrayAccessWithGetters::offsetGet as private parentOffsetGet; + use ObjectTrait, NestedArrayAccessWithGetters, Export { + NestedArrayAccessWithGetters::offsetExists as private parentOffsetExists; + NestedArrayAccessWithGetters::offsetGet as private parentOffsetGet; + NestedArrayAccessWithGetters::offsetSet as private parentOffsetSet; } /** @@ -50,31 +51,47 @@ class Object implements ObjectInterface } /** - * Checks whether or not an offset exists with a possibility to load the field by $this->loadOffset_{$offset}(). + * Checks whether or not an offset exists with a possibility to load the field by $this->offsetLoad_{$offset}(). * * @param mixed $offset An offset to check for. * @return bool Returns TRUE on success or FALSE on failure. */ public function offsetExists($offset) { - return $this->parentOffsetExists($offset) || method_exists($this, "loadOffset_{$offset}"); + return $this->parentOffsetExists($offset) || method_exists($this, "offsetLoad_{$offset}"); } /** - * Returns the value at specified offset with a possibility to load the field by $this->loadOffset_{$offset}(). + * Returns the value at specified offset with a possibility to load the field by $this->offsetLoad_{$offset}(). * * @param mixed $offset The offset to retrieve. * @return mixed Can return all value types. */ public function offsetGet($offset) { - if (!$this->parentOffsetExists($offset) && method_exists($this, "loadOffset_{$offset}")) { - $this->offsetSet($offset, call_user_func([$this, "loadOffset_{$offset}"])); + if (!$this->parentOffsetExists($offset) && method_exists($this, "offsetLoad_{$offset}")) { + $this->offsetSet($offset, call_user_func([$this, "offsetLoad_{$offset}"])); } return $this->parentOffsetGet($offset); } + + /** + * Assigns a value to the specified offset with a possibility to check or alter the value by $this->offsetPrepare_{$offset}(). + * + * @param mixed $offset The offset to assign the value to. + * @param mixed $value The value to set. + */ + public function offsetSet($offset, $value) + { + if (method_exists($this, "offsetPrepare_{$offset}")) { + $value = call_user_func([$this, "offsetPrepare_{$offset}"], $value); + } + + $this->parentOffsetSet($offset, $value); + } + /** * Implements JsonSerializable interface. * From 0269ec579ba891b9cafa9c584748aae9188037e5 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Tue, 16 May 2017 19:04:24 +0300 Subject: [PATCH 009/141] Object collections: Allow property get, set and grouping for nested arrays --- system/src/Grav/Framework/Object/ObjectCollectionTrait.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/system/src/Grav/Framework/Object/ObjectCollectionTrait.php b/system/src/Grav/Framework/Object/ObjectCollectionTrait.php index 861ce2de1..8eab19169 100644 --- a/system/src/Grav/Framework/Object/ObjectCollectionTrait.php +++ b/system/src/Grav/Framework/Object/ObjectCollectionTrait.php @@ -53,7 +53,7 @@ trait ObjectCollectionTrait $list = []; foreach ($this as $id => $element) { - $list[$id] = isset($element->{$property}) ? $element->{$property} : null; + $list[$id] = isset($element[$property]) ? $element[$property] : null; } return $list; @@ -66,7 +66,7 @@ trait ObjectCollectionTrait public function setProperty($property, $value) { foreach ($this as $element) { - $element->{$property} = $value; + $element[$property] = $value; } } @@ -96,8 +96,9 @@ trait ObjectCollectionTrait public function group($property) { $list = []; + foreach ($this as $element) { - $list[$element->{$property}][] = $element; + $list[$element[$property]][] = $element; } return $list; From 7ca0f8711cfbd9c5aae8ddd184b90cfe73a7323c Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Mon, 22 May 2017 14:55:26 +0300 Subject: [PATCH 010/141] Make it possible to include debug bar also into non-HTML responses --- CHANGELOG.md | 1 + system/src/Grav/Common/Debugger.php | 41 +++++++++++++++++++++++------ system/src/Grav/Common/Grav.php | 5 ---- 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64f2044ff..1df2864e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ 1. [](#improved) * Optionally remove unpublished pages from the translated languages, move into untranslated list [#1482](https://github.com/getgrav/grav/pull/1482) * Improved reliability of `hash` filecheck method + * Make it possible to include debug bar also into non-HTML responses 1. [](#bugfix) * Fix output handling in RenderProcessor [#1483](https://github.com/getgrav/grav/pull/1483) diff --git a/system/src/Grav/Common/Debugger.php b/system/src/Grav/Common/Debugger.php index 679772306..ef5b242b4 100644 --- a/system/src/Grav/Common/Debugger.php +++ b/system/src/Grav/Common/Debugger.php @@ -36,6 +36,9 @@ class Debugger */ public function __construct() { + // Enable debugger until $this->init() gets called. + $this->enabled = true; + $this->debugbar = new StandardDebugBar(); $this->debugbar['time']->addMeasure('Loading', $this->debugbar['time']->getRequestStartTime(), microtime(true)); } @@ -51,6 +54,9 @@ class Debugger $this->grav = Grav::instance(); $this->config = $this->grav['config']; + // Enable/disable debugger based on configuration. + $this->enabled = $this->config->get('system.debugger.enabled'); + if ($this->enabled()) { $this->debugbar->addCollector(new ConfigCollector((array)$this->config->get('system'), 'Config')); $this->debugbar->addCollector(new ConfigCollector((array)$this->config->get('plugins'), 'Plugins')); @@ -70,10 +76,6 @@ class Debugger { if (isset($state)) { $this->enabled = $state; - } else { - if (!isset($this->enabled)) { - $this->enabled = $this->config->get('system.debugger.enabled'); - } } return $this->enabled; @@ -91,7 +93,6 @@ class Debugger // Only add assets if Page is HTML $page = $this->grav['page']; if ($page->templateFormat() != 'html') { - $this->enabled = false; return $this; } @@ -163,6 +164,12 @@ class Debugger public function render() { if ($this->enabled()) { + // Only add assets if Page is HTML + $page = $this->grav['page']; + if ($page->templateFormat() != 'html') { + return $this; + } + echo $this->renderer->render(); } @@ -176,11 +183,29 @@ class Debugger */ public function sendDataInHeaders() { - $this->debugbar->sendDataInHeaders(); + if ($this->enabled()) { + $this->debugbar->sendDataInHeaders(); + } return $this; } + /** + * Returns collected debugger data. + * + * @return array + */ + public function getData() + { + if (!$this->enabled()) { + return null; + } + + $this->timers = []; + + return $this->debugbar->getData(); + } + /** * Start a timer with an associated name and description * @@ -191,7 +216,7 @@ class Debugger */ public function startTimer($name, $description = null) { - if ($name[0] == '_' || $this->config->get('system.debugger.enabled')) { + if ($name[0] == '_' || $this->enabled()) { $this->debugbar['time']->startMeasure($name, $description); $this->timers[] = $name; } @@ -208,7 +233,7 @@ class Debugger */ public function stopTimer($name) { - if (in_array($name, $this->timers) && ($name[0] == '_' || $this->config->get('system.debugger.enabled'))) { + if (in_array($name, $this->timers) && ($name[0] == '_' || $this->enabled())) { $this->debugbar['time']->stopMeasure($name); } diff --git a/system/src/Grav/Common/Grav.php b/system/src/Grav/Common/Grav.php index a260ec95f..c5adcb5d0 100644 --- a/system/src/Grav/Common/Grav.php +++ b/system/src/Grav/Common/Grav.php @@ -247,11 +247,6 @@ class Grav extends Container header('ETag: "' . md5($page->raw() . $page->modified()).'"'); } - // Set debugger data in headers - if (!($format === null || $format == 'html')) { - $this['debugger']->enabled(false); - } - // Set HTTP response code if (isset($this['page']->header()->http_response_code)) { http_response_code($this['page']->header()->http_response_code); From b2070c8ab5f1da35f98abc696b0df9a7d6543878 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Wed, 24 May 2017 15:15:14 +0300 Subject: [PATCH 011/141] Fix error on missing renderer if using unknown file extension --- system/src/Grav/Common/Debugger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Debugger.php b/system/src/Grav/Common/Debugger.php index ef5b242b4..cce279d38 100644 --- a/system/src/Grav/Common/Debugger.php +++ b/system/src/Grav/Common/Debugger.php @@ -166,7 +166,7 @@ class Debugger if ($this->enabled()) { // Only add assets if Page is HTML $page = $this->grav['page']; - if ($page->templateFormat() != 'html') { + if ($page->templateFormat() != 'html' || !$this->renderer) { return $this; } From 99eff9587caf383c2198d97140ad4c5d9e013f4c Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 26 May 2017 12:27:48 +0300 Subject: [PATCH 012/141] Implement MemoryCache adapter --- .../Framework/Cache/Adapter/MemoryCache.php | 65 +++++++++++++++++++ .../src/Grav/Framework/Cache/CacheTrait.php | 39 ++++++++++- 2 files changed, 101 insertions(+), 3 deletions(-) create mode 100644 system/src/Grav/Framework/Cache/Adapter/MemoryCache.php diff --git a/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php b/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php new file mode 100644 index 000000000..9e164ea2d --- /dev/null +++ b/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php @@ -0,0 +1,65 @@ +doHas($key) ? $this->cache[$key] : $default; + } + + protected function doSet($key, $value, $ttl) + { + $this->cache[$key] = $value; + + return true; + } + + protected function doDelete($key) + { + unset($this->cache[$key]); + + return true; + } + + protected function doClear() + { + $this->cache = []; + + return true; + } + + protected function doHas($key) + { + return array_key_exists($key, $this->cache); + } +} diff --git a/system/src/Grav/Framework/Cache/CacheTrait.php b/system/src/Grav/Framework/Cache/CacheTrait.php index 0c7b9a33f..f0308621c 100644 --- a/system/src/Grav/Framework/Cache/CacheTrait.php +++ b/system/src/Grav/Framework/Cache/CacheTrait.php @@ -233,8 +233,41 @@ trait CacheTrait abstract protected function doSet($key, $value, $ttl); abstract protected function doDelete($key); abstract protected function doClear(); - abstract protected function doGetMultiple($keys, $default); - abstract protected function doSetMultiple($values, $ttl); - abstract protected function doDeleteMultiple($keys); + + protected function doGetMultiple($keys, $default) + { + $results = []; + + foreach ($keys as $key) { + if ($this->doHas($key)) { + $results[$key] = $this->doGet($key, $default); + } + } + + return $results; + } + + protected function doSetMultiple($values, $ttl) + { + $success = true; + + foreach ($values as $key => $value) { + $success = $this->doSet($key, $value, $ttl) && $success; + } + + return $success; + } + + protected function doDeleteMultiple($keys) + { + $success = true; + + foreach ($keys as $key) { + $success = $this->doDelete($key) && $success; + } + + return $success; + } + abstract protected function doHas($key); } From 83943ce70d62a67ef9668631c9cd3835ccfdee88 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 26 May 2017 13:12:18 +0300 Subject: [PATCH 013/141] Namespace and TTL not needed in MemoryCache adapter --- .../src/Grav/Framework/Cache/Adapter/MemoryCache.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php b/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php index 9e164ea2d..b9dd35ac0 100644 --- a/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php +++ b/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php @@ -11,7 +11,7 @@ namespace Grav\Framework\Cache\Adapter; use Grav\Framework\Cache\AbstractCache; /** - * Cache class for PSR-16 compatible "Simple Cache" implementation using memory backend. + * Cache class for PSR-16 compatible "Simple Cache" implementation using in memory backend. * Memory backend does not use namespace or ttl as the cache is unique to each cache object and request. * * @package Grav\Framework\Cache @@ -21,15 +21,11 @@ class MemoryCache extends AbstractCache protected $cache = []; /** - * Doctrine Cache constructor. - * - * @param string $namespace - * @param null|int|\DateInterval $defaultLifetime + * Memory Cache constructor. */ - public function __construct($namespace = '', $defaultLifetime = null) + public function __construct() { - // Do not use $namespace or $defaultLifetime directly, store them with constructor and fetch with methods. - parent::__construct($namespace, $defaultLifetime); + parent::__construct(); } protected function doGet($key, $default) From 6dbf704a1356562744808639d325707b46b485d9 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Mon, 29 May 2017 10:12:02 +0300 Subject: [PATCH 014/141] Implement memory and chain cache --- .../Framework/Cache/Adapter/ChainCache.php | 177 ++++++++++++++++++ .../Framework/Cache/Adapter/DoctrineCache.php | 18 +- .../Framework/Cache/Adapter/MemoryCache.php | 26 ++- .../Grav/Framework/Cache/CacheInterface.php | 8 + system/src/Grav/Framework/Cache/CacheMiss.php | 20 ++ .../src/Grav/Framework/Cache/CacheTrait.php | 118 +++++++----- 6 files changed, 302 insertions(+), 65 deletions(-) create mode 100644 system/src/Grav/Framework/Cache/Adapter/ChainCache.php create mode 100644 system/src/Grav/Framework/Cache/CacheMiss.php diff --git a/system/src/Grav/Framework/Cache/Adapter/ChainCache.php b/system/src/Grav/Framework/Cache/Adapter/ChainCache.php new file mode 100644 index 000000000..1402fbaa5 --- /dev/null +++ b/system/src/Grav/Framework/Cache/Adapter/ChainCache.php @@ -0,0 +1,177 @@ +caches = array_values($caches); + $this->count = count($caches); + $this->miss = new \stdClass; + } + + public function doGet($key) + { + foreach ($this->caches as $i => $cache) { + $value = $cache->doGet($key); + if ($this->isHit($value)) { + while (--$i >= 0) { + // Update all the previous caches with missing value. + $this->caches[$i]->doSet($key, $value, $this->getDefaultLifetime()); + } + + return $value; + } + } + + return $this->miss(); + } + + public function doSet($key, $value, $ttl) + { + $success = true; + $i = $this->count; + + while ($i--) { + $success = $this->caches[$i]->doSet($key, $value, $ttl) && $success; + } + + return $success; + } + + public function doDelete($key) + { + $success = true; + $i = $this->count; + + while ($i--) { + $success = $this->caches[$i]->doDelete($key) && $success; + } + + return $success; + } + + public function doClear() + { + $success = true; + $i = $this->count; + + while ($i--) { + $success = $this->caches[$i]->doClear() && $success; + } + return $success; + } + + + public function doGetMultiple($keys) + { + $found = []; + $missing = []; + foreach ($this->caches as $i => $cache) { + $values = $cache->doGetMultiple($i ? $missing[$i - 1] : $keys); + + foreach ($values as $key => $value) { + if ($this->isHit($value)) { + $found[$key] = $value; + } else { + $missing[$i][$key] = true; + } + } + + if (empty($missing[$i])) { + break; + } + } + + $values = []; + // Update all the previous caches with missing values. + foreach (array_reverse($missing) as $i => $keys) { + $values += array_intersect($found, $keys); + $this->caches[$i]->doSetMultiple($values, $this->getDefaultLifetime()); + } + + return $found; + } + + public function doSetMultiple($values, $ttl) + { + $success = true; + $i = $this->count; + + while ($i--) { + $success = $this->caches[$i]->doSetMultiple($values, $ttl) && $success; + } + + return $success; + } + + public function doDeleteMultiple($keys) + { + $success = true; + $i = $this->count; + + while ($i--) { + $success = $this->caches[$i]->doDeleteMultiple($keys) && $success; + } + + return $success; + } + + public function doHas($key) + { + foreach ($this->caches as $cache) { + if ($cache->doHas($key)) { + return true; + } + } + + return false; + } +} diff --git a/system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php b/system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php index 57b127391..7499aba04 100644 --- a/system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php +++ b/system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php @@ -41,40 +41,40 @@ class DoctrineCache extends AbstractCache $this->driver = $doctrineCache; } - protected function doGet($key, $default) + public function doGet($key) { $value = $this->driver->fetch($key); // Doctrine cache does not differentiate between no result and cached 'false'. Make sure that we do. - return $value !== false || $this->driver->contains($key) ? $value : $default; + return $value !== false || $this->driver->contains($key) ? $value : $this->miss(); } - protected function doSet($key, $value, $ttl) + public function doSet($key, $value, $ttl) { return $this->driver->save($key, $value, (int) $ttl); } - protected function doDelete($key) + public function doDelete($key) { return $this->driver->delete($key); } - protected function doClear() + public function doClear() { return $this->driver->deleteAll(); } - protected function doGetMultiple($keys, $default) + public function doGetMultiple($keys) { return $this->driver->fetchMultiple($keys); } - protected function doSetMultiple($values, $ttl) + public function doSetMultiple($values, $ttl) { return $this->driver->saveMultiple($values, (int) $ttl); } - protected function doDeleteMultiple($keys) + public function doDeleteMultiple($keys) { // TODO: Remove when Doctrine Cache has been updated to support the feature. if (!method_exists($this->driver, 'deleteMultiple')) { @@ -89,7 +89,7 @@ class DoctrineCache extends AbstractCache return $this->driver->deleteMultiple($keys); } - protected function doHas($key) + public function doHas($key) { return $this->driver->contains($key); } diff --git a/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php b/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php index b9dd35ac0..f551c8044 100644 --- a/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php +++ b/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php @@ -12,12 +12,15 @@ use Grav\Framework\Cache\AbstractCache; /** * Cache class for PSR-16 compatible "Simple Cache" implementation using in memory backend. - * Memory backend does not use namespace or ttl as the cache is unique to each cache object and request. + * Memory backend does not use namespace or default ttl as the cache is unique to each cache object and request. * * @package Grav\Framework\Cache */ class MemoryCache extends AbstractCache { + /** + * @var array + */ protected $cache = []; /** @@ -28,34 +31,39 @@ class MemoryCache extends AbstractCache parent::__construct(); } - protected function doGet($key, $default) + public function doGet($key) { - return $this->doHas($key) ? $this->cache[$key] : $default; + if (!array_key_exists($key, $this->cache)) { + // Cache misses. + $this->cache[$key] = $this->miss(); + } + + return $this->cache[$key]; } - protected function doSet($key, $value, $ttl) + public function doSet($key, $value, $ttl) { $this->cache[$key] = $value; return true; } - protected function doDelete($key) + public function doDelete($key) { - unset($this->cache[$key]); + $this->cache[$key] = $this->miss(); return true; } - protected function doClear() + public function doClear() { $this->cache = []; return true; } - protected function doHas($key) + public function doHas($key) { - return array_key_exists($key, $this->cache); + return array_key_exists($key, $this->cache) && $this->isHit($this->cache[$key]); } } diff --git a/system/src/Grav/Framework/Cache/CacheInterface.php b/system/src/Grav/Framework/Cache/CacheInterface.php index fe573013a..3ba8a3ef4 100644 --- a/system/src/Grav/Framework/Cache/CacheInterface.php +++ b/system/src/Grav/Framework/Cache/CacheInterface.php @@ -16,4 +16,12 @@ use Psr\SimpleCache\CacheInterface as SimpleCacheInterface; */ interface CacheInterface extends SimpleCacheInterface { + public function doGet($key); + public function doSet($key, $value, $ttl); + public function doDelete($key); + public function doClear(); + public function doGetMultiple($keys); + public function doSetMultiple($values, $ttl); + public function doDeleteMultiple($keys); + public function doHas($key); } diff --git a/system/src/Grav/Framework/Cache/CacheMiss.php b/system/src/Grav/Framework/Cache/CacheMiss.php new file mode 100644 index 000000000..0858aec22 --- /dev/null +++ b/system/src/Grav/Framework/Cache/CacheMiss.php @@ -0,0 +1,20 @@ +namespace = (string) $namespace; $this->defaultLifetime = $this->convertTtl($defaultLifetime, true); + $this->miss = new CacheMiss(); } /** @@ -55,6 +61,23 @@ trait CacheTrait return $this->defaultLifetime; } + /** + * @param mixed $value + * @return bool + */ + protected function isHit($value) + { + return !($value instanceof CacheMiss); + } + + /** + * @return CacheMiss + */ + protected function miss() + { + return $this->miss; + } + /** * @inheritdoc */ @@ -62,7 +85,9 @@ trait CacheTrait { $this->validateKey($key); - return $this->doGet($key, $default); + $value = $this->doGet($key); + + return $this->isHit($value) ? $value : $default; } /** @@ -113,7 +138,7 @@ trait CacheTrait $this->validateKeys($keys); - $list = $this->doGetMultiple($keys, $default); + $list = $this->doGetMultiple($keys); if (count($list) !== count($keys)) { // Return all values, with default value if they do not exist. @@ -121,9 +146,7 @@ trait CacheTrait } // Make sure that results are returned in the same order as the keys were given. - ksort($list); - - return $list; + return array_replace(array_flip($keys), $list); } /** @@ -181,6 +204,49 @@ trait CacheTrait return $this->doHas($key); } + abstract public function doGet($key); + abstract public function doSet($key, $value, $ttl); + abstract public function doDelete($key); + abstract public function doClear(); + + public function doGetMultiple($keys) + { + $results = []; + + foreach ($keys as $key) { + $value = $this->doGet($key); + if ($this->isHit($value)) { + $results[$key] = $value; + } + } + + return $results; + } + + public function doSetMultiple($values, $ttl) + { + $success = true; + + foreach ($values as $key => $value) { + $success = $this->doSet($key, $value, $ttl) && $success; + } + + return $success; + } + + public function doDeleteMultiple($keys) + { + $success = true; + + foreach ($keys as $key) { + $success = $this->doDelete($key) && $success; + } + + return $success; + } + + abstract public function doHas($key); + /** * @param string $key */ @@ -228,46 +294,4 @@ trait CacheTrait throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given', is_object($ttl) ? get_class($ttl) : gettype($ttl))); } - - abstract protected function doGet($key, $default); - abstract protected function doSet($key, $value, $ttl); - abstract protected function doDelete($key); - abstract protected function doClear(); - - protected function doGetMultiple($keys, $default) - { - $results = []; - - foreach ($keys as $key) { - if ($this->doHas($key)) { - $results[$key] = $this->doGet($key, $default); - } - } - - return $results; - } - - protected function doSetMultiple($values, $ttl) - { - $success = true; - - foreach ($values as $key => $value) { - $success = $this->doSet($key, $value, $ttl) && $success; - } - - return $success; - } - - protected function doDeleteMultiple($keys) - { - $success = true; - - foreach ($keys as $key) { - $success = $this->doDelete($key) && $success; - } - - return $success; - } - - abstract protected function doHas($key); } From 673131926adac57b92e7ba72807755cb91c605fa Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Mon, 29 May 2017 14:30:52 +0300 Subject: [PATCH 015/141] Improve caching functions --- .../Framework/Cache/Adapter/ChainCache.php | 41 +++++++---------- .../Framework/Cache/Adapter/DoctrineCache.php | 6 +-- .../Framework/Cache/Adapter/MemoryCache.php | 9 ++-- .../Grav/Framework/Cache/CacheInterface.php | 4 +- system/src/Grav/Framework/Cache/CacheMiss.php | 20 --------- .../src/Grav/Framework/Cache/CacheTrait.php | 44 +++++++------------ 6 files changed, 40 insertions(+), 84 deletions(-) delete mode 100644 system/src/Grav/Framework/Cache/CacheMiss.php diff --git a/system/src/Grav/Framework/Cache/Adapter/ChainCache.php b/system/src/Grav/Framework/Cache/Adapter/ChainCache.php index 1402fbaa5..d211516aa 100644 --- a/system/src/Grav/Framework/Cache/Adapter/ChainCache.php +++ b/system/src/Grav/Framework/Cache/Adapter/ChainCache.php @@ -28,11 +28,6 @@ class ChainCache extends AbstractCache */ protected $count; - /** - * @var \stdClass - */ - protected $miss; - /** * Chain Cache constructor. * @param array $caches @@ -54,14 +49,13 @@ class ChainCache extends AbstractCache $this->caches = array_values($caches); $this->count = count($caches); - $this->miss = new \stdClass; } - public function doGet($key) + public function doGet($key, $miss) { foreach ($this->caches as $i => $cache) { - $value = $cache->doGet($key); - if ($this->isHit($value)) { + $value = $cache->doGet($key, $miss); + if ($value !== $miss) { while (--$i >= 0) { // Update all the previous caches with missing value. $this->caches[$i]->doSet($key, $value, $this->getDefaultLifetime()); @@ -71,7 +65,7 @@ class ChainCache extends AbstractCache } } - return $this->miss(); + return $miss; } public function doSet($key, $value, $ttl) @@ -110,34 +104,29 @@ class ChainCache extends AbstractCache } - public function doGetMultiple($keys) + public function doGetMultiple($keys, $miss) { - $found = []; - $missing = []; + $list = []; foreach ($this->caches as $i => $cache) { - $values = $cache->doGetMultiple($i ? $missing[$i - 1] : $keys); + $list[$i] = $cache->doGetMultiple($keys, $miss); - foreach ($values as $key => $value) { - if ($this->isHit($value)) { - $found[$key] = $value; - } else { - $missing[$i][$key] = true; - } - } + $keys = array_diff_key($keys, $list[$i]); - if (empty($missing[$i])) { + if (!$keys) { break; } } $values = []; // Update all the previous caches with missing values. - foreach (array_reverse($missing) as $i => $keys) { - $values += array_intersect($found, $keys); - $this->caches[$i]->doSetMultiple($values, $this->getDefaultLifetime()); + foreach (array_reverse($list) as $i => $items) { + $values += $items; + if ($i && $values) { + $this->caches[$i-1]->doSetMultiple($values, $this->getDefaultLifetime()); + } } - return $found; + return $values; } public function doSetMultiple($values, $ttl) diff --git a/system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php b/system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php index 7499aba04..50ed80084 100644 --- a/system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php +++ b/system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php @@ -41,12 +41,12 @@ class DoctrineCache extends AbstractCache $this->driver = $doctrineCache; } - public function doGet($key) + public function doGet($key, $miss) { $value = $this->driver->fetch($key); // Doctrine cache does not differentiate between no result and cached 'false'. Make sure that we do. - return $value !== false || $this->driver->contains($key) ? $value : $this->miss(); + return $value !== false || $this->driver->contains($key) ? $value : $miss; } public function doSet($key, $value, $ttl) @@ -64,7 +64,7 @@ class DoctrineCache extends AbstractCache return $this->driver->deleteAll(); } - public function doGetMultiple($keys) + public function doGetMultiple($keys, $miss) { return $this->driver->fetchMultiple($keys); } diff --git a/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php b/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php index f551c8044..e19bb755e 100644 --- a/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php +++ b/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php @@ -31,11 +31,10 @@ class MemoryCache extends AbstractCache parent::__construct(); } - public function doGet($key) + public function doGet($key, $miss) { if (!array_key_exists($key, $this->cache)) { - // Cache misses. - $this->cache[$key] = $this->miss(); + return $miss; } return $this->cache[$key]; @@ -50,7 +49,7 @@ class MemoryCache extends AbstractCache public function doDelete($key) { - $this->cache[$key] = $this->miss(); + unset($this->cache[$key]); return true; } @@ -64,6 +63,6 @@ class MemoryCache extends AbstractCache public function doHas($key) { - return array_key_exists($key, $this->cache) && $this->isHit($this->cache[$key]); + return array_key_exists($key, $this->cache); } } diff --git a/system/src/Grav/Framework/Cache/CacheInterface.php b/system/src/Grav/Framework/Cache/CacheInterface.php index 3ba8a3ef4..587dbeeda 100644 --- a/system/src/Grav/Framework/Cache/CacheInterface.php +++ b/system/src/Grav/Framework/Cache/CacheInterface.php @@ -16,11 +16,11 @@ use Psr\SimpleCache\CacheInterface as SimpleCacheInterface; */ interface CacheInterface extends SimpleCacheInterface { - public function doGet($key); + public function doGet($key, $miss); public function doSet($key, $value, $ttl); public function doDelete($key); public function doClear(); - public function doGetMultiple($keys); + public function doGetMultiple($keys, $miss); public function doSetMultiple($values, $ttl); public function doDeleteMultiple($keys); public function doHas($key); diff --git a/system/src/Grav/Framework/Cache/CacheMiss.php b/system/src/Grav/Framework/Cache/CacheMiss.php deleted file mode 100644 index 0858aec22..000000000 --- a/system/src/Grav/Framework/Cache/CacheMiss.php +++ /dev/null @@ -1,20 +0,0 @@ -namespace = (string) $namespace; $this->defaultLifetime = $this->convertTtl($defaultLifetime, true); - $this->miss = new CacheMiss(); + $this->miss = new \stdClass; } /** @@ -61,23 +61,6 @@ trait CacheTrait return $this->defaultLifetime; } - /** - * @param mixed $value - * @return bool - */ - protected function isHit($value) - { - return !($value instanceof CacheMiss); - } - - /** - * @return CacheMiss - */ - protected function miss() - { - return $this->miss; - } - /** * @inheritdoc */ @@ -85,9 +68,9 @@ trait CacheTrait { $this->validateKey($key); - $value = $this->doGet($key); + $value = $this->doGet($key, $this->miss); - return $this->isHit($value) ? $value : $default; + return $value !== $this->miss ? $value : $default; } /** @@ -137,12 +120,17 @@ trait CacheTrait } $this->validateKeys($keys); + $keys = array_unique($keys); + $keys = array_combine($keys, $keys); - $list = $this->doGetMultiple($keys); + $list = $this->doGetMultiple($keys, $this->miss); if (count($list) !== count($keys)) { - // Return all values, with default value if they do not exist. - return array_replace(array_fill_keys($keys, $default), $list); + foreach ($keys as $key) { + if (!array_key_exists($key, $list) || $list[$key] === $this->miss) { + $list[$key] = $default; + } + } } // Make sure that results are returned in the same order as the keys were given. @@ -204,18 +192,18 @@ trait CacheTrait return $this->doHas($key); } - abstract public function doGet($key); + abstract public function doGet($key, $miss); abstract public function doSet($key, $value, $ttl); abstract public function doDelete($key); abstract public function doClear(); - public function doGetMultiple($keys) + public function doGetMultiple($keys, $miss) { $results = []; foreach ($keys as $key) { - $value = $this->doGet($key); - if ($this->isHit($value)) { + $value = $this->doGet($key, $miss); + if ($value !== $miss) { $results[$key] = $value; } } From 512aae350ecbd8ea697527f42893d10f7181c7e0 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Wed, 31 May 2017 13:34:04 +0300 Subject: [PATCH 016/141] Fix cloning issues with ObjectCollection --- system/src/Grav/Framework/Object/ObjectCollection.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/system/src/Grav/Framework/Object/ObjectCollection.php b/system/src/Grav/Framework/Object/ObjectCollection.php index 764b6ff13..799a0cbe9 100644 --- a/system/src/Grav/Framework/Object/ObjectCollection.php +++ b/system/src/Grav/Framework/Object/ObjectCollection.php @@ -32,10 +32,6 @@ class ObjectCollection extends ArrayCollection implements ObjectCollectionInterf parent::__construct($elements); $this->key = $key !== null ? $key : $this->getKey(); - - if ($this->key === null) { - throw new \InvalidArgumentException('Object cannot be created without assigning a key'); - } } /** From c4fac41fe32a2524ddc33381731ab0ea2a9d8244 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Wed, 31 May 2017 13:35:14 +0300 Subject: [PATCH 017/141] Improve CacheTrait::getMultiple() --- system/src/Grav/Framework/Cache/CacheTrait.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/system/src/Grav/Framework/Cache/CacheTrait.php b/system/src/Grav/Framework/Cache/CacheTrait.php index dd8e759b4..9d07547fb 100644 --- a/system/src/Grav/Framework/Cache/CacheTrait.php +++ b/system/src/Grav/Framework/Cache/CacheTrait.php @@ -125,16 +125,17 @@ trait CacheTrait $list = $this->doGetMultiple($keys, $this->miss); - if (count($list) !== count($keys)) { - foreach ($keys as $key) { - if (!array_key_exists($key, $list) || $list[$key] === $this->miss) { - $list[$key] = $default; - } + // Make sure that values are returned in the same order as the keys were given. + $values = []; + foreach ($keys as $key) { + if (!array_key_exists($key, $list) || $list[$key] === $this->miss) { + $values[$key] = $default; + } else { + $values[$key] = $list[$key]; } } - // Make sure that results are returned in the same order as the keys were given. - return array_replace(array_flip($keys), $list); + return $values; } /** From 039d2286fb5aa3c152d15689462f6b26a95983b6 Mon Sep 17 00:00:00 2001 From: mahagr Date: Tue, 18 Jul 2017 15:37:04 -0600 Subject: [PATCH 018/141] Add Object::getKey() function --- composer.lock | 182 +++++++++++++------- system/src/Grav/Framework/Object/Object.php | 5 + 2 files changed, 123 insertions(+), 64 deletions(-) diff --git a/composer.lock b/composer.lock index f9bb7168e..78d5ee99d 100644 --- a/composer.lock +++ b/composer.lock @@ -239,16 +239,16 @@ }, { "name": "erusev/parsedown", - "version": "1.6.2", + "version": "1.6.3", "source": { "type": "git", "url": "https://github.com/erusev/parsedown.git", - "reference": "1bf24f7334fe16c88bf9d467863309ceaf285b01" + "reference": "728952b90a333b5c6f77f06ea9422b94b585878d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown/zipball/1bf24f7334fe16c88bf9d467863309ceaf285b01", - "reference": "1bf24f7334fe16c88bf9d467863309ceaf285b01", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/728952b90a333b5c6f77f06ea9422b94b585878d", + "reference": "728952b90a333b5c6f77f06ea9422b94b585878d", "shasum": "" }, "require": { @@ -277,7 +277,7 @@ "markdown", "parser" ], - "time": "2017-03-29T16:04:15+00:00" + "time": "2017-05-14T14:47:48+00:00" }, { "name": "erusev/parsedown-extra", @@ -532,16 +532,16 @@ }, { "name": "matthiasmullie/minify", - "version": "1.3.45", + "version": "1.3.46", "source": { "type": "git", "url": "https://github.com/matthiasmullie/minify.git", - "reference": "09b83e9dbdc50cf6734c6a9652a54891c0651998" + "reference": "1443646268465b8930c9a7f2f8ff1a51453796d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/09b83e9dbdc50cf6734c6a9652a54891c0651998", - "reference": "09b83e9dbdc50cf6734c6a9652a54891c0651998", + "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/1443646268465b8930c9a7f2f8ff1a51453796d1", + "reference": "1443646268465b8930c9a7f2f8ff1a51453796d1", "shasum": "" }, "require": { @@ -588,7 +588,7 @@ "minifier", "minify" ], - "time": "2017-06-13T15:54:31+00:00" + "time": "2017-07-06T12:26:44+00:00" }, { "name": "matthiasmullie/path-converter", @@ -835,25 +835,29 @@ }, { "name": "pimple/pimple", - "version": "v3.0.2", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/silexphp/Pimple.git", - "reference": "a30f7d6e57565a2e1a316e1baf2a483f788b258a" + "reference": "279b56046fb368deacf77e2f8f3bdcea45cc367a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/a30f7d6e57565a2e1a316e1baf2a483f788b258a", - "reference": "a30f7d6e57565a2e1a316e1baf2a483f788b258a", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/279b56046fb368deacf77e2f8f3bdcea45cc367a", + "reference": "279b56046fb368deacf77e2f8f3bdcea45cc367a", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=5.3.0", + "psr/container": "^1.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^3.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { @@ -877,7 +881,56 @@ "container", "dependency injection" ], - "time": "2015-09-11T15:10:35+00:00" + "time": "2017-07-03T14:06:46+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" }, { "name": "psr/log", @@ -1072,16 +1125,16 @@ }, { "name": "symfony/console", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "3ef6ef64abecd566d551d9e7f6393ac6e93b2462" + "reference": "46e65f8d98c9ab629bbfcc16a4ff023f61c37fb2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/3ef6ef64abecd566d551d9e7f6393ac6e93b2462", - "reference": "3ef6ef64abecd566d551d9e7f6393ac6e93b2462", + "url": "https://api.github.com/repos/symfony/console/zipball/46e65f8d98c9ab629bbfcc16a4ff023f61c37fb2", + "reference": "46e65f8d98c9ab629bbfcc16a4ff023f61c37fb2", "shasum": "" }, "require": { @@ -1129,7 +1182,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-06-02T14:36:56+00:00" + "time": "2017-07-03T08:04:30+00:00" }, { "name": "symfony/debug", @@ -1190,7 +1243,7 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -1368,16 +1421,16 @@ }, { "name": "symfony/var-dumper", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "8108f6200e8a1cf999df2691431a2d71e6db1152" + "reference": "5fe3ba6d3817ae378d141962616e048ac85ba21d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/8108f6200e8a1cf999df2691431a2d71e6db1152", - "reference": "8108f6200e8a1cf999df2691431a2d71e6db1152", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/5fe3ba6d3817ae378d141962616e048ac85ba21d", + "reference": "5fe3ba6d3817ae378d141962616e048ac85ba21d", "shasum": "" }, "require": { @@ -1432,11 +1485,11 @@ "debug", "dump" ], - "time": "2017-06-02T08:28:06+00:00" + "time": "2017-06-20T23:27:56+00:00" }, { "name": "symfony/yaml", - "version": "v2.8.22", + "version": "v2.8.24", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", @@ -1485,16 +1538,16 @@ }, { "name": "twig/twig", - "version": "v1.34.3", + "version": "v1.34.4", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "451c6f4197e113e24c1c85bc3fc8c2d77adeff2e" + "reference": "f878bab48edb66ad9c6ed626bf817f60c6c096ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/451c6f4197e113e24c1c85bc3fc8c2d77adeff2e", - "reference": "451c6f4197e113e24c1c85bc3fc8c2d77adeff2e", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/f878bab48edb66ad9c6ed626bf817f60c6c096ee", + "reference": "f878bab48edb66ad9c6ed626bf817f60c6c096ee", "shasum": "" }, "require": { @@ -1546,7 +1599,7 @@ "keywords": [ "templating" ], - "time": "2017-06-07T18:45:17+00:00" + "time": "2017-07-04T13:19:31+00:00" } ], "packages-dev": [ @@ -1611,16 +1664,16 @@ }, { "name": "codeception/codeception", - "version": "2.3.3", + "version": "2.3.4", "source": { "type": "git", "url": "https://github.com/Codeception/Codeception.git", - "reference": "67cd520b4f20cdfc3a52d1a0022924125822a8e6" + "reference": "b5391497f9a3c9d0a9c02ae39b53441e413e35a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/Codeception/zipball/67cd520b4f20cdfc3a52d1a0022924125822a8e6", - "reference": "67cd520b4f20cdfc3a52d1a0022924125822a8e6", + "url": "https://api.github.com/repos/Codeception/Codeception/zipball/b5391497f9a3c9d0a9c02ae39b53441e413e35a8", + "reference": "b5391497f9a3c9d0a9c02ae39b53441e413e35a8", "shasum": "" }, "require": { @@ -1657,6 +1710,7 @@ "php-amqplib/php-amqplib": "~2.4", "predis/predis": "^1.0", "squizlabs/php_codesniffer": "~2.0", + "symfony/process": ">=2.7 <4.0", "vlucas/phpdotenv": "^2.4.0" }, "suggest": { @@ -1701,7 +1755,7 @@ "functional testing", "unit testing" ], - "time": "2017-06-02T00:22:30+00:00" + "time": "2017-07-10T19:45:09+00:00" }, { "name": "doctrine/instantiator", @@ -2094,22 +2148,22 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "3.1.1", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" + "reference": "46f7e8bb075036c92695b15a1ddb6971c751e585" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/46f7e8bb075036c92695b15a1ddb6971c751e585", + "reference": "46f7e8bb075036c92695b15a1ddb6971c751e585", "shasum": "" }, "require": { "php": ">=5.5", "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.2.0", + "phpdocumentor/type-resolver": "^0.4.0", "webmozart/assert": "^1.0" }, "require-dev": { @@ -2135,24 +2189,24 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-09-30T07:12:33+00:00" + "time": "2017-07-15T11:38:20+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.2.1", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", "shasum": "" }, "require": { - "php": ">=5.5", + "php": "^5.5 || ^7.0", "phpdocumentor/reflection-common": "^1.0" }, "require-dev": { @@ -2182,7 +2236,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2016-11-25T06:54:22+00:00" + "time": "2017-07-14T14:27:02+00:00" }, { "name": "phpspec/prophecy", @@ -3092,16 +3146,16 @@ }, { "name": "symfony/browser-kit", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "c2c8ceb1aa9dab9eae54e9150e6a588ce3e53be1" + "reference": "3a4435e79a8401746e8525e98039199d0924b4e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/c2c8ceb1aa9dab9eae54e9150e6a588ce3e53be1", - "reference": "c2c8ceb1aa9dab9eae54e9150e6a588ce3e53be1", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/3a4435e79a8401746e8525e98039199d0924b4e5", + "reference": "3a4435e79a8401746e8525e98039199d0924b4e5", "shasum": "" }, "require": { @@ -3145,11 +3199,11 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2017-04-12T14:14:56+00:00" + "time": "2017-06-24T09:29:48+00:00" }, { "name": "symfony/css-selector", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", @@ -3202,7 +3256,7 @@ }, { "name": "symfony/dom-crawler", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", @@ -3258,7 +3312,7 @@ }, { "name": "symfony/finder", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -3307,16 +3361,16 @@ }, { "name": "symfony/process", - "version": "v3.3.2", + "version": "v3.3.4", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "8e30690c67aafb6c7992d6d8eb0d707807dd3eaf" + "reference": "5ab8949b682b1bf9d4511a228b5e045c96758c30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/8e30690c67aafb6c7992d6d8eb0d707807dd3eaf", - "reference": "8e30690c67aafb6c7992d6d8eb0d707807dd3eaf", + "url": "https://api.github.com/repos/symfony/process/zipball/5ab8949b682b1bf9d4511a228b5e045c96758c30", + "reference": "5ab8949b682b1bf9d4511a228b5e045c96758c30", "shasum": "" }, "require": { @@ -3352,7 +3406,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-05-22T12:32:03+00:00" + "time": "2017-07-03T08:12:02+00:00" }, { "name": "webmozart/assert", diff --git a/system/src/Grav/Framework/Object/Object.php b/system/src/Grav/Framework/Object/Object.php index e09cdf32a..fe4f77060 100644 --- a/system/src/Grav/Framework/Object/Object.php +++ b/system/src/Grav/Framework/Object/Object.php @@ -50,6 +50,11 @@ class Object implements ObjectInterface } } + public function getKey() + { + return $this->key; + } + /** * Checks whether or not an offset exists with a possibility to load the field by $this->offsetLoad_{$offset}(). * From 6fadaa078944cd34ef1258bc47e26d5c16dd0f04 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 19 Jul 2017 14:28:57 -0600 Subject: [PATCH 019/141] Added nicenumber twig filter --- CHANGELOG.md | 1 + system/src/Grav/Common/Twig/TwigExtension.php | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f48af8866..c89c769ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * Added `Grav\Framework\Object` classes for creating collections of objects * Added `Grav\Framework\Page` interfaces * Deprecated GravTrait + * Added `|nicenumber` Twig filter 1. [](#improved) * Make it possible to include debug bar also into non-HTML responses diff --git a/system/src/Grav/Common/Twig/TwigExtension.php b/system/src/Grav/Common/Twig/TwigExtension.php index 908b5fdac..a00329cd8 100644 --- a/system/src/Grav/Common/Twig/TwigExtension.php +++ b/system/src/Grav/Common/Twig/TwigExtension.php @@ -66,6 +66,7 @@ class TwigExtension extends \Twig_Extension new \Twig_SimpleFilter('*ize', [$this, 'inflectorFilter']), new \Twig_SimpleFilter('absolute_url', [$this, 'absoluteUrlFilter']), new \Twig_SimpleFilter('contains', [$this, 'containsFilter']), + new \Twig_SimpleFilter('nicenumber', [$this, 'niceNumberFunc']), new \Twig_SimpleFilter('defined', [$this, 'definedDefaultFilter']), new \Twig_SimpleFilter('ends_with', [$this, 'endsWithFilter']), new \Twig_SimpleFilter('fieldName', [$this, 'fieldNameFilter']), @@ -1048,4 +1049,28 @@ class TwigExtension extends \Twig_Extension { return pathinfo($var); } + + /** + * Returns a nicer more readable number + * + * @param $number + * @return bool|string + */ + public function niceNumberFunc($n) + { + + // first strip any formatting; + $n = (0+str_replace(",", "", $n)); + + // is this a number? + if (!is_numeric($n)) return false; + + // now filter it; + if ($n > 1000000000000) return round(($n/1000000000000), 2).' t'; + elseif ($n > 1000000000) return round(($n/1000000000), 2).' b'; + elseif ($n > 1000000) return round(($n/1000000), 2).' m'; + elseif ($n > 1000) return round(($n/1000), 2).' k'; + + return number_format($n); + } } From 9685ab4a1899fbeb7fa60d965e2483c6ecd49a47 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Tue, 8 Aug 2017 14:31:53 +0300 Subject: [PATCH 020/141] Added `$grav->login()` and `$grav->logout()` functions with event hooks for plugins Added events `onUserLoginAuthenticate`, `onUserLoginAuthorize`, `onUserLoginFailure`, `onUserLogin`, `onUserLogout` --- CHANGELOG.md | 4 +- system/src/Grav/Common/Grav.php | 25 ++++++ .../src/Grav/Common/User/Authentication.php | 58 ++++++++++++++ .../Common/User/Events/UserLoginEvent.php | 77 +++++++++++++++++++ system/src/Grav/Common/User/Group.php | 62 +++++++-------- system/src/Grav/Common/User/User.php | 43 ++++++----- 6 files changed, 218 insertions(+), 51 deletions(-) create mode 100644 system/src/Grav/Common/User/Events/UserLoginEvent.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f5bad32b..45e20fe1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,10 @@ * Added `Grav\Framework\ContentBlock` classes for nested HTML blocks with CSS/JS assets * Added `Grav\Framework\Object` classes for creating collections of objects * Added `Grav\Framework\Page` interfaces - * Deprecated GravTrait + * Added `$grav->login()` and `$grav->logout()` functions with event hooks for plugins + * Added events `onUserLoginAuthenticate`, `onUserLoginAuthorize`, `onUserLoginFailure`, `onUserLogin`, `onUserLogout` * Added `|nicenumber` Twig filter + * Deprecated GravTrait 1. [](#improved) * Make it possible to include debug bar also into non-HTML responses diff --git a/system/src/Grav/Common/Grav.php b/system/src/Grav/Common/Grav.php index c5adcb5d0..d2a34ac92 100644 --- a/system/src/Grav/Common/Grav.php +++ b/system/src/Grav/Common/Grav.php @@ -13,8 +13,10 @@ use Grav\Common\Language\Language; use Grav\Common\Page\Medium\ImageMedium; use Grav\Common\Page\Medium\Medium; use Grav\Common\Page\Page; +use Grav\Common\User\Authentication; use RocketTheme\Toolbox\DI\Container; use RocketTheme\Toolbox\Event\Event; +use RocketTheme\Toolbox\Event\EventDispatcher; class Grav extends Container { @@ -215,6 +217,29 @@ class Grav extends Container } } + public function login(array $credentials, array $options) + { + if (isset($this['user'])) { + return false; + } + + $user = Authentication::login($credentials, $options); + if ($user) { + $this['user'] = $user; + } + + return $user !== null; + } + + public function logout() + { + if (isset($this['user'])) { + Authentication::logout($this['user']); + + unset($this['user']); + } + } + /** * Set response header. */ diff --git a/system/src/Grav/Common/User/Authentication.php b/system/src/Grav/Common/User/Authentication.php index a3e12ff7e..ba0d78eda 100644 --- a/system/src/Grav/Common/User/Authentication.php +++ b/system/src/Grav/Common/User/Authentication.php @@ -8,8 +8,66 @@ namespace Grav\Common\User; +use Grav\Common\Grav; +use Grav\Common\User\Events\UserLoginEvent; +use RocketTheme\Toolbox\Event\Event; + abstract class Authentication { + /** + * @param array $credentials + * @param array $options + * @return User|null + */ + public static function login(array $credentials, array $options) + { + $grav = Grav::instance(); + + $eventOptions = [ + 'credentials' => $credentials, + 'options' => $options + ]; + + $event = new UserLoginEvent($eventOptions); + + // Attempt to authenticate the user. + $grav->fireEvent('onUserLoginAuthenticate', $event); + + $event->removeCredentials(); + + // Allow plugins to prevent login after successful authentication. + if ($event['status'] === UserLoginEvent::AUTHENTICATION_SUCCESS) { + $grav->fireEvent('onUserLoginAuthorize', $event); + } + + // Allow plugins to log errors or do other tasks on failure. + if ($event['status'] !== UserLoginEvent::AUTHENTICATION_SUCCESS) { + $grav->fireEvent('onUserLoginFailure', $event); + + return null; + } + + if (empty($event['user']->authenticated)) { + throw new \RuntimeException('Login: User object has not been authenticated!'); + } + + // User has been logged in, let plugins know. + $grav->fireEvent('onUserLogin', $event); + + return $event['user']; + } + + public static function logout($user) + { + $grav = Grav::instance(); + + $event = new Event; + $event->user = $user; + + // Logout the user. + $grav->fireEvent('onUserLogout', $event); + } + /** * Create password hash from plaintext password. * diff --git a/system/src/Grav/Common/User/Events/UserLoginEvent.php b/system/src/Grav/Common/User/Events/UserLoginEvent.php new file mode 100644 index 000000000..add97aa65 --- /dev/null +++ b/system/src/Grav/Common/User/Events/UserLoginEvent.php @@ -0,0 +1,77 @@ + ['username' => '', 'password' => ''], + 'options' => ['remember_me' => false], + 'status' => static::AUTHENTICATION_UNDEFINED, + 'user' => null, + 'message' => '' + ]; + + parent::__construct(array_merge_recursive($defaults, $items)); + + $username = $this['credentials']['username']; + $this['user'] = $username ? User::load($username, false) : new User; + } + + public function removeCredentials() + { + unset($this['credentials']); + } +} diff --git a/system/src/Grav/Common/User/Group.php b/system/src/Grav/Common/User/Group.php index f8bf2aca9..597cb9a6a 100644 --- a/system/src/Grav/Common/User/Group.php +++ b/system/src/Grav/Common/User/Group.php @@ -8,6 +8,7 @@ namespace Grav\Common\User; +use Grav\Common\Config\Config; use Grav\Common\Data\Blueprints; use Grav\Common\Data\Data; use Grav\Common\File\CompiledYamlFile; @@ -23,9 +24,7 @@ class Group extends Data */ private static function groups() { - $groups = Grav::instance()['config']->get('groups'); - - return $groups; + return Grav::instance()['config']->get('groups', []); } /** @@ -37,7 +36,7 @@ class Group extends Data { $groups = []; - foreach(Grav::instance()['config']->get('groups', []) as $groupname => $group) { + foreach(static::groups() as $groupname => $group) { $groups[$groupname] = isset($group['readableName']) ? $group['readableName'] : $groupname; } @@ -65,20 +64,15 @@ class Group extends Data */ public static function load($groupname) { - if (self::groupExists($groupname)) { - $content = self::groups()[$groupname]; - } else { - $content = []; - } + $groups = self::groups(); + + $content = isset($groups[$groupname]) ? $groups[$groupname] : []; + $content += ['groupname' => $groupname]; $blueprints = new Blueprints; $blueprint = $blueprints->get('user/group'); - if (!isset($content['groupname'])) { - $content['groupname'] = $groupname; - } - $group = new Group($content, $blueprint); - return $group; + return new Group($content, $blueprint); } /** @@ -87,29 +81,30 @@ class Group extends Data public function save() { $grav = Grav::instance(); + + /** @var Config $config */ $config = $grav['config']; $blueprints = new Blueprints; $blueprint = $blueprints->get('user/group'); + $config->set("groups.{$this->groupname}", []); + $fields = $blueprint->fields(); - - $config->set("groups.$this->groupname", []); - foreach ($fields as $field) { - if ($field['type'] == 'text') { + if ($field['type'] === 'text') { $value = $field['name']; if (isset($this->items['data'][$value])) { - $config->set("groups.$this->groupname.$value", $this->items['data'][$value]); + $config->set("groups.{$this->groupname}.{$value}", $this->items['data'][$value]); } } - if ($field['type'] == 'array' || $field['type'] == 'permissions') { + if ($field['type'] === 'array' || $field['type'] === 'permissions') { $value = $field['name']; $arrayValues = Utils::getDotNotation($this->items['data'], $field['name']); if ($arrayValues) { foreach ($arrayValues as $arrayIndex => $arrayValue) { - $config->set("groups.$this->groupname.$value.$arrayIndex", $arrayValue); + $config->set("groups.{$this->groupname}.{$value}.{$arrayIndex}", $arrayValue); } } } @@ -117,9 +112,11 @@ class Group extends Data $type = 'groups'; $blueprints = $this->blueprints("config/{$type}"); + + $filename = CompiledYamlFile::instance($grav['locator']->findResource("config://{$type}.yaml")); + $obj = new Data($config->get($type), $blueprints); - $file = CompiledYamlFile::instance($grav['locator']->findResource("config://{$type}.yaml")); - $obj->file($file); + $obj->file($filename); $obj->save(); } @@ -133,18 +130,23 @@ class Group extends Data public static function remove($groupname) { $grav = Grav::instance(); + + /** @var Config $config */ $config = $grav['config']; + $blueprints = new Blueprints; $blueprint = $blueprints->get('user/group'); - $groups = $config->get("groups"); - unset($groups[$groupname]); - $config->set("groups", $groups); - $type = 'groups'; - $obj = new Data($config->get($type), $blueprint); - $file = CompiledYamlFile::instance($grav['locator']->findResource("config://{$type}.yaml")); - $obj->file($file); + + $groups = $config->get($type); + unset($groups[$groupname]); + $config->set($type, $groups); + + $filename = CompiledYamlFile::instance($grav['locator']->findResource("config://{$type}.yaml")); + + $obj = new Data($groups, $blueprint); + $obj->file($filename); $obj->save(); return true; diff --git a/system/src/Grav/Common/User/User.php b/system/src/Grav/Common/User/User.php index 7768d888b..d7f42112e 100644 --- a/system/src/Grav/Common/User/User.php +++ b/system/src/Grav/Common/User/User.php @@ -8,11 +8,13 @@ namespace Grav\Common\User; +use Grav\Common\Config\Config; use Grav\Common\Data\Blueprints; use Grav\Common\Data\Data; use Grav\Common\File\CompiledYamlFile; use Grav\Common\Grav; use Grav\Common\Utils; +use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator; class User extends Data { @@ -22,13 +24,16 @@ class User extends Data * Always creates user object. To check if user exists, use $this->exists(). * * @param string $username + * @param bool $setConfig * * @return User */ - public static function load($username) + public static function load($username, $setConfig = true) { $grav = Grav::instance(); + /** @var UniformResourceLocator $locator */ $locator = $grav['locator']; + /** @var Config $config */ $config = $grav['config']; // force lowercase of username @@ -36,20 +41,18 @@ class User extends Data $blueprints = new Blueprints; $blueprint = $blueprints->get('user/account'); + $file_path = $locator->findResource('account://' . $username . YAML_EXT); $file = CompiledYamlFile::instance($file_path); - $content = $file->content(); - if (!isset($content['username'])) { - $content['username'] = $username; - } - if (!isset($content['state'])) { - $content['state'] = 'enabled'; - } + $content = (array)$file->content() + ['username' => $username, 'state' => 'enabled']; + $user = new User($content, $blueprint); $user->file($file); - // add user to config - $config->set("user", $user); + if ($setConfig) { + // add user to config + $config->set('user', $user); + } return $user; } @@ -80,7 +83,7 @@ class User extends Data if (Utils::endsWith($file, YAML_EXT)) { $find_user = User::load(trim(pathinfo($file, PATHINFO_FILENAME))); foreach ($fields as $field) { - if ($find_user[$field] == $query) { + if ($find_user[$field] === $query) { return $find_user; } } @@ -132,20 +135,20 @@ class User extends Data ); return false; - } else { - // Plain-text does match, we can update the hash and proceed - $save = true; - - $this->hashed_password = Authentication::create($this->password); - unset($this->password); } + // Plain-text does match, we can update the hash and proceed + $save = true; + + $this->hashed_password = Authentication::create($this->password); + unset($this->password); + } $result = Authentication::verify($password, $this->hashed_password); // Password needs to be updated, save the file. - if ($result == 2) { + if ($result === 2) { $save = true; $this->hashed_password = Authentication::create($password); } @@ -251,8 +254,8 @@ class User extends Data $avatar = $this->avatar; $avatar = array_shift($avatar); return Grav::instance()['base_url'] . '/' . $avatar['path']; - } else { - return 'https://www.gravatar.com/avatar/' . md5($this->email); } + + return 'https://www.gravatar.com/avatar/' . md5($this->email); } } From 6e511d0b2040e2f6155a0d3911a5c7e6dfdf8600 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Tue, 8 Aug 2017 17:50:26 +0300 Subject: [PATCH 021/141] Improve login/logout logic --- system/src/Grav/Common/Grav.php | 30 +++++++--- .../src/Grav/Common/User/Authentication.php | 59 ++++++++++++------- .../Common/User/Events/UserLoginEvent.php | 17 +++--- 3 files changed, 68 insertions(+), 38 deletions(-) diff --git a/system/src/Grav/Common/Grav.php b/system/src/Grav/Common/Grav.php index d2a34ac92..b60a44448 100644 --- a/system/src/Grav/Common/Grav.php +++ b/system/src/Grav/Common/Grav.php @@ -14,6 +14,7 @@ use Grav\Common\Page\Medium\ImageMedium; use Grav\Common\Page\Medium\Medium; use Grav\Common\Page\Page; use Grav\Common\User\Authentication; +use Grav\Common\User\User; use RocketTheme\Toolbox\DI\Container; use RocketTheme\Toolbox\Event\Event; use RocketTheme\Toolbox\Event\EventDispatcher; @@ -217,26 +218,41 @@ class Grav extends Container } } - public function login(array $credentials, array $options) + /** + * Login user. + * + * @param array $credentials + * @param array $options + * @return User + */ + public function login(array $credentials, array $options = []) { - if (isset($this['user'])) { - return false; + if (isset($this['user']) && $this['user']->authenticated) { + return null; } + unset($this['user']); + $user = Authentication::login($credentials, $options); if ($user) { $this['user'] = $user; } - return $user !== null; + return $user; } - public function logout() + /** + * Logout user. + * + * @param array $options + */ + public function logout(array $options = []) { if (isset($this['user'])) { - Authentication::logout($this['user']); + $user = Authentication::logout($this['user'], $options); unset($this['user']); + $this['user'] = $user; } } @@ -451,7 +467,7 @@ class Grav extends Container */ public function fallbackUrl($path) { - $this->fireEvent('onPageFallBackUrl'); + $this->fireEvent('onPageFallBackUrl'); /** @var Uri $uri */ $uri = $this['uri']; diff --git a/system/src/Grav/Common/User/Authentication.php b/system/src/Grav/Common/User/Authentication.php index ba0d78eda..9de431657 100644 --- a/system/src/Grav/Common/User/Authentication.php +++ b/system/src/Grav/Common/User/Authentication.php @@ -10,16 +10,17 @@ namespace Grav\Common\User; use Grav\Common\Grav; use Grav\Common\User\Events\UserLoginEvent; -use RocketTheme\Toolbox\Event\Event; abstract class Authentication { /** + * Login user. + * * @param array $credentials * @param array $options - * @return User|null + * @return User */ - public static function login(array $credentials, array $options) + public static function login(array $credentials, array $options = []) { $grav = Grav::instance(); @@ -28,44 +29,58 @@ abstract class Authentication 'options' => $options ]; - $event = new UserLoginEvent($eventOptions); - // Attempt to authenticate the user. + $event = new UserLoginEvent($eventOptions); $grav->fireEvent('onUserLoginAuthenticate', $event); - $event->removeCredentials(); - // Allow plugins to prevent login after successful authentication. - if ($event['status'] === UserLoginEvent::AUTHENTICATION_SUCCESS) { + if ($event->status === UserLoginEvent::AUTHENTICATION_SUCCESS) { + $event = new UserLoginEvent($event->toArray()); $grav->fireEvent('onUserLoginAuthorize', $event); } - // Allow plugins to log errors or do other tasks on failure. - if ($event['status'] !== UserLoginEvent::AUTHENTICATION_SUCCESS) { + if ($event->status !== UserLoginEvent::AUTHENTICATION_SUCCESS) { + // Allow plugins to log errors or do other tasks on failure. + $event = new UserLoginEvent($event->toArray()); $grav->fireEvent('onUserLoginFailure', $event); - return null; + $event->user->authenticated = false; + + } else { + // User has been logged in, let plugins know. + $event = new UserLoginEvent($event->toArray()); + $grav->fireEvent('onUserLogin', $event); + + $event->user->authenticated = true; } - if (empty($event['user']->authenticated)) { - throw new \RuntimeException('Login: User object has not been authenticated!'); - } - - // User has been logged in, let plugins know. - $grav->fireEvent('onUserLogin', $event); - - return $event['user']; + return $event->user; } - public static function logout($user) + /** + * Logout user. + * + * @param User $user + * @param array $options + * @return User + */ + public static function logout(User $user, array $options = []) { $grav = Grav::instance(); - $event = new Event; - $event->user = $user; + $eventOptions = [ + 'user' => $user, + 'options' => $options + ]; + + $event = new UserLoginEvent($eventOptions); // Logout the user. $grav->fireEvent('onUserLogout', $event); + + $event->user->authenticated = false; + + return $event->user; } /** diff --git a/system/src/Grav/Common/User/Events/UserLoginEvent.php b/system/src/Grav/Common/User/Events/UserLoginEvent.php index add97aa65..d472470bc 100644 --- a/system/src/Grav/Common/User/Events/UserLoginEvent.php +++ b/system/src/Grav/Common/User/Events/UserLoginEvent.php @@ -17,6 +17,7 @@ use RocketTheme\Toolbox\Event\Event; * * @property int $status * @property array $credentials + * @property string $authorize * @property array $options * @property User $user * @property string $message @@ -58,20 +59,18 @@ class UserLoginEvent extends Event { $defaults = [ 'credentials' => ['username' => '', 'password' => ''], - 'options' => ['remember_me' => false], + 'options' => [], + 'authorize' => 'site.login', 'status' => static::AUTHENTICATION_UNDEFINED, 'user' => null, 'message' => '' ]; - parent::__construct(array_merge_recursive($defaults, $items)); + parent::__construct(array_replace_recursive($defaults, $items)); - $username = $this['credentials']['username']; - $this['user'] = $username ? User::load($username, false) : new User; - } - - public function removeCredentials() - { - unset($this['credentials']); + if (!isset($this->user)) { + $username = $this->credentials['username']; + $this->user = $username ? User::load($username, false) : new User; + } } } From dbebd143919563c89e3983a8fbf121b0724f1ce0 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Thu, 10 Aug 2017 11:40:42 +0300 Subject: [PATCH 022/141] Because of B/C issues, login/logout code needed to be moved into the Login plugin --- CHANGELOG.md | 2 - system/src/Grav/Common/Grav.php | 40 ---------- .../src/Grav/Common/User/Authentication.php | 73 ------------------ .../Common/User/Events/UserLoginEvent.php | 76 ------------------- 4 files changed, 191 deletions(-) delete mode 100644 system/src/Grav/Common/User/Events/UserLoginEvent.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 45e20fe1f..007d6b03f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,6 @@ * Added `Grav\Framework\ContentBlock` classes for nested HTML blocks with CSS/JS assets * Added `Grav\Framework\Object` classes for creating collections of objects * Added `Grav\Framework\Page` interfaces - * Added `$grav->login()` and `$grav->logout()` functions with event hooks for plugins - * Added events `onUserLoginAuthenticate`, `onUserLoginAuthorize`, `onUserLoginFailure`, `onUserLogin`, `onUserLogout` * Added `|nicenumber` Twig filter * Deprecated GravTrait 1. [](#improved) diff --git a/system/src/Grav/Common/Grav.php b/system/src/Grav/Common/Grav.php index b60a44448..6b0a7690d 100644 --- a/system/src/Grav/Common/Grav.php +++ b/system/src/Grav/Common/Grav.php @@ -13,8 +13,6 @@ use Grav\Common\Language\Language; use Grav\Common\Page\Medium\ImageMedium; use Grav\Common\Page\Medium\Medium; use Grav\Common\Page\Page; -use Grav\Common\User\Authentication; -use Grav\Common\User\User; use RocketTheme\Toolbox\DI\Container; use RocketTheme\Toolbox\Event\Event; use RocketTheme\Toolbox\Event\EventDispatcher; @@ -218,44 +216,6 @@ class Grav extends Container } } - /** - * Login user. - * - * @param array $credentials - * @param array $options - * @return User - */ - public function login(array $credentials, array $options = []) - { - if (isset($this['user']) && $this['user']->authenticated) { - return null; - } - - unset($this['user']); - - $user = Authentication::login($credentials, $options); - if ($user) { - $this['user'] = $user; - } - - return $user; - } - - /** - * Logout user. - * - * @param array $options - */ - public function logout(array $options = []) - { - if (isset($this['user'])) { - $user = Authentication::logout($this['user'], $options); - - unset($this['user']); - $this['user'] = $user; - } - } - /** * Set response header. */ diff --git a/system/src/Grav/Common/User/Authentication.php b/system/src/Grav/Common/User/Authentication.php index 9de431657..a3e12ff7e 100644 --- a/system/src/Grav/Common/User/Authentication.php +++ b/system/src/Grav/Common/User/Authentication.php @@ -8,81 +8,8 @@ namespace Grav\Common\User; -use Grav\Common\Grav; -use Grav\Common\User\Events\UserLoginEvent; - abstract class Authentication { - /** - * Login user. - * - * @param array $credentials - * @param array $options - * @return User - */ - public static function login(array $credentials, array $options = []) - { - $grav = Grav::instance(); - - $eventOptions = [ - 'credentials' => $credentials, - 'options' => $options - ]; - - // Attempt to authenticate the user. - $event = new UserLoginEvent($eventOptions); - $grav->fireEvent('onUserLoginAuthenticate', $event); - - // Allow plugins to prevent login after successful authentication. - if ($event->status === UserLoginEvent::AUTHENTICATION_SUCCESS) { - $event = new UserLoginEvent($event->toArray()); - $grav->fireEvent('onUserLoginAuthorize', $event); - } - - if ($event->status !== UserLoginEvent::AUTHENTICATION_SUCCESS) { - // Allow plugins to log errors or do other tasks on failure. - $event = new UserLoginEvent($event->toArray()); - $grav->fireEvent('onUserLoginFailure', $event); - - $event->user->authenticated = false; - - } else { - // User has been logged in, let plugins know. - $event = new UserLoginEvent($event->toArray()); - $grav->fireEvent('onUserLogin', $event); - - $event->user->authenticated = true; - } - - return $event->user; - } - - /** - * Logout user. - * - * @param User $user - * @param array $options - * @return User - */ - public static function logout(User $user, array $options = []) - { - $grav = Grav::instance(); - - $eventOptions = [ - 'user' => $user, - 'options' => $options - ]; - - $event = new UserLoginEvent($eventOptions); - - // Logout the user. - $grav->fireEvent('onUserLogout', $event); - - $event->user->authenticated = false; - - return $event->user; - } - /** * Create password hash from plaintext password. * diff --git a/system/src/Grav/Common/User/Events/UserLoginEvent.php b/system/src/Grav/Common/User/Events/UserLoginEvent.php deleted file mode 100644 index d472470bc..000000000 --- a/system/src/Grav/Common/User/Events/UserLoginEvent.php +++ /dev/null @@ -1,76 +0,0 @@ - ['username' => '', 'password' => ''], - 'options' => [], - 'authorize' => 'site.login', - 'status' => static::AUTHENTICATION_UNDEFINED, - 'user' => null, - 'message' => '' - ]; - - parent::__construct(array_replace_recursive($defaults, $items)); - - if (!isset($this->user)) { - $username = $this->credentials['username']; - $this->user = $username ? User::load($username, false) : new User; - } - } -} From 53611c862700cbbeaaf8e2c85f0366329f44d5bb Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Thu, 10 Aug 2017 21:08:42 +0300 Subject: [PATCH 023/141] Composer: Use develop version of rockettheme/toolbox --- composer.json | 2 +- composer.lock | 152 ++++++++++++++++++++++++++------------------------ 2 files changed, 80 insertions(+), 74 deletions(-) diff --git a/composer.json b/composer.json index f369b04e3..e60e6770f 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "gregwar/image": "~2.0", "donatj/phpuseragentparser": "~0.3", "pimple/pimple": "~3.0", - "rockettheme/toolbox": "~1.0", + "rockettheme/toolbox": "dev-develop", "maximebf/debugbar": "~1.10", "ext-mbstring": "*", "ext-openssl": "*", diff --git a/composer.lock b/composer.lock index 78d5ee99d..bf635dc8f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "b418b22b918df3b62e5e372de49f13c4", + "content-hash": "c10d9db1071970e7b04672767874703f", "packages": [ { "name": "antoligy/dom-string-iterators", @@ -52,33 +52,37 @@ }, { "name": "doctrine/cache", - "version": "v1.6.1", + "version": "v1.7.0", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "b6f544a20f4807e81f7044d31e679ccbb1866dc3" + "reference": "53d9518ffeb019c51d542ff60cb578f076d3ff16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/b6f544a20f4807e81f7044d31e679ccbb1866dc3", - "reference": "b6f544a20f4807e81f7044d31e679ccbb1866dc3", + "url": "https://api.github.com/repos/doctrine/cache/zipball/53d9518ffeb019c51d542ff60cb578f076d3ff16", + "reference": "53d9518ffeb019c51d542ff60cb578f076d3ff16", "shasum": "" }, "require": { - "php": "~5.5|~7.0" + "php": "~7.1" }, "conflict": { "doctrine/common": ">2.2,<2.4" }, "require-dev": { - "phpunit/phpunit": "~4.8|~5.0", - "predis/predis": "~1.0", - "satooshi/php-coveralls": "~0.6" + "alcaeus/mongo-php-adapter": "^1.1", + "mongodb/mongodb": "^1.1", + "phpunit/phpunit": "^5.7", + "predis/predis": "~1.0" + }, + "suggest": { + "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.7.x-dev" } }, "autoload": { @@ -118,7 +122,7 @@ "cache", "caching" ], - "time": "2016-10-29T11:16:17+00:00" + "time": "2017-07-22T13:00:15+00:00" }, { "name": "doctrine/collections", @@ -325,16 +329,16 @@ }, { "name": "filp/whoops", - "version": "2.1.9", + "version": "2.1.10", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "b238974e1c7cc1859b0c16ddc1c02ecb70ecc07f" + "reference": "ffbbd2c06c64b08fb47974eed5dbce4ca2bb0eec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/b238974e1c7cc1859b0c16ddc1c02ecb70ecc07f", - "reference": "b238974e1c7cc1859b0c16ddc1c02ecb70ecc07f", + "url": "https://api.github.com/repos/filp/whoops/zipball/ffbbd2c06c64b08fb47974eed5dbce4ca2bb0eec", + "reference": "ffbbd2c06c64b08fb47974eed5dbce4ca2bb0eec", "shasum": "" }, "require": { @@ -382,7 +386,7 @@ "whoops", "zf2" ], - "time": "2017-06-03T18:33:07+00:00" + "time": "2017-08-03T18:23:40+00:00" }, { "name": "gregwar/cache", @@ -835,16 +839,16 @@ }, { "name": "pimple/pimple", - "version": "v3.1.0", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/silexphp/Pimple.git", - "reference": "279b56046fb368deacf77e2f8f3bdcea45cc367a" + "reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/279b56046fb368deacf77e2f8f3bdcea45cc367a", - "reference": "279b56046fb368deacf77e2f8f3bdcea45cc367a", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/4d45fb62d96418396ec58ba76e6f065bca16e10a", + "reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a", "shasum": "" }, "require": { @@ -857,7 +861,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "3.2.x-dev" } }, "autoload": { @@ -881,7 +885,7 @@ "container", "dependency injection" ], - "time": "2017-07-03T14:06:46+00:00" + "time": "2017-07-23T07:32:15+00:00" }, { "name": "psr/container", @@ -1029,16 +1033,16 @@ }, { "name": "rockettheme/toolbox", - "version": "1.3.5", + "version": "dev-develop", "source": { "type": "git", "url": "https://github.com/rockettheme/toolbox.git", - "reference": "1be0986127007c9691345729607f94ba0e8a5120" + "reference": "017b4c5e255edcae8e110d096fa7362a37885c9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rockettheme/toolbox/zipball/1be0986127007c9691345729607f94ba0e8a5120", - "reference": "1be0986127007c9691345729607f94ba0e8a5120", + "url": "https://api.github.com/repos/rockettheme/toolbox/zipball/017b4c5e255edcae8e110d096fa7362a37885c9c", + "reference": "017b4c5e255edcae8e110d096fa7362a37885c9c", "shasum": "" }, "require": { @@ -1073,7 +1077,7 @@ "php", "rockettheme" ], - "time": "2017-05-22T13:09:53+00:00" + "time": "2017-08-10 17:57:13" }, { "name": "seld/cli-prompt", @@ -1125,16 +1129,16 @@ }, { "name": "symfony/console", - "version": "v2.8.24", + "version": "v2.8.26", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "46e65f8d98c9ab629bbfcc16a4ff023f61c37fb2" + "reference": "32a3c6b3398de5db8ed381f4ef92970c59c2fcdd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/46e65f8d98c9ab629bbfcc16a4ff023f61c37fb2", - "reference": "46e65f8d98c9ab629bbfcc16a4ff023f61c37fb2", + "url": "https://api.github.com/repos/symfony/console/zipball/32a3c6b3398de5db8ed381f4ef92970c59c2fcdd", + "reference": "32a3c6b3398de5db8ed381f4ef92970c59c2fcdd", "shasum": "" }, "require": { @@ -1182,7 +1186,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-07-03T08:04:30+00:00" + "time": "2017-07-29T21:26:04+00:00" }, { "name": "symfony/debug", @@ -1243,7 +1247,7 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.8.24", + "version": "v2.8.26", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -1421,16 +1425,16 @@ }, { "name": "symfony/var-dumper", - "version": "v2.8.24", + "version": "v2.8.26", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "5fe3ba6d3817ae378d141962616e048ac85ba21d" + "reference": "e9337f23b1c080df301d25b8891ecf1607b0b72f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/5fe3ba6d3817ae378d141962616e048ac85ba21d", - "reference": "5fe3ba6d3817ae378d141962616e048ac85ba21d", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/e9337f23b1c080df301d25b8891ecf1607b0b72f", + "reference": "e9337f23b1c080df301d25b8891ecf1607b0b72f", "shasum": "" }, "require": { @@ -1485,11 +1489,11 @@ "debug", "dump" ], - "time": "2017-06-20T23:27:56+00:00" + "time": "2017-07-26T06:29:15+00:00" }, { "name": "symfony/yaml", - "version": "v2.8.24", + "version": "v2.8.26", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", @@ -1759,32 +1763,32 @@ }, { "name": "doctrine/instantiator", - "version": "1.0.5", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", "shasum": "" }, "require": { - "php": ">=5.3,<8.0-DEV" + "php": "^7.1" }, "require-dev": { "athletic/athletic": "~0.1.8", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -1809,7 +1813,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14T21:17:01+00:00" + "time": "2017-07-22T11:58:36+00:00" }, { "name": "facebook/webdriver", @@ -2148,22 +2152,22 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "3.2.0", + "version": "3.2.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "46f7e8bb075036c92695b15a1ddb6971c751e585" + "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/46f7e8bb075036c92695b15a1ddb6971c751e585", - "reference": "46f7e8bb075036c92695b15a1ddb6971c751e585", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/4aada1f93c72c35e22fb1383b47fee43b8f1d157", + "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157", "shasum": "" }, "require": { "php": ">=5.5", "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.4.0", + "phpdocumentor/type-resolver": "^0.3.0", "webmozart/assert": "^1.0" }, "require-dev": { @@ -2189,20 +2193,20 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-07-15T11:38:20+00:00" + "time": "2017-08-08T06:39:58+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.4.0", + "version": "0.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fb3933512008d8162b3cdf9e18dba9309b7c3773", + "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773", "shasum": "" }, "require": { @@ -2236,7 +2240,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2017-07-14T14:27:02+00:00" + "time": "2017-06-03T08:32:36+00:00" }, { "name": "phpspec/prophecy", @@ -3146,16 +3150,16 @@ }, { "name": "symfony/browser-kit", - "version": "v3.3.4", + "version": "v3.3.6", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "3a4435e79a8401746e8525e98039199d0924b4e5" + "reference": "8079a6b3668ef15cdbf73a4c7d31081abb8bb5f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/3a4435e79a8401746e8525e98039199d0924b4e5", - "reference": "3a4435e79a8401746e8525e98039199d0924b4e5", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/8079a6b3668ef15cdbf73a4c7d31081abb8bb5f0", + "reference": "8079a6b3668ef15cdbf73a4c7d31081abb8bb5f0", "shasum": "" }, "require": { @@ -3199,11 +3203,11 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2017-06-24T09:29:48+00:00" + "time": "2017-07-12T13:03:20+00:00" }, { "name": "symfony/css-selector", - "version": "v3.3.4", + "version": "v3.3.6", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", @@ -3256,7 +3260,7 @@ }, { "name": "symfony/dom-crawler", - "version": "v3.3.4", + "version": "v3.3.6", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", @@ -3312,7 +3316,7 @@ }, { "name": "symfony/finder", - "version": "v3.3.4", + "version": "v3.3.6", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -3361,16 +3365,16 @@ }, { "name": "symfony/process", - "version": "v3.3.4", + "version": "v3.3.6", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "5ab8949b682b1bf9d4511a228b5e045c96758c30" + "reference": "07432804942b9f6dd7b7377faf9920af5f95d70a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/5ab8949b682b1bf9d4511a228b5e045c96758c30", - "reference": "5ab8949b682b1bf9d4511a228b5e045c96758c30", + "url": "https://api.github.com/repos/symfony/process/zipball/07432804942b9f6dd7b7377faf9920af5f95d70a", + "reference": "07432804942b9f6dd7b7377faf9920af5f95d70a", "shasum": "" }, "require": { @@ -3406,7 +3410,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-07-03T08:12:02+00:00" + "time": "2017-07-13T13:05:09+00:00" }, { "name": "webmozart/assert", @@ -3461,7 +3465,9 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "rockettheme/toolbox": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { From fb0e086f5720dd441c1705f7392ef077b6786dde Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Thu, 10 Aug 2017 21:13:14 +0300 Subject: [PATCH 024/141] Composer: Force doctrine/cache to use v1.6 (with PHP 5.5 support) --- composer.json | 2 +- composer.lock | 34 +++++++++++++++------------------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/composer.json b/composer.json index e60e6770f..a4f7a0f89 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "symfony/event-dispatcher": "~2.8", "symfony/var-dumper": "~2.8", "symfony/polyfill-iconv": "~1.0", - "doctrine/cache": "~1.5", + "doctrine/cache": "1.6", "doctrine/collections": "1.3", "psr/simple-cache": "^1.0", "filp/whoops": "~2.0", diff --git a/composer.lock b/composer.lock index bf635dc8f..8a19bae06 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "c10d9db1071970e7b04672767874703f", + "content-hash": "1397168ae7b9a8c2b2b59ed178f78605", "packages": [ { "name": "antoligy/dom-string-iterators", @@ -52,37 +52,33 @@ }, { "name": "doctrine/cache", - "version": "v1.7.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "53d9518ffeb019c51d542ff60cb578f076d3ff16" + "reference": "f8af318d14bdb0eff0336795b428b547bd39ccb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/53d9518ffeb019c51d542ff60cb578f076d3ff16", - "reference": "53d9518ffeb019c51d542ff60cb578f076d3ff16", + "url": "https://api.github.com/repos/doctrine/cache/zipball/f8af318d14bdb0eff0336795b428b547bd39ccb6", + "reference": "f8af318d14bdb0eff0336795b428b547bd39ccb6", "shasum": "" }, "require": { - "php": "~7.1" + "php": "~5.5|~7.0" }, "conflict": { "doctrine/common": ">2.2,<2.4" }, "require-dev": { - "alcaeus/mongo-php-adapter": "^1.1", - "mongodb/mongodb": "^1.1", - "phpunit/phpunit": "^5.7", - "predis/predis": "~1.0" - }, - "suggest": { - "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" + "phpunit/phpunit": "~4.8|~5.0", + "predis/predis": "~1.0", + "satooshi/php-coveralls": "~0.6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "1.6.x-dev" } }, "autoload": { @@ -122,7 +118,7 @@ "cache", "caching" ], - "time": "2017-07-22T13:00:15+00:00" + "time": "2015-12-31T16:37:02+00:00" }, { "name": "doctrine/collections", @@ -1037,12 +1033,12 @@ "source": { "type": "git", "url": "https://github.com/rockettheme/toolbox.git", - "reference": "017b4c5e255edcae8e110d096fa7362a37885c9c" + "reference": "76a6aacc0d343ccf090299d7a61d9f8f27d6b5ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rockettheme/toolbox/zipball/017b4c5e255edcae8e110d096fa7362a37885c9c", - "reference": "017b4c5e255edcae8e110d096fa7362a37885c9c", + "url": "https://api.github.com/repos/rockettheme/toolbox/zipball/76a6aacc0d343ccf090299d7a61d9f8f27d6b5ae", + "reference": "76a6aacc0d343ccf090299d7a61d9f8f27d6b5ae", "shasum": "" }, "require": { @@ -1077,7 +1073,7 @@ "php", "rockettheme" ], - "time": "2017-08-10 17:57:13" + "time": "2017-08-10 18:07:33" }, { "name": "seld/cli-prompt", From d15eb0e6ad3d72295d36bce57d95673aef6b5362 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Thu, 17 Aug 2017 10:01:42 +0300 Subject: [PATCH 025/141] Composer update --- composer.json | 2 +- composer.lock | 40 +++++++++++++++++++--------------------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/composer.json b/composer.json index a4f7a0f89..deb9d2990 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "gregwar/image": "~2.0", "donatj/phpuseragentparser": "~0.3", "pimple/pimple": "~3.0", - "rockettheme/toolbox": "dev-develop", + "rockettheme/toolbox": "~1.3", "maximebf/debugbar": "~1.10", "ext-mbstring": "*", "ext-openssl": "*", diff --git a/composer.lock b/composer.lock index 56fdb1f8d..a45592b7a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "1397168ae7b9a8c2b2b59ed178f78605", + "content-hash": "b8c9d8a8d904116ce81d1e48c18e68e0", "packages": [ { "name": "antoligy/dom-string-iterators", @@ -1029,16 +1029,16 @@ }, { "name": "rockettheme/toolbox", - "version": "dev-develop", + "version": "1.3.6", "source": { "type": "git", "url": "https://github.com/rockettheme/toolbox.git", - "reference": "76a6aacc0d343ccf090299d7a61d9f8f27d6b5ae" + "reference": "0905611d963485b2fda0a7be0cba6e56cc1c85a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rockettheme/toolbox/zipball/76a6aacc0d343ccf090299d7a61d9f8f27d6b5ae", - "reference": "76a6aacc0d343ccf090299d7a61d9f8f27d6b5ae", + "url": "https://api.github.com/repos/rockettheme/toolbox/zipball/0905611d963485b2fda0a7be0cba6e56cc1c85a2", + "reference": "0905611d963485b2fda0a7be0cba6e56cc1c85a2", "shasum": "" }, "require": { @@ -1073,7 +1073,7 @@ "php", "rockettheme" ], - "time": "2017-08-10 18:07:33" + "time": "2017-08-16T16:31:10+00:00" }, { "name": "seld/cli-prompt", @@ -1303,16 +1303,16 @@ }, { "name": "symfony/polyfill-iconv", - "version": "v1.4.0", + "version": "v1.5.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-iconv.git", - "reference": "ae1347fa81423b67dbc232c8c111facb367ff8b9" + "reference": "1ea0e08453819ecc7130e1fb0ee10862c2f33ed0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/ae1347fa81423b67dbc232c8c111facb367ff8b9", - "reference": "ae1347fa81423b67dbc232c8c111facb367ff8b9", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/1ea0e08453819ecc7130e1fb0ee10862c2f33ed0", + "reference": "1ea0e08453819ecc7130e1fb0ee10862c2f33ed0", "shasum": "" }, "require": { @@ -1324,7 +1324,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.5-dev" } }, "autoload": { @@ -1358,20 +1358,20 @@ "portable", "shim" ], - "time": "2017-06-09T08:25:21+00:00" + "time": "2017-06-14T15:44:48+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.4.0", + "version": "v1.5.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "f29dca382a6485c3cbe6379f0c61230167681937" + "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f29dca382a6485c3cbe6379f0c61230167681937", - "reference": "f29dca382a6485c3cbe6379f0c61230167681937", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7c8fae0ac1d216eb54349e6a8baa57d515fe8803", + "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803", "shasum": "" }, "require": { @@ -1383,7 +1383,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.5-dev" } }, "autoload": { @@ -1417,7 +1417,7 @@ "portable", "shim" ], - "time": "2017-06-09T14:24:12+00:00" + "time": "2017-06-14T15:44:48+00:00" }, { "name": "symfony/var-dumper", @@ -3463,9 +3463,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "rockettheme/toolbox": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { From 96ee41a3ddea70ea89c73b0034ec67858d4e97fd Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 18 Aug 2017 12:28:13 +0300 Subject: [PATCH 026/141] Follow PSR-2 in Grav\Framework --- .../Grav/Framework/Cache/AbstractCache.php | 2 - .../Framework/Cache/Adapter/ChainCache.php | 9 +++- .../src/Grav/Framework/Cache/CacheTrait.php | 45 ++++++++++++++--- .../Framework/Collection/ArrayCollection.php | 16 +++--- .../Framework/Collection/FileCollection.php | 5 +- .../Framework/ContentBlock/ContentBlock.php | 7 +-- .../ContentBlock/ContentBlockInterface.php | 2 +- .../Grav/Framework/ContentBlock/HtmlBlock.php | 21 ++++++-- system/src/Grav/Framework/Object/Object.php | 50 +++++-------------- .../Framework/Object/ObjectCollection.php | 19 ++++--- .../Object/ObjectCollectionInterface.php | 6 +++ .../Object/ObjectCollectionTrait.php | 3 +- .../src/Grav/Framework/Object/ObjectTrait.php | 4 +- .../Page/PageCollectionInterface.php | 3 +- .../Framework/Page/PageHeaderInterface.php | 5 +- .../Page/PageMediaCollectionInterface.php | 3 +- 16 files changed, 119 insertions(+), 81 deletions(-) diff --git a/system/src/Grav/Framework/Cache/AbstractCache.php b/system/src/Grav/Framework/Cache/AbstractCache.php index 1713b754c..90269213c 100644 --- a/system/src/Grav/Framework/Cache/AbstractCache.php +++ b/system/src/Grav/Framework/Cache/AbstractCache.php @@ -8,8 +8,6 @@ namespace Grav\Framework\Cache; -use Grav\Framework\Cache\Exception\InvalidArgumentException; - /** * Cache trait for PSR-16 compatible "Simple Cache" implementation * @package Grav\Framework\Cache diff --git a/system/src/Grav/Framework/Cache/Adapter/ChainCache.php b/system/src/Grav/Framework/Cache/Adapter/ChainCache.php index d211516aa..af0784c95 100644 --- a/system/src/Grav/Framework/Cache/Adapter/ChainCache.php +++ b/system/src/Grav/Framework/Cache/Adapter/ChainCache.php @@ -32,6 +32,7 @@ class ChainCache extends AbstractCache * Chain Cache constructor. * @param array $caches * @param null|int|\DateInterval $defaultLifetime + * @throws \InvalidArgumentException */ public function __construct(array $caches, $defaultLifetime = null) { @@ -43,7 +44,13 @@ class ChainCache extends AbstractCache foreach ($caches as $cache) { if (!$cache instanceof CacheInterface) { - throw new \InvalidArgumentException(sprintf("The class '%s' does not implement the '%s' interface", get_class($cache), CacheInterface::class)); + throw new \InvalidArgumentException( + sprintf( + "The class '%s' does not implement the '%s' interface", + get_class($cache), + CacheInterface::class + ) + ); } } diff --git a/system/src/Grav/Framework/Cache/CacheTrait.php b/system/src/Grav/Framework/Cache/CacheTrait.php index 9d07547fb..8be0165bd 100644 --- a/system/src/Grav/Framework/Cache/CacheTrait.php +++ b/system/src/Grav/Framework/Cache/CacheTrait.php @@ -8,7 +8,6 @@ namespace Grav\Framework\Cache; -use Grav\Framework\Cache\CacheInterface; use Grav\Framework\Cache\Exception\InvalidArgumentException; /** @@ -106,13 +105,19 @@ trait CacheTrait /** * @inheritdoc + * @throws InvalidArgumentException */ public function getMultiple($keys, $default = null) { if ($keys instanceof \Traversable) { $keys = iterator_to_array($keys, false); } elseif (!is_array($keys)) { - throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', is_object($keys) ? get_class($keys) : gettype($keys))); + throw new InvalidArgumentException( + sprintf( + 'Cache keys must be array or Traversable, "%s" given', + is_object($keys) ? get_class($keys) : gettype($keys) + ) + ); } if (empty($keys)) { @@ -146,7 +151,12 @@ trait CacheTrait if ($values instanceof \Traversable) { $values = iterator_to_array($values, true); } elseif (!is_array($values)) { - throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', is_object($values) ? get_class($values) : gettype($values))); + throw new InvalidArgumentException( + sprintf( + 'Cache values must be array or Traversable, "%s" given', + is_object($values) ? get_class($values) : gettype($values) + ) + ); } $keys = array_keys($values); @@ -171,7 +181,12 @@ trait CacheTrait if ($keys instanceof \Traversable) { $keys = iterator_to_array($keys, false); } elseif (!is_array($keys)) { - throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', is_object($keys) ? get_class($keys) : gettype($keys))); + throw new InvalidArgumentException( + sprintf( + 'Cache keys must be array or Traversable, "%s" given', + is_object($keys) ? get_class($keys) : gettype($keys) + ) + ); } if (empty($keys)) { @@ -242,16 +257,25 @@ trait CacheTrait protected function validateKey($key) { if (!is_string($key)) { - throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given', is_object($key) ? get_class($key) : gettype($key))); + throw new InvalidArgumentException( + sprintf( + 'Cache key must be string, "%s" given', + is_object($key) ? get_class($key) : gettype($key) + ) + ); } if (!isset($key[0])) { throw new InvalidArgumentException('Cache key length must be greater than zero'); } if (strlen($key) > 64) { - throw new InvalidArgumentException(sprintf('Cache key length must be less than 65 characters, key had %s characters', strlen($key))); + throw new InvalidArgumentException( + sprintf('Cache key length must be less than 65 characters, key had %s characters', strlen($key)) + ); } if (strpbrk($key, '{}()/\@:') !== false) { - throw new InvalidArgumentException(sprintf('Cache key "%s" contains reserved characters {}()/\@:', $key)); + throw new InvalidArgumentException( + sprintf('Cache key "%s" contains reserved characters {}()/\@:', $key) + ); } } @@ -281,6 +305,11 @@ trait CacheTrait $ttl = (int) \DateTime::createFromFormat('U', 0)->add($ttl)->format('U'); } - throw new InvalidArgumentException(sprintf('Expiration date must be an integer, a DateInterval or null, "%s" given', is_object($ttl) ? get_class($ttl) : gettype($ttl))); + throw new InvalidArgumentException( + sprintf( + 'Expiration date must be an integer, a DateInterval or null, "%s" given', + is_object($ttl) ? get_class($ttl) : gettype($ttl) + ) + ); } } diff --git a/system/src/Grav/Framework/Collection/ArrayCollection.php b/system/src/Grav/Framework/Collection/ArrayCollection.php index 917abd6b7..b49423162 100644 --- a/system/src/Grav/Framework/Collection/ArrayCollection.php +++ b/system/src/Grav/Framework/Collection/ArrayCollection.php @@ -24,12 +24,12 @@ class ArrayCollection extends BaseArrayCollection implements CollectionInterface */ public function reverse() { - if (method_exists($this, 'createFrom')) { - return $this->createFrom(array_reverse($this->toArray())); - } else { - // TODO: remove when PHP 5.6 is minimum (with doctrine/collections v1.4). + // TODO: remove when PHP 5.6 is minimum (with doctrine/collections v1.4). + if (!method_exists($this, 'createFrom')) { return new static(array_reverse($this->toArray())); } + + return $this->createFrom(array_reverse($this->toArray())); } /** @@ -42,12 +42,12 @@ class ArrayCollection extends BaseArrayCollection implements CollectionInterface $keys = $this->getKeys(); shuffle($keys); - if (method_exists($this, 'createFrom')) { - return $this->createFrom(array_replace(array_flip($keys), $this->toArray())); - } else { - // TODO: remove when PHP 5.6 is minimum (with doctrine/collections v1.4). + // TODO: remove when PHP 5.6 is minimum (with doctrine/collections v1.4). + if (!method_exists($this, 'createFrom')) { return new static(array_replace(array_flip($keys), $this->toArray())); } + + return $this->createFrom(array_replace(array_flip($keys), $this->toArray())); } /** diff --git a/system/src/Grav/Framework/Collection/FileCollection.php b/system/src/Grav/Framework/Collection/FileCollection.php index da9764448..65e49701f 100644 --- a/system/src/Grav/Framework/Collection/FileCollection.php +++ b/system/src/Grav/Framework/Collection/FileCollection.php @@ -62,7 +62,8 @@ class FileCollection extends AbstractLazyCollection public function __construct($path, $flags = null) { $this->path = $path; - $this->flags = (int) ($flags ?: FileCollection::INCLUDE_FILES | FileCollection::INCLUDE_FOLDERS | FileCollection::RECURSIVE); + $this->flags = (int) ($flags + ?: FileCollection::INCLUDE_FILES | FileCollection::INCLUDE_FOLDERS | FileCollection::RECURSIVE); $this->setIterator(); $this->setFilter(); @@ -268,7 +269,7 @@ class FileCollection extends AbstractLazyCollection protected function createObject($file) { return (object) [ - 'key' => $file->getSubPathName(), + 'key' => $file->getSubPathname(), 'type' => $file->isDir() ? 'folder' : 'file:' . $file->getExtension(), 'url' => method_exists($file, 'getUrl') ? $file->getUrl() : null, 'pathname' => $file->getPathname(), diff --git a/system/src/Grav/Framework/ContentBlock/ContentBlock.php b/system/src/Grav/Framework/ContentBlock/ContentBlock.php index c446c3a1b..5c50937b5 100644 --- a/system/src/Grav/Framework/ContentBlock/ContentBlock.php +++ b/system/src/Grav/Framework/ContentBlock/ContentBlock.php @@ -151,6 +151,7 @@ class ContentBlock implements ContentBlockInterface /** * @param array $serialized + * @throws \RuntimeException */ public function build(array $serialized) { @@ -221,9 +222,9 @@ class ContentBlock implements ContentBlockInterface */ protected function checkVersion(array $serialized) { - $version = isset($serialized['_version']) ? (string) $serialized['_version'] : 1; - if ($version != $this->version) { + $version = isset($serialized['_version']) ? (string) $serialized['_version'] : '1'; + if ($version !== $this->version) { throw new \RuntimeException(sprintf('Unsupported version %s', $version)); } } -} \ No newline at end of file +} diff --git a/system/src/Grav/Framework/ContentBlock/ContentBlockInterface.php b/system/src/Grav/Framework/ContentBlock/ContentBlockInterface.php index 9412ef82f..914f4eae6 100644 --- a/system/src/Grav/Framework/ContentBlock/ContentBlockInterface.php +++ b/system/src/Grav/Framework/ContentBlock/ContentBlockInterface.php @@ -72,4 +72,4 @@ interface ContentBlockInterface extends \Serializable * @return $this */ public function addBlock(ContentBlockInterface $block); -} \ No newline at end of file +} diff --git a/system/src/Grav/Framework/ContentBlock/HtmlBlock.php b/system/src/Grav/Framework/ContentBlock/HtmlBlock.php index c2537da86..477c5e0ae 100644 --- a/system/src/Grav/Framework/ContentBlock/HtmlBlock.php +++ b/system/src/Grav/Framework/ContentBlock/HtmlBlock.php @@ -15,7 +15,6 @@ namespace Grav\Framework\ContentBlock; */ class HtmlBlock extends ContentBlock implements HtmlBlockInterface { - protected $version = 1; protected $frameworks = []; protected $styles = []; protected $scripts = []; @@ -73,7 +72,7 @@ class HtmlBlock extends ContentBlock implements HtmlBlockInterface } /** - * @return array + * @return array[] */ public function toArray() { @@ -97,6 +96,7 @@ class HtmlBlock extends ContentBlock implements HtmlBlockInterface /** * @param array $serialized + * @throws \RuntimeException */ public function build(array $serialized) { @@ -144,7 +144,15 @@ class HtmlBlock extends ContentBlock implements HtmlBlockInterface $href = $element['href']; $type = !empty($element['type']) ? (string) $element['type'] : 'text/css'; $media = !empty($element['media']) ? (string) $element['media'] : null; - unset($element['tag'], $element['id'], $element['rel'], $element['content'], $element['href'], $element['type'], $element['media']); + unset( + $element['tag'], + $element['id'], + $element['rel'], + $element['content'], + $element['href'], + $element['type'], + $element['media'] + ); $this->styles[$location][md5($href) . sha1($href)] = [ ':type' => 'file', @@ -354,10 +362,13 @@ class HtmlBlock extends ContentBlock implements HtmlBlockInterface foreach ($items as &$item) { $item[':order'] = ++$count; } + unset($item); + uasort( $items, function ($a, $b) { - return ($a[':priority'] == $b[':priority']) ? $a[':order'] - $b[':order'] : $a[':priority'] - $b[':priority']; + return ($a[':priority'] === $b[':priority']) + ? $a[':order'] - $b[':order'] : $a[':priority'] - $b[':priority']; } ); } @@ -371,4 +382,4 @@ class HtmlBlock extends ContentBlock implements HtmlBlockInterface $this->sortAssetsInLocation($items); } } -} \ No newline at end of file +} diff --git a/system/src/Grav/Framework/Object/Object.php b/system/src/Grav/Framework/Object/Object.php index fe4f77060..fbbdab919 100644 --- a/system/src/Grav/Framework/Object/Object.php +++ b/system/src/Grav/Framework/Object/Object.php @@ -24,37 +24,6 @@ class Object implements ObjectInterface NestedArrayAccessWithGetters::offsetSet as private parentOffsetSet; } - /** - * Properties of the object. - * @var array - */ - protected $items; - - /** - * @var string - */ - private $key; - - /** - * @param array $elements - * @param string $key - */ - public function __construct(array $elements = [], $key = null) - { - - $this->items = $elements; - $this->key = $key !== null ? $key : $this->getKey(); - - if ($this->key === null) { - throw new \InvalidArgumentException('Object cannot be created without assigning a key'); - } - } - - public function getKey() - { - return $this->key; - } - /** * Checks whether or not an offset exists with a possibility to load the field by $this->offsetLoad_{$offset}(). * @@ -63,7 +32,9 @@ class Object implements ObjectInterface */ public function offsetExists($offset) { - return $this->parentOffsetExists($offset) || method_exists($this, "offsetLoad_{$offset}"); + $methodName = "offsetLoad_{$offset}"; + + return $this->parentOffsetExists($offset) || method_exists($this, $methodName); } /** @@ -74,8 +45,10 @@ class Object implements ObjectInterface */ public function offsetGet($offset) { - if (!$this->parentOffsetExists($offset) && method_exists($this, "offsetLoad_{$offset}")) { - $this->offsetSet($offset, call_user_func([$this, "offsetLoad_{$offset}"])); + $methodName = "offsetLoad_{$offset}"; + + if (!$this->parentOffsetExists($offset) && method_exists($this, $methodName)) { + $this->offsetSet($offset, $this->{$methodName}()); } return $this->parentOffsetGet($offset); @@ -83,15 +56,18 @@ class Object implements ObjectInterface /** - * Assigns a value to the specified offset with a possibility to check or alter the value by $this->offsetPrepare_{$offset}(). + * Assigns a value to the specified offset with a possibility to check or alter the value by + * $this->offsetPrepare_{$offset}(). * * @param mixed $offset The offset to assign the value to. * @param mixed $value The value to set. */ public function offsetSet($offset, $value) { - if (method_exists($this, "offsetPrepare_{$offset}")) { - $value = call_user_func([$this, "offsetPrepare_{$offset}"], $value); + $methodName = "offsetPrepare_{$offset}"; + + if (method_exists($this, $methodName)) { + $value = $this->{$methodName}($value); } $this->parentOffsetSet($offset, $value); diff --git a/system/src/Grav/Framework/Object/ObjectCollection.php b/system/src/Grav/Framework/Object/ObjectCollection.php index 799a0cbe9..81fa198a1 100644 --- a/system/src/Grav/Framework/Object/ObjectCollection.php +++ b/system/src/Grav/Framework/Object/ObjectCollection.php @@ -18,20 +18,27 @@ class ObjectCollection extends ArrayCollection implements ObjectCollectionInterf { use ObjectCollectionTrait; - /** - * @var string - */ - private $key; - /** * @param array $elements * @param string $key + * @throws \InvalidArgumentException */ public function __construct(array $elements = [], $key = null) { parent::__construct($elements); - $this->key = $key !== null ? $key : $this->getKey(); + $this->key = $key ?: $this->getKey() ?: __CLASS__ . '@' . spl_object_hash($this); + } + + /** + * @param string $key + * @return $this + */ + public function setKey($key) + { + $this->key = $key; + + return $this; } /** diff --git a/system/src/Grav/Framework/Object/ObjectCollectionInterface.php b/system/src/Grav/Framework/Object/ObjectCollectionInterface.php index 2248417be..c4764ea1a 100644 --- a/system/src/Grav/Framework/Object/ObjectCollectionInterface.php +++ b/system/src/Grav/Framework/Object/ObjectCollectionInterface.php @@ -23,6 +23,12 @@ interface ObjectCollectionInterface extends CollectionInterface, ObjectInterface */ public function copy(); + /** + * @param string $key + * @return $this + */ + public function setKey($key); + /** * @return array */ diff --git a/system/src/Grav/Framework/Object/ObjectCollectionTrait.php b/system/src/Grav/Framework/Object/ObjectCollectionTrait.php index 8eab19169..52d8e592c 100644 --- a/system/src/Grav/Framework/Object/ObjectCollectionTrait.php +++ b/system/src/Grav/Framework/Object/ObjectCollectionTrait.php @@ -80,7 +80,8 @@ trait ObjectCollectionTrait $list = []; foreach ($this as $id => $element) { - $list[$id] = method_exists($element, $method) ? call_user_func_array([$element, $method], $arguments) : null; + $list[$id] = method_exists($element, $method) + ? call_user_func_array([$element, $method], $arguments) : null; } return $list; diff --git a/system/src/Grav/Framework/Object/ObjectTrait.php b/system/src/Grav/Framework/Object/ObjectTrait.php index c20a12aee..1c353eb58 100644 --- a/system/src/Grav/Framework/Object/ObjectTrait.php +++ b/system/src/Grav/Framework/Object/ObjectTrait.php @@ -8,9 +8,6 @@ namespace Grav\Framework\Object; -use RocketTheme\Toolbox\ArrayTraits\ArrayAccessWithGetters; -use RocketTheme\Toolbox\ArrayTraits\Export; - /** * Object trait. * @@ -32,6 +29,7 @@ trait ObjectTrait /** * @param array $elements * @param string $key + * @throws \InvalidArgumentException */ public function __construct(array $elements = [], $key = null) { diff --git a/system/src/Grav/Framework/Page/PageCollectionInterface.php b/system/src/Grav/Framework/Page/PageCollectionInterface.php index a932ed888..f2b486f94 100644 --- a/system/src/Grav/Framework/Page/PageCollectionInterface.php +++ b/system/src/Grav/Framework/Page/PageCollectionInterface.php @@ -10,5 +10,6 @@ namespace Grav\Framework\Page; use Grav\Framework\Collection\CollectionInterface; -interface PageCollectionInterface extends CollectionInterface { +interface PageCollectionInterface extends CollectionInterface +{ } diff --git a/system/src/Grav/Framework/Page/PageHeaderInterface.php b/system/src/Grav/Framework/Page/PageHeaderInterface.php index 6398d4da5..55a1d2517 100644 --- a/system/src/Grav/Framework/Page/PageHeaderInterface.php +++ b/system/src/Grav/Framework/Page/PageHeaderInterface.php @@ -8,5 +8,6 @@ namespace Grav\Framework\Page; -interface PageHeaderInterface extends \ArrayAccess { -} \ No newline at end of file +interface PageHeaderInterface extends \ArrayAccess +{ +} diff --git a/system/src/Grav/Framework/Page/PageMediaCollectionInterface.php b/system/src/Grav/Framework/Page/PageMediaCollectionInterface.php index c7fee7550..6f18ca6ee 100644 --- a/system/src/Grav/Framework/Page/PageMediaCollectionInterface.php +++ b/system/src/Grav/Framework/Page/PageMediaCollectionInterface.php @@ -10,5 +10,6 @@ namespace Grav\Framework\Page; use Grav\Framework\Collection\CollectionInterface; -interface PageMediaCollectionInterface extends CollectionInterface { +interface PageMediaCollectionInterface extends CollectionInterface +{ } From a4795a9df16752b3e758e65458be265ee7f15156 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Tue, 29 Aug 2017 10:37:14 +0300 Subject: [PATCH 027/141] Add new SessionCache class --- .../Grav/Framework/Cache/AbstractCache.php | 3 + .../Framework/Cache/Adapter/SessionCache.php | 72 +++++++++++++++++++ .../src/Grav/Framework/Cache/CacheTrait.php | 9 +++ 3 files changed, 84 insertions(+) create mode 100644 system/src/Grav/Framework/Cache/Adapter/SessionCache.php diff --git a/system/src/Grav/Framework/Cache/AbstractCache.php b/system/src/Grav/Framework/Cache/AbstractCache.php index 90269213c..b9447f108 100644 --- a/system/src/Grav/Framework/Cache/AbstractCache.php +++ b/system/src/Grav/Framework/Cache/AbstractCache.php @@ -8,6 +8,8 @@ namespace Grav\Framework\Cache; +use Grav\Framework\Cache\Exception\InvalidArgumentException; + /** * Cache trait for PSR-16 compatible "Simple Cache" implementation * @package Grav\Framework\Cache @@ -19,6 +21,7 @@ abstract class AbstractCache implements CacheInterface /** * @param string $namespace * @param null|int|\DateInterval $defaultLifetime + * @throws InvalidArgumentException */ public function __construct($namespace = '', $defaultLifetime = null) { diff --git a/system/src/Grav/Framework/Cache/Adapter/SessionCache.php b/system/src/Grav/Framework/Cache/Adapter/SessionCache.php new file mode 100644 index 000000000..6a2b8ae53 --- /dev/null +++ b/system/src/Grav/Framework/Cache/Adapter/SessionCache.php @@ -0,0 +1,72 @@ +doGetStored($key); + + return $stored ? $stored[self::VALUE] : $miss; + } + + public function doSet($key, $value, $ttl) + { + $_SESSION[$this->getNamespace()][$key] = [self::VALUE => $value, self::LIFETIME => time() + $ttl]; + + return true; + } + + public function doDelete($key) + { + unset($_SESSION[$this->getNamespace()][$key]); + + return true; + } + + public function doClear() + { + $_SESSION[$this->getNamespace()] = []; + + return true; + } + + public function doHas($key) + { + return $this->doGetStored($key) !== null; + } + + public function getNamespace() + { + return 'cache-' . parent::getNamespace(); + } + + protected function doGetStored($key) + { + $stored = isset($_SESSION[$this->getNamespace()][$key]) ? $_SESSION[$this->getNamespace()][$key] : null; + + if ($stored && $stored[self::LIFETIME] < time()) { + unset($_SESSION[$this->getNamespace()][$key]); + $stored = null; + } + + return $stored ?: null; + } +} diff --git a/system/src/Grav/Framework/Cache/CacheTrait.php b/system/src/Grav/Framework/Cache/CacheTrait.php index 8be0165bd..2b1b937e7 100644 --- a/system/src/Grav/Framework/Cache/CacheTrait.php +++ b/system/src/Grav/Framework/Cache/CacheTrait.php @@ -36,6 +36,7 @@ trait CacheTrait * * @param string $namespace * @param null|int|\DateInterval $defaultLifetime + * @throws InvalidArgumentException */ protected function init($namespace = '', $defaultLifetime = null) { @@ -62,6 +63,7 @@ trait CacheTrait /** * @inheritdoc + * @throws InvalidArgumentException */ public function get($key, $default = null) { @@ -74,6 +76,7 @@ trait CacheTrait /** * @inheritdoc + * @throws InvalidArgumentException */ public function set($key, $value, $ttl = null) { @@ -87,6 +90,7 @@ trait CacheTrait /** * @inheritdoc + * @throws InvalidArgumentException */ public function delete($key) { @@ -145,6 +149,7 @@ trait CacheTrait /** * @inheritdoc + * @throws InvalidArgumentException */ public function setMultiple($values, $ttl = null) { @@ -175,6 +180,7 @@ trait CacheTrait /** * @inheritdoc + * @throws InvalidArgumentException */ public function deleteMultiple($keys) { @@ -200,6 +206,7 @@ trait CacheTrait /** * @inheritdoc + * @throws InvalidArgumentException */ public function has($key) { @@ -253,6 +260,7 @@ trait CacheTrait /** * @param string $key + * @throws InvalidArgumentException */ protected function validateKey($key) { @@ -290,6 +298,7 @@ trait CacheTrait * @param null|int|\DateInterval $ttl * @param bool $ignoreDefault Used internally inside $this->init(). * @return int|null + * @throws InvalidArgumentException */ protected function convertTtl($ttl, $ignoreDefault = false) { From 1bae601ad9ff9aedbcff0600bd26c76000bf38ff Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Tue, 29 Aug 2017 11:17:38 +0300 Subject: [PATCH 028/141] Add new FileCache class --- .../Framework/Cache/Adapter/FileCache.php | 167 ++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 system/src/Grav/Framework/Cache/Adapter/FileCache.php diff --git a/system/src/Grav/Framework/Cache/Adapter/FileCache.php b/system/src/Grav/Framework/Cache/Adapter/FileCache.php new file mode 100644 index 000000000..8050021a0 --- /dev/null +++ b/system/src/Grav/Framework/Cache/Adapter/FileCache.php @@ -0,0 +1,167 @@ +getFile($key); + + if (!file_exists($file) || !$h = @fopen($file, 'rb')) { + return $miss; + } + + if ($now >= (int) $expiresAt = fgets($h)) { + fclose($h); + @unlink($file); + } else { + $i = rawurldecode(rtrim(fgets($h))); + $value = stream_get_contents($h); + fclose($h); + + if ($i === $key) { + return unserialize($value); + } + } + + return $miss; + } + + public function doSet($key, $value, $ttl) + { + $expiresAt = time() + ($ttl ?: 31557600); // = 1 year + + $result = $this->write( + $this->getFile($key, true), + $expiresAt . "\n" . rawurlencode($key) . "\n" . serialize($value), + $expiresAt + ); + + if (!$result && !is_writable($this->directory)) { + throw new CacheException(sprintf('Cache directory is not writable (%s)', $this->directory)); + } + + return $result; + } + + public function doDelete($key) + { + $file = $this->getFile($key); + + return (!file_exists($file) || @unlink($file) || !file_exists($file)); + } + + public function doClear() + { + $result = true; + $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->directory, \FilesystemIterator::SKIP_DOTS)); + + foreach ($iterator as $file) { + $result = ($file->isDir() || @unlink($file) || !file_exists($file)) && $result; + } + + return $result; + } + + public function doHas($key) + { + $file = $this->getFile($key); + + return file_exists($file) && (@filemtime($file) > time() || $this->doGet($key, null)); + } + + protected function getFile($key, $mkdir = false) + { + $hash = str_replace('/', '-', base64_encode(hash('sha256', static::class . $key, true))); + $dir = $this->directory . $hash[0] . DIRECTORY_SEPARATOR . $hash[1] . DIRECTORY_SEPARATOR; + + if ($mkdir && !file_exists($dir)) { + @mkdir($dir, 0777, true); + } + + return $dir . substr($hash, 2, 20); + } + + private function init($namespace, $directory) + { + if (!isset($directory[0])) { + $directory = sys_get_temp_dir() . '/grav-cache'; + } else { + $directory = realpath($directory) ?: $directory; + } + + if (isset($namespace[0])) { + if (preg_match('#[^-+_.A-Za-z0-9]#', $namespace, $match)) { + throw new InvalidArgumentException(sprintf('Namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed.', $match[0])); + } + $directory .= DIRECTORY_SEPARATOR . $namespace; + } + + if (!file_exists($directory)) { + @mkdir($directory, 0777, true); + } + + $directory .= DIRECTORY_SEPARATOR; + // On Windows the whole path is limited to 258 chars + if ('\\' === DIRECTORY_SEPARATOR && strlen($directory) > 234) { + throw new InvalidArgumentException(sprintf('Cache folder is too long (%s)', $directory)); + } + $this->directory = $directory; + } + + private function write($file, $data, $expiresAt = null) + { + set_error_handler(__CLASS__.'::throwError'); + + try { + if ($this->tmp === null) { + $this->tmp = $this->directory . uniqid('', true); + } + + file_put_contents($this->tmp, $data); + + if ($expiresAt !== null) { + touch($this->tmp, $expiresAt); + } + + return rename($this->tmp, $file); + } finally { + restore_error_handler(); + } + } + + /** + * @internal + */ + public static function throwError($type, $message, $file, $line) + { + throw new \ErrorException($message, 0, $type, $file, $line); + } + + public function __destruct() + { + if ($this->tmp !== null && file_exists($this->tmp)) { + unlink($this->tmp); + } + } +} From fab81b923bafe43b7f99a92c67e5e42edb50201a Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Tue, 29 Aug 2017 11:17:54 +0300 Subject: [PATCH 029/141] Composer update --- composer.lock | 108 +++++++++++++++++++++++++------------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/composer.lock b/composer.lock index a45592b7a..70e65bd5c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "b8c9d8a8d904116ce81d1e48c18e68e0", + "content-hash": "a11c16ecc5e1a59b0e585ab8f04a28e6", "packages": [ { "name": "antoligy/dom-string-iterators", @@ -641,16 +641,16 @@ }, { "name": "maximebf/debugbar", - "version": "1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/maximebf/php-debugbar.git", - "reference": "afee79a236348e39a44cb837106b7c5b4897ac2a" + "reference": "e23a98f2d65607d8aa6c7b409a513f8fdf4acdde" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/afee79a236348e39a44cb837106b7c5b4897ac2a", - "reference": "afee79a236348e39a44cb837106b7c5b4897ac2a", + "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/e23a98f2d65607d8aa6c7b409a513f8fdf4acdde", + "reference": "e23a98f2d65607d8aa6c7b409a513f8fdf4acdde", "shasum": "" }, "require": { @@ -669,7 +669,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -698,7 +698,7 @@ "debug", "debugbar" ], - "time": "2017-01-05T08:46:19+00:00" + "time": "2017-08-17T07:17:00+00:00" }, { "name": "miljar/php-exif", @@ -1029,16 +1029,16 @@ }, { "name": "rockettheme/toolbox", - "version": "1.3.6", + "version": "1.3.7", "source": { "type": "git", "url": "https://github.com/rockettheme/toolbox.git", - "reference": "0905611d963485b2fda0a7be0cba6e56cc1c85a2" + "reference": "670ad362eb948d14ebc589b957965cf178674a33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rockettheme/toolbox/zipball/0905611d963485b2fda0a7be0cba6e56cc1c85a2", - "reference": "0905611d963485b2fda0a7be0cba6e56cc1c85a2", + "url": "https://api.github.com/repos/rockettheme/toolbox/zipball/670ad362eb948d14ebc589b957965cf178674a33", + "reference": "670ad362eb948d14ebc589b957965cf178674a33", "shasum": "" }, "require": { @@ -1073,7 +1073,7 @@ "php", "rockettheme" ], - "time": "2017-08-16T16:31:10+00:00" + "time": "2017-08-28T20:31:35+00:00" }, { "name": "seld/cli-prompt", @@ -1125,16 +1125,16 @@ }, { "name": "symfony/console", - "version": "v2.8.26", + "version": "v2.8.27", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "32a3c6b3398de5db8ed381f4ef92970c59c2fcdd" + "reference": "c0807a2ca978e64d8945d373a9221a5c35d1a253" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/32a3c6b3398de5db8ed381f4ef92970c59c2fcdd", - "reference": "32a3c6b3398de5db8ed381f4ef92970c59c2fcdd", + "url": "https://api.github.com/repos/symfony/console/zipball/c0807a2ca978e64d8945d373a9221a5c35d1a253", + "reference": "c0807a2ca978e64d8945d373a9221a5c35d1a253", "shasum": "" }, "require": { @@ -1182,7 +1182,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:26:04+00:00" + "time": "2017-08-27T14:29:03+00:00" }, { "name": "symfony/debug", @@ -1243,7 +1243,7 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.8.26", + "version": "v2.8.27", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -1421,16 +1421,16 @@ }, { "name": "symfony/var-dumper", - "version": "v2.8.26", + "version": "v2.8.27", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "e9337f23b1c080df301d25b8891ecf1607b0b72f" + "reference": "83ebf3e92c0b2231fa63b8e584a2a3d3cd9876ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/e9337f23b1c080df301d25b8891ecf1607b0b72f", - "reference": "e9337f23b1c080df301d25b8891ecf1607b0b72f", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/83ebf3e92c0b2231fa63b8e584a2a3d3cd9876ef", + "reference": "83ebf3e92c0b2231fa63b8e584a2a3d3cd9876ef", "shasum": "" }, "require": { @@ -1485,11 +1485,11 @@ "debug", "dump" ], - "time": "2017-07-26T06:29:15+00:00" + "time": "2017-08-27T14:29:03+00:00" }, { "name": "symfony/yaml", - "version": "v2.8.26", + "version": "v2.8.27", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", @@ -3148,20 +3148,20 @@ }, { "name": "symfony/browser-kit", - "version": "v3.3.6", + "version": "v3.3.8", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "8079a6b3668ef15cdbf73a4c7d31081abb8bb5f0" + "reference": "aee7120b058c268363e606ff5fe8271da849a1b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/8079a6b3668ef15cdbf73a4c7d31081abb8bb5f0", - "reference": "8079a6b3668ef15cdbf73a4c7d31081abb8bb5f0", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/aee7120b058c268363e606ff5fe8271da849a1b5", + "reference": "aee7120b058c268363e606ff5fe8271da849a1b5", "shasum": "" }, "require": { - "php": ">=5.5.9", + "php": "^5.5.9|>=7.0.8", "symfony/dom-crawler": "~2.8|~3.0" }, "require-dev": { @@ -3201,24 +3201,24 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2017-07-12T13:03:20+00:00" + "time": "2017-07-29T21:54:42+00:00" }, { "name": "symfony/css-selector", - "version": "v3.3.6", + "version": "v3.3.8", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "4d882dced7b995d5274293039370148e291808f2" + "reference": "c5f5263ed231f164c58368efbce959137c7d9488" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/4d882dced7b995d5274293039370148e291808f2", - "reference": "4d882dced7b995d5274293039370148e291808f2", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/c5f5263ed231f164c58368efbce959137c7d9488", + "reference": "c5f5263ed231f164c58368efbce959137c7d9488", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^5.5.9|>=7.0.8" }, "type": "library", "extra": { @@ -3254,24 +3254,24 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2017-05-01T15:01:29+00:00" + "time": "2017-07-29T21:54:42+00:00" }, { "name": "symfony/dom-crawler", - "version": "v3.3.6", + "version": "v3.3.8", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "fc2c588ce376e9fe04a7b8c79e3ec62fe32d95b1" + "reference": "d15dfaf71b65bf3affb80900470caf4451a8217e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/fc2c588ce376e9fe04a7b8c79e3ec62fe32d95b1", - "reference": "fc2c588ce376e9fe04a7b8c79e3ec62fe32d95b1", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/d15dfaf71b65bf3affb80900470caf4451a8217e", + "reference": "d15dfaf71b65bf3affb80900470caf4451a8217e", "shasum": "" }, "require": { - "php": ">=5.5.9", + "php": "^5.5.9|>=7.0.8", "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { @@ -3310,24 +3310,24 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2017-05-25T23:10:31+00:00" + "time": "2017-08-15T13:31:09+00:00" }, { "name": "symfony/finder", - "version": "v3.3.6", + "version": "v3.3.8", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "baea7f66d30854ad32988c11a09d7ffd485810c4" + "reference": "b2260dbc80f3c4198f903215f91a1ac7fe9fe09e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/baea7f66d30854ad32988c11a09d7ffd485810c4", - "reference": "baea7f66d30854ad32988c11a09d7ffd485810c4", + "url": "https://api.github.com/repos/symfony/finder/zipball/b2260dbc80f3c4198f903215f91a1ac7fe9fe09e", + "reference": "b2260dbc80f3c4198f903215f91a1ac7fe9fe09e", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^5.5.9|>=7.0.8" }, "type": "library", "extra": { @@ -3359,24 +3359,24 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-06-01T21:01:25+00:00" + "time": "2017-07-29T21:54:42+00:00" }, { "name": "symfony/process", - "version": "v3.3.6", + "version": "v3.3.8", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "07432804942b9f6dd7b7377faf9920af5f95d70a" + "reference": "b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/07432804942b9f6dd7b7377faf9920af5f95d70a", - "reference": "07432804942b9f6dd7b7377faf9920af5f95d70a", + "url": "https://api.github.com/repos/symfony/process/zipball/b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0", + "reference": "b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^5.5.9|>=7.0.8" }, "type": "library", "extra": { @@ -3408,7 +3408,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-07-13T13:05:09+00:00" + "time": "2017-07-29T21:54:42+00:00" }, { "name": "webmozart/assert", From cdb5d591e8ee2c44c3cc960c94ba4e498013de9e Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Wed, 30 Aug 2017 14:08:57 +0300 Subject: [PATCH 030/141] Fix a bug in MemoryCache --- system/src/Grav/Framework/Cache/Adapter/MemoryCache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php b/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php index e19bb755e..334bbb3ed 100644 --- a/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php +++ b/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php @@ -28,7 +28,7 @@ class MemoryCache extends AbstractCache */ public function __construct() { - parent::__construct(); + parent::__construct('', 300); } public function doGet($key, $miss) From cd11b149988d69c3997e5f6330b0784f94d25cbe Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 8 Sep 2017 14:39:33 +0300 Subject: [PATCH 031/141] Add `FileCollectionInterface` and `AbstractFileCollection` classes --- .../Collection/AbstractFileCollection.php | 227 ++++++++++++++++++ .../Framework/Collection/FileCollection.php | 210 +--------------- .../Collection/FileCollectionInterface.php | 28 +++ 3 files changed, 267 insertions(+), 198 deletions(-) create mode 100644 system/src/Grav/Framework/Collection/AbstractFileCollection.php create mode 100644 system/src/Grav/Framework/Collection/FileCollectionInterface.php diff --git a/system/src/Grav/Framework/Collection/AbstractFileCollection.php b/system/src/Grav/Framework/Collection/AbstractFileCollection.php new file mode 100644 index 000000000..d35cdfc18 --- /dev/null +++ b/system/src/Grav/Framework/Collection/AbstractFileCollection.php @@ -0,0 +1,227 @@ +path = $path; + $this->flags = self::INCLUDE_FILES | self::INCLUDE_FOLDERS; + $this->nestingLimit = 0; + $this->createObjectFunction = [$this, 'createObject']; + + $this->setIterator(); + } + + /** + * @return string + */ + public function getPath() + { + return $this->path; + } + + /** + * @param Criteria $criteria + * @return ArrayCollection + * @todo Implement lazy matching + */ + public function matching(Criteria $criteria) + { + $expr = $criteria->getWhereExpression(); + + $oldFilter = $this->filterFunction; + if ($expr) { + $visitor = new ClosureExpressionVisitor(); + $filter = $visitor->dispatch($expr); + $this->addFilter($filter); + } + + $filtered = $this->doInitializeByIterator($this->iterator, $this->nestingLimit); + $this->filterFunction = $oldFilter; + + if ($orderings = $criteria->getOrderings()) { + $next = null; + foreach (array_reverse($orderings) as $field => $ordering) { + $next = ClosureExpressionVisitor::sortByField($field, $ordering == Criteria::DESC ? -1 : 1, $next); + } + + uasort($filtered, $next); + } else { + ksort($filtered); + } + + $offset = $criteria->getFirstResult(); + $length = $criteria->getMaxResults(); + + if ($offset || $length) { + $filtered = array_slice($filtered, (int)$offset, $length); + } + + return new ArrayCollection($filtered); + } + + protected function setIterator() + { + $iteratorFlags = \RecursiveDirectoryIterator::SKIP_DOTS + \FilesystemIterator::UNIX_PATHS + + \FilesystemIterator::CURRENT_AS_SELF + \FilesystemIterator::FOLLOW_SYMLINKS; + + if (strpos($this->path, '://')) { + /** @var UniformResourceLocator $locator */ + $locator = Grav::instance()['locator']; + $this->iterator = $locator->getRecursiveIterator($this->path, $iteratorFlags); + } else { + $this->iterator = new \RecursiveDirectoryIterator($this->path, $iteratorFlags); + } + } + + /** + * @param callable $filterFunction + * @return $this + */ + protected function addFilter(callable $filterFunction) + { + if ($this->filterFunction) { + $oldFilterFunction = $this->filterFunction; + $this->filterFunction = function ($expr) use ($oldFilterFunction, $filterFunction) { + return $oldFilterFunction($expr) && $filterFunction($expr); + }; + } else { + $this->filterFunction = $filterFunction; + } + + return $this; + } + + /** + * {@inheritDoc} + */ + protected function doInitialize() + { + $filtered = $this->doInitializeByIterator($this->iterator, $this->nestingLimit); + ksort($filtered); + + $this->collection = new ArrayCollection($filtered); + } + + protected function doInitializeByIterator(\SeekableIterator $iterator, $nestingLimit) + { + $children = []; + $objects = []; + $filter = $this->filterFunction; + $objectFunction = $this->createObjectFunction; + + /** @var \RecursiveDirectoryIterator $file */ + foreach ($iterator as $file) { + // Skip files if they shouldn't be included. + if (!($this->flags & static::INCLUDE_FILES) && $file->isFile()) { + continue; + } + + // Apply main filter. + if ($filter && !$filter($file)) { + continue; + } + + // Include children if the recursive flag is set. + if (($this->flags & static::RECURSIVE) && $nestingLimit > 0 && $file->hasChildren()) { + $children[] = $file->getChildren(); + } + + // Skip folders if they shouldn't be included. + if (!($this->flags & static::INCLUDE_FOLDERS) && $file->isDir()) { + continue; + } + + $object = $objectFunction($file); + $objects[$object->key] = $object; + } + + if ($children) { + $objects += $this->doInitializeChildren($children, $nestingLimit - 1); + } + + return $objects; + } + + /** + * @param \RecursiveDirectoryIterator[] $children + * @return array + */ + protected function doInitializeChildren(array $children, $nestingLimit) + { + $objects = []; + + foreach ($children as $iterator) { + $objects += $this->doInitializeByIterator($iterator, $nestingLimit); + } + + return $objects; + } + + /** + * @param \RecursiveDirectoryIterator $file + * @return object + */ + protected function createObject($file) + { + return (object) [ + 'key' => $file->getSubPathname(), + 'type' => $file->isDir() ? 'folder' : 'file:' . $file->getExtension(), + 'url' => method_exists($file, 'getUrl') ? $file->getUrl() : null, + 'pathname' => $file->getPathname(), + 'mtime' => $file->getMTime() + ]; + } +} diff --git a/system/src/Grav/Framework/Collection/FileCollection.php b/system/src/Grav/Framework/Collection/FileCollection.php index 65e49701f..a86b09249 100644 --- a/system/src/Grav/Framework/Collection/FileCollection.php +++ b/system/src/Grav/Framework/Collection/FileCollection.php @@ -8,62 +8,22 @@ namespace Grav\Framework\Collection; -use Doctrine\Common\Collections\Criteria; -use Doctrine\Common\Collections\Expr\ClosureExpressionVisitor; -use Grav\Common\Grav; -use RocketTheme\Toolbox\ResourceLocator\RecursiveUniformResourceIterator; -use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator; - /** * Collection of objects stored into a filesystem. * * @package Grav\Framework\Collection */ -class FileCollection extends AbstractLazyCollection +class FileCollection extends AbstractFileCollection { - const INCLUDE_FILES = 1; - const INCLUDE_FOLDERS = 2; - const RECURSIVE = 4; - - /** - * @var string - */ - protected $path; - - /** - * @var \RecursiveDirectoryIterator|RecursiveUniformResourceIterator - */ - protected $iterator; - - /** - * @var callable - */ - protected $createObjectFunction; - - /** - * @var callable - */ - protected $filterFunction; - - /** - * @var int - */ - protected $flags; - - /** - * @var int - */ - protected $nestingLimit; - /** * @param string $path * @param int $flags */ public function __construct($path, $flags = null) { - $this->path = $path; - $this->flags = (int) ($flags - ?: FileCollection::INCLUDE_FILES | FileCollection::INCLUDE_FOLDERS | FileCollection::RECURSIVE); + parent::__construct($path); + + $this->flags = (int)($flags ?: self::INCLUDE_FILES | self::INCLUDE_FOLDERS | self::RECURSIVE); $this->setIterator(); $this->setFilter(); @@ -71,14 +31,6 @@ class FileCollection extends AbstractLazyCollection $this->setNestingLimit(); } - /** - * @return string - */ - public function getPath() - { - return $this->path; - } - /** * @return int */ @@ -95,18 +47,15 @@ class FileCollection extends AbstractLazyCollection return $this->nestingLimit; } - public function setIterator() + /** + * @param int $limit + * @return $this + */ + public function setNestingLimit($limit = 99) { - $iteratorFlags = \RecursiveDirectoryIterator::SKIP_DOTS + \FilesystemIterator::UNIX_PATHS - + \FilesystemIterator::CURRENT_AS_SELF + \FilesystemIterator::FOLLOW_SYMLINKS; + $this->nestingLimit = (int) $limit; - if (strpos($this->path, '://')) { - /** @var UniformResourceLocator $locator */ - $locator = Grav::instance()['locator']; - $this->iterator = $locator->getRecursiveIterator($this->path, $iteratorFlags); - } else { - $this->iterator = new \RecursiveDirectoryIterator($this->path, $iteratorFlags); - } + return $this; } /** @@ -126,14 +75,7 @@ class FileCollection extends AbstractLazyCollection */ public function addFilter(callable $filterFunction) { - if ($this->filterFunction) { - $oldFilterFunction = $this->filterFunction; - $this->filterFunction = function ($expr) use ($oldFilterFunction, $filterFunction) { - return $oldFilterFunction($expr) && $filterFunction($expr); - }; - } else { - $this->filterFunction = $filterFunction; - } + parent::addFilter($filterFunction); return $this; } @@ -148,132 +90,4 @@ class FileCollection extends AbstractLazyCollection return $this; } - - public function setNestingLimit($limit = 99) - { - $this->nestingLimit = (int) $limit; - - return $this; - } - - /** - * @param Criteria $criteria - * @return ArrayCollection - * @todo Implement lazy matching - */ - public function matching(Criteria $criteria) - { - $expr = $criteria->getWhereExpression(); - - $oldFilter = $this->filterFunction; - if ($expr) { - $visitor = new ClosureExpressionVisitor(); - $filter = $visitor->dispatch($expr); - $this->addFilter($filter); - } - - $filtered = $this->doInitializeByIterator($this->iterator, $this->nestingLimit); - $this->filterFunction = $oldFilter; - - if ($orderings = $criteria->getOrderings()) { - $next = null; - foreach (array_reverse($orderings) as $field => $ordering) { - $next = ClosureExpressionVisitor::sortByField($field, $ordering == Criteria::DESC ? -1 : 1, $next); - } - - uasort($filtered, $next); - } else { - ksort($filtered); - } - - $offset = $criteria->getFirstResult(); - $length = $criteria->getMaxResults(); - - if ($offset || $length) { - $filtered = array_slice($filtered, (int)$offset, $length); - } - - return new ArrayCollection($filtered); - } - - /** - * {@inheritDoc} - */ - protected function doInitialize() - { - $filtered = $this->doInitializeByIterator($this->iterator, $this->nestingLimit); - ksort($filtered); - - $this->collection = new ArrayCollection($filtered); - } - - protected function doInitializeByIterator(\SeekableIterator $iterator, $nestingLimit) - { - $children = []; - $objects = []; - $filter = $this->filterFunction; - $objectFunction = $this->createObjectFunction; - - /** @var \RecursiveDirectoryIterator $file */ - foreach ($iterator as $file) { - // Skip files if they shouldn't be included. - if (!($this->flags & static::INCLUDE_FILES) && $file->isFile()) { - continue; - } - - // Apply main filter. - if ($filter && !$filter($file)) { - continue; - } - - // Include children if the recursive flag is set. - if (($this->flags & static::RECURSIVE) && $nestingLimit > 0 && $file->hasChildren()) { - $children[] = $file->getChildren(); - } - - // Skip folders if they shouldn't be included. - if (!($this->flags & static::INCLUDE_FOLDERS) && $file->isDir()) { - continue; - } - - $object = $objectFunction($file); - $objects[$object->key] = $object; - } - - if ($children) { - $objects += $this->doInitializeChildren($children, $nestingLimit - 1); - } - - return $objects; - } - - /** - * @param \RecursiveDirectoryIterator[] $children - * @return array - */ - protected function doInitializeChildren(array $children, $nestingLimit) - { - $objects = []; - - foreach ($children as $iterator) { - $objects += $this->doInitializeByIterator($iterator, $nestingLimit); - } - - return $objects; - } - - /** - * @param \RecursiveDirectoryIterator $file - * @return object - */ - protected function createObject($file) - { - return (object) [ - 'key' => $file->getSubPathname(), - 'type' => $file->isDir() ? 'folder' : 'file:' . $file->getExtension(), - 'url' => method_exists($file, 'getUrl') ? $file->getUrl() : null, - 'pathname' => $file->getPathname(), - 'mtime' => $file->getMTime() - ]; - } } diff --git a/system/src/Grav/Framework/Collection/FileCollectionInterface.php b/system/src/Grav/Framework/Collection/FileCollectionInterface.php new file mode 100644 index 000000000..845c9890f --- /dev/null +++ b/system/src/Grav/Framework/Collection/FileCollectionInterface.php @@ -0,0 +1,28 @@ + Date: Fri, 8 Sep 2017 14:40:16 +0300 Subject: [PATCH 032/141] Code cleanup --- system/src/Grav/Common/Plugin.php | 17 ++++++++++------- system/src/Grav/Common/Uri.php | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/system/src/Grav/Common/Plugin.php b/system/src/Grav/Common/Plugin.php index dbf530891..fa9d1c3cf 100644 --- a/system/src/Grav/Common/Plugin.php +++ b/system/src/Grav/Common/Plugin.php @@ -90,7 +90,7 @@ class Plugin implements EventSubscriberInterface, \ArrayAccess /** * Get configuration of the plugin. * - * @return Config + * @return array */ public function config() { @@ -121,7 +121,7 @@ class Plugin implements EventSubscriberInterface, \ArrayAccess if (strpos($uri->path(), $this->config->get('plugins.admin.route') . '/' . $plugin_route) === false) { $should_run = false; - } elseif (isset($uri->paths()[1]) && $uri->paths()[1] == $plugin_route) { + } elseif (isset($uri->paths()[1]) && $uri->paths()[1] === $plugin_route) { $should_run = true; } @@ -207,6 +207,7 @@ class Plugin implements EventSubscriberInterface, \ArrayAccess * * @param mixed $offset The offset to assign the value to. * @param mixed $value The value to set. + * @throws LogicException */ public function offsetSet($offset, $value) { @@ -217,6 +218,7 @@ class Plugin implements EventSubscriberInterface, \ArrayAccess * Unsets an offset. * * @param mixed $offset The offset to unset. + * @throws LogicException */ public function offsetUnset($offset) { @@ -299,13 +301,14 @@ class Plugin implements EventSubscriberInterface, \ArrayAccess */ private function mergeArrays($deep = false, $array1, $array2) { - if ($deep == 'merge') { + if ($deep === 'merge') { return Utils::arrayMergeRecursiveUnique($array1, $array2); - } elseif ($deep === true) { - return array_replace_recursive($array1, $array2); - } else { - return array_merge($array1, $array2); } + if ($deep === true) { + return array_replace_recursive($array1, $array2); + } + + return array_merge($array1, $array2); } /** diff --git a/system/src/Grav/Common/Uri.php b/system/src/Grav/Common/Uri.php index 45daf1a04..297afe2ca 100644 --- a/system/src/Grav/Common/Uri.php +++ b/system/src/Grav/Common/Uri.php @@ -441,7 +441,7 @@ class Uri * @param string $id Optional parameter name. * @param boolean $array return the array format or not * - * @return null|string + * @return null|string|array */ public function params($id = null, $array = false) { From 8c3210332e8bfd32db0e12e1aabddb6ff170291d Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 8 Sep 2017 14:44:37 +0300 Subject: [PATCH 033/141] Add `ArrayObject` and make `Object` not to implement `ArrayAccess` interface. Remove Toolbox dependency. --- .../src/Grav/Framework/Object/ArrayObject.php | 69 ++++++ system/src/Grav/Framework/Object/Object.php | 216 +++++++++++++++--- .../Framework/Object/ObjectCollection.php | 8 +- .../Object/ObjectCollectionInterface.php | 6 +- .../Object/ObjectCollectionTrait.php | 15 +- .../Grav/Framework/Object/ObjectInterface.php | 20 +- .../src/Grav/Framework/Object/ObjectTrait.php | 20 +- 7 files changed, 316 insertions(+), 38 deletions(-) create mode 100644 system/src/Grav/Framework/Object/ArrayObject.php diff --git a/system/src/Grav/Framework/Object/ArrayObject.php b/system/src/Grav/Framework/Object/ArrayObject.php new file mode 100644 index 000000000..d7dfbb881 --- /dev/null +++ b/system/src/Grav/Framework/Object/ArrayObject.php @@ -0,0 +1,69 @@ +getProperty($offset, $test) !== $test; + } + + return $this->__isset($offset); + } + + /** + * Returns the value at specified offset. + * + * @param mixed $offset The offset to retrieve. + * @return mixed Can return all value types. + */ + public function offsetGet($offset) + { + return $this->getProperty($offset); + } + + /** + * Assigns a value to the specified offset. + * + * @param mixed $offset The offset to assign the value to. + * @param mixed $value The value to set. + */ + public function offsetSet($offset, $value) + { + $this->setProperty($offset, $value); + } + + /** + * Unsets an offset. + * + * @param mixed $offset The offset to unset. + */ + public function offsetUnset($offset) + { + if (strpos($offset, '.') !== false) { + $this->setProperty($offset, null); + } else { + $this->__unset($offset); + } + } +} diff --git a/system/src/Grav/Framework/Object/Object.php b/system/src/Grav/Framework/Object/Object.php index fbbdab919..cec2dfdbe 100644 --- a/system/src/Grav/Framework/Object/Object.php +++ b/system/src/Grav/Framework/Object/Object.php @@ -8,9 +8,6 @@ namespace Grav\Framework\Object; -use RocketTheme\Toolbox\ArrayTraits\Export; -use RocketTheme\Toolbox\ArrayTraits\NestedArrayAccessWithGetters; - /** * Object class. * @@ -18,10 +15,126 @@ use RocketTheme\Toolbox\ArrayTraits\NestedArrayAccessWithGetters; */ class Object implements ObjectInterface { - use ObjectTrait, NestedArrayAccessWithGetters, Export { - NestedArrayAccessWithGetters::offsetExists as private parentOffsetExists; - NestedArrayAccessWithGetters::offsetGet as private parentOffsetGet; - NestedArrayAccessWithGetters::offsetSet as private parentOffsetSet; + use ObjectTrait; + + static protected $prefix = 'o.'; + static protected $type; + + /** + * Get value by using dot notation for nested arrays/objects. + * + * @example $value = $this->get('this.is.my.nested.variable'); + * + * @param string $name Dot separated path to the requested value. + * @param mixed $default Default value (or null). + * @param string $separator Separator, defaults to '.' + * @return mixed Value. + */ + public function getProperty($name, $default = null, $separator = '.') + { + $path = explode($separator, $name); + $offset = array_shift($path); + $current = $this->__get($offset); + + do { + // We are done: return current variable. + if (empty($path)) { + return $current; + } + + // Get property of nested Object. + if ($current instanceof Object) { + return $current->getProperty(implode($separator, $path), $default, $separator); + } + + $offset = array_shift($path); + + if ((is_array($current) || is_a($current, 'ArrayAccess')) && isset($current[$offset])) { + $current = $current[$offset]; + } elseif (is_object($current) && isset($current->{$offset})) { + $current = $current->{$offset}; + } else { + return $default; + } + } while ($path); + + return $current; + } + + /** + * Set value by using dot notation for nested arrays/objects. + * + * @example $data->set('this.is.my.nested.variable', $value); + * + * @param string $name Dot separated path to the requested value. + * @param mixed $value New value. + * @param string $separator Separator, defaults to '.' + * @return $this + */ + public function setProperty($name, $value, $separator = '.') + { + $path = explode($separator, $name); + $offset = array_shift($path); + + // Set simple variable. + if (empty($path)) { + $this->__set($offset, $value); + + return $this; + } + + $current = &$this->getRef($offset, true); + + do { + // Set property of nested Object. + if ($current instanceof Object) { + $current->setProperty(implode($separator, $path), $value, $separator); + + return $this; + } + + $offset = array_shift($path); + + if (is_object($current)) { + // Handle objects. + if (!isset($current->{$offset})) { + $current->{$offset} = []; + } + $current = &$current->{$offset}; + } else { + // Handle arrays and scalars. + if (!is_array($current)) { + $current = [$offset => []]; + } elseif (!isset($current[$offset])) { + $current[$offset] = []; + } + $current = &$current[$offset]; + } + } while ($path); + + $current = $value; + + return $this; + } + + /** + * Define value by using dot notation for nested arrays/objects. + * + * @example $data->defProperty('this.is.my.nested.variable', $value); + * + * @param string $name Dot separated path to the requested value. + * @param mixed $value New value. + * @param string $separator Separator, defaults to '.' + * @return $this + */ + public function defProperty($name, $value, $separator = '.') + { + $test = new \stdClass; + if ($this->getProperty($name, $test, $separator) === $test) { + $this->setProperty($name, $value, $separator); + } + + return $this; } /** @@ -30,11 +143,9 @@ class Object implements ObjectInterface * @param mixed $offset An offset to check for. * @return bool Returns TRUE on success or FALSE on failure. */ - public function offsetExists($offset) + public function __isset($offset) { - $methodName = "offsetLoad_{$offset}"; - - return $this->parentOffsetExists($offset) || method_exists($this, $methodName); + return array_key_exists($offset, $this->items) || $this->isPropertyDefined($offset); } /** @@ -43,18 +154,11 @@ class Object implements ObjectInterface * @param mixed $offset The offset to retrieve. * @return mixed Can return all value types. */ - public function offsetGet($offset) + public function __get($offset) { - $methodName = "offsetLoad_{$offset}"; - - if (!$this->parentOffsetExists($offset) && method_exists($this, $methodName)) { - $this->offsetSet($offset, $this->{$methodName}()); - } - - return $this->parentOffsetGet($offset); + return $this->getRef($offset); } - /** * Assigns a value to the specified offset with a possibility to check or alter the value by * $this->offsetPrepare_{$offset}(). @@ -62,15 +166,41 @@ class Object implements ObjectInterface * @param mixed $offset The offset to assign the value to. * @param mixed $value The value to set. */ - public function offsetSet($offset, $value) + public function __set($offset, $value) { - $methodName = "offsetPrepare_{$offset}"; + if ($this->isPropertyDefined($offset)) { + $methodName = "offsetPrepare_{$offset}"; - if (method_exists($this, $methodName)) { - $value = $this->{$methodName}($value); + if (method_exists($this, $methodName)) { + $this->{$offset} = $this->{$methodName}($value); + } } - $this->parentOffsetSet($offset, $value); + $this->items[$offset] = $value; + } + + /** + * Magic method to unset the attribute + * + * @param mixed $offset The name value to unset + */ + public function __unset($offset) + { + if ($this->isPropertyDefined($offset)) { + $this->{$offset} = null; + } else { + unset($this->items[$offset]); + } + } + + /** + * Convert object into an array. + * + * @return array + */ + protected function toArray() + { + return $this->items; } /** @@ -80,6 +210,40 @@ class Object implements ObjectInterface */ public function jsonSerialize() { - return ['key' => $this->getKey(), 'object' => $this->toArray()]; + return [ + 'key' => $this->getKey(), + 'type' => $this->getType(true), + 'object' => $this->toArray() + ]; + } + + protected function &getRef($offset, $new = false) + { + if ($this->isPropertyDefined($offset)) { + if ($this->{$offset} === null) { + $methodName = "offsetLoad_{$offset}"; + + if (method_exists($this, $methodName)) { + $this->{$offset} = $this->{$methodName}(); + } + } + + return $this->{$offset}; + } + + if (!isset($this->items[$offset])) { + if (!$new) { + $null = null; + return $null; + } + $this->items[$offset] = []; + } + + return $this->items[$offset]; + } + + protected function isPropertyDefined($offset) + { + return array_key_exists($offset, get_object_vars($this)); } } diff --git a/system/src/Grav/Framework/Object/ObjectCollection.php b/system/src/Grav/Framework/Object/ObjectCollection.php index 81fa198a1..7ac1e1e53 100644 --- a/system/src/Grav/Framework/Object/ObjectCollection.php +++ b/system/src/Grav/Framework/Object/ObjectCollection.php @@ -18,6 +18,8 @@ class ObjectCollection extends ArrayCollection implements ObjectCollectionInterf { use ObjectCollectionTrait; + static protected $prefix = 'c.'; + /** * @param array $elements * @param string $key @@ -27,7 +29,11 @@ class ObjectCollection extends ArrayCollection implements ObjectCollectionInterf { parent::__construct($elements); - $this->key = $key ?: $this->getKey() ?: __CLASS__ . '@' . spl_object_hash($this); + $this->key = $key !== null ? $key : (string) $this; + + if ($this->key === null) { + throw new \InvalidArgumentException('Object cannot be created without assigning a key to it'); + } } /** diff --git a/system/src/Grav/Framework/Object/ObjectCollectionInterface.php b/system/src/Grav/Framework/Object/ObjectCollectionInterface.php index c4764ea1a..94aa36c0c 100644 --- a/system/src/Grav/Framework/Object/ObjectCollectionInterface.php +++ b/system/src/Grav/Framework/Object/ObjectCollectionInterface.php @@ -36,14 +36,14 @@ interface ObjectCollectionInterface extends CollectionInterface, ObjectInterface /** * @param string $property Object property to be fetched. - * @return array Values of the property. + * @param mixed $default Default value if not set. + * @return array Property value. */ - public function getProperty($property); + public function getProperty($property, $default = null); /** * @param string $property Object property to be updated. * @param string $value New value. - * @return $this */ public function setProperty($property, $value); diff --git a/system/src/Grav/Framework/Object/ObjectCollectionTrait.php b/system/src/Grav/Framework/Object/ObjectCollectionTrait.php index 52d8e592c..8c9f05edc 100644 --- a/system/src/Grav/Framework/Object/ObjectCollectionTrait.php +++ b/system/src/Grav/Framework/Object/ObjectCollectionTrait.php @@ -46,14 +46,16 @@ trait ObjectCollectionTrait /** * @param string $property Object property to be fetched. + * @param mixed $default Default value if not set. * @return array Key/Value pairs of the properties. */ - public function getProperty($property) + public function getProperty($property, $default = null) { $list = []; + /** @var ObjectInterface $element */ foreach ($this as $id => $element) { - $list[$id] = isset($element[$property]) ? $element[$property] : null; + $list[$id] = $element->getProperty($property, $default); } return $list; @@ -62,12 +64,16 @@ trait ObjectCollectionTrait /** * @param string $property Object property to be updated. * @param string $value New value. + * @return $this */ public function setProperty($property, $value) { + /** @var ObjectInterface $element */ foreach ($this as $element) { - $element[$property] = $value; + $element->setProperty($property, $value); } + + return $this; } /** @@ -98,8 +104,9 @@ trait ObjectCollectionTrait { $list = []; + /** @var ObjectInterface $element */ foreach ($this as $element) { - $list[$element[$property]][] = $element; + $list[(string) $element->getProperty($property)][] = $element; } return $list; diff --git a/system/src/Grav/Framework/Object/ObjectInterface.php b/system/src/Grav/Framework/Object/ObjectInterface.php index 26c7a27b7..d67c33339 100644 --- a/system/src/Grav/Framework/Object/ObjectInterface.php +++ b/system/src/Grav/Framework/Object/ObjectInterface.php @@ -12,7 +12,7 @@ namespace Grav\Framework\Object; * Object Interface * @package Grav\Framework\Object */ -interface ObjectInterface extends \ArrayAccess, \JsonSerializable +interface ObjectInterface extends \JsonSerializable { /** * @param array $elements @@ -20,8 +20,26 @@ interface ObjectInterface extends \ArrayAccess, \JsonSerializable */ public function __construct(array $elements = [], $key = null); + /** + * @return string + */ + public function getType(); + /** * @return string */ public function getKey(); + + /** + * @param string $property Object property to be fetched. + * @param mixed $default Default value if not set. + * @return mixed Property value. + */ + public function getProperty($property, $default = null); + + /** + * @param string $property Object property to be updated. + * @param string $value New value. + */ + public function setProperty($property, $value); } diff --git a/system/src/Grav/Framework/Object/ObjectTrait.php b/system/src/Grav/Framework/Object/ObjectTrait.php index 1c353eb58..001d53ffa 100644 --- a/system/src/Grav/Framework/Object/ObjectTrait.php +++ b/system/src/Grav/Framework/Object/ObjectTrait.php @@ -35,13 +35,27 @@ trait ObjectTrait { $this->items = $elements; - $this->key = $key !== null ? $key : $this->getKey(); + $this->key = $key !== null ? $key : (string) $this; if ($this->key === null) { - throw new \InvalidArgumentException('Object cannot be created without assigning a key'); + throw new \InvalidArgumentException('Object cannot be created without assigning a key to it'); } } + /** + * @param bool $prefix + * @return string + */ + public function getType($prefix = false) + { + if (static::$type) { + return ($prefix ? static::$prefix : '') . static::$type; + } + + $class = get_class($this); + return ($prefix ? static::$prefix : '') . strtolower(substr($class, strrpos($class, '\\') + 1)); + } + /** * @return string */ @@ -57,6 +71,6 @@ trait ObjectTrait */ public function __toString() { - return __CLASS__ . '@' . spl_object_hash($this); + return $this->getKey() ?: $this->getType() . '@' . spl_object_hash($this); } } From 62389975a2ec6b36ee9f0bcac05a3a5b8dcce9e4 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 8 Sep 2017 15:50:05 +0300 Subject: [PATCH 034/141] Object code cleanup --- system/src/Grav/Common/GravTrait.php | 2 +- .../src/Grav/Framework/Object/ArrayObject.php | 2 +- system/src/Grav/Framework/Object/Object.php | 34 ++++++------------- .../Framework/Object/ObjectCollection.php | 10 ------ .../Object/ObjectCollectionInterface.php | 6 ---- .../Object/ObjectCollectionTrait.php | 30 +++++++++++++--- .../Grav/Framework/Object/ObjectInterface.php | 12 +++++-- .../src/Grav/Framework/Object/ObjectTrait.php | 12 ++++++- 8 files changed, 58 insertions(+), 50 deletions(-) diff --git a/system/src/Grav/Common/GravTrait.php b/system/src/Grav/Common/GravTrait.php index 99848d224..ea2f7e052 100644 --- a/system/src/Grav/Common/GravTrait.php +++ b/system/src/Grav/Common/GravTrait.php @@ -9,7 +9,7 @@ namespace Grav\Common; /** - * @deprecated in Grav 2.0 + * @deprecated 2.0 */ trait GravTrait { diff --git a/system/src/Grav/Framework/Object/ArrayObject.php b/system/src/Grav/Framework/Object/ArrayObject.php index d7dfbb881..dae0d00de 100644 --- a/system/src/Grav/Framework/Object/ArrayObject.php +++ b/system/src/Grav/Framework/Object/ArrayObject.php @@ -9,7 +9,7 @@ namespace Grav\Framework\Object; /** - * Object class. + * ArrayObject class. * * @package Grav\Framework\Object */ diff --git a/system/src/Grav/Framework/Object/Object.php b/system/src/Grav/Framework/Object/Object.php index cec2dfdbe..fa08b2c0b 100644 --- a/system/src/Grav/Framework/Object/Object.php +++ b/system/src/Grav/Framework/Object/Object.php @@ -25,14 +25,14 @@ class Object implements ObjectInterface * * @example $value = $this->get('this.is.my.nested.variable'); * - * @param string $name Dot separated path to the requested value. + * @param string $property Dot separated path to the requested value. * @param mixed $default Default value (or null). * @param string $separator Separator, defaults to '.' * @return mixed Value. */ - public function getProperty($name, $default = null, $separator = '.') + public function getProperty($property, $default = null, $separator = '.') { - $path = explode($separator, $name); + $path = explode($separator, $property); $offset = array_shift($path); $current = $this->__get($offset); @@ -66,14 +66,14 @@ class Object implements ObjectInterface * * @example $data->set('this.is.my.nested.variable', $value); * - * @param string $name Dot separated path to the requested value. + * @param string $property Dot separated path to the requested value. * @param mixed $value New value. * @param string $separator Separator, defaults to '.' * @return $this */ - public function setProperty($name, $value, $separator = '.') + public function setProperty($property, $value, $separator = '.') { - $path = explode($separator, $name); + $path = explode($separator, $property); $offset = array_shift($path); // Set simple variable. @@ -122,16 +122,16 @@ class Object implements ObjectInterface * * @example $data->defProperty('this.is.my.nested.variable', $value); * - * @param string $name Dot separated path to the requested value. + * @param string $property Dot separated path to the requested value. * @param mixed $value New value. * @param string $separator Separator, defaults to '.' * @return $this */ - public function defProperty($name, $value, $separator = '.') + public function defProperty($property, $value, $separator = '.') { $test = new \stdClass; - if ($this->getProperty($name, $test, $separator) === $test) { - $this->setProperty($name, $value, $separator); + if ($this->getProperty($property, $test, $separator) === $test) { + $this->setProperty($property, $value, $separator); } return $this; @@ -203,20 +203,6 @@ class Object implements ObjectInterface return $this->items; } - /** - * Implements JsonSerializable interface. - * - * @return array - */ - public function jsonSerialize() - { - return [ - 'key' => $this->getKey(), - 'type' => $this->getType(true), - 'object' => $this->toArray() - ]; - } - protected function &getRef($offset, $new = false) { if ($this->isPropertyDefined($offset)) { diff --git a/system/src/Grav/Framework/Object/ObjectCollection.php b/system/src/Grav/Framework/Object/ObjectCollection.php index 7ac1e1e53..85ea126aa 100644 --- a/system/src/Grav/Framework/Object/ObjectCollection.php +++ b/system/src/Grav/Framework/Object/ObjectCollection.php @@ -46,14 +46,4 @@ class ObjectCollection extends ArrayCollection implements ObjectCollectionInterf return $this; } - - /** - * Implements JsonSerializable interface. - * - * @return array - */ - public function jsonSerialize() - { - return ['key' => $this->getKey(), 'objects' => $this->toArray()]; - } } diff --git a/system/src/Grav/Framework/Object/ObjectCollectionInterface.php b/system/src/Grav/Framework/Object/ObjectCollectionInterface.php index 94aa36c0c..d2e1e5b7e 100644 --- a/system/src/Grav/Framework/Object/ObjectCollectionInterface.php +++ b/system/src/Grav/Framework/Object/ObjectCollectionInterface.php @@ -41,12 +41,6 @@ interface ObjectCollectionInterface extends CollectionInterface, ObjectInterface */ public function getProperty($property, $default = null); - /** - * @param string $property Object property to be updated. - * @param string $value New value. - */ - public function setProperty($property, $value); - /** * @param string $name Method name. * @param array $arguments List of arguments passed to the function. diff --git a/system/src/Grav/Framework/Object/ObjectCollectionTrait.php b/system/src/Grav/Framework/Object/ObjectCollectionTrait.php index 8c9f05edc..c2e3df4ed 100644 --- a/system/src/Grav/Framework/Object/ObjectCollectionTrait.php +++ b/system/src/Grav/Framework/Object/ObjectCollectionTrait.php @@ -24,7 +24,7 @@ trait ObjectCollectionTrait public function copy() { $list = []; - foreach ($this as $key => $value) { + foreach ($this->getIterator() as $key => $value) { $list[$key] = is_object($value) ? clone $value : $value; } @@ -54,7 +54,7 @@ trait ObjectCollectionTrait $list = []; /** @var ObjectInterface $element */ - foreach ($this as $id => $element) { + foreach ($this->getIterator() as $id => $element) { $list[$id] = $element->getProperty($property, $default); } @@ -69,13 +69,28 @@ trait ObjectCollectionTrait public function setProperty($property, $value) { /** @var ObjectInterface $element */ - foreach ($this as $element) { + foreach ($this->getIterator() as $element) { $element->setProperty($property, $value); } return $this; } + /** + * @param string $property Object property to be updated. + * @param string $value New value. + * @return $this + */ + public function defProperty($property, $value) + { + /** @var ObjectInterface $element */ + foreach ($this->getIterator() as $element) { + $element->defProperty($property, $value); + } + + return $this; + } + /** * @param string $method Method name. * @param array $arguments List of arguments passed to the function. @@ -85,7 +100,7 @@ trait ObjectCollectionTrait { $list = []; - foreach ($this as $id => $element) { + foreach ($this->getIterator() as $id => $element) { $list[$id] = method_exists($element, $method) ? call_user_func_array([$element, $method], $arguments) : null; } @@ -105,10 +120,15 @@ trait ObjectCollectionTrait $list = []; /** @var ObjectInterface $element */ - foreach ($this as $element) { + foreach ($this->getIterator() as $element) { $list[(string) $element->getProperty($property)][] = $element; } return $list; } + + /** + * @return \Traversable + */ + abstract public function getIterator(); } diff --git a/system/src/Grav/Framework/Object/ObjectInterface.php b/system/src/Grav/Framework/Object/ObjectInterface.php index d67c33339..106fa26e4 100644 --- a/system/src/Grav/Framework/Object/ObjectInterface.php +++ b/system/src/Grav/Framework/Object/ObjectInterface.php @@ -38,8 +38,16 @@ interface ObjectInterface extends \JsonSerializable public function getProperty($property, $default = null); /** - * @param string $property Object property to be updated. - * @param string $value New value. + * @param string $property Object property to be updated. + * @param string $value New value. + * @return $this */ public function setProperty($property, $value); + + /** + * @param string $property Object property to be defined. + * @param mixed $value Default value. + * @return $this + */ + public function defProperty($property, $value); } diff --git a/system/src/Grav/Framework/Object/ObjectTrait.php b/system/src/Grav/Framework/Object/ObjectTrait.php index 001d53ffa..7292e5158 100644 --- a/system/src/Grav/Framework/Object/ObjectTrait.php +++ b/system/src/Grav/Framework/Object/ObjectTrait.php @@ -46,7 +46,7 @@ trait ObjectTrait * @param bool $prefix * @return string */ - public function getType($prefix = false) + public function getType($prefix = true) { if (static::$type) { return ($prefix ? static::$prefix : '') . static::$type; @@ -64,6 +64,16 @@ trait ObjectTrait return $this->key; } + /** + * Implements JsonSerializable interface. + * + * @return array + */ + public function jsonSerialize() + { + return ['key' => (string) $this, 'type' => $this->getType(), 'elements' => $this->toArray()]; + } + /** * Returns a string representation of this object. * From 23592b8a765381fd5f2ee63bbf808824607bd5cc Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Wed, 13 Sep 2017 09:50:34 +0300 Subject: [PATCH 035/141] Major update on Object classes (backwards incompatible) --- .../Object/Access/ArrayAccessTrait.php | 64 +++++ .../Object/Access/NestedArrayAccessTrait.php | 64 +++++ .../Access/NestedPropertyCollectionTrait.php | 124 +++++++++ .../Object/Access/NestedPropertyTrait.php | 179 +++++++++++++ .../Object/Access/OverloadedPropertyTrait.php | 64 +++++ .../src/Grav/Framework/Object/ArrayObject.php | 63 +---- .../{ => Base}/ObjectCollectionTrait.php | 48 +++- .../Framework/Object/Base/ObjectTrait.php | 167 +++++++++++++ .../Interfaces/NestedObjectInterface.php | 57 +++++ .../ObjectCollectionInterface.php | 2 +- .../{ => Interfaces}/ObjectInterface.php | 22 +- .../src/Grav/Framework/Object/LazyObject.php | 26 ++ system/src/Grav/Framework/Object/Object.php | 235 ------------------ .../Framework/Object/ObjectCollection.php | 33 ++- .../src/Grav/Framework/Object/ObjectTrait.php | 86 ------- .../Object/Property/ArrayPropertyTrait.php | 96 +++++++ .../Object/Property/LazyPropertyTrait.php | 92 +++++++ .../Object/Property/MixedPropertyTrait.php | 97 ++++++++ .../Object/Property/ObjectPropertyTrait.php | 151 +++++++++++ .../Grav/Framework/Object/PropertyObject.php | 26 ++ 20 files changed, 1292 insertions(+), 404 deletions(-) create mode 100644 system/src/Grav/Framework/Object/Access/ArrayAccessTrait.php create mode 100644 system/src/Grav/Framework/Object/Access/NestedArrayAccessTrait.php create mode 100644 system/src/Grav/Framework/Object/Access/NestedPropertyCollectionTrait.php create mode 100644 system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php create mode 100644 system/src/Grav/Framework/Object/Access/OverloadedPropertyTrait.php rename system/src/Grav/Framework/Object/{ => Base}/ObjectCollectionTrait.php (71%) create mode 100644 system/src/Grav/Framework/Object/Base/ObjectTrait.php create mode 100644 system/src/Grav/Framework/Object/Interfaces/NestedObjectInterface.php rename system/src/Grav/Framework/Object/{ => Interfaces}/ObjectCollectionInterface.php (96%) rename system/src/Grav/Framework/Object/{ => Interfaces}/ObjectInterface.php (61%) create mode 100644 system/src/Grav/Framework/Object/LazyObject.php delete mode 100644 system/src/Grav/Framework/Object/Object.php delete mode 100644 system/src/Grav/Framework/Object/ObjectTrait.php create mode 100644 system/src/Grav/Framework/Object/Property/ArrayPropertyTrait.php create mode 100644 system/src/Grav/Framework/Object/Property/LazyPropertyTrait.php create mode 100644 system/src/Grav/Framework/Object/Property/MixedPropertyTrait.php create mode 100644 system/src/Grav/Framework/Object/Property/ObjectPropertyTrait.php create mode 100644 system/src/Grav/Framework/Object/PropertyObject.php diff --git a/system/src/Grav/Framework/Object/Access/ArrayAccessTrait.php b/system/src/Grav/Framework/Object/Access/ArrayAccessTrait.php new file mode 100644 index 000000000..e22251d88 --- /dev/null +++ b/system/src/Grav/Framework/Object/Access/ArrayAccessTrait.php @@ -0,0 +1,64 @@ +hasProperty($offset); + } + + /** + * Returns the value at specified offset. + * + * @param mixed $offset The offset to retrieve. + * @return mixed Can return all value types. + */ + public function offsetGet($offset) + { + return $this->getProperty($offset); + } + + /** + * Assigns a value to the specified offset. + * + * @param mixed $offset The offset to assign the value to. + * @param mixed $value The value to set. + */ + public function offsetSet($offset, $value) + { + $this->setProperty($offset, $value); + } + + /** + * Unsets an offset. + * + * @param mixed $offset The offset to unset. + */ + public function offsetUnset($offset) + { + $this->unsetProperty($offset); + } + + abstract public function hasProperty($property); + abstract public function getProperty($property, $default = null); + abstract public function setProperty($property, $value); + abstract public function unsetProperty($property); +} diff --git a/system/src/Grav/Framework/Object/Access/NestedArrayAccessTrait.php b/system/src/Grav/Framework/Object/Access/NestedArrayAccessTrait.php new file mode 100644 index 000000000..c5e8b1bdd --- /dev/null +++ b/system/src/Grav/Framework/Object/Access/NestedArrayAccessTrait.php @@ -0,0 +1,64 @@ +hasNestedProperty($offset); + } + + /** + * Returns the value at specified offset. + * + * @param mixed $offset The offset to retrieve. + * @return mixed Can return all value types. + */ + public function offsetGet($offset) + { + return $this->getNestedProperty($offset); + } + + /** + * Assigns a value to the specified offset. + * + * @param mixed $offset The offset to assign the value to. + * @param mixed $value The value to set. + */ + public function offsetSet($offset, $value) + { + $this->setNestedProperty($offset, $value); + } + + /** + * Unsets an offset. + * + * @param mixed $offset The offset to unset. + */ + public function offsetUnset($offset) + { + $this->unsetNestedProperty($offset); + } + + abstract public function hasNestedProperty($property, $separator = null); + abstract public function getNestedProperty($property, $default = null, $separator = null); + abstract public function setNestedProperty($property, $value, $separator = null); + abstract public function unsetNestedProperty($property, $separator = null); +} diff --git a/system/src/Grav/Framework/Object/Access/NestedPropertyCollectionTrait.php b/system/src/Grav/Framework/Object/Access/NestedPropertyCollectionTrait.php new file mode 100644 index 000000000..6e1d34ca1 --- /dev/null +++ b/system/src/Grav/Framework/Object/Access/NestedPropertyCollectionTrait.php @@ -0,0 +1,124 @@ +getIterator() as $id => $element) { + $list[$id] = $element->hasNestedProperty($property, $separator); + } + + return $list; + } + + /** + * @param string $property Object property to be fetched. + * @param mixed $default Default value if not set. + * @param string $separator Separator, defaults to '.' + * @return array Key/Value pairs of the properties. + */ + public function getNestedProperty($property, $default = null, $separator = null) + { + $list = []; + + /** @var NestedObjectInterface $element */ + foreach ($this->getIterator() as $id => $element) { + $list[$id] = $element->getNestedProperty($property, $default, $separator); + } + + return $list; + } + + /** + * @param string $property Object property to be updated. + * @param string $value New value. + * @param string $separator Separator, defaults to '.' + * @return $this + */ + public function setNestedProperty($property, $value, $separator = null) + { + /** @var NestedObjectInterface $element */ + foreach ($this->getIterator() as $element) { + $element->setNestedProperty($property, $value, $separator); + } + + return $this; + } + + /** + * @param string $property Object property to be updated. + * @param string $separator Separator, defaults to '.' + * @return $this + */ + public function unsetNestedProperty($property, $separator = null) + { + /** @var NestedObjectInterface $element */ + foreach ($this->getIterator() as $element) { + $element->unsetNestedProperty($property, $separator); + } + + return $this; + } + + /** + * @param string $property Object property to be updated. + * @param string $default Default value. + * @param string $separator Separator, defaults to '.' + * @return $this + */ + public function defNestedProperty($property, $default, $separator = null) + { + /** @var NestedObjectInterface $element */ + foreach ($this->getIterator() as $element) { + $element->defNestedProperty($property, $default, $separator); + } + + return $this; + } + + /** + * Group items in the collection by a field. + * + * @param string $property Object property to be used to make groups. + * @param string $separator Separator, defaults to '.' + * @return array + */ + public function group($property, $separator = null) + { + $list = []; + + /** @var NestedObjectInterface $element */ + foreach ($this->getIterator() as $element) { + $list[(string) $element->getNestedProperty($property, null, $separator)][] = $element; + } + + return $list; + } + + /** + * @return \Traversable + */ + abstract public function getIterator(); +} diff --git a/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php b/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php new file mode 100644 index 000000000..62f63fd42 --- /dev/null +++ b/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php @@ -0,0 +1,179 @@ +getNestedProperty($property, $test, $separator) !== $test; + } + + /** + * @param string $property Object property to be fetched. + * @param mixed $default Default value if property has not been set. + * @param string $separator Separator, defaults to '.' + * @return mixed Property value. + */ + public function getNestedProperty($property, $default = null, $separator = null) + { + $path = explode($separator ?: '.', $property); + $offset = array_shift($path); + + if (!$this->hasProperty($offset)) { + return $default; + } + + $current = $this->getProperty($offset); + + while ($path) { + // Get property of nested Object. + if ($current instanceof ObjectInterface) { + if (method_exists($current, 'getNestedProperty')) { + return $current->getNestedProperty(implode($separator, $path), $default, $separator); + } + return $current->getProperty(implode($separator, $path), $default); + } + + $offset = array_shift($path); + + if ((is_array($current) || is_a($current, 'ArrayAccess')) && isset($current[$offset])) { + $current = $current[$offset]; + } elseif (is_object($current) && isset($current->{$offset})) { + $current = $current->{$offset}; + } else { + return $default; + } + }; + + return $current; + } + + + /** + * @param string $property Object property to be updated. + * @param string $value New value. + * @param string $separator Separator, defaults to '.' + * @return $this + * @throws \RuntimeException + */ + public function setNestedProperty($property, $value, $separator = null) + { + $path = explode($separator ?: '.', $property); + $offset = array_shift($path); + + if (!$path) { + $this->setProperty($offset, $value); + + return $this; + } + + $current = &$this->doGetProperty($offset, null, true); + + while ($path) { + $offset = array_shift($path); + + // Handle arrays and scalars. + if ($current === null) { + $current = [$offset => []]; + } elseif (is_array($current)) { + if (!isset($current[$offset])) { + $current[$offset] = []; + } + } else { + throw new \RuntimeException('Cannot set nested property on non-array value'); + } + + $current = &$current[$offset]; + }; + + $current = $value; + + return $this; + } + + /** + * @param string $property Object property to be updated. + * @param string $separator Separator, defaults to '.' + * @return $this + * @throws \RuntimeException + */ + public function unsetNestedProperty($property, $separator = null) + { + $path = explode($separator ?: '.', $property); + $offset = array_shift($path); + + if (!$path) { + $this->unsetProperty($offset); + + return $this; + } + + $last = array_pop($path); + $current = &$this->doGetProperty($offset, null, true); + + while ($path) { + $offset = array_shift($path); + + // Handle arrays and scalars. + if ($current === null) { + return $this; + } + if (is_array($current)) { + if (!isset($current[$offset])) { + return $this; + } + } else { + throw new \RuntimeException('Cannot set nested property on non-array value'); + } + + $current = &$current[$offset]; + }; + + unset($current[$last]); + + return $this; + } + + /** + * @param string $property Object property to be updated. + * @param string $default Default value. + * @param string $separator Separator, defaults to '.' + * @return $this + * @throws \RuntimeException + */ + public function defNestedProperty($property, $default, $separator = null) + { + if (!$this->hasNestedProperty($property, $separator)) { + $this->setNestedProperty($property, $default, $separator); + } + + return $this; + } + + + abstract public function hasProperty($property); + abstract public function getProperty($property, $default = null); + abstract public function setProperty($property, $value); + abstract public function unsetProperty($property); + abstract protected function &doGetProperty($property, $default = null, $doCreate = false); +} diff --git a/system/src/Grav/Framework/Object/Access/OverloadedPropertyTrait.php b/system/src/Grav/Framework/Object/Access/OverloadedPropertyTrait.php new file mode 100644 index 000000000..596c799f8 --- /dev/null +++ b/system/src/Grav/Framework/Object/Access/OverloadedPropertyTrait.php @@ -0,0 +1,64 @@ +hasProperty($offset); + } + + /** + * Returns the value at specified offset. + * + * @param mixed $offset The offset to retrieve. + * @return mixed Can return all value types. + */ + public function __get($offset) + { + return $this->getProperty($offset); + } + + /** + * Assigns a value to the specified offset. + * + * @param mixed $offset The offset to assign the value to. + * @param mixed $value The value to set. + */ + public function __set($offset, $value) + { + $this->setProperty($offset, $value); + } + + /** + * Magic method to unset the attribute + * + * @param mixed $offset The name value to unset + */ + public function __unset($offset) + { + $this->unsetProperty($offset); + } + + abstract public function hasProperty($property); + abstract public function getProperty($property, $default = null); + abstract public function setProperty($property, $value); + abstract public function unsetProperty($property); +} diff --git a/system/src/Grav/Framework/Object/ArrayObject.php b/system/src/Grav/Framework/Object/ArrayObject.php index dae0d00de..583ed3849 100644 --- a/system/src/Grav/Framework/Object/ArrayObject.php +++ b/system/src/Grav/Framework/Object/ArrayObject.php @@ -8,62 +8,19 @@ namespace Grav\Framework\Object; +use Grav\Framework\Object\Access\NestedPropertyTrait; +use Grav\Framework\Object\Access\OverloadedPropertyTrait; +use Grav\Framework\Object\Base\ObjectTrait; +use Grav\Framework\Object\Interfaces\NestedObjectInterface; +use Grav\Framework\Object\Property\ArrayPropertyTrait; +use RocketTheme\Toolbox\ArrayTraits\NestedArrayAccess; + /** - * ArrayObject class. + * Array Object class. * * @package Grav\Framework\Object */ -class ArrayObject extends Object implements \ArrayAccess +class ArrayObject implements NestedObjectInterface, \ArrayAccess { - /** - * Whether or not an offset exists. - * - * @param mixed $offset An offset to check for. - * @return bool Returns TRUE on success or FALSE on failure. - */ - public function offsetExists($offset) - { - if (strpos($offset, '.') !== false) { - $test = new \stdClass(); - return $this->getProperty($offset, $test) !== $test; - } - - return $this->__isset($offset); - } - - /** - * Returns the value at specified offset. - * - * @param mixed $offset The offset to retrieve. - * @return mixed Can return all value types. - */ - public function offsetGet($offset) - { - return $this->getProperty($offset); - } - - /** - * Assigns a value to the specified offset. - * - * @param mixed $offset The offset to assign the value to. - * @param mixed $value The value to set. - */ - public function offsetSet($offset, $value) - { - $this->setProperty($offset, $value); - } - - /** - * Unsets an offset. - * - * @param mixed $offset The offset to unset. - */ - public function offsetUnset($offset) - { - if (strpos($offset, '.') !== false) { - $this->setProperty($offset, null); - } else { - $this->__unset($offset); - } - } + use ObjectTrait, ArrayPropertyTrait, NestedPropertyTrait, OverloadedPropertyTrait, NestedArrayAccess; } diff --git a/system/src/Grav/Framework/Object/ObjectCollectionTrait.php b/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php similarity index 71% rename from system/src/Grav/Framework/Object/ObjectCollectionTrait.php rename to system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php index c2e3df4ed..916502b67 100644 --- a/system/src/Grav/Framework/Object/ObjectCollectionTrait.php +++ b/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php @@ -6,7 +6,9 @@ * @license MIT License; see LICENSE file for details. */ -namespace Grav\Framework\Object; +namespace Grav\Framework\Object\Base; + +use Grav\Framework\Object\Interfaces\ObjectInterface; /** * ObjectCollection Trait @@ -14,7 +16,9 @@ namespace Grav\Framework\Object; */ trait ObjectCollectionTrait { - use ObjectTrait; + use ObjectTrait { + setKey as public; + } /** * Create a copy from this collection by cloning all objects in the collection. @@ -44,12 +48,28 @@ trait ObjectCollectionTrait return $this->call('getKey'); } + /** + * @param string $property Object property to be matched. + * @return array Key/Value pairs of the properties. + */ + public function doHasProperty($property) + { + $list = []; + + /** @var ObjectInterface $element */ + foreach ($this->getIterator() as $id => $element) { + $list[$id] = $element->hasProperty($property); + } + + return $list; + } + /** * @param string $property Object property to be fetched. * @param mixed $default Default value if not set. * @return array Key/Value pairs of the properties. */ - public function getProperty($property, $default = null) + public function doGetProperty($property, $default = null) { $list = []; @@ -66,7 +86,7 @@ trait ObjectCollectionTrait * @param string $value New value. * @return $this */ - public function setProperty($property, $value) + public function doSetProperty($property, $value) { /** @var ObjectInterface $element */ foreach ($this->getIterator() as $element) { @@ -78,14 +98,28 @@ trait ObjectCollectionTrait /** * @param string $property Object property to be updated. - * @param string $value New value. * @return $this */ - public function defProperty($property, $value) + public function doUnsetProperty($property) { /** @var ObjectInterface $element */ foreach ($this->getIterator() as $element) { - $element->defProperty($property, $value); + $element->unsetProperty($property); + } + + return $this; + } + + /** + * @param string $property Object property to be updated. + * @param string $default Default value. + * @return $this + */ + public function doDefProperty($property, $default) + { + /** @var ObjectInterface $element */ + foreach ($this->getIterator() as $element) { + $element->defProperty($property, $default); } return $this; diff --git a/system/src/Grav/Framework/Object/Base/ObjectTrait.php b/system/src/Grav/Framework/Object/Base/ObjectTrait.php new file mode 100644 index 000000000..5c2b7b4f7 --- /dev/null +++ b/system/src/Grav/Framework/Object/Base/ObjectTrait.php @@ -0,0 +1,167 @@ +_key ?: $this->getType() . '@' . spl_object_hash($this); + } + + /** + * @param string $property Object property name. + * @return bool True if property has been defined (can be null). + */ + public function hasProperty($property) + { + return $this->doHasProperty($property); + } + + /** + * @param string $property Object property to be fetched. + * @param mixed $default Default value if property has not been set. + * @return mixed Property value. + */ + public function getProperty($property, $default = null) + { + return $this->doGetProperty($property, $default); + } + + /** + * @param string $property Object property to be updated. + * @param string $value New value. + * @return $this + */ + public function setProperty($property, $value) + { + $this->doSetProperty($property, $value); + + return $this; + } + + /** + * @param string $property Object property to be unset. + * @return $this + */ + public function unsetProperty($property) + { + $this->doUnsetProperty($property); + + return $this; + } + + /** + * @param string $property Object property to be defined. + * @param mixed $default Default value. + * @return $this + */ + public function defProperty($property, $default) + { + if (!$this->hasProperty($property)) { + $this->setProperty($property, $default); + } + + return $this; + } + + /** + * Implements Serializable interface. + * + * @return string + */ + public function serialize() + { + return serialize($this->jsonSerialize()); + } + + /** + * @param string $serialized + */ + public function unserialize($serialized) + { + $data = unserialize($serialized); + + $this->doUnserialize($data); + } + + /** + * @param array $serialized + */ + protected function doUnserialize(array $serialized) + { + $this->setKey($serialized['key']); + $this->setElements($serialized['elements']); + } + + /** + * Implements JsonSerializable interface. + * + * @return array + */ + public function jsonSerialize() + { + return ['key' => $this->getKey(), 'type' => $this->getType(), 'elements' => $this->getElements()]; + } + + /** + * Returns a string representation of this object. + * + * @return string + */ + public function __toString() + { + return $this->getKey(); + } + + /** + * @param string $key + */ + protected function setKey($key) + { + $this->_key = (string) $key; + } + + abstract protected function doHasProperty($property); + abstract protected function &doGetProperty($property, $default = null, $doCreate = false); + abstract protected function doSetProperty($property, $value); + abstract protected function doUnsetProperty($property); + abstract protected function getElements(); + abstract protected function setElements(array $elements); +} diff --git a/system/src/Grav/Framework/Object/Interfaces/NestedObjectInterface.php b/system/src/Grav/Framework/Object/Interfaces/NestedObjectInterface.php new file mode 100644 index 000000000..889d35659 --- /dev/null +++ b/system/src/Grav/Framework/Object/Interfaces/NestedObjectInterface.php @@ -0,0 +1,57 @@ +get('this.is.my.nested.variable'); - * - * @param string $property Dot separated path to the requested value. - * @param mixed $default Default value (or null). - * @param string $separator Separator, defaults to '.' - * @return mixed Value. - */ - public function getProperty($property, $default = null, $separator = '.') - { - $path = explode($separator, $property); - $offset = array_shift($path); - $current = $this->__get($offset); - - do { - // We are done: return current variable. - if (empty($path)) { - return $current; - } - - // Get property of nested Object. - if ($current instanceof Object) { - return $current->getProperty(implode($separator, $path), $default, $separator); - } - - $offset = array_shift($path); - - if ((is_array($current) || is_a($current, 'ArrayAccess')) && isset($current[$offset])) { - $current = $current[$offset]; - } elseif (is_object($current) && isset($current->{$offset})) { - $current = $current->{$offset}; - } else { - return $default; - } - } while ($path); - - return $current; - } - - /** - * Set value by using dot notation for nested arrays/objects. - * - * @example $data->set('this.is.my.nested.variable', $value); - * - * @param string $property Dot separated path to the requested value. - * @param mixed $value New value. - * @param string $separator Separator, defaults to '.' - * @return $this - */ - public function setProperty($property, $value, $separator = '.') - { - $path = explode($separator, $property); - $offset = array_shift($path); - - // Set simple variable. - if (empty($path)) { - $this->__set($offset, $value); - - return $this; - } - - $current = &$this->getRef($offset, true); - - do { - // Set property of nested Object. - if ($current instanceof Object) { - $current->setProperty(implode($separator, $path), $value, $separator); - - return $this; - } - - $offset = array_shift($path); - - if (is_object($current)) { - // Handle objects. - if (!isset($current->{$offset})) { - $current->{$offset} = []; - } - $current = &$current->{$offset}; - } else { - // Handle arrays and scalars. - if (!is_array($current)) { - $current = [$offset => []]; - } elseif (!isset($current[$offset])) { - $current[$offset] = []; - } - $current = &$current[$offset]; - } - } while ($path); - - $current = $value; - - return $this; - } - - /** - * Define value by using dot notation for nested arrays/objects. - * - * @example $data->defProperty('this.is.my.nested.variable', $value); - * - * @param string $property Dot separated path to the requested value. - * @param mixed $value New value. - * @param string $separator Separator, defaults to '.' - * @return $this - */ - public function defProperty($property, $value, $separator = '.') - { - $test = new \stdClass; - if ($this->getProperty($property, $test, $separator) === $test) { - $this->setProperty($property, $value, $separator); - } - - return $this; - } - - /** - * Checks whether or not an offset exists with a possibility to load the field by $this->offsetLoad_{$offset}(). - * - * @param mixed $offset An offset to check for. - * @return bool Returns TRUE on success or FALSE on failure. - */ - public function __isset($offset) - { - return array_key_exists($offset, $this->items) || $this->isPropertyDefined($offset); - } - - /** - * Returns the value at specified offset with a possibility to load the field by $this->offsetLoad_{$offset}(). - * - * @param mixed $offset The offset to retrieve. - * @return mixed Can return all value types. - */ - public function __get($offset) - { - return $this->getRef($offset); - } - - /** - * Assigns a value to the specified offset with a possibility to check or alter the value by - * $this->offsetPrepare_{$offset}(). - * - * @param mixed $offset The offset to assign the value to. - * @param mixed $value The value to set. - */ - public function __set($offset, $value) - { - if ($this->isPropertyDefined($offset)) { - $methodName = "offsetPrepare_{$offset}"; - - if (method_exists($this, $methodName)) { - $this->{$offset} = $this->{$methodName}($value); - } - } - - $this->items[$offset] = $value; - } - - /** - * Magic method to unset the attribute - * - * @param mixed $offset The name value to unset - */ - public function __unset($offset) - { - if ($this->isPropertyDefined($offset)) { - $this->{$offset} = null; - } else { - unset($this->items[$offset]); - } - } - - /** - * Convert object into an array. - * - * @return array - */ - protected function toArray() - { - return $this->items; - } - - protected function &getRef($offset, $new = false) - { - if ($this->isPropertyDefined($offset)) { - if ($this->{$offset} === null) { - $methodName = "offsetLoad_{$offset}"; - - if (method_exists($this, $methodName)) { - $this->{$offset} = $this->{$methodName}(); - } - } - - return $this->{$offset}; - } - - if (!isset($this->items[$offset])) { - if (!$new) { - $null = null; - return $null; - } - $this->items[$offset] = []; - } - - return $this->items[$offset]; - } - - protected function isPropertyDefined($offset) - { - return array_key_exists($offset, get_object_vars($this)); - } -} diff --git a/system/src/Grav/Framework/Object/ObjectCollection.php b/system/src/Grav/Framework/Object/ObjectCollection.php index 85ea126aa..1414492d5 100644 --- a/system/src/Grav/Framework/Object/ObjectCollection.php +++ b/system/src/Grav/Framework/Object/ObjectCollection.php @@ -9,16 +9,20 @@ namespace Grav\Framework\Object; use Grav\Framework\Collection\ArrayCollection; +use Grav\Framework\Object\Access\NestedPropertyCollectionTrait; +use Grav\Framework\Object\Base\ObjectCollectionTrait; +use Grav\Framework\Object\Interfaces\NestedObjectInterface; +use Grav\Framework\Object\Interfaces\ObjectCollectionInterface; /** * Object Collection * @package Grav\Framework\Object */ -class ObjectCollection extends ArrayCollection implements ObjectCollectionInterface +class ObjectCollection extends ArrayCollection implements ObjectCollectionInterface, NestedObjectInterface { - use ObjectCollectionTrait; - - static protected $prefix = 'c.'; + use ObjectCollectionTrait, NestedPropertyCollectionTrait { + NestedPropertyCollectionTrait::group insteadof ObjectCollectionTrait; + } /** * @param array $elements @@ -27,23 +31,18 @@ class ObjectCollection extends ArrayCollection implements ObjectCollectionInterf */ public function __construct(array $elements = [], $key = null) { - parent::__construct($elements); + parent::__construct($this->setElements($elements)); - $this->key = $key !== null ? $key : (string) $this; - - if ($this->key === null) { - throw new \InvalidArgumentException('Object cannot be created without assigning a key to it'); - } + $this->setKey($key); } - /** - * @param string $key - * @return $this - */ - public function setKey($key) + protected function getElements() { - $this->key = $key; + return $this->toArray(); + } - return $this; + protected function setElements(array $elements) + { + return $elements; } } diff --git a/system/src/Grav/Framework/Object/ObjectTrait.php b/system/src/Grav/Framework/Object/ObjectTrait.php deleted file mode 100644 index 7292e5158..000000000 --- a/system/src/Grav/Framework/Object/ObjectTrait.php +++ /dev/null @@ -1,86 +0,0 @@ -items = $elements; - $this->key = $key !== null ? $key : (string) $this; - - if ($this->key === null) { - throw new \InvalidArgumentException('Object cannot be created without assigning a key to it'); - } - } - - /** - * @param bool $prefix - * @return string - */ - public function getType($prefix = true) - { - if (static::$type) { - return ($prefix ? static::$prefix : '') . static::$type; - } - - $class = get_class($this); - return ($prefix ? static::$prefix : '') . strtolower(substr($class, strrpos($class, '\\') + 1)); - } - - /** - * @return string - */ - public function getKey() - { - return $this->key; - } - - /** - * Implements JsonSerializable interface. - * - * @return array - */ - public function jsonSerialize() - { - return ['key' => (string) $this, 'type' => $this->getType(), 'elements' => $this->toArray()]; - } - - /** - * Returns a string representation of this object. - * - * @return string - */ - public function __toString() - { - return $this->getKey() ?: $this->getType() . '@' . spl_object_hash($this); - } -} diff --git a/system/src/Grav/Framework/Object/Property/ArrayPropertyTrait.php b/system/src/Grav/Framework/Object/Property/ArrayPropertyTrait.php new file mode 100644 index 000000000..7d1d4f8b5 --- /dev/null +++ b/system/src/Grav/Framework/Object/Property/ArrayPropertyTrait.php @@ -0,0 +1,96 @@ +setElements($elements); + $this->setKey($key); + } + + /** + * @param string $property Object property name. + * @return bool True if property has been defined (can be null). + */ + protected function doHasProperty($property) + { + return array_key_exists($property, $this->_elements); + } + + /** + * @param string $property Object property to be fetched. + * @param mixed $default Default value if property has not been set. + * @param bool $doCreate Set true to create variable. + * @return mixed Property value. + */ + protected function &doGetProperty($property, $default = null, $doCreate = false) + { + if (!$this->doHasProperty($property)) { + if ($doCreate) { + $this->_elements[$property] = null; + } else { + return $default; + } + } + + return $this->_elements[$property]; + } + + /** + * @param string $property Object property to be updated. + * @param string $value New value. + */ + protected function doSetProperty($property, $value) + { + $this->_elements[$property] = $value; + } + + /** + * @param string $property Object property to be unset. + */ + protected function doUnsetProperty($property) + { + unset($this->_elements[$property]); + } + + /** + * @return array + */ + protected function getElements() + { + return $this->_elements; + } + + /** + * @param array $elements + */ + protected function setElements(array $elements) + { + $this->_elements = $elements; + } + + abstract protected function setKey($key); +} diff --git a/system/src/Grav/Framework/Object/Property/LazyPropertyTrait.php b/system/src/Grav/Framework/Object/Property/LazyPropertyTrait.php new file mode 100644 index 000000000..10e7caa4b --- /dev/null +++ b/system/src/Grav/Framework/Object/Property/LazyPropertyTrait.php @@ -0,0 +1,92 @@ +hasArrayProperty($property) || $this->hasObjectProperty($property); + } + + /** + * @param string $property Object property to be fetched. + * @param mixed $default Default value if property has not been set. + * @return mixed Property value. + */ + protected function &doGetProperty($property, $default = null, $doCreate = false) + { + if ($this->hasObjectProperty($property)) { + return $this->getObjectProperty($property, $default, function ($default = null) use ($property) { + return $this->getArrayProperty($property, $default); + }); + } + + return $this->getArrayProperty($property, $default, $doCreate); + } + + /** + * @param string $property Object property to be updated. + * @param string $value New value. + * @return $this + */ + protected function doSetProperty($property, $value) + { + if ($this->hasObjectProperty($property)) { + $this->setObjectProperty($property, $value); + } else { + $this->setArrayProperty($property, $value); + } + + return $this; + } + + /** + * @param string $property Object property to be unset. + * @return $this + */ + protected function doUnsetProperty($property) + { + $this->hasObjectProperty($property) ? + $this->unsetObjectProperty($property) : $this->unsetArrayProperty($property); + + return $this; + } + + /** + * @return array + */ + protected function getElements() + { + return $this->getObjectElements() + $this->getArrayElements(); + } +} diff --git a/system/src/Grav/Framework/Object/Property/MixedPropertyTrait.php b/system/src/Grav/Framework/Object/Property/MixedPropertyTrait.php new file mode 100644 index 000000000..56b785653 --- /dev/null +++ b/system/src/Grav/Framework/Object/Property/MixedPropertyTrait.php @@ -0,0 +1,97 @@ +hasArrayProperty($property) || $this->hasObjectProperty($property); + } + + /** + * @param string $property Object property to be fetched. + * @param mixed $default Default value if property has not been set. + * @return mixed Property value. + */ + protected function &doGetProperty($property, $default = null, $doCreate = false) + { + if ($this->hasObjectProperty($property)) { + return $this->getObjectProperty($property); + } + + return $this->getArrayProperty($property, $default, $doCreate); + } + + /** + * @param string $property Object property to be updated. + * @param string $value New value. + * @return $this + */ + protected function doSetProperty($property, $value) + { + $this->hasObjectProperty($property) + ? $this->setObjectProperty($property, $value) : $this->setArrayProperty($property, $value); + + return $this; + } + + /** + * @param string $property Object property to be unset. + * @return $this + */ + protected function doUnsetProperty($property) + { + $this->hasObjectProperty($property) ? + $this->unsetObjectProperty($property) : $this->unsetArrayProperty($property); + + return $this; + } + + /** + * @return array + */ + protected function getElements() + { + return $this->getObjectElements() + $this->getArrayElements(); + } + + /** + * @param array $elements + */ + protected function setElements(array $elements) + { + $this->setObjectElements(array_intersect_key($elements, $this->_definedProperties)); + $this->setArrayElements(array_diff_key($elements, $this->_definedProperties)); + } +} diff --git a/system/src/Grav/Framework/Object/Property/ObjectPropertyTrait.php b/system/src/Grav/Framework/Object/Property/ObjectPropertyTrait.php new file mode 100644 index 000000000..8154c391c --- /dev/null +++ b/system/src/Grav/Framework/Object/Property/ObjectPropertyTrait.php @@ -0,0 +1,151 @@ +initObjectProperties(); + $this->setElements($elements); + $this->setKey($key); + } + + /** + * @param string $property Object property name. + * @return bool True if property has been defined (can be null). + */ + protected function doHasProperty($property) + { + return array_key_exists($property, $this->_definedProperties); + } + + /** + * @param string $property Object property to be fetched. + * @param mixed $default Default value if property has not been set. + * @param bool $doCreate Set true to create variable. + * @return mixed Property value. + */ + protected function &doGetProperty($property, $default = null, $doCreate = false) + { + if (!array_key_exists($property, $this->_definedProperties)) { + throw new \InvalidArgumentException("Property '{$property}' does not exist in the object!"); + } + + if (empty($this->_definedProperties[$property])) { + if ($doCreate === true) { + $this->_definedProperties[$property] = true; + $this->{$property} = null; + } elseif (is_callable($doCreate)) { + $this->_definedProperties[$property] = true; + $this->{$property} = $this->onPropertyLoad($property, $doCreate()); + } else { + return $default; + } + } + + return $this->{$property}; + } + + /** + * @param string $property Object property to be updated. + * @param string $value New value. + * @throws \InvalidArgumentException + */ + protected function doSetProperty($property, $value) + { + if (!array_key_exists($property, $this->_definedProperties)) { + throw new \InvalidArgumentException("Property '{$property}' does not exist in the object!"); + } + + $this->_definedProperties[$property] = true; + $this->{$property} = $this->onPropertySet($property, $value); + } + + /** + * @param string $property Object property to be unset. + */ + protected function doUnsetProperty($property) + { + if (!array_key_exists($property, $this->_definedProperties)) { + return; + } + + $this->_definedProperties[$property] = false; + unset($this->{$property}); + } + + + protected function onPropertyLoad($offset, $value) + { + $methodName = "offsetLoad_{$offset}"; + + if (method_exists($this, $methodName)) { + return $this->{$methodName}($value); + } + + return $value; + } + + protected function onPropertySet($offset, $value) + { + $methodName = "offsetPrepare_{$offset}"; + + if (method_exists($this, $methodName)) { + return $this->{$methodName}($value); + } + + return $value; + } + + protected function initObjectProperties() + { + $this->_definedProperties = []; + foreach (get_object_vars($this) as $property => $value) { + if ($property[0] !== '_') { + $this->_definedProperties[$property] = ($value !== null); + } + } + } + + /** + * @return array + */ + protected function getElements() + { + return array_intersect_key(get_object_vars($this), array_filter($this->_definedProperties)); + } + + /** + * @param array $elements + */ + protected function setElements(array $elements) + { + foreach ($elements as $property => $value) { + $this->setProperty($property, $value); + } + } + + abstract public function setProperty($property, $value); + abstract protected function setKey($key); +} diff --git a/system/src/Grav/Framework/Object/PropertyObject.php b/system/src/Grav/Framework/Object/PropertyObject.php new file mode 100644 index 000000000..e7b66bc19 --- /dev/null +++ b/system/src/Grav/Framework/Object/PropertyObject.php @@ -0,0 +1,26 @@ + Date: Thu, 14 Sep 2017 15:58:16 +0300 Subject: [PATCH 036/141] Fix bug on Object ArrayAccess --- system/src/Grav/Framework/Object/ArrayObject.php | 4 ++-- system/src/Grav/Framework/Object/LazyObject.php | 4 ++-- system/src/Grav/Framework/Object/PropertyObject.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/system/src/Grav/Framework/Object/ArrayObject.php b/system/src/Grav/Framework/Object/ArrayObject.php index 583ed3849..6d9811a93 100644 --- a/system/src/Grav/Framework/Object/ArrayObject.php +++ b/system/src/Grav/Framework/Object/ArrayObject.php @@ -8,12 +8,12 @@ namespace Grav\Framework\Object; +use Grav\Framework\Object\Access\NestedArrayAccessTrait; use Grav\Framework\Object\Access\NestedPropertyTrait; use Grav\Framework\Object\Access\OverloadedPropertyTrait; use Grav\Framework\Object\Base\ObjectTrait; use Grav\Framework\Object\Interfaces\NestedObjectInterface; use Grav\Framework\Object\Property\ArrayPropertyTrait; -use RocketTheme\Toolbox\ArrayTraits\NestedArrayAccess; /** * Array Object class. @@ -22,5 +22,5 @@ use RocketTheme\Toolbox\ArrayTraits\NestedArrayAccess; */ class ArrayObject implements NestedObjectInterface, \ArrayAccess { - use ObjectTrait, ArrayPropertyTrait, NestedPropertyTrait, OverloadedPropertyTrait, NestedArrayAccess; + use ObjectTrait, ArrayPropertyTrait, NestedPropertyTrait, OverloadedPropertyTrait, NestedArrayAccessTrait; } diff --git a/system/src/Grav/Framework/Object/LazyObject.php b/system/src/Grav/Framework/Object/LazyObject.php index c73872706..ba13c6e7b 100644 --- a/system/src/Grav/Framework/Object/LazyObject.php +++ b/system/src/Grav/Framework/Object/LazyObject.php @@ -8,12 +8,12 @@ namespace Grav\Framework\Object; +use Grav\Framework\Object\Access\NestedArrayAccessTrait; use Grav\Framework\Object\Access\NestedPropertyTrait; use Grav\Framework\Object\Access\OverloadedPropertyTrait; use Grav\Framework\Object\Base\ObjectTrait; use Grav\Framework\Object\Interfaces\NestedObjectInterface; use Grav\Framework\Object\Property\LazyPropertyTrait; -use RocketTheme\Toolbox\ArrayTraits\NestedArrayAccess; /** * Lazy Object class. @@ -22,5 +22,5 @@ use RocketTheme\Toolbox\ArrayTraits\NestedArrayAccess; */ class LazyObject implements NestedObjectInterface, \ArrayAccess { - use ObjectTrait, LazyPropertyTrait, NestedPropertyTrait, OverloadedPropertyTrait, NestedArrayAccess; + use ObjectTrait, LazyPropertyTrait, NestedPropertyTrait, OverloadedPropertyTrait, NestedArrayAccessTrait; } diff --git a/system/src/Grav/Framework/Object/PropertyObject.php b/system/src/Grav/Framework/Object/PropertyObject.php index e7b66bc19..99f9611bc 100644 --- a/system/src/Grav/Framework/Object/PropertyObject.php +++ b/system/src/Grav/Framework/Object/PropertyObject.php @@ -8,12 +8,12 @@ namespace Grav\Framework\Object; +use Grav\Framework\Object\Access\NestedArrayAccessTrait; use Grav\Framework\Object\Access\NestedPropertyTrait; use Grav\Framework\Object\Access\OverloadedPropertyTrait; use Grav\Framework\Object\Base\ObjectTrait; use Grav\Framework\Object\Interfaces\NestedObjectInterface; use Grav\Framework\Object\Property\ObjectPropertyTrait; -use RocketTheme\Toolbox\ArrayTraits\NestedArrayAccess; /** * Property Object class. @@ -22,5 +22,5 @@ use RocketTheme\Toolbox\ArrayTraits\NestedArrayAccess; */ class PropertyObject implements NestedObjectInterface, \ArrayAccess { - use ObjectTrait, ObjectPropertyTrait, NestedPropertyTrait, OverloadedPropertyTrait, NestedArrayAccess; + use ObjectTrait, ObjectPropertyTrait, NestedPropertyTrait, OverloadedPropertyTrait, NestedArrayAccessTrait; } From 588c5091942e7b62e151710c6db66b2558bb38d6 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 15 Sep 2017 14:05:21 +0300 Subject: [PATCH 037/141] Add ArrayCollection::chunk() function --- .../Framework/Collection/AbstractLazyCollection.php | 9 +++++++++ .../src/Grav/Framework/Collection/ArrayCollection.php | 11 +++++++++++ .../Grav/Framework/Collection/CollectionInterface.php | 8 ++++++++ 3 files changed, 28 insertions(+) diff --git a/system/src/Grav/Framework/Collection/AbstractLazyCollection.php b/system/src/Grav/Framework/Collection/AbstractLazyCollection.php index ad0830d94..c28395c0a 100644 --- a/system/src/Grav/Framework/Collection/AbstractLazyCollection.php +++ b/system/src/Grav/Framework/Collection/AbstractLazyCollection.php @@ -42,6 +42,15 @@ abstract class AbstractLazyCollection extends BaseAbstractLazyCollection impleme return $this->collection->shuffle(); } + /** + * {@inheritDoc} + */ + public function chunk($size) + { + $this->initialize(); + return $this->collection->chunk($size); + } + /** * {@inheritDoc} */ diff --git a/system/src/Grav/Framework/Collection/ArrayCollection.php b/system/src/Grav/Framework/Collection/ArrayCollection.php index b49423162..bef3834c2 100644 --- a/system/src/Grav/Framework/Collection/ArrayCollection.php +++ b/system/src/Grav/Framework/Collection/ArrayCollection.php @@ -50,6 +50,17 @@ class ArrayCollection extends BaseArrayCollection implements CollectionInterface return $this->createFrom(array_replace(array_flip($keys), $this->toArray())); } + /** + * Split collection into chunks. + * + * @param int $size Size of each chunk. + * @return array + */ + public function chunk($size) + { + return array_chunk($this->toArray(), $size, true); + } + /** * Implementes JsonSerializable interface. * diff --git a/system/src/Grav/Framework/Collection/CollectionInterface.php b/system/src/Grav/Framework/Collection/CollectionInterface.php index ef46e00ec..ea0ae96d3 100644 --- a/system/src/Grav/Framework/Collection/CollectionInterface.php +++ b/system/src/Grav/Framework/Collection/CollectionInterface.php @@ -30,4 +30,12 @@ interface CollectionInterface extends Collection, \JsonSerializable * @return static */ public function shuffle(); + + /** + * Split collection into chunks. + * + * @param int $size Size of each chunk. + * @return array + */ + public function chunk($size); } From 71b11366bbc83cfdb16bfe4478828a7c521ea50a Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Mon, 25 Sep 2017 14:17:14 +0300 Subject: [PATCH 038/141] Add support to serialize Object properties --- .../Object/Property/ObjectPropertyTrait.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/system/src/Grav/Framework/Object/Property/ObjectPropertyTrait.php b/system/src/Grav/Framework/Object/Property/ObjectPropertyTrait.php index 8154c391c..727eb7361 100644 --- a/system/src/Grav/Framework/Object/Property/ObjectPropertyTrait.php +++ b/system/src/Grav/Framework/Object/Property/ObjectPropertyTrait.php @@ -133,7 +133,19 @@ trait ObjectPropertyTrait */ protected function getElements() { - return array_intersect_key(get_object_vars($this), array_filter($this->_definedProperties)); + $properties = array_intersect_key(get_object_vars($this), array_filter($this->_definedProperties)); + + $elements = []; + foreach ($properties as $offset => $value) { + $methodName = "offsetSerialize_{$offset}"; + if (method_exists($this, $methodName)) { + $elements[$offset] = $this->{$methodName}($value); + } else { + $elements[$offset] = $value; + } + } + + return $elements; } /** From 0fd6fda4d8ffb29d3462a88ec9333e72534cdf1a Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Tue, 26 Sep 2017 18:26:39 +0300 Subject: [PATCH 039/141] Add method ObjectCollection::collectionGroup() --- .../Object/Base/ObjectCollectionTrait.php | 26 +++++++++++++++++-- .../Interfaces/ObjectCollectionInterface.php | 10 ++++++- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php b/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php index 916502b67..a122ee3e7 100644 --- a/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php +++ b/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php @@ -142,9 +142,8 @@ trait ObjectCollectionTrait return $list; } - /** - * Group items in the collection by a field. + * Group items in the collection by a field and return them as associated array. * * @param string $property * @return array @@ -161,6 +160,29 @@ trait ObjectCollectionTrait return $list; } + /** + * Group items in the collection by a field and return them as associated array of collections. + * + * @param string $property + * @return static[] + */ + public function collectionGroup($property) + { + $collections = []; + foreach ($this->group($property) as $id => $elements) { + // TODO: remove when PHP 5.6 is minimum (with doctrine/collections v1.4). + if (!method_exists($this, 'createFrom')) { + $collection = new static(array_reverse($this->toArray())); + } else { + $collection = $this->createFrom(array_reverse($this->toArray())); + } + + $collections[$id] = $collection; + } + + return $collections; + } + /** * @return \Traversable */ diff --git a/system/src/Grav/Framework/Object/Interfaces/ObjectCollectionInterface.php b/system/src/Grav/Framework/Object/Interfaces/ObjectCollectionInterface.php index 5f4646e3b..3cba932f6 100644 --- a/system/src/Grav/Framework/Object/Interfaces/ObjectCollectionInterface.php +++ b/system/src/Grav/Framework/Object/Interfaces/ObjectCollectionInterface.php @@ -49,10 +49,18 @@ interface ObjectCollectionInterface extends CollectionInterface, ObjectInterface public function call($name, array $arguments); /** - * Group items in the collection by a field. + * Group items in the collection by a field and return them as associated array. * * @param string $property * @return array */ public function group($property); + + /** + * Group items in the collection by a field and return them as associated array of collections. + * + * @param string $property + * @return static[] + */ + public function collectionGroup($property); } From a535e8547a2365e672eb18b1f4670b8d9d7b8629 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Tue, 26 Sep 2017 19:02:51 +0300 Subject: [PATCH 040/141] Fix bug --- .../src/Grav/Framework/Object/Base/ObjectCollectionTrait.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php b/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php index a122ee3e7..0a31da39d 100644 --- a/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php +++ b/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php @@ -172,9 +172,9 @@ trait ObjectCollectionTrait foreach ($this->group($property) as $id => $elements) { // TODO: remove when PHP 5.6 is minimum (with doctrine/collections v1.4). if (!method_exists($this, 'createFrom')) { - $collection = new static(array_reverse($this->toArray())); + $collection = new static($elements); } else { - $collection = $this->createFrom(array_reverse($this->toArray())); + $collection = $this->createFrom($elements); } $collections[$id] = $collection; From 8b3949b7d924a3ba89a92e7883fe83cd59d32666 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Wed, 27 Sep 2017 10:13:26 +0300 Subject: [PATCH 041/141] Fixed nested object access by Object::getNestedProperty() --- .../Grav/Framework/Object/Access/NestedPropertyTrait.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php b/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php index 62f63fd42..9216bb025 100644 --- a/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php +++ b/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php @@ -36,7 +36,8 @@ trait NestedPropertyTrait */ public function getNestedProperty($property, $default = null, $separator = null) { - $path = explode($separator ?: '.', $property); + $separator = $separator ?: '.'; + $path = explode($separator, $property); $offset = array_shift($path); if (!$this->hasProperty($offset)) { @@ -78,7 +79,8 @@ trait NestedPropertyTrait */ public function setNestedProperty($property, $value, $separator = null) { - $path = explode($separator ?: '.', $property); + $separator = $separator ?: '.'; + $path = explode($separator, $property); $offset = array_shift($path); if (!$path) { @@ -119,7 +121,8 @@ trait NestedPropertyTrait */ public function unsetNestedProperty($property, $separator = null) { - $path = explode($separator ?: '.', $property); + $separator = $separator ?: '.'; + $path = explode($separator, $property); $offset = array_shift($path); if (!$path) { From 4e6738cbc5c54e9d857e1467a85f21dd36c4cc5b Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Wed, 4 Oct 2017 15:24:45 +0300 Subject: [PATCH 042/141] Composer update --- composer.lock | 87 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 67 insertions(+), 20 deletions(-) diff --git a/composer.lock b/composer.lock index 138dd9f44..e31d21532 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "24c56b5fbd83e5c8173f1c38c2805b68", + "content-hash": "391b1b837642a79d03beb5c598c95260", "packages": [ { "name": "antoligy/dom-string-iterators", @@ -1038,6 +1038,54 @@ ], "time": "2016-10-10T12:19:37+00:00" }, + { + "name": "psr/simple-cache", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "753fa598e8f3b9966c886fe13f370baa45ef0e24" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/753fa598e8f3b9966c886fe13f370baa45ef0e24", + "reference": "753fa598e8f3b9966c886fe13f370baa45ef0e24", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "time": "2017-01-02T13:31:39+00:00" + }, { "name": "rockettheme/toolbox", "version": "1.3.8", @@ -1675,16 +1723,16 @@ }, { "name": "codeception/codeception", - "version": "2.3.5", + "version": "2.3.6", "source": { "type": "git", "url": "https://github.com/Codeception/Codeception.git", - "reference": "e807cd458eb9f7ae7464f33ad835a2f54aa73194" + "reference": "c3dd3b5d9e0b1ea6c2fcca52457736dc756716f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/Codeception/zipball/e807cd458eb9f7ae7464f33ad835a2f54aa73194", - "reference": "e807cd458eb9f7ae7464f33ad835a2f54aa73194", + "url": "https://api.github.com/repos/Codeception/Codeception/zipball/c3dd3b5d9e0b1ea6c2fcca52457736dc756716f8", + "reference": "c3dd3b5d9e0b1ea6c2fcca52457736dc756716f8", "shasum": "" }, "require": { @@ -1699,7 +1747,7 @@ "phpunit/phpunit": ">4.8.20 <7.0", "phpunit/phpunit-mock-objects": ">2.3 <5.0", "sebastian/comparator": ">1.1 <3.0", - "sebastian/diff": "^1.4", + "sebastian/diff": ">=1.4 <3.0", "stecman/symfony-console-completion": "^0.7.0", "symfony/browser-kit": ">=2.7 <4.0", "symfony/console": ">=2.7 <4.0", @@ -1715,7 +1763,6 @@ "flow/jsonpath": "~0.2", "league/factory-muffin": "^3.0", "league/factory-muffin-faker": "^1.0", - "mongodb/mongodb": "^1.0", "monolog/monolog": "~1.8", "pda/pheanstalk": "~3.0", "php-amqplib/php-amqplib": "~2.4", @@ -1766,7 +1813,7 @@ "functional testing", "unit testing" ], - "time": "2017-08-10T20:28:02+00:00" + "time": "2017-09-28T23:19:49+00:00" }, { "name": "doctrine/instantiator", @@ -2161,22 +2208,22 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "3.2.2", + "version": "4.1.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157" + "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/4aada1f93c72c35e22fb1383b47fee43b8f1d157", - "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/2d3d238c433cf69caeb4842e97a3223a116f94b2", + "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2", "shasum": "" }, "require": { - "php": ">=5.5", + "php": "^7.0", "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.3.0", + "phpdocumentor/type-resolver": "^0.4.0", "webmozart/assert": "^1.0" }, "require-dev": { @@ -2202,20 +2249,20 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-08-08T06:39:58+00:00" + "time": "2017-08-30T18:51:59+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.3.0", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773" + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fb3933512008d8162b3cdf9e18dba9309b7c3773", - "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", "shasum": "" }, "require": { @@ -2249,7 +2296,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2017-06-03T08:32:36+00:00" + "time": "2017-07-14T14:27:02+00:00" }, { "name": "phpspec/prophecy", From ae143814fb9541e02ab0fdf7f2cff8c7dfb90d9d Mon Sep 17 00:00:00 2001 From: Djamil Legato Date: Thu, 19 Oct 2017 17:37:29 -0400 Subject: [PATCH 043/141] Updated default with new media order --- system/blueprints/pages/default.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/blueprints/pages/default.yaml b/system/blueprints/pages/default.yaml index 929a067c3..8472b3b1a 100644 --- a/system/blueprints/pages/default.yaml +++ b/system/blueprints/pages/default.yaml @@ -32,7 +32,7 @@ form: validate: type: textarea - uploads: + header.media_order: type: pagemedia label: PLUGIN_ADMIN.PAGE_MEDIA From 586fcf42ab7fde975ca01816af56e8ee311bff0f Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Mon, 30 Oct 2017 13:31:47 +0200 Subject: [PATCH 044/141] Added `{% try %} ... {% catch %} Error: {{ e.message }} {% endcatch %}` tag to allow basic exception handling inside Twig --- CHANGELOG.md | 1 + system/src/Grav/Common/Debugger.php | 14 ++-- .../src/Grav/Common/Twig/TokenParserTry.php | 66 +++++++++++++++++++ system/src/Grav/Common/Twig/TwigExtension.php | 10 +++ system/src/Grav/Common/Twig/TwigNodeTry.php | 52 +++++++++++++++ 5 files changed, 136 insertions(+), 7 deletions(-) create mode 100644 system/src/Grav/Common/Twig/TokenParserTry.php create mode 100644 system/src/Grav/Common/Twig/TwigNodeTry.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cf7d8639..6c0b59f4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * Added `Grav\Framework\Object` classes for creating collections of objects * Added `Grav\Framework\Page` interfaces * Added `|nicenumber` Twig filter + * Added `{% try %} ... {% catch %} Error: {{ e.message }} {% endcatch %}` tag to allow basic exception handling inside Twig * Deprecated GravTrait 1. [](#improved) * Make it possible to include debug bar also into non-HTML responses diff --git a/system/src/Grav/Common/Debugger.php b/system/src/Grav/Common/Debugger.php index cce279d38..40a485402 100644 --- a/system/src/Grav/Common/Debugger.php +++ b/system/src/Grav/Common/Debugger.php @@ -74,7 +74,7 @@ class Debugger */ public function enabled($state = null) { - if (isset($state)) { + if ($state !== null) { $this->enabled = $state; } @@ -92,7 +92,7 @@ class Debugger // Only add assets if Page is HTML $page = $this->grav['page']; - if ($page->templateFormat() != 'html') { + if ($page->templateFormat() !== 'html') { return $this; } @@ -107,13 +107,13 @@ class Debugger // Get the required CSS files list($css_files, $js_files) = $this->renderer->getAssets(null, JavascriptRenderer::RELATIVE_URL); - foreach ($css_files as $css) { + foreach ((array)$css_files as $css) { $assets->addCss($css); } $assets->addCss('/system/assets/debugger.css'); - foreach ($js_files as $js) { + foreach ((array)$js_files as $js) { $assets->addJs($js); } } @@ -166,7 +166,7 @@ class Debugger if ($this->enabled()) { // Only add assets if Page is HTML $page = $this->grav['page']; - if ($page->templateFormat() != 'html' || !$this->renderer) { + if (!$this->renderer || $page->templateFormat() !== 'html') { return $this; } @@ -216,7 +216,7 @@ class Debugger */ public function startTimer($name, $description = null) { - if ($name[0] == '_' || $this->enabled()) { + if ($name[0] === '_' || $this->enabled()) { $this->debugbar['time']->startMeasure($name, $description); $this->timers[] = $name; } @@ -233,7 +233,7 @@ class Debugger */ public function stopTimer($name) { - if (in_array($name, $this->timers) && ($name[0] == '_' || $this->enabled())) { + if (in_array($name, $this->timers, true) && ($name[0] === '_' || $this->enabled())) { $this->debugbar['time']->stopMeasure($name); } diff --git a/system/src/Grav/Common/Twig/TokenParserTry.php b/system/src/Grav/Common/Twig/TokenParserTry.php new file mode 100644 index 000000000..74465540f --- /dev/null +++ b/system/src/Grav/Common/Twig/TokenParserTry.php @@ -0,0 +1,66 @@ + + * {% try %} + *
  • {{ user.get('name') }}
  • + * {% catch %} + * {{ e.message }} + * {% endcatch %} + * + */ +class TokenParserTry extends \Twig_TokenParser +{ + /** + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_NodeInterface A Twig_NodeInterface instance + */ + public function parse(\Twig_Token $token) + { + $lineno = $token->getLine(); + $stream = $this->parser->getStream(); + + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + $try = $this->parser->subparse([$this, 'decideCatch']); + $stream->next(); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + $catch = $this->parser->subparse([$this, 'decideEnd']); + $stream->next(); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + + return new TwigNodeTry($try, $catch, $lineno, $this->getTag()); + } + + public function decideCatch(\Twig_Token $token) + { + return $token->test(array('catch')); + } + + public function decideEnd(\Twig_Token $token) + { + return $token->test(array('endtry')) || $token->test(array('endcatch')); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'try'; + } +} diff --git a/system/src/Grav/Common/Twig/TwigExtension.php b/system/src/Grav/Common/Twig/TwigExtension.php index 5201bc71f..b1ee96da1 100644 --- a/system/src/Grav/Common/Twig/TwigExtension.php +++ b/system/src/Grav/Common/Twig/TwigExtension.php @@ -148,6 +148,16 @@ class TwigExtension extends \Twig_Extension ]; } + /** + * @return array + */ + public function getTokenParsers() + { + return [ + new TokenParserTry(), + ]; + } + /** * Filters field name by changing dot notation into array notation. * diff --git a/system/src/Grav/Common/Twig/TwigNodeTry.php b/system/src/Grav/Common/Twig/TwigNodeTry.php new file mode 100644 index 000000000..009556557 --- /dev/null +++ b/system/src/Grav/Common/Twig/TwigNodeTry.php @@ -0,0 +1,52 @@ + $try, 'catch' => $catch), array(), $lineno, $tag); + } + + /** + * Compiles the node to PHP. + * + * @param \Twig_Compiler $compiler A Twig_Compiler instance + * @throws \LogicException + */ + public function compile(\Twig_Compiler $compiler) + { + $compiler->addDebugInfo($this); + + $compiler + ->write('try {') + ; + + $compiler + ->indent() + ->subcompile($this->getNode('try')) + ; + + if ($this->hasNode('catch') && null !== $this->getNode('catch')) { + $compiler + ->outdent() + ->write('} catch (\Exception $e) {' . "\n") + ->indent() + ->write('if (isset($context[\'grav\'][\'debugger\'])) $context[\'grav\'][\'debugger\']->addException($e);' . "\n") + ->write('$context[\'e\'] = $e;' . "\n") + ->subcompile($this->getNode('catch')) + ; + } + + $compiler + ->outdent() + ->write("}\n"); + } +} From 84789cbcd44f82e96cacd557f5f8af77b1077230 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Tue, 31 Oct 2017 16:50:05 +0200 Subject: [PATCH 045/141] Added `{% script %}` and `{% style %}` tags for Twig templates --- CHANGELOG.md | 1 + .../Grav/Common/Twig/Node/TwigNodeScript.php | 101 +++++++++++++++++ .../Grav/Common/Twig/Node/TwigNodeStyle.php | 97 ++++++++++++++++ .../TwigNodeTryCatch.php} | 4 +- .../TokenParser/TwigTokenParserScript.php | 105 ++++++++++++++++++ .../Twig/TokenParser/TwigTokenParserStyle.php | 98 ++++++++++++++++ .../TwigTokenParserTryCatch.php} | 8 +- system/src/Grav/Common/Twig/TwigExtension.php | 19 ++-- 8 files changed, 416 insertions(+), 17 deletions(-) create mode 100644 system/src/Grav/Common/Twig/Node/TwigNodeScript.php create mode 100644 system/src/Grav/Common/Twig/Node/TwigNodeStyle.php rename system/src/Grav/Common/Twig/{TwigNodeTry.php => Node/TwigNodeTryCatch.php} (94%) create mode 100644 system/src/Grav/Common/Twig/TokenParser/TwigTokenParserScript.php create mode 100644 system/src/Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php rename system/src/Grav/Common/Twig/{TokenParserTry.php => TokenParser/TwigTokenParserTryCatch.php} (87%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c0b59f4f..c836ede2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Added `Grav\Framework\Page` interfaces * Added `|nicenumber` Twig filter * Added `{% try %} ... {% catch %} Error: {{ e.message }} {% endcatch %}` tag to allow basic exception handling inside Twig + * Added `{% script %}` and `{% style %}` tags for Twig templates * Deprecated GravTrait 1. [](#improved) * Make it possible to include debug bar also into non-HTML responses diff --git a/system/src/Grav/Common/Twig/Node/TwigNodeScript.php b/system/src/Grav/Common/Twig/Node/TwigNodeScript.php new file mode 100644 index 000000000..40d6e5e86 --- /dev/null +++ b/system/src/Grav/Common/Twig/Node/TwigNodeScript.php @@ -0,0 +1,101 @@ + $body, 'file' => $file, 'group' => $group, 'priority' => $priority, 'attributes' => $attributes], [], $lineno, $tag); + } + /** + * Compiles the node to PHP. + * + * @param \Twig_Compiler $compiler A Twig_Compiler instance + */ + public function compile(\Twig_Compiler $compiler) + { + $compiler->addDebugInfo($this); + + if ($this->getNode('attributes') !== null) { + $compiler + ->write('$attributes = ') + ->subcompile($this->getNode('attributes')) + ->raw(";\n") + ->write("if (\$attributes !== null && !is_array(\$attributes)) {\n") + ->indent() + ->write("throw new UnexpectedValueException('{% {$this->tagName} with x %}: x is not an array');\n") + ->outdent() + ->write("}\n"); + } else { + $compiler->write('$attributes = [];' . "\n"); + } + + if ($this->getNode('group') !== null) { + $compiler + ->write('$group = ') + ->subcompile($this->getNode('group')) + ->raw(";\n") + ->write("if (\$group !== null && !is_string(\$group)) {\n") + ->indent() + ->write("throw new UnexpectedValueException('{% {$this->tagName} in x %}: x is not a string');\n") + ->outdent() + ->write("}\n"); + } else { + $compiler->write('$group = null;' . "\n"); + } + + if ($this->getNode('priority') !== null) { + $compiler + ->write('$priority = (int)(') + ->subcompile($this->getNode('priority')) + ->raw(");\n"); + } else { + $compiler->write('$priority = null;' . "\n"); + } + + $compiler->write("\$assets = \\Grav\\Common\\Grav::instance()['assets'];\n"); + + if ($this->getNode('file') !== null) { + $compiler + ->write('$file = ') + ->subcompile($this->getNode('file')) + ->write(";\n") + ->write("\$pipeline = !empty(\$attributes['pipeline']);\n") + ->write("\$loading = !empty(\$attributes['defer']) ? 'defer' : (!empty(\$attributes['async']) ? 'async' : null);\n") + ->write("\$assets->addJs(\$file, \$priority, \$pipeline, \$loading, \$group);\n"); + } else { + $compiler + ->write("ob_start();\n") + ->subcompile($this->getNode('body')) + ->write("\$content = ob_end_clean();") + ->write("\$assets->addInlineJs(\$content, \$priority, \$group, \$attributes);\n"); + } + } +} diff --git a/system/src/Grav/Common/Twig/Node/TwigNodeStyle.php b/system/src/Grav/Common/Twig/Node/TwigNodeStyle.php new file mode 100644 index 000000000..0cb239541 --- /dev/null +++ b/system/src/Grav/Common/Twig/Node/TwigNodeStyle.php @@ -0,0 +1,97 @@ + $body, 'file' => $file, 'group' => $group, 'priority' => $priority, 'attributes' => $attributes], [], $lineno, $tag); + } + /** + * Compiles the node to PHP. + * + * @param \Twig_Compiler $compiler A Twig_Compiler instance + */ + public function compile(\Twig_Compiler $compiler) + { + $compiler->addDebugInfo($this); + + if ($this->getNode('attributes') !== null) { + $compiler + ->write('$attributes = ') + ->subcompile($this->getNode('attributes')) + ->raw(";\n") + ->write("if (\$attributes !== null && !is_array(\$attributes)) {\n") + ->indent() + ->write("throw new UnexpectedValueException('{% {$this->tagName} with x %}: x is not an array');\n") + ->outdent() + ->write("}\n"); + } else { + $compiler->write('$attributes = [];' . "\n"); + } + + if ($this->getNode('group') !== null) { + $compiler + ->write('$group = ') + ->subcompile($this->getNode('group')) + ->raw(";\n") + ->write("if (\$group !== null && !is_string(\$group)) {\n") + ->indent() + ->write("throw new UnexpectedValueException('{% {$this->tagName} in x %}: x is not a string');\n") + ->outdent() + ->write("}\n"); + } else { + $compiler->write('$group = null;' . "\n"); + } + + if ($this->getNode('priority') !== null) { + $compiler + ->write('$priority = (int)(') + ->subcompile($this->getNode('priority')) + ->raw(");\n"); + } else { + $compiler->write('$priority = null;' . "\n"); + } + + $compiler->write("\$assets = \\Grav\\Common\\Grav::instance()['assets'];\n"); + + if ($this->getNode('file') !== null) { + $compiler + ->write('$file = ') + ->subcompile($this->getNode('file')) + ->write(";\n") + ->write("\$pipeline = !empty(\$attributes['pipeline']);\n") + ->write("\$assets->addCss(\$file, \$priority, \$pipeline, \$group);\n"); + } else { + $compiler + ->write("ob_start();\n") + ->subcompile($this->getNode('body')) + ->write("\$content = ob_end_clean();") + ->write("\$assets->addInlineCss(\$content, \$priority, \$group);\n"); + } + } +} diff --git a/system/src/Grav/Common/Twig/TwigNodeTry.php b/system/src/Grav/Common/Twig/Node/TwigNodeTryCatch.php similarity index 94% rename from system/src/Grav/Common/Twig/TwigNodeTry.php rename to system/src/Grav/Common/Twig/Node/TwigNodeTryCatch.php index 009556557..ee7e36e2f 100644 --- a/system/src/Grav/Common/Twig/TwigNodeTry.php +++ b/system/src/Grav/Common/Twig/Node/TwigNodeTryCatch.php @@ -6,9 +6,9 @@ * @license MIT License; see LICENSE file for details. */ -namespace Grav\Common\Twig; +namespace Grav\Common\Twig\Node; -class TwigNodeTry extends \Twig_Node +class TwigNodeTryCatch extends \Twig_Node { public function __construct(\Twig_NodeInterface $try, \Twig_NodeInterface $catch = null, $lineno, $tag = null) { diff --git a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserScript.php b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserScript.php new file mode 100644 index 000000000..8677452a5 --- /dev/null +++ b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserScript.php @@ -0,0 +1,105 @@ +getLine(); + $stream = $this->parser->getStream(); + + list($file, $group, $priority, $attributes) = $this->parseArguments($token); + + $content = null; + if ($file === null) { + $content = $this->parser->subparse([$this, 'decideBlockEnd'], true); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + } + + return new TwigNodeScript($content, $file, $group, $priority, $attributes, $lineno, $this->getTag()); + } + + /** + * @param \Twig_Token $token + * @return array + */ + protected function parseArguments(\Twig_Token $token) + { + $stream = $this->parser->getStream(); + + if ($stream->test(\Twig_Token::BLOCK_END_TYPE)) { + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + + return [null, null, null, null]; + } + + $file = null; + if (!$stream->nextIf([\Twig_Token::NAME_TYPE, \Twig_Token::OPERATOR_TYPE])) { + $file = $this->parser->getExpressionParser()->parseExpression(); + } + + $group = null; + if ($stream->nextIf(\Twig_Token::OPERATOR_TYPE, 'in')) { + $group = $this->parser->getExpressionParser()->parseExpression(); + } + + $priority = null; + if ($stream->nextIf(\Twig_Token::NAME_TYPE, 'priority')) { + $priority = $this->parser->getExpressionParser()->parseExpression(); + } + + $attributes = null; + if ($stream->nextIf(\Twig_Token::NAME_TYPE, 'with')) { + $attributes = $this->parser->getExpressionParser()->parseExpression(); + } + + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + + return [$file, $group, $priority, $attributes]; + } + + /** + * @param \Twig_Token $token + * @return bool + */ + public function decideBlockEnd(\Twig_Token $token) + { + return $token->test('endscript'); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'script'; + } +} diff --git a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php new file mode 100644 index 000000000..3be798f0c --- /dev/null +++ b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php @@ -0,0 +1,98 @@ +getLine(); + $stream = $this->parser->getStream(); + + list ($file, $group, $priority, $attributes) = $this->parseArguments($token); + + $content = null; + if (!$file) { + $content = $this->parser->subparse([$this, 'decideBlockEnd'], true); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + } + + return new TwigNodeStyle($content, $file, $group, $priority, $attributes, $lineno, $this->getTag()); + } + + /** + * @param \Twig_Token $token + * @return array + */ + protected function parseArguments(\Twig_Token $token) + { + $stream = $this->parser->getStream(); + + $file = null; + if (!$stream->nextIf([\Twig_Token::NAME_TYPE, \Twig_Token::OPERATOR_TYPE, \Twig_Token::BLOCK_END_TYPE])) { + $file = $this->parser->getExpressionParser()->parseExpression(); + } + + $group = null; + if ($stream->nextIf(\Twig_Token::OPERATOR_TYPE, 'in')) { + $group = $this->parser->getExpressionParser()->parseExpression(); + } + + $priority = null; + if ($stream->nextIf(\Twig_Token::NAME_TYPE, 'priority')) { + $priority = $this->parser->getExpressionParser()->parseExpression(); + } + + $attributes = null; + if ($stream->nextIf(\Twig_Token::NAME_TYPE, 'with')) { + $attributes = $this->parser->getExpressionParser()->parseExpression(); + } + + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + + return [$file, $group, $priority, $attributes]; + } + + /** + * @param \Twig_Token $token + * @return bool + */ + public function decideBlockEnd(\Twig_Token $token) + { + return $token->test('endstyle'); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'style'; + } +} diff --git a/system/src/Grav/Common/Twig/TokenParserTry.php b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserTryCatch.php similarity index 87% rename from system/src/Grav/Common/Twig/TokenParserTry.php rename to system/src/Grav/Common/Twig/TokenParser/TwigTokenParserTryCatch.php index 74465540f..b225da345 100644 --- a/system/src/Grav/Common/Twig/TokenParserTry.php +++ b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserTryCatch.php @@ -6,7 +6,9 @@ * @license MIT License; see LICENSE file for details. */ -namespace Grav\Common\Twig; +namespace Grav\Common\Twig\TokenParser; + +use Grav\Common\Twig\Node\TwigNodeTryCatch; /** * Handles try/catch in template file. @@ -19,7 +21,7 @@ namespace Grav\Common\Twig; * {% endcatch %} * */ -class TokenParserTry extends \Twig_TokenParser +class TwigTokenParserTryCatch extends \Twig_TokenParser { /** * Parses a token and returns a node. @@ -41,7 +43,7 @@ class TokenParserTry extends \Twig_TokenParser $stream->next(); $stream->expect(\Twig_Token::BLOCK_END_TYPE); - return new TwigNodeTry($try, $catch, $lineno, $this->getTag()); + return new TwigNodeTryCatch($try, $catch, $lineno, $this->getTag()); } public function decideCatch(\Twig_Token $token) diff --git a/system/src/Grav/Common/Twig/TwigExtension.php b/system/src/Grav/Common/Twig/TwigExtension.php index b1ee96da1..fcd9abdfb 100644 --- a/system/src/Grav/Common/Twig/TwigExtension.php +++ b/system/src/Grav/Common/Twig/TwigExtension.php @@ -11,6 +11,9 @@ namespace Grav\Common\Twig; use Grav\Common\Grav; use Grav\Common\Page\Collection; use Grav\Common\Page\Media; +use Grav\Common\Twig\TokenParser\TwigTokenParserScript; +use Grav\Common\Twig\TokenParser\TwigTokenParserStyle; +use Grav\Common\Twig\TokenParser\TwigTokenParserTryCatch; use Grav\Common\Utils; use Grav\Common\Markdown\Parsedown; use Grav\Common\Markdown\ParsedownExtra; @@ -18,7 +21,7 @@ use Grav\Common\Uri; use Grav\Common\Helpers\Base32; use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator; -class TwigExtension extends \Twig_Extension +class TwigExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface { protected $grav; protected $debugger; @@ -34,16 +37,6 @@ class TwigExtension extends \Twig_Extension $this->config = $this->grav['config']; } - /** - * Returns extension name. - * - * @return string - */ - public function getName() - { - return 'GravTwigExtension'; - } - /** * Register some standard globals * @@ -154,7 +147,9 @@ class TwigExtension extends \Twig_Extension public function getTokenParsers() { return [ - new TokenParserTry(), + new TwigTokenParserTryCatch(), + new TwigTokenParserScript(), + new TwigTokenParserStyle(), ]; } From 7c19d1520df5cb9edfc537726b079ba5248fd25f Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Tue, 31 Oct 2017 20:02:26 +0200 Subject: [PATCH 046/141] Tweaked script/style tag formatting --- system/src/Grav/Common/Twig/Node/TwigNodeScript.php | 2 +- system/src/Grav/Common/Twig/Node/TwigNodeStyle.php | 2 +- .../Grav/Common/Twig/TokenParser/TwigTokenParserScript.php | 5 +++-- .../Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php | 5 +++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/system/src/Grav/Common/Twig/Node/TwigNodeScript.php b/system/src/Grav/Common/Twig/Node/TwigNodeScript.php index 40d6e5e86..1bd509e1b 100644 --- a/system/src/Grav/Common/Twig/Node/TwigNodeScript.php +++ b/system/src/Grav/Common/Twig/Node/TwigNodeScript.php @@ -94,7 +94,7 @@ class TwigNodeScript extends \Twig_Node implements \Twig_NodeOutputInterface $compiler ->write("ob_start();\n") ->subcompile($this->getNode('body')) - ->write("\$content = ob_end_clean();") + ->write("\$content = ob_get_clean();") ->write("\$assets->addInlineJs(\$content, \$priority, \$group, \$attributes);\n"); } } diff --git a/system/src/Grav/Common/Twig/Node/TwigNodeStyle.php b/system/src/Grav/Common/Twig/Node/TwigNodeStyle.php index 0cb239541..a3d13dbef 100644 --- a/system/src/Grav/Common/Twig/Node/TwigNodeStyle.php +++ b/system/src/Grav/Common/Twig/Node/TwigNodeStyle.php @@ -90,7 +90,7 @@ class TwigNodeStyle extends \Twig_Node implements \Twig_NodeOutputInterface $compiler ->write("ob_start();\n") ->subcompile($this->getNode('body')) - ->write("\$content = ob_end_clean();") + ->write("\$content = ob_get_clean();") ->write("\$assets->addInlineCss(\$content, \$priority, \$group);\n"); } } diff --git a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserScript.php b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserScript.php index 8677452a5..364b7ad7b 100644 --- a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserScript.php +++ b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserScript.php @@ -13,9 +13,9 @@ use Grav\Common\Twig\Node\TwigNodeScript; /** * Adds a script to head/bottom/custom location in the document. * - * {% script 'theme://js/something.js' in 'bottom' priority 20 with { defer: true, async: true } %} + * {% script 'theme://js/something.js' in 'bottom' priority: 20 with { defer: true, async: true } %} * - * {% script in 'bottom' priority 20 %} + * {% script in 'bottom' priority: 20 %} * alert('Warning!'); * {% endscript %} @@ -71,6 +71,7 @@ class TwigTokenParserScript extends \Twig_TokenParser $priority = null; if ($stream->nextIf(\Twig_Token::NAME_TYPE, 'priority')) { + $stream->expect(\Twig_Token::PUNCTUATION_TYPE, ':'); $priority = $this->parser->getExpressionParser()->parseExpression(); } diff --git a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php index 3be798f0c..bff1c8c03 100644 --- a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php +++ b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php @@ -13,9 +13,9 @@ use Grav\Common\Twig\Node\TwigNodeStyle; /** * Adds a style to the document. * - * {% style 'theme://css/foo.css' priority 20 %} + * {% style 'theme://css/foo.css' priority: 20 %} - * {% style priority 20 with { media: 'screen' } %} + * {% style priority: 20 with { media: 'screen' } %} * a { color: red; } * {% endstyle %} */ @@ -64,6 +64,7 @@ class TwigTokenParserStyle extends \Twig_TokenParser $priority = null; if ($stream->nextIf(\Twig_Token::NAME_TYPE, 'priority')) { + $stream->expect(\Twig_Token::PUNCTUATION_TYPE, ':'); $priority = $this->parser->getExpressionParser()->parseExpression(); } From 3380577e4000f373c1fd967ecf6bffb710bdf50f Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Wed, 1 Nov 2017 07:45:59 +0200 Subject: [PATCH 047/141] Improved script/style tag parameter handling --- .../Common/Twig/TokenParser/TwigTokenParserScript.php | 8 +------- .../Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserScript.php b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserScript.php index 364b7ad7b..3bee11b53 100644 --- a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserScript.php +++ b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserScript.php @@ -53,14 +53,8 @@ class TwigTokenParserScript extends \Twig_TokenParser { $stream = $this->parser->getStream(); - if ($stream->test(\Twig_Token::BLOCK_END_TYPE)) { - $stream->expect(\Twig_Token::BLOCK_END_TYPE); - - return [null, null, null, null]; - } - $file = null; - if (!$stream->nextIf([\Twig_Token::NAME_TYPE, \Twig_Token::OPERATOR_TYPE])) { + if (!$stream->test(\Twig_Token::NAME_TYPE) && !$stream->test(\Twig_Token::OPERATOR_TYPE) && !$stream->test(\Twig_Token::BLOCK_END_TYPE)) { $file = $this->parser->getExpressionParser()->parseExpression(); } diff --git a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php index bff1c8c03..db6971c41 100644 --- a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php +++ b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php @@ -53,7 +53,7 @@ class TwigTokenParserStyle extends \Twig_TokenParser $stream = $this->parser->getStream(); $file = null; - if (!$stream->nextIf([\Twig_Token::NAME_TYPE, \Twig_Token::OPERATOR_TYPE, \Twig_Token::BLOCK_END_TYPE])) { + if (!$stream->test(\Twig_Token::NAME_TYPE) && !$stream->test(\Twig_Token::OPERATOR_TYPE) && !$stream->test(\Twig_Token::BLOCK_END_TYPE)) { $file = $this->parser->getExpressionParser()->parseExpression(); } From 980b2b67cd1159e113bdffafe1f1f660bbb27e90 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Mon, 6 Nov 2017 10:18:22 +0200 Subject: [PATCH 048/141] Code readability improvements --- system/src/Grav/Common/Backup/ZipBackup.php | 9 ++++--- .../Grav/Common/Config/CompiledBlueprints.php | 3 ++- .../Grav/Common/Config/CompiledLanguages.php | 2 +- system/src/Grav/Common/Config/Config.php | 1 + system/src/Grav/Common/Config/Setup.php | 15 +++++++---- .../src/Grav/Common/Data/BlueprintSchema.php | 8 +++--- system/src/Grav/Common/Data/Blueprints.php | 4 +-- system/src/Grav/Common/Data/Data.php | 1 + .../Grav/Common/Errors/SimplePageHandler.php | 6 ++--- system/src/Grav/Common/File/CompiledFile.php | 6 ++--- system/src/Grav/Common/Filesystem/Folder.php | 19 +++++++------- .../RecursiveFolderFilterIterator.php | 2 +- system/src/Grav/Common/GPM/Common/Package.php | 4 +++ .../src/Grav/Common/GPM/Remote/GravCore.php | 7 ++--- system/src/Grav/Common/GPM/Upgrader.php | 1 + system/src/Grav/Common/Helpers/Base32.php | 6 ++--- system/src/Grav/Common/Helpers/Excerpts.php | 16 ++++++------ system/src/Grav/Common/Helpers/Exif.php | 7 ++++- system/src/Grav/Common/Helpers/Truncator.php | 10 +++---- .../Grav/Common/Language/LanguageCodes.php | 20 +++++++------- .../Grav/Common/Page/Medium/MediumFactory.php | 4 +-- .../Page/Medium/ThumbnailImageMedium.php | 4 +-- .../Grav/Common/Page/Medium/VideoMedium.php | 26 ++++++++----------- .../Grav/Common/Twig/Node/TwigNodeScript.php | 1 + .../Grav/Common/Twig/Node/TwigNodeStyle.php | 1 + 25 files changed, 100 insertions(+), 83 deletions(-) diff --git a/system/src/Grav/Common/Backup/ZipBackup.php b/system/src/Grav/Common/Backup/ZipBackup.php index 2fef157e8..0292b0635 100644 --- a/system/src/Grav/Common/Backup/ZipBackup.php +++ b/system/src/Grav/Common/Backup/ZipBackup.php @@ -32,7 +32,7 @@ class ZipBackup /** * Backup * - * @param null $destination + * @param string|null $destination * @param callable|null $messager * * @return null|string @@ -107,18 +107,19 @@ class ZipBackup * @param $exclusiveLength * @param $messager */ - private static function folderToZip($folder, \ZipArchive &$zipFile, $exclusiveLength, callable $messager = null) + private static function folderToZip($folder, \ZipArchive $zipFile, $exclusiveLength, callable $messager = null) { $handle = opendir($folder); while (false !== $f = readdir($handle)) { - if ($f != '.' && $f != '..') { + if ($f !== '.' && $f !== '..') { $filePath = "$folder/$f"; // Remove prefix from file path before add to zip. $localPath = substr($filePath, $exclusiveLength); if (in_array($f, static::$ignoreFolders)) { continue; - } elseif (in_array($localPath, static::$ignorePaths)) { + } + if (in_array($localPath, static::$ignorePaths)) { $zipFile->addEmptyDir($f); continue; } diff --git a/system/src/Grav/Common/Config/CompiledBlueprints.php b/system/src/Grav/Common/Config/CompiledBlueprints.php index f827903c8..83b1253b0 100644 --- a/system/src/Grav/Common/Config/CompiledBlueprints.php +++ b/system/src/Grav/Common/Config/CompiledBlueprints.php @@ -32,7 +32,7 @@ class CompiledBlueprints extends CompiledBase */ public function checksum() { - if (!isset($this->checksum)) { + if (null === $this->checksum) { $this->checksum = md5(json_encode($this->files) . json_encode($this->getTypes()) . $this->version); } @@ -92,6 +92,7 @@ class CompiledBlueprints extends CompiledBase // Convert file list into parent list. $list = []; + /** @var array $files */ foreach ($this->files as $files) { foreach ($files as $name => $item) { $list[$name][] = $this->path . $item['file']; diff --git a/system/src/Grav/Common/Config/CompiledLanguages.php b/system/src/Grav/Common/Config/CompiledLanguages.php index cb572be44..4d6f0541d 100644 --- a/system/src/Grav/Common/Config/CompiledLanguages.php +++ b/system/src/Grav/Common/Config/CompiledLanguages.php @@ -60,7 +60,7 @@ class CompiledLanguages extends CompiledBase { $file = CompiledYamlFile::instance($filename); if (preg_match('|languages\.yaml$|', $filename)) { - $this->object->mergeRecursive($file->content()); + $this->object->mergeRecursive((array) $file->content()); } else { $this->object->mergeRecursive([$name => $file->content()]); } diff --git a/system/src/Grav/Common/Config/Config.php b/system/src/Grav/Common/Config/Config.php index 52921e6d0..45cc845b6 100644 --- a/system/src/Grav/Common/Config/Config.php +++ b/system/src/Grav/Common/Config/Config.php @@ -16,6 +16,7 @@ use Grav\Common\Utils; class Config extends Data { + /** @var string */ protected $checksum; protected $modified = false; protected $timestamp = 0; diff --git a/system/src/Grav/Common/Config/Setup.php b/system/src/Grav/Common/Config/Setup.php index a8bbd544d..eecebd31d 100644 --- a/system/src/Grav/Common/Config/Setup.php +++ b/system/src/Grav/Common/Config/Setup.php @@ -133,7 +133,7 @@ class Setup extends Data */ public function __construct($container) { - $environment = isset(static::$environment) ? static::$environment : ($container['uri']->environment() ?: 'localhost'); + $environment = null !== static::$environment ? static::$environment : ($container['uri']->environment() ?: 'localhost'); // Pre-load setup.php which contains our initial configuration. // Configuration may contain dynamic parts, which is why we need to always load it. @@ -151,11 +151,13 @@ class Setup extends Data // Set up environment. $this->def('environment', $environment ?: 'cli'); - $this->def('streams.schemes.environment.prefixes', ['' => ($environment ? ["user://{$this->environment}"] : [])]); + $this->def('streams.schemes.environment.prefixes', ['' => $environment ? ["user://{$this->environment}"] : []]); } /** * @return $this + * @throws \RuntimeException + * @throws \InvalidArgumentException */ public function init() { @@ -175,7 +177,7 @@ class Setup extends Data // Update streams. foreach (array_reverse($files) as $path) { $file = CompiledYamlFile::instance($path); - $content = $file->content(); + $content = (array)$file->content(); if (!empty($content['schemes'])) { $this->items['streams']['schemes'] = $content['schemes'] + $this->items['streams']['schemes']; } @@ -196,6 +198,7 @@ class Setup extends Data * Initialize resource locator by using the configuration. * * @param UniformResourceLocator $locator + * @throws \BadMethodCallException */ public function initializeLocator(UniformResourceLocator $locator) { @@ -212,7 +215,7 @@ class Setup extends Data $force = isset($config['force']) ? $config['force'] : false; if (isset($config['prefixes'])) { - foreach ($config['prefixes'] as $prefix => $paths) { + foreach ((array)$config['prefixes'] as $prefix => $paths) { $locator->addPath($scheme, $prefix, $paths, $override, $force); } } @@ -229,7 +232,7 @@ class Setup extends Data $schemes = []; foreach ((array) $this->get('streams.schemes') as $scheme => $config) { $type = !empty($config['type']) ? $config['type'] : 'ReadOnlyStream'; - if ($type[0] != '\\') { + if ($type[0] !== '\\') { $type = '\\RocketTheme\\Toolbox\\StreamWrapper\\' . $type; } @@ -242,6 +245,8 @@ class Setup extends Data /** * @param UniformResourceLocator $locator * @throws \InvalidArgumentException + * @throws \BadMethodCallException + * @throws \RuntimeException */ protected function check(UniformResourceLocator $locator) { diff --git a/system/src/Grav/Common/Data/BlueprintSchema.php b/system/src/Grav/Common/Data/BlueprintSchema.php index 8c621cae9..9e3eebca2 100644 --- a/system/src/Grav/Common/Data/BlueprintSchema.php +++ b/system/src/Grav/Common/Data/BlueprintSchema.php @@ -78,7 +78,7 @@ class BlueprintSchema extends BlueprintSchemaBase implements ExportInterface } elseif (is_array($field) && is_array($val)) { // Array has been defined in blueprints. $messages += $this->validateArray($field, $val); - } elseif (isset($rules['validation']) && $rules['validation'] == 'strict') { + } elseif (isset($rules['validation']) && $rules['validation'] === 'strict') { // Undefined/extra item. throw new \RuntimeException(sprintf('%s is not defined in blueprints', $key)); } @@ -106,7 +106,7 @@ class BlueprintSchema extends BlueprintSchemaBase implements ExportInterface } elseif (is_array($field) && is_array($val)) { // Array has been defined in blueprints. $field = $this->filterArray($field, $val); - } elseif (isset($rules['validation']) && $rules['validation'] == 'strict') { + } elseif (isset($rules['validation']) && $rules['validation'] === 'strict') { $field = null; } @@ -138,7 +138,7 @@ class BlueprintSchema extends BlueprintSchemaBase implements ExportInterface if (isset($data[$name])) { continue; } - if ($field['type'] == 'file' && isset($data['data']['name'][$name])) { //handle case of file input fields required + if ($field['type'] === 'file' && isset($data['data']['name'][$name])) { //handle case of file input fields required continue; } @@ -164,7 +164,7 @@ class BlueprintSchema extends BlueprintSchemaBase implements ExportInterface $default = isset($field[$property]) ? $field[$property] : null; $config = Grav::instance()['config']->get($value, $default); - if (!is_null($config)) { + if (null !== $config) { $field[$property] = $config; } } diff --git a/system/src/Grav/Common/Data/Blueprints.php b/system/src/Grav/Common/Data/Blueprints.php index 51d0c7783..cd2cb9f21 100644 --- a/system/src/Grav/Common/Data/Blueprints.php +++ b/system/src/Grav/Common/Data/Blueprints.php @@ -65,11 +65,11 @@ class Blueprints /** @var \DirectoryIterator $file */ foreach ($iterator as $file) { - if (!$file->isFile() || '.' . $file->getExtension() != YAML_EXT) { + if (!$file->isFile() || '.' . $file->getExtension() !== YAML_EXT) { continue; } $name = $file->getBasename(YAML_EXT); - $this->types[$name] = ucfirst(strtr($name, '_', ' ')); + $this->types[$name] = ucfirst(str_replace('_', ' ', $name)); } } diff --git a/system/src/Grav/Common/Data/Data.php b/system/src/Grav/Common/Data/Data.php index 75eb79d06..c3d25c0a3 100644 --- a/system/src/Grav/Common/Data/Data.php +++ b/system/src/Grav/Common/Data/Data.php @@ -233,6 +233,7 @@ class Data implements DataInterface, \ArrayAccess, \Countable, ExportInterface /** * Save data if storage has been defined. + * @throws \RuntimeException */ public function save() { diff --git a/system/src/Grav/Common/Errors/SimplePageHandler.php b/system/src/Grav/Common/Errors/SimplePageHandler.php index 9616b9d61..094c65ee9 100644 --- a/system/src/Grav/Common/Errors/SimplePageHandler.php +++ b/system/src/Grav/Common/Errors/SimplePageHandler.php @@ -57,6 +57,7 @@ class SimplePageHandler extends Handler * @param $resource * * @return string + * @throws \RuntimeException */ protected function getResource($resource) { @@ -80,8 +81,7 @@ class SimplePageHandler extends Handler // If we got this far, nothing was found. throw new \RuntimeException( - "Could not find resource '$resource' in any resource paths." - . "(searched: " . join(", ", $this->searchPaths). ")" + "Could not find resource '{$resource}' in any resource paths (searched: " . implode(', ', $this->searchPaths). ')' ); } @@ -89,7 +89,7 @@ class SimplePageHandler extends Handler { if (!is_dir($path)) { throw new \InvalidArgumentException( - "'$path' is not a valid directory" + "'{$path}' is not a valid directory" ); } diff --git a/system/src/Grav/Common/File/CompiledFile.php b/system/src/Grav/Common/File/CompiledFile.php index 406f4f097..c307ddccd 100644 --- a/system/src/Grav/Common/File/CompiledFile.php +++ b/system/src/Grav/Common/File/CompiledFile.php @@ -42,9 +42,9 @@ trait CompiledFile // Load real file if cache isn't up to date (or is invalid). if ( !isset($cache['@class']) - || $cache['@class'] != $class - || $cache['modified'] != $modified - || $cache['filename'] != $this->filename + || $cache['@class'] !== $class + || $cache['modified'] !== $modified + || $cache['filename'] !== $this->filename ) { // Attempt to lock the file for writing. try { diff --git a/system/src/Grav/Common/Filesystem/Folder.php b/system/src/Grav/Common/Filesystem/Folder.php index df9dec045..eb2b0ff3b 100644 --- a/system/src/Grav/Common/Filesystem/Folder.php +++ b/system/src/Grav/Common/Filesystem/Folder.php @@ -108,8 +108,7 @@ abstract class Folder $files[] = $file->getPathname() . '?'. $file->getMTime(); } - $hash = md5(serialize($files)); - return $hash; + return md5(serialize($files)); } /** @@ -234,7 +233,7 @@ abstract class Folder /** @var \RecursiveDirectoryIterator $file */ foreach ($iterator as $file) { // Ignore hidden files. - if ($file->getFilename()[0] == '.') { + if ($file->getFilename()[0] === '.') { continue; } if (!$folders && $file->isDir()) { @@ -339,7 +338,7 @@ abstract class Folder } // Don't do anything if the source is the same as the new target - if ($source == $target) { + if ($source === $target) { return; } @@ -377,6 +376,7 @@ abstract class Folder * @param string $target * @param bool $include_target * @return bool + * @throws \RuntimeException */ public static function delete($target, $include_target = true) { @@ -435,6 +435,7 @@ abstract class Folder * @param $dest * * @return bool + * @throws \RuntimeException */ public static function rcopy($src, $dest) { @@ -447,7 +448,7 @@ abstract class Folder // If the destination directory does not exist create it if (!is_dir($dest)) { - Folder::mkdir($dest); + static::mkdir($dest); } // Open the source directory to read in files @@ -455,10 +456,10 @@ abstract class Folder /** @var \DirectoryIterator $f */ foreach ($i as $f) { if ($f->isFile()) { - copy($f->getRealPath(), "$dest/" . $f->getFilename()); + copy($f->getRealPath(), "{$dest}/" . $f->getFilename()); } else { if (!$f->isDot() && $f->isDir()) { - static::rcopy($f->getRealPath(), "$dest/$f"); + static::rcopy($f->getRealPath(), "{$dest}/{$f}"); } } } @@ -479,10 +480,10 @@ abstract class Folder } // Go through all items in filesystem and recursively remove everything. - $files = array_diff(scandir($folder), array('.', '..')); + $files = array_diff(scandir($folder, SCANDIR_SORT_NONE), array('.', '..')); foreach ($files as $file) { $path = "{$folder}/{$file}"; - (is_dir($path)) ? self::doDelete($path) : @unlink($path); + is_dir($path) ? self::doDelete($path) : @unlink($path); } return $include_target ? @rmdir($folder) : true; diff --git a/system/src/Grav/Common/Filesystem/RecursiveFolderFilterIterator.php b/system/src/Grav/Common/Filesystem/RecursiveFolderFilterIterator.php index 96e5b7cac..62aa1ebfb 100644 --- a/system/src/Grav/Common/Filesystem/RecursiveFolderFilterIterator.php +++ b/system/src/Grav/Common/Filesystem/RecursiveFolderFilterIterator.php @@ -37,7 +37,7 @@ class RecursiveFolderFilterIterator extends \RecursiveFilterIterator /** @var $current \SplFileInfo */ $current = $this->current(); - if ($current->isDir() && !in_array($current->getFilename(), $this::$folder_ignores)) { + if ($current->isDir() && !in_array($current->getFilename(), $this::$folder_ignores, true)) { return true; } return false; diff --git a/system/src/Grav/Common/GPM/Common/Package.php b/system/src/Grav/Common/GPM/Common/Package.php index 7c6c5bb44..f2422c350 100644 --- a/system/src/Grav/Common/GPM/Common/Package.php +++ b/system/src/Grav/Common/GPM/Common/Package.php @@ -34,6 +34,10 @@ class Package { return isset($this->data->$key); } + public function __set($key, $value) { + throw new \BadMethodCallException('Not Implemented'); + } + public function __toString() { return $this->toJson(); } diff --git a/system/src/Grav/Common/GPM/Remote/GravCore.php b/system/src/Grav/Common/GPM/Remote/GravCore.php index cccf5683e..5e53476dd 100644 --- a/system/src/Grav/Common/GPM/Remote/GravCore.php +++ b/system/src/Grav/Common/GPM/Remote/GravCore.php @@ -22,6 +22,7 @@ class GravCore extends AbstractPackageCollection /** * @param bool $refresh * @param null $callback + * @throws \InvalidArgumentException */ public function __construct($refresh = false, $callback = null) { @@ -38,7 +39,7 @@ class GravCore extends AbstractPackageCollection $this->date = isset($this->data['date']) ? $this->data['date'] : '-'; if (isset($this->data['assets'])) { - foreach ($this->data['assets'] as $slug => $data) { + foreach ((array)$this->data['assets'] as $slug => $data) { $this->items[$slug] = new Package($data); } } @@ -68,10 +69,10 @@ class GravCore extends AbstractPackageCollection } $diffLog = []; - foreach ($this->data['changelog'] as $version => $changelog) { + foreach ((array)$this->data['changelog'] as $version => $changelog) { preg_match("/[\w-\.]+/", $version, $cleanVersion); - if (!$cleanVersion || version_compare($diff, $cleanVersion[0], ">=")) { + if (!$cleanVersion || version_compare($diff, $cleanVersion[0], '>=')) { continue; } diff --git a/system/src/Grav/Common/GPM/Upgrader.php b/system/src/Grav/Common/GPM/Upgrader.php index 72390095b..fba405ad1 100644 --- a/system/src/Grav/Common/GPM/Upgrader.php +++ b/system/src/Grav/Common/GPM/Upgrader.php @@ -29,6 +29,7 @@ class Upgrader * * @param boolean $refresh Applies to Remote Packages only and forces a refetch of data * @param callable $callback Either a function or callback in array notation + * @throws \InvalidArgumentException */ public function __construct($refresh = false, $callback = null) { diff --git a/system/src/Grav/Common/Helpers/Base32.php b/system/src/Grav/Common/Helpers/Base32.php index 33cb0f194..9c1918f97 100644 --- a/system/src/Grav/Common/Helpers/Base32.php +++ b/system/src/Grav/Common/Helpers/Base32.php @@ -32,7 +32,7 @@ class Base32 { */ public static function encode( $bytes ) { $i = 0; $index = 0; $digit = 0; - $base32 = ""; + $base32 = ''; $bytes_len = strlen($bytes); while( $i < $bytes_len ) { $currByte = ord($bytes{$i}); @@ -51,7 +51,7 @@ class Base32 { } else { $digit = ($currByte >> (8 - ($index + 5))) & 0x1F; $index = ($index + 5) % 8; - if( $index == 0 ) $i++; + if( $index === 0 ) $i++; } $base32 .= self::$base32Chars{$digit}; } @@ -96,7 +96,7 @@ class Base32 { $bytes[$offset] |= $digit << (8 - $index); } } - $bites = ""; + $bites = ''; foreach( $bytes as $byte ) $bites .= chr($byte); return $bites; } diff --git a/system/src/Grav/Common/Helpers/Excerpts.php b/system/src/Grav/Common/Helpers/Excerpts.php index 03b4e32cd..5b9ba1fd6 100644 --- a/system/src/Grav/Common/Helpers/Excerpts.php +++ b/system/src/Grav/Common/Helpers/Excerpts.php @@ -55,13 +55,13 @@ class Excerpts public static function getExcerptFromHtml($html, $tag) { $doc = new \DOMDocument(); - $doc->loadHtml($html); + $doc->loadHTML($html); $images = $doc->getElementsByTagName($tag); $excerpt = null; foreach ($images as $image) { $attributes = []; - foreach ($image->attributes as $name => $value) { + foreach ((array)$image->attributes as $name => $value) { $attributes[$name] = $value->value; } $excerpt = [ @@ -87,7 +87,7 @@ class Excerpts $html = '<'.$element['name']; if (isset($element['attributes'])) { - foreach ($element['attributes'] as $name => $value) { + foreach ((array)$element['attributes'] as $name => $value) { if ($value === null) { continue; } @@ -141,9 +141,9 @@ class Excerpts foreach ($actions as $attrib => $value) { $key = $attrib; - if (in_array($attrib, $valid_attributes)) { + if (in_array($attrib, $valid_attributes, true)) { // support both class and classes. - if ($attrib == 'classes') { + if ($attrib === 'classes') { $attrib = 'class'; } $excerpt['element']['attributes'][$attrib] = str_replace(',', ' ', $value); @@ -210,8 +210,8 @@ class Excerpts } else { // File is also local if scheme is http(s) and host matches. $local_file = isset($url_parts['path']) - && (empty($url_parts['scheme']) || in_array($url_parts['scheme'], ['http', 'https'])) - && (empty($url_parts['host']) || $url_parts['host'] == Grav::instance()['uri']->host()); + && (empty($url_parts['scheme']) || in_array($url_parts['scheme'], ['http', 'https'], true)) + && (empty($url_parts['host']) || $url_parts['host'] === Grav::instance()['uri']->host()); if ($local_file) { $filename = basename($url_parts['path']); @@ -251,7 +251,7 @@ class Excerpts $class = isset($excerpt['element']['attributes']['class']) ? $excerpt['element']['attributes']['class'] : ''; $id = isset($excerpt['element']['attributes']['id']) ? $excerpt['element']['attributes']['id'] : ''; - $excerpt['element'] = $medium->parseDownElement($title, $alt, $class, $id, true); + $excerpt['element'] = $medium->parsedownElement($title, $alt, $class, $id, true); } else { // Not a current page media file, see if it needs converting to relative. diff --git a/system/src/Grav/Common/Helpers/Exif.php b/system/src/Grav/Common/Helpers/Exif.php index e33cc7366..94a5e72ac 100644 --- a/system/src/Grav/Common/Helpers/Exif.php +++ b/system/src/Grav/Common/Helpers/Exif.php @@ -9,18 +9,23 @@ namespace Grav\Common\Helpers; use Grav\Common\Grav; +use SebastianBergmann\GlobalState\RuntimeException; class Exif { public $reader; + /** + * Exif constructor. + * @throws RuntimeException + */ public function __construct() { if (Grav::instance()['config']->get('system.media.auto_metadata_exif')) { if (function_exists('exif_read_data') && class_exists('\PHPExif\Reader\Reader')) { $this->reader = \PHPExif\Reader\Reader::factory(\PHPExif\Reader\Reader::TYPE_NATIVE); } else { - throw new \Exception('Please enable the Exif extension for PHP or disable Exif support in Grav system configuration'); + throw new \RuntimeException('Please enable the Exif extension for PHP or disable Exif support in Grav system configuration'); } } } diff --git a/system/src/Grav/Common/Helpers/Truncator.php b/system/src/Grav/Common/Helpers/Truncator.php index 1318b7e66..12593847c 100644 --- a/system/src/Grav/Common/Helpers/Truncator.php +++ b/system/src/Grav/Common/Helpers/Truncator.php @@ -34,7 +34,7 @@ class Truncator { * @param string $ellipsis String to use as ellipsis (if any). * @return string Safe truncated HTML. */ - public static function truncateWords($html, $limit = 0, $ellipsis = "") + public static function truncateWords($html, $limit = 0, $ellipsis = '') { if ($limit <= 0) { return $html; @@ -94,7 +94,7 @@ class Truncator { $dom = self::htmlToDomDocument($html); // Grab the body of our DOM. - $body = $dom->getElementsByTagName("body")->item(0); + $body = $dom->getElementsByTagName('body')->item(0); // Iterate over letters. $letters = new DOMLettersIterator($body); @@ -181,7 +181,7 @@ class Truncator { { $avoid = array('a', 'strong', 'em', 'h1', 'h2', 'h3', 'h4', 'h5'); //html tags to avoid appending the ellipsis to - if (in_array($domNode->parentNode->nodeName, $avoid) && $domNode->parentNode->parentNode !== null) { + if ($domNode->parentNode->parentNode !== null && in_array($domNode->parentNode->nodeName, $avoid, true)) { // Append as text node to parent instead $textNode = new DOMText($ellipsis); @@ -204,9 +204,9 @@ class Truncator { * @return string */ private static function innerHTML($element) { - $innerHTML = ""; + $innerHTML = ''; $children = $element->childNodes; - foreach ($children as $child) + foreach ((array)$children as $child) { $tmp_dom = new DOMDocument(); $tmp_dom->appendChild($tmp_dom->importNode($child, true)); diff --git a/system/src/Grav/Common/Language/LanguageCodes.php b/system/src/Grav/Common/Language/LanguageCodes.php index 68225c8e4..7097dcba4 100644 --- a/system/src/Grav/Common/Language/LanguageCodes.php +++ b/system/src/Grav/Common/Language/LanguageCodes.php @@ -157,14 +157,13 @@ class LanguageCodes { if (isset(static::$codes[$code])) { return static::get($code, 'nativeName'); - } else { - if (preg_match('/[a-zA-Z]{2}-[a-zA-Z]{2}/', $code)) { - return static::get(substr($code, 0, 2), 'nativeName') . ' (' . substr($code, -2) . ')'; - } else { - return $code; - } - } + + if (preg_match('/[a-zA-Z]{2}-[a-zA-Z]{2}/', $code)) { + return static::get(substr($code, 0, 2), 'nativeName') . ' (' . substr($code, -2) . ')'; + } + + return $code; } public static function getOrientation($code) @@ -179,7 +178,7 @@ class LanguageCodes public static function isRtl($code) { - if (static::getOrientation($code) == 'rtl') { + if (static::getOrientation($code) === 'rtl') { return true; } return false; @@ -192,7 +191,6 @@ class LanguageCodes if (isset(static::$codes[$key])) { $results[$key] = static::$codes[$key]; } - } return $results; } @@ -201,8 +199,8 @@ class LanguageCodes { if (isset(static::$codes[$code][$type])) { return static::$codes[$code][$type]; - } else { - return false; } + + return false; } } diff --git a/system/src/Grav/Common/Page/Medium/MediumFactory.php b/system/src/Grav/Common/Page/Medium/MediumFactory.php index 9c6a0a536..ea2b3a32f 100644 --- a/system/src/Grav/Common/Page/Medium/MediumFactory.php +++ b/system/src/Grav/Common/Page/Medium/MediumFactory.php @@ -34,7 +34,7 @@ class MediumFactory $config = Grav::instance()['config']; - $media_params = $config->get("media.types.".strtolower($ext)); + $media_params = $config->get("media.types." . strtolower($ext)); if (!$media_params) { return null; } @@ -106,7 +106,7 @@ class MediumFactory * @param ImageMedium $medium * @param int $from * @param int $to - * @return Medium + * @return Medium|array */ public static function scaledFromMedium($medium, $from, $to) { diff --git a/system/src/Grav/Common/Page/Medium/ThumbnailImageMedium.php b/system/src/Grav/Common/Page/Medium/ThumbnailImageMedium.php index 82c9501c8..7cbd74dfd 100644 --- a/system/src/Grav/Common/Page/Medium/ThumbnailImageMedium.php +++ b/system/src/Grav/Common/Page/Medium/ThumbnailImageMedium.php @@ -123,8 +123,8 @@ class ThumbnailImageMedium extends ImageMedium { if (!$testLinked || $this->linked) { return $this->parent ? call_user_func_array(array($this->parent, $method), $arguments) : $this; - } else { - return call_user_func_array(array($this, 'parent::' . $method), $arguments); } + + return call_user_func_array(array($this, 'parent::' . $method), $arguments); } } diff --git a/system/src/Grav/Common/Page/Medium/VideoMedium.php b/system/src/Grav/Common/Page/Medium/VideoMedium.php index 9f477d261..144d9d43c 100644 --- a/system/src/Grav/Common/Page/Medium/VideoMedium.php +++ b/system/src/Grav/Common/Page/Medium/VideoMedium.php @@ -38,14 +38,12 @@ class VideoMedium extends Medium */ public function controls($display = true) { - if($display) - { + if($display) { $this->attributes['controls'] = true; - } - else - { + } else { unset($this->attributes['controls']); } + return $this; } @@ -58,6 +56,7 @@ class VideoMedium extends Medium public function poster($urlImage) { $this->attributes['poster'] = $urlImage; + return $this; } @@ -69,14 +68,12 @@ class VideoMedium extends Medium */ public function loop($status = false) { - if($status) - { + if($status) { $this->attributes['loop'] = true; - } - else - { + } else { unset($this->attributes['loop']); } + return $this; } @@ -88,14 +85,12 @@ class VideoMedium extends Medium */ public function autoplay($status = false) { - if($status) - { + if($status) { $this->attributes['autoplay'] = true; - } - else - { + } else { unset($this->attributes['autoplay']); } + return $this; } @@ -109,6 +104,7 @@ class VideoMedium extends Medium parent::reset(); $this->attributes['controls'] = true; + return $this; } } diff --git a/system/src/Grav/Common/Twig/Node/TwigNodeScript.php b/system/src/Grav/Common/Twig/Node/TwigNodeScript.php index 1bd509e1b..83ba5ced9 100644 --- a/system/src/Grav/Common/Twig/Node/TwigNodeScript.php +++ b/system/src/Grav/Common/Twig/Node/TwigNodeScript.php @@ -38,6 +38,7 @@ class TwigNodeScript extends \Twig_Node implements \Twig_NodeOutputInterface * Compiles the node to PHP. * * @param \Twig_Compiler $compiler A Twig_Compiler instance + * @throws \LogicException */ public function compile(\Twig_Compiler $compiler) { diff --git a/system/src/Grav/Common/Twig/Node/TwigNodeStyle.php b/system/src/Grav/Common/Twig/Node/TwigNodeStyle.php index a3d13dbef..affb9600a 100644 --- a/system/src/Grav/Common/Twig/Node/TwigNodeStyle.php +++ b/system/src/Grav/Common/Twig/Node/TwigNodeStyle.php @@ -35,6 +35,7 @@ class TwigNodeStyle extends \Twig_Node implements \Twig_NodeOutputInterface * Compiles the node to PHP. * * @param \Twig_Compiler $compiler A Twig_Compiler instance + * @throws \LogicException */ public function compile(\Twig_Compiler $compiler) { From cc648b885cfc959d788246c4889508bb015cc318 Mon Sep 17 00:00:00 2001 From: Djamil Legato Date: Fri, 8 Dec 2017 18:14:04 -0800 Subject: [PATCH 049/141] Updated grav version for 2.0 branch --- system/defines.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/defines.php b/system/defines.php index b6a4e6200..331151643 100644 --- a/system/defines.php +++ b/system/defines.php @@ -8,7 +8,7 @@ // Some standard defines define('GRAV', true); -define('GRAV_VERSION', '1.3.8'); +define('GRAV_VERSION', '2.0.0'); //define('GRAV_TESTING', true); define('DS', '/'); From 8d82fce89f437aacd9dfbc61165147e1a4493c59 Mon Sep 17 00:00:00 2001 From: Djamil Legato Date: Mon, 11 Dec 2017 11:46:30 -0800 Subject: [PATCH 050/141] Updated version to 1.4.0-beta.1 --- CHANGELOG.md | 22 +++++++++++----------- system/defines.php | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 784d70abb..3647ab91a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# v2.0.0-dev +# v1.4.0-beta.1 ## mm/dd/2017 1. [](#new) @@ -23,14 +23,14 @@ ## 12/06/2017 1. [](#bugfix) - * Reverted GPM Local pull request as it broken admin [#1742](https://github.com/getgrav/grav/issues/1742) + * Reverted GPM Local pull request as it broken admin [#1742](https://github.com/getgrav/grav/issues/1742) # v1.3.9 ## 12/05/2017 1. [](#new) * Added new core Twig templates for `partials/metadata.html.twig` and `partials/messages.html.twig` - * Added ability to work with GPM locally [#1742](https://github.com/getgrav/grav/issues/1742) + * Added ability to work with GPM locally [#1742](https://github.com/getgrav/grav/issues/1742) * Added new HTML5 audio controls [#1756](https://github.com/getgrav/grav/issues/1756) * Added `Medium::copy()` method to create a copy of a medium object * Added new `force_lowercase_urls` functionality on routes and slugs @@ -54,15 +54,15 @@ * Fixed token creation issue with `Uri` params like `/id:3` * Fixed CSS Pipeline failing with Google remote fonts if the file was minified [#1261](https://github.com/getgrav/grav-plugin-admin/issues/1261) * Forced `field.multiple: true` to allow use of min/max options in `checkboxes.validate` - + # v1.3.8 ## 10/26/2017 1. [](#new) * Added Page `media_order` capability to manually order page media via a page header 1. [](#bugfix) - * Fixed GPM update issue with filtered slugs [#1711](https://github.com/getgrav/grav/issues/1711) - * Fixed issue with missing image file not throwing 404 properly [#1713](https://github.com/getgrav/grav/issues/1713) + * Fixed GPM update issue with filtered slugs [#1711](https://github.com/getgrav/grav/issues/1711) + * Fixed issue with missing image file not throwing 404 properly [#1713](https://github.com/getgrav/grav/issues/1713) # v1.3.7 ## 10/18/2017 @@ -78,20 +78,20 @@ 1. [](#bugfix) * Regression: Ajax error in Nginx [admin#1244](https://github.com/getgrav/grav-plugin-admin/issues/1244) * Remove the `_url=$uri` portion of the the Nginx `try_files` command [admin#1244](https://github.com/getgrav/grav-plugin-admin/issues/1244) - + # v1.3.5 ## 10/11/2017 1. [](#improved) * Refactored `URI` class with numerous bug fixes, and optimizations * Override `system.media.upload_limit` with PHP's `post_max_size` or `upload_max_filesize` - * Updated `bin/grav clean` command to remove unnecessary vendor files (save some bytes) + * Updated `bin/grav clean` command to remove unnecessary vendor files (save some bytes) * Added a `http_status_code` Twig function to allow setting HTTP status codes from Twig directly. * Deter XSS attacks via URI path/uri methods (credit:newbthenewbd) * Added support for `$uri->toArray()` and `(string)$uri` * Added support for `type` on `Asstes::addInlineJs()` [#1683](https://github.com/getgrav/grav/pull/1683) 1. [](#bugfix) - * Fixed method signature error with `GPM\InstallCommand::processPackage()` [#1682](https://github.com/getgrav/grav/pull/1682) + * Fixed method signature error with `GPM\InstallCommand::processPackage()` [#1682](https://github.com/getgrav/grav/pull/1682) # v1.3.4 ## 09/29/2017 @@ -105,7 +105,7 @@ * Improved support for Assets with query strings [#1451](https://github.com/getgrav/grav/issues/1451) * Twig extension cleanup 1. [](#bugfix) - * Fixed an issue where fallback was not supporting dynamic page generation + * Fixed an issue where fallback was not supporting dynamic page generation * Fixed issue with Image query string not being fully URL encoded [#1622](https://github.com/getgrav/grav/issues/1622) * Fixed `Page::summary()` when using delimiter and multibyte UTF8 Characters [#1644](https://github.com/getgrav/grav/issues/1644) * Fixed missing `.json` thumbnail throwing error when adding media [grav-plugin-admin#1156](https://github.com/getgrav/grav-plugin-admin/issues/1156) @@ -148,7 +148,7 @@ * Allow `session.timeout` field to be set to `0` via blueprints [#1598](https://github.com/getgrav/grav/issues/1598) * Fixed `Data::exists()` and `Data::raw()` functions breaking if `Data::file()` hasn't been called with non-null value * Fixed parent theme auto-loading in child themes of Gantry 5 - + # v1.3.1 ## 07/19/2017 diff --git a/system/defines.php b/system/defines.php index 331151643..6c2d0d4a4 100644 --- a/system/defines.php +++ b/system/defines.php @@ -8,8 +8,8 @@ // Some standard defines define('GRAV', true); -define('GRAV_VERSION', '2.0.0'); -//define('GRAV_TESTING', true); +define('GRAV_VERSION', '1.4.0-beta.1'); +define('GRAV_TESTING', true); define('DS', '/'); if (!defined('GRAV_PHP_MIN')) { From d34fad65b5667f2697a8a2a25d4bd27d32ca07b2 Mon Sep 17 00:00:00 2001 From: Djamil Legato Date: Mon, 11 Dec 2017 11:49:19 -0800 Subject: [PATCH 051/141] Removed Page interfaces --- CHANGELOG.md | 1 - .../Grav/Framework/Page/FilePageInterface.php | 37 ------- .../Page/PageCollectionInterface.php | 15 --- .../Framework/Page/PageHeaderInterface.php | 13 --- .../src/Grav/Framework/Page/PageInterface.php | 98 ------------------- .../Page/PageMediaCollectionInterface.php | 15 --- 6 files changed, 179 deletions(-) delete mode 100644 system/src/Grav/Framework/Page/FilePageInterface.php delete mode 100644 system/src/Grav/Framework/Page/PageCollectionInterface.php delete mode 100644 system/src/Grav/Framework/Page/PageHeaderInterface.php delete mode 100644 system/src/Grav/Framework/Page/PageInterface.php delete mode 100644 system/src/Grav/Framework/Page/PageMediaCollectionInterface.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 3647ab91a..70cbd18cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,6 @@ * Added `Grav\Framework\Cache` classes providing PSR-16 `Simple Cache` implementation * Added `Grav\Framework\ContentBlock` classes for nested HTML blocks with CSS/JS assets * Added `Grav\Framework\Object` classes for creating collections of objects - * Added `Grav\Framework\Page` interfaces * Added `|nicenumber` Twig filter * Added `{% try %} ... {% catch %} Error: {{ e.message }} {% endcatch %}` tag to allow basic exception handling inside Twig * Added `{% script %}` and `{% style %}` tags for Twig templates diff --git a/system/src/Grav/Framework/Page/FilePageInterface.php b/system/src/Grav/Framework/Page/FilePageInterface.php deleted file mode 100644 index c090d8f9a..000000000 --- a/system/src/Grav/Framework/Page/FilePageInterface.php +++ /dev/null @@ -1,37 +0,0 @@ - Date: Mon, 11 Dec 2017 11:56:07 -0800 Subject: [PATCH 052/141] Changed GPM channel to testing --- user/config/system.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user/config/system.yaml b/user/config/system.yaml index 474d8edfd..7bc0f5171 100644 --- a/user/config/system.yaml +++ b/user/config/system.yaml @@ -41,5 +41,5 @@ debugger: shutdown: close_connection: true gpm: - releases: stable + releases: testing verify_peer: true From b5f75acf50122ed90ec014e86d7a0a8868788ef5 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 11 Dec 2017 13:17:03 -0700 Subject: [PATCH 053/141] Fix array casting with DOM elements --- system/src/Grav/Common/Helpers/Excerpts.php | 4 ++-- system/src/Grav/Common/Helpers/Truncator.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/system/src/Grav/Common/Helpers/Excerpts.php b/system/src/Grav/Common/Helpers/Excerpts.php index b8b254435..0a0a4a28e 100644 --- a/system/src/Grav/Common/Helpers/Excerpts.php +++ b/system/src/Grav/Common/Helpers/Excerpts.php @@ -62,7 +62,7 @@ class Excerpts foreach ($images as $image) { $attributes = []; - foreach ((array)$image->attributes as $name => $value) { + foreach ($image->attributes as $name => $value) { $attributes[$name] = $value->value; } $excerpt = [ @@ -88,7 +88,7 @@ class Excerpts $html = '<'.$element['name']; if (isset($element['attributes'])) { - foreach ((array)$element['attributes'] as $name => $value) { + foreach ($element['attributes'] as $name => $value) { if ($value === null) { continue; } diff --git a/system/src/Grav/Common/Helpers/Truncator.php b/system/src/Grav/Common/Helpers/Truncator.php index 12593847c..e5c0b348f 100644 --- a/system/src/Grav/Common/Helpers/Truncator.php +++ b/system/src/Grav/Common/Helpers/Truncator.php @@ -206,7 +206,7 @@ class Truncator { private static function innerHTML($element) { $innerHTML = ''; $children = $element->childNodes; - foreach ((array)$children as $child) + foreach ($children as $child) { $tmp_dom = new DOMDocument(); $tmp_dom->appendChild($tmp_dom->importNode($child, true)); From 7ec66b2bf296689a7accd38ee5626d01b32b0070 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 11 Dec 2017 15:08:05 -0700 Subject: [PATCH 054/141] Transferred copyright --- CHANGELOG.md | 7 +++++++ backup/.gitkeep | 0 index.php | 2 +- system/defines.php | 2 +- system/router.php | 2 +- system/src/Grav/Common/Assets.php | 2 +- system/src/Grav/Common/Backup/ZipBackup.php | 2 +- system/src/Grav/Common/Browser.php | 2 +- system/src/Grav/Common/Cache.php | 2 +- system/src/Grav/Common/Composer.php | 2 +- system/src/Grav/Common/Config/CompiledBase.php | 2 +- system/src/Grav/Common/Config/CompiledBlueprints.php | 2 +- system/src/Grav/Common/Config/CompiledConfig.php | 2 +- system/src/Grav/Common/Config/CompiledLanguages.php | 2 +- system/src/Grav/Common/Config/Config.php | 2 +- system/src/Grav/Common/Config/ConfigFileFinder.php | 2 +- system/src/Grav/Common/Config/Languages.php | 2 +- system/src/Grav/Common/Config/Setup.php | 2 +- system/src/Grav/Common/Data/Blueprint.php | 2 +- system/src/Grav/Common/Data/BlueprintSchema.php | 2 +- system/src/Grav/Common/Data/Blueprints.php | 2 +- system/src/Grav/Common/Data/Data.php | 2 +- system/src/Grav/Common/Data/DataInterface.php | 2 +- system/src/Grav/Common/Data/Validation.php | 2 +- system/src/Grav/Common/Data/ValidationException.php | 2 +- system/src/Grav/Common/Debugger.php | 2 +- system/src/Grav/Common/Errors/BareHandler.php | 2 +- system/src/Grav/Common/Errors/Errors.php | 2 +- system/src/Grav/Common/Errors/SimplePageHandler.php | 2 +- system/src/Grav/Common/Errors/SystemFacade.php | 2 +- system/src/Grav/Common/File/CompiledFile.php | 2 +- system/src/Grav/Common/File/CompiledJsonFile.php | 2 +- system/src/Grav/Common/File/CompiledMarkdownFile.php | 2 +- system/src/Grav/Common/File/CompiledYamlFile.php | 2 +- system/src/Grav/Common/Filesystem/Folder.php | 2 +- .../Common/Filesystem/RecursiveFolderFilterIterator.php | 2 +- system/src/Grav/Common/GPM/AbstractCollection.php | 2 +- .../Grav/Common/GPM/Common/AbstractPackageCollection.php | 2 +- system/src/Grav/Common/GPM/Common/CachedCollection.php | 2 +- system/src/Grav/Common/GPM/Common/Package.php | 2 +- system/src/Grav/Common/GPM/GPM.php | 2 +- system/src/Grav/Common/GPM/Installer.php | 2 +- system/src/Grav/Common/GPM/Licenses.php | 2 +- .../Grav/Common/GPM/Local/AbstractPackageCollection.php | 2 +- system/src/Grav/Common/GPM/Local/Package.php | 2 +- system/src/Grav/Common/GPM/Local/Packages.php | 2 +- system/src/Grav/Common/GPM/Local/Plugins.php | 2 +- system/src/Grav/Common/GPM/Local/Themes.php | 2 +- .../Grav/Common/GPM/Remote/AbstractPackageCollection.php | 2 +- system/src/Grav/Common/GPM/Remote/GravCore.php | 2 +- system/src/Grav/Common/GPM/Remote/Package.php | 2 +- system/src/Grav/Common/GPM/Remote/Packages.php | 2 +- system/src/Grav/Common/GPM/Remote/Plugins.php | 2 +- system/src/Grav/Common/GPM/Remote/Themes.php | 2 +- system/src/Grav/Common/GPM/Response.php | 2 +- system/src/Grav/Common/GPM/Upgrader.php | 2 +- system/src/Grav/Common/Getters.php | 2 +- system/src/Grav/Common/Grav.php | 2 +- system/src/Grav/Common/GravTrait.php | 2 +- system/src/Grav/Common/Helpers/Base32.php | 2 +- system/src/Grav/Common/Helpers/Excerpts.php | 2 +- system/src/Grav/Common/Helpers/Exif.php | 2 +- system/src/Grav/Common/Helpers/Truncator.php | 2 +- system/src/Grav/Common/Inflector.php | 2 +- system/src/Grav/Common/Iterator.php | 2 +- system/src/Grav/Common/Language/Language.php | 2 +- system/src/Grav/Common/Language/LanguageCodes.php | 2 +- system/src/Grav/Common/Markdown/Parsedown.php | 2 +- system/src/Grav/Common/Markdown/ParsedownExtra.php | 2 +- system/src/Grav/Common/Markdown/ParsedownGravTrait.php | 2 +- system/src/Grav/Common/Page/Collection.php | 2 +- system/src/Grav/Common/Page/Header.php | 2 +- system/src/Grav/Common/Page/Media.php | 2 +- system/src/Grav/Common/Page/Medium/AbstractMedia.php | 2 +- system/src/Grav/Common/Page/Medium/AudioMedium.php | 2 +- system/src/Grav/Common/Page/Medium/GlobalMedia.php | 2 +- system/src/Grav/Common/Page/Medium/ImageFile.php | 2 +- system/src/Grav/Common/Page/Medium/ImageMedium.php | 2 +- system/src/Grav/Common/Page/Medium/Link.php | 2 +- system/src/Grav/Common/Page/Medium/Medium.php | 2 +- system/src/Grav/Common/Page/Medium/MediumFactory.php | 2 +- system/src/Grav/Common/Page/Medium/ParsedownHtmlTrait.php | 2 +- system/src/Grav/Common/Page/Medium/RenderableInterface.php | 2 +- system/src/Grav/Common/Page/Medium/StaticImageMedium.php | 2 +- system/src/Grav/Common/Page/Medium/StaticResizeTrait.php | 2 +- .../src/Grav/Common/Page/Medium/ThumbnailImageMedium.php | 2 +- system/src/Grav/Common/Page/Medium/VideoMedium.php | 2 +- system/src/Grav/Common/Page/Page.php | 2 +- system/src/Grav/Common/Page/Pages.php | 2 +- system/src/Grav/Common/Page/Types.php | 2 +- system/src/Grav/Common/Plugin.php | 2 +- system/src/Grav/Common/Plugins.php | 2 +- system/src/Grav/Common/Processors/AssetsProcessor.php | 2 +- .../src/Grav/Common/Processors/ConfigurationProcessor.php | 2 +- .../src/Grav/Common/Processors/DebuggerAssetsProcessor.php | 2 +- .../src/Grav/Common/Processors/DebuggerInitProcessor.php | 2 +- system/src/Grav/Common/Processors/ErrorsProcessor.php | 2 +- system/src/Grav/Common/Processors/InitializeProcessor.php | 2 +- system/src/Grav/Common/Processors/PagesProcessor.php | 2 +- system/src/Grav/Common/Processors/PluginsProcessor.php | 2 +- system/src/Grav/Common/Processors/ProcessorBase.php | 2 +- system/src/Grav/Common/Processors/ProcessorInterface.php | 2 +- system/src/Grav/Common/Processors/RenderProcessor.php | 2 +- system/src/Grav/Common/Processors/SiteSetupProcessor.php | 2 +- system/src/Grav/Common/Processors/TasksProcessor.php | 2 +- system/src/Grav/Common/Processors/ThemesProcessor.php | 2 +- system/src/Grav/Common/Processors/TwigProcessor.php | 2 +- system/src/Grav/Common/Service/AssetsServiceProvider.php | 2 +- system/src/Grav/Common/Service/ConfigServiceProvider.php | 2 +- system/src/Grav/Common/Service/ErrorServiceProvider.php | 2 +- system/src/Grav/Common/Service/LoggerServiceProvider.php | 2 +- system/src/Grav/Common/Service/MessagesServiceProvider.php | 2 +- system/src/Grav/Common/Service/OutputServiceProvider.php | 2 +- system/src/Grav/Common/Service/PageServiceProvider.php | 2 +- system/src/Grav/Common/Service/StreamsServiceProvider.php | 2 +- system/src/Grav/Common/Service/TaskServiceProvider.php | 2 +- system/src/Grav/Common/Session.php | 2 +- system/src/Grav/Common/Taxonomy.php | 2 +- system/src/Grav/Common/Theme.php | 2 +- system/src/Grav/Common/Themes.php | 2 +- system/src/Grav/Common/Twig/Node/TwigNodeScript.php | 2 +- system/src/Grav/Common/Twig/Node/TwigNodeStyle.php | 2 +- system/src/Grav/Common/Twig/Node/TwigNodeTryCatch.php | 2 +- .../Grav/Common/Twig/TokenParser/TwigTokenParserScript.php | 2 +- .../Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php | 2 +- .../Common/Twig/TokenParser/TwigTokenParserTryCatch.php | 2 +- system/src/Grav/Common/Twig/Twig.php | 2 +- system/src/Grav/Common/Twig/TwigEnvironment.php | 2 +- system/src/Grav/Common/Twig/TwigExtension.php | 2 +- system/src/Grav/Common/Twig/WriteCacheFileTrait.php | 2 +- system/src/Grav/Common/Uri.php | 2 +- system/src/Grav/Common/User/Authentication.php | 2 +- system/src/Grav/Common/User/Group.php | 2 +- system/src/Grav/Common/User/User.php | 2 +- system/src/Grav/Common/Utils.php | 2 +- system/src/Grav/Console/Cli/BackupCommand.php | 2 +- system/src/Grav/Console/Cli/CleanCommand.php | 2 +- system/src/Grav/Console/Cli/ClearCacheCommand.php | 2 +- system/src/Grav/Console/Cli/ComposerCommand.php | 2 +- system/src/Grav/Console/Cli/InstallCommand.php | 2 +- system/src/Grav/Console/Cli/NewProjectCommand.php | 2 +- system/src/Grav/Console/Cli/SandboxCommand.php | 2 +- system/src/Grav/Console/ConsoleCommand.php | 2 +- system/src/Grav/Console/ConsoleTrait.php | 2 +- system/src/Grav/Console/Gpm/DirectInstallCommand.php | 2 +- system/src/Grav/Console/Gpm/IndexCommand.php | 2 +- system/src/Grav/Console/Gpm/InfoCommand.php | 2 +- system/src/Grav/Console/Gpm/InstallCommand.php | 2 +- system/src/Grav/Console/Gpm/SelfupgradeCommand.php | 2 +- system/src/Grav/Console/Gpm/UninstallCommand.php | 2 +- system/src/Grav/Console/Gpm/UpdateCommand.php | 2 +- system/src/Grav/Console/Gpm/VersionCommand.php | 2 +- system/src/Grav/Console/TerminalObjects/Table.php | 2 +- system/src/Grav/Framework/Cache/AbstractCache.php | 2 +- system/src/Grav/Framework/Cache/Adapter/ChainCache.php | 2 +- system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php | 2 +- system/src/Grav/Framework/Cache/Adapter/FileCache.php | 2 +- system/src/Grav/Framework/Cache/Adapter/MemoryCache.php | 2 +- system/src/Grav/Framework/Cache/Adapter/SessionCache.php | 2 +- system/src/Grav/Framework/Cache/CacheInterface.php | 2 +- system/src/Grav/Framework/Cache/CacheTrait.php | 2 +- .../src/Grav/Framework/Cache/Exception/CacheException.php | 2 +- .../Framework/Cache/Exception/InvalidArgumentException.php | 2 +- .../Grav/Framework/Collection/AbstractFileCollection.php | 2 +- .../Grav/Framework/Collection/AbstractLazyCollection.php | 2 +- system/src/Grav/Framework/Collection/ArrayCollection.php | 2 +- .../src/Grav/Framework/Collection/CollectionInterface.php | 2 +- system/src/Grav/Framework/Collection/FileCollection.php | 2 +- .../Grav/Framework/Collection/FileCollectionInterface.php | 2 +- system/src/Grav/Framework/ContentBlock/ContentBlock.php | 2 +- .../Grav/Framework/ContentBlock/ContentBlockInterface.php | 2 +- system/src/Grav/Framework/ContentBlock/HtmlBlock.php | 2 +- .../src/Grav/Framework/ContentBlock/HtmlBlockInterface.php | 2 +- .../src/Grav/Framework/Object/Access/ArrayAccessTrait.php | 2 +- .../Framework/Object/Access/NestedArrayAccessTrait.php | 2 +- .../Object/Access/NestedPropertyCollectionTrait.php | 2 +- .../Grav/Framework/Object/Access/NestedPropertyTrait.php | 2 +- .../Framework/Object/Access/OverloadedPropertyTrait.php | 2 +- system/src/Grav/Framework/Object/ArrayObject.php | 2 +- .../Grav/Framework/Object/Base/ObjectCollectionTrait.php | 2 +- system/src/Grav/Framework/Object/Base/ObjectTrait.php | 2 +- .../Framework/Object/Interfaces/NestedObjectInterface.php | 2 +- .../Object/Interfaces/ObjectCollectionInterface.php | 2 +- .../Grav/Framework/Object/Interfaces/ObjectInterface.php | 2 +- system/src/Grav/Framework/Object/LazyObject.php | 2 +- system/src/Grav/Framework/Object/ObjectCollection.php | 2 +- .../Grav/Framework/Object/Property/ArrayPropertyTrait.php | 2 +- .../Grav/Framework/Object/Property/LazyPropertyTrait.php | 2 +- .../Grav/Framework/Object/Property/MixedPropertyTrait.php | 2 +- .../Grav/Framework/Object/Property/ObjectPropertyTrait.php | 2 +- system/src/Grav/Framework/Object/PropertyObject.php | 2 +- 191 files changed, 196 insertions(+), 189 deletions(-) delete mode 100644 backup/.gitkeep diff --git a/CHANGELOG.md b/CHANGELOG.md index 70cbd18cf..549f357e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # v1.4.0-beta.1 ## mm/dd/2017 +1. [](#new) + * Transferred copyright from RocketTheme, LLC, to Trilby Media LLC + + +# v1.4.0-beta.1 +## 12/11/2017 + 1. [](#new) * Added `Grav\Framework\Cache` classes providing PSR-16 `Simple Cache` implementation * Added `Grav\Framework\ContentBlock` classes for nested HTML blocks with CSS/JS assets diff --git a/backup/.gitkeep b/backup/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/index.php b/index.php index 68c904982..473d4a306 100644 --- a/index.php +++ b/index.php @@ -2,7 +2,7 @@ /** * @package Grav.Core * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/defines.php b/system/defines.php index 6c2d0d4a4..b28f4df0b 100644 --- a/system/defines.php +++ b/system/defines.php @@ -2,7 +2,7 @@ /** * @package Grav.Core * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/router.php b/system/router.php index 850ac1771..2e5af825e 100644 --- a/system/router.php +++ b/system/router.php @@ -2,7 +2,7 @@ /** * @package Grav.Core * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Assets.php b/system/src/Grav/Common/Assets.php index 0399895f0..b46a0bb62 100644 --- a/system/src/Grav/Common/Assets.php +++ b/system/src/Grav/Common/Assets.php @@ -2,7 +2,7 @@ /** * @package Grav.Common * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Backup/ZipBackup.php b/system/src/Grav/Common/Backup/ZipBackup.php index 0292b0635..517d7da4d 100644 --- a/system/src/Grav/Common/Backup/ZipBackup.php +++ b/system/src/Grav/Common/Backup/ZipBackup.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Backup * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Browser.php b/system/src/Grav/Common/Browser.php index 3a8417c4d..bb0a3fb4f 100644 --- a/system/src/Grav/Common/Browser.php +++ b/system/src/Grav/Common/Browser.php @@ -2,7 +2,7 @@ /** * @package Grav.Common * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Cache.php b/system/src/Grav/Common/Cache.php index 8e9ed3977..a44c407ca 100644 --- a/system/src/Grav/Common/Cache.php +++ b/system/src/Grav/Common/Cache.php @@ -2,7 +2,7 @@ /** * @package Grav.Common * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Composer.php b/system/src/Grav/Common/Composer.php index 9c65fd69b..26719252c 100644 --- a/system/src/Grav/Common/Composer.php +++ b/system/src/Grav/Common/Composer.php @@ -2,7 +2,7 @@ /** * @package Grav.Common * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Config/CompiledBase.php b/system/src/Grav/Common/Config/CompiledBase.php index b4e2abb29..1e6379599 100644 --- a/system/src/Grav/Common/Config/CompiledBase.php +++ b/system/src/Grav/Common/Config/CompiledBase.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Config * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Config/CompiledBlueprints.php b/system/src/Grav/Common/Config/CompiledBlueprints.php index 83b1253b0..a29ecded9 100644 --- a/system/src/Grav/Common/Config/CompiledBlueprints.php +++ b/system/src/Grav/Common/Config/CompiledBlueprints.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Config * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ namespace Grav\Common\Config; diff --git a/system/src/Grav/Common/Config/CompiledConfig.php b/system/src/Grav/Common/Config/CompiledConfig.php index 05d3ed9b1..6f21123aa 100644 --- a/system/src/Grav/Common/Config/CompiledConfig.php +++ b/system/src/Grav/Common/Config/CompiledConfig.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Config * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Config/CompiledLanguages.php b/system/src/Grav/Common/Config/CompiledLanguages.php index 4d6f0541d..610e347df 100644 --- a/system/src/Grav/Common/Config/CompiledLanguages.php +++ b/system/src/Grav/Common/Config/CompiledLanguages.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Config * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Config/Config.php b/system/src/Grav/Common/Config/Config.php index 45cc845b6..55282cda4 100644 --- a/system/src/Grav/Common/Config/Config.php +++ b/system/src/Grav/Common/Config/Config.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Config * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Config/ConfigFileFinder.php b/system/src/Grav/Common/Config/ConfigFileFinder.php index 8ff34274a..798067175 100644 --- a/system/src/Grav/Common/Config/ConfigFileFinder.php +++ b/system/src/Grav/Common/Config/ConfigFileFinder.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Config * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Config/Languages.php b/system/src/Grav/Common/Config/Languages.php index badf07089..aa97cdbf7 100644 --- a/system/src/Grav/Common/Config/Languages.php +++ b/system/src/Grav/Common/Config/Languages.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Config * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Config/Setup.php b/system/src/Grav/Common/Config/Setup.php index eecebd31d..316b090d5 100644 --- a/system/src/Grav/Common/Config/Setup.php +++ b/system/src/Grav/Common/Config/Setup.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Config * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Data/Blueprint.php b/system/src/Grav/Common/Data/Blueprint.php index dc31f29ae..bf33d415f 100644 --- a/system/src/Grav/Common/Data/Blueprint.php +++ b/system/src/Grav/Common/Data/Blueprint.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Data * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Data/BlueprintSchema.php b/system/src/Grav/Common/Data/BlueprintSchema.php index 9e3eebca2..3205c3843 100644 --- a/system/src/Grav/Common/Data/BlueprintSchema.php +++ b/system/src/Grav/Common/Data/BlueprintSchema.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Data * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Data/Blueprints.php b/system/src/Grav/Common/Data/Blueprints.php index cd2cb9f21..c7090c5ec 100644 --- a/system/src/Grav/Common/Data/Blueprints.php +++ b/system/src/Grav/Common/Data/Blueprints.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Data * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Data/Data.php b/system/src/Grav/Common/Data/Data.php index c3d25c0a3..a9ceca332 100644 --- a/system/src/Grav/Common/Data/Data.php +++ b/system/src/Grav/Common/Data/Data.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Data * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Data/DataInterface.php b/system/src/Grav/Common/Data/DataInterface.php index bc98982ad..aa61d2604 100644 --- a/system/src/Grav/Common/Data/DataInterface.php +++ b/system/src/Grav/Common/Data/DataInterface.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Data * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Data/Validation.php b/system/src/Grav/Common/Data/Validation.php index c6be512b9..623406d27 100644 --- a/system/src/Grav/Common/Data/Validation.php +++ b/system/src/Grav/Common/Data/Validation.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Data * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Data/ValidationException.php b/system/src/Grav/Common/Data/ValidationException.php index 18dd6af68..9272894b0 100644 --- a/system/src/Grav/Common/Data/ValidationException.php +++ b/system/src/Grav/Common/Data/ValidationException.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Data * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Debugger.php b/system/src/Grav/Common/Debugger.php index 40a485402..4687325e1 100644 --- a/system/src/Grav/Common/Debugger.php +++ b/system/src/Grav/Common/Debugger.php @@ -2,7 +2,7 @@ /** * @package Grav.Common * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Errors/BareHandler.php b/system/src/Grav/Common/Errors/BareHandler.php index eb6ac5171..5d8ef9a34 100644 --- a/system/src/Grav/Common/Errors/BareHandler.php +++ b/system/src/Grav/Common/Errors/BareHandler.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Errors * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Errors/Errors.php b/system/src/Grav/Common/Errors/Errors.php index 9b7e47c78..c342837d4 100644 --- a/system/src/Grav/Common/Errors/Errors.php +++ b/system/src/Grav/Common/Errors/Errors.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Errors * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Errors/SimplePageHandler.php b/system/src/Grav/Common/Errors/SimplePageHandler.php index 094c65ee9..fb2e73f58 100644 --- a/system/src/Grav/Common/Errors/SimplePageHandler.php +++ b/system/src/Grav/Common/Errors/SimplePageHandler.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Errors * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Errors/SystemFacade.php b/system/src/Grav/Common/Errors/SystemFacade.php index 75aa0e710..5b73a2b77 100644 --- a/system/src/Grav/Common/Errors/SystemFacade.php +++ b/system/src/Grav/Common/Errors/SystemFacade.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Errors * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/File/CompiledFile.php b/system/src/Grav/Common/File/CompiledFile.php index 2864f0b44..a0e230f14 100644 --- a/system/src/Grav/Common/File/CompiledFile.php +++ b/system/src/Grav/Common/File/CompiledFile.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.File * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/File/CompiledJsonFile.php b/system/src/Grav/Common/File/CompiledJsonFile.php index 87b71676e..c2a9a3209 100644 --- a/system/src/Grav/Common/File/CompiledJsonFile.php +++ b/system/src/Grav/Common/File/CompiledJsonFile.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.File * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/File/CompiledMarkdownFile.php b/system/src/Grav/Common/File/CompiledMarkdownFile.php index 0b038eb48..fa1798f03 100644 --- a/system/src/Grav/Common/File/CompiledMarkdownFile.php +++ b/system/src/Grav/Common/File/CompiledMarkdownFile.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.File * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/File/CompiledYamlFile.php b/system/src/Grav/Common/File/CompiledYamlFile.php index 2f8276fbc..5861744d0 100644 --- a/system/src/Grav/Common/File/CompiledYamlFile.php +++ b/system/src/Grav/Common/File/CompiledYamlFile.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.File * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Filesystem/Folder.php b/system/src/Grav/Common/Filesystem/Folder.php index eb2b0ff3b..0d691002b 100644 --- a/system/src/Grav/Common/Filesystem/Folder.php +++ b/system/src/Grav/Common/Filesystem/Folder.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.FileSystem * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Filesystem/RecursiveFolderFilterIterator.php b/system/src/Grav/Common/Filesystem/RecursiveFolderFilterIterator.php index 62aa1ebfb..397207422 100644 --- a/system/src/Grav/Common/Filesystem/RecursiveFolderFilterIterator.php +++ b/system/src/Grav/Common/Filesystem/RecursiveFolderFilterIterator.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.FileSystem * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/AbstractCollection.php b/system/src/Grav/Common/GPM/AbstractCollection.php index 2935920fc..3430a6a85 100644 --- a/system/src/Grav/Common/GPM/AbstractCollection.php +++ b/system/src/Grav/Common/GPM/AbstractCollection.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.GPM * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Common/AbstractPackageCollection.php b/system/src/Grav/Common/GPM/Common/AbstractPackageCollection.php index 6d777f33f..78d93bce7 100644 --- a/system/src/Grav/Common/GPM/Common/AbstractPackageCollection.php +++ b/system/src/Grav/Common/GPM/Common/AbstractPackageCollection.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.GPM * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Common/CachedCollection.php b/system/src/Grav/Common/GPM/Common/CachedCollection.php index 31d65219b..0244692e1 100644 --- a/system/src/Grav/Common/GPM/Common/CachedCollection.php +++ b/system/src/Grav/Common/GPM/Common/CachedCollection.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.GPM * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Common/Package.php b/system/src/Grav/Common/GPM/Common/Package.php index f2422c350..468ca9e9c 100644 --- a/system/src/Grav/Common/GPM/Common/Package.php +++ b/system/src/Grav/Common/GPM/Common/Package.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.GPM * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/GPM.php b/system/src/Grav/Common/GPM/GPM.php index fd5af4849..9c46fea3b 100644 --- a/system/src/Grav/Common/GPM/GPM.php +++ b/system/src/Grav/Common/GPM/GPM.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.GPM * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Installer.php b/system/src/Grav/Common/GPM/Installer.php index eadc6501a..275c2fc36 100644 --- a/system/src/Grav/Common/GPM/Installer.php +++ b/system/src/Grav/Common/GPM/Installer.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.GPM * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Licenses.php b/system/src/Grav/Common/GPM/Licenses.php index d5651dbbe..fed5b642e 100644 --- a/system/src/Grav/Common/GPM/Licenses.php +++ b/system/src/Grav/Common/GPM/Licenses.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.GPM * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Local/AbstractPackageCollection.php b/system/src/Grav/Common/GPM/Local/AbstractPackageCollection.php index 038b43bf8..b9762085c 100644 --- a/system/src/Grav/Common/GPM/Local/AbstractPackageCollection.php +++ b/system/src/Grav/Common/GPM/Local/AbstractPackageCollection.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.GPM * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Local/Package.php b/system/src/Grav/Common/GPM/Local/Package.php index 704a8f750..d0fae3a29 100644 --- a/system/src/Grav/Common/GPM/Local/Package.php +++ b/system/src/Grav/Common/GPM/Local/Package.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.GPM * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Local/Packages.php b/system/src/Grav/Common/GPM/Local/Packages.php index 391c68297..3120d21d3 100644 --- a/system/src/Grav/Common/GPM/Local/Packages.php +++ b/system/src/Grav/Common/GPM/Local/Packages.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.GPM * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Local/Plugins.php b/system/src/Grav/Common/GPM/Local/Plugins.php index 34ca76b9e..e97aa5922 100644 --- a/system/src/Grav/Common/GPM/Local/Plugins.php +++ b/system/src/Grav/Common/GPM/Local/Plugins.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.GPM * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Local/Themes.php b/system/src/Grav/Common/GPM/Local/Themes.php index e7f691a88..9b557af9e 100644 --- a/system/src/Grav/Common/GPM/Local/Themes.php +++ b/system/src/Grav/Common/GPM/Local/Themes.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.GPM * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Remote/AbstractPackageCollection.php b/system/src/Grav/Common/GPM/Remote/AbstractPackageCollection.php index 70539cfcd..ffdd90c64 100644 --- a/system/src/Grav/Common/GPM/Remote/AbstractPackageCollection.php +++ b/system/src/Grav/Common/GPM/Remote/AbstractPackageCollection.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.GPM * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Remote/GravCore.php b/system/src/Grav/Common/GPM/Remote/GravCore.php index 5e53476dd..6d02d4c95 100644 --- a/system/src/Grav/Common/GPM/Remote/GravCore.php +++ b/system/src/Grav/Common/GPM/Remote/GravCore.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.GPM * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Remote/Package.php b/system/src/Grav/Common/GPM/Remote/Package.php index ebe51af23..830f63dd5 100644 --- a/system/src/Grav/Common/GPM/Remote/Package.php +++ b/system/src/Grav/Common/GPM/Remote/Package.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.GPM * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Remote/Packages.php b/system/src/Grav/Common/GPM/Remote/Packages.php index ddad08442..d8afd9094 100644 --- a/system/src/Grav/Common/GPM/Remote/Packages.php +++ b/system/src/Grav/Common/GPM/Remote/Packages.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.GPM * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Remote/Plugins.php b/system/src/Grav/Common/GPM/Remote/Plugins.php index 10e273278..74e5ffb09 100644 --- a/system/src/Grav/Common/GPM/Remote/Plugins.php +++ b/system/src/Grav/Common/GPM/Remote/Plugins.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.GPM * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Remote/Themes.php b/system/src/Grav/Common/GPM/Remote/Themes.php index 07ffbdcf5..3f3f96cb0 100644 --- a/system/src/Grav/Common/GPM/Remote/Themes.php +++ b/system/src/Grav/Common/GPM/Remote/Themes.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.GPM * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Response.php b/system/src/Grav/Common/GPM/Response.php index ffb8caf05..d62acd23b 100644 --- a/system/src/Grav/Common/GPM/Response.php +++ b/system/src/Grav/Common/GPM/Response.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.GPM * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GPM/Upgrader.php b/system/src/Grav/Common/GPM/Upgrader.php index fba405ad1..02d465c09 100644 --- a/system/src/Grav/Common/GPM/Upgrader.php +++ b/system/src/Grav/Common/GPM/Upgrader.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.GPM * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Getters.php b/system/src/Grav/Common/Getters.php index 659ba15a7..6f58fba20 100644 --- a/system/src/Grav/Common/Getters.php +++ b/system/src/Grav/Common/Getters.php @@ -2,7 +2,7 @@ /** * @package Grav.Common * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Grav.php b/system/src/Grav/Common/Grav.php index 7b0607c13..7b0276a59 100644 --- a/system/src/Grav/Common/Grav.php +++ b/system/src/Grav/Common/Grav.php @@ -2,7 +2,7 @@ /** * @package Grav.Common * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/GravTrait.php b/system/src/Grav/Common/GravTrait.php index ea2f7e052..7ff04e65e 100644 --- a/system/src/Grav/Common/GravTrait.php +++ b/system/src/Grav/Common/GravTrait.php @@ -2,7 +2,7 @@ /** * @package Grav.Common * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Helpers/Base32.php b/system/src/Grav/Common/Helpers/Base32.php index 9c1918f97..f212e5856 100644 --- a/system/src/Grav/Common/Helpers/Base32.php +++ b/system/src/Grav/Common/Helpers/Base32.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Helpers * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Helpers/Excerpts.php b/system/src/Grav/Common/Helpers/Excerpts.php index 0a0a4a28e..b294bd955 100644 --- a/system/src/Grav/Common/Helpers/Excerpts.php +++ b/system/src/Grav/Common/Helpers/Excerpts.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Helpers * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Helpers/Exif.php b/system/src/Grav/Common/Helpers/Exif.php index 94a5e72ac..ee0c4cae7 100644 --- a/system/src/Grav/Common/Helpers/Exif.php +++ b/system/src/Grav/Common/Helpers/Exif.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Helpers * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Helpers/Truncator.php b/system/src/Grav/Common/Helpers/Truncator.php index e5c0b348f..c2e734989 100644 --- a/system/src/Grav/Common/Helpers/Truncator.php +++ b/system/src/Grav/Common/Helpers/Truncator.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Helpers * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Inflector.php b/system/src/Grav/Common/Inflector.php index d3138ccb6..f4a17ba7c 100644 --- a/system/src/Grav/Common/Inflector.php +++ b/system/src/Grav/Common/Inflector.php @@ -2,7 +2,7 @@ /** * @package Grav.Common * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Iterator.php b/system/src/Grav/Common/Iterator.php index 0924e6449..99fc0c48e 100644 --- a/system/src/Grav/Common/Iterator.php +++ b/system/src/Grav/Common/Iterator.php @@ -2,7 +2,7 @@ /** * @package Grav.Common * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Language/Language.php b/system/src/Grav/Common/Language/Language.php index ae9546a22..74a13656e 100644 --- a/system/src/Grav/Common/Language/Language.php +++ b/system/src/Grav/Common/Language/Language.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Language * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Language/LanguageCodes.php b/system/src/Grav/Common/Language/LanguageCodes.php index 7097dcba4..8be5b5b04 100644 --- a/system/src/Grav/Common/Language/LanguageCodes.php +++ b/system/src/Grav/Common/Language/LanguageCodes.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Language * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Markdown/Parsedown.php b/system/src/Grav/Common/Markdown/Parsedown.php index c9ec34d8a..b066ad3bc 100644 --- a/system/src/Grav/Common/Markdown/Parsedown.php +++ b/system/src/Grav/Common/Markdown/Parsedown.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Markdown * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Markdown/ParsedownExtra.php b/system/src/Grav/Common/Markdown/ParsedownExtra.php index a96dfca59..5d0799e02 100644 --- a/system/src/Grav/Common/Markdown/ParsedownExtra.php +++ b/system/src/Grav/Common/Markdown/ParsedownExtra.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Markdown * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php index c8266eb7b..e5c230ce9 100644 --- a/system/src/Grav/Common/Markdown/ParsedownGravTrait.php +++ b/system/src/Grav/Common/Markdown/ParsedownGravTrait.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Markdown * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Collection.php b/system/src/Grav/Common/Page/Collection.php index 386b93134..6f476ffce 100644 --- a/system/src/Grav/Common/Page/Collection.php +++ b/system/src/Grav/Common/Page/Collection.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Page * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Header.php b/system/src/Grav/Common/Page/Header.php index 9003cec62..7df862bb1 100644 --- a/system/src/Grav/Common/Page/Header.php +++ b/system/src/Grav/Common/Page/Header.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Page * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Media.php b/system/src/Grav/Common/Page/Media.php index df6290e4b..bd97cb2e2 100644 --- a/system/src/Grav/Common/Page/Media.php +++ b/system/src/Grav/Common/Page/Media.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Page * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/AbstractMedia.php b/system/src/Grav/Common/Page/Medium/AbstractMedia.php index cc428b992..fe0ac62ed 100644 --- a/system/src/Grav/Common/Page/Medium/AbstractMedia.php +++ b/system/src/Grav/Common/Page/Medium/AbstractMedia.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Page * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/AudioMedium.php b/system/src/Grav/Common/Page/Medium/AudioMedium.php index 1a2821d8e..aae359776 100644 --- a/system/src/Grav/Common/Page/Medium/AudioMedium.php +++ b/system/src/Grav/Common/Page/Medium/AudioMedium.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Page * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/GlobalMedia.php b/system/src/Grav/Common/Page/Medium/GlobalMedia.php index 47360d32e..74adc088d 100644 --- a/system/src/Grav/Common/Page/Medium/GlobalMedia.php +++ b/system/src/Grav/Common/Page/Medium/GlobalMedia.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Page * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/ImageFile.php b/system/src/Grav/Common/Page/Medium/ImageFile.php index 57e6b847e..683448872 100644 --- a/system/src/Grav/Common/Page/Medium/ImageFile.php +++ b/system/src/Grav/Common/Page/Medium/ImageFile.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Page * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/ImageMedium.php b/system/src/Grav/Common/Page/Medium/ImageMedium.php index 23b5b3ce7..05bc4c486 100644 --- a/system/src/Grav/Common/Page/Medium/ImageMedium.php +++ b/system/src/Grav/Common/Page/Medium/ImageMedium.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Page * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/Link.php b/system/src/Grav/Common/Page/Medium/Link.php index acea8fefc..15aac7b3b 100644 --- a/system/src/Grav/Common/Page/Medium/Link.php +++ b/system/src/Grav/Common/Page/Medium/Link.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Page * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/Medium.php b/system/src/Grav/Common/Page/Medium/Medium.php index 0d571c10d..55281bed5 100644 --- a/system/src/Grav/Common/Page/Medium/Medium.php +++ b/system/src/Grav/Common/Page/Medium/Medium.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Page * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/MediumFactory.php b/system/src/Grav/Common/Page/Medium/MediumFactory.php index ea2b3a32f..b5b197e5b 100644 --- a/system/src/Grav/Common/Page/Medium/MediumFactory.php +++ b/system/src/Grav/Common/Page/Medium/MediumFactory.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Page * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/ParsedownHtmlTrait.php b/system/src/Grav/Common/Page/Medium/ParsedownHtmlTrait.php index 48619d186..aaf6fdeef 100644 --- a/system/src/Grav/Common/Page/Medium/ParsedownHtmlTrait.php +++ b/system/src/Grav/Common/Page/Medium/ParsedownHtmlTrait.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Page * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/RenderableInterface.php b/system/src/Grav/Common/Page/Medium/RenderableInterface.php index 61650deb2..35b03782c 100644 --- a/system/src/Grav/Common/Page/Medium/RenderableInterface.php +++ b/system/src/Grav/Common/Page/Medium/RenderableInterface.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Page * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/StaticImageMedium.php b/system/src/Grav/Common/Page/Medium/StaticImageMedium.php index 0dc8337ce..047e7ed22 100644 --- a/system/src/Grav/Common/Page/Medium/StaticImageMedium.php +++ b/system/src/Grav/Common/Page/Medium/StaticImageMedium.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Page * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/StaticResizeTrait.php b/system/src/Grav/Common/Page/Medium/StaticResizeTrait.php index 42d87879f..4e7d61901 100644 --- a/system/src/Grav/Common/Page/Medium/StaticResizeTrait.php +++ b/system/src/Grav/Common/Page/Medium/StaticResizeTrait.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Page * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/ThumbnailImageMedium.php b/system/src/Grav/Common/Page/Medium/ThumbnailImageMedium.php index 7cbd74dfd..6f88a2cce 100644 --- a/system/src/Grav/Common/Page/Medium/ThumbnailImageMedium.php +++ b/system/src/Grav/Common/Page/Medium/ThumbnailImageMedium.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Page * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Medium/VideoMedium.php b/system/src/Grav/Common/Page/Medium/VideoMedium.php index 144d9d43c..b3c8eed85 100644 --- a/system/src/Grav/Common/Page/Medium/VideoMedium.php +++ b/system/src/Grav/Common/Page/Medium/VideoMedium.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Page * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index fd9b04d89..04286dc47 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Page * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Pages.php b/system/src/Grav/Common/Page/Pages.php index 10911efff..d3c6079ac 100644 --- a/system/src/Grav/Common/Page/Pages.php +++ b/system/src/Grav/Common/Page/Pages.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Page * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Page/Types.php b/system/src/Grav/Common/Page/Types.php index c027142b6..436d4f835 100644 --- a/system/src/Grav/Common/Page/Types.php +++ b/system/src/Grav/Common/Page/Types.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Page * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Plugin.php b/system/src/Grav/Common/Plugin.php index fa9d1c3cf..ec5b34616 100644 --- a/system/src/Grav/Common/Plugin.php +++ b/system/src/Grav/Common/Plugin.php @@ -2,7 +2,7 @@ /** * @package Grav.Common * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Plugins.php b/system/src/Grav/Common/Plugins.php index 25fb356ad..5e407a905 100644 --- a/system/src/Grav/Common/Plugins.php +++ b/system/src/Grav/Common/Plugins.php @@ -2,7 +2,7 @@ /** * @package Grav.Common * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/AssetsProcessor.php b/system/src/Grav/Common/Processors/AssetsProcessor.php index 32a288934..6ca952d70 100644 --- a/system/src/Grav/Common/Processors/AssetsProcessor.php +++ b/system/src/Grav/Common/Processors/AssetsProcessor.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Processors * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/ConfigurationProcessor.php b/system/src/Grav/Common/Processors/ConfigurationProcessor.php index ed3adcd05..03478532c 100644 --- a/system/src/Grav/Common/Processors/ConfigurationProcessor.php +++ b/system/src/Grav/Common/Processors/ConfigurationProcessor.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Processors * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/DebuggerAssetsProcessor.php b/system/src/Grav/Common/Processors/DebuggerAssetsProcessor.php index 1c048cbcb..643e8d13f 100644 --- a/system/src/Grav/Common/Processors/DebuggerAssetsProcessor.php +++ b/system/src/Grav/Common/Processors/DebuggerAssetsProcessor.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Processors * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/DebuggerInitProcessor.php b/system/src/Grav/Common/Processors/DebuggerInitProcessor.php index 95695fe02..e3b4e1d6f 100644 --- a/system/src/Grav/Common/Processors/DebuggerInitProcessor.php +++ b/system/src/Grav/Common/Processors/DebuggerInitProcessor.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Processors * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/ErrorsProcessor.php b/system/src/Grav/Common/Processors/ErrorsProcessor.php index 16afffe44..7c7685da2 100644 --- a/system/src/Grav/Common/Processors/ErrorsProcessor.php +++ b/system/src/Grav/Common/Processors/ErrorsProcessor.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Processors * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/InitializeProcessor.php b/system/src/Grav/Common/Processors/InitializeProcessor.php index 734eb8211..1b4022735 100644 --- a/system/src/Grav/Common/Processors/InitializeProcessor.php +++ b/system/src/Grav/Common/Processors/InitializeProcessor.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Processors * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/PagesProcessor.php b/system/src/Grav/Common/Processors/PagesProcessor.php index 5bb003954..b2828f796 100644 --- a/system/src/Grav/Common/Processors/PagesProcessor.php +++ b/system/src/Grav/Common/Processors/PagesProcessor.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Processors * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/PluginsProcessor.php b/system/src/Grav/Common/Processors/PluginsProcessor.php index 02a28d5f7..ee563930e 100644 --- a/system/src/Grav/Common/Processors/PluginsProcessor.php +++ b/system/src/Grav/Common/Processors/PluginsProcessor.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Processors * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/ProcessorBase.php b/system/src/Grav/Common/Processors/ProcessorBase.php index c53a989c7..056c86d6a 100644 --- a/system/src/Grav/Common/Processors/ProcessorBase.php +++ b/system/src/Grav/Common/Processors/ProcessorBase.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Processors * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/ProcessorInterface.php b/system/src/Grav/Common/Processors/ProcessorInterface.php index e534dc8b7..0e4b1694b 100644 --- a/system/src/Grav/Common/Processors/ProcessorInterface.php +++ b/system/src/Grav/Common/Processors/ProcessorInterface.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Processors * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/RenderProcessor.php b/system/src/Grav/Common/Processors/RenderProcessor.php index 5171c507d..b5f281918 100644 --- a/system/src/Grav/Common/Processors/RenderProcessor.php +++ b/system/src/Grav/Common/Processors/RenderProcessor.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Processors * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/SiteSetupProcessor.php b/system/src/Grav/Common/Processors/SiteSetupProcessor.php index b2a5e9df8..1f3f8afec 100644 --- a/system/src/Grav/Common/Processors/SiteSetupProcessor.php +++ b/system/src/Grav/Common/Processors/SiteSetupProcessor.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Processors * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/TasksProcessor.php b/system/src/Grav/Common/Processors/TasksProcessor.php index 8c41de783..d1e7a2f92 100644 --- a/system/src/Grav/Common/Processors/TasksProcessor.php +++ b/system/src/Grav/Common/Processors/TasksProcessor.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Processors * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/ThemesProcessor.php b/system/src/Grav/Common/Processors/ThemesProcessor.php index b0b79d995..c9ea013e7 100644 --- a/system/src/Grav/Common/Processors/ThemesProcessor.php +++ b/system/src/Grav/Common/Processors/ThemesProcessor.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Processors * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Processors/TwigProcessor.php b/system/src/Grav/Common/Processors/TwigProcessor.php index 9867efc1d..392824f90 100644 --- a/system/src/Grav/Common/Processors/TwigProcessor.php +++ b/system/src/Grav/Common/Processors/TwigProcessor.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Processors * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/AssetsServiceProvider.php b/system/src/Grav/Common/Service/AssetsServiceProvider.php index 91a7a86c3..961801397 100644 --- a/system/src/Grav/Common/Service/AssetsServiceProvider.php +++ b/system/src/Grav/Common/Service/AssetsServiceProvider.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Service * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/ConfigServiceProvider.php b/system/src/Grav/Common/Service/ConfigServiceProvider.php index ad3bf07f9..25c1a126e 100644 --- a/system/src/Grav/Common/Service/ConfigServiceProvider.php +++ b/system/src/Grav/Common/Service/ConfigServiceProvider.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Service * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/ErrorServiceProvider.php b/system/src/Grav/Common/Service/ErrorServiceProvider.php index ec87562d5..139de54d5 100644 --- a/system/src/Grav/Common/Service/ErrorServiceProvider.php +++ b/system/src/Grav/Common/Service/ErrorServiceProvider.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Service * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/LoggerServiceProvider.php b/system/src/Grav/Common/Service/LoggerServiceProvider.php index 6c61685c9..628d15897 100644 --- a/system/src/Grav/Common/Service/LoggerServiceProvider.php +++ b/system/src/Grav/Common/Service/LoggerServiceProvider.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Service * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/MessagesServiceProvider.php b/system/src/Grav/Common/Service/MessagesServiceProvider.php index 60b3815fe..f51e89a8d 100644 --- a/system/src/Grav/Common/Service/MessagesServiceProvider.php +++ b/system/src/Grav/Common/Service/MessagesServiceProvider.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Service * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/OutputServiceProvider.php b/system/src/Grav/Common/Service/OutputServiceProvider.php index 92871fd2a..89322ee49 100644 --- a/system/src/Grav/Common/Service/OutputServiceProvider.php +++ b/system/src/Grav/Common/Service/OutputServiceProvider.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Service * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/PageServiceProvider.php b/system/src/Grav/Common/Service/PageServiceProvider.php index b880a8467..bf55f791b 100644 --- a/system/src/Grav/Common/Service/PageServiceProvider.php +++ b/system/src/Grav/Common/Service/PageServiceProvider.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Service * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/StreamsServiceProvider.php b/system/src/Grav/Common/Service/StreamsServiceProvider.php index cb0638839..a2ebcc671 100644 --- a/system/src/Grav/Common/Service/StreamsServiceProvider.php +++ b/system/src/Grav/Common/Service/StreamsServiceProvider.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Service * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Service/TaskServiceProvider.php b/system/src/Grav/Common/Service/TaskServiceProvider.php index b0f90d334..40b9696b4 100644 --- a/system/src/Grav/Common/Service/TaskServiceProvider.php +++ b/system/src/Grav/Common/Service/TaskServiceProvider.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Service * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Session.php b/system/src/Grav/Common/Session.php index cbf2477b7..d78b633c6 100644 --- a/system/src/Grav/Common/Session.php +++ b/system/src/Grav/Common/Session.php @@ -2,7 +2,7 @@ /** * @package Grav.Common * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Taxonomy.php b/system/src/Grav/Common/Taxonomy.php index ec9f4f779..dda284412 100644 --- a/system/src/Grav/Common/Taxonomy.php +++ b/system/src/Grav/Common/Taxonomy.php @@ -2,7 +2,7 @@ /** * @package Grav.Common * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Theme.php b/system/src/Grav/Common/Theme.php index 1cff2c1b4..537df11d6 100644 --- a/system/src/Grav/Common/Theme.php +++ b/system/src/Grav/Common/Theme.php @@ -2,7 +2,7 @@ /** * @package Grav.Common * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Themes.php b/system/src/Grav/Common/Themes.php index 29324be9a..8f29037dd 100644 --- a/system/src/Grav/Common/Themes.php +++ b/system/src/Grav/Common/Themes.php @@ -2,7 +2,7 @@ /** * @package Grav.Common * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/Node/TwigNodeScript.php b/system/src/Grav/Common/Twig/Node/TwigNodeScript.php index 83ba5ced9..35ca20f7a 100644 --- a/system/src/Grav/Common/Twig/Node/TwigNodeScript.php +++ b/system/src/Grav/Common/Twig/Node/TwigNodeScript.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Twig * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/Node/TwigNodeStyle.php b/system/src/Grav/Common/Twig/Node/TwigNodeStyle.php index affb9600a..8c0b3b87c 100644 --- a/system/src/Grav/Common/Twig/Node/TwigNodeStyle.php +++ b/system/src/Grav/Common/Twig/Node/TwigNodeStyle.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Twig * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/Node/TwigNodeTryCatch.php b/system/src/Grav/Common/Twig/Node/TwigNodeTryCatch.php index ee7e36e2f..e37c31992 100644 --- a/system/src/Grav/Common/Twig/Node/TwigNodeTryCatch.php +++ b/system/src/Grav/Common/Twig/Node/TwigNodeTryCatch.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Twig * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserScript.php b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserScript.php index 3bee11b53..98c72e21b 100644 --- a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserScript.php +++ b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserScript.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Twig * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php index db6971c41..f207686bd 100644 --- a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php +++ b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserStyle.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Twig * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserTryCatch.php b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserTryCatch.php index b225da345..d639c57a0 100644 --- a/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserTryCatch.php +++ b/system/src/Grav/Common/Twig/TokenParser/TwigTokenParserTryCatch.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Twig * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/Twig.php b/system/src/Grav/Common/Twig/Twig.php index dd7241147..e1ba281f4 100644 --- a/system/src/Grav/Common/Twig/Twig.php +++ b/system/src/Grav/Common/Twig/Twig.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Twig * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/TwigEnvironment.php b/system/src/Grav/Common/Twig/TwigEnvironment.php index ecea507e1..66ca8bf71 100644 --- a/system/src/Grav/Common/Twig/TwigEnvironment.php +++ b/system/src/Grav/Common/Twig/TwigEnvironment.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Twig * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/TwigExtension.php b/system/src/Grav/Common/Twig/TwigExtension.php index fcd9abdfb..56e659fde 100644 --- a/system/src/Grav/Common/Twig/TwigExtension.php +++ b/system/src/Grav/Common/Twig/TwigExtension.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Twig * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Twig/WriteCacheFileTrait.php b/system/src/Grav/Common/Twig/WriteCacheFileTrait.php index 59275456a..c413ca6fb 100644 --- a/system/src/Grav/Common/Twig/WriteCacheFileTrait.php +++ b/system/src/Grav/Common/Twig/WriteCacheFileTrait.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.Twig * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Uri.php b/system/src/Grav/Common/Uri.php index 555f4e65b..fb8ccd6ff 100644 --- a/system/src/Grav/Common/Uri.php +++ b/system/src/Grav/Common/Uri.php @@ -2,7 +2,7 @@ /** * @package Grav.Common * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/User/Authentication.php b/system/src/Grav/Common/User/Authentication.php index a3e12ff7e..b46750c29 100644 --- a/system/src/Grav/Common/User/Authentication.php +++ b/system/src/Grav/Common/User/Authentication.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.User * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/User/Group.php b/system/src/Grav/Common/User/Group.php index 597cb9a6a..a251326a4 100644 --- a/system/src/Grav/Common/User/Group.php +++ b/system/src/Grav/Common/User/Group.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.User * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/User/User.php b/system/src/Grav/Common/User/User.php index cd8fa8925..c1c23464d 100644 --- a/system/src/Grav/Common/User/User.php +++ b/system/src/Grav/Common/User/User.php @@ -2,7 +2,7 @@ /** * @package Grav.Common.User * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Common/Utils.php b/system/src/Grav/Common/Utils.php index b4743774e..16d0ed4d8 100644 --- a/system/src/Grav/Common/Utils.php +++ b/system/src/Grav/Common/Utils.php @@ -2,7 +2,7 @@ /** * @package Grav.Common * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Cli/BackupCommand.php b/system/src/Grav/Console/Cli/BackupCommand.php index 4a0b754f3..4a538697b 100644 --- a/system/src/Grav/Console/Cli/BackupCommand.php +++ b/system/src/Grav/Console/Cli/BackupCommand.php @@ -2,7 +2,7 @@ /** * @package Grav.Console * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Cli/CleanCommand.php b/system/src/Grav/Console/Cli/CleanCommand.php index 6c1f11470..f6909fc85 100644 --- a/system/src/Grav/Console/Cli/CleanCommand.php +++ b/system/src/Grav/Console/Cli/CleanCommand.php @@ -2,7 +2,7 @@ /** * @package Grav.Console * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Cli/ClearCacheCommand.php b/system/src/Grav/Console/Cli/ClearCacheCommand.php index 18bff688e..cb5ffe84f 100644 --- a/system/src/Grav/Console/Cli/ClearCacheCommand.php +++ b/system/src/Grav/Console/Cli/ClearCacheCommand.php @@ -2,7 +2,7 @@ /** * @package Grav.Console * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Cli/ComposerCommand.php b/system/src/Grav/Console/Cli/ComposerCommand.php index b17b3f27e..4f9c18f63 100644 --- a/system/src/Grav/Console/Cli/ComposerCommand.php +++ b/system/src/Grav/Console/Cli/ComposerCommand.php @@ -2,7 +2,7 @@ /** * @package Grav.Console * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Cli/InstallCommand.php b/system/src/Grav/Console/Cli/InstallCommand.php index 53869fcc7..ac00256dd 100644 --- a/system/src/Grav/Console/Cli/InstallCommand.php +++ b/system/src/Grav/Console/Cli/InstallCommand.php @@ -2,7 +2,7 @@ /** * @package Grav.Console * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Cli/NewProjectCommand.php b/system/src/Grav/Console/Cli/NewProjectCommand.php index 61aa446a0..5a8f3d1e4 100644 --- a/system/src/Grav/Console/Cli/NewProjectCommand.php +++ b/system/src/Grav/Console/Cli/NewProjectCommand.php @@ -2,7 +2,7 @@ /** * @package Grav.Console * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Cli/SandboxCommand.php b/system/src/Grav/Console/Cli/SandboxCommand.php index 9fca627b1..284878e02 100644 --- a/system/src/Grav/Console/Cli/SandboxCommand.php +++ b/system/src/Grav/Console/Cli/SandboxCommand.php @@ -2,7 +2,7 @@ /** * @package Grav.Console * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/ConsoleCommand.php b/system/src/Grav/Console/ConsoleCommand.php index 40fee6176..a9c221738 100644 --- a/system/src/Grav/Console/ConsoleCommand.php +++ b/system/src/Grav/Console/ConsoleCommand.php @@ -2,7 +2,7 @@ /** * @package Grav.Console * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/ConsoleTrait.php b/system/src/Grav/Console/ConsoleTrait.php index 4ffdafb27..b6ab3bfe0 100644 --- a/system/src/Grav/Console/ConsoleTrait.php +++ b/system/src/Grav/Console/ConsoleTrait.php @@ -2,7 +2,7 @@ /** * @package Grav.Console * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Gpm/DirectInstallCommand.php b/system/src/Grav/Console/Gpm/DirectInstallCommand.php index 5444ba134..60c5fa893 100644 --- a/system/src/Grav/Console/Gpm/DirectInstallCommand.php +++ b/system/src/Grav/Console/Gpm/DirectInstallCommand.php @@ -2,7 +2,7 @@ /** * @package Grav.Console * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Gpm/IndexCommand.php b/system/src/Grav/Console/Gpm/IndexCommand.php index a1d15b621..8c457063f 100644 --- a/system/src/Grav/Console/Gpm/IndexCommand.php +++ b/system/src/Grav/Console/Gpm/IndexCommand.php @@ -2,7 +2,7 @@ /** * @package Grav.Console * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Gpm/InfoCommand.php b/system/src/Grav/Console/Gpm/InfoCommand.php index 1a9d4b669..8c1d50e83 100644 --- a/system/src/Grav/Console/Gpm/InfoCommand.php +++ b/system/src/Grav/Console/Gpm/InfoCommand.php @@ -2,7 +2,7 @@ /** * @package Grav.Console * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Gpm/InstallCommand.php b/system/src/Grav/Console/Gpm/InstallCommand.php index 5281b8b51..3281fd923 100644 --- a/system/src/Grav/Console/Gpm/InstallCommand.php +++ b/system/src/Grav/Console/Gpm/InstallCommand.php @@ -2,7 +2,7 @@ /** * @package Grav.Console * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Gpm/SelfupgradeCommand.php b/system/src/Grav/Console/Gpm/SelfupgradeCommand.php index e63ec56bc..bd7e62257 100644 --- a/system/src/Grav/Console/Gpm/SelfupgradeCommand.php +++ b/system/src/Grav/Console/Gpm/SelfupgradeCommand.php @@ -2,7 +2,7 @@ /** * @package Grav.Console * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Gpm/UninstallCommand.php b/system/src/Grav/Console/Gpm/UninstallCommand.php index e39d2e352..966f0c840 100644 --- a/system/src/Grav/Console/Gpm/UninstallCommand.php +++ b/system/src/Grav/Console/Gpm/UninstallCommand.php @@ -2,7 +2,7 @@ /** * @package Grav.Console * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Gpm/UpdateCommand.php b/system/src/Grav/Console/Gpm/UpdateCommand.php index 1fb07134b..06913b169 100644 --- a/system/src/Grav/Console/Gpm/UpdateCommand.php +++ b/system/src/Grav/Console/Gpm/UpdateCommand.php @@ -2,7 +2,7 @@ /** * @package Grav.Console * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/Gpm/VersionCommand.php b/system/src/Grav/Console/Gpm/VersionCommand.php index 14a1fb71e..c828106c4 100644 --- a/system/src/Grav/Console/Gpm/VersionCommand.php +++ b/system/src/Grav/Console/Gpm/VersionCommand.php @@ -2,7 +2,7 @@ /** * @package Grav.Console * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Console/TerminalObjects/Table.php b/system/src/Grav/Console/TerminalObjects/Table.php index 07aca144c..c3078a964 100644 --- a/system/src/Grav/Console/TerminalObjects/Table.php +++ b/system/src/Grav/Console/TerminalObjects/Table.php @@ -2,7 +2,7 @@ /** * @package Grav.Console * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Cache/AbstractCache.php b/system/src/Grav/Framework/Cache/AbstractCache.php index b9447f108..de749a1c6 100644 --- a/system/src/Grav/Framework/Cache/AbstractCache.php +++ b/system/src/Grav/Framework/Cache/AbstractCache.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Cache * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Cache/Adapter/ChainCache.php b/system/src/Grav/Framework/Cache/Adapter/ChainCache.php index af0784c95..7301f3c0d 100644 --- a/system/src/Grav/Framework/Cache/Adapter/ChainCache.php +++ b/system/src/Grav/Framework/Cache/Adapter/ChainCache.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Cache * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php b/system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php index 50ed80084..c78d5abd4 100644 --- a/system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php +++ b/system/src/Grav/Framework/Cache/Adapter/DoctrineCache.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Cache * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Cache/Adapter/FileCache.php b/system/src/Grav/Framework/Cache/Adapter/FileCache.php index 8050021a0..eb2e61ff9 100644 --- a/system/src/Grav/Framework/Cache/Adapter/FileCache.php +++ b/system/src/Grav/Framework/Cache/Adapter/FileCache.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Cache * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php b/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php index 334bbb3ed..43a32d273 100644 --- a/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php +++ b/system/src/Grav/Framework/Cache/Adapter/MemoryCache.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Cache * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Cache/Adapter/SessionCache.php b/system/src/Grav/Framework/Cache/Adapter/SessionCache.php index 6a2b8ae53..eeb5d3052 100644 --- a/system/src/Grav/Framework/Cache/Adapter/SessionCache.php +++ b/system/src/Grav/Framework/Cache/Adapter/SessionCache.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Cache * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Cache/CacheInterface.php b/system/src/Grav/Framework/Cache/CacheInterface.php index 587dbeeda..54af40c69 100644 --- a/system/src/Grav/Framework/Cache/CacheInterface.php +++ b/system/src/Grav/Framework/Cache/CacheInterface.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Cache * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Cache/CacheTrait.php b/system/src/Grav/Framework/Cache/CacheTrait.php index 2b1b937e7..326b8132c 100644 --- a/system/src/Grav/Framework/Cache/CacheTrait.php +++ b/system/src/Grav/Framework/Cache/CacheTrait.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Cache * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Cache/Exception/CacheException.php b/system/src/Grav/Framework/Cache/Exception/CacheException.php index d4bc175f5..71caff7f6 100644 --- a/system/src/Grav/Framework/Cache/Exception/CacheException.php +++ b/system/src/Grav/Framework/Cache/Exception/CacheException.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Cache * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Cache/Exception/InvalidArgumentException.php b/system/src/Grav/Framework/Cache/Exception/InvalidArgumentException.php index 3daa3ced0..a00199b79 100644 --- a/system/src/Grav/Framework/Cache/Exception/InvalidArgumentException.php +++ b/system/src/Grav/Framework/Cache/Exception/InvalidArgumentException.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Cache * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Collection/AbstractFileCollection.php b/system/src/Grav/Framework/Collection/AbstractFileCollection.php index d35cdfc18..765723d97 100644 --- a/system/src/Grav/Framework/Collection/AbstractFileCollection.php +++ b/system/src/Grav/Framework/Collection/AbstractFileCollection.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Collection * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Collection/AbstractLazyCollection.php b/system/src/Grav/Framework/Collection/AbstractLazyCollection.php index c28395c0a..af2f696f8 100644 --- a/system/src/Grav/Framework/Collection/AbstractLazyCollection.php +++ b/system/src/Grav/Framework/Collection/AbstractLazyCollection.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Collection * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Collection/ArrayCollection.php b/system/src/Grav/Framework/Collection/ArrayCollection.php index bef3834c2..bf6dda056 100644 --- a/system/src/Grav/Framework/Collection/ArrayCollection.php +++ b/system/src/Grav/Framework/Collection/ArrayCollection.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Collection * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Collection/CollectionInterface.php b/system/src/Grav/Framework/Collection/CollectionInterface.php index ea0ae96d3..5f5e1fc60 100644 --- a/system/src/Grav/Framework/Collection/CollectionInterface.php +++ b/system/src/Grav/Framework/Collection/CollectionInterface.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Collection * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Collection/FileCollection.php b/system/src/Grav/Framework/Collection/FileCollection.php index a86b09249..9c1d905fe 100644 --- a/system/src/Grav/Framework/Collection/FileCollection.php +++ b/system/src/Grav/Framework/Collection/FileCollection.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Collection * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Collection/FileCollectionInterface.php b/system/src/Grav/Framework/Collection/FileCollectionInterface.php index 845c9890f..37f63d2cc 100644 --- a/system/src/Grav/Framework/Collection/FileCollectionInterface.php +++ b/system/src/Grav/Framework/Collection/FileCollectionInterface.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Collection * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/ContentBlock/ContentBlock.php b/system/src/Grav/Framework/ContentBlock/ContentBlock.php index 5c50937b5..6229b8151 100644 --- a/system/src/Grav/Framework/ContentBlock/ContentBlock.php +++ b/system/src/Grav/Framework/ContentBlock/ContentBlock.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\ContentBlock * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/ContentBlock/ContentBlockInterface.php b/system/src/Grav/Framework/ContentBlock/ContentBlockInterface.php index 914f4eae6..4f2434c9d 100644 --- a/system/src/Grav/Framework/ContentBlock/ContentBlockInterface.php +++ b/system/src/Grav/Framework/ContentBlock/ContentBlockInterface.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\ContentBlock * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/ContentBlock/HtmlBlock.php b/system/src/Grav/Framework/ContentBlock/HtmlBlock.php index 477c5e0ae..976018a0e 100644 --- a/system/src/Grav/Framework/ContentBlock/HtmlBlock.php +++ b/system/src/Grav/Framework/ContentBlock/HtmlBlock.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\ContentBlock * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/ContentBlock/HtmlBlockInterface.php b/system/src/Grav/Framework/ContentBlock/HtmlBlockInterface.php index 08e4caad3..204e199e5 100644 --- a/system/src/Grav/Framework/ContentBlock/HtmlBlockInterface.php +++ b/system/src/Grav/Framework/ContentBlock/HtmlBlockInterface.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\ContentBlock * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Access/ArrayAccessTrait.php b/system/src/Grav/Framework/Object/Access/ArrayAccessTrait.php index e22251d88..37e7328e3 100644 --- a/system/src/Grav/Framework/Object/Access/ArrayAccessTrait.php +++ b/system/src/Grav/Framework/Object/Access/ArrayAccessTrait.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Access/NestedArrayAccessTrait.php b/system/src/Grav/Framework/Object/Access/NestedArrayAccessTrait.php index c5e8b1bdd..256a1cef7 100644 --- a/system/src/Grav/Framework/Object/Access/NestedArrayAccessTrait.php +++ b/system/src/Grav/Framework/Object/Access/NestedArrayAccessTrait.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Access/NestedPropertyCollectionTrait.php b/system/src/Grav/Framework/Object/Access/NestedPropertyCollectionTrait.php index 6e1d34ca1..65b155da7 100644 --- a/system/src/Grav/Framework/Object/Access/NestedPropertyCollectionTrait.php +++ b/system/src/Grav/Framework/Object/Access/NestedPropertyCollectionTrait.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php b/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php index 9216bb025..e01f42590 100644 --- a/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php +++ b/system/src/Grav/Framework/Object/Access/NestedPropertyTrait.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Access/OverloadedPropertyTrait.php b/system/src/Grav/Framework/Object/Access/OverloadedPropertyTrait.php index 596c799f8..1524bd6ab 100644 --- a/system/src/Grav/Framework/Object/Access/OverloadedPropertyTrait.php +++ b/system/src/Grav/Framework/Object/Access/OverloadedPropertyTrait.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/ArrayObject.php b/system/src/Grav/Framework/Object/ArrayObject.php index 6d9811a93..08041337f 100644 --- a/system/src/Grav/Framework/Object/ArrayObject.php +++ b/system/src/Grav/Framework/Object/ArrayObject.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php b/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php index 0a31da39d..f99a5ff20 100644 --- a/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php +++ b/system/src/Grav/Framework/Object/Base/ObjectCollectionTrait.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Base/ObjectTrait.php b/system/src/Grav/Framework/Object/Base/ObjectTrait.php index 5c2b7b4f7..746428614 100644 --- a/system/src/Grav/Framework/Object/Base/ObjectTrait.php +++ b/system/src/Grav/Framework/Object/Base/ObjectTrait.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Interfaces/NestedObjectInterface.php b/system/src/Grav/Framework/Object/Interfaces/NestedObjectInterface.php index 889d35659..3f8d784d9 100644 --- a/system/src/Grav/Framework/Object/Interfaces/NestedObjectInterface.php +++ b/system/src/Grav/Framework/Object/Interfaces/NestedObjectInterface.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Interfaces/ObjectCollectionInterface.php b/system/src/Grav/Framework/Object/Interfaces/ObjectCollectionInterface.php index 3cba932f6..199cbc3d6 100644 --- a/system/src/Grav/Framework/Object/Interfaces/ObjectCollectionInterface.php +++ b/system/src/Grav/Framework/Object/Interfaces/ObjectCollectionInterface.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Interfaces/ObjectInterface.php b/system/src/Grav/Framework/Object/Interfaces/ObjectInterface.php index 44e8695f8..c652818f4 100644 --- a/system/src/Grav/Framework/Object/Interfaces/ObjectInterface.php +++ b/system/src/Grav/Framework/Object/Interfaces/ObjectInterface.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/LazyObject.php b/system/src/Grav/Framework/Object/LazyObject.php index ba13c6e7b..4aabe252c 100644 --- a/system/src/Grav/Framework/Object/LazyObject.php +++ b/system/src/Grav/Framework/Object/LazyObject.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/ObjectCollection.php b/system/src/Grav/Framework/Object/ObjectCollection.php index 1414492d5..a637bf1e0 100644 --- a/system/src/Grav/Framework/Object/ObjectCollection.php +++ b/system/src/Grav/Framework/Object/ObjectCollection.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Property/ArrayPropertyTrait.php b/system/src/Grav/Framework/Object/Property/ArrayPropertyTrait.php index 7d1d4f8b5..6ae1400eb 100644 --- a/system/src/Grav/Framework/Object/Property/ArrayPropertyTrait.php +++ b/system/src/Grav/Framework/Object/Property/ArrayPropertyTrait.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Property/LazyPropertyTrait.php b/system/src/Grav/Framework/Object/Property/LazyPropertyTrait.php index 10e7caa4b..735bbb2ae 100644 --- a/system/src/Grav/Framework/Object/Property/LazyPropertyTrait.php +++ b/system/src/Grav/Framework/Object/Property/LazyPropertyTrait.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Property/MixedPropertyTrait.php b/system/src/Grav/Framework/Object/Property/MixedPropertyTrait.php index 56b785653..5c2e4a0f7 100644 --- a/system/src/Grav/Framework/Object/Property/MixedPropertyTrait.php +++ b/system/src/Grav/Framework/Object/Property/MixedPropertyTrait.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/Property/ObjectPropertyTrait.php b/system/src/Grav/Framework/Object/Property/ObjectPropertyTrait.php index 727eb7361..b9e575cf6 100644 --- a/system/src/Grav/Framework/Object/Property/ObjectPropertyTrait.php +++ b/system/src/Grav/Framework/Object/Property/ObjectPropertyTrait.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ diff --git a/system/src/Grav/Framework/Object/PropertyObject.php b/system/src/Grav/Framework/Object/PropertyObject.php index 99f9611bc..99f7e7ff9 100644 --- a/system/src/Grav/Framework/Object/PropertyObject.php +++ b/system/src/Grav/Framework/Object/PropertyObject.php @@ -2,7 +2,7 @@ /** * @package Grav\Framework\Object * - * @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved. + * @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved. * @license MIT License; see LICENSE file for details. */ From d629391ad940073304ab4ce56ae47aecf06b3dd7 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 11 Dec 2017 15:08:20 -0700 Subject: [PATCH 055/141] updated changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 549f357e6..d30aa1e5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## mm/dd/2017 1. [](#new) - * Transferred copyright from RocketTheme, LLC, to Trilby Media LLC + * Transferred overall copyright from RocketTheme, LLC, to Trilby Media LLC # v1.4.0-beta.1 From 3fec18e5e58022f1bb089a92bfed44b45244f8e3 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Tue, 12 Dec 2017 12:47:12 +0200 Subject: [PATCH 056/141] Composer update --- composer.lock | 500 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 303 insertions(+), 197 deletions(-) diff --git a/composer.lock b/composer.lock index e31d21532..7a6a7e831 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "391b1b837642a79d03beb5c598c95260", + "content-hash": "863f839a5a0e0ebbf94742efc24cb6a4", "packages": [ { "name": "antoligy/dom-string-iterators", @@ -52,16 +52,16 @@ }, { "name": "composer/ca-bundle", - "version": "1.0.8", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "9dd73a03951357922d8aee6cc084500de93e2343" + "reference": "943b2c4fcad1ef178d16a713c2468bf7e579c288" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/9dd73a03951357922d8aee6cc084500de93e2343", - "reference": "9dd73a03951357922d8aee6cc084500de93e2343", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/943b2c4fcad1ef178d16a713c2468bf7e579c288", + "reference": "943b2c4fcad1ef178d16a713c2468bf7e579c288", "shasum": "" }, "require": { @@ -70,12 +70,9 @@ "php": "^5.3.2 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^4.5", + "phpunit/phpunit": "^4.8.35", "psr/log": "^1.0", - "symfony/process": "^2.5 || ^3.0" - }, - "suggest": { - "symfony/process": "This is necessary to reliably check whether openssl_x509_parse is vulnerable on older php versions, but can be ignored on PHP 5.5.6+" + "symfony/process": "^2.5 || ^3.0 || ^4.0" }, "type": "library", "extra": { @@ -107,7 +104,7 @@ "ssl", "tls" ], - "time": "2017-09-11T07:24:36+00:00" + "time": "2017-11-29T09:37:33+00:00" }, { "name": "doctrine/cache", @@ -247,16 +244,16 @@ }, { "name": "donatj/phpuseragentparser", - "version": "v0.7.0", + "version": "v0.9.0", "source": { "type": "git", "url": "https://github.com/donatj/PhpUserAgent.git", - "reference": "73c819d4c7de034f1bfb7c7a36259192d7d7472a" + "reference": "ea79de6a18e52285e62cd75cf1cebe276ecaf503" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/donatj/PhpUserAgent/zipball/73c819d4c7de034f1bfb7c7a36259192d7d7472a", - "reference": "73c819d4c7de034f1bfb7c7a36259192d7d7472a", + "url": "https://api.github.com/repos/donatj/PhpUserAgent/zipball/ea79de6a18e52285e62cd75cf1cebe276ecaf503", + "reference": "ea79de6a18e52285e62cd75cf1cebe276ecaf503", "shasum": "" }, "require": { @@ -265,7 +262,7 @@ "require-dev": { "camspiers/json-pretty": "0.1.*", "donatj/drop": "*", - "phpunit/phpunit": ">=4.8" + "phpunit/phpunit": "~4.8" }, "type": "library", "autoload": { @@ -294,25 +291,28 @@ "user agent", "useragent" ], - "time": "2017-03-01T22:19:13+00:00" + "time": "2017-10-23T16:52:52+00:00" }, { "name": "erusev/parsedown", - "version": "1.6.3", + "version": "1.6.4", "source": { "type": "git", "url": "https://github.com/erusev/parsedown.git", - "reference": "728952b90a333b5c6f77f06ea9422b94b585878d" + "reference": "fbe3fe878f4fe69048bb8a52783a09802004f548" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown/zipball/728952b90a333b5c6f77f06ea9422b94b585878d", - "reference": "728952b90a333b5c6f77f06ea9422b94b585878d", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/fbe3fe878f4fe69048bb8a52783a09802004f548", + "reference": "fbe3fe878f4fe69048bb8a52783a09802004f548", "shasum": "" }, "require": { "php": ">=5.3.0" }, + "require-dev": { + "phpunit/phpunit": "^4.8.35" + }, "type": "library", "autoload": { "psr-0": { @@ -336,7 +336,7 @@ "markdown", "parser" ], - "time": "2017-05-14T14:47:48+00:00" + "time": "2017-11-14T20:44:03+00:00" }, { "name": "erusev/parsedown-extra", @@ -384,16 +384,16 @@ }, { "name": "filp/whoops", - "version": "2.1.10", + "version": "2.1.14", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "ffbbd2c06c64b08fb47974eed5dbce4ca2bb0eec" + "reference": "c6081b8838686aa04f1e83ba7e91f78b7b2a23e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/ffbbd2c06c64b08fb47974eed5dbce4ca2bb0eec", - "reference": "ffbbd2c06c64b08fb47974eed5dbce4ca2bb0eec", + "url": "https://api.github.com/repos/filp/whoops/zipball/c6081b8838686aa04f1e83ba7e91f78b7b2a23e6", + "reference": "c6081b8838686aa04f1e83ba7e91f78b7b2a23e6", "shasum": "" }, "require": { @@ -402,7 +402,7 @@ }, "require-dev": { "mockery/mockery": "0.9.*", - "phpunit/phpunit": "^4.8 || ^5.0", + "phpunit/phpunit": "^4.8.35 || ^5.7", "symfony/var-dumper": "^2.6 || ^3.0" }, "suggest": { @@ -438,10 +438,10 @@ "exception", "handling", "library", - "whoops", - "zf2" + "throwable", + "whoops" ], - "time": "2017-08-03T18:23:40+00:00" + "time": "2017-11-23T18:22:44+00:00" }, { "name": "gregwar/cache", @@ -591,16 +591,16 @@ }, { "name": "matthiasmullie/minify", - "version": "1.3.52", + "version": "1.3.57", "source": { "type": "git", "url": "https://github.com/matthiasmullie/minify.git", - "reference": "134b25a63d83a80ae128aedc9a99987e064b4382" + "reference": "7559ac0806f39f89f949c917e6612dda8154488b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/134b25a63d83a80ae128aedc9a99987e064b4382", - "reference": "134b25a63d83a80ae128aedc9a99987e064b4382", + "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/7559ac0806f39f89f949c917e6612dda8154488b", + "reference": "7559ac0806f39f89f949c917e6612dda8154488b", "shasum": "" }, "require": { @@ -609,7 +609,7 @@ "php": ">=5.3.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~1.0", + "friendsofphp/php-cs-fixer": "~2.0", "matthiasmullie/scrapbook": "~1.0", "phpunit/phpunit": "~4.8" }, @@ -638,7 +638,7 @@ "role": "Developer" } ], - "description": "CSS & JS minifier", + "description": "CSS & JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.", "homepage": "http://www.minifier.org", "keywords": [ "JS", @@ -647,7 +647,7 @@ "minifier", "minify" ], - "time": "2017-09-15T13:02:11+00:00" + "time": "2017-12-06T12:46:42+00:00" }, { "name": "matthiasmullie/path-converter", @@ -700,16 +700,16 @@ }, { "name": "maximebf/debugbar", - "version": "v1.14.0", + "version": "v1.14.1", "source": { "type": "git", "url": "https://github.com/maximebf/php-debugbar.git", - "reference": "e23a98f2d65607d8aa6c7b409a513f8fdf4acdde" + "reference": "64251a392344e3d22f3d21c3b7c531ba96eb01d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/e23a98f2d65607d8aa6c7b409a513f8fdf4acdde", - "reference": "e23a98f2d65607d8aa6c7b409a513f8fdf4acdde", + "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/64251a392344e3d22f3d21c3b7c531ba96eb01d2", + "reference": "64251a392344e3d22f3d21c3b7c531ba96eb01d2", "shasum": "" }, "require": { @@ -757,7 +757,7 @@ "debug", "debugbar" ], - "time": "2017-08-17T07:17:00+00:00" + "time": "2017-09-13T12:19:36+00:00" }, { "name": "miljar/php-exif", @@ -1086,6 +1086,151 @@ ], "time": "2017-01-02T13:31:39+00:00" }, + { + "name": "roave/security-advisories", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/Roave/SecurityAdvisories.git", + "reference": "40b035345ed34a4cc92c842f60a6cc739101542f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/40b035345ed34a4cc92c842f60a6cc739101542f", + "reference": "40b035345ed34a4cc92c842f60a6cc739101542f", + "shasum": "" + }, + "conflict": { + "adodb/adodb-php": "<5.20.6", + "amphp/artax": "<1.0.6|>=2,<2.0.6", + "aws/aws-sdk-php": ">=3,<3.2.1", + "bugsnag/bugsnag-laravel": ">=2,<2.0.2", + "cakephp/cakephp": ">=1.3,<1.3.18|>=2,<2.4.99|>=2.5,<2.5.99|>=2.6,<2.6.12|>=2.7,<2.7.6|>=3,<3.0.15|>=3.1,<3.1.4", + "cart2quote/module-quotation": ">=4.1.6,<=4.4.5|>=5,<5.4.4", + "cartalyst/sentry": "<=2.1.6", + "codeigniter/framework": "<=3.0.6", + "composer/composer": "<=1.0.0-alpha11", + "contao-components/mediaelement": ">=2.14.2,<2.21.1", + "contao/core": ">=2,<3.5.31", + "contao/core-bundle": ">=4,<4.4.8", + "contao/listing-bundle": ">=4,<4.4.8", + "doctrine/annotations": ">=1,<1.2.7", + "doctrine/cache": ">=1,<1.3.2|>=1.4,<1.4.2", + "doctrine/common": ">=2,<2.4.3|>=2.5,<2.5.1", + "doctrine/dbal": ">=2,<2.0.8|>=2.1,<2.1.2", + "doctrine/doctrine-bundle": "<1.5.2", + "doctrine/doctrine-module": "<=0.7.1", + "doctrine/mongodb-odm": ">=1,<1.0.2", + "doctrine/mongodb-odm-bundle": ">=2,<3.0.1", + "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1", + "dompdf/dompdf": ">=0.6,<0.6.2", + "drupal/core": ">=8,<8.3.7", + "drupal/drupal": ">=8,<8.3.7", + "ezsystems/ezpublish-legacy": ">=5.3,<5.3.12.2|>=5.4,<5.4.10.1|>=2017.8,<2017.8.1.1", + "firebase/php-jwt": "<2", + "friendsofsymfony/rest-bundle": ">=1.2,<1.2.2", + "friendsofsymfony/user-bundle": ">=1.2,<1.3.5", + "gree/jose": "<=2.2", + "gregwar/rst": "<1.0.3", + "guzzlehttp/guzzle": ">=6,<6.2.1|>=4.0.0-rc2,<4.2.4|>=5,<5.3.1", + "illuminate/auth": ">=4,<4.0.99|>=4.1,<4.1.26", + "illuminate/database": ">=4,<4.0.99|>=4.1,<4.1.29", + "joomla/session": "<1.3.1", + "laravel/framework": ">=4,<4.0.99|>=4.1,<4.1.29", + "laravel/socialite": ">=1,<1.0.99|>=2,<2.0.10", + "magento/magento1ce": ">=1.5.0.1,<1.9.3.2", + "magento/magento1ee": ">=1.9,<1.14.3.2", + "magento/magento2ce": ">=2,<2.2", + "monolog/monolog": ">=1.8,<1.12", + "namshi/jose": "<2.2", + "onelogin/php-saml": "<2.10.4", + "oro/crm": ">=1.7,<1.7.4", + "oro/platform": ">=1.7,<1.7.4", + "phpmailer/phpmailer": ">=5,<5.2.24", + "phpunit/phpunit": ">=4.8.19,<4.8.28|>=5.0.10,<5.6.3", + "phpxmlrpc/extras": "<6.0.1", + "pusher/pusher-php-server": "<2.2.1", + "sabre/dav": ">=1.6,<1.6.99|>=1.7,<1.7.11|>=1.8,<1.8.9", + "shopware/shopware": "<5.2.25", + "silverstripe/cms": ">=3,<=3.0.11|>=3.1,<3.1.11", + "silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3", + "silverstripe/framework": ">=3,<3.3", + "silverstripe/userforms": "<3", + "simplesamlphp/saml2": "<1.8.1|>=1.9,<1.9.1|>=1.10,<1.10.3|>=2,<2.3.3", + "simplesamlphp/simplesamlphp": "<1.14.16", + "simplesamlphp/simplesamlphp-module-infocard": "<1.0.1", + "socalnick/scn-social-auth": "<1.15.2", + "squizlabs/php_codesniffer": ">=1,<2.8.1", + "swiftmailer/swiftmailer": ">=4,<5.4.5", + "symfony/dependency-injection": ">=2,<2.0.17", + "symfony/form": ">=2.3,<2.3.35|>=2.4,<2.6.12|>=2.7,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13", + "symfony/framework-bundle": ">=2,<2.3.18|>=2.4,<2.4.8|>=2.5,<2.5.2", + "symfony/http-foundation": ">=2,<2.3.27|>=2.4,<2.5.11|>=2.6,<2.6.6", + "symfony/http-kernel": ">=2,<2.3.29|>=2.4,<2.5.12|>=2.6,<2.6.8", + "symfony/intl": ">=2.7,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13", + "symfony/routing": ">=2,<2.0.19", + "symfony/security": ">=2,<2.0.25|>=2.1,<2.1.13|>=2.2,<2.2.9|>=2.3,<2.3.37|>=2.4,<2.6.13|>=2.7,<2.7.9|>=2.7.30,<2.7.32|>=2.8.23,<2.8.25|>=3.2.10,<3.2.12|>=3.3.3,<3.3.5", + "symfony/security-core": ">=2.4,<2.6.13|>=2.7,<2.7.9|>=2.7.30,<2.7.32|>=2.8,<2.8.6|>=2.8.23,<2.8.25|>=3,<3.0.6|>=3.2.10,<3.2.12|>=3.3.3,<3.3.5", + "symfony/security-csrf": ">=2.7,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13", + "symfony/security-http": ">=2.3,<2.3.41|>=2.4,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13", + "symfony/serializer": ">=2,<2.0.11", + "symfony/symfony": ">=2,<2.3.41|>=2.4,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13", + "symfony/translation": ">=2,<2.0.17", + "symfony/validator": ">=2,<2.0.24|>=2.1,<2.1.12|>=2.2,<2.2.5|>=2.3,<2.3.3", + "symfony/web-profiler-bundle": ">=2,<2.3.19|>=2.4,<2.4.9|>=2.5,<2.5.4", + "symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7", + "thelia/backoffice-default-template": ">=2.1,<2.1.2", + "thelia/thelia": ">=2.1,<2.1.2|>=2.1.0-beta1,<2.1.3", + "twig/twig": "<1.20", + "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.22|>=8,<8.7.5", + "typo3/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.10|>=3.1,<3.1.7|>=3.2,<3.2.7|>=3.3,<3.3.5", + "typo3/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4", + "willdurand/js-translation-bundle": "<2.1.1", + "yiisoft/yii": ">=1.1.14,<1.1.15", + "yiisoft/yii2": "<2.0.5", + "yiisoft/yii2-bootstrap": "<2.0.4", + "yiisoft/yii2-dev": "<2.0.4", + "yiisoft/yii2-gii": "<2.0.4", + "yiisoft/yii2-jui": "<2.0.4", + "zendframework/zend-cache": ">=2.4,<2.4.8|>=2.5,<2.5.3", + "zendframework/zend-captcha": ">=2,<2.4.9|>=2.5,<2.5.2", + "zendframework/zend-crypt": ">=2,<2.4.9|>=2.5,<2.5.2", + "zendframework/zend-db": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.10|>=2.3,<2.3.5", + "zendframework/zend-diactoros": ">=1,<1.0.4", + "zendframework/zend-form": ">=2,<2.2.7|>=2.3,<2.3.1", + "zendframework/zend-http": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.3,<2.3.8|>=2.4,<2.4.1", + "zendframework/zend-json": ">=2.1,<2.1.6|>=2.2,<2.2.6", + "zendframework/zend-ldap": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.8|>=2.3,<2.3.3", + "zendframework/zend-mail": ">=2,<2.4.11|>=2.5,<2.7.2", + "zendframework/zend-navigation": ">=2,<2.2.7|>=2.3,<2.3.1", + "zendframework/zend-session": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.9|>=2.3,<2.3.4", + "zendframework/zend-validator": ">=2.3,<2.3.6", + "zendframework/zend-view": ">=2,<2.2.7|>=2.3,<2.3.1", + "zendframework/zend-xmlrpc": ">=2.1,<2.1.6|>=2.2,<2.2.6", + "zendframework/zendframework": ">=2,<2.4.11|>=2.5,<2.5.1", + "zendframework/zendframework1": "<1.12.20", + "zendframework/zendopenid": ">=2,<2.0.2", + "zendframework/zendxml": ">=1,<1.0.1", + "zetacomponents/mail": "<1.8.2", + "zf-commons/zfc-user": "<1.2.2", + "zfcampus/zf-apigility-doctrine": ">=1,<1.0.3", + "zfr/zfr-oauth2-server-module": "<0.1.2" + }, + "type": "metapackage", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "role": "maintainer" + } + ], + "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it", + "time": "2017-12-12T00:38:43+00:00" + }, { "name": "rockettheme/toolbox", "version": "1.3.8", @@ -1184,16 +1329,16 @@ }, { "name": "symfony/console", - "version": "v2.8.27", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "c0807a2ca978e64d8945d373a9221a5c35d1a253" + "reference": "46270f1ca44f08ebc134ce120fd2c2baf5fd63de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/c0807a2ca978e64d8945d373a9221a5c35d1a253", - "reference": "c0807a2ca978e64d8945d373a9221a5c35d1a253", + "url": "https://api.github.com/repos/symfony/console/zipball/46270f1ca44f08ebc134ce120fd2c2baf5fd63de", + "reference": "46270f1ca44f08ebc134ce120fd2c2baf5fd63de", "shasum": "" }, "require": { @@ -1241,7 +1386,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-08-27T14:29:03+00:00" + "time": "2017-11-29T09:33:18+00:00" }, { "name": "symfony/debug", @@ -1302,16 +1447,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.8.27", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "1377400fd641d7d1935981546aaef780ecd5bf6d" + "reference": "b59aacf238fadda50d612c9de73b74751872a903" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/1377400fd641d7d1935981546aaef780ecd5bf6d", - "reference": "1377400fd641d7d1935981546aaef780ecd5bf6d", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b59aacf238fadda50d612c9de73b74751872a903", + "reference": "b59aacf238fadda50d612c9de73b74751872a903", "shasum": "" }, "require": { @@ -1358,20 +1503,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-06-02T07:47:27+00:00" + "time": "2017-11-05T15:25:56+00:00" }, { "name": "symfony/polyfill-iconv", - "version": "v1.5.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-iconv.git", - "reference": "1ea0e08453819ecc7130e1fb0ee10862c2f33ed0" + "reference": "7a84ccdb8c953ee274c96dd6bde778d873fc824a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/1ea0e08453819ecc7130e1fb0ee10862c2f33ed0", - "reference": "1ea0e08453819ecc7130e1fb0ee10862c2f33ed0", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/7a84ccdb8c953ee274c96dd6bde778d873fc824a", + "reference": "7a84ccdb8c953ee274c96dd6bde778d873fc824a", "shasum": "" }, "require": { @@ -1383,7 +1528,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5-dev" + "dev-master": "1.6-dev" } }, "autoload": { @@ -1417,20 +1562,20 @@ "portable", "shim" ], - "time": "2017-06-14T15:44:48+00:00" + "time": "2017-10-11T12:05:26+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.5.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803" + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7c8fae0ac1d216eb54349e6a8baa57d515fe8803", - "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", "shasum": "" }, "require": { @@ -1442,7 +1587,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5-dev" + "dev-master": "1.6-dev" } }, "autoload": { @@ -1476,20 +1621,20 @@ "portable", "shim" ], - "time": "2017-06-14T15:44:48+00:00" + "time": "2017-10-11T12:05:26+00:00" }, { "name": "symfony/var-dumper", - "version": "v2.8.27", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "83ebf3e92c0b2231fa63b8e584a2a3d3cd9876ef" + "reference": "0f2d237b01db1a1a486e330ad89be836513e19a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/83ebf3e92c0b2231fa63b8e584a2a3d3cd9876ef", - "reference": "83ebf3e92c0b2231fa63b8e584a2a3d3cd9876ef", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/0f2d237b01db1a1a486e330ad89be836513e19a0", + "reference": "0f2d237b01db1a1a486e330ad89be836513e19a0", "shasum": "" }, "require": { @@ -1544,20 +1689,20 @@ "debug", "dump" ], - "time": "2017-08-27T14:29:03+00:00" + "time": "2017-11-07T14:08:47+00:00" }, { "name": "symfony/yaml", - "version": "v2.8.27", + "version": "v2.8.32", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "4c29dec8d489c4e37cf87ccd7166cd0b0e6a45c5" + "reference": "968ef42161e4bc04200119da473077f9e7015128" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/4c29dec8d489c4e37cf87ccd7166cd0b0e6a45c5", - "reference": "4c29dec8d489c4e37cf87ccd7166cd0b0e6a45c5", + "url": "https://api.github.com/repos/symfony/yaml/zipball/968ef42161e4bc04200119da473077f9e7015128", + "reference": "968ef42161e4bc04200119da473077f9e7015128", "shasum": "" }, "require": { @@ -1593,7 +1738,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-06-01T20:52:29+00:00" + "time": "2017-11-29T09:33:18+00:00" }, { "name": "twig/twig", @@ -1723,16 +1868,16 @@ }, { "name": "codeception/codeception", - "version": "2.3.6", + "version": "2.3.7", "source": { "type": "git", "url": "https://github.com/Codeception/Codeception.git", - "reference": "c3dd3b5d9e0b1ea6c2fcca52457736dc756716f8" + "reference": "151de88277878adc18784ef3eaddd87f4a2fdc14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/Codeception/zipball/c3dd3b5d9e0b1ea6c2fcca52457736dc756716f8", - "reference": "c3dd3b5d9e0b1ea6c2fcca52457736dc756716f8", + "url": "https://api.github.com/repos/Codeception/Codeception/zipball/151de88277878adc18784ef3eaddd87f4a2fdc14", + "reference": "151de88277878adc18784ef3eaddd87f4a2fdc14", "shasum": "" }, "require": { @@ -1744,18 +1889,17 @@ "guzzlehttp/psr7": "~1.0", "php": ">=5.4.0 <8.0", "phpunit/php-code-coverage": ">=2.2.4 <6.0", - "phpunit/phpunit": ">4.8.20 <7.0", + "phpunit/phpunit": ">=4.8.28 <5.0.0 || >=5.6.3 <7.0", "phpunit/phpunit-mock-objects": ">2.3 <5.0", "sebastian/comparator": ">1.1 <3.0", "sebastian/diff": ">=1.4 <3.0", - "stecman/symfony-console-completion": "^0.7.0", - "symfony/browser-kit": ">=2.7 <4.0", - "symfony/console": ">=2.7 <4.0", - "symfony/css-selector": ">=2.7 <4.0", - "symfony/dom-crawler": ">=2.7.5 <4.0", - "symfony/event-dispatcher": ">=2.7 <4.0", - "symfony/finder": ">=2.7 <4.0", - "symfony/yaml": ">=2.7 <4.0" + "symfony/browser-kit": ">=2.7 <5.0", + "symfony/console": ">=2.7 <5.0", + "symfony/css-selector": ">=2.7 <5.0", + "symfony/dom-crawler": ">=2.7 <5.0", + "symfony/event-dispatcher": ">=2.7 <5.0", + "symfony/finder": ">=2.7 <5.0", + "symfony/yaml": ">=2.7 <5.0" }, "require-dev": { "codeception/specify": "~0.3", @@ -1768,16 +1912,19 @@ "php-amqplib/php-amqplib": "~2.4", "predis/predis": "^1.0", "squizlabs/php_codesniffer": "~2.0", - "symfony/process": ">=2.7 <4.0", + "symfony/process": ">=2.7 <5.0", "vlucas/phpdotenv": "^2.4.0" }, "suggest": { + "aws/aws-sdk-php": "For using AWS Auth in REST module and Queue module", + "codeception/phpbuiltinserver": "Start and stop PHP built-in web server for your tests", "codeception/specify": "BDD-style code blocks", "codeception/verify": "BDD-style assertions", "flow/jsonpath": "For using JSONPath in REST module", "league/factory-muffin": "For DataFactory module", "league/factory-muffin-faker": "For Faker support in DataFactory module", "phpseclib/phpseclib": "for SFTP option in FTP Module", + "stecman/symfony-console-completion": "For BASH autocompletion", "symfony/phpunit-bridge": "For phpunit-bridge support" }, "bin": [ @@ -1813,7 +1960,7 @@ "functional testing", "unit testing" ], - "time": "2017-09-28T23:19:49+00:00" + "time": "2017-12-12T04:22:17+00:00" }, { "name": "doctrine/instantiator", @@ -2208,22 +2355,22 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.1.1", + "version": "3.2.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2" + "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/2d3d238c433cf69caeb4842e97a3223a116f94b2", - "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/4aada1f93c72c35e22fb1383b47fee43b8f1d157", + "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157", "shasum": "" }, "require": { - "php": "^7.0", + "php": ">=5.5", "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.4.0", + "phpdocumentor/type-resolver": "^0.3.0", "webmozart/assert": "^1.0" }, "require-dev": { @@ -2249,20 +2396,20 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-08-30T18:51:59+00:00" + "time": "2017-08-08T06:39:58+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.4.0", + "version": "0.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fb3933512008d8162b3cdf9e18dba9309b7c3773", + "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773", "shasum": "" }, "require": { @@ -2296,20 +2443,20 @@ "email": "me@mikevanriel.com" } ], - "time": "2017-07-14T14:27:02+00:00" + "time": "2017-06-03T08:32:36+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.7.2", + "version": "1.7.3", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6" + "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", - "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", + "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", "shasum": "" }, "require": { @@ -2321,7 +2468,7 @@ }, "require-dev": { "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8 || ^5.6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7" }, "type": "library", "extra": { @@ -2359,7 +2506,7 @@ "spy", "stub" ], - "time": "2017-09-04T11:05:03+00:00" + "time": "2017-11-24T13:59:53+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2425,16 +2572,16 @@ }, { "name": "phpunit/php-file-iterator", - "version": "1.4.2", + "version": "1.4.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", "shasum": "" }, "require": { @@ -2468,7 +2615,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03T07:40:28+00:00" + "time": "2017-11-27T13:52:08+00:00" }, { "name": "phpunit/php-text-template", @@ -2562,16 +2709,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "1.4.11", + "version": "1.4.12", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", "shasum": "" }, "require": { @@ -2607,7 +2754,7 @@ "keywords": [ "tokenizer" ], - "time": "2017-02-27T10:12:30+00:00" + "time": "2017-12-04T08:55:13+00:00" }, { "name": "phpunit/phpunit", @@ -3159,72 +3306,27 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2015-06-21T13:59:46+00:00" }, - { - "name": "stecman/symfony-console-completion", - "version": "0.7.0", - "source": { - "type": "git", - "url": "https://github.com/stecman/symfony-console-completion.git", - "reference": "5461d43e53092b3d3b9dbd9d999f2054730f4bbb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/stecman/symfony-console-completion/zipball/5461d43e53092b3d3b9dbd9d999f2054730f4bbb", - "reference": "5461d43e53092b3d3b9dbd9d999f2054730f4bbb", - "shasum": "" - }, - "require": { - "php": ">=5.3.2", - "symfony/console": "~2.3 || ~3.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.6.x-dev" - } - }, - "autoload": { - "psr-4": { - "Stecman\\Component\\Symfony\\Console\\BashCompletion\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Stephen Holdaway", - "email": "stephen@stecman.co.nz" - } - ], - "description": "Automatic BASH completion for Symfony Console Component based applications.", - "time": "2016-02-24T05:08:54+00:00" - }, { "name": "symfony/browser-kit", - "version": "v3.3.9", + "version": "v3.4.1", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "aee7120b058c268363e606ff5fe8271da849a1b5" + "reference": "179522b5f0b5e6d00bb60f38a4d6b29962e4b61b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/aee7120b058c268363e606ff5fe8271da849a1b5", - "reference": "aee7120b058c268363e606ff5fe8271da849a1b5", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/179522b5f0b5e6d00bb60f38a4d6b29962e4b61b", + "reference": "179522b5f0b5e6d00bb60f38a4d6b29962e4b61b", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8", - "symfony/dom-crawler": "~2.8|~3.0" + "symfony/dom-crawler": "~2.8|~3.0|~4.0" }, "require-dev": { - "symfony/css-selector": "~2.8|~3.0", - "symfony/process": "~2.8|~3.0" + "symfony/css-selector": "~2.8|~3.0|~4.0", + "symfony/process": "~2.8|~3.0|~4.0" }, "suggest": { "symfony/process": "" @@ -3232,7 +3334,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -3259,20 +3361,20 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2017-11-07T14:20:24+00:00" }, { "name": "symfony/css-selector", - "version": "v3.3.9", + "version": "v3.4.1", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "c5f5263ed231f164c58368efbce959137c7d9488" + "reference": "7134b93e90ea7e7881fcb2da006d21b4c5f31908" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/c5f5263ed231f164c58368efbce959137c7d9488", - "reference": "c5f5263ed231f164c58368efbce959137c7d9488", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/7134b93e90ea7e7881fcb2da006d21b4c5f31908", + "reference": "7134b93e90ea7e7881fcb2da006d21b4c5f31908", "shasum": "" }, "require": { @@ -3281,7 +3383,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -3312,20 +3414,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2017-11-05T16:10:10+00:00" }, { "name": "symfony/dom-crawler", - "version": "v3.3.9", + "version": "v3.4.1", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "6b511d7329b203a620f09a2288818d27dcc915ae" + "reference": "7bf68716e400997a291ad42c9f9fe7972e6656d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/6b511d7329b203a620f09a2288818d27dcc915ae", - "reference": "6b511d7329b203a620f09a2288818d27dcc915ae", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/7bf68716e400997a291ad42c9f9fe7972e6656d2", + "reference": "7bf68716e400997a291ad42c9f9fe7972e6656d2", "shasum": "" }, "require": { @@ -3333,7 +3435,7 @@ "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { - "symfony/css-selector": "~2.8|~3.0" + "symfony/css-selector": "~2.8|~3.0|~4.0" }, "suggest": { "symfony/css-selector": "" @@ -3341,7 +3443,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -3368,20 +3470,20 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2017-09-11T15:55:22+00:00" + "time": "2017-11-05T16:10:10+00:00" }, { "name": "symfony/finder", - "version": "v3.3.9", + "version": "v3.4.1", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "b2260dbc80f3c4198f903215f91a1ac7fe9fe09e" + "reference": "dac8d7db537bac7ad8143eb11360a8c2231f251a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/b2260dbc80f3c4198f903215f91a1ac7fe9fe09e", - "reference": "b2260dbc80f3c4198f903215f91a1ac7fe9fe09e", + "url": "https://api.github.com/repos/symfony/finder/zipball/dac8d7db537bac7ad8143eb11360a8c2231f251a", + "reference": "dac8d7db537bac7ad8143eb11360a8c2231f251a", "shasum": "" }, "require": { @@ -3390,7 +3492,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -3417,20 +3519,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2017-11-05T16:10:10+00:00" }, { "name": "symfony/process", - "version": "v3.3.9", + "version": "v3.4.1", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0" + "reference": "db25e810fd5e124085e3777257d0cf4ae533d0ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0", - "reference": "b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0", + "url": "https://api.github.com/repos/symfony/process/zipball/db25e810fd5e124085e3777257d0cf4ae533d0ea", + "reference": "db25e810fd5e124085e3777257d0cf4ae533d0ea", "shasum": "" }, "require": { @@ -3439,7 +3541,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -3466,7 +3568,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2017-11-22T12:18:49+00:00" }, { "name": "victorjonsson/markdowndocs", @@ -3568,6 +3670,7 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { + "roave/security-advisories": 20, "victorjonsson/markdowndocs": 20 }, "prefer-stable": false, @@ -3579,5 +3682,8 @@ "ext-curl": "*", "ext-zip": "*" }, - "platform-dev": [] + "platform-dev": [], + "platform-overrides": { + "php": "5.5.9" + } } From 97b088b959301f3bb0282647a8e0e4094f71c3a2 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Tue, 12 Dec 2017 11:29:02 -0700 Subject: [PATCH 057/141] Updated welcome page --- user/pages/01.home/default.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user/pages/01.home/default.md b/user/pages/01.home/default.md index 3ebb8dda0..a5bcc57c1 100644 --- a/user/pages/01.home/default.md +++ b/user/pages/01.home/default.md @@ -2,10 +2,10 @@ title: Home --- -# Grav is Running! -## You have installed **Grav** successfully +# **Grav is Running!** +## You have installed Grav successfully -Congratulations! You have installed the **Base Grav Package** that provides a **simple page** and the default **antimatter** theme to get you started. +Congratulations! You have installed the **Base Grav Package** that provides a **simple page** and the default **Quark** theme to get you started. !!! If you want a more **full-featured** base install, you should check out [**Skeleton** packages available in the downloads](http://getgrav.org/downloads). From aadb8bb2eabd50c816e72c9c1439eaa849485571 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 13 Dec 2017 21:51:06 -0700 Subject: [PATCH 058/141] Added some new theme twig functions --- system/src/Grav/Common/Twig/TwigExtension.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/system/src/Grav/Common/Twig/TwigExtension.php b/system/src/Grav/Common/Twig/TwigExtension.php index 56e659fde..a927817ed 100644 --- a/system/src/Grav/Common/Twig/TwigExtension.php +++ b/system/src/Grav/Common/Twig/TwigExtension.php @@ -137,6 +137,8 @@ class TwigExtension extends \Twig_Extension implements \Twig_Extension_GlobalsIn new \Twig_SimpleFunction('isajaxrequest', [$this, 'isAjaxFunc']), new \Twig_SimpleFunction('exif', [$this, 'exifFunc']), new \Twig_SimpleFunction('media_directory', [$this, 'mediaDirFunc']), + new \Twig_SimpleFunction('body_class', [$this, 'bodyClassFunc']), + new \Twig_SimpleFunction('theme_var', [$this, 'themeVarFunc']), ]; } @@ -1124,4 +1126,40 @@ class TwigExtension extends \Twig_Extension implements \Twig_Extension_GlobalsIn return number_format($n); } + + /** + * Get a theme variable + * + * @param $var + * @return string + */ + public function themeVarFunc($var) + { + return $this->config->get('theme.' . $var, false) ?: ''; + } + + /** + * takes an array of classes, and if they are not set on body_classes + * look to see if they are set in theme config + * + * @param $classes + * @return string + */ + public function bodyClassFunc($classes) + { + + $header = $this->grav['page']->header(); + $body_classes = isset($header->body_classes) ? $header->body_classes : ''; + + foreach ((array)$classes as $class) { + if (!empty($body_classes) && Utils::contains($body_classes, $class)) { + continue; + } else { + $val = $this->config->get('theme.' . $class, false) ? $class : false; + $body_classes .= $val ? ' ' . $val : ''; + } + } + + return $body_classes; + } } From 21674194e0501b74884e6bdf6c35a6682871d8ad Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 13 Dec 2017 22:19:43 -0700 Subject: [PATCH 059/141] Updated changelog --- CHANGELOG.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d30aa1e5d..c08e03f3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,11 @@ -# v1.4.0-beta.1 +# v1.4.0-beta.2 ## mm/dd/2017 1. [](#new) * Transferred overall copyright from RocketTheme, LLC, to Trilby Media LLC - + * Added `theme_var` and `body_class` Twig functions that are useful for themes +1. [](#improved) + * Updated vendor libraries to latest version # v1.4.0-beta.1 ## 12/11/2017 From fb106b1106f6845857fe25ae3a06d2ec73edaaeb Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 15 Dec 2017 21:31:40 +0200 Subject: [PATCH 060/141] Removed constructor from ObjectInterface --- CHANGELOG.md | 1 + .../Grav/Framework/Object/Interfaces/ObjectInterface.php | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a8652d26..4af7acc67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Added `theme_var` and `body_class` Twig functions that are useful for themes 1. [](#improved) * Updated vendor libraries to latest version + * Removed constructor from ObjectInterface # v1.4.0-beta.1 ## 12/11/2017 diff --git a/system/src/Grav/Framework/Object/Interfaces/ObjectInterface.php b/system/src/Grav/Framework/Object/Interfaces/ObjectInterface.php index c652818f4..f454ad850 100644 --- a/system/src/Grav/Framework/Object/Interfaces/ObjectInterface.php +++ b/system/src/Grav/Framework/Object/Interfaces/ObjectInterface.php @@ -14,12 +14,6 @@ namespace Grav\Framework\Object\Interfaces; */ interface ObjectInterface extends \Serializable, \JsonSerializable { - /** - * @param array $elements - * @param string $key - */ - public function __construct(array $elements = [], $key = null); - /** * @return string */ From b6e5bfa7f34422c032679bc3be7b67d92ec9aa6c Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Fri, 15 Dec 2017 15:12:26 -0700 Subject: [PATCH 061/141] Fixed `BadMethodException` in GPM updates #1784 --- CHANGELOG.md | 2 ++ system/src/Grav/Common/GPM/Common/Package.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c08e03f3e..6760ef33f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ * Added `theme_var` and `body_class` Twig functions that are useful for themes 1. [](#improved) * Updated vendor libraries to latest version +1. [](#bugfix) + * Fixed `BadMethodCallException` thrown in GPM updates [#1784](https://github.com/getgrav/grav/issues/1784) # v1.4.0-beta.1 ## 12/11/2017 diff --git a/system/src/Grav/Common/GPM/Common/Package.php b/system/src/Grav/Common/GPM/Common/Package.php index 468ca9e9c..ce25d57d2 100644 --- a/system/src/Grav/Common/GPM/Common/Package.php +++ b/system/src/Grav/Common/GPM/Common/Package.php @@ -35,7 +35,7 @@ class Package { } public function __set($key, $value) { - throw new \BadMethodCallException('Not Implemented'); + $this->data->set($key, $value); } public function __toString() { From 1f1c429fc4089bfd710704f8a81654bd47997060 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Fri, 15 Dec 2017 15:27:23 -0700 Subject: [PATCH 062/141] updated changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52851519e..f2669de99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,11 @@ # v1.4.0-beta.2 -## mm/dd/2017 +## 12/15/2017 1. [](#new) * Transferred overall copyright from RocketTheme, LLC, to Trilby Media LLC * Added `theme_var` and `body_class` Twig functions that are useful for themes 1. [](#improved) - * Updated vendor libraries to latest version + * Updated vendor libraries to latest versions * Removed constructor from ObjectInterface 1. [](#bugfix) * Fixed `BadMethodCallException` thrown in GPM updates [#1784](https://github.com/getgrav/grav/issues/1784) From 559fde4e00cb5a5bce39112c7f2b58c5e3a1b2d2 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Fri, 15 Dec 2017 15:54:50 -0700 Subject: [PATCH 063/141] Tweak to default page --- user/pages/01.home/default.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/user/pages/01.home/default.md b/user/pages/01.home/default.md index a5bcc57c1..fd8aea9ae 100644 --- a/user/pages/01.home/default.md +++ b/user/pages/01.home/default.md @@ -1,8 +1,9 @@ --- title: Home +body_classes: title-center --- -# **Grav is Running!** +# Grav is Running! ## You have installed Grav successfully Congratulations! You have installed the **Base Grav Package** that provides a **simple page** and the default **Quark** theme to get you started. From a1c804ed41d08ba94e0cbf3072ef27e31ae5317e Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Fri, 15 Dec 2017 16:08:53 -0700 Subject: [PATCH 064/141] Changed title --- user/pages/01.home/default.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user/pages/01.home/default.md b/user/pages/01.home/default.md index fd8aea9ae..407895f8e 100644 --- a/user/pages/01.home/default.md +++ b/user/pages/01.home/default.md @@ -4,7 +4,7 @@ body_classes: title-center --- # Grav is Running! -## You have installed Grav successfully +## installation successful... Congratulations! You have installed the **Base Grav Package** that provides a **simple page** and the default **Quark** theme to get you started. From 3e15de74f4d913a9ef584acc81c1084b7dc454e6 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Sun, 17 Dec 2017 13:45:48 -0700 Subject: [PATCH 065/141] Added `header_var` twig function --- CHANGELOG.md | 2 +- system/src/Grav/Common/Twig/TwigExtension.php | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2669de99..8c0a6e2de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ 1. [](#new) * Transferred overall copyright from RocketTheme, LLC, to Trilby Media LLC - * Added `theme_var` and `body_class` Twig functions that are useful for themes + * Added `theme_var`, `header_var` and `body_class` Twig functions for themes 1. [](#improved) * Updated vendor libraries to latest versions * Removed constructor from ObjectInterface diff --git a/system/src/Grav/Common/Twig/TwigExtension.php b/system/src/Grav/Common/Twig/TwigExtension.php index a927817ed..be41fc8a0 100644 --- a/system/src/Grav/Common/Twig/TwigExtension.php +++ b/system/src/Grav/Common/Twig/TwigExtension.php @@ -139,6 +139,7 @@ class TwigExtension extends \Twig_Extension implements \Twig_Extension_GlobalsIn new \Twig_SimpleFunction('media_directory', [$this, 'mediaDirFunc']), new \Twig_SimpleFunction('body_class', [$this, 'bodyClassFunc']), new \Twig_SimpleFunction('theme_var', [$this, 'themeVarFunc']), + new \Twig_SimpleFunction('header_var', [$this, 'pageHeaderVarFunc']), ]; } @@ -1162,4 +1163,37 @@ class TwigExtension extends \Twig_Extension implements \Twig_Extension_GlobalsIn return $body_classes; } + + /** + * Look for a page header variable in an array of pages working its way through until a value is found + * + * @param $var + * @param null $pages + * @return mixed + */ + public function pageHeaderVarFunc($var, $pages = null) + { + if ($pages === null) { + $pages = $this->grav['page']; + } + + // Make sure pages are an array + if (!is_array($pages)) { + $pages = array($pages); + } + + // Loop over pages and look for header vars + foreach ($pages as $page) { + if (is_string($page)) { + $page = $this->grav['pages']->find($page); + } + + if ($page) { + $header = $page->header(); + if (isset($header->$var)) { + return $header->$var; + } + } + } + } } From 42de0bbb32b22d9f291fdada1004766090844399 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Mon, 18 Dec 2017 09:16:52 +0200 Subject: [PATCH 066/141] Changelog update --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c0a6e2de..2219db182 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ * Added `theme_var`, `header_var` and `body_class` Twig functions for themes 1. [](#improved) * Updated vendor libraries to latest versions - * Removed constructor from ObjectInterface + * Removed constructor from `ObjectInterface` 1. [](#bugfix) * Fixed `BadMethodCallException` thrown in GPM updates [#1784](https://github.com/getgrav/grav/issues/1784) From 2d93c1ace09e6198c070a6af5424609302912226 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 18 Dec 2017 12:18:10 -0700 Subject: [PATCH 067/141] title change --- user/pages/01.home/default.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user/pages/01.home/default.md b/user/pages/01.home/default.md index 407895f8e..e7977d62d 100644 --- a/user/pages/01.home/default.md +++ b/user/pages/01.home/default.md @@ -3,7 +3,7 @@ title: Home body_classes: title-center --- -# Grav is Running! +# Say Hello to Grav! ## installation successful... Congratulations! You have installed the **Base Grav Package** that provides a **simple page** and the default **Quark** theme to get you started. From 3888358dc971ca9419734310e97f062e31d5ad2f Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 18 Dec 2017 14:07:55 -0700 Subject: [PATCH 068/141] Updated to latest vendor libs --- composer.lock | 54 +++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/composer.lock b/composer.lock index 7a6a7e831..a81fe2801 100644 --- a/composer.lock +++ b/composer.lock @@ -700,22 +700,22 @@ }, { "name": "maximebf/debugbar", - "version": "v1.14.1", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/maximebf/php-debugbar.git", - "reference": "64251a392344e3d22f3d21c3b7c531ba96eb01d2" + "reference": "30e7d60937ee5f1320975ca9bc7bcdd44d500f07" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/64251a392344e3d22f3d21c3b7c531ba96eb01d2", - "reference": "64251a392344e3d22f3d21c3b7c531ba96eb01d2", + "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/30e7d60937ee5f1320975ca9bc7bcdd44d500f07", + "reference": "30e7d60937ee5f1320975ca9bc7bcdd44d500f07", "shasum": "" }, "require": { "php": ">=5.3.0", "psr/log": "^1.0", - "symfony/var-dumper": "^2.6|^3.0" + "symfony/var-dumper": "^2.6|^3.0|^4.0" }, "require-dev": { "phpunit/phpunit": "^4.0|^5.0" @@ -757,7 +757,7 @@ "debug", "debugbar" ], - "time": "2017-09-13T12:19:36+00:00" + "time": "2017-12-15T11:13:46+00:00" }, { "name": "miljar/php-exif", @@ -3308,16 +3308,16 @@ }, { "name": "symfony/browser-kit", - "version": "v3.4.1", + "version": "v3.4.2", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "179522b5f0b5e6d00bb60f38a4d6b29962e4b61b" + "reference": "f761b4ecdd23a451c2cae6fba704d8b207cbb045" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/179522b5f0b5e6d00bb60f38a4d6b29962e4b61b", - "reference": "179522b5f0b5e6d00bb60f38a4d6b29962e4b61b", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/f761b4ecdd23a451c2cae6fba704d8b207cbb045", + "reference": "f761b4ecdd23a451c2cae6fba704d8b207cbb045", "shasum": "" }, "require": { @@ -3361,20 +3361,20 @@ ], "description": "Symfony BrowserKit Component", "homepage": "https://symfony.com", - "time": "2017-11-07T14:20:24+00:00" + "time": "2017-12-11T22:06:16+00:00" }, { "name": "symfony/css-selector", - "version": "v3.4.1", + "version": "v3.4.2", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "7134b93e90ea7e7881fcb2da006d21b4c5f31908" + "reference": "eac760b414cf1f64362c3dd047b989e4db121332" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/7134b93e90ea7e7881fcb2da006d21b4c5f31908", - "reference": "7134b93e90ea7e7881fcb2da006d21b4c5f31908", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/eac760b414cf1f64362c3dd047b989e4db121332", + "reference": "eac760b414cf1f64362c3dd047b989e4db121332", "shasum": "" }, "require": { @@ -3414,20 +3414,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2017-11-05T16:10:10+00:00" + "time": "2017-12-14T19:40:10+00:00" }, { "name": "symfony/dom-crawler", - "version": "v3.4.1", + "version": "v3.4.2", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "7bf68716e400997a291ad42c9f9fe7972e6656d2" + "reference": "dc847845c66fa68ad4522ed27e62b9b9dd12ab3b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/7bf68716e400997a291ad42c9f9fe7972e6656d2", - "reference": "7bf68716e400997a291ad42c9f9fe7972e6656d2", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/dc847845c66fa68ad4522ed27e62b9b9dd12ab3b", + "reference": "dc847845c66fa68ad4522ed27e62b9b9dd12ab3b", "shasum": "" }, "require": { @@ -3470,11 +3470,11 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2017-11-05T16:10:10+00:00" + "time": "2017-12-14T19:40:10+00:00" }, { "name": "symfony/finder", - "version": "v3.4.1", + "version": "v3.4.2", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -3523,16 +3523,16 @@ }, { "name": "symfony/process", - "version": "v3.4.1", + "version": "v3.4.2", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "db25e810fd5e124085e3777257d0cf4ae533d0ea" + "reference": "bb3ef65d493a6d57297cad6c560ee04e2a8f5098" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/db25e810fd5e124085e3777257d0cf4ae533d0ea", - "reference": "db25e810fd5e124085e3777257d0cf4ae533d0ea", + "url": "https://api.github.com/repos/symfony/process/zipball/bb3ef65d493a6d57297cad6c560ee04e2a8f5098", + "reference": "bb3ef65d493a6d57297cad6c560ee04e2a8f5098", "shasum": "" }, "require": { @@ -3568,7 +3568,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-11-22T12:18:49+00:00" + "time": "2017-12-14T19:40:10+00:00" }, { "name": "victorjonsson/markdowndocs", From 9d41417c263de747b5982ffff8b5abed46f16eee Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 18 Dec 2017 14:21:43 -0700 Subject: [PATCH 069/141] updated changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2219db182..57230e9a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # v1.4.0-beta.2 -## 12/15/2017 +## 12/18/2017 1. [](#new) * Transferred overall copyright from RocketTheme, LLC, to Trilby Media LLC From a8a061d4b292ba214dddd5cbb6dbbdf61e7786c0 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 18 Dec 2017 14:28:07 -0700 Subject: [PATCH 070/141] updated defines for beta.2 --- system/defines.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/defines.php b/system/defines.php index b28f4df0b..8de65a18c 100644 --- a/system/defines.php +++ b/system/defines.php @@ -8,7 +8,7 @@ // Some standard defines define('GRAV', true); -define('GRAV_VERSION', '1.4.0-beta.1'); +define('GRAV_VERSION', '1.4.0-beta.2'); define('GRAV_TESTING', true); define('DS', '/'); From bd578070de7e29f16bd8853d6d499081f8cb1074 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 18 Dec 2017 17:34:49 -0700 Subject: [PATCH 071/141] removed _set method as it breaks GPM --- CHANGELOG.md | 6 ++++++ system/src/Grav/Common/GPM/Common/Package.php | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57230e9a4..a8d0d0b47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.4.0-beta.3 +## mm/dd/2017 + +1. [](#bugfix) + * Fix for `vundefined` error for version numbers in GPM [form#222](https://github.com/getgrav/grav-plugin-form/issues/222) + # v1.4.0-beta.2 ## 12/18/2017 diff --git a/system/src/Grav/Common/GPM/Common/Package.php b/system/src/Grav/Common/GPM/Common/Package.php index ce25d57d2..fe4618af7 100644 --- a/system/src/Grav/Common/GPM/Common/Package.php +++ b/system/src/Grav/Common/GPM/Common/Package.php @@ -34,10 +34,6 @@ class Package { return isset($this->data->$key); } - public function __set($key, $value) { - $this->data->set($key, $value); - } - public function __toString() { return $this->toJson(); } From 5df6db9ffa26341ee00c501655662a56100a4f93 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Tue, 26 Dec 2017 15:01:44 -0700 Subject: [PATCH 072/141] Added a new typography page --- user/pages/01.home/default.md | 10 +- user/pages/02.typography/default.md | 155 ++++++++++++++++++++++++++++ 2 files changed, 161 insertions(+), 4 deletions(-) create mode 100644 user/pages/02.typography/default.md diff --git a/user/pages/01.home/default.md b/user/pages/01.home/default.md index e7977d62d..a8119bde9 100644 --- a/user/pages/01.home/default.md +++ b/user/pages/01.home/default.md @@ -1,6 +1,6 @@ --- title: Home -body_classes: title-center +body_classes: title-center title-h1h2 --- # Say Hello to Grav! @@ -8,7 +8,7 @@ body_classes: title-center Congratulations! You have installed the **Base Grav Package** that provides a **simple page** and the default **Quark** theme to get you started. -!!! If you want a more **full-featured** base install, you should check out [**Skeleton** packages available in the downloads](http://getgrav.org/downloads). +!! If you see a **404 Error** when you click `Typography` in the menu, please refer to the [troubleshooting guide](http://learn.getgrav.org/troubleshooting/page-not-found). ### Find out all about Grav @@ -16,6 +16,8 @@ Congratulations! You have installed the **Base Grav Package** that provides a ** * Download **plugins**, **themes**, as well as other Grav **skeleton** packages from the [Grav Downloads](http://getgrav.org/downloads) page. * Check out our [Grav Development Blog](http://getgrav.org/blog) to find out the latest goings on in the Grav-verse. +!!! If you want a more **full-featured** base install, you should check out [**Skeleton** packages available in the downloads](http://getgrav.org/downloads). + ### Edit this Page To edit this page, simply navigate to the folder you installed **Grav** into, and then browse to the `user/pages/01.home` folder and open the `default.md` file in your [editor of choice](http://learn.getgrav.org/basics/requirements). You will see the content of this page in [Markdown format](http://learn.getgrav.org/content/markdown). @@ -24,7 +26,7 @@ To edit this page, simply navigate to the folder you installed **Grav** into, an Creating a new page is a simple affair in **Grav**. Simply follow these simple steps: -1. Navigate to your pages folder: `user/pages/` and create a new folder. In this example, we will use [explicit default ordering](http://learn.getgrav.org/content/content-pages) and call the folder `02.mypage`. +1. Navigate to your pages folder: `user/pages/` and create a new folder. In this example, we will use [explicit default ordering](http://learn.getgrav.org/content/content-pages) and call the folder `03.mypage`. 2. Launch your text editor and paste in the following sample code: --- @@ -34,7 +36,7 @@ Creating a new page is a simple affair in **Grav**. Simply follow these simple This is the body of **my new page** and I can easily use _Markdown_ syntax here. -3. Save this file in the `user/pages/02.mypage/` folder as `default.md`. This will tell **Grav** to render the page using the **default** template. +3. Save this file in the `user/pages/03.mypage/` folder as `default.md`. This will tell **Grav** to render the page using the **default** template. 4. That is it! Reload your browser to see your new page in the menu. ! NOTE: The page will automatically show up in the Menu after the "Home" menu item. If you wish to change the name that shows up in the Menu, simple add: `menu: My Page` between the dashes in the page content. This is called the YAML front matter, and it is where you configure page-specific options. diff --git a/user/pages/02.typography/default.md b/user/pages/02.typography/default.md new file mode 100644 index 000000000..30a5d1041 --- /dev/null +++ b/user/pages/02.typography/default.md @@ -0,0 +1,155 @@ +--- +title: Typography +--- + +! Details on the full capabiltiies of Spectre.css can be found in the [Official Spectre Documentation](https://picturepan2.github.io/spectre/elements.html) + +The [Quark theme](https://github.com/getgrav/grav-theme-quark) is the new default theme for Grav built with [Spectre.css](https://picturepan2.github.io/spectre/) the lightweight, responsive and modern CSS framework. Spectre provides basic styles for typography, elements, and a responsive layout system that utilizes best practices and consistent language design. + +### Headings + +# H1 Heading `40px` + +## H2 Heading `32px` + +### H3 Heading `28px` + +#### H4 Heading `24px` + +##### H5 Heading `20px` + +###### H6 Heading `16px` + +```html +# H1 Heading +# H1 Heading `40px`` + +H1 Heading +``` + +### Paragraphs + +Lorem ipsum dolor sit amet, consectetur [adipiscing elit. Praesent risus leo, dictum in vehicula sit amet](#), feugiat tempus tellus. Duis quis sodales risus. Etiam euismod ornare consequat. + +Climb leg rub face on everything give attitude nap all day for under the bed. Chase mice attack feet but rub face on everything hopped up on goofballs. + +### Markdown Semantic Text Elements + +**Bold** `**Bold**` + +_Italic_ `_Italic_` + +~~Deleted~~ `~~Deleted~~` + +`Inline Code` `` `Inline Code` `` + +### HTML Semantic Text Elements + +I18N `` + +Citation `` + +Ctrl + S `` + +TextSuperscripted `` + +TextSubscxripted `` + +Underlined `` + +Highlighted `` + + `