public function longURL(string $shortURL = '') : string
{
$post = $this->db->row("SELECT * FROM view_hull_blog_list WHERE shorturl = ?", $shortURL);
if (empty($post)) {
return '';
}
return \implode('/', ['', $post['blogyear'], \str_pad($post['blogmonth'], 2, '0', STR_PAD_LEFT), $post['slug']]);
}
/** * Handle short URLs * * @param string $uniqueID * @route b/(.*) */ public function shortURL(string $uniqueID = '') { if (empty($uniqueID)) { \Airship\redirect($this->airship_cabin_prefix . '/blog'); } $long = $this->blog->longURL($uniqueID); \Airship\redirect($this->airship_cabin_prefix . '/blog' . $long); }