diff options
Diffstat (limited to 'start.php')
-rw-r--r-- | start.php | 37 |
1 files changed, 25 insertions, 12 deletions
@@ -270,22 +270,35 @@ function videolist_embed_get_items($hook, $type, $value, $params) { * @return string Relative URL */ function videolist_icon_url_override($hook, $type, $returnvalue, $params) { - $videolist_item = $params['entity']; - /* @var ElggObject $videolist_item */ - $size = $params['size']; - if($videolist_item->getSubtype() != 'videolist_item'){ - return $returnvalue; - } - - // tiny thumbnails are too small to be useful, so give a generic video icon - if ($size != 'tiny' && isset($videolist_item->thumbnail)) { - return elgg_get_site_url() . "mod/videolist/thumbnail.php?guid=" . $videolist_item->guid; + // if someone already set this, quit + if ($return_value) { + return null; } - if (in_array($size, array('tiny', 'small', 'medium'))){ - return "mod/videolist/graphics/videolist_icon_{$size}.png"; + $videolist_item = $params['entity']; + $size = $params['size']; + + if (!elgg_instanceof($videolist_item, 'object', 'videolist_item')) { + return null; } + + // tiny thumbnails are too small to be useful, so give a generic video icon + try { + if ($size != 'tiny' && isset($videolist_item->thumbnail)) { + $owner = $videolist_item->getOwnerEntity(); + $owner_guid = $owner->getGUID(); + $join_date = $owner->getTimeCreated(); + return "mod/videolist/thumbnail.php?joindate=$join_date&guid={$videolist_item->guid}&owner_guid=$owner_guid&size=$size"; + } + } catch (InvalidParameterException $e) { + elgg_log("Unable to get videolist icon for video with GUID {$videolist_item->guid}", 'ERROR'); + return "mod/videolist/graphics/videolist_icon_{$size}.png"; + } + if (in_array($size, array('tiny', 'small', 'medium'))){ + return "mod/videolist/graphics/videolist_icon_{$size}.png"; + } + return null; } /** |