aboutsummaryrefslogtreecommitdiff
path: root/mod/ecml/views/default/ecml/keywords/youtube.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-14 22:25:37 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-14 22:25:37 +0000
commit436ecaf476e5052434d0841aeeb7c0ccf8dd76f1 (patch)
tree73cfe69b7ee9aca03dcf1c62dc4437a99e27cab5 /mod/ecml/views/default/ecml/keywords/youtube.php
parent9b1f2384134da90edc116790babaa37ce7991151 (diff)
downloadelgg-436ecaf476e5052434d0841aeeb7c0ccf8dd76f1.tar.gz
elgg-436ecaf476e5052434d0841aeeb7c0ccf8dd76f1.tar.bz2
Changed tokenizer for ECML to support attribute quotes.
Added core youtube and slideshare keywords. Passing the full keyword and attribute string to views. git-svn-id: http://code.elgg.org/elgg/trunk@5735 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/ecml/views/default/ecml/keywords/youtube.php')
-rw-r--r--mod/ecml/views/default/ecml/keywords/youtube.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/mod/ecml/views/default/ecml/keywords/youtube.php b/mod/ecml/views/default/ecml/keywords/youtube.php
new file mode 100644
index 000000000..87fb669d2
--- /dev/null
+++ b/mod/ecml/views/default/ecml/keywords/youtube.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * ECML Youtube 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/
+ */
+
+$src = (isset($vars['src'])) ? $vars['src'] : FALSE;
+$width = (isset($vars['width'])) ? $vars['width'] : 480;
+$height = (isset($vars['height'])) ? $vars['height'] : 385;
+
+// need to extract the video id.
+// the src arg can take a full url or an id.
+// assume if no youtube.com that it's an id.
+if (strpos($src, 'youtube.com') === FALSE) {
+ $vid = $src;
+} else {
+ // grab the v param
+ if ($parts = parse_url($src)) {
+ if (isset($parts['query'])) {
+ parse_str($parts['query'], $query_arr);
+ $vid = (isset($query_arr['v'])) ? $query_arr['v'] : FALSE;
+ }
+ }
+}
+
+if ($vid) {
+ $movie_url = "http://www.youtube.com/v/$vid";
+
+ echo "
+<object width=\"$width\" height=\"$height\">
+ <param name=\"movie\" value=\"$movie_url\"></param>
+ <param name=\"allowFullScreen\" value=\"true\"></param>
+ <param name=\"allowscriptaccess\" value=\"always\"></param>
+
+ <embed src=\"$movie_url\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"$width\" height=\"$height\"></embed>
+</object>
+ ";
+} \ No newline at end of file