Remove getCleanTitle() and move title cleanup code to getTitle()

master
Skylar Ittner 5 years ago
parent f9b6d7213e
commit c84a682a6b

@ -77,20 +77,20 @@ switch ($VARS['action']) {
switch ($VARS['type']) {
case "html":
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);
break;
case "odt":
if ($SETTINGS['pandoc'] != "") {
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();
echo $pandoc->convert($note->getText(), "markdown_github", "odt");
break;
}
default:
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();
}
break;

@ -131,7 +131,7 @@ class Note {
. "<link rel=\"schema.dcterms\" href=\"http://purl.org/dc/terms/\">\n"
. "<meta name=\"dcterms.modified\" content=\"" . date("Y-m-d", strtotime($this->getModified())) . "\">\n"
. "\n"
. "<title>" . $this->getCleanTitle() . "</title>\n"
. "<title>" . $this->getTitle() . "</title>\n"
. "\n"
. $safehtml;
return $document;
@ -184,15 +184,6 @@ class Note {
$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 = preg_replace([
"/^- \[ \] /m",

Loading…
Cancel
Save