fixing bugs and refactoring.
This commit is contained in:
parent
a7e98e8e9a
commit
45538620da
|
@ -20,13 +20,13 @@ public static function to($url = '', $https = false)
|
|||
{
|
||||
if (filter_var($url, FILTER_VALIDATE_URL) !== false) return $url;
|
||||
|
||||
// First, we need to build the base URL for the application, as well as handle
|
||||
// the generation of links using SSL. It is possible for the developer to disable
|
||||
// the generation of SSL links throughout the application, making it more
|
||||
// convenient to create applications without SSL on the development box.
|
||||
$base = Config::get('application.url').'/'.Config::get('application.index');
|
||||
// First, we build the base URL for the application, as well as handle the generation
|
||||
// of links using SSL. It is possible for the developer to disable the generation
|
||||
// of SSL links throughout the application, making it more convenient to create
|
||||
// applications without SSL on the development box.
|
||||
$base = Config::$items['application']['url'].'/'.Config::$items['application']['index'];
|
||||
|
||||
if ($https and Config::get('application.ssl'))
|
||||
if ($https and Config::$items['application']['ssl'])
|
||||
{
|
||||
$base = preg_replace('~http://~', 'https://', $base, 1);
|
||||
}
|
||||
|
@ -88,6 +88,8 @@ public static function to_route($name, $parameters = array(), $https = false)
|
|||
{
|
||||
$uris = explode(', ', key($route));
|
||||
|
||||
// Grab the first URI assigned to the route, removing the request URI
|
||||
// and leading slash from the destination defined on the route.
|
||||
$uri = substr($uris[0], strpos($uris[0], '/'));
|
||||
|
||||
// Spin through each route parameter and replace the route wildcard
|
||||
|
|
|
@ -133,10 +133,9 @@ protected static function name($name)
|
|||
{
|
||||
if (is_null(static::$composers)) static::$composers = require APP_PATH.'composers'.EXT;
|
||||
|
||||
// The view's name may specified in several different ways in the
|
||||
// composers file. The composer may simple have a string value,
|
||||
// which is the name. Or, the composer could have an array
|
||||
// value in which a "name" key exists.
|
||||
// The view's name may specified in several different ways in the composers file.
|
||||
// The composer may simple have a string value, which is the name. Or, it may
|
||||
// an array value in which a "name" key exists.
|
||||
foreach (static::$composers as $key => $value)
|
||||
{
|
||||
if ($name === $value or (is_array($value) and $name === Arr::get($value, 'name'))) return $key;
|
||||
|
@ -177,7 +176,10 @@ public function render()
|
|||
// main view is evaluated and dumps the links to the assets.
|
||||
foreach ($this->data as &$data)
|
||||
{
|
||||
if ($data instanceof View or $data instanceof Response) $data = $data->render();
|
||||
if ($data instanceof View or $data instanceof Response)
|
||||
{
|
||||
$data = $data->render();
|
||||
}
|
||||
}
|
||||
|
||||
ob_start() and extract($this->data, EXTR_SKIP);
|
||||
|
|
Loading…
Reference in New Issue