/** 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; }