aboutsummaryrefslogtreecommitdiff
path: root/mod/videolist
diff options
context:
space:
mode:
Diffstat (limited to 'mod/videolist')
-rw-r--r--mod/videolist/.gitignore15
-rw-r--r--mod/videolist/CHANGES.txt14
-rw-r--r--mod/videolist/actions/videolist/delete.php39
-rw-r--r--mod/videolist/actions/videolist/edit.php107
-rw-r--r--mod/videolist/graphics/_videolist_icon_medium.pngbin0 -> 4391 bytes
-rw-r--r--mod/videolist/graphics/videolist_icon_medium.pngbin0 -> 3840 bytes
-rw-r--r--mod/videolist/graphics/videolist_icon_small.pngbin0 -> 1960 bytes
-rw-r--r--mod/videolist/graphics/videolist_icon_tiny.pngbin0 -> 1295 bytes
-rw-r--r--mod/videolist/languages/ca.php40
-rw-r--r--mod/videolist/languages/en.php78
-rw-r--r--mod/videolist/languages/es.php40
-rw-r--r--mod/videolist/languages/fr.php28
-rw-r--r--mod/videolist/languages/gl.php29
-rw-r--r--mod/videolist/languages/pt.php50
-rw-r--r--mod/videolist/lib/Videolist/Platform/Bliptv.php38
-rw-r--r--mod/videolist/lib/Videolist/Platform/Gisstv.php50
-rw-r--r--mod/videolist/lib/Videolist/Platform/Metacafe.php38
-rw-r--r--mod/videolist/lib/Videolist/Platform/Vimeo.php40
-rw-r--r--mod/videolist/lib/Videolist/Platform/Youtube.php49
-rw-r--r--mod/videolist/lib/Videolist/PlatformInterface.php23
-rw-r--r--mod/videolist/lib/videolist.php46
-rw-r--r--mod/videolist/manifest.xml18
-rw-r--r--mod/videolist/pages/videolist/add.php39
-rw-r--r--mod/videolist/pages/videolist/all.php34
-rw-r--r--mod/videolist/pages/videolist/edit.php49
-rw-r--r--mod/videolist/pages/videolist/friends.php33
-rw-r--r--mod/videolist/pages/videolist/owner.php54
-rw-r--r--mod/videolist/pages/videolist/watch.php42
-rw-r--r--mod/videolist/start.php328
-rw-r--r--mod/videolist/thumbnail.php64
-rw-r--r--mod/videolist/upgrades/2012022501.php82
-rw-r--r--mod/videolist/views/default/forms/videolist/edit.php55
-rw-r--r--mod/videolist/views/default/icon/object/videolist_item.php47
-rw-r--r--mod/videolist/views/default/object/videolist_item.php108
-rw-r--r--mod/videolist/views/default/page/elements/videolist_block.php36
-rw-r--r--mod/videolist/views/default/river/object/videolist_item/create.php15
-rw-r--r--mod/videolist/views/default/videolist/css.php23
-rw-r--r--mod/videolist/views/default/videolist/group_module.php43
-rw-r--r--mod/videolist/views/default/videolist/sidebar.php28
-rw-r--r--mod/videolist/views/default/videolist/watch.php8
-rw-r--r--mod/videolist/views/default/videolist/watch/bliptv.php6
-rw-r--r--mod/videolist/views/default/videolist/watch/gisstv.php7
-rw-r--r--mod/videolist/views/default/videolist/watch/metacafe.php6
-rw-r--r--mod/videolist/views/default/videolist/watch/vimeo.php5
-rw-r--r--mod/videolist/views/default/videolist/watch/youtube.php5
-rw-r--r--mod/videolist/views/default/widgets/videolist/content.php32
-rw-r--r--mod/videolist/views/default/widgets/videolist/edit.php24
-rw-r--r--mod/videolist/views/rss/object/videolist_item.php47
48 files changed, 1962 insertions, 0 deletions
diff --git a/mod/videolist/.gitignore b/mod/videolist/.gitignore
new file mode 100644
index 000000000..339142537
--- /dev/null
+++ b/mod/videolist/.gitignore
@@ -0,0 +1,15 @@
+# ignore IDE/hidden/testing/OS cache files
+.*
+*~
+/nbproject
+/nb-configuration.xml
+Session.vim
+*.tmproj
+*.tmproject
+tmtags
+Thumbs.db
+Desktop.ini
+/JsTestDriver-*.jar
+
+# don't ignore travis config
+!/.travis.yml
diff --git a/mod/videolist/CHANGES.txt b/mod/videolist/CHANGES.txt
new file mode 100644
index 000000000..9a55a443f
--- /dev/null
+++ b/mod/videolist/CHANGES.txt
@@ -0,0 +1,14 @@
+Version 1.8.1
+(November 8, 2013 from https://github.com/lorea/videolist.git)
+
+ Enhancements
+ * Setting responsive dimensions.
+ * Making video thumbnails faster (thanks to ura soul).
+ * Do not display watching video in sidebar (thanks to ura soul).
+
+ Bugfixes
+ * Using https instead http in embeded videos.
+
+Version 1.8.0 (Foxglove)
+(September 13th, 2013 from git://github.com/lorea/videolist.git)
+
diff --git a/mod/videolist/actions/videolist/delete.php b/mod/videolist/actions/videolist/delete.php
new file mode 100644
index 000000000..0b9724c52
--- /dev/null
+++ b/mod/videolist/actions/videolist/delete.php
@@ -0,0 +1,39 @@
+<?php
+/**
+* Elgg videolist item delete
+*
+* @package ElggVideolist
+*/
+
+$guid = (int) get_input('guid');
+
+$videolist_item = get_entity($guid);
+if (!$videolist_item->guid) {
+ register_error(elgg_echo("videolist:deletefailed"));
+ forward('videolist/all');
+}
+
+if (!$videolist_item->canEdit()) {
+ register_error(elgg_echo("videolist:deletefailed"));
+ forward($videolist_item->getURL());
+}
+
+$container = $videolist_item->getContainerEntity();
+$url = $videolist_item->getURL();
+
+if (!$videolist_item->delete()) {
+ register_error(elgg_echo("videolist:deletefailed"));
+} else {
+ system_message(elgg_echo("videolist:deleted"));
+}
+
+// we can't come back to video url because it's deleted
+if($url != $_SERVER['HTTP_REFERER']) {
+ forward(REFERER);
+}
+
+if (elgg_instanceof($container, 'group')) {
+ forward("videolist/group/$container->guid/all");
+} else {
+ forward("videolist/owner/$container->username");
+}
diff --git a/mod/videolist/actions/videolist/edit.php b/mod/videolist/actions/videolist/edit.php
new file mode 100644
index 000000000..a5e6ea453
--- /dev/null
+++ b/mod/videolist/actions/videolist/edit.php
@@ -0,0 +1,107 @@
+<?php
+/**
+ * Create or edit a video
+ *
+ * @package ElggVideolist
+ */
+
+$variables = elgg_get_config('videolist');
+$input = array();
+foreach ($variables as $name => $type) {
+ $filter_input = ($name !== 'video_url');
+ $input[$name] = get_input($name, null, $filter_input);
+ if ($name == 'title') {
+ $input[$name] = strip_tags($input[$name]);
+ }
+ if ($type == 'tags') {
+ $input[$name] = string_to_tag_array($input[$name]);
+ }
+}
+
+// Get guids
+$video_guid = (int)get_input('video_guid');
+$container_guid = (int)get_input('container_guid');
+
+elgg_make_sticky_form('videolist');
+
+elgg_load_library('elgg:videolist');
+
+// If new video, get data from video providers
+if(!$video_guid) {
+
+ $input['video_url'] = elgg_trigger_plugin_hook('videolist:preprocess', 'url', $input, $input['video_url']);
+
+ if (!$input['video_url']) {
+ register_error(elgg_echo('videolist:error:no_url'));
+ forward(REFERER);
+ }
+
+ $parsedPlatform = videolist_parse_url($input['video_url']);
+
+ if (!$parsedPlatform) {
+ register_error(elgg_echo('videolist:error:invalid_url'));
+ forward(REFERER);
+ }
+ list ($parsed, $platform) = $parsedPlatform;
+ /* @var Videolist_PlatformInterface $platform */
+
+ unset($input['title']);
+ unset($input['description']);
+ $input = array_merge($parsed, $platform->getData($parsed), $input);
+ $input['videotype'] = $platform->getType();
+
+} else {
+ unset($input['video_url']);
+}
+
+if ($video_guid) {
+ $video = get_entity($video_guid);
+ if (!$video || !$video->canEdit()) {
+ register_error(elgg_echo('videolist:error:no_save'));
+ forward(REFERER);
+ }
+ $new_video = false;
+} else {
+ $video = new ElggObject();
+ $video->subtype = 'videolist_item';
+ $new_video = true;
+}
+
+if (sizeof($input) > 0) {
+ foreach ($input as $name => $value) {
+ $video->$name = $value;
+ }
+}
+
+$video->container_guid = $container_guid;
+
+if ($video->save()) {
+
+ elgg_clear_sticky_form('videolist');
+
+ // Let's save the thumbnail in the data folder
+ $thumb_url = $video->thumbnail;
+ if ($thumb_url) {
+ $thumbnail = file_get_contents($thumb_url);
+ if ($thumbnail) {
+ $prefix = "videolist/" . $video->guid;
+ $filehandler = new ElggFile();
+ $filehandler->owner_guid = $video->owner_guid;
+ $filehandler->setFilename($prefix . ".jpg");
+ $filehandler->open("write");
+ $filehandler->write($thumbnail);
+ $filehandler->close();
+ }
+ }
+
+ system_message(elgg_echo('videolist:saved'));
+
+ if ($new_video) {
+ add_to_river('river/object/videolist_item/create', 'create', elgg_get_logged_in_user_guid(), $video->guid);
+ }
+
+ forward($video->getURL());
+} else {
+ register_error(elgg_echo('videolist:error:no_save'));
+ forward(REFERER);
+}
diff --git a/mod/videolist/graphics/_videolist_icon_medium.png b/mod/videolist/graphics/_videolist_icon_medium.png
new file mode 100644
index 000000000..9cfc50fd8
--- /dev/null
+++ b/mod/videolist/graphics/_videolist_icon_medium.png
Binary files differ
diff --git a/mod/videolist/graphics/videolist_icon_medium.png b/mod/videolist/graphics/videolist_icon_medium.png
new file mode 100644
index 000000000..e567c70ed
--- /dev/null
+++ b/mod/videolist/graphics/videolist_icon_medium.png
Binary files differ
diff --git a/mod/videolist/graphics/videolist_icon_small.png b/mod/videolist/graphics/videolist_icon_small.png
new file mode 100644
index 000000000..507260f28
--- /dev/null
+++ b/mod/videolist/graphics/videolist_icon_small.png
Binary files differ
diff --git a/mod/videolist/graphics/videolist_icon_tiny.png b/mod/videolist/graphics/videolist_icon_tiny.png
new file mode 100644
index 000000000..2ea6e05f4
--- /dev/null
+++ b/mod/videolist/graphics/videolist_icon_tiny.png
Binary files differ
diff --git a/mod/videolist/languages/ca.php b/mod/videolist/languages/ca.php
new file mode 100644
index 000000000..289c1f44a
--- /dev/null
+++ b/mod/videolist/languages/ca.php
@@ -0,0 +1,40 @@
+<?php
+$language = array (
+ 'videolist' => 'Vídeos',
+ 'videolist:owner' => 'Vídeos de %s',
+ 'videolist:friends' => 'Vídeos dels amics',
+ 'videolist:all' => 'Tots els vídeos',
+ 'videolist:add' => 'Afegir vídeo',
+ 'videolist:group' => 'Vídeos del grup',
+ 'groups:enablevideolist' => 'Activar vídeos del grup',
+ 'videolist:edit' => 'Edita aquest vídeo',
+ 'videolist:delete' => 'Esborra aquest vídeo',
+ 'videolist:new' => 'Un nou vídeo',
+ 'videolist:notification' => '%s ha afegit un nou vídeo
+
+%s
+%s
+
+Veure i comentar al nou vídeo:
+%s',
+ 'videolist:delete:confirm' => 'Estàs segur de voler esborrar aquest vídeo?',
+ 'item:object:videolist_item' => 'Vídeo',
+ 'videolist:nogroup' => 'Aquest grup no té cap vídeo encara',
+ 'videolist:more' => 'Més vídeos',
+ 'videolist:none' => 'No hi ha cap vídeo',
+ 'river:create:object:videolist_item' => '%s ha creat el vídeo %s',
+ 'river:update:object:videolist_item' => '% ha actualitzat el vídeo %s',
+ 'river:comment:object:videolist_item' => '%s ha comentat al vídeo titulat %s',
+ 'videolist:title' => 'Títol',
+ 'videolist:description' => 'Descripció',
+ 'videolist:video_url' => 'Escriu la URL del vídeo',
+ 'videolist:access_id' => 'Qui pot veure que has penjat aquest vídeo?',
+ 'videolist:tags' => 'Afegir etiquetes',
+ 'videolist:error:no_save' => 'Hi ha hagut un error desant el vídeo, si us plau intenta-ho d\'aquí a una estona',
+ 'videolist:saved' => 'El teu vídeo s\'ha desat correctament!',
+ 'videolist:deleted' => 'El teu vídeo s\'ha esborrat correctament!',
+ 'videolist:deletefailed' => 'Malauradament, aquest vídeo no es pot esborrar ara. Si us plau, intenta-ho més tard',
+ 'videolist:num_videos' => 'Nombre de vídeos a mostrar',
+ 'videolist:widget:description' => 'La teva llista de reproducció de vídeos.',
+);
+add_translation("ca", $language); \ No newline at end of file
diff --git a/mod/videolist/languages/en.php b/mod/videolist/languages/en.php
new file mode 100644
index 000000000..d357725a7
--- /dev/null
+++ b/mod/videolist/languages/en.php
@@ -0,0 +1,78 @@
+<?php
+/**
+ * Elgg videolist english language pack.
+ *
+ * @package ElggVideolist
+ */
+
+$english = array(
+
+ /**
+ * Menu items and titles
+ */
+
+ 'videolist' => "Videos",
+ 'videolist:owner' => "%s's videos",
+ 'videolist:friends' => "Friends' videos",
+ 'videolist:all' => "All site videos",
+ 'videolist:add' => "Add a video",
+
+ 'videolist:group' => "Group videos",
+ 'groups:enablevideolist' => 'Enable group videos',
+
+ 'videolist:edit' => "Edit this video",
+ 'videolist:delete' => "Delete this video",
+
+ 'videolist:new' => "Add a video",
+ 'videolist:notification' =>
+'%s added a new video:
+
+%s
+%s
+
+View and comment on the new video:
+%s
+',
+ 'videolist:delete:confirm' => 'Are you sure you want to delete this video?',
+ 'item:object:videolist_item' => 'Video',
+ 'videolist:nogroup' => 'This group does not have any video yet',
+ 'videolist:more' => 'More videos',
+ 'videolist:none' => 'No videos posted yet.',
+
+ /**
+ * River
+ **/
+
+ 'river:create:object:videolist_item' => '%s created the video %s',
+ 'river:update:object:videolist_item' => '%s updated the video %s',
+ 'river:comment:object:videolist_item' => '%s commented on the video titled %s',
+
+ /**
+ * Form fields
+ */
+
+ 'videolist:title' => 'Title',
+ 'videolist:description' => 'Description',
+ 'videolist:video_url' => 'Enter video URL',
+ 'videolist:access_id' => 'Who can see you posted this video?',
+ 'videolist:tags' => 'Add tags',
+
+ /**
+ * Status and error messages
+ */
+ 'videolist:error:no_save' => 'There was an error in saving the video, please try after sometime',
+ 'videolist:saved' => 'Your video has been saved successfully!',
+ 'videolist:deleted' => 'Your video was removed successfully!',
+ 'videolist:deletefailed' => 'Unfortunately, this video could not be removed now. Please try again later',
+
+
+ /**
+ * Widget
+ **/
+
+ 'videolist:num_videos' => 'Number of videos to display',
+ 'videolist:widget:description' => 'Your personal video playlist.',
+
+);
+
+add_translation("en", $english);
diff --git a/mod/videolist/languages/es.php b/mod/videolist/languages/es.php
new file mode 100644
index 000000000..ad8cbe46c
--- /dev/null
+++ b/mod/videolist/languages/es.php
@@ -0,0 +1,40 @@
+<?php
+$language = array (
+ 'videolist' => 'Vídeos',
+ 'videolist:owner' => 'vídeos de %s',
+ 'videolist:friends' => 'Vídeos de amigos',
+ 'videolist:all' => 'Todos los vídeos',
+ 'videolist:add' => 'Añadir vídeo',
+ 'videolist:group' => 'Vídeos del grupo',
+ 'groups:enablevideolist' => 'Habilitar vídeos de grupo',
+ 'videolist:edit' => 'Editar este vídeo',
+ 'videolist:delete' => 'Eliminar este vídeo',
+ 'videolist:new' => 'Nuevo vídeo',
+ 'videolist:notification' => '%s ha añadido un nuevo vídeo:
+
+%s
+%s
+
+Ver y comentar el nuevo vídeo:
+%s',
+ 'videolist:delete:confirm' => 'Estas seguro de que quieres eliminar este vídeo?',
+ 'item:object:videolist_item' => 'Vídeo',
+ 'videolist:nogroup' => 'Este grupo no tiene ningún video todavía',
+ 'videolist:more' => 'Más videos',
+ 'videolist:none' => 'No hay videos colgados.',
+ 'river:create:object:videolist_item' => '%s ha creado el video %s',
+ 'river:update:object:videolist_item' => '%s ha actualizado el video %s',
+ 'river:comment:object:videolist_item' => '%s ha comentado en el video titulado %s',
+ 'videolist:title' => 'Título',
+ 'videolist:description' => 'Descripción',
+ 'videolist:video_url' => 'URL del video',
+ 'videolist:access_id' => 'Quien puede ver que has colgado el video?',
+ 'videolist:tags' => 'Añadir etiquetas',
+ 'videolist:error:no_save' => 'Ha habido un error guardando el video, por favor inténtalo más tarde',
+ 'videolist:saved' => '¡Tu video se ha guardado correctamente!',
+ 'videolist:deleted' => '¡Tu video se ha borrado correctamente!',
+ 'videolist:deletefailed' => 'Desafortunadamente este video no se puede borrar ahora. Por favor inténtalo más tarde de nuevo',
+ 'videolist:num_videos' => 'Número de videos a mostrar',
+ 'videolist:widget:description' => 'Tu lista personal de reproducción de videos.',
+);
+add_translation("es", $language); \ No newline at end of file
diff --git a/mod/videolist/languages/fr.php b/mod/videolist/languages/fr.php
new file mode 100644
index 000000000..c21495546
--- /dev/null
+++ b/mod/videolist/languages/fr.php
@@ -0,0 +1,28 @@
+<?php
+$fr = array (
+ 'videolist' => 'Mes videos',
+ 'videolist:home' => '%s \'s Videos',
+ 'videolist:new' => 'ajouter une video',
+ 'videolist:find' => 'toutes les videos',
+ 'videolist:search' => 'toutes les videos',
+ 'videolist:submit' => 'envoie',
+ 'videolist:widget' => 'Mes videos',
+ 'videolist:widget:description' => 'tes videos de youtube',
+ 'videolist:num_videos' => 'nombre de videos à afficher',
+ 'profile:videoheader' => 'ma galerie video',
+ 'videolist:tags' => 'ajoute des tags',
+ 'videolist:browse' => 'cherche des videos - %s',
+ 'videolist:browsemenu' => 'cherche des videos',
+ 'videolist:title_search_tube' => 'cherche des videos de',
+ 'videolist:searchTubeVideos' => 'cherche sur youtube.com',
+ 'videolist:comments' => 'commentaires',
+ 'videolist:commentspost' => 'poste',
+ 'videolist:river:item' => 'une video',
+ 'videolist:river:created' => '%s a ajouté',
+ 'videolist:group' => 'Videos',
+ 'videolist:groupall' => 'toutes les vidoes du groupe',
+ 'videolist:none' => 'ce groupe n\'as pas encore de videos',
+);
+
+add_translation("fr", $fr);
+
diff --git a/mod/videolist/languages/gl.php b/mod/videolist/languages/gl.php
new file mode 100644
index 000000000..90444e3fa
--- /dev/null
+++ b/mod/videolist/languages/gl.php
@@ -0,0 +1,29 @@
+<?php
+$gl = array (
+ 'videolist' => 'Os meus vídeos',
+ 'videolist:home' => 'Vídeos de %s',
+ 'videolist:new' => 'Engadir vídeos',
+ 'videolist:find' => 'Vídeos de toda a rede',
+ 'videolist:search' => 'Procurar vídeos',
+ 'videolist:submit' => 'Aceptar',
+ 'videolist:widget' => 'Os meus vídeos',
+ 'videolist:widget:description' => 'Podes comparti-la túa galería de vídeos personalizada co resto da rede',
+ 'videolist:num_videos' => 'Número de vídeos a mostrar',
+ 'profile:videoheader' => 'As miñas galerías de vídeos',
+ 'videolist:tags' => 'Engadir etiquetas',
+ 'videolist:browse' => 'Procura-los vídeos de %s',
+ 'videolist:browsemenu' => 'Procurar vídeos',
+ 'videolist:title_search_tube' => 'Procurar vídeos en:',
+ 'videolist:searchTubeVideos' => 'Procurar en youtube',
+ 'videolist:comments' => 'Comentarios',
+ 'videolist:commentspost' => 'Entrada',
+ 'videolist:river:item' => 'un vídeo titulado:',
+ 'videolist:river:created' => '%s engadiu',
+ 'videolist:group' => 'Vídeos do grupo',
+ 'videolist:groupall' => 'Tódolos vídeos do grupo',
+ 'videolist:none' => 'O non hai vídeos subidos.',
+ 'videolist:edit' => 'Editar vídeo %s',
+);
+
+add_translation("gl", $gl);
+
diff --git a/mod/videolist/languages/pt.php b/mod/videolist/languages/pt.php
new file mode 100644
index 000000000..e8b28c182
--- /dev/null
+++ b/mod/videolist/languages/pt.php
@@ -0,0 +1,50 @@
+<?php
+$pt = array (
+ 'videolist' => 'Meus vídeos',
+ 'videolist:home' => 'Vídeos de %s',
+ 'videolist:new' => 'Adicionar vídeo',
+ 'videolist:find' => 'Todos os vídeos',
+ 'videolist:search' => 'Todos os vídeos',
+ 'videolist:submit' => 'Publicar',
+ 'videolist:widget' => 'Meus Vídeos',
+ 'videolist:num_videos' => 'Número de visto a visualizar',
+ 'profile:videoheader' => 'Minha galeria de vídeos',
+ 'videolist:tags' => 'Adicionar etiquetas',
+ 'videolist:browse' => 'Procurar vídeos - %s',
+ 'videolist:browsemenu' => 'Procurar vídeos',
+ 'videolist:title_search_tube' => 'Procurar vídeos de',
+ 'videolist:searchTubeVideos' => 'Procurar no youtube',
+ 'videolist:comments' => 'Comentários',
+ 'videolist:commentspost' => 'Publicar',
+ 'videolist:river:item' => 'um video',
+ 'videolist:river:created' => 'adicionado por %s',
+ 'videolist:group' => 'Vídeos',
+ 'videolist:groupall' => 'Todos os vídeos do grupo',
+ 'videolist:none' => 'Este grupo ainda não tem vídeos',
+ 'videolist:user' => 'Vídeos de %s',
+ 'videolist:all' => 'Todos vídeos',
+ 'videolist:add' => 'Adicionar um vídeo',
+ 'videolist:play:video' => 'Tocar',
+ 'videolist:add:video' => 'Adicionar',
+ 'videolist:friends' => 'Vídeos dos amigos',
+ 'videolist:edit' => 'Editar vídeos',
+ 'videolist:ingroup' => 'na comunidade',
+ 'videolist:title' => 'Título',
+ 'videolist:description' => 'Descrição',
+ 'videolist:video_url' => 'Entrar um endereço do vídeo',
+ 'videolist:error:no_save' => 'Ocorreu um erro ao salvar o vídeo, por favor tente mais tarde',
+ 'videolist:saved' => 'Seu vídeo foi salvo com sucesso!',
+ 'videolist_item:more' => 'Ver todos vídeos',
+ 'videolist_item:none' => 'desculpe, nenhum vídeo foi encontrado',
+ 'videolist:deleted' => 'Seu vídeo foi removido com sucesso!',
+ 'videolist:deletefailed' => 'Infelizmente, este vídeo não pode ser removido agora. Por favor, tente mais tarde.',
+ 'videolist:widget:description' => 'Demonstre sua galeira de vídeos pessoas do youtube',
+ 'videolist:access_id' => 'Quem pode ver que você enviou este vídeo?',
+ 'item:object:videolist_item' => 'Vídeos',
+ 'river:create:object:videolist_item' => '%s adicionou o vídeo %s',
+ 'river:comment:object:videolist_item' => '%s comentou em %s',
+ 'videolist:delete:confirm' => 'Você tem certeza que deseja apagar este vídeo?',
+);
+
+add_translation("pt", $pt);
+
diff --git a/mod/videolist/lib/Videolist/Platform/Bliptv.php b/mod/videolist/lib/Videolist/Platform/Bliptv.php
new file mode 100644
index 000000000..62cefbd39
--- /dev/null
+++ b/mod/videolist/lib/Videolist/Platform/Bliptv.php
@@ -0,0 +1,38 @@
+<?php
+
+class Videolist_Platform_Bliptv implements Videolist_PlatformInterface
+{
+ public function getType()
+ {
+ return "bliptv";
+ }
+
+ public function parseUrl($url)
+ {
+ $parsed = parse_url($url);
+ $path = explode('/', $parsed['path']);
+
+ if ($parsed['host'] != 'blip.tv' || count($path) < 3) {
+ return false;
+ }
+
+ return array(
+ 'video_id' => $parsed['path'],
+ );
+ }
+
+ public function getData($parsed)
+ {
+ $video_id = $parsed['video_id'];
+
+ $buffer = file_get_contents('https://blip.tv'.$video_id.'?skin=rss');
+ $xml = new SimpleXMLElement($buffer);
+
+ return array(
+ 'title' => current($xml->xpath('/rss/channel/item/title')),
+ 'description' => strip_tags(current($xml->xpath('/rss/channel/item/description'))),
+ 'thumbnail' => current($xml->xpath('/rss/channel/item/media:thumbnail/@url')),
+ 'embedurl' => current($xml->xpath('/rss/channel/item/blip:embedUrl')),
+ );
+ }
+}
diff --git a/mod/videolist/lib/Videolist/Platform/Gisstv.php b/mod/videolist/lib/Videolist/Platform/Gisstv.php
new file mode 100644
index 000000000..b79898449
--- /dev/null
+++ b/mod/videolist/lib/Videolist/Platform/Gisstv.php
@@ -0,0 +1,50 @@
+<?php
+
+class Videolist_Platform_Gisstv implements Videolist_PlatformInterface
+{
+ public function getType()
+ {
+ return "gisstv";
+ }
+
+ public function parseUrl($url)
+ {
+ $parsed = parse_url($url);
+ $path = explode('/', $parsed['path']);
+
+ if ($parsed['host'] != 'giss.tv' || $path[1] != 'dmmdb') {
+ return false;
+ }
+
+ if($path[2] == 'contents' && isset($path[3])) {
+ $video_id = $path[3];
+ } elseif($path[3] == 'contents' && isset($path[4])) {
+ $video_id = $path[4];
+ } else {
+ return false;
+ }
+
+ return array(
+ 'video_id' => $video_id,
+ );
+ }
+
+ public function getData($parsed)
+ {
+ $video_id = $parsed['video_id'];
+
+ $buffer = file_get_contents('http://giss.tv/dmmdb//rss.php');
+ $xml = new SimpleXMLElement($buffer);
+
+ $data = array();
+ foreach($xml->xpath('/rss/channel/item') as $item){
+ if ($item->link === 'http://giss.tv/dmmdb//contents/'.$video_id) {
+ $data['title'] = $item->title;
+ $data['description'] = strip_tags($item->description);
+ $data['thumbnail'] = $item->thumbnail;
+ break;
+ }
+ }
+ return $data;
+ }
+}
diff --git a/mod/videolist/lib/Videolist/Platform/Metacafe.php b/mod/videolist/lib/Videolist/Platform/Metacafe.php
new file mode 100644
index 000000000..74a346b34
--- /dev/null
+++ b/mod/videolist/lib/Videolist/Platform/Metacafe.php
@@ -0,0 +1,38 @@
+<?php
+
+class Videolist_Platform_Metacafe implements Videolist_PlatformInterface
+{
+ public function getType()
+ {
+ return "metacafe";
+ }
+
+ public function parseUrl($url)
+ {
+ $parsed = parse_url($url);
+ $path = explode('/', $parsed['path']);
+
+ if ($parsed['host'] != 'www.metacafe.com' || $path[1] != 'watch' || !(int) $path[2]) {
+ return false;
+ }
+
+ return array(
+ 'video_id' => $path[2],
+ );
+ }
+
+ public function getData($parsed)
+ {
+ $video_id = $parsed['video_id'];
+
+ $buffer = file_get_contents("https://www.metacafe.com/api/item/$video_id");
+ $xml = new SimpleXMLElement($buffer);
+
+ return array(
+ 'title' => current($xml->xpath('/rss/channel/item/title')),
+ 'description' => strip_tags(current($xml->xpath('/rss/channel/item/description'))),
+ 'thumbnail' => current($xml->xpath('/rss/channel/item/media:thumbnail/@url')),
+ 'embedurl' => current($xml->xpath('/rss/channel/item/media:content/@url')),
+ );
+ }
+}
diff --git a/mod/videolist/lib/Videolist/Platform/Vimeo.php b/mod/videolist/lib/Videolist/Platform/Vimeo.php
new file mode 100644
index 000000000..6930cdb2d
--- /dev/null
+++ b/mod/videolist/lib/Videolist/Platform/Vimeo.php
@@ -0,0 +1,40 @@
+<?php
+
+class Videolist_Platform_Vimeo implements Videolist_PlatformInterface
+{
+ public function getType()
+ {
+ return "vimeo";
+ }
+
+ public function parseUrl($url)
+ {
+ $parsed = parse_url($url);
+ $path = explode('/', $parsed['path']);
+
+ if ($parsed['host'] != 'vimeo.com' || !(int) $path[1]) {
+ return false;
+ }
+
+ return array(
+ 'video_id' => $path[1],
+ );
+ }
+
+ public function getData($parsed)
+ {
+ $video_id = $parsed['video_id'];
+
+ $buffer = file_get_contents("https://vimeo.com/api/v2/video/$video_id.xml");
+ $xml = new SimpleXMLElement($buffer);
+
+ $videos = $xml->children();
+ $video = $videos[0];
+
+ return array(
+ 'title' => $video->title,
+ 'description' => strip_tags($video->description),
+ 'thumbnail' => $video->thumbnail_medium,
+ );
+ }
+}
diff --git a/mod/videolist/lib/Videolist/Platform/Youtube.php b/mod/videolist/lib/Videolist/Platform/Youtube.php
new file mode 100644
index 000000000..31a4bc950
--- /dev/null
+++ b/mod/videolist/lib/Videolist/Platform/Youtube.php
@@ -0,0 +1,49 @@
+<?php
+
+class Videolist_Platform_Youtube implements Videolist_PlatformInterface
+{
+ public function getType()
+ {
+ return "youtube";
+ }
+
+ public function parseUrl($url)
+ {
+ $parsed = parse_url($url);
+ $id = '';
+ if (! empty($parsed['host'])) {
+ if ($parsed['host'] === 'youtu.be') {
+ // short URLs
+ $id = substr($parsed['path'], 1);
+ } elseif ($parsed['host'] === 'www.youtube.com'
+ && $parsed['path'] === '/watch'
+ && ! empty($parsed['query'])) {
+ // long URLs
+ parse_str($parsed['query'], $query);
+ if (! empty($query['v'])) {
+ $id = $query['v'];
+ }
+ }
+ }
+ if ($id) {
+ return array(
+ 'video_id' => $id,
+ );
+ }
+ return false;
+ }
+
+ public function getData($parsed)
+ {
+ $video_id = $parsed['video_id'];
+
+ $buffer = file_get_contents('https://gdata.youtube.com/feeds/api/videos/'.$video_id);
+ $xml = new SimpleXMLElement($buffer);
+
+ return array(
+ 'title' => $xml->title,
+ 'description' => strip_tags($xml->content),
+ 'thumbnail' => "https://img.youtube.com/vi/$video_id/default.jpg",
+ );
+ }
+}
diff --git a/mod/videolist/lib/Videolist/PlatformInterface.php b/mod/videolist/lib/Videolist/PlatformInterface.php
new file mode 100644
index 000000000..25ca019e9
--- /dev/null
+++ b/mod/videolist/lib/Videolist/PlatformInterface.php
@@ -0,0 +1,23 @@
+<?php
+
+interface Videolist_PlatformInterface {
+ /**
+ * @abstract
+ * @return string
+ */
+ public function getType();
+
+ /**
+ * @abstract
+ * @param string $url
+ * @return array
+ */
+ public function parseUrl($url);
+
+ /**
+ * @abstract
+ * @param array $parsed
+ * @return array
+ */
+ public function getData($parsed);
+}
diff --git a/mod/videolist/lib/videolist.php b/mod/videolist/lib/videolist.php
new file mode 100644
index 000000000..b86db99cf
--- /dev/null
+++ b/mod/videolist/lib/videolist.php
@@ -0,0 +1,46 @@
+<?php
+
+/**
+ * @return array
+ */
+function videolist_get_default_platforms() {
+ static $platforms = array();
+ if (! $platforms) {
+ require dirname(__FILE__) . '/Videolist/PlatformInterface.php';
+ $path = dirname(__FILE__) . '/Videolist/Platform';
+ foreach (scandir($path) as $filename) {
+ if (preg_match('/^(\\w+)\\.php$/', $filename, $m)) {
+ require "$path/$filename";
+ $class = 'Videolist_Platform_' . $m[1];
+ $platform = new $class();
+ if ($platform instanceof Videolist_PlatformInterface) {
+ /* @var Videolist_PlatformInterface $platform */
+ $platforms[$platform->getType()][] = $platform;
+ }
+ }
+ }
+ }
+ return $platforms;
+}
+
+/**
+ * @param string $url
+ * @return array [parsed, platform]
+ */
+function videolist_parse_url($url) {
+ $params = array(
+ 'url' => $url,
+ );
+ $platforms = videolist_get_default_platforms();
+ $platforms = elgg_trigger_plugin_hook('videolist:prepare', 'platforms', $params, $platforms);
+ foreach ($platforms as $list) {
+ foreach ($list as $platform) {
+ /* @var Videolist_PlatformInterface $platform */
+ $parsed = $platform->parseUrl($url);
+ if ($parsed) {
+ return array($parsed, $platform);
+ }
+ }
+ }
+ return false;
+}
diff --git a/mod/videolist/manifest.xml b/mod/videolist/manifest.xml
new file mode 100644
index 000000000..08539650a
--- /dev/null
+++ b/mod/videolist/manifest.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8">
+ <name>Videolist</name>
+ <author>Prateek Choudhary, Core developers, Lorea developers</author>
+ <version>1.8.1</version>
+ <category>lorea</category>
+ <category>content</category>
+ <category>multimedia</category>
+ <description>This plugin allows users to create a library of videos.</description>
+ <website>https://lorea.org/</website>
+ <copyright>(C) Prateek Choudhary 2008-09, Elgg 2010, Lorea 2011-13</copyright>
+ <license>GNU Public License version 2</license>
+ <requires>
+ <type>elgg_release</type>
+ <version>1.8</version>
+ </requires>
+ <activate_on_install>true</activate_on_install>
+</plugin_manifest>
diff --git a/mod/videolist/pages/videolist/add.php b/mod/videolist/pages/videolist/add.php
new file mode 100644
index 000000000..6dd6a2f1f
--- /dev/null
+++ b/mod/videolist/pages/videolist/add.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * Add a new video
+ *
+ * @package ElggVideolist
+ */
+
+$page_owner = elgg_get_page_owner_entity();
+
+gatekeeper();
+group_gatekeeper();
+
+$title = elgg_echo('videolist:add');
+
+// set up breadcrumbs
+elgg_push_breadcrumb(elgg_echo('videolist'), "file/all");
+if (elgg_instanceof($page_owner, 'user')) {
+ elgg_push_breadcrumb($page_owner->name, "videolist/owner/$page_owner->username");
+} else {
+ elgg_push_breadcrumb($page_owner->name, "videolist/group/$page_owner->guid/all");
+}
+elgg_push_breadcrumb($title);
+
+// create form
+$form_vars = array();
+$body_vars = array(
+ 'container_guid' => $page_owner->guid,
+ 'access_id' => elgg_instanceof($page_owner, 'user') ? ACCESS_DEFAULT : $page_owner->group_acl,
+);
+
+$content = elgg_view_form('videolist/edit', $form_vars, $body_vars);
+
+$body = elgg_view_layout('content', array(
+ 'content' => $content,
+ 'title' => $title,
+ 'filter' => '',
+));
+
+echo elgg_view_page($title, $body);
diff --git a/mod/videolist/pages/videolist/all.php b/mod/videolist/pages/videolist/all.php
new file mode 100644
index 000000000..6fe68f3eb
--- /dev/null
+++ b/mod/videolist/pages/videolist/all.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * All videos
+ *
+ * @package ElggVideolist
+ */
+
+elgg_push_breadcrumb(elgg_echo('videolist'));
+
+elgg_register_title_button();
+
+$limit = get_input("limit", 10);
+
+$title = elgg_echo('videolist:all');
+
+$content = elgg_list_entities(array(
+ 'types' => 'object',
+ 'subtypes' => 'videolist_item',
+ 'limit' => $limit,
+ 'full_view' => FALSE
+));
+
+$sidebar = elgg_view('videolist/sidebar');
+
+elgg_set_context('videolist');
+$body = elgg_view_layout('content', array(
+ 'filter_context' => 'all',
+ 'content' => $content,
+ 'title' => $title,
+ 'sidebar' => $sidebar,
+));
+
+// Finally draw the page
+echo elgg_view_page($title, $body);
diff --git a/mod/videolist/pages/videolist/edit.php b/mod/videolist/pages/videolist/edit.php
new file mode 100644
index 000000000..916d9d280
--- /dev/null
+++ b/mod/videolist/pages/videolist/edit.php
@@ -0,0 +1,49 @@
+<?php
+/**
+ * Edit a videolist item
+ *
+ * @package ElggVideolist
+ */
+
+gatekeeper();
+
+$guid = (int) get_input('guid');
+$videolist_item = get_entity($guid);
+if (!$videolist_item) {
+ forward();
+}
+if (!$videolist_item->canEdit()) {
+ forward();
+}
+
+$title = elgg_echo('videolist:edit');
+$container = get_entity($videolist_item->getContainerGUID());
+
+elgg_push_breadcrumb(elgg_echo('videolist'), "videolist/all");
+if(elgg_instanceof($container, 'user')){
+ elgg_push_breadcrumb($container->name, "videolist/owner/$container->username/");
+} else {
+ elgg_push_breadcrumb($container->name, "videolist/group/$container->guid/");
+}
+elgg_push_breadcrumb($videolist_item->title, $videolist_item->getURL());
+elgg_push_breadcrumb($title);
+
+elgg_set_page_owner_guid($container->guid);
+
+$form_vars = array();
+$body_vars = array('guid' => $guid);
+
+foreach(array_keys(elgg_get_config('videolist')) as $variable) {
+ $body_vars[$variable] = $videolist_item->$variable;
+}
+$body_vars['container_guid'] = $videolist_item->container_guid;
+
+$content = elgg_view_form('videolist/edit', $form_vars, $body_vars);
+
+$body = elgg_view_layout('content', array(
+ 'content' => $content,
+ 'title' => $title,
+ 'filter' => '',
+));
+
+echo elgg_view_page($title, $body);
diff --git a/mod/videolist/pages/videolist/friends.php b/mod/videolist/pages/videolist/friends.php
new file mode 100644
index 000000000..8bbb34698
--- /dev/null
+++ b/mod/videolist/pages/videolist/friends.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Friends Videolist
+ *
+ * @package ElggVideolist
+ */
+
+$page_owner = elgg_get_page_owner_entity();
+
+elgg_push_breadcrumb(elgg_echo('videolist'), "videolist/all");
+elgg_push_breadcrumb($page_owner->name, "videolist/owner/$page_owner->username");
+elgg_push_breadcrumb(elgg_echo('friends'));
+
+elgg_register_title_button();
+
+$title = elgg_echo("videolist:friends");
+
+// offset is grabbed in list_user_friends_objects
+$content = list_user_friends_objects($page_owner->guid, 'videolist_items', 10, false);
+if (!$content) {
+ $content = elgg_echo("videolist:none");
+}
+
+$sidebar = elgg_view('videolist/sidebar', array());
+
+$body = elgg_view_layout('content', array(
+ 'filter_context' => 'friends',
+ 'content' => $content,
+ 'title' => $title,
+ 'sidebar' => $sidebar,
+));
+
+echo elgg_view_page($title, $body);
diff --git a/mod/videolist/pages/videolist/owner.php b/mod/videolist/pages/videolist/owner.php
new file mode 100644
index 000000000..74917354e
--- /dev/null
+++ b/mod/videolist/pages/videolist/owner.php
@@ -0,0 +1,54 @@
+<?php
+/**
+ * Individual's or group's videolist
+ *
+ * @package ElggVideolist
+ */
+
+// access check for closed groups
+group_gatekeeper();
+
+$page_owner = elgg_get_page_owner_entity();
+
+elgg_push_breadcrumb(elgg_echo('videolist'), "videolist/all");
+elgg_push_breadcrumb($page_owner->name);
+
+elgg_register_title_button();
+
+$params = array();
+
+if ($page_owner->guid == elgg_get_logged_in_user_guid()) {
+ // user looking at own videolist
+ $params['filter_context'] = 'mine';
+} else if (elgg_instanceof($page_owner, 'user')) {
+ // someone else's videolist
+ // do not show select a tab when viewing someone else's posts
+ $params['filter_context'] = 'none';
+} else {
+ // group videolist
+ $params['filter'] = '';
+}
+
+$title = elgg_echo("videolist:owner", array($page_owner->name));
+
+// List videolist
+$content = elgg_list_entities(array(
+ 'types' => 'object',
+ 'subtypes' => 'videolist_item',
+ 'container_guid' => $page_owner->guid,
+ 'limit' => 10,
+ 'full_view' => FALSE,
+));
+if (!$content) {
+ $content = elgg_echo("videolist:none");
+}
+
+$sidebar = elgg_view('videolist/sidebar');
+
+$params['content'] = $content;
+$params['title'] = $title;
+$params['sidebar'] = $sidebar;
+
+$body = elgg_view_layout('content', $params);
+
+echo elgg_view_page($title, $body);
diff --git a/mod/videolist/pages/videolist/watch.php b/mod/videolist/pages/videolist/watch.php
new file mode 100644
index 000000000..3a740f396
--- /dev/null
+++ b/mod/videolist/pages/videolist/watch.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * View a file
+ *
+ * @package ElggFile
+ */
+
+$videolist_item = get_entity(get_input('guid'));
+
+elgg_set_page_owner_guid($videolist_item->container_guid);
+
+$page_owner = elgg_get_page_owner_entity();
+
+elgg_push_breadcrumb(elgg_echo('videolist'), 'videolist/all');
+
+$crumbs_title = $page_owner->name;
+if (elgg_instanceof($page_owner, 'group')) {
+ elgg_push_breadcrumb($crumbs_title, "videolist/group/$page_owner->guid/all");
+} else {
+ elgg_push_breadcrumb($crumbs_title, "videolist/owner/$page_owner->username");
+}
+
+$title = $videolist_item->title;
+
+elgg_push_breadcrumb($title);
+
+$content = elgg_view_entity($videolist_item, array('full_view' => true));
+$content .= elgg_view_comments($videolist_item);
+
+$sidebar = elgg_view('videolist/sidebar', array(
+ 'show_comments' => false,
+ 'show_videolist' => true,
+));
+
+$body = elgg_view_layout('content', array(
+ 'content' => $content,
+ 'title' => $title,
+ 'filter' => '',
+ 'sidebar' => $sidebar,
+));
+
+echo elgg_view_page($title, $body);
diff --git a/mod/videolist/start.php b/mod/videolist/start.php
new file mode 100644
index 000000000..6f94b97d0
--- /dev/null
+++ b/mod/videolist/start.php
@@ -0,0 +1,328 @@
+<?php
+/**
+ * Elgg Video Plugin
+ * This plugin allows users to create a library of videos
+ *
+ * @package Elgg
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary <synapticfield@gmail.com>
+ * @copyright Prateek Choudhary
+ */
+
+elgg_register_event_handler('init', 'system', 'videolist_init');
+
+function videolist_init() {
+
+ elgg_register_library('elgg:videolist', elgg_get_plugins_path() . 'videolist/lib/videolist.php');
+
+ // add a site navigation item
+ $item = new ElggMenuItem('videolist', elgg_echo('videolist'), 'videolist/all');
+ elgg_register_menu_item('site', $item);
+
+ // Extend system CSS with our own styles
+ elgg_extend_view('css/elgg','videolist/css');
+
+ // Register a page handler, so we can have nice URLs
+ elgg_register_page_handler('videolist', 'videolist_page_handler');
+
+ // Language short codes must be of the form "videolist:key"
+ // where key is the array key below
+ elgg_set_config('videolist', array(
+ 'video_url' => 'url',
+ 'title' => 'text',
+ 'description' => 'longtext',
+ 'tags' => 'tags',
+ 'access_id' => 'access',
+ ));
+
+ // add to groups
+ add_group_tool_option('videolist', elgg_echo('groups:enablevideolist'), true);
+ elgg_extend_view('groups/tool_latest', 'videolist/group_module');
+
+ //add a widget
+ elgg_register_widget_type('videolist', elgg_echo('videolist'), elgg_echo('videolist:widget:description'));
+
+ // Register granular notification for this type
+ register_notification_object('object', 'videolist_item', elgg_echo('videolist:new'));
+
+ // Register entity type for search
+ elgg_register_entity_type('object', 'videolist_item');
+
+ // add a file link to owner blocks
+ elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'videolist_owner_block_menu');
+ elgg_register_event_handler('annotate','all','videolist_object_notifications');
+
+ elgg_register_plugin_hook_handler('object:notifications','object','videolist_object_notifications_intercept');
+
+ //register entity url handler
+ elgg_register_entity_url_handler('object', 'videolist_item', 'videolist_url');
+ elgg_register_plugin_hook_handler('entity:icon:url', 'object', 'videolist_icon_url_override');
+
+ // register for embed
+ elgg_register_plugin_hook_handler('embed_get_sections', 'all', 'videolist_embed_get_sections');
+ elgg_register_plugin_hook_handler('embed_get_items', 'videolist', 'videolist_embed_get_items');
+
+ // handle URLs without scheme
+ elgg_register_plugin_hook_handler('videolist:preprocess', 'url', 'videolist_preprocess_url');
+
+ // Register actions
+ $actions_path = elgg_get_plugins_path() . "videolist/actions/videolist";
+ elgg_register_action("videolist/add", "$actions_path/add.php");
+ elgg_register_action("videolist/edit", "$actions_path/edit.php");
+ elgg_register_action("videolist/delete", "$actions_path/delete.php");
+
+ elgg_register_event_handler('upgrade', 'system', 'videolist_run_upgrades');
+}
+
+/**
+ * Dispatches blog pages.
+ * URLs take the form of
+ * All videos: videolist/all
+ * User's videos: videolist/owner/<username>
+ * Friends' videos: videolist/friends/<username>
+ * Video watch: videolist/watch/<guid>/<title>
+ * Video browse: videolist/browse
+ * New video: videolist/add/<guid>
+ * Edit video: videolist/edit/<guid>
+ * Group videos: videolist/group/<guid>/all
+ *
+ * Title is ignored
+ *
+ * @param array $page
+ * @return NULL
+ */
+function videolist_page_handler($page) {
+
+ if (!isset($page[0])) {
+ $page[0] = 'all';
+ }
+
+ $videolist_dir = elgg_get_plugins_path() . 'videolist/pages/videolist';
+
+ $page_type = $page[0];
+ switch ($page_type) {
+ case 'owner':
+ include "$videolist_dir/owner.php";
+ break;
+ case 'friends':
+ include "$videolist_dir/friends.php";
+ break;
+ case 'watch':
+ set_input('guid', $page[1]);
+ include "$videolist_dir/watch.php";
+ break;
+ case 'add':
+ include "$videolist_dir/add.php";
+ break;
+ case 'edit':
+ set_input('guid', $page[1]);
+ include "$videolist_dir/edit.php";
+ break;
+ case 'group':
+ include "$videolist_dir/owner.php";
+ break;
+ case 'all':
+ default:
+ include "$videolist_dir/all.php";
+ break;
+ }
+ return true;
+}
+
+/**
+ * Add a menu item to the user ownerblock
+ *
+ * @param string $hook
+ * @param string $type
+ * @param array $return
+ * @param array $params
+ * @return array
+ */
+function videolist_owner_block_menu($hook, $type, $return, $params) {
+ if (elgg_instanceof($params['entity'], 'user')) {
+ $url = "videolist/owner/{$params['entity']->username}";
+ $item = new ElggMenuItem('videolist', elgg_echo('videolist'), $url);
+ $return[] = $item;
+ } else {
+ if ($params['entity']->videolist_enable != "no") {
+ $url = "videolist/group/{$params['entity']->guid}/all";
+ $item = new ElggMenuItem('videolist', elgg_echo('videolist:group'), $url);
+ $return[] = $item;
+ }
+ }
+
+ return $return;
+}
+
+/**
+ * @param ElggObject $videolist_item
+ * @return string
+ */
+function videolist_url($videolist_item) {
+ $guid = $videolist_item->guid;
+ $title = elgg_get_friendly_title($videolist_item->title);
+ return elgg_get_site_url() . "videolist/watch/$guid/$title";
+}
+
+/**
+ * Event handler for videolist
+ *
+ * @param string $event
+ * @param string $object_type
+ * @param ElggObject $object
+ */
+function videolist_object_notifications($event, $object_type, $object) {
+ static $flag;
+ if (!isset($flag)) {
+ $flag = 0;
+ }
+
+ if (is_callable('object_notifications')) {
+ if ($object instanceof ElggObject) {
+ if ($object->getSubtype() == 'videolist_item') {
+ if ($flag == 0) {
+ $flag = 1;
+ object_notifications($event, $object_type, $object);
+ }
+ }
+ }
+ }
+}
+
+/**
+ * Intercepts the notification on an event of new video being created and prevents a notification from going out
+ * (because one will be sent on the annotation)
+ *
+ * @param string $hook
+ * @param string $entity_type
+ * @param array $returnvalue
+ * @param array $params
+ * @return bool
+ */
+function videolist_object_notifications_intercept($hook, $entity_type, $returnvalue, $params) {
+ if (isset($params)) {
+ if ($params['event'] == 'create' && $params['object'] instanceof ElggObject) {
+ if ($params['object']->getSubtype() == 'videolist_item') {
+ return true;
+ }
+ }
+ }
+ return null;
+}
+
+
+/**
+ * Register videolist as an embed type.
+ *
+ * @param string $hook
+ * @param string $type
+ * @param array $value
+ * @param array $params
+ * @return array
+ */
+function videolist_embed_get_sections($hook, $type, $value, $params) {
+ $value['videolist'] = array(
+ 'name' => elgg_echo('videolist'),
+ 'layout' => 'list',
+ 'icon_size' => 'medium',
+ );
+
+ return $value;
+}
+
+/**
+ * Return a list of videos for embedding
+ *
+ * @param string $hook
+ * @param string $type
+ * @param array $value
+ * @param array $params
+ * @return array
+ */
+function videolist_embed_get_items($hook, $type, $value, $params) {
+ $options = array(
+ 'owner_guid' => elgg_get_logged_in_user_guid(),
+ 'type_subtype_pair' => array('object' => 'videolist_item'),
+ 'count' => TRUE
+ );
+
+ $count = elgg_get_entities($options);
+ $value['count'] += $count;
+
+ unset($options['count']);
+ $options['offset'] = $params['offset'];
+ $options['limit'] = $params['limit'];
+
+ $items = elgg_get_entities($options);
+
+ $value['items'] = array_merge($items, $value['items']);
+
+ return $value;
+}
+
+/**
+ * Override the default entity icon for videoslist items
+ *
+ * @param string $hook
+ * @param string $type
+ * @param string $returnvalue
+ * @param array $params
+ * @return string Relative URL
+ */
+function videolist_icon_url_override($hook, $type, $returnvalue, $params) {
+
+ // if someone already set this, quit
+ if ($return_value) {
+ return null;
+ }
+
+ $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;
+}
+
+/**
+ * Prepend HTTP scheme if missing
+ * @param string $hook
+ * @param string $type
+ * @param string $returnvalue
+ * @param array $params
+ * @return string
+ */
+function videolist_preprocess_url($hook, $type, $returnvalue, $params) {
+ $parsed = parse_url($returnvalue);
+ if (empty($parsed['host']) && ! empty($parsed['path']) && $parsed['path'][0] !== '/') {
+ // user probably forgot scheme
+ $returnvalue = 'https://' . $returnvalue;
+ }
+ return $returnvalue;
+}
+
+/**
+ * Process upgrades for the videolist plugin
+ */
+function videolist_run_upgrades($event, $type, $details) {
+ if (include_once(elgg_get_plugins_path() . 'upgrade-tools/lib/upgrade_tools.php')) {
+ upgrade_module_run('videolist');
+ }
+}
diff --git a/mod/videolist/thumbnail.php b/mod/videolist/thumbnail.php
new file mode 100644
index 000000000..7a4ca8b6c
--- /dev/null
+++ b/mod/videolist/thumbnail.php
@@ -0,0 +1,64 @@
+<?php
+/**
+ * Elgg profile icon cache/bypass
+ *
+ *
+ * @package ElggProfile
+ */
+
+// Get DB settings
+require_once(dirname(dirname(dirname(__FILE__))). '/engine/settings.php');
+
+global $CONFIG;
+
+// won't be able to serve anything if no joindate or guid
+if (!isset($_GET['joindate']) || !isset($_GET['guid'])) {
+ header("HTTP/1.1 404 Not Found");
+ exit;
+}
+
+$join_date = (int)$_GET['joindate'];
+$owner_guid = (int)$_GET['owner_guid'];
+$guid = (int)$_GET['guid'];
+
+$mysql_dblink = @mysql_connect($CONFIG->dbhost, $CONFIG->dbuser, $CONFIG->dbpass, true);
+if ($mysql_dblink) {
+ if (@mysql_select_db($CONFIG->dbname, $mysql_dblink)) {
+ $result = mysql_query("select name, value from {$CONFIG->dbprefix}datalists where name='dataroot'", $mysql_dblink);
+ if ($result) {
+ $row = mysql_fetch_object($result);
+ while ($row) {
+ if ($row->name == 'dataroot') {
+ $data_root = $row->value;
+ }
+ $row = mysql_fetch_object($result);
+ }
+ }
+
+ @mysql_close($mysql_dblink);
+
+ if (isset($data_root)) {
+
+ // this depends on ElggDiskFilestore::makeFileMatrix()
+ $user_path = date('Y/m/d/', $join_date) . $owner_guid;
+
+ $filename = "$data_root$user_path/videolist/{$guid}.jpg";
+ $size = @filesize($filename);
+ if ($size) {
+ header("Content-type: image/jpeg");
+ header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', strtotime("+6 months")), true);
+ header("Pragma: public");
+ header("Cache-Control: public");
+ header("Content-Length: $size");
+ readfile($filename);
+ exit;
+ }
+ }
+ }
+
+}
+
+// something went wrong so load engine and try to forward to default icon
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+elgg_log("Profile icon direct failed.", "WARNING");
+forward("mod/videolist/graphics/videolist_icon_{$size}.png");
diff --git a/mod/videolist/upgrades/2012022501.php b/mod/videolist/upgrades/2012022501.php
new file mode 100644
index 000000000..f832c8033
--- /dev/null
+++ b/mod/videolist/upgrades/2012022501.php
@@ -0,0 +1,82 @@
+<?php
+/**
+ * Download the video thumbnail in the server and link it to video
+ *
+ * First determine if the upgrade is needed and then if needed, batch the update
+ */
+
+$items = elgg_get_entities(array(
+ 'type' => 'object',
+ 'subtype' => 'videolist',
+ 'limit' => 5,
+ 'order_by' => 'e.time_created asc',
+));
+
+// if not items, no upgrade required
+if (!$items) {
+ return;
+}
+
+/**
+ * Downloads the thumbnail and saves into data folder
+ *
+ * @param ElggObject $item
+ * @return bool
+ */
+function videolist_2012022501($item) {
+ require_once(elgg_get_plugins_path() . 'upgrade-tools/lib/upgrade_tools.php');
+
+ // get thumbnail image
+ $thumbnail = file_get_contents($item->thumbnail);
+ if (!$thumbnail) {
+ return false;
+ }
+
+ $prefix = "videolist/" . $item->guid;
+ $filehandler = new ElggFile();
+ $filehandler->owner_guid = $item->owner_guid;
+ $filehandler->setFilename($prefix . ".jpg");
+ $filehandler->open("write");
+ $filehandler->write($thumbnail);
+ $filehandler->close();
+
+ // update properties
+ if ($item->url) {
+ $item->video_url = $item->url;
+ $item->deleteMetadata('url');
+ }
+ if ($item->desc) {
+ $item->description = $item->desc;
+ $item->deleteMetadata('desc');
+ $item->save();
+ }
+ if ($item->embedurl) {
+ $item->deleteMetadata('embedurl');
+ }
+ upgrade_change_subtype($item, 'videolist_item');
+
+ // update river
+ $options = array('object_guid' => $item->guid);
+ $river_items = elgg_get_river($options);
+ foreach($river_items as $river_item) {
+ if ($river_item->action_type == 'create') {
+ upgrade_update_river($river_item->id, 'river/object/videolist_item/create', $item->guid, 0);
+ }
+ }
+
+ return true;
+}
+$previous_access = elgg_set_ignore_access(true);
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'videolist',
+ 'limit' => 0,
+);
+$batch = new ElggBatch('elgg_get_entities', $options, 'videolist_2012022501', 100);
+elgg_set_ignore_access($previous_access);
+
+if ($batch->callbackResult) {
+ error_log("Elgg videolist upgrade (2012022501) succeeded");
+} else {
+ error_log("Elgg videolist upgrade (2012022501) failed");
+}
diff --git a/mod/videolist/views/default/forms/videolist/edit.php b/mod/videolist/views/default/forms/videolist/edit.php
new file mode 100644
index 000000000..18fb6ded4
--- /dev/null
+++ b/mod/videolist/views/default/forms/videolist/edit.php
@@ -0,0 +1,55 @@
+<?php
+/**
+ * Videolist edit form body
+ *
+ * @package ElggVideolist
+ */
+
+$variables = elgg_get_config('videolist');
+
+if(empty($vars['guid'])){
+ unset($variables['title']);
+ unset($variables['description']);
+} else {
+ unset($variables['video_url']);
+}
+
+foreach ($variables as $name => $type) {
+?>
+<div>
+ <label><?php echo elgg_echo("videolist:$name") ?></label>
+ <?php
+ if ($type != 'longtext') {
+ echo '<br />';
+ }
+ ?>
+ <?php echo elgg_view("input/$type", array(
+ 'name' => $name,
+ 'value' => $vars[$name],
+ ));
+ ?>
+</div>
+<?php
+}
+
+$cats = elgg_view('categories', $vars);
+if (!empty($cats)) {
+ echo $cats;
+}
+
+
+echo '<div class="elgg-foot">';
+if ($vars['guid']) {
+ echo elgg_view('input/hidden', array(
+ 'name' => 'video_guid',
+ 'value' => $vars['guid'],
+ ));
+}
+echo elgg_view('input/hidden', array(
+ 'name' => 'container_guid',
+ 'value' => $vars['container_guid'],
+));
+
+echo elgg_view('input/submit', array('value' => elgg_echo('save')));
+
+echo '</div>';
diff --git a/mod/videolist/views/default/icon/object/videolist_item.php b/mod/videolist/views/default/icon/object/videolist_item.php
new file mode 100644
index 000000000..24a5b5fe8
--- /dev/null
+++ b/mod/videolist/views/default/icon/object/videolist_item.php
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Generic icon view.
+ *
+ * @package Elgg
+ * @subpackage Core
+ *
+ * @uses $vars['entity'] The entity the icon represents - uses getIconURL() method
+ * @uses $vars['size'] topbar, tiny, small, medium (default), large, master
+ * @uses $vars['href'] Optional override for link
+ */
+
+$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);
+
+// Get size
+if (!in_array($vars['size'], $sizes)) {
+ $size = "medium";
+} else {
+ $size = $vars['size'];
+}
+
+if (isset($entity->name)) {
+ $title = $entity->name;
+} else {
+ $title = $entity->title;
+}
+
+$url = $entity->getURL();
+if (isset($vars['href'])) {
+ $url = $vars['href'];
+}
+
+$img_src = $entity->getIconURL($vars['size']);
+$img = "<img src=\"$img_src\" alt=\"$title\" width=\"{$img_width[$size]}\" />";
+
+if ($url) {
+ echo elgg_view('output/url', array(
+ 'href' => $url,
+ 'text' => $img,
+ ));
+} else {
+ echo $img;
+}
diff --git a/mod/videolist/views/default/object/videolist_item.php b/mod/videolist/views/default/object/videolist_item.php
new file mode 100644
index 000000000..5789c8475
--- /dev/null
+++ b/mod/videolist/views/default/object/videolist_item.php
@@ -0,0 +1,108 @@
+<?php
+/**
+ * Videolist item renderer.
+ *
+ * @package ElggVideolist
+ */
+
+$full = elgg_extract('full_view', $vars, FALSE);
+$entity = elgg_extract('entity', $vars, FALSE);
+/* @var ElggObject $entity */
+
+if (!$entity) {
+ return TRUE;
+}
+
+$owner = $entity->getOwnerEntity();
+$container = $entity->getContainerEntity();
+$categories = elgg_view('output/categories', $vars);
+$excerpt = elgg_get_excerpt($entity->description);
+
+$body = elgg_view('output/longtext', array('value' => $entity->description));
+
+$owner_link = elgg_view('output/url', array(
+ 'href' => "videolist/owner/$owner->username",
+ 'text' => $owner->name,
+));
+$author_text = elgg_echo('byline', array($owner_link));
+
+$entity_icon = elgg_view_entity_icon($entity, 'medium');
+$owner_icon = elgg_view_entity_icon($owner, 'small');
+
+$tags = elgg_view('output/tags', array('tags' => $entity->tags));
+$date = elgg_view_friendly_time($entity->time_created);
+
+$comments_count = $entity->countComments();
+//only display if there are commments
+if ($comments_count != 0) {
+ $text = elgg_echo("comments") . " ($comments_count)";
+ $comments_link = elgg_view('output/url', array(
+ 'href' => $entity->getURL() . '#videolist-item-comments',
+ 'text' => $text,
+ ));
+} else {
+ $comments_link = '';
+}
+
+$metadata = elgg_view_menu('entity', array(
+ 'entity' => $vars['entity'],
+ 'handler' => 'videolist',
+ 'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz',
+));
+
+$subtitle = "$author_text $date $categories $comments_link";
+
+// do not show the metadata and controls in widget view
+if (elgg_in_context('widgets')) {
+ $metadata = '';
+ $excerpt = '';
+}
+
+if ($full && !elgg_in_context('gallery')) {
+
+ $content = elgg_view("videolist/watch", $vars);
+ $content = "<div class=\"videolist-watch\">$content</div>";
+
+ $params = array(
+ 'entity' => $entity,
+ 'title' => false,
+ 'content' => $content,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => $tags,
+ );
+ $params = $params + $vars;
+ $list_body = elgg_view('object/elements/summary', $params);
+
+ $entity_info = elgg_view_image_block($owner_icon, $list_body);
+
+ echo <<<HTML
+$entity_info
+$body
+HTML;
+
+} elseif (elgg_in_context('gallery')) {
+ echo '<div class="videolist-gallery-item">';
+ $content = elgg_view('output/url', array(
+ 'text' => elgg_get_excerpt($entity->title, 25),
+ 'href' => $entity->getURL(),
+ ));
+ $content .= "<p class='subtitle'>$owner_link $date</p>";
+ echo elgg_view_image_block($entity_icon, $content);
+ echo '</div>';
+} else {
+ // brief view
+
+ $params = array(
+ 'entity' => $entity,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => $tags,
+ 'content' => $excerpt,
+ );
+ $params = $params + $vars;
+ $list_body = elgg_view('object/elements/summary', $params);
+
+ echo elgg_view_image_block($entity_icon, $list_body);
+}
diff --git a/mod/videolist/views/default/page/elements/videolist_block.php b/mod/videolist/views/default/page/elements/videolist_block.php
new file mode 100644
index 000000000..a0653a09e
--- /dev/null
+++ b/mod/videolist/views/default/page/elements/videolist_block.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Display the latest videolist items
+ *
+ * Generally used in a sidebar.
+ *
+ * @uses $vars['container_guid'] The videolist container
+ * @uses $vars['limit'] The number of comments to display
+ */
+
+$entity_guid = get_input('guid', ELGG_ENTITIES_ANY_VALUE);
+$container_guid = elgg_extract('container_guid', $vars, ELGG_ENTITIES_ANY_VALUE);
+
+$container = get_entity($container_guid);
+
+$options = array(
+ 'container_guid' => $container_guid,
+ 'limit' => elgg_extract('limit', $vars, 6),
+ 'type' => 'object',
+ 'subtypes' => 'videolist_item',
+ 'full_view' => false,
+ 'pagination' => false,
+ 'wheres' => array('guid <> ' . $entity_guid), // exclude this item from list.
+);
+
+if($container) {
+ $title = elgg_echo('videolist:owner', array($container->name));
+} else {
+ $title = elgg_echo('videolist');
+}
+
+elgg_push_context('gallery');
+$content = elgg_list_entities($options);
+elgg_pop_context('gallery');
+
+echo elgg_view_module('aside', $title, $content);
diff --git a/mod/videolist/views/default/river/object/videolist_item/create.php b/mod/videolist/views/default/river/object/videolist_item/create.php
new file mode 100644
index 000000000..ea9f8394b
--- /dev/null
+++ b/mod/videolist/views/default/river/object/videolist_item/create.php
@@ -0,0 +1,15 @@
+<?php
+/**
+ * Videolist item river view.
+ */
+
+$object = $vars['item']->getObjectEntity();
+$thumbnail = elgg_view('icon/object/videolist_item', array(
+ 'entity' => $object,
+ 'size' => 'medium',
+));
+
+echo elgg_view('river/item', array(
+ 'item' => $vars['item'],
+ 'message' => $thumbnail,
+));
diff --git a/mod/videolist/views/default/videolist/css.php b/mod/videolist/views/default/videolist/css.php
new file mode 100644
index 000000000..625935451
--- /dev/null
+++ b/mod/videolist/views/default/videolist/css.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Elgg Videolist CSS
+ */
+?>
+
+.videolist-watch {
+ margin-top: 40px;
+ position: relative;
+ padding-bottom: 56.25%;
+ padding-top: 30px;
+ height: 0;
+}
+
+.videolist-watch iframe,
+.videolist-watch object,
+.videolist-watch embed {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+} \ No newline at end of file
diff --git a/mod/videolist/views/default/videolist/group_module.php b/mod/videolist/views/default/videolist/group_module.php
new file mode 100644
index 000000000..0e0a1ab63
--- /dev/null
+++ b/mod/videolist/views/default/videolist/group_module.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Group videolist module
+ */
+
+$group = elgg_get_page_owner_entity();
+
+if ($group->videolist_enable == "no") {
+ return true;
+}
+
+$all_link = elgg_view('output/url', array(
+ 'href' => "videolist/group/$group->guid/all",
+ 'text' => elgg_echo('link:view:all'),
+));
+
+elgg_push_context('widgets');
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'videolist_item',
+ 'container_guid' => elgg_get_page_owner_guid(),
+ 'limit' => 6,
+ 'full_view' => false,
+ 'pagination' => false,
+);
+$content = elgg_list_entities($options);
+elgg_pop_context();
+
+if (!$content) {
+ $content = '<p>' . elgg_echo('videolist:none') . '</p>';
+}
+
+$new_link = elgg_view('output/url', array(
+ 'href' => "videolist/add/$group->guid",
+ 'text' => elgg_echo('videolist:add'),
+));
+
+echo elgg_view('groups/profile/module', array(
+ 'title' => elgg_echo('videolist:group'),
+ 'content' => $content,
+ 'all_link' => $all_link,
+ 'add_link' => $new_link,
+));
diff --git a/mod/videolist/views/default/videolist/sidebar.php b/mod/videolist/views/default/videolist/sidebar.php
new file mode 100644
index 000000000..4a9e1cdda
--- /dev/null
+++ b/mod/videolist/views/default/videolist/sidebar.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Videolist sidebar
+ */
+
+$show_comments = elgg_extract('show_comments', $vars, true);
+$show_tags = elgg_extract('show_tags', $vars, true);
+$show_videolist = elgg_extract('show_videolist', $vars, false);
+
+if($show_videolist){
+ echo elgg_view('page/elements/videolist_block', array(
+ 'container_guid' => elgg_get_page_owner_guid(),
+ ));
+}
+
+if($show_comments) {
+ echo elgg_view('page/elements/comments_block', array(
+ 'subtypes' => 'videolist_item',
+ 'owner_guid' => elgg_get_page_owner_guid(),
+ ));
+}
+
+if($show_tags) {
+ echo elgg_view('page/elements/tagcloud_block', array(
+ 'subtypes' => 'videolist_item',
+ 'owner_guid' => elgg_get_page_owner_guid(),
+ ));
+}
diff --git a/mod/videolist/views/default/videolist/watch.php b/mod/videolist/views/default/videolist/watch.php
new file mode 100644
index 000000000..2e1dbacec
--- /dev/null
+++ b/mod/videolist/views/default/videolist/watch.php
@@ -0,0 +1,8 @@
+<?php
+
+$entity = elgg_extract('entity', $vars);
+if (elgg_view_exists("videolist/watch/$entity->videotype")) {
+ echo elgg_view("videolist/watch/$entity->videotype", $vars);
+} else {
+ echo elgg_view("videolist/watch/default", $vars);
+}
diff --git a/mod/videolist/views/default/videolist/watch/bliptv.php b/mod/videolist/views/default/videolist/watch/bliptv.php
new file mode 100644
index 000000000..ae3d75901
--- /dev/null
+++ b/mod/videolist/views/default/videolist/watch/bliptv.php
@@ -0,0 +1,6 @@
+<?php
+
+$embedurl = $vars['entity']->embedurl;
+$embedurl = preg_replace('/https?:/', 'https:', $embedurl);
+
+echo "<iframe src=\"$embedurl\" frameborder=\"0\" allowfullscreen></iframe>";
diff --git a/mod/videolist/views/default/videolist/watch/gisstv.php b/mod/videolist/views/default/videolist/watch/gisstv.php
new file mode 100644
index 000000000..a96894ada
--- /dev/null
+++ b/mod/videolist/views/default/videolist/watch/gisstv.php
@@ -0,0 +1,7 @@
+<?php
+
+$video_id = $vars['entity']->video_id;
+
+echo "<video controls=\"\" tabindex=\"0\">
+ <source type=\"video/ogg\" src=\"http://giss.tv/dmmdb//contents/$video_id\"></source>
+</video>";
diff --git a/mod/videolist/views/default/videolist/watch/metacafe.php b/mod/videolist/views/default/videolist/watch/metacafe.php
new file mode 100644
index 000000000..ce8e257d5
--- /dev/null
+++ b/mod/videolist/views/default/videolist/watch/metacafe.php
@@ -0,0 +1,6 @@
+<?php
+
+$embedurl = $vars['entity']->embedurl;
+$embedurl = preg_replace('/https?:/', 'https:', $embedurl);
+
+echo "<embed flashVars=\"playerVars=autoPlay=no\" src=\"$embedurl\" wmode=\"transparent\" allowFullScreen=\"true\" allowScriptAccess=\"always\" name=\"Metacafe_$video_id\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\"></embed>";
diff --git a/mod/videolist/views/default/videolist/watch/vimeo.php b/mod/videolist/views/default/videolist/watch/vimeo.php
new file mode 100644
index 000000000..cdb4b6bfb
--- /dev/null
+++ b/mod/videolist/views/default/videolist/watch/vimeo.php
@@ -0,0 +1,5 @@
+<?php
+
+$video_id = $vars['entity']->video_id;
+
+echo "<iframe src=\"https://player.vimeo.com/video/$video_id?byline=0\" frameborder=\"0\" webkitAllowFullScreen allowFullScreen></iframe>";
diff --git a/mod/videolist/views/default/videolist/watch/youtube.php b/mod/videolist/views/default/videolist/watch/youtube.php
new file mode 100644
index 000000000..b0b758718
--- /dev/null
+++ b/mod/videolist/views/default/videolist/watch/youtube.php
@@ -0,0 +1,5 @@
+<?php
+
+$video_id = $vars['entity']->video_id;
+
+echo "<iframe src=\"https://www.youtube-nocookie.com/embed/$video_id\" frameborder=\"0\" allowfullscreen></iframe>";
diff --git a/mod/videolist/views/default/widgets/videolist/content.php b/mod/videolist/views/default/widgets/videolist/content.php
new file mode 100644
index 000000000..aaf6076a3
--- /dev/null
+++ b/mod/videolist/views/default/widgets/videolist/content.php
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Elgg video list widget
+ *
+ * @package ElggVideolist
+ */
+
+$num = (int) $vars['entity']->videos_num;
+
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'videolist_item',
+ 'container_guid' => $vars['entity']->owner_guid,
+ 'limit' => $num,
+ 'full_view' => FALSE,
+ 'pagination' => FALSE,
+);
+$content = elgg_list_entities($options);
+
+echo $content;
+
+if ($content) {
+ $url = "pages/owner/" . elgg_get_page_owner_entity()->username;
+ $more_link = elgg_view('output/url', array(
+ 'href' => $url,
+ 'text' => elgg_echo('videolist:more'),
+ 'is_trusted' => true,
+ ));
+ echo "<span class=\"elgg-widget-more\">$more_link</span>";
+} else {
+ echo elgg_echo('videolist:none');
+}
diff --git a/mod/videolist/views/default/widgets/videolist/edit.php b/mod/videolist/views/default/widgets/videolist/edit.php
new file mode 100644
index 000000000..a2865848e
--- /dev/null
+++ b/mod/videolist/views/default/widgets/videolist/edit.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Elgg video list widget edit
+ *
+ * @package ElggVideolist
+ */
+
+// set default value
+if (!isset($vars['entity']->videos_num)) {
+ $vars['entity']->videos_num = 4;
+}
+
+$params = array(
+ 'name' => 'params[videos_num]',
+ 'value' => $vars['entity']->videos_num,
+ 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
+);
+$dropdown = elgg_view('input/dropdown', $params);
+
+?>
+<div>
+ <?php echo elgg_echo('videolist:num_videos'); ?>:
+ <?php echo $dropdown; ?>
+</div>
diff --git a/mod/videolist/views/rss/object/videolist_item.php b/mod/videolist/views/rss/object/videolist_item.php
new file mode 100644
index 000000000..41d89fadf
--- /dev/null
+++ b/mod/videolist/views/rss/object/videolist_item.php
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Elgg default object view
+ *
+ * @package Elgg
+ * @subpackage Core
+ */
+
+$title = $vars['entity']->title;
+if (empty($title)) {
+ $subtitle = strip_tags($vars['entity']->description);
+ $title = substr($subtitle, 0, 32);
+ if (strlen($subtitle) > 32) {
+ $title .= ' ...';
+ }
+}
+
+set_input('view', 'default');
+
+$description = elgg_view("videolist/watch/".$vars['entity']->videotype, array(
+ 'entity' => $vars['entity'],
+));
+
+set_input('view', 'rss');
+
+$description .= $vars['entity']->description;
+
+$permalink = htmlspecialchars($vars['entity']->getURL());
+$pubdate = date('r', $vars['entity']->time_created);
+
+$creator = elgg_view('object/creator', $vars);
+$georss = elgg_view('object/georss', $vars);
+$extension = elgg_view('extensions/item', $vars);
+
+$item = <<<__HTML
+<item>
+ <guid isPermaLink="true">$permalink</guid>
+ <pubDate>$pubdate</pubDate>
+ <link>$permalink</link>
+ <title><![CDATA[$title]]></title>
+ <description><![CDATA[$description]]></description>
+ $creator$georss$extension
+</item>
+
+__HTML;
+
+echo $item;