diff --git a/blog.txt b/blog.txt index a890835..fc88332 100644 --- a/blog.txt +++ b/blog.txt @@ -1 +1 @@ -2020-10-01T08:05:33Z ac7c64 Welcome to picoblog. For updates and such, visit [https://0xff.nu/picoblog](https://0xff.nu/picoblog). \ No newline at end of file +2020-10-01T08:05:33Z (#MWZkYw) Welcome to picoblog. For updates and such, visit [https://0xff.nu/picoblog](https://0xff.nu/picoblog). \ No newline at end of file diff --git a/picoblog.php b/picoblog.php index 8cca13d..9f1deca 100644 --- a/picoblog.php +++ b/picoblog.php @@ -47,7 +47,7 @@ class PicoBlog } /** - * Read source file + * Read source file/URL * * @return boolean true if successful, false if not */ @@ -58,6 +58,11 @@ class PicoBlog if (!empty($this->rawentries)) { return true; } + } elseif ($url = filter_var($this->sourcefile, FILTER_VALIDATE_URL)) { + $this->rawentries = preg_split('/\x0A/', file_get_contents($url)); + if (!empty($this->rawentries)) { + return true; + } } throw new \Exception("{$this->sourcefile} is empty! Aborting."); return false; @@ -76,7 +81,7 @@ class PicoBlog $pattern = '/^(?[^\t]+)\t(?.+)/'; break; case 'picoblog': - $pattern = '/^(?[^\t]+)\t#(?[a-zA-Z0-9]{6})\t(?.+)/'; + $pattern = '/^(?[^\t]+)\t\(#(?[a-zA-Z0-9]{6,7})\)\t(?.+)/'; break; } foreach ($entries as $i => $entry) {