diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-04-14 22:25:37 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-04-14 22:25:37 +0000 |
commit | 436ecaf476e5052434d0841aeeb7c0ccf8dd76f1 (patch) | |
tree | 73cfe69b7ee9aca03dcf1c62dc4437a99e27cab5 /mod/ecml/views | |
parent | 9b1f2384134da90edc116790babaa37ce7991151 (diff) | |
download | elgg-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')
-rw-r--r-- | mod/ecml/views/default/ecml/keywords/slideshare.php | 34 | ||||
-rw-r--r-- | mod/ecml/views/default/ecml/keywords/youtube.php | 43 |
2 files changed, 77 insertions, 0 deletions
diff --git a/mod/ecml/views/default/ecml/keywords/slideshare.php b/mod/ecml/views/default/ecml/keywords/slideshare.php new file mode 100644 index 000000000..1881a1a89 --- /dev/null +++ b/mod/ecml/views/default/ecml/keywords/slideshare.php @@ -0,0 +1,34 @@ +<?php +/** + * ECML Slideshare 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/ + */ + +// this wants the "wordpress.com" embed code. +// to make life easier on users, don't require them to add the "s +// and just chop out the id= bit here from the full attr list + +$id = str_replace('id=', '', $vars['ecml_params_string']); +$width = (isset($vars['width'])) ? $vars['width'] : 450; +$height = (isset($vars['height'])) ? $vars['height'] : 369; + +if ($id) { + // @todo need to check if the & should be encoded. + + $slide_url = "http://static.slideshare.net/swf/ssplayer2.swf?id=$id"; + + echo " +<object type=\"application/x-shockwave-flash\" wmode=\"opaque\" data=\"$slide_url\" width=\"$width\" height=\"$height\"> + <param name=\"movie\" value=\"$slide_url\" /> + <param name=\"allowFullScreen\" value=\"true\" /> + <param name=\"allowScriptAccess\" value=\"always\" /> + + <embed src=\"$slide_url\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"$width\" height=\"$height\"></embed> +</object> +"; +}
\ No newline at end of file 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 |