BryanDavis has uploaded a new change for review.
https://gerrit.wikimedia.org/r/178075
Change subject: Update slim to 2.4.3
......................................................................
Update slim to 2.4.3
Change-Id: I946f379947a96d7bdb8f8760022f5d3bc0506f31
---
M composer.json
M composer.lock
M vendor/autoload.php
M vendor/composer/autoload_real.php
M vendor/composer/installed.json
A vendor/slim/slim/.gitignore
M vendor/slim/slim/.travis.yml
M vendor/slim/slim/README.markdown
M vendor/slim/slim/Slim/Environment.php
M vendor/slim/slim/Slim/Exception/Pass.php
M vendor/slim/slim/Slim/Exception/Stop.php
M vendor/slim/slim/Slim/Helper/Set.php
M vendor/slim/slim/Slim/Http/Cookies.php
M vendor/slim/slim/Slim/Http/Headers.php
M vendor/slim/slim/Slim/Http/Request.php
M vendor/slim/slim/Slim/Http/Response.php
M vendor/slim/slim/Slim/Http/Util.php
M vendor/slim/slim/Slim/Log.php
M vendor/slim/slim/Slim/LogWriter.php
M vendor/slim/slim/Slim/Middleware.php
M vendor/slim/slim/Slim/Middleware/ContentTypes.php
M vendor/slim/slim/Slim/Middleware/Flash.php
M vendor/slim/slim/Slim/Middleware/MethodOverride.php
M vendor/slim/slim/Slim/Middleware/PrettyExceptions.php
M vendor/slim/slim/Slim/Middleware/SessionCookie.php
M vendor/slim/slim/Slim/Route.php
M vendor/slim/slim/Slim/Router.php
M vendor/slim/slim/Slim/Slim.php
M vendor/slim/slim/Slim/View.php
M vendor/slim/slim/composer.json
M vendor/slim/slim/tests/EnvironmentTest.php
M vendor/slim/slim/tests/Helper/SetTest.php
M vendor/slim/slim/tests/Http/CookiesTest.php
M vendor/slim/slim/tests/Http/HeadersTest.php
M vendor/slim/slim/tests/Http/RequestTest.php
M vendor/slim/slim/tests/Http/ResponseTest.php
M vendor/slim/slim/tests/Http/UtilTest.php
M vendor/slim/slim/tests/LogTest.php
M vendor/slim/slim/tests/LogWriterTest.php
M vendor/slim/slim/tests/Middleware/ContentTypesTest.php
M vendor/slim/slim/tests/Middleware/FlashTest.php
M vendor/slim/slim/tests/Middleware/MethodOverrideTest.php
M vendor/slim/slim/tests/Middleware/PrettyExceptionsTest.php
M vendor/slim/slim/tests/Middleware/SessionCookieTest.php
M vendor/slim/slim/tests/MiddlewareTest.php
M vendor/slim/slim/tests/RouteTest.php
M vendor/slim/slim/tests/RouterTest.php
M vendor/slim/slim/tests/SlimTest.php
M vendor/slim/slim/tests/ViewTest.php
M vendor/slim/slim/tests/bootstrap.php
M vendor/slim/views/Slim/Views/README.md
M vendor/slim/views/Slim/Views/Smarty.php
M vendor/slim/views/Slim/Views/SmartyPlugins/function.baseUrl.php
M vendor/slim/views/Slim/Views/SmartyPlugins/function.siteUrl.php
M vendor/slim/views/Slim/Views/SmartyPlugins/function.urlFor.php
M vendor/slim/views/Slim/Views/Twig.php
M vendor/slim/views/Slim/Views/TwigExtension.php
M vendor/slim/views/Slim/Views/composer.json
58 files changed, 610 insertions(+), 282 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/wikimania-scholarships
refs/changes/75/178075/1
diff --git a/composer.json b/composer.json
index 9f36002..0f1695c 100644
--- a/composer.json
+++ b/composer.json
@@ -3,8 +3,8 @@
"require": {
"php": ">=5.3.7",
"twig/twig": "v1.14.1",
- "slim/slim": "2.3.5",
- "slim/views": "0.1.0",
+ "slim/slim": "2.4.3",
+ "slim/views": "0.1.2",
"monolog/monolog": "1.11.0",
"phpmailer/phpmailer": "v5.2.9"
},
diff --git a/composer.lock b/composer.lock
index 611fe4a..a85d86a 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at
http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "hash": "b8d085c65b0c57fbf71cfc87e779cd04",
+ "hash": "13335cc73996f538391142b4d1f94df7",
"packages": [
{
"name": "monolog/monolog",
@@ -171,21 +171,23 @@
},
{
"name": "slim/slim",
- "version": "2.3.5",
+ "version": "2.4.3",
"source": {
"type": "git",
"url": "https://github.com/codeguy/Slim.git",
- "reference": "3dec4f9ee2e9c204a9f334afd72abc174c1b792e"
+ "reference": "4906b77a07c7bd6ff1a99aea903e940a2d4fa106"
},
"dist": {
"type": "zip",
- "url":
"https://api.github.com/repos/codeguy/Slim/zipball/3dec4f9ee2e9c204a9f334afd72abc174c1b792e",
- "reference": "3dec4f9ee2e9c204a9f334afd72abc174c1b792e",
+ "url":
"https://api.github.com/repos/codeguy/Slim/zipball/4906b77a07c7bd6ff1a99aea903e940a2d4fa106",
+ "reference": "4906b77a07c7bd6ff1a99aea903e940a2d4fa106",
"shasum": ""
},
"require": {
- "ext-mcrypt": "*",
"php": ">=5.3.0"
+ },
+ "suggest": {
+ "ext-mcrypt": "Required for HTTP cookie encryption"
},
"type": "library",
"autoload": {
@@ -211,26 +213,30 @@
"rest",
"router"
],
- "time": "2013-10-31 02:05:09"
+ "time": "2014-04-05 18:33:59"
},
{
"name": "slim/views",
- "version": "0.1.0",
+ "version": "0.1.2",
"target-dir": "Slim/Views",
"source": {
"type": "git",
"url": "https://github.com/codeguy/Slim-Views.git",
- "reference": "d5eca1c0932aadf7255d83f3ed02ffc07c3c8297"
+ "reference": "f0a05ea0b654218e40de692ed7cddcad1cf4b828"
},
"dist": {
"type": "zip",
- "url":
"https://api.github.com/repos/codeguy/Slim-Views/zipball/d5eca1c0932aadf7255d83f3ed02ffc07c3c8297",
- "reference": "d5eca1c0932aadf7255d83f3ed02ffc07c3c8297",
+ "url":
"https://api.github.com/repos/codeguy/Slim-Views/zipball/f0a05ea0b654218e40de692ed7cddcad1cf4b828",
+ "reference": "f0a05ea0b654218e40de692ed7cddcad1cf4b828",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
- "slim/slim": ">=2.0.0"
+ "slim/slim": ">=2.4.0"
+ },
+ "suggest": {
+ "smarty/smarty": "Smarty templating system",
+ "twig/twig": "Twig templating system"
},
"type": "library",
"autoload": {
@@ -246,7 +252,7 @@
{
"name": "Andrew Smith",
"email": "[email protected]",
- "homepage": "http://thoughts.silentworks.co.uk/"
+ "homepage": "http://www.silentworks.co.uk/"
},
{
"name": "Josh Lockhart",
@@ -254,14 +260,14 @@
"homepage": "http://www.joshlockhart.com/"
}
],
- "description": "Twig View Parser package for the Slim Framework",
+ "description": "Smarty and Twig View Parser package for the Slim
Framework",
"homepage": "http://github.com/codeguy/Slim-Views",
"keywords": [
"extensions",
"slimphp",
"templating"
],
- "time": "2013-07-10 07:34:17"
+ "time": "2014-04-03 16:31:10"
},
{
"name": "twig/twig",
diff --git a/vendor/autoload.php b/vendor/autoload.php
index 198364e..e991184 100644
--- a/vendor/autoload.php
+++ b/vendor/autoload.php
@@ -4,4 +4,4 @@
require_once __DIR__ . '/composer' . '/autoload_real.php';
-return ComposerAutoloaderInit8cd07465d313f95367bd11ed3643ca9f::getLoader();
+return ComposerAutoloaderInite2fa2568f3ed1f1d66dfd309b39b1148::getLoader();
diff --git a/vendor/composer/autoload_real.php
b/vendor/composer/autoload_real.php
index 83ac695..f81287f 100644
--- a/vendor/composer/autoload_real.php
+++ b/vendor/composer/autoload_real.php
@@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
-class ComposerAutoloaderInit8cd07465d313f95367bd11ed3643ca9f
+class ComposerAutoloaderInite2fa2568f3ed1f1d66dfd309b39b1148
{
private static $loader;
@@ -19,9 +19,9 @@
return self::$loader;
}
-
spl_autoload_register(array('ComposerAutoloaderInit8cd07465d313f95367bd11ed3643ca9f',
'loadClassLoader'), true, true);
+
spl_autoload_register(array('ComposerAutoloaderInite2fa2568f3ed1f1d66dfd309b39b1148',
'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
-
spl_autoload_unregister(array('ComposerAutoloaderInit8cd07465d313f95367bd11ed3643ca9f',
'loadClassLoader'));
+
spl_autoload_unregister(array('ComposerAutoloaderInite2fa2568f3ed1f1d66dfd309b39b1148',
'loadClassLoader'));
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
@@ -44,7 +44,7 @@
}
}
-function composerRequire8cd07465d313f95367bd11ed3643ca9f($file)
+function composerRequiree2fa2568f3ed1f1d66dfd309b39b1148($file)
{
require $file;
}
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index 08d7886..d89695b 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -51,104 +51,6 @@
]
},
{
- "name": "slim/slim",
- "version": "2.3.5",
- "version_normalized": "2.3.5.0",
- "source": {
- "type": "git",
- "url": "https://github.com/codeguy/Slim.git",
- "reference": "3dec4f9ee2e9c204a9f334afd72abc174c1b792e"
- },
- "dist": {
- "type": "zip",
- "url":
"https://api.github.com/repos/codeguy/Slim/zipball/3dec4f9ee2e9c204a9f334afd72abc174c1b792e",
- "reference": "3dec4f9ee2e9c204a9f334afd72abc174c1b792e",
- "shasum": ""
- },
- "require": {
- "ext-mcrypt": "*",
- "php": ">=5.3.0"
- },
- "time": "2013-10-31 02:05:09",
- "type": "library",
- "installation-source": "dist",
- "autoload": {
- "psr-0": {
- "Slim": "."
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Josh Lockhart",
- "email": "[email protected]",
- "homepage": "http://www.joshlockhart.com/"
- }
- ],
- "description": "Slim Framework, a PHP micro framework",
- "homepage": "http://github.com/codeguy/Slim",
- "keywords": [
- "microframework",
- "rest",
- "router"
- ]
- },
- {
- "name": "slim/views",
- "version": "0.1.0",
- "version_normalized": "0.1.0.0",
- "target-dir": "Slim/Views",
- "source": {
- "type": "git",
- "url": "https://github.com/codeguy/Slim-Views.git",
- "reference": "d5eca1c0932aadf7255d83f3ed02ffc07c3c8297"
- },
- "dist": {
- "type": "zip",
- "url":
"https://api.github.com/repos/codeguy/Slim-Views/zipball/d5eca1c0932aadf7255d83f3ed02ffc07c3c8297",
- "reference": "d5eca1c0932aadf7255d83f3ed02ffc07c3c8297",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.0",
- "slim/slim": ">=2.0.0"
- },
- "time": "2013-07-10 07:34:17",
- "type": "library",
- "installation-source": "dist",
- "autoload": {
- "psr-0": {
- "Slim\\Views": ""
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Andrew Smith",
- "email": "[email protected]",
- "homepage": "http://thoughts.silentworks.co.uk/"
- },
- {
- "name": "Josh Lockhart",
- "email": "[email protected]",
- "homepage": "http://www.joshlockhart.com/"
- }
- ],
- "description": "Twig View Parser package for the Slim Framework",
- "homepage": "http://github.com/codeguy/Slim-Views",
- "keywords": [
- "extensions",
- "slimphp",
- "templating"
- ]
- },
- {
"name": "psr/log",
"version": "1.0.0",
"version_normalized": "1.0.0.0",
@@ -316,5 +218,109 @@
}
],
"description": "PHPMailer is a full-featured email creation and
transfer class for PHP"
+ },
+ {
+ "name": "slim/slim",
+ "version": "2.4.3",
+ "version_normalized": "2.4.3.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/codeguy/Slim.git",
+ "reference": "4906b77a07c7bd6ff1a99aea903e940a2d4fa106"
+ },
+ "dist": {
+ "type": "zip",
+ "url":
"https://api.github.com/repos/codeguy/Slim/zipball/4906b77a07c7bd6ff1a99aea903e940a2d4fa106",
+ "reference": "4906b77a07c7bd6ff1a99aea903e940a2d4fa106",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "suggest": {
+ "ext-mcrypt": "Required for HTTP cookie encryption"
+ },
+ "time": "2014-04-05 18:33:59",
+ "type": "library",
+ "installation-source": "dist",
+ "autoload": {
+ "psr-0": {
+ "Slim": "."
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Josh Lockhart",
+ "email": "[email protected]",
+ "homepage": "http://www.joshlockhart.com/"
+ }
+ ],
+ "description": "Slim Framework, a PHP micro framework",
+ "homepage": "http://github.com/codeguy/Slim",
+ "keywords": [
+ "microframework",
+ "rest",
+ "router"
+ ]
+ },
+ {
+ "name": "slim/views",
+ "version": "0.1.2",
+ "version_normalized": "0.1.2.0",
+ "target-dir": "Slim/Views",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/codeguy/Slim-Views.git",
+ "reference": "f0a05ea0b654218e40de692ed7cddcad1cf4b828"
+ },
+ "dist": {
+ "type": "zip",
+ "url":
"https://api.github.com/repos/codeguy/Slim-Views/zipball/f0a05ea0b654218e40de692ed7cddcad1cf4b828",
+ "reference": "f0a05ea0b654218e40de692ed7cddcad1cf4b828",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0",
+ "slim/slim": ">=2.4.0"
+ },
+ "suggest": {
+ "smarty/smarty": "Smarty templating system",
+ "twig/twig": "Twig templating system"
+ },
+ "time": "2014-04-03 16:31:10",
+ "type": "library",
+ "installation-source": "dist",
+ "autoload": {
+ "psr-0": {
+ "Slim\\Views": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Andrew Smith",
+ "email": "[email protected]",
+ "homepage": "http://www.silentworks.co.uk/"
+ },
+ {
+ "name": "Josh Lockhart",
+ "email": "[email protected]",
+ "homepage": "http://www.joshlockhart.com/"
+ }
+ ],
+ "description": "Smarty and Twig View Parser package for the Slim
Framework",
+ "homepage": "http://github.com/codeguy/Slim-Views",
+ "keywords": [
+ "extensions",
+ "slimphp",
+ "templating"
+ ]
}
]
diff --git a/vendor/slim/slim/.gitignore b/vendor/slim/slim/.gitignore
new file mode 100644
index 0000000..485dee6
--- /dev/null
+++ b/vendor/slim/slim/.gitignore
@@ -0,0 +1 @@
+.idea
diff --git a/vendor/slim/slim/.travis.yml b/vendor/slim/slim/.travis.yml
index e5f88b3..9cb62f1 100644
--- a/vendor/slim/slim/.travis.yml
+++ b/vendor/slim/slim/.travis.yml
@@ -3,5 +3,7 @@
php:
- 5.3
- 5.4
+ - 5.5
+ - hhvm
script: phpunit --coverage-text
diff --git a/vendor/slim/slim/README.markdown b/vendor/slim/slim/README.markdown
index 802624b..8e4fbe8 100644
--- a/vendor/slim/slim/README.markdown
+++ b/vendor/slim/slim/README.markdown
@@ -63,6 +63,10 @@
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
+Additionally, make sure your virtual host is configured with the AllowOverride
option so that the .htaccess rewrite rules can be used:
+
+ AllowOverride All
+
#### Nginx
The nginx configuration file should contain this code (along with other
settings you may need) in your `location` block:
diff --git a/vendor/slim/slim/Slim/Environment.php
b/vendor/slim/slim/Slim/Environment.php
index d0f3f0e..a15e1e4 100644
--- a/vendor/slim/slim/Slim/Environment.php
+++ b/vendor/slim/slim/Slim/Environment.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
diff --git a/vendor/slim/slim/Slim/Exception/Pass.php
b/vendor/slim/slim/Slim/Exception/Pass.php
index b7fe1ee..99d95c2 100644
--- a/vendor/slim/slim/Slim/Exception/Pass.php
+++ b/vendor/slim/slim/Slim/Exception/Pass.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
diff --git a/vendor/slim/slim/Slim/Exception/Stop.php
b/vendor/slim/slim/Slim/Exception/Stop.php
index da03033..a251851 100644
--- a/vendor/slim/slim/Slim/Exception/Stop.php
+++ b/vendor/slim/slim/Slim/Exception/Stop.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
diff --git a/vendor/slim/slim/Slim/Helper/Set.php
b/vendor/slim/slim/Slim/Helper/Set.php
index e447938..9538b69 100644
--- a/vendor/slim/slim/Slim/Helper/Set.php
+++ b/vendor/slim/slim/Slim/Helper/Set.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
diff --git a/vendor/slim/slim/Slim/Http/Cookies.php
b/vendor/slim/slim/Slim/Http/Cookies.php
index f00a2b6..cf13801 100644
--- a/vendor/slim/slim/Slim/Http/Cookies.php
+++ b/vendor/slim/slim/Slim/Http/Cookies.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
diff --git a/vendor/slim/slim/Slim/Http/Headers.php
b/vendor/slim/slim/Slim/Http/Headers.php
index dc37a08..1704b80 100644
--- a/vendor/slim/slim/Slim/Http/Headers.php
+++ b/vendor/slim/slim/Slim/Http/Headers.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
@@ -72,7 +72,7 @@
foreach ($data as $key => $value) {
$key = strtoupper($key);
if (strpos($key, 'X_') === 0 || strpos($key, 'HTTP_') === 0 ||
in_array($key, static::$special)) {
- if ($key === 'HTTP_CONTENT_TYPE' || $key ===
'HTTP_CONTENT_LENGTH') {
+ if ($key === 'HTTP_CONTENT_LENGTH') {
continue;
}
$results[$key] = $value;
diff --git a/vendor/slim/slim/Slim/Http/Request.php
b/vendor/slim/slim/Slim/Http/Request.php
index ff8703f..735484b 100644
--- a/vendor/slim/slim/Slim/Http/Request.php
+++ b/vendor/slim/slim/Slim/Http/Request.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
@@ -187,16 +187,18 @@
* Fetch GET and POST data
*
* This method returns a union of GET and POST data as a key-value array,
or the value
- * of the array key if requested; if the array key does not exist, NULL is
returned.
+ * of the array key if requested; if the array key does not exist, NULL is
returned,
+ * unless there is a default value specified.
*
* @param string $key
+ * @param mixed $default
* @return array|mixed|null
*/
- public function params($key = null)
+ public function params($key = null, $default = null)
{
$union = array_merge($this->get(), $this->post());
if ($key) {
- return isset($union[$key]) ? $union[$key] : null;
+ return isset($union[$key]) ? $union[$key] : $default;
}
return $union;
@@ -209,9 +211,10 @@
* the value of the array key if requested; if the array key does not
exist, NULL is returned.
*
* @param string $key
+ * @param mixed $default Default return value when key does
not exist
* @return array|mixed|null
*/
- public function get($key = null)
+ public function get($key = null, $default = null)
{
if (!isset($this->env['slim.request.query_hash'])) {
$output = array();
@@ -226,7 +229,7 @@
if (isset($this->env['slim.request.query_hash'][$key])) {
return $this->env['slim.request.query_hash'][$key];
} else {
- return null;
+ return $default;
}
} else {
return $this->env['slim.request.query_hash'];
@@ -240,10 +243,11 @@
* the value of a hash key if requested; if the array key does not exist,
NULL is returned.
*
* @param string $key
+ * @param mixed $default Default return value when key does
not exist
* @return array|mixed|null
* @throws \RuntimeException If environment input is not available
*/
- public function post($key = null)
+ public function post($key = null, $default = null)
{
if (!isset($this->env['slim.input'])) {
throw new \RuntimeException('Missing slim.input in environment
variables');
@@ -266,7 +270,7 @@
if (isset($this->env['slim.request.form_hash'][$key])) {
return $this->env['slim.request.form_hash'][$key];
} else {
- return null;
+ return $default;
}
} else {
return $this->env['slim.request.form_hash'];
@@ -276,31 +280,34 @@
/**
* Fetch PUT data (alias for \Slim\Http\Request::post)
* @param string $key
+ * @param mixed $default Default return value when key does
not exist
* @return array|mixed|null
*/
- public function put($key = null)
+ public function put($key = null, $default = null)
{
- return $this->post($key);
+ return $this->post($key, $default);
}
/**
* Fetch PATCH data (alias for \Slim\Http\Request::post)
* @param string $key
+ * @param mixed $default Default return value when key does
not exist
* @return array|mixed|null
*/
- public function patch($key = null)
+ public function patch($key = null, $default = null)
{
- return $this->post($key);
+ return $this->post($key, $default);
}
/**
* Fetch DELETE data (alias for \Slim\Http\Request::post)
* @param string $key
+ * @param mixed $default Default return value when key does
not exist
* @return array|mixed|null
*/
- public function delete($key = null)
+ public function delete($key = null, $default = null)
{
- return $this->post($key);
+ return $this->post($key, $default);
}
/**
@@ -571,10 +578,11 @@
*/
public function getIp()
{
- if (isset($this->env['X_FORWARDED_FOR'])) {
- return $this->env['X_FORWARDED_FOR'];
- } elseif (isset($this->env['CLIENT_IP'])) {
- return $this->env['CLIENT_IP'];
+ $keys = array('X_FORWARDED_FOR', 'HTTP_X_FORWARDED_FOR', 'CLIENT_IP',
'REMOTE_ADDR');
+ foreach ($keys as $key) {
+ if (isset($this->env[$key])) {
+ return $this->env[$key];
+ }
}
return $this->env['REMOTE_ADDR'];
diff --git a/vendor/slim/slim/Slim/Http/Response.php
b/vendor/slim/slim/Slim/Http/Response.php
index c7a6499..c55d647 100644
--- a/vendor/slim/slim/Slim/Http/Response.php
+++ b/vendor/slim/slim/Slim/Http/Response.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
@@ -113,6 +113,7 @@
415 => '415 Unsupported Media Type',
416 => '416 Requested Range Not Satisfiable',
417 => '417 Expectation Failed',
+ 418 => '418 I\'m a teapot',
422 => '422 Unprocessable Entity',
423 => '423 Locked',
//Server Error 5xx
diff --git a/vendor/slim/slim/Slim/Http/Util.php
b/vendor/slim/slim/Slim/Http/Util.php
index e7cf698..dafedb3 100644
--- a/vendor/slim/slim/Slim/Http/Util.php
+++ b/vendor/slim/slim/Slim/Http/Util.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
@@ -224,7 +224,7 @@
*/
public static function encodeSecureCookie($value, $expires, $secret,
$algorithm, $mode)
{
- $key = hash_hmac('sha1', $expires, $secret);
+ $key = hash_hmac('sha1', (string) $expires, $secret);
$iv = self::getIv($expires, $secret);
$secureString = base64_encode(
self::encrypt(
@@ -401,7 +401,7 @@
$header = rtrim($header, "\r\n");
$headerPieces = preg_split('@\s*[;,]\s*@', $header);
foreach ($headerPieces as $c) {
- $cParts = explode('=', $c);
+ $cParts = explode('=', $c, 2);
if (count($cParts) === 2) {
$key = urldecode($cParts[0]);
$value = urldecode($cParts[1]);
diff --git a/vendor/slim/slim/Slim/Log.php b/vendor/slim/slim/Slim/Log.php
index 824a40d..d872e87 100644
--- a/vendor/slim/slim/Slim/Log.php
+++ b/vendor/slim/slim/Slim/Log.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
diff --git a/vendor/slim/slim/Slim/LogWriter.php
b/vendor/slim/slim/Slim/LogWriter.php
index e3d91b0..5e44e2f 100644
--- a/vendor/slim/slim/Slim/LogWriter.php
+++ b/vendor/slim/slim/Slim/LogWriter.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
diff --git a/vendor/slim/slim/Slim/Middleware.php
b/vendor/slim/slim/Slim/Middleware.php
index f316b17..be23100 100644
--- a/vendor/slim/slim/Slim/Middleware.php
+++ b/vendor/slim/slim/Slim/Middleware.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
diff --git a/vendor/slim/slim/Slim/Middleware/ContentTypes.php
b/vendor/slim/slim/Slim/Middleware/ContentTypes.php
index 3e024ee..08049db 100644
--- a/vendor/slim/slim/Slim/Middleware/ContentTypes.php
+++ b/vendor/slim/slim/Slim/Middleware/ContentTypes.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
diff --git a/vendor/slim/slim/Slim/Middleware/Flash.php
b/vendor/slim/slim/Slim/Middleware/Flash.php
index 835ca01..96f685e 100644
--- a/vendor/slim/slim/Slim/Middleware/Flash.php
+++ b/vendor/slim/slim/Slim/Middleware/Flash.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
diff --git a/vendor/slim/slim/Slim/Middleware/MethodOverride.php
b/vendor/slim/slim/Slim/Middleware/MethodOverride.php
index 3b4c909..7fa3bb0 100644
--- a/vendor/slim/slim/Slim/Middleware/MethodOverride.php
+++ b/vendor/slim/slim/Slim/Middleware/MethodOverride.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
diff --git a/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php
b/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php
index bc2dedd..8a56442 100644
--- a/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php
+++ b/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
@@ -89,7 +89,7 @@
$message = $exception->getMessage();
$file = $exception->getFile();
$line = $exception->getLine();
- $trace = $exception->getTraceAsString();
+ $trace = str_replace(array('#', '\n'), array('<div>#', '</div>'),
$exception->getTraceAsString());
$html = sprintf('<h1>%s</h1>', $title);
$html .= '<p>The application could not run because of the following
error:</p>';
$html .= '<h2>Details</h2>';
diff --git a/vendor/slim/slim/Slim/Middleware/SessionCookie.php
b/vendor/slim/slim/Slim/Middleware/SessionCookie.php
index 22e211b..a467475 100644
--- a/vendor/slim/slim/Slim/Middleware/SessionCookie.php
+++ b/vendor/slim/slim/Slim/Middleware/SessionCookie.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
diff --git a/vendor/slim/slim/Slim/Route.php b/vendor/slim/slim/Slim/Route.php
index 1136035..99b47a1 100644
--- a/vendor/slim/slim/Slim/Route.php
+++ b/vendor/slim/slim/Slim/Route.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
@@ -91,15 +91,22 @@
protected $middleware = array();
/**
- * Constructor
- * @param string $pattern The URL pattern (e.g. "/books/:id")
- * @param mixed $callable Anything that returns TRUE for is_callable()
+ * @var bool Whether or not this route should be matched in a
case-sensitive manner
*/
- public function __construct($pattern, $callable)
+ protected $caseSensitive;
+
+ /**
+ * Constructor
+ * @param string $pattern The URL pattern (e.g. "/books/:id")
+ * @param mixed $callable Anything that returns TRUE for is_callable()
+ * @param bool $caseSensitive Whether or not this route should be matched
in a case-sensitive manner
+ */
+ public function __construct($pattern, $callable, $caseSensitive = true)
{
$this->setPattern($pattern);
$this->setCallable($callable);
$this->setConditions(self::getDefaultConditions());
+ $this->caseSensitive = $caseSensitive;
}
/**
@@ -154,6 +161,19 @@
*/
public function setCallable($callable)
{
+ $matches = array();
+ if (is_string($callable) &&
preg_match('!^([^\:]+)\:([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)$!',
$callable, $matches)) {
+ $class = $matches[1];
+ $method = $matches[2];
+ $callable = function() use ($class, $method) {
+ static $obj = null;
+ if ($obj === null) {
+ $obj = new $class;
+ }
+ return call_user_func_array(array($obj, $method),
func_get_args());
+ };
+ }
+
if (!is_callable($callable)) {
throw new \InvalidArgumentException('Route callable must be
callable');
}
@@ -194,7 +214,7 @@
*/
public function setName($name)
{
- $this->name = (string) $name;
+ $this->name = (string)$name;
}
/**
@@ -217,7 +237,7 @@
/**
* Get route parameter value
- * @param string $index Name of URL parameter
+ * @param string $index Name of URL parameter
* @return string
* @throws \InvalidArgumentException If route parameter does not exist at
index
*/
@@ -232,8 +252,8 @@
/**
* Set route parameter value
- * @param string $index Name of URL parameter
- * @param mixed $value The new parameter value
+ * @param string $index Name of URL parameter
+ * @param mixed $value The new parameter value
* @throws \InvalidArgumentException If route parameter does not exist at
index
*/
public function setParam($index, $value)
@@ -351,19 +371,25 @@
$patternAsRegex = preg_replace_callback(
'#:([\w]+)\+?#',
array($this, 'matchesCallback'),
- str_replace(')', ')?', (string) $this->pattern)
+ str_replace(')', ')?', (string)$this->pattern)
);
if (substr($this->pattern, -1) === '/') {
$patternAsRegex .= '?';
}
+ $regex = '#^' . $patternAsRegex . '$#';
+
+ if ($this->caseSensitive === false) {
+ $regex .= 'i';
+ }
+
//Cache URL params' names and values if this route matches the current
HTTP request
- if (!preg_match('#^' . $patternAsRegex . '$#', $resourceUri,
$paramValues)) {
+ if (!preg_match($regex, $resourceUri, $paramValues)) {
return false;
}
foreach ($this->paramNames as $name) {
if (isset($paramValues[$name])) {
- if (isset($this->paramNamesPath[ $name ])) {
+ if (isset($this->paramNamesPath[$name])) {
$this->params[$name] = explode('/',
urldecode($paramValues[$name]));
} else {
$this->params[$name] = urldecode($paramValues[$name]);
@@ -376,17 +402,17 @@
/**
* Convert a URL parameter (e.g. ":id", ":id+") into a regular expression
- * @param array $m URL parameters
+ * @param array $m URL parameters
* @return string Regular expression for URL parameter
*/
protected function matchesCallback($m)
{
$this->paramNames[] = $m[1];
- if (isset($this->conditions[ $m[1] ])) {
- return '(?P<' . $m[1] . '>' . $this->conditions[ $m[1] ] . ')';
+ if (isset($this->conditions[$m[1]])) {
+ return '(?P<' . $m[1] . '>' . $this->conditions[$m[1]] . ')';
}
if (substr($m[0], -1) === '+') {
- $this->paramNamesPath[ $m[1] ] = 1;
+ $this->paramNamesPath[$m[1]] = 1;
return '(?P<' . $m[1] . '>.+)';
}
@@ -396,7 +422,7 @@
/**
* Set route name
- * @param string $name The name of the route
+ * @param string $name The name of the route
* @return \Slim\Route
*/
public function name($name)
@@ -408,7 +434,7 @@
/**
* Merge route conditions
- * @param array $conditions Key-value array of URL parameter
conditions
+ * @param array $conditions Key-value array of URL parameter conditions
* @return \Slim\Route
*/
public function conditions(array $conditions)
@@ -434,6 +460,6 @@
}
$return = call_user_func_array($this->getCallable(),
array_values($this->getParams()));
- return ($return === false)? false : true;
+ return ($return === false) ? false : true;
}
}
diff --git a/vendor/slim/slim/Slim/Router.php b/vendor/slim/slim/Slim/Router.php
index 3dcc646..b0e7a60 100644
--- a/vendor/slim/slim/Slim/Router.php
+++ b/vendor/slim/slim/Slim/Router.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
diff --git a/vendor/slim/slim/Slim/Slim.php b/vendor/slim/slim/Slim/Slim.php
index 2a68b6c..cb8ef66 100644
--- a/vendor/slim/slim/Slim/Slim.php
+++ b/vendor/slim/slim/Slim/Slim.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
@@ -40,16 +40,21 @@
/**
* Slim
- * @package Slim
- * @author Josh Lockhart
- * @since 1.0.0
+ * @package Slim
+ * @author Josh Lockhart
+ * @since 1.0.0
+ *
+ * @property \Slim\Environment $environment
+ * @property \Slim\Http\Response $response
+ * @property \Slim\Http\Request $request
+ * @property \Slim\Router $router
*/
class Slim
{
/**
* @const string
*/
- const VERSION = '2.3.5';
+ const VERSION = '2.4.2';
/**
* @var \Slim\Helper\Set
@@ -172,8 +177,11 @@
// Default view
$this->container->singleton('view', function ($c) {
$viewClass = $c['settings']['view'];
+ $templatesPath = $c['settings']['templates.path'];
- return ($viewClass instanceOf \Slim\View) ? $viewClass : new
$viewClass;
+ $view = ($viewClass instanceOf \Slim\View) ? $viewClass : new
$viewClass;
+ $view->setTemplatesDirectory($templatesPath);
+ return $view;
});
// Default log writer
@@ -300,7 +308,9 @@
'cookies.cipher' => MCRYPT_RIJNDAEL_256,
'cookies.cipher_mode' => MCRYPT_MODE_CBC,
// HTTP
- 'http.version' => '1.1'
+ 'http.version' => '1.1',
+ // Routing
+ 'routes.case_sensitive' => true
);
}
@@ -325,16 +335,20 @@
*/
public function config($name, $value = null)
{
- if (func_num_args() === 1) {
- if (is_array($name)) {
- $this->settings = array_merge($this->settings, $name);
+ $c = $this->container;
+
+ if (is_array($name)) {
+ if (true === $value) {
+ $c['settings'] = array_merge_recursive($c['settings'], $name);
} else {
- return isset($this->settings[$name]) ? $this->settings[$name]
: null;
+ $c['settings'] = array_merge($c['settings'], $name);
}
+ } elseif (func_num_args() === 1) {
+ return isset($c['settings'][$name]) ? $c['settings'][$name] : null;
} else {
- $settings = $this->settings;
+ $settings = $c['settings'];
$settings[$name] = $value;
- $this->settings = $settings;
+ $c['settings'] = $settings;
}
}
@@ -426,7 +440,7 @@
{
$pattern = array_shift($args);
$callable = array_pop($args);
- $route = new \Slim\Route($pattern, $callable);
+ $route = new \Slim\Route($pattern, $callable,
$this->settings['routes.case_sensitive']);
$this->router->map($route);
if (count($args) > 0) {
$route->setMiddleware($args);
@@ -739,7 +753,6 @@
if (!is_null($status)) {
$this->response->status($status);
}
- $this->view->setTemplatesDirectory($this->config('templates.path'));
$this->view->appendData($data);
$this->view->display($template);
}
@@ -1224,6 +1237,10 @@
*/
public function add(\Slim\Middleware $newMiddleware)
{
+ if(in_array($newMiddleware, $this->middleware)) {
+ $middleware_class = get_class($newMiddleware);
+ throw new \RuntimeException("Circular Middleware setup detected.
Tried to queue the same Middleware instance ({$middleware_class}) twice.");
+ }
$newMiddleware->setApplication($this);
$newMiddleware->setNextMiddleware($this->middleware[0]);
array_unshift($this->middleware, $newMiddleware);
@@ -1282,6 +1299,8 @@
echo $body;
}
+ $this->applyHook('slim.after');
+
restore_error_handler();
}
@@ -1320,7 +1339,6 @@
$this->stop();
} catch (\Slim\Exception\Stop $e) {
$this->response()->write(ob_get_clean());
- $this->applyHook('slim.after');
} catch (\Exception $e) {
if ($this->config('debug')) {
throw $e;
diff --git a/vendor/slim/slim/Slim/View.php b/vendor/slim/slim/Slim/View.php
index c6c435a..1a3973b 100644
--- a/vendor/slim/slim/Slim/View.php
+++ b/vendor/slim/slim/Slim/View.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
* @package Slim
*
* MIT LICENSE
@@ -236,20 +236,23 @@
* This method echoes the rendered template to the current output buffer
*
* @param string $template Pathname of template file relative to
templates directory
+ * @param array $data Any additonal data to be passed to the
template.
*/
- public function display($template)
+ public function display($template, $data = null)
{
- echo $this->fetch($template);
+ echo $this->fetch($template, $data);
}
/**
* Return the contents of a rendered template file
- * @var string $template The template pathname, relative to the
template base directory
- * @return string The rendered template
+ *
+ * @param string $template The template pathname, relative to the
template base directory
+ * @param array $data Any additonal data to be passed to the
template.
+ * @return string The rendered template
*/
- public function fetch($template)
+ public function fetch($template, $data = null)
{
- return $this->render($template);
+ return $this->render($template, $data);
}
/**
@@ -257,17 +260,20 @@
*
* NOTE: This method should be overridden by custom view subclasses
*
- * @var string $template The template pathname, relative to the
template base directory
+ * @param string $template The template pathname, relative to the
template base directory
+ * @param array $data Any additonal data to be passed to the
template.
* @return string The rendered template
* @throws \RuntimeException If resolved template pathname is not a
valid file
*/
- protected function render($template)
+ protected function render($template, $data = null)
{
$templatePathname = $this->getTemplatePathname($template);
if (!is_file($templatePathname)) {
throw new \RuntimeException("View cannot render `$template`
because the template does not exist");
}
- extract($this->data->all());
+
+ $data = array_merge($this->data->all(), (array) $data);
+ extract($data);
ob_start();
require $templatePathname;
diff --git a/vendor/slim/slim/composer.json b/vendor/slim/slim/composer.json
index 656de32..0becfe6 100644
--- a/vendor/slim/slim/composer.json
+++ b/vendor/slim/slim/composer.json
@@ -13,8 +13,10 @@
}
],
"require": {
- "php": ">=5.3.0",
- "ext-mcrypt": "*"
+ "php": ">=5.3.0"
+ },
+ "suggest": {
+ "ext-mcrypt": "Required for HTTP cookie encryption"
},
"autoload": {
"psr-0": { "Slim": "." }
diff --git a/vendor/slim/slim/tests/EnvironmentTest.php
b/vendor/slim/slim/tests/EnvironmentTest.php
index 377098b..b35405c 100644
--- a/vendor/slim/slim/tests/EnvironmentTest.php
+++ b/vendor/slim/slim/tests/EnvironmentTest.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
*
* MIT LICENSE
*
@@ -277,10 +277,8 @@
*/
public function testUnsetsContentTypeAndContentLength()
{
- $_SERVER['HTTP_CONTENT_TYPE'] = 'text/csv';
$_SERVER['HTTP_CONTENT_LENGTH'] = 150;
$env = \Slim\Environment::getInstance(true);
- $this->assertFalse(isset($env['HTTP_CONTENT_TYPE']));
$this->assertFalse(isset($env['HTTP_CONTENT_LENGTH']));
}
diff --git a/vendor/slim/slim/tests/Helper/SetTest.php
b/vendor/slim/slim/tests/Helper/SetTest.php
index 19735ac..236d1f8 100644
--- a/vendor/slim/slim/tests/Helper/SetTest.php
+++ b/vendor/slim/slim/tests/Helper/SetTest.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
*
* MIT LICENSE
*
diff --git a/vendor/slim/slim/tests/Http/CookiesTest.php
b/vendor/slim/slim/tests/Http/CookiesTest.php
index d7d8cb1..232553a 100644
--- a/vendor/slim/slim/tests/Http/CookiesTest.php
+++ b/vendor/slim/slim/tests/Http/CookiesTest.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
*
* MIT LICENSE
*
diff --git a/vendor/slim/slim/tests/Http/HeadersTest.php
b/vendor/slim/slim/tests/Http/HeadersTest.php
index 02903c5..22090f1 100644
--- a/vendor/slim/slim/tests/Http/HeadersTest.php
+++ b/vendor/slim/slim/tests/Http/HeadersTest.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
*
* MIT LICENSE
*
diff --git a/vendor/slim/slim/tests/Http/RequestTest.php
b/vendor/slim/slim/tests/Http/RequestTest.php
index 35af9fc..6d87659 100644
--- a/vendor/slim/slim/tests/Http/RequestTest.php
+++ b/vendor/slim/slim/tests/Http/RequestTest.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
*
* MIT LICENSE
*
@@ -190,6 +190,7 @@
$this->assertEquals(3, count($req->params()));
$this->assertEquals('1', $req->params('one'));
$this->assertNull($req->params('foo'));
+ $this->assertEquals(1, $req->params('foo', 1));
}
/**
@@ -221,6 +222,7 @@
$this->assertEquals(3, count($req->get()));
$this->assertEquals('1', $req->get('one'));
$this->assertNull($req->get('foo'));
+ $this->assertFalse($req->get('foo', false));
}
/**
@@ -236,6 +238,7 @@
$this->assertEquals(3, count($req->get()));
$this->assertEquals('1', $req->get('one'));
$this->assertNull($req->get('foo'));
+ $this->assertFalse($req->get('foo', false));
}
/**
@@ -253,6 +256,7 @@
$this->assertEquals(2, count($req->post()));
$this->assertEquals('bar', $req->post('foo'));
$this->assertNull($req->post('xyz'));
+ $this->assertFalse($req->post('xyz', false));
}
/**
@@ -271,6 +275,7 @@
$this->assertEquals(2, count($req->post()));
$this->assertEquals('bar', $req->post('foo'));
$this->assertNull($req->post('xyz'));
+ $this->assertFalse($req->post('xyz', false));
}
/**
@@ -319,6 +324,7 @@
$this->assertEquals('bar', $req->put('foo'));
$this->assertEquals('bar', $req->params('foo'));
$this->assertNull($req->put('xyz'));
+ $this->assertFalse($req->put('xyz', false));
}
/**
@@ -337,6 +343,7 @@
$this->assertEquals('bar', $req->patch('foo'));
$this->assertEquals('bar', $req->params('foo'));
$this->assertNull($req->patch('xyz'));
+ $this->assertFalse($req->patch('xyz', false));
}
/**
@@ -355,6 +362,7 @@
$this->assertEquals('bar', $req->delete('foo'));
$this->assertEquals('bar', $req->params('foo'));
$this->assertNull($req->delete('xyz'));
+ $this->assertFalse($req->delete('xyz', false));
}
/**
@@ -501,6 +509,19 @@
}
/**
+ * Test get content type for built-in PHP server
+ */
+ public function testGetContentTypeForBuiltInServer()
+ {
+ $env = \Slim\Environment::mock(array(
+ 'slim.input' => '',
+ 'HTTP_CONTENT_TYPE' => 'application/json; charset=ISO-8859-4'
+ ));
+ $req = new \Slim\Http\Request($env);
+ $this->assertEquals('application/json; charset=ISO-8859-4',
$req->getContentType());
+ }
+
+ /**
* Test get content type
*/
public function testGetContentTypeWhenNotExists()
@@ -508,6 +529,19 @@
$env = \Slim\Environment::mock();
$req = new \Slim\Http\Request($env);
$this->assertNull($req->getContentType());
+ }
+
+ /**
+ * Test get content type with built-in server
+ */
+ public function testGetContentTypeWithBuiltInServer()
+ {
+ $env = \Slim\Environment::mock(array(
+ 'slim.input' => '',
+ 'HTTP_CONTENT_TYPE' => 'application/json; charset=ISO-8859-4'
+ ));
+ $req = new \Slim\Http\Request($env);
+ $this->assertEquals('application/json; charset=ISO-8859-4',
$req->getContentType());
}
/**
@@ -846,41 +880,24 @@
/**
* Test get IP
+ * @dataProvider dataTestIp
*/
- public function testGetIp()
+ public function testGetIp(array $server, $expected)
{
- $env = \Slim\Environment::mock(array(
- 'REMOTE_ADDR' => '127.0.0.1'
- ));
+ $env = \Slim\Environment::mock($server);
$req = new \Slim\Http\Request($env);
- $this->assertEquals('127.0.0.1', $req->getIp());
+ $this->assertEquals($expected, $req->getIp());
}
- /**
- * Test get IP with proxy server and Client-Ip header
- */
- public function testGetIpWithClientIp()
+ public function dataTestIp()
{
- $env = \Slim\Environment::mock(array(
- 'REMOTE_ADDR' => '127.0.0.1',
- 'CLIENT_IP' => '127.0.0.2'
- ));
- $req = new \Slim\Http\Request($env);
- $this->assertEquals('127.0.0.2', $req->getIp());
- }
-
- /**
- * Test get IP with proxy server and X-Forwarded-For header
- */
- public function testGetIpWithForwardedFor()
- {
- $env = \Slim\Environment::mock(array(
- 'REMOTE_ADDR' => '127.0.0.1',
- 'CLIENT_IP' => '127.0.0.2',
- 'X_FORWARDED_FOR' => '127.0.0.3'
- ));
- $req = new \Slim\Http\Request($env);
- $this->assertEquals('127.0.0.3', $req->getIp());
+ return array(
+ array(array('REMOTE_ADDR' => '127.0.0.1'), '127.0.0.1'),
+ array(array('REMOTE_ADDR' => '127.0.0.1', 'CLIENT_IP' =>
'127.0.0.2'), '127.0.0.2'),
+ array(array('REMOTE_ADDR' => '127.0.0.1', 'CLIENT_IP' =>
'127.0.0.2', 'X_FORWARDED_FOR' => '127.0.0.3'), '127.0.0.3'),
+ array(array('REMOTE_ADDR' => '127.0.0.1', 'CLIENT_IP' =>
'127.0.0.2', 'HTTP_X_FORWARDED_FOR' => '127.0.0.4'), '127.0.0.4'),
+ array(array('REMOTE_ADDR' => '127.0.0.1', 'CLIENT_IP' =>
'127.0.0.2', 'X_FORWARDED_FOR' => '127.0.0.3', 'HTTP_X_FORWARDED_FOR' =>
'127.0.0.4'), '127.0.0.3'),
+ );
}
/**
diff --git a/vendor/slim/slim/tests/Http/ResponseTest.php
b/vendor/slim/slim/tests/Http/ResponseTest.php
index 0479c6d..d7c07f5 100644
--- a/vendor/slim/slim/tests/Http/ResponseTest.php
+++ b/vendor/slim/slim/tests/Http/ResponseTest.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
*
* MIT LICENSE
*
diff --git a/vendor/slim/slim/tests/Http/UtilTest.php
b/vendor/slim/slim/tests/Http/UtilTest.php
index ae1a4cf..dfe0ea1 100644
--- a/vendor/slim/slim/tests/Http/UtilTest.php
+++ b/vendor/slim/slim/tests/Http/UtilTest.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
*
* MIT LICENSE
*
@@ -413,6 +413,19 @@
$this->assertEquals('blue', $result['colors']);
}
+ /**
+ * Test parses Cookie: HTTP header with `=` in the cookie value
+ */
+ public function testParsesCookieHeaderWithEqualSignInValue()
+ {
+ $header = 'foo=bar; one=two=; colors=blue';
+ $result = \Slim\Http\Util::parseCookieHeader($header);
+ $this->assertEquals(3, count($result));
+ $this->assertEquals('bar', $result['foo']);
+ $this->assertEquals('two=', $result['one']);
+ $this->assertEquals('blue', $result['colors']);
+ }
+
public function testParsesCookieHeaderWithCommaSeparator()
{
$header = 'foo=bar, one=two, colors=blue';
diff --git a/vendor/slim/slim/tests/LogTest.php
b/vendor/slim/slim/tests/LogTest.php
index 6dd0c35..b3ced65 100644
--- a/vendor/slim/slim/tests/LogTest.php
+++ b/vendor/slim/slim/tests/LogTest.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
*
* MIT LICENSE
*
diff --git a/vendor/slim/slim/tests/LogWriterTest.php
b/vendor/slim/slim/tests/LogWriterTest.php
index 46129b0..25c6f29 100644
--- a/vendor/slim/slim/tests/LogWriterTest.php
+++ b/vendor/slim/slim/tests/LogWriterTest.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
*
* MIT LICENSE
*
diff --git a/vendor/slim/slim/tests/Middleware/ContentTypesTest.php
b/vendor/slim/slim/tests/Middleware/ContentTypesTest.php
index c7b0366..9510da4 100644
--- a/vendor/slim/slim/tests/Middleware/ContentTypesTest.php
+++ b/vendor/slim/slim/tests/Middleware/ContentTypesTest.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
*
* MIT LICENSE
*
diff --git a/vendor/slim/slim/tests/Middleware/FlashTest.php
b/vendor/slim/slim/tests/Middleware/FlashTest.php
index 07e592f..d7cde6c 100644
--- a/vendor/slim/slim/tests/Middleware/FlashTest.php
+++ b/vendor/slim/slim/tests/Middleware/FlashTest.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
*
* MIT LICENSE
*
diff --git a/vendor/slim/slim/tests/Middleware/MethodOverrideTest.php
b/vendor/slim/slim/tests/Middleware/MethodOverrideTest.php
index 5acac74..48d00c9 100644
--- a/vendor/slim/slim/tests/Middleware/MethodOverrideTest.php
+++ b/vendor/slim/slim/tests/Middleware/MethodOverrideTest.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
*
* MIT LICENSE
*
diff --git a/vendor/slim/slim/tests/Middleware/PrettyExceptionsTest.php
b/vendor/slim/slim/tests/Middleware/PrettyExceptionsTest.php
index f59285f..3e29655 100644
--- a/vendor/slim/slim/tests/Middleware/PrettyExceptionsTest.php
+++ b/vendor/slim/slim/tests/Middleware/PrettyExceptionsTest.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
*
* MIT LICENSE
*
diff --git a/vendor/slim/slim/tests/Middleware/SessionCookieTest.php
b/vendor/slim/slim/tests/Middleware/SessionCookieTest.php
index 36ae16e..9543ac4 100644
--- a/vendor/slim/slim/tests/Middleware/SessionCookieTest.php
+++ b/vendor/slim/slim/tests/Middleware/SessionCookieTest.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
*
* MIT LICENSE
*
@@ -135,6 +135,7 @@
$logWriter->expects($this->once())
->method('write');
+ $oldLevel = error_reporting(E_ALL);
$app = new \Slim\Slim(array(
'log.writer' => $logWriter
@@ -149,6 +150,8 @@
$mw->setNextMiddleware($app);
$mw->call();
$this->assertEquals(array(), $_SESSION);
+
+ error_reporting($oldLevel);
}
/**
diff --git a/vendor/slim/slim/tests/MiddlewareTest.php
b/vendor/slim/slim/tests/MiddlewareTest.php
index 9439894..27cacc9 100644
--- a/vendor/slim/slim/tests/MiddlewareTest.php
+++ b/vendor/slim/slim/tests/MiddlewareTest.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
*
* MIT LICENSE
*
diff --git a/vendor/slim/slim/tests/RouteTest.php
b/vendor/slim/slim/tests/RouteTest.php
index 0e67d22..b44fa8c 100644
--- a/vendor/slim/slim/tests/RouteTest.php
+++ b/vendor/slim/slim/tests/RouteTest.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
*
* MIT LICENSE
*
@@ -29,6 +29,28 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+
+class LazyInitializeTestClass {
+ public static $initialized = false;
+
+ public function __construct() {
+ self::$initialized = true;
+ }
+
+ public function foo() {
+ }
+}
+
+class FooTestClass {
+ public static $foo_invoked = false;
+ public static $foo_invoked_args = array();
+
+ public function foo() {
+ self::$foo_invoked = true;
+ self::$foo_invoked_args = func_get_args();
+ }
+}
+
class RouteTest extends PHPUnit_Framework_TestCase
{
public function testGetPattern()
@@ -65,6 +87,51 @@
$route = new \Slim\Route('/foo', $callable);
$this->assertSame($callable, $route->getCallable());
+ }
+
+ public function testGetCallableAsClass()
+ {
+ FooTestClass::$foo_invoked = false;
+ FooTestClass::$foo_invoked_args = array();
+ $route = new \Slim\Route('/foo', '\FooTestClass:foo');
+ $route->setParams(array('bar' => '1234'));
+
+ $this->assertFalse(FooTestClass::$foo_invoked);
+ $this->assertTrue($route->dispatch());
+ $this->assertTrue(FooTestClass::$foo_invoked);
+ $this->assertEquals(array('1234'), FooTestClass::$foo_invoked_args);
+ }
+
+ public function testGetCallableAsClassLazyInitialize()
+ {
+ LazyInitializeTestClass::$initialized = false;
+
+ $route = new \Slim\Route('/foo', '\LazyInitializeTestClass:foo');
+ $this->assertFalse(LazyInitializeTestClass::$initialized);
+
+ $route->dispatch();
+ $this->assertTrue(LazyInitializeTestClass::$initialized);
+ }
+
+ public function testGetCallableAsStaticMethod()
+ {
+ $route = new \Slim\Route('/bar', '\Slim\Slim::getInstance');
+
+ $callable = $route->getCallable();
+ $this->assertEquals('\Slim\Slim::getInstance', $callable);
+ }
+
+ public function example_càllâble_wïth_wéird_chars()
+ {
+ return 'test';
+ }
+
+ public function testGetCallableWithOddCharsAsClass()
+ {
+ $route = new \Slim\Route('/foo',
'\RouteTest:example_càllâble_wïth_wéird_chars');
+ $callable = $route->getCallable();
+
+ $this->assertEquals('test', $callable());
}
public function testSetCallable()
@@ -255,6 +322,20 @@
$this->assertEquals(array('year' => '2010', 'month' => '05', 'day' =>
'13'), $route3->getParams());
}
+ public function testMatchesIsCaseSensitiveByDefault()
+ {
+ $route = new \Slim\Route('/case/sensitive', function () {});
+ $this->assertTrue($route->matches('/case/sensitive'));
+ $this->assertFalse($route->matches('/CaSe/SensItiVe'));
+ }
+
+ public function testMatchesCanBeCaseInsensitive()
+ {
+ $route = new \Slim\Route('/Case/Insensitive', function () {}, false);
+ $this->assertTrue($route->matches('/Case/Insensitive'));
+ $this->assertTrue($route->matches('/CaSe/iNSensItiVe'));
+ }
+
public function testGetConditions()
{
$route = new \Slim\Route('/foo', function () {});
diff --git a/vendor/slim/slim/tests/RouterTest.php
b/vendor/slim/slim/tests/RouterTest.php
index ffd2ae3..1ae583f 100644
--- a/vendor/slim/slim/tests/RouterTest.php
+++ b/vendor/slim/slim/tests/RouterTest.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
*
* MIT LICENSE
*
diff --git a/vendor/slim/slim/tests/SlimTest.php
b/vendor/slim/slim/tests/SlimTest.php
index 26f2ec6..a33fa49 100644
--- a/vendor/slim/slim/tests/SlimTest.php
+++ b/vendor/slim/slim/tests/SlimTest.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
*
* MIT LICENSE
*
@@ -33,7 +33,7 @@
//Mock custom view
class CustomView extends \Slim\View
{
- public function render($template) { echo "Custom view"; }
+ public function render($template, $data = null) { echo "Custom view"; }
}
//Echo Logger
@@ -197,6 +197,50 @@
));
$this->assertEquals('./tmpl', $s->config('templates.path'));
$this->assertFalse($s->config('debug'));
+ }
+
+ /**
+ * Test set settings recursively
+ */
+ public function testSetSettingsRecursively()
+ {
+ $config = array(
+ 'my_module' => array(
+ 'paths' => array(
+ './my_module/path/1',
+ ),
+ )
+ );
+
+ $s = new \Slim\Slim($config);
+
+ $override = array(
+ 'my_module' => array(
+ 'paths' => array(
+ './my_module/path/2',
+ './my_module/path/3',
+ ),
+ )
+ );
+
+ // Test recursive batch behaviour
+ $s->config($override, true);
+
+ $expected = array(
+ 'paths' => array(
+ './my_module/path/1',
+ './my_module/path/2',
+ './my_module/path/3',
+ ),
+ );
+
+ $this->assertEquals($expected, $s->config('my_module'));
+
+ // Test default batch behaviour
+ $s = new \Slim\Slim($config);
+ $s->config($override);
+
+ $this->assertNotEquals($expected, $s->config('my_module'));
}
/************************************************
@@ -495,6 +539,22 @@
}
/**
+ * Tests if route will match in case-insensitive manner if configured to
do so
+ */
+ public function testRouteMatchesInCaseInsensitiveMannerIfConfigured()
+ {
+ \Slim\Environment::mock(array(
+ 'PATH_INFO' => '/BaR', // Does not match route case
+ ));
+ $s = new \Slim\Slim(array('routes.case_sensitive' => false));
+ $route = $s->get('/bar', function () { echo "xyz"; });
+ $s->call();
+ $this->assertEquals(200, $s->response()->status());
+ $this->assertEquals('xyz', $s->response()->body());
+ $this->assertEquals('/bar', $route->getPattern());
+ }
+
+ /**
* Test if route contains URL encoded characters
*/
public function testRouteWithUrlEncodedCharacters()
@@ -550,6 +610,16 @@
/************************************************
* RENDERING
************************************************/
+
+ /**
+ * Test template path is passed to view
+ */
+ public function testViewGetsTemplatesPath()
+ {
+ $path = dirname(__FILE__) . '/templates';
+ $s = new \Slim\Slim(array('templates.path' => $path));
+ $this->assertEquals($s->view->getTemplatesDirectory(), $path);
+ }
/**
* Test render with template and data
@@ -735,7 +805,6 @@
'SCRIPT_NAME' => '/foo', //<-- Physical
'PATH_INFO' => '/bar', //<-- Virtual
));
- $expectedDate = gmdate('D, d M Y H:i:s T', strtotime('5 days'));
$s = new \Slim\Slim();
$s->get('/bar', function () use ($s) {
$s->expires('5 days');
@@ -743,7 +812,12 @@
$s->call();
list($status, $header, $body) = $s->response()->finalize();
$this->assertTrue(isset($header['Expires']));
- $this->assertEquals($header['Expires'], $expectedDate);
+
+ $this->assertEquals(
+ strtotime('5 days'),
+ strtotime($header['Expires']),
+ 1 // delta
+ );
}
/**
@@ -1158,6 +1232,25 @@
$this->assertEquals('Hello', $s->response()->header('X-Slim-Test'));
}
+ /**
+ * Test exception when adding circular middleware queues
+ *
+ * This asserts that the same middleware can NOT be queued twice (usually
by accident).
+ * Circular middleware stack causes a troublesome to debug PHP Fatal error:
+ *
+ * > Fatal error: Maximum function nesting level of '100' reached.
aborting!
+ */
+ public function testFailureWhenAddingCircularMiddleware()
+ {
+ $this->setExpectedException('\RuntimeException');
+ $middleware = new CustomMiddleware;
+ $s = new \Slim\Slim;
+ $s->add($middleware);
+ $s->add(new CustomMiddleware);
+ $s->add($middleware);
+ $s->run();
+ }
+
/************************************************
* FLASH MESSAGING
************************************************/
diff --git a/vendor/slim/slim/tests/ViewTest.php
b/vendor/slim/slim/tests/ViewTest.php
index 6f9f2c3..6101807 100644
--- a/vendor/slim/slim/tests/ViewTest.php
+++ b/vendor/slim/slim/tests/ViewTest.php
@@ -6,7 +6,7 @@
* @copyright 2011 Josh Lockhart
* @link http://www.slimframework.com
* @license http://www.slimframework.com/license
- * @version 2.3.5
+ * @version 2.4.2
*
* MIT LICENSE
*
@@ -115,6 +115,21 @@
$this->assertEquals(array('foo' => 'bar'),
$prop->getValue($view)->all());
}
+ public function testLocalData()
+ {
+ $view = new \Slim\View();
+ $prop1 = new \ReflectionProperty($view, 'data');
+ $prop1->setAccessible(true);
+ $prop1->setValue($view, new \Slim\Helper\Set(array('foo' => 'bar')));
+
+ $prop2 = new \ReflectionProperty($view, 'templatesDirectory');
+ $prop2->setAccessible(true);
+ $prop2->setValue($view, dirname(__FILE__) . '/templates');
+
+ $output = $view->fetch('test.php', array('foo' => 'baz'));
+ $this->assertEquals('test output baz', $output);
+ }
+
public function testAppendDataOverwrite()
{
$view = new \Slim\View();
diff --git a/vendor/slim/slim/tests/bootstrap.php
b/vendor/slim/slim/tests/bootstrap.php
index 0705e54..c253350 100644
--- a/vendor/slim/slim/tests/bootstrap.php
+++ b/vendor/slim/slim/tests/bootstrap.php
@@ -1,6 +1,9 @@
<?php
set_include_path(dirname(__FILE__) . '/../' . PATH_SEPARATOR .
get_include_path());
+// Set default timezone
+date_default_timezone_set('America/New_York');
+
require_once 'Slim/Slim.php';
// Register Slim's autoloader
diff --git a/vendor/slim/views/Slim/Views/README.md
b/vendor/slim/views/Slim/Views/README.md
index 59436c5..b0b54ca 100644
--- a/vendor/slim/views/Slim/Views/README.md
+++ b/vendor/slim/views/Slim/Views/README.md
@@ -19,7 +19,7 @@
```json
{
"require": {
- "slim/views": "1.0.*"
+ "slim/views": "0.1.*"
}
}
```
@@ -123,7 +123,11 @@
{urlFor name="hello" options="name.Josh|age.26"}
-You can easily pass variables that are arrays using the (.) or object using
the (->) by doing:
+or with the new array syntax:
+
+ {urlFor name="hello" options=["name" => "Josh", "age" => "26"]}
+
+You can easily pass variables that are arrays as normal or using the (.):
<a href="{urlFor name="hello"
options="name.{$person.name}|age.{$person.age}"}">Hello {$name}</a>
diff --git a/vendor/slim/views/Slim/Views/Smarty.php
b/vendor/slim/views/Slim/Views/Smarty.php
index d0a39be..6bbc372 100644
--- a/vendor/slim/views/Slim/Views/Smarty.php
+++ b/vendor/slim/views/Slim/Views/Smarty.php
@@ -6,7 +6,7 @@
* @author Andrew Smith
* @link http://www.slimframework.com
* @copyright 2013 Josh Lockhart
- * @version 0.1.0
+ * @version 0.1.2
* @package SlimViews
*
* MIT LICENSE
@@ -78,15 +78,16 @@
*
* This method will output the rendered template content
*
- * @param string $template The path to the template, relative to the
templates directory.
- * @return void
+ * @param string $template The path to the template, relative to the
templates directory.
+ * @param null $data
+ * @return string
*/
- public function render($template)
+ public function render($template, $data = null)
{
$parser = $this->getInstance();
$parser->assign($this->all());
- return $parser->fetch($template);
+ return $parser->fetch($template, $data);
}
/**
diff --git a/vendor/slim/views/Slim/Views/SmartyPlugins/function.baseUrl.php
b/vendor/slim/views/Slim/Views/SmartyPlugins/function.baseUrl.php
index 28093d5..3d66249 100644
--- a/vendor/slim/views/Slim/Views/SmartyPlugins/function.baseUrl.php
+++ b/vendor/slim/views/Slim/Views/SmartyPlugins/function.baseUrl.php
@@ -6,6 +6,8 @@
* Type: function
* Name: baseUrl
* Purpose: outputs url for a function with the defined name method
+ * version 0.1.2
+ * package SlimViews
* -------------------------------------------------------------
*/
function smarty_function_baseUrl($params, $template)
diff --git a/vendor/slim/views/Slim/Views/SmartyPlugins/function.siteUrl.php
b/vendor/slim/views/Slim/Views/SmartyPlugins/function.siteUrl.php
index fa312b6..540d7b7 100644
--- a/vendor/slim/views/Slim/Views/SmartyPlugins/function.siteUrl.php
+++ b/vendor/slim/views/Slim/Views/SmartyPlugins/function.siteUrl.php
@@ -6,7 +6,7 @@
* Type: function
* Name: siteUrl
* Purpose: outputs url for a function with the defined name method
- * version 0.1.0
+ * version 0.1.2
* package SlimViews
* -------------------------------------------------------------
*/
diff --git a/vendor/slim/views/Slim/Views/SmartyPlugins/function.urlFor.php
b/vendor/slim/views/Slim/Views/SmartyPlugins/function.urlFor.php
index b9d65b2..2ab4190 100644
--- a/vendor/slim/views/Slim/Views/SmartyPlugins/function.urlFor.php
+++ b/vendor/slim/views/Slim/Views/SmartyPlugins/function.urlFor.php
@@ -1,13 +1,13 @@
<?php
-/*
+/**
* Smarty plugin
* -------------------------------------------------------------
* File: function.urlFor.php
* Type: function
* Name: urlFor
* Purpose: outputs url for a function with the defined name method
- * version 0.1.0
- * package SlimViews
+ * @version 0.1.2
+ * @package SlimViews
* -------------------------------------------------------------
*/
function smarty_function_urlFor($params, $template)
@@ -19,10 +19,21 @@
if (isset($params['options']))
{
- $options = explode('|', $params['options']);
- foreach ($options as $option) {
- list($key, $value) = explode('.', $option);
- $opts[$key] = $value;
+ switch (gettype($params['options'])) {
+ case 'array':
+ $opts = $params['options'];
+ break;
+
+ case 'string':
+ $options = explode('|', $params['options']);
+ foreach ($options as $option) {
+ list($key, $value) = explode('.',
$option);
+ $opts[$key] = $value;
+ }
+ break;
+
+ default:
+ throw new \Exception('Options parameter is of
unknown type, provide either string or array');
}
$url = \Slim\Slim::getInstance($appName)->urlFor($name, $opts);
diff --git a/vendor/slim/views/Slim/Views/Twig.php
b/vendor/slim/views/Slim/Views/Twig.php
index 36133b2..2a42ca0 100644
--- a/vendor/slim/views/Slim/Views/Twig.php
+++ b/vendor/slim/views/Slim/Views/Twig.php
@@ -6,7 +6,7 @@
* @author Andrew Smith
* @link http://www.slimframework.com
* @copyright 2013 Josh Lockhart
- * @version 0.1.0
+ * @version 0.1.2
* @package SlimViews
*
* MIT LICENSE
@@ -77,15 +77,18 @@
*
* This method will output the rendered template content
*
- * @param string $template The path to the Twig template, relative to
the Twig templates directory.
- * @return void
+ * @param string $template The path to the Twig template, relative to the
Twig templates directory.
+ * @param null $data
+ * @return string
*/
- public function render($template)
+ public function render($template, $data = null)
{
$env = $this->getInstance();
$parser = $env->loadTemplate($template);
- return $parser->render($this->all());
+ $data = array_merge($this->all(), (array) $data);
+
+ return $parser->render($data);
}
/**
diff --git a/vendor/slim/views/Slim/Views/TwigExtension.php
b/vendor/slim/views/Slim/Views/TwigExtension.php
index 9152271..e5b13ed 100644
--- a/vendor/slim/views/Slim/Views/TwigExtension.php
+++ b/vendor/slim/views/Slim/Views/TwigExtension.php
@@ -6,7 +6,7 @@
* @author Andrew Smith
* @link http://www.slimframework.com
* @copyright 2013 Josh Lockhart
- * @version 0.1.0
+ * @version 0.1.2
* @package SlimViews
*
* MIT LICENSE
diff --git a/vendor/slim/views/Slim/Views/composer.json
b/vendor/slim/views/Slim/Views/composer.json
index f657ff5..be06b74 100644
--- a/vendor/slim/views/Slim/Views/composer.json
+++ b/vendor/slim/views/Slim/Views/composer.json
@@ -1,7 +1,7 @@
{
"name": "slim/views",
"type": "library",
- "description": "Twig View Parser package for the Slim Framework",
+ "description": "Smarty and Twig View Parser package for the Slim
Framework",
"keywords": ["templating", "extensions", "slimphp"],
"homepage": "http://github.com/codeguy/Slim-Views",
"license": "MIT",
@@ -18,9 +18,13 @@
}
],
"require": {
- "slim/slim": ">=2.0.0",
+ "slim/slim": ">=2.4.0",
"php": ">=5.3.0"
},
+ "suggest": {
+ "smarty/smarty": "Smarty templating system",
+ "twig/twig": "Twig templating system"
+ },
"autoload": {
"psr-0": {
"Slim\\Views": ""
--
To view, visit https://gerrit.wikimedia.org/r/178075
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I946f379947a96d7bdb8f8760022f5d3bc0506f31
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/wikimania-scholarships
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits