Remove getCleanTitle() and move title cleanup code to getTitle()
This commit is contained in:
parent
f9b6d7213e
commit
c84a682a6b
@ -77,20 +77,20 @@ switch ($VARS['action']) {
|
|||||||
switch ($VARS['type']) {
|
switch ($VARS['type']) {
|
||||||
case "html":
|
case "html":
|
||||||
header("Content-Type: text/html; charset=UTF-8");
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
header("Content-disposition: attachment; filename=\"" . $note->getCleanTitle() . "_" . $note->getModified() . ".html\"");
|
header("Content-disposition: attachment; filename=\"" . $note->getTitle() . "_" . $note->getModified() . ".html\"");
|
||||||
echo $note->getHTML(false);
|
echo $note->getHTML(false);
|
||||||
break;
|
break;
|
||||||
case "odt":
|
case "odt":
|
||||||
if ($SETTINGS['pandoc'] != "") {
|
if ($SETTINGS['pandoc'] != "") {
|
||||||
header("Content-Type: application/vnd.oasis.opendocument.text");
|
header("Content-Type: application/vnd.oasis.opendocument.text");
|
||||||
header("Content-disposition: attachment; filename=\"" . $note->getCleanTitle() . "_" . $note->getModified() . ".odt\"");
|
header("Content-disposition: attachment; filename=\"" . $note->getTitle() . "_" . $note->getModified() . ".odt\"");
|
||||||
$pandoc = new Pandoc\Pandoc();
|
$pandoc = new Pandoc\Pandoc();
|
||||||
echo $pandoc->convert($note->getText(), "markdown_github", "odt");
|
echo $pandoc->convert($note->getText(), "markdown_github", "odt");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
header("Content-Type: text/markdown; charset=UTF-8");
|
header("Content-Type: text/markdown; charset=UTF-8");
|
||||||
header("Content-disposition: attachment; filename=\"" . $note->getCleanTitle() . "_" . $note->getModified() . ".md\"");
|
header("Content-disposition: attachment; filename=\"" . $note->getTitle() . "_" . $note->getModified() . ".md\"");
|
||||||
echo $note->getText();
|
echo $note->getText();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -131,7 +131,7 @@ class Note {
|
|||||||
. "<link rel=\"schema.dcterms\" href=\"http://purl.org/dc/terms/\">\n"
|
. "<link rel=\"schema.dcterms\" href=\"http://purl.org/dc/terms/\">\n"
|
||||||
. "<meta name=\"dcterms.modified\" content=\"" . date("Y-m-d", strtotime($this->getModified())) . "\">\n"
|
. "<meta name=\"dcterms.modified\" content=\"" . date("Y-m-d", strtotime($this->getModified())) . "\">\n"
|
||||||
. "\n"
|
. "\n"
|
||||||
. "<title>" . $this->getCleanTitle() . "</title>\n"
|
. "<title>" . $this->getTitle() . "</title>\n"
|
||||||
. "\n"
|
. "\n"
|
||||||
. $safehtml;
|
. $safehtml;
|
||||||
return $document;
|
return $document;
|
||||||
@ -184,15 +184,6 @@ class Note {
|
|||||||
$title = explode("\n", $this->getText())[0];
|
$title = explode("\n", $this->getText())[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $title;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the note title stripped of Markdown and trimmed
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCleanTitle(): string {
|
|
||||||
$title = $this->getTitle();
|
|
||||||
$title = str_replace(["*", "#", "_", "`"], "", $title);
|
$title = str_replace(["*", "#", "_", "`"], "", $title);
|
||||||
$title = preg_replace([
|
$title = preg_replace([
|
||||||
"/^- \[ \] /m",
|
"/^- \[ \] /m",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user