aboutsummaryrefslogtreecommitdiff
path: root/start.php
diff options
context:
space:
mode:
Diffstat (limited to 'start.php')
-rw-r--r--start.php37
1 files changed, 25 insertions, 12 deletions
diff --git a/start.php b/start.php
index 2094ffacc..6f94b97d0 100644
--- a/start.php
+++ b/start.php
@@ -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;
}
/**