-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from katzwebservices/develop
Update Twig; version 2.1.3
- Loading branch information
Showing
98 changed files
with
1,084 additions
and
818 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,9 +13,7 @@ | |
namespace Composer\Autoload; | ||
|
||
/** | ||
* ClassLoader implements a PSR-0 class loader | ||
* | ||
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md | ||
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader. | ||
* | ||
* $loader = new \Composer\Autoload\ClassLoader(); | ||
* | ||
|
@@ -39,6 +37,8 @@ | |
* | ||
* @author Fabien Potencier <[email protected]> | ||
* @author Jordi Boggiano <[email protected]> | ||
* @see http://www.php-fig.org/psr/psr-0/ | ||
* @see http://www.php-fig.org/psr/psr-4/ | ||
*/ | ||
class ClassLoader | ||
{ | ||
|
@@ -147,7 +147,7 @@ public function add($prefix, $paths, $prepend = false) | |
* appending or prepending to the ones previously set for this namespace. | ||
* | ||
* @param string $prefix The prefix/namespace, with trailing '\\' | ||
* @param array|string $paths The PSR-0 base directories | ||
* @param array|string $paths The PSR-4 base directories | ||
* @param bool $prepend Whether to prepend the directories | ||
* | ||
* @throws \InvalidArgumentException | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
Copyright (c) 2015 Nils Adermann, Jordi Boggiano | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is furnished | ||
to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
Copyright (c) 2009-2014 by the Twig Team. | ||
Copyright (c) 2009-2016 by the Twig Team. | ||
|
||
Some rights reserved. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ | |
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "1.21-dev" | ||
"dev-master": "1.24-dev" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,14 +9,14 @@ | |
* file that was distributed with this source code. | ||
*/ | ||
|
||
@trigger_error('The Twig_Autoloader class is deprecated and will be removed in 2.0. Use Composer instead.', E_USER_DEPRECATED); | ||
@trigger_error('The Twig_Autoloader class is deprecated since version 1.21 and will be removed in 2.0. Use Composer instead.', E_USER_DEPRECATED); | ||
|
||
/** | ||
* Autoloads Twig classes. | ||
* | ||
* @author Fabien Potencier <[email protected]> | ||
* | ||
* @deprecated Use Composer instead. Will be removed in Twig 2.0. | ||
* @deprecated since 1.21 and will be removed in 2.0. Use Composer instead. 2.0. | ||
*/ | ||
class Twig_Autoloader | ||
{ | ||
|
@@ -27,7 +27,7 @@ class Twig_Autoloader | |
*/ | ||
public static function register($prepend = false) | ||
{ | ||
@trigger_error('Using Twig_Autoloader is deprecated. Use Composer instead.', E_USER_DEPRECATED); | ||
@trigger_error('Using Twig_Autoloader is deprecated since version 1.21. Use Composer instead.', E_USER_DEPRECATED); | ||
|
||
if (PHP_VERSION_ID < 50300) { | ||
spl_autoload_register(array(__CLASS__, 'autoload')); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Twig. | ||
* | ||
* (c) 2015 Fabien Potencier | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/** | ||
* Implements a cache on the filesystem. | ||
* | ||
* @author Andrew Tch <[email protected]> | ||
*/ | ||
class Twig_Cache_Filesystem implements Twig_CacheInterface | ||
{ | ||
const FORCE_BYTECODE_INVALIDATION = 1; | ||
|
||
private $directory; | ||
private $options; | ||
|
||
/** | ||
* @param $directory string The root cache directory | ||
* @param $options int A set of options | ||
*/ | ||
public function __construct($directory, $options = 0) | ||
{ | ||
$this->directory = rtrim($directory, '\/').'/'; | ||
$this->options = $options; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function generateKey($name, $className) | ||
{ | ||
$hash = hash('sha256', $className); | ||
|
||
return $this->directory.$hash[0].$hash[1].'/'.$hash.'.php'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function load($key) | ||
{ | ||
@include_once $key; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function write($key, $content) | ||
{ | ||
$dir = dirname($key); | ||
if (!is_dir($dir)) { | ||
if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) { | ||
throw new RuntimeException(sprintf('Unable to create the cache directory (%s).', $dir)); | ||
} | ||
} elseif (!is_writable($dir)) { | ||
throw new RuntimeException(sprintf('Unable to write in the cache directory (%s).', $dir)); | ||
} | ||
|
||
$tmpFile = tempnam($dir, basename($key)); | ||
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $key)) { | ||
@chmod($key, 0666 & ~umask()); | ||
|
||
if (self::FORCE_BYTECODE_INVALIDATION == ($this->options & self::FORCE_BYTECODE_INVALIDATION)) { | ||
// Compile cached file into bytecode cache | ||
if (function_exists('opcache_invalidate')) { | ||
opcache_invalidate($key, true); | ||
} elseif (function_exists('apc_compile_file')) { | ||
apc_compile_file($key); | ||
} | ||
} | ||
|
||
return; | ||
} | ||
|
||
throw new RuntimeException(sprintf('Failed to write cache file "%s".', $key)); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getTimestamp($key) | ||
{ | ||
if (!file_exists($key)) { | ||
return 0; | ||
} | ||
|
||
return (int) @filemtime($key); | ||
} | ||
} |
Oops, something went wrong.