X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2FPlatal.php;h=88e06501699d70d847b83438c57e45b957ef8653;hb=f0430dc7403d6c3c29f51132c0f8295c782d7555;hp=a05219305da0f366d342182355931979710744ce;hpb=63528107273f1f5de8a83428dbdd70e5f25d3d7f;p=platal.git diff --git a/classes/Platal.php b/classes/Platal.php index a052193..88e0650 100644 --- a/classes/Platal.php +++ b/classes/Platal.php @@ -41,11 +41,25 @@ class Platal array_unshift($modules, 'core'); foreach ($modules as $module) { - $this->__mods[$module] = $m = PLModule::factory($this, $module); + $this->__mods[$module] = $m = PLModule::factory($module); $this->__hooks += $m->handlers(); } } + function pl_self($n = null) + { + if (is_null($n)) + return $this->path; + + if ($n >= 0) + return join('/', array_slice($this->argv, 0, $n + 1)); + + if ($n <= -count($this->argv)) + return $this->argv[0]; + + return join('/', array_slice($this->argv, 0, $n)); + } + function find_hook() { $p = $this->path;