Skip to content

Commit 4c2f1bb

Browse files
author
=
committed
Add namespaces in custom views
1 parent 40183d4 commit 4c2f1bb

File tree

12 files changed

+31
-31
lines changed

12 files changed

+31
-31
lines changed

Views/Dwoo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ private function getInstance()
8383
{
8484
if (!self::$dwooInstance) {
8585
if (!is_dir(self::$dwooDirectory)) {
86-
throw new RuntimeException('Cannot set the Dwoo lib directory : ' . self::$dwooDirectory . '. Directory does not exist.');
86+
throw new \RuntimeException('Cannot set the Dwoo lib directory : ' . self::$dwooDirectory . '. Directory does not exist.');
8787
}
8888
require_once self::$dwooDirectory . '/dwooAutoload.php';
89-
self::$dwooInstance = new Dwoo();
89+
self::$dwooInstance = new \Dwoo();
9090
}
9191

9292
return self::$dwooInstance;

Views/Extension/Smarty/function.urlFor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function smarty_function_urlFor($params, $template)
1313
$name = isset($params['name']) ? $params['name'] : '';
1414
$appName = isset($params['appname']) ? $params['appname'] : 'default';
1515

16-
$url = Slim::getInstance($appName)->urlFor($name);
16+
$url = \Slim\Slim::getInstance($appName)->urlFor($name);
1717

1818
if (isset($params['options']))
1919
{
@@ -23,7 +23,7 @@ function smarty_function_urlFor($params, $template)
2323
$opts[$key] = $value;
2424
}
2525

26-
$url = Slim::getInstance($appName)->urlFor($name, $opts);
26+
$url = \Slim\Slim::getInstance($appName)->urlFor($name, $opts);
2727
}
2828

2929
return $url;

