projects
/
mdref
/
mdref
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (parent:
bcc3732
)
upgrade autocracy
author
Michael Wallner
<mike@php.net>
Wed, 20 Aug 2014 13:45:38 +0000
(15:45 +0200)
committer
Michael Wallner
<mike@php.net>
Wed, 20 Aug 2014 13:45:38 +0000
(15:45 +0200)
mdref/Action.php
patch
|
blob
|
history
diff --git
a/mdref/Action.php
b/mdref/Action.php
index 46ab7557e391fd1360a790d6e3c676496ecc0f8b..d85e300fed5fc36663505d57943372efe4cd0959 100644
(file)
--- a/
mdref/Action.php
+++ b/
mdref/Action.php
@@
-9,11
+9,11
@@
use http\Controller\Observer;
*/
class Action extends Observer
{
*/
class Action extends Observer
{
- private function serveReference(\http\Url $url, \
http\Controller\Payload
$payload) {
+ private function serveReference(\http\Url $url, \
stdClass
$payload) {
$finder = new Finder($this->baseUrl, REFS);
$path = $finder->find($url);
$payload->listing = new RefListing($path,
$finder = new Finder($this->baseUrl, REFS);
$path = $finder->find($url);
$payload->listing = new RefListing($path,
- $finder->glob($path, "/[_a-zA-Z]*.md"));
+ $finder->glob($path, "/[
:
_a-zA-Z]*.md"));
$payload->title = $payload->listing->getSelf()->formatLink();
$payload->refs = $finder;
if ($path->isFile()) {
$payload->title = $payload->listing->getSelf()->formatLink();
$payload->refs = $finder;
if ($path->isFile()) {
@@
-24,7
+24,7
@@
class Action extends Observer
}
}
}
}
- private function serveInternal(\http\Url $url, \
http\Controller\Payload
$payload) {
+ private function serveInternal(\http\Url $url, \
stdClass
$payload) {
$finder = new Finder($this->baseUrl, ROOT);
$path = $finder->find($url, "");
if ($path->isFile("")) {
$finder = new Finder($this->baseUrl, ROOT);
$path = $finder->find($url, "");
if ($path->isFile("")) {
@@
-65,15
+65,18
@@
class Action extends Observer
function update(\SplSubject $ctl) {
/* @var \http\Controller $ctl */
try {
function update(\SplSubject $ctl) {
/* @var \http\Controller $ctl */
try {
- $pld = $ctl->getPayload();
+ $pld = new \stdClass;
+ $ctl[Observer\View::class] = function() use($pld) {
+ return $pld;
+ };
+
$pld->baseUrl = $this->baseUrl;
$url = $this->baseUrl->mod($ctl->getRequest()->getRequestUrl());
$pld->permUrl = implode("/", $this->baseUrl->params($url));
$pld->baseUrl = $this->baseUrl;
$url = $this->baseUrl->mod($ctl->getRequest()->getRequestUrl());
$pld->permUrl = implode("/", $this->baseUrl->params($url));
-
if ($this->serveReference($url, $pld) || $this->serveInternal($url, $pld)) {
return;
} elseif ($this->servePublic($url, $ctl->getResponse())) {
if ($this->serveReference($url, $pld) || $this->serveInternal($url, $pld)) {
return;
} elseif ($this->servePublic($url, $ctl->getResponse())) {
- $ctl->detachAll(
"\\http\\Controller\\Observer\\View"
);
+ $ctl->detachAll(
Observer\View::class
);
return;
}
return;
}
@@
-81,8
+84,10
@@
class Action extends Observer
if (strcmp($url->path, $this->baseUrl->path)) {
throw new \http\Controller\Exception(404, "Could not find '$url'");
}
if (strcmp($url->path, $this->baseUrl->path)) {
throw new \http\Controller\Exception(404, "Could not find '$url'");
}
- } catch (\Exception $e) {
- $ctl->getPayload()->exception = $e;
+ } catch (\Exception $exception) {
+ $ctl[Observer\View::class] = function() use($exception) {
+ return compact("exception");
+ };
}
}
}
}
}
}