]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Added more video sources.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 16 Apr 2010 01:21:32 +0000 (01:21 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 16 Apr 2010 01:21:32 +0000 (01:21 +0000)
Allowing the . character in keywords.

git-svn-id: http://code.elgg.org/elgg/trunk@5759 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/ecml/start.php
mod/ecml/views/default/ecml/keywords/blip.tv.php [new file with mode: 0644]
mod/ecml/views/default/ecml/keywords/dailymotion.php [new file with mode: 0644]
mod/ecml/views/default/ecml/keywords/livevideo.php [new file with mode: 0644]
mod/ecml/views/default/ecml/keywords/redlasso.php [new file with mode: 0644]

index 98389451160074ec27c43584852187ffb9b03cc0..287bdc730900fdc2f11de3f77e3d3698ccdd5232 100644 (file)
@@ -120,7 +120,7 @@ function ecml_parse_view($hook, $entity_type, $return_value, $params) {
 
        // give me everything that is not a ], possibly followed by a :, and surrounded by [[ ]]s
        //$keyword_regex = '/\[\[([a-z0-9_]+):?([^\]]+)?\]\]/';
-       $keyword_regex = '/\[\[([a-z0-9]+)([^\]]+)?\]\]/';
+       $keyword_regex = '/\[\[([a-z0-9\.]+)([^\]]+)?\]\]/';
        $CONFIG->ecml_current_view = $params['view'];
        $return_value = preg_replace_callback($keyword_regex, 'ecml_parse_view_match', $return_value);
 
@@ -140,7 +140,19 @@ function ecml_parse_view($hook, $entity_type, $return_value, $params) {
 function ecml_keyword_hook($hook, $type, $value, $params) {
        // I keep going back and forth about entity and view. They're powerful, but
        // a great way to let a site get hacked if the admin doesn't lock them down.
-       $keywords = array('entity', 'view', 'youtube', 'slideshare', 'vimeo', 'googlemaps');
+       $keywords = array(
+               'entity',
+               'view',
+               'youtube',
+               'slideshare',
+               'vimeo',
+               'googlemaps',
+               'scribd',
+               'blip.tv',
+               'dailymotion',
+               'livevideo',
+               'redlasso'
+       );
 
        foreach ($keywords as $keyword) {
                $value[$keyword] = array(
diff --git a/mod/ecml/views/default/ecml/keywords/blip.tv.php b/mod/ecml/views/default/ecml/keywords/blip.tv.php
new file mode 100644 (file)
index 0000000..44e1405
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+/**
+ * ECML Blip.tv support
+ *
+ * @package ECML
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.org/
+ */
+
+$params = str_replace('?', '', $vars['ecml_params_string']);
+$width = (isset($vars['width'])) ? $vars['width'] : 425;
+$height = (isset($vars['height'])) ? $vars['height'] : 350;
+
+if ($params) {
+       $embed_src = elgg_http_add_url_query_elements($src, array('output' => 'embed'));
+       $link_href = elgg_http_add_url_query_elements($src, array('source' => 'embed'));
+
+       echo "
+<p><script type='text/javascript' src='http://blip.tv/syndication/write_player?skin=js&cross_post_destination=-1&view=full_js&$params'></script></p>
+";
+}
\ No newline at end of file
diff --git a/mod/ecml/views/default/ecml/keywords/dailymotion.php b/mod/ecml/views/default/ecml/keywords/dailymotion.php
new file mode 100644 (file)
index 0000000..1c97792
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+/**
+ * ECML Daily Motion support
+ *
+ * @package ECML
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.org/
+ */
+
+$base_url = 'http://www.dailymotion.com/video/';
+$src = (isset($vars['src'])) ? str_replace($base_url, '', $vars['src']) : FALSE;
+$width = (isset($vars['width'])) ? $vars['width'] : 480;
+$height = (isset($vars['height'])) ? $vars['height'] : 270;
+
+if ($src) {
+       list($vid, $name) = explode('_', $src);
+       $url =  "http://www.dailymotion.com/swf/video/$vid";
+
+       echo "
+       <p>
+       <object width=\"$width\" height=\"$height\">
+       <param name=\"movie\" value=\"$url\"></param>
+       <param name=\"allowFullScreen\" value=\"true\"></param>
+       <param name=\"allowScriptAccess\" value=\"always\"></param>
+       <embed type=\"application/x-shockwave-flash\" src=\"$url\" width=\"$width\" height=\"$height\" allowfullscreen=\"true\" allowscriptaccess=\"always\"></embed>
+       </object>
+       </p>
+";
+}
\ No newline at end of file
diff --git a/mod/ecml/views/default/ecml/keywords/livevideo.php b/mod/ecml/views/default/ecml/keywords/livevideo.php
new file mode 100644 (file)
index 0000000..b067b1a
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * ECML Live Video support
+ *
+ * @package ECML
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.org/
+ */
+
+$base_url = 'http://www.livevideo.com/video/';
+$src = (isset($vars['src'])) ? str_replace($base_url, '', $vars['src']) : FALSE;
+$width = (isset($vars['width'])) ? $vars['width'] : 445;
+$height = (isset($vars['height'])) ? $vars['height'] : 369;
+
+if ($src) {
+       $parts = explode('/', $src);
+       $vid = $parts[1];
+       // it automatically autostarts, but not passing it causes control issues
+       $url =  "http://www.livevideo.com/flvplayer/embed/$vid&autoStart=1";
+
+       echo "
+       <p>
+       <embed src=\"$url\" type=\"application/x-shockwave-flash\" quality=\"high\" WIDTH=\"$width\" HEIGHT=\"$height\" wmode=\"transparent\"></embed>
+       </p>
+";
+}
\ No newline at end of file
diff --git a/mod/ecml/views/default/ecml/keywords/redlasso.php b/mod/ecml/views/default/ecml/keywords/redlasso.php
new file mode 100644 (file)
index 0000000..e36a4a9
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+/**
+ * ECML Red Lasso support
+ *
+ * @package ECML
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.org/
+ */
+
+$vid = (isset($vars['id'])) ? $vars['id'] : FALSE;
+$width = (isset($vars['width'])) ? $vars['width'] : 390;
+$height = (isset($vars['height'])) ? $vars['height'] : 320;
+
+if ($vid) {
+       echo "
+<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"$width\" height=\"$height\" id=\"Redlasso\">
+       <param name=\"movie\" value=\"http://player.redlasso.com/redlasso_player_b1b_deploy.swf\" />
+       <param name=\"flashvars\" value=\"embedId=$vid&pid=\" />
+       <param name=\"allowScriptAccess\" value=\"always\" />
+       <param name=\"allowFullScreen\" value=\"true\" />
+       <embed src=\"http://player.redlasso.com/redlasso_player_b1b_deploy.swf\" flashvars=\"embedId=$vid&pid=\" width=\"$width\" height=\"$height\" type=\"application/x-shockwave-flash\" allowScriptAccess=\"always\" allowFullScreen=\"true\" name=\"Redlasso\">
+       </embed>
+</object>
+";
+}
\ No newline at end of file