projects
/
mdref
/
mdref
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
lift max-width limitation
[mdref/mdref]
/
mdref
/
Action.php
diff --git
a/mdref/Action.php
b/mdref/Action.php
index 68f64a7edb8f41a4293af90ae4ce3d162187a68d..df974b9f1f1595d9fb48f0ad2822475874ffbb1d 100644
(file)
--- a/
mdref/Action.php
+++ b/
mdref/Action.php
@@
-29,7
+29,7
@@
class Action {
* @var \http\Url
*/
private $baseUrl;
* @var \http\Url
*/
private $baseUrl;
-
+
/**
* Initialize the reference
*/
/**
* Initialize the reference
*/
@@
-44,7
+44,7
@@
class Action {
function esc($txt) {
return htmlspecialchars($txt);
}
function esc($txt) {
return htmlspecialchars($txt);
}
-
+
/**
* Create the view payload
* @param \http\Controller $ctl
/**
* Create the view payload
* @param \http\Controller $ctl
@@
-52,8
+52,9
@@
class Action {
*/
private function createPayload() {
$pld = new \stdClass;
*/
private function createPayload() {
$pld = new \stdClass;
-
+
$pld->esc = "htmlspecialchars";
$pld->esc = "htmlspecialchars";
+ $pld->anchor = [$this->reference, "formatAnchor"];
$pld->quick = [$this->reference, "formatString"];
$pld->file = [$this->reference, "formatFile"];
$pld->quick = [$this->reference, "formatString"];
$pld->file = [$this->reference, "formatFile"];
@@
-62,10
+63,10
@@
class Action {
$pld->refs = $this->reference;
$pld->baseUrl = $this->baseUrl;
$pld->refs = $this->reference;
$pld->baseUrl = $this->baseUrl;
-
+
return $pld;
}
return $pld;
}
-
+
/**
* Redirect to canononical url
* @param string $cnn
/**
* Redirect to canononical url
* @param string $cnn
@@
-75,7
+76,7
@@
class Action {
$this->response->setResponseCode(301);
$this->response->send();
}
$this->response->setResponseCode(301);
$this->response->send();
}
-
+
/**
* Serve index.css
*/
/**
* Serve index.css
*/
@@
-84,7
+85,7
@@
class Action {
$this->response->setBody(new \http\Message\Body(fopen(ROOT."/public/index.css", "r")));
$this->response->send();
}
$this->response->setBody(new \http\Message\Body(fopen(ROOT."/public/index.css", "r")));
$this->response->send();
}
-
+
/**
* Serve index.js
*/
/**
* Serve index.js
*/
@@
-93,10
+94,11
@@
class Action {
$this->response->setBody(new \http\Message\Body(fopen(ROOT."/public/index.js", "r")));
$this->response->send();
}
$this->response->setBody(new \http\Message\Body(fopen(ROOT."/public/index.js", "r")));
$this->response->send();
}
-
+
/**
* Serve a preset
* @param \stdClass $pld
/**
* Serve a preset
* @param \stdClass $pld
+ * @return true to continue serving the payload
* @throws Exception
*/
private function servePreset($pld) {
* @throws Exception
*/
private function servePreset($pld) {
@@
-105,16
+107,17
@@
class Action {
case "LICENSE":
case "VERSION":
$pld->text = file_get_contents(ROOT."/$pld->ref");
case "LICENSE":
case "VERSION":
$pld->text = file_get_contents(ROOT."/$pld->ref");
-
break
;
+
return true
;
case "index.css":
case "index.css":
- $this->serveStylesheet(
$ctl
);
+ $this->serveStylesheet();
break;
case "index.js":
break;
case "index.js":
- $this->serveJavascript(
$ctl
);
+ $this->serveJavascript();
break;
default:
throw new Exception(404, "$pld->ref not found");
}
break;
default:
throw new Exception(404, "$pld->ref not found");
}
+ return false;
}
private function serve() {
}
private function serve() {
@@
-122,7
+125,7
@@
class Action {
include ROOT."/views/layout.phtml";
$this->response->send();
}
include ROOT."/views/layout.phtml";
$this->response->send();
}
-
+
public function handle() {
try {
public function handle() {
try {
@@
-138,15
+141,15
@@
class Action {
/* direct match */
$pld->entry = $repo->getEntry($pld->ref);
}
/* direct match */
$pld->entry = $repo->getEntry($pld->ref);
}
- } else {
- return
$this->servePreset($pld)
;
+ } else
if (!$this->servePreset($pld))
{
+ return;
}
}
}
}
-
+
} catch (\Exception $e) {
$pld->exception = $e;
}
$this->serve($pld);
}
} catch (\Exception $e) {
$pld->exception = $e;
}
$this->serve($pld);
}
-}
\ No newline at end of file
+}