Add @csgen.redirectTo
This commit is contained in:
parent
b305cbd433
commit
cea8423eda
|
@ -55,6 +55,7 @@ Markdown document and it can be at any point.
|
|||
- `@csgen.addAuthor = "one author here";`
|
||||
- `@csgen.markAsFeed = "false";`
|
||||
- `@csgen.includePage = "/blog/my-awesome-blog-post";`
|
||||
- `@csgen.redirectTo = "/blog/rss.xml";`
|
||||
- `@csgen.span<STYLE, TEXT>("color: #0000ff;", "thisIsRedText");`
|
||||
- `@csgen.span<STYLE, HTML>("color: #0000ff;", "<p>thisIsARedHTMLTag</p>");`
|
||||
- `@csgen.inline<HTML>("<small>myHtmlHere</small>");`
|
||||
|
|
13
core.php
13
core.php
|
@ -19,6 +19,7 @@ class parsedMarkdown {
|
|||
public $displaySource = true;
|
||||
public $displayAuthors = false;
|
||||
public $displayLicense = false;
|
||||
public $redirectTo = '';
|
||||
public $pages = array();
|
||||
public $isFeed = false;
|
||||
}
|
||||
|
@ -227,6 +228,7 @@ function convertMarkdownToHTML($contents) {
|
|||
'/.*@csgen\.displayLicense.*=.*"(.*)(");/',
|
||||
'/.*@csgen\.markAsFeed.*=.*"(.*)(");/',
|
||||
'/.*@csgen\.includePage.*=.*"(.*)(");/',
|
||||
'/.*@csgen\.redirectTo.*=.*"(.*)(");/',
|
||||
'/.*@csgen\.span.*<STYLE.*,.*TEXT>\(.*"(.*)".*, "(.*)"\);/',
|
||||
'/.*@csgen\.span.*<STYLE.*,.*HTML>\(.*"(.*)".*, "(.*)"\);/',
|
||||
'/.*@csgen\.inline.*<HTML>\(.*"(.*)"\);/',
|
||||
|
@ -318,6 +320,11 @@ function convertMarkdownToHTML($contents) {
|
|||
$ret->pages[] = $matches[1];
|
||||
$out = str_replace($matches[0], '', $out);
|
||||
|
||||
break;
|
||||
case '/.*@csgen\.redirectTo.*=.*"(.*)(");/':
|
||||
$ret->redirectTo = $matches[1];
|
||||
$out = str_replace($matches[0], '', $out);
|
||||
|
||||
break;
|
||||
case '/.*@csgen\.span.*<STYLE.*,.*TEXT>\(.*"(.*)".*, "(.*)"\);/':
|
||||
$cssCode = htmlspecialchars_decode($matches[1]);
|
||||
|
@ -535,6 +542,12 @@ function printHeader($html, $printpage) {
|
|||
$html .= "\t\t<div class=\"content\">\n";
|
||||
|
||||
if ($printpage == 1) {
|
||||
if ($ret->redirectTo != '') {
|
||||
$path = $ret->redirectTo;
|
||||
header("Location: $path");
|
||||
die();
|
||||
}
|
||||
|
||||
$License = $ret->license;
|
||||
$sourceFile = $line['file'];
|
||||
|
||||
|
|
Loading…
Reference in a new issue