Created
August 16, 2010 11:56
-
-
Save jsmitka/526834 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
class PresenterLoader extends \Nette\Application\PresenterLoader | |
{ | |
public $baseNamespace = 'PandaWeb'; | |
public $caseSensitive = TRUE; | |
private $baseDir; | |
static public function createService() | |
{ | |
return new static(\Nette\Environment::getVariable('appDir')); | |
} | |
public function __construct($baseDir) | |
{ | |
$this->baseDir = $baseDir; | |
} | |
public function formatPresenterClass($presenter) | |
{ | |
return $this->baseNamespace . '\\' . parent::formatPresenterClass($presenter); | |
} | |
public function unformatPresenterClass($class) | |
{ | |
return substr(parent::unformatPresenterClass($class), strlen($this->baseNamespace) + 1); | |
} | |
public function formatPresenterFile($presenter) | |
{ | |
$path = '/' . str_replace(':', 'Module/', $presenter); | |
return $this->baseDir . substr_replace($path, '/Presenters', strrpos($path, '/'), 0) . 'Presenter.php'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment