Better type check, better URL

This commit is contained in:
Evan Prodromou 2013-06-05 16:51:35 -04:00
parent a9b2a86004
commit 0e83c5c824

View File

@ -576,12 +576,12 @@ class ActivityObject
$object->thumbnail = $thumbnail;
}
switch ($object->type) {
case ActivityObject::IMAGE:
switch (ActivityObject::canonicalType($object->type)) {
case 'image':
$object->largerImage = $file->url;
break;
case ActivityObject::VIDEO:
case ActivityObject::AUDIO:
case 'video':
case 'audio':
$object->stream = $file->url;
break;
}
@ -798,8 +798,9 @@ class ActivityObject
// TODO: upstreamDuplicates
// url (XXX: need to put the right thing here...)
$object['url'] = $this->id;
if ($this->link) {
$object['url'] = $this->link;
}
/* Extensions */
// @fixme these may collide with XML extensions
@ -866,14 +867,14 @@ class ActivityObject
}
}
switch ($object->type) {
case self::IMAGE:
switch (ActivityObject::canonicalType($object->type)) {
case 'image':
if (!empty($this->largerImage)) {
$object['fullImage'] = array('url' => $this->largerImage);
}
break;
case self::AUDIO:
case self::VIDEO:
case 'audio':
case 'video':
if (!empty($this->stream)) {
$object['stream'] = array('url' => $this->stream);
}