function asActivity($cur = null, $source = false)
{
+ $act = self::cacheGet('notice:as-activity:'.$this->id);
+
+ if (!empty($act)) {
+ return $act;
+ }
+
$act = new Activity();
if (Event::handle('StartNoticeAsActivity', array($this, &$act))) {
-
+
$profile = $this->getProfile();
$act->actor = ActivityObject::fromProfile($profile);
Event::handle('EndNoticeAsActivity', array($this, &$act));
}
+ self::cacheSet('notice:as-activity:'.$this->id, $act);
+
return $act;
}
function asString($namespace=false, $author=true)
{
+ $c = Cache::instance();
+
+ $str = $c->get('activity:as-string:'.Cache::keyize($this->id));
+
+ if (!empty($str)) {
+ return $str;
+ }
+
$xs = new XMLStringer(true);
if ($namespace) {
$xs->elementEnd('entry');
- return $xs->getString();
+ $str = $xs->getString();
+
+ $c->set('activity:as-string:'.Cache::keyize($this->id), $str);
+
+ return $str;
}
private function _child($element, $tag, $namespace=self::SPEC)