diff --git a/lib/pico.php b/lib/pico.php index d8215f2..4e20f04 100644 --- a/lib/pico.php +++ b/lib/pico.php @@ -251,7 +251,7 @@ class Pico 'url' => $url, 'date_formatted' => isset($page_meta['date']) ? date($config['date_format'], strtotime($page_meta['date'])) : null, 'content' => $page_content, - 'excerpt' => $this->limit_words(strip_tags($page_content), $excerpt_length), + 'excerpt' => isset($page_meta['excerpt']) ? $page_meta['excerpt'] : $this->limit_words(strip_tags($page_content), $excerpt_length), 'last_modified' => new DateTime('@' . filemtime($page)) ); $data = array_merge($data, $extras); diff --git a/vendor/autoload.php b/vendor/autoload.php index 2140d4d..c17dcad 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -1,7 +1,7 @@ prefixes; + return call_user_func_array('array_merge', $this->prefixes); } public function getFallbackDirs() @@ -98,19 +98,21 @@ class ClassLoader return; } - if (!isset($this->prefixes[$prefix])) { - $this->prefixes[$prefix] = (array) $paths; + + $first = $prefix[0]; + if (!isset($this->prefixes[$first][$prefix])) { + $this->prefixes[$first][$prefix] = (array) $paths; return; } if ($prepend) { - $this->prefixes[$prefix] = array_merge( + $this->prefixes[$first][$prefix] = array_merge( (array) $paths, - $this->prefixes[$prefix] + $this->prefixes[$first][$prefix] ); } else { - $this->prefixes[$prefix] = array_merge( - $this->prefixes[$prefix], + $this->prefixes[$first][$prefix] = array_merge( + $this->prefixes[$first][$prefix], (array) $paths ); } @@ -119,8 +121,8 @@ class ClassLoader /** * Registers a set of classes, replacing any others previously set. * - * @param string $prefix The classes prefix - * @param array|string $paths The location(s) of the classes + * @param string $prefix The classes prefix + * @param array|string $paths The location(s) of the classes */ public function set($prefix, $paths) { @@ -129,7 +131,7 @@ class ClassLoader return; } - $this->prefixes[$prefix] = (array) $paths; + $this->prefixes[substr($prefix, 0, 1)][$prefix] = (array) $paths; } /** @@ -195,6 +197,7 @@ class ClassLoader */ public function findFile($class) { + // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731 if ('\\' == $class[0]) { $class = substr($class, 1); } @@ -205,7 +208,7 @@ class ClassLoader if (false !== $pos = strrpos($class, '\\')) { // namespaced class name - $classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)) . DIRECTORY_SEPARATOR; + $classPath = strtr(substr($class, 0, $pos), '\\', DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; $className = substr($class, $pos + 1); } else { // PEAR-like class name @@ -213,13 +216,16 @@ class ClassLoader $className = $class; } - $classPath .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; + $classPath .= strtr($className, '_', DIRECTORY_SEPARATOR) . '.php'; - foreach ($this->prefixes as $prefix => $dirs) { - if (0 === strpos($class, $prefix)) { - foreach ($dirs as $dir) { - if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) { - return $dir . DIRECTORY_SEPARATOR . $classPath; + $first = $class[0]; + if (isset($this->prefixes[$first])) { + foreach ($this->prefixes[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) { + return $dir . DIRECTORY_SEPARATOR . $classPath; + } } } } diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index af4ad58..7a91153 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -1,6 +1,6 @@ $vendorDir . '/twig/twig/lib', - 'Michelf' => $vendorDir . '/michelf/php-markdown', + 'Twig_' => array($vendorDir . '/twig/twig/lib'), + 'Michelf' => array($vendorDir . '/michelf/php-markdown'), ); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 7006333..3d2926d 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -1,8 +1,8 @@ $path) { - $loader->add($namespace, $path); + $loader->set($namespace, $path); } $classMap = require __DIR__ . '/autoload_classmap.php'; diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 6a4868b..0b95cb4 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1,55 +1,4 @@ [ - { - "name": "twig/twig", - "version": "v1.13.1", - "version_normalized": "1.13.1.0", - "source": { - "type": "git", - "url": "https://github.com/fabpot/Twig.git", - "reference": "v1.13.1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/fabpot/Twig/zipball/v1.13.1", - "reference": "v1.13.1", - "shasum": "" - }, - "require": { - "php": ">=5.2.4" - }, - "time": "2013-06-06 06:06:01", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.13-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Twig_": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com" - } - ], - "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "http://twig.sensiolabs.org", - "keywords": [ - "templating" - ] - }, { "name": "michelf/php-markdown", "version": "1.3", @@ -102,5 +51,56 @@ "keywords": [ "markdown" ] + }, + { + "name": "twig/twig", + "version": "v1.13.2", + "version_normalized": "1.13.2.0", + "source": { + "type": "git", + "url": "https://github.com/fabpot/Twig.git", + "reference": "6d6a1009427d1f398c9d40904147bf9f723d5755" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fabpot/Twig/zipball/6d6a1009427d1f398c9d40904147bf9f723d5755", + "reference": "6d6a1009427d1f398c9d40904147bf9f723d5755", + "shasum": "" + }, + "require": { + "php": ">=5.2.4" + }, + "time": "2013-08-03 15:35:31", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Twig_": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "http://twig.sensiolabs.org", + "keywords": [ + "templating" + ] } ] diff --git a/vendor/twig/twig/.travis.yml b/vendor/twig/twig/.travis.yml index e6d3b61..8569a39 100644 --- a/vendor/twig/twig/.travis.yml +++ b/vendor/twig/twig/.travis.yml @@ -4,6 +4,7 @@ php: - 5.2 - 5.3 - 5.4 + - 5.5 env: - TWIG_EXT=no diff --git a/vendor/twig/twig/CHANGELOG b/vendor/twig/twig/CHANGELOG index fedfc32..80ff9d2 100644 --- a/vendor/twig/twig/CHANGELOG +++ b/vendor/twig/twig/CHANGELOG @@ -1,3 +1,8 @@ +* 1.13.2 (2013-08-03) + + * fixed the error line number for an error occurs in and embedded template + * fixed crashes of the C extension on some edge cases + * 1.13.1 (2013-06-06) * added the possibility to ignore the filesystem constructor argument in Twig_Loader_Filesystem diff --git a/vendor/twig/twig/composer.json b/vendor/twig/twig/composer.json index 3c5d079..67a08aa 100644 --- a/vendor/twig/twig/composer.json +++ b/vendor/twig/twig/composer.json @@ -4,7 +4,7 @@ "description": "Twig, the flexible, fast, and secure template language for PHP", "keywords": ["templating"], "homepage": "http://twig.sensiolabs.org", - "license": "BSD-3", + "license": "BSD-3-Clause", "authors": [ { "name": "Fabien Potencier", diff --git a/vendor/twig/twig/lib/Twig/Environment.php b/vendor/twig/twig/lib/Twig/Environment.php index 3afa73d..6d4c5c5 100644 --- a/vendor/twig/twig/lib/Twig/Environment.php +++ b/vendor/twig/twig/lib/Twig/Environment.php @@ -16,7 +16,7 @@ */ class Twig_Environment { - const VERSION = '1.13.1'; + const VERSION = '1.13.2'; protected $charset; protected $loader; @@ -728,7 +728,7 @@ class Twig_Environment public function addNodeVisitor(Twig_NodeVisitorInterface $visitor) { if ($this->extensionInitialized) { - throw new LogicException('Unable to add a node visitor as extensions have already been initialized.', $extension->getName()); + throw new LogicException('Unable to add a node visitor as extensions have already been initialized.'); } $this->staging->addNodeVisitor($visitor); diff --git a/vendor/twig/twig/lib/Twig/Error.php b/vendor/twig/twig/lib/Twig/Error.php index 72d91a9..61a4cfa 100644 --- a/vendor/twig/twig/lib/Twig/Error.php +++ b/vendor/twig/twig/lib/Twig/Error.php @@ -186,6 +186,7 @@ class Twig_Error extends Exception protected function guessTemplateInfo() { $template = null; + $templateClass = null; if (version_compare(phpversion(), '5.3.6', '>=')) { $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS | DEBUG_BACKTRACE_PROVIDE_OBJECT); @@ -195,8 +196,11 @@ class Twig_Error extends Exception foreach ($backtrace as $trace) { if (isset($trace['object']) && $trace['object'] instanceof Twig_Template && 'Twig_Template' !== get_class($trace['object'])) { - if (null === $this->filename || $this->filename == $trace['object']->getTemplateName()) { + $currentClass = get_class($trace['object']); + $isEmbedContainer = 0 === strpos($templateClass, $currentClass); + if (null === $this->filename || ($this->filename == $trace['object']->getTemplateName() && !$isEmbedContainer)) { $template = $trace['object']; + $templateClass = get_class($trace['object']); } } } diff --git a/vendor/twig/twig/lib/Twig/Loader/Filesystem.php b/vendor/twig/twig/lib/Twig/Loader/Filesystem.php index f9211cb..d47781a 100644 --- a/vendor/twig/twig/lib/Twig/Loader/Filesystem.php +++ b/vendor/twig/twig/lib/Twig/Loader/Filesystem.php @@ -16,6 +16,9 @@ */ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderInterface { + /** Identifier of the main namespace. */ + const MAIN_NAMESPACE = '__main__'; + protected $paths; protected $cache; @@ -38,7 +41,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI * * @return array The array of paths where to look for templates */ - public function getPaths($namespace = '__main__') + public function getPaths($namespace = self::MAIN_NAMESPACE) { return isset($this->paths[$namespace]) ? $this->paths[$namespace] : array(); } @@ -46,7 +49,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI /** * Returns the path namespaces. * - * The "__main__" namespace is always defined. + * The main namespace is always defined. * * @return array The array of defined namespaces */ @@ -61,7 +64,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI * @param string|array $paths A path or an array of paths where to look for templates * @param string $namespace A path namespace */ - public function setPaths($paths, $namespace = '__main__') + public function setPaths($paths, $namespace = self::MAIN_NAMESPACE) { if (!is_array($paths)) { $paths = array($paths); @@ -81,7 +84,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI * * @throws Twig_Error_Loader */ - public function addPath($path, $namespace = '__main__') + public function addPath($path, $namespace = self::MAIN_NAMESPACE) { // invalidate the cache $this->cache = array(); @@ -101,7 +104,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI * * @throws Twig_Error_Loader */ - public function prependPath($path, $namespace = '__main__') + public function prependPath($path, $namespace = self::MAIN_NAMESPACE) { // invalidate the cache $this->cache = array(); @@ -175,7 +178,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI $this->validateName($name); - $namespace = '__main__'; + $namespace = self::MAIN_NAMESPACE; if (isset($name[0]) && '@' == $name[0]) { if (false === $pos = strpos($name, '/')) { throw new Twig_Error_Loader(sprintf('Malformed namespaced template name "%s" (expecting "@namespace/template_name").', $name)); diff --git a/vendor/twig/twig/lib/Twig/Node/Expression/Call.php b/vendor/twig/twig/lib/Twig/Node/Expression/Call.php index 87b62de..dba9b0e 100644 --- a/vendor/twig/twig/lib/Twig/Node/Expression/Call.php +++ b/vendor/twig/twig/lib/Twig/Node/Expression/Call.php @@ -146,7 +146,7 @@ abstract class Twig_Node_Expression_Call extends Twig_Node_Expression if (array_key_exists($name, $parameters)) { if (array_key_exists($pos, $parameters)) { - throw new Twig_Error_Syntax(sprintf('Arguments "%s" is defined twice for %s "%s".', $name, $this->getAttribute('type'), $this->getAttribute('name'))); + throw new Twig_Error_Syntax(sprintf('Argument "%s" is defined twice for %s "%s".', $name, $this->getAttribute('type'), $this->getAttribute('name'))); } $arguments[] = $parameters[$name]; @@ -164,8 +164,8 @@ abstract class Twig_Node_Expression_Call extends Twig_Node_Expression } } - foreach (array_keys($parameters) as $name) { - throw new Twig_Error_Syntax(sprintf('Unknown argument "%s" for %s "%s".', $name, $this->getAttribute('type'), $this->getAttribute('name'))); + if (!empty($parameters)) { + throw new Twig_Error_Syntax(sprintf('Unknown argument%s "%s" for %s "%s".', count($parameters) > 1 ? 's' : '' , implode('", "', array_keys($parameters)), $this->getAttribute('type'), $this->getAttribute('name'))); } return $arguments;