diff --git a/library/Zepto/FileLoader/MarkdownLoader.php b/library/Zepto/FileLoader/MarkdownLoader.php index 08dfce4..3384eb2 100644 --- a/library/Zepto/FileLoader/MarkdownLoader.php +++ b/library/Zepto/FileLoader/MarkdownLoader.php @@ -63,33 +63,17 @@ private function post_process() */ private function parse_meta($file) { - // Define metadata - $meta = array( - 'title' => 'Title', - 'description' => 'Description', - 'author' => 'Author', - 'date' => 'Date', - 'robots' => 'Robots', - 'template' => 'Template' - ); + // Grab meta section between '/* ... */' in the content file + preg_match_all('#/\*(.*?)\*/#s', $file, $meta); - // Grab meta fields between '/* ... */' in the content file - foreach ($meta as $field => $regex) { - if ( - preg_match( - '/^[ \t\/*#@]*' . preg_quote($regex, '/') . ':(.*)$/mi', - $file, - $match - ) && $match[1] - ) { - $meta[$field] = trim(preg_replace("/\s*(?:\*\/|\?>).*/", '', $match[1])); - } - else { - unset($meta[$field]); - } + // Retrieve individual meta fields + preg_match_all('/^[\t\/*#@]*(.*):(.*)$/mi', $meta[1][0], $match); + + for ($i=0; $i < count($match[1]); $i++) { + $result[strtolower($match[1][$i])] = trim(htmlentities($match[2][$i])); } - return $meta; + return $result; } /** diff --git a/library/Zepto/FileLoader/PluginLoader.php b/library/Zepto/FileLoader/PluginLoader.php index d71cee2..0595b99 100644 --- a/library/Zepto/FileLoader/PluginLoader.php +++ b/library/Zepto/FileLoader/PluginLoader.php @@ -13,12 +13,6 @@ class PluginLoader extends \Zepto\FileLoader { - // public function __construct($plugin_dir) - // { - // parent::__construct(); - // $this->plugin_dir = $plugin_dir; - // } - /** * Loads in a single file or all files in a directory if $file_path is a folder * diff --git a/library/Zepto/FileWriter.php b/library/Zepto/FileWriter.php index 631e0a5..43b2717 100644 --- a/library/Zepto/FileWriter.php +++ b/library/Zepto/FileWriter.php @@ -13,11 +13,6 @@ class FileWriter { - public function __construct() - { - - } - // Seems to work, meh public function write($file_path, $file_data) {