Views/Extension/Twig/Extensions/Slim.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
class Twig_Extensions_Slim extends Twig_Extension
3+
class Twig_Extensions_Slim extends \Twig_Extension
44
{
55
public function getName()
66
{
@@ -10,7 +10,7 @@ public function getName()
1010
public function getFunctions()
1111
{
1212
return array(
13-
'urlFor' => new Twig_Function_Method($this, 'urlFor'),
13+
'urlFor' => new \Twig_Function_Method($this, 'urlFor'),
1414
);
1515
}
1616

Views/H2o.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function render($template)
6161
self::$h2o_options['searchpath'] = $this->getTemplatesDirectory() . '/';
6262
}
6363
$this->_load_h2o();
64-
$h2o = new H2o($template, self::$h2o_options);
64+
$h2o = new \H2o($template, self::$h2o_options);
6565

6666
return $h2o->render($this->data);
6767
}
@@ -75,11 +75,11 @@ public function render($template)
7575
*/
7676
private function _load_h2o()
7777
{
78-
if (class_exists('H2o')) {
78+
if (class_exists('\H2o')) {
7979
return;
8080
}
8181
if (!is_dir(self::$h2o_directory)) {
82-
throw new RuntimeException('h2o directory is invalid');
82+
throw new \RuntimeException('h2o directory is invalid');
8383
}
8484
require_once self::$h2o_directory . 'h2o.php';
8585
}

Views/Haanga.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class Haanga extends \Slim\View
5959
public function __construct($haangaDir, $templatesDir, $compiledDir)
6060
{
6161
require_once $haangaDir . '/lib/Haanga.php';
62-
Haanga::configure(array(
62+
\Haanga::configure(array(
6363
'template_dir' => $templatesDir,
6464
'cache_dir' => $compiledDir
6565
));
@@ -75,6 +75,6 @@ public function __construct($haangaDir, $templatesDir, $compiledDir)
7575
*/
7676
public function render($template)
7777
{
78-
return Haanga::load($template, $this->data);
78+
return \Haanga::load($template, $this->data);
7979
}
8080
}

Views/Haml.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ class Haml extends \Slim\View
7272
public function render($template)
7373
{
7474
if (!is_dir(self::$hamlDirectory)) {
75-
throw new RuntimeException('Cannot set the HamlPHP lib directory : ' . self::$hamlDirectory . '. Directory does not exist.');
75+
throw new \RuntimeException('Cannot set the HamlPHP lib directory : ' . self::$hamlDirectory . '. Directory does not exist.');
7676
}
7777
require_once self::$hamlDirectory . '/HamlPHP/HamlPHP.php';
7878
require_once self::$hamlDirectory . '/HamlPHP/Storage/FileStorage.php';
79-
$parser = new HamlPHP(new FileStorage(self::$hamlCacheDirectory));
79+
$parser = new \HamlPHP(new \FileStorage(self::$hamlCacheDirectory));
8080

81-
return $parser->parseFile(self::$hamlTemplatesDirectory.$template, $this->data);
81+
return $parser->parseFile(self::$hamlTemplatesDirectory . $template, $this->data);
8282
}
8383
}

Views/Mustache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class Mustache extends \Slim\View
5959
public function render($template)
6060
{
6161
require_once self::$mustacheDirectory . '/Mustache.php';
62-
$m = new Mustache();
62+
$m = new \Mustache();
6363
$contents = file_get_contents($this->getTemplatesDirectory() . '/' . ltrim($template, '/'));
6464

6565
return $m->render($contents, $this->data);

Views/Rain.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ private function getInstance()
9090
{
9191
if (!self::$rainInstance) {
9292
if (!is_dir(self::$rainDirectory)) {
93-
throw new RuntimeException('Cannot set the Rain lib directory : ' . self::$rainDirectory . '. Directory does not exist.');
93+
throw new \RuntimeException('Cannot set the Rain lib directory : ' . self::$rainDirectory . '. Directory does not exist.');
9494
}
9595
require_once self::$rainDirectory . '/rain.tpl.class.php';
9696
raintpl::$tpl_dir = self::$rainTemplatesDirectory;
9797
raintpl::$cache_dir = self::$rainCacheDirectory;
98-
self::$rainInstance = new raintpl();
98+
self::$rainInstance = new \raintpl();
9999
}
100100

101101
return self::$rainInstance;

Views/Savant.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ private function getInstance()
8484
{
8585
if (!self::$savantInstance) {
8686
if (!is_dir(self::$savantDirectory)) {
87-
throw new RuntimeException('Cannot set the Savant lib directory : ' . self::$savantDirectory . '. Directory does not exist.');
87+
throw new \RuntimeException('Cannot set the Savant lib directory : ' . self::$savantDirectory . '. Directory does not exist.');
8888
}
8989
require_once self::$savantDirectory . '/Savant3.php';
90-
self::$savantInstance = new Savant3(self::$savantOptions);
90+
self::$savantInstance = new \Savant3(self::$savantOptions);
9191
}
9292

9393
return self::$savantInstance;

Views/Smarty.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ public function render($template)
101101
*/
102102
public static function getInstance()
103103
{
104-
if (!(self::$smartyInstance instanceof Smarty)) {
104+
if (!(self::$smartyInstance instanceof \Smarty)) {
105105
if (!is_dir(self::$smartyDirectory)) {
106-
throw new RuntimeException('Cannot set the Smarty lib directory : ' . self::$smartyDirectory . '. Directory does not exist.');
106+
throw new \RuntimeException('Cannot set the Smarty lib directory : ' . self::$smartyDirectory . '. Directory does not exist.');
107107
}
108108
require_once self::$smartyDirectory . '/Smarty.class.php';
109-
self::$smartyInstance = new Smarty();
109+
self::$smartyInstance = new \Smarty();
110110
self::$smartyInstance->template_dir = is_null(self::$smartyTemplatesDirectory) ? $this->getTemplatesDirectory() : self::$smartyTemplatesDirectory;
111111
if (self::$smartyExtensions) {
112112
self::$smartyInstance->addPluginsDir(self::$smartyExtensions);

0 commit comments

Comments
 (0)