parsePathspec() static public method

Example: content/posts/2008-08/29-reading-a-book.html date: GBDateTime(2008-08-29T00:00:00Z) (resolution restricted by gb::$posts_cn_pattern) slug: "reading-a-book" fnext: "html"
static public parsePathspec ( $pathspec, &$date, &$slug, &$fnext )
コード例 #1
0
ファイル: content.php プロジェクト: rsms/gitblog
 /** Handle object */
 function onObject($name, $id)
 {
     if (substr($name, 0, 14) !== 'content/posts/') {
         return false;
     }
     GBPost::parsePathspec($name, $date, $slug, $fnext);
     # date missing means malformed pathname
     if ($date === false) {
         throw new UnexpectedValueException('malformed post "' . $name . '" missing date prefix -- skipping');
         return false;
     }
     # handle missing slug. content/posts/2009-01-22 => post
     if (!$slug) {
         $slug = 'post';
     }
     # comment or post?
     if ($fnext === 'comments') {
         $obj = $this->_onComment($name, $id, GBPost::mkCachename($date, $slug));
     } else {
         $obj = $this->_onObject(GBPost::findByDateAndSlug($date, $slug), 'GBPost', $name, $id, $slug);
         if (!$obj) {
             return false;
         }
         self::$posts[] = $obj;
     }
     if ($obj->published === null) {
         $obj->published = $date;
     }
     return true;
 }