From 01c44e9002d03f58c9a5271c6256096de3273eb5 Mon Sep 17 00:00:00 2001 From: Steve Clay Date: Mon, 9 Apr 2012 15:06:33 -0400 Subject: More PHPDoc comments and @var declarations to help IDE comprehension --- views/default/icon/object/videolist_item.php | 1 + views/default/object/videolist_item.php | 1 + 2 files changed, 2 insertions(+) (limited to 'views') diff --git a/views/default/icon/object/videolist_item.php b/views/default/icon/object/videolist_item.php index 38b805021..24a5b5fe8 100644 --- a/views/default/icon/object/videolist_item.php +++ b/views/default/icon/object/videolist_item.php @@ -11,6 +11,7 @@ */ $entity = $vars['entity']; +/* @var ElggObject $entity */ $sizes = array('small', 'medium', 'large', 'tiny', 'master', 'topbar'); $img_width = array('tiny' => 25, 'small' => 40, 'medium' => 100, 'large' => 200); diff --git a/views/default/object/videolist_item.php b/views/default/object/videolist_item.php index 6ed284a43..e30d9d95b 100644 --- a/views/default/object/videolist_item.php +++ b/views/default/object/videolist_item.php @@ -7,6 +7,7 @@ $full = elgg_extract('full_view', $vars, FALSE); $entity = elgg_extract('entity', $vars, FALSE); +/* @var ElggObject $entity */ if (!$entity) { return TRUE; -- cgit v1.2.3 From 4af120de2bd0fe2046795346a40102f00fbe5479 Mon Sep 17 00:00:00 2001 From: Steve Clay Date: Tue, 10 Apr 2012 12:04:42 -0400 Subject: Allow plugins to alter video dimensions. --- start.php | 28 ++++++++++++++++++++++++++++ views/default/object/videolist_item.php | 7 ++++--- 2 files changed, 32 insertions(+), 3 deletions(-) (limited to 'views') diff --git a/start.php b/start.php index 2791b1185..77bf0a7bc 100644 --- a/start.php +++ b/start.php @@ -288,6 +288,34 @@ function videolist_icon_url_override($hook, $type, $returnvalue, $params) { } } +/** + * @param ElggObject $videolist_item + * @return array + */ +function videolist_get_video_dimensions(ElggObject $videolist_item) { + $dimensions = array( + 'width' => 600, + 'height' => 400, + ); + $params['entity'] = $videolist_item; + $params['videotype'] = $videolist_item->videotype; + $dimensions = elgg_trigger_plugin_hook( + 'videolist:setdimensions', + $params['videotype'], + $params, + $dimensions); + if (! is_array($dimensions)) { + $dimensions = array(); + } + if (empty($dimensions['width']) || ! is_numeric($dimensions['width'])) { + $dimensions['width'] = 600; + } + if (empty($dimensions['height']) || ! is_numeric($dimensions['height'])) { + $dimensions['height'] = 400; + } + return $dimensions; +} + /** * Prepend HTTP scheme if missing * @param string $hook diff --git a/views/default/object/videolist_item.php b/views/default/object/videolist_item.php index e30d9d95b..5e0db00ce 100644 --- a/views/default/object/videolist_item.php +++ b/views/default/object/videolist_item.php @@ -60,11 +60,12 @@ if (elgg_in_context('widgets')) { } if ($full && !elgg_in_context('gallery')) { - + + $dimensions = videolist_get_video_dimensions($entity); $content = elgg_view("videolist/watch/{$entity->videotype}", array( 'entity' => $entity, - 'width' => 600, - 'height' => 400, + 'width' => $dimensions['width'], + 'height' => $dimensions['height'], )); $content = "
$content
"; -- cgit v1.2.3