diff options
Diffstat (limited to 'mod/ecml')
| -rw-r--r-- | mod/ecml/README.txt | 150 | ||||
| -rw-r--r-- | mod/ecml/ecml_functions.php | 217 | ||||
| -rw-r--r-- | mod/ecml/graphics/ecml.png | bin | 341 -> 0 bytes | |||
| -rw-r--r-- | mod/ecml/languages/en.php | 41 | ||||
| -rw-r--r-- | mod/ecml/manifest.xml | 14 | ||||
| -rw-r--r-- | mod/ecml/start.php | 143 | ||||
| -rw-r--r-- | mod/ecml/views/default/ecml/help.php | 32 | ||||
| -rw-r--r-- | mod/ecml/views/default/ecml/input_ext.php | 14 | ||||
| -rw-r--r-- | mod/ecml/views/default/ecml/keywords/slideshare.php | 34 | ||||
| -rw-r--r-- | mod/ecml/views/default/ecml/keywords/user_list.php | 47 | ||||
| -rw-r--r-- | mod/ecml/views/default/ecml/keywords/vimeo.php | 54 | ||||
| -rw-r--r-- | mod/ecml/views/default/ecml/keywords/youtube.php | 43 |
12 files changed, 0 insertions, 789 deletions
diff --git a/mod/ecml/README.txt b/mod/ecml/README.txt deleted file mode 100644 index c72e8c0c4..000000000 --- a/mod/ecml/README.txt +++ /dev/null @@ -1,150 +0,0 @@ -ECML - Elgg Customizable Markup Language - -CONTENTS: - 1. Overview - 2. Security - 3. Using ECML Keywords - 3.1 Utility keywords 'entity' and 'view' - 3.2 Embedded 3rd party media - 4. Custom ECML Keywords - 5. Hints and Quirks - - -1. OVERVIEW - - ECML adds support for an extensible keyword system that allows users - to quickly add elements and embed media in their content. The ECML - control panel can be used to granularly allow ECML keywords in certain - contexts and views. - - -2. SECURITY - - From the ECML control panel in the administration section the - administrator can select which sections of the site support - ECML. For each section registered to display ECML, the administrator - can select which keywords to deny. For example, this is useful to - prevent users from inserting an Elgg view into a blog page. - -3. USING ECML KEYWORDS - - All ECML keywords are surrounded by two square brackets: [[ and ]]. - Some keywords, like views and entity lists, take optional parameters. - - Examples: - [[userlist]] -- Display up to 10 newest users. - [[youtube src="http://www.youtube.com/watch?v=kCpjgl2baLs"]] -- Embed a YouTube video. - [[view src="input/text"]] -- Display a textarea - - -3.1 UTILITY KEYWORDS 'entity' AND 'view' - - ECML includes a few built-in keywords to get you started. They are - mainly for embedding content from 3rd party sites, but also include - two utility views to help non-programmers quickly display content. - - The two utility keywords available are [[entity]] and [[view]]. - - [[entity]] - Displays a list of entities using similar arguments to the - elgg_get_entities() function. See documentation for that function for - the full list of supported arguments and default values. - - Additional / changed parameters supported by keywords: - * owner: The username owner. (You can still use owner_guid) - - Example: Displays a list of all blog posts by the user named 'admin': - [[entity type=object subtype=blog owner=admin]] - - Example: Displays newest group created: - [[entity type=object subtype=group limit=1]] - - - [[view]] - Displays a valid Elgg view passing any optional parameters to - the view. - - Example: Display a text input: - [[view src="input/text"]] - - Example: Display a textarea with a default value: - [[view src="input/longtext" value="This is an example of a quoted value!"]] - - -3.2 EMBEDDED 3RD PARTY MEDIA - - ECML provides support for embedding media from a few of the most common - media sites: - - * Youtube -- [[youtube src="URL"]] - * Vimeo -- [[vimeo src="URL"]] - * Slideshare -- [[slideshare id="ID"]] (NB: Use the "wordpress.com" embed - link surrounded by two [[s and ]]s.) - - -4 CUSTOM ECML KEYWORDS (AKA "THE 'C' in ECML) - - Plugins can add their own ECML keywords. Each keyword must be bound to - a valid view. Almost all functionality in custom keywords could be - implemented using the 'view' keyword, but custom keywords provide a - simple way for non-techy users to include ready-made views without - the fuss of knowing what they're doing. - - To register your own ECML keywords, reply to the 'get_keywords' - hook of type 'ecml' and append to the passed array with a key that is - your keyword name and a value that is an array of a description and view. - - Arguments passed to the keyword are accessible to the keyword view via - the $vars array. It is the responsibility of the custom view to parse - these arguments. - - The below example creates the 'buttonizer' keyword that turns the user's - text into an HTML button. It uses the view at 'buttonizer/ecml/buttonizer.' - - How a user will call the keyword: - - [[buttonizer text="This is my button!"]] - - How to implement this in a plugin: - - buttonizer/start.php: - register_plugin_hook('get_keywords', 'ecml', 'buttonizer_ecml_keywords'); - - function buttonizer_ecml_keywords($hook, $type, $value, $params) { - $value['buttonizer'] = array( - 'view' => 'buttonizer/ecml/buttonizer', - 'description' => 'Makes your text a button! What could be better?' - ); - - return $value; - } - - buttonizer/views/default/buttonizer/ecml/buttonizer.php: - $text = $vars['text']; - - echo elgg_view('input/button', array( - 'value' => $text, - 'type' => 'button' - )); - - This is exactly the same as saying: - - [[view src="buttonizer/ecml/buttonizer" text="This is my button!"]] - - but is much simpler for the user. - - -5. HINTS AND QUIRKS - - * A custom keyword is slightly more complicated to implement, but is - much simpler for the end user to use. - - * A custom keyword is safer. Since ECML can be disabled for certain - views, many administrators disable the entity and view keywords in - user-accessible pages like blogs, pages, and files. - - * Custom keywords can contain only alphanumeric characters. - - * To pass a complex argument to a keyword, quote the value. - - * If making a custom keyword, avoid underscores in your params. They - look funny. - diff --git a/mod/ecml/ecml_functions.php b/mod/ecml/ecml_functions.php deleted file mode 100644 index e818a8f99..000000000 --- a/mod/ecml/ecml_functions.php +++ /dev/null @@ -1,217 +0,0 @@ -<?php -/** - * Helper functions for ECML. - * - * @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/ - */ - - -/** - * Parse ECML keywords - * - * @param array $matches - * @return string html - */ -function ecml_parse_view_match($matches) { - global $CONFIG; - - $view = $CONFIG->ecml_current_view; - - $keyword = trim($matches[1]); - $params_string = trim($matches[2]); - - // reject keyword if blacklisted for view or invalid - if (!ecml_is_valid_keyword($keyword, $view)) { - return $matches[0]; - } - - switch ($keyword) { - case 'entity': - $options = ecml_keywords_parse_entity_params($params_string); - // must use this lower-level function because I missed refactoring - // the list entity functions for relationships. - // (which, since you're here, is the only function that runs through all - // possible options for elgg_get_entities*() functions...) - $entities = elgg_get_entities_from_relationship($options); - $content = elgg_view_entity_list($entities, count($entities), $options['offset'], - $options['limit'], $options['full_view'], $options['view_type_toggle'], $options['pagination']); - break; - - case 'view': - // src is a required attribute of view - $vars = ecml_keywords_tokenize_params($params_string); - $vars['ecml_keyword'] = $keyword; - $vars['ecml_params_string'] = $params_string; - $content = elgg_view($vars['src'], $vars); - - break; - - default: - // match against custom keywords with optional args - $keyword_info = $CONFIG->ecml_keywords[$keyword]; - $vars = ecml_keywords_tokenize_params($params_string); - $vars['ecml_keyword'] = $keyword; - $vars['ecml_params_string'] = $params_string; - $content = elgg_view($keyword_info['view'], $vars); - break; - } - - // if nothing matched return the original string. - if (!$content) { - $content = $matches[0]; - } - - return $content; -} - -/** - * Creates an array from a name=value name2='value2' name3="value3" string. - * - * @param $string - * @return array - */ -function ecml_keywords_tokenize_params($string) { - - if (empty($string)) { - return array(); - } - - $params = array(); - $pos = 0; - $char = substr($string, $pos, 1); - - // working var for assembling name and values - $operand = $name = ''; - - while ($char !== FALSE) { - switch ($char) { - // handle quoted names/values - case '"': - case "'": - $quote = $char; - - $next_char = substr($string, ++$pos, 1); - while ($next_char != $quote) { - if ($next_char === FALSE) { - // no matching quote. bail. - return array(); - } - $operand .= $next_char; - $next_char = substr($string, ++$pos, 1); - } - break; - - case ECML_ATTR_SEPARATOR: - // normalize true and false - if ($operand == 'true'){ - $operand = TRUE; - } elseif ($operand == 'false') { - $operand = FALSE; - } - $params[$name] = $operand; - $operand = $name = ''; - break; - - case ECML_ATTR_OPERATOR: - // save name, switch to value - $name = $operand; - $operand = ''; - break; - - default: - $operand .= $char; - } - - $char = substr($string, ++$pos, 1); - } - - // need to get the last attr - if ($name && $operand) { - if ($operand == 'true'){ - $operand = TRUE; - } elseif ($operand == 'false') { - $operand = FALSE; - } - $params[$name] = $operand; - } - - return $params; - - // this is much faster, but doesn't allow quoting. -// $pairs = array_map('trim', explode(',', $string)); -// $params = array(); -// -// foreach ($pairs as $pair) { -// list($name, $value) = explode('=', $pair); -// -// $name = trim($name); -// $value = trim($value); -// -// // normalize BOOL values -// if ($value === 'true') { -// $value = TRUE; -// } elseif ($value === 'false') { -// $value = FALSE; -// } -// -// // don't check against value since a falsy/empty value is valid. -// if ($name) { -// $params[$name] = $value; -// } -// } -// -// return $params; -} - -/** - * Returns an options array suitable for using in elgg_get_entities() - * - * @param string $string "name=value, name2=value2" - * @return array - */ -function ecml_keywords_parse_entity_params($string) { - $params = ecml_keywords_tokenize_params($string); - - // handle some special cases - if (isset($params['owner'])) { - if ($user = get_user_by_username($params['owner'])) { - $params['owner_guid'] = $user->getGUID(); - } - } - - // @todo probably need to add more for - // group -> container_guid, etc - return $params; -} - -/** - * Checks granular permissions if keyword is valid for view - * - * @param unknown_type $keyword - * @param unknown_type $view - * @return bool - */ -function ecml_is_valid_keyword($keyword, $view = NULL) { - global $CONFIG; - - // this isn't even a real keyword. - if (!isset($CONFIG->ecml_keywords[$keyword])) { - return FALSE; - } - - $views = $CONFIG->ecml_permissions['views']; - $contexts = $CONFIG->ecml_permissions['contexts']; - - // this is a blacklist, so return TRUE by default. - $r = TRUE; - - if (isset($views[$view]) && in_array($keyword, $views[$view])) { - $r = FALSE; - } - - return $r; -}
\ No newline at end of file diff --git a/mod/ecml/graphics/ecml.png b/mod/ecml/graphics/ecml.png Binary files differdeleted file mode 100644 index 81de57b56..000000000 --- a/mod/ecml/graphics/ecml.png +++ /dev/null diff --git a/mod/ecml/languages/en.php b/mod/ecml/languages/en.php deleted file mode 100644 index d93c7236a..000000000 --- a/mod/ecml/languages/en.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php -/** - * Language definitions for ECML - * - * @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/ - */ - -$english = array( - 'ecml' => 'ECML', - 'ecml:help' => 'ECML Help', - - /** - * Key words - */ - 'ecml:keywords_title' => 'Keywords', - 'ecml:keywords_instructions' => - 'Keywords are replaced with content when viewed. They must be surrounded by - two square brackets ([[ and ]]). You can build your own or use the ones listed below. - Hover over a keyword to read its description.', - - 'ecml:keywords_instructions_more' => - ' - <p>You can build your own keywords for views and entities.</p> - - <p>[[entity: type=type, subtype=subtype, owner=username, limit=number]]<br /> - - EX: To show 5 blog posts by admin:<br /> - [[entity: type=object, subtype=blog, owner=admin, limit=5]]</p> - - <p>You can also specify a valid Elgg view:<br /> - [[view: elgg_view, name=value]]</p> - - <p>Ex: To show a text input with a default value:<br /> - [[view: input/text, value=This is a default value]]</p>', -); - -add_translation('en', $english);
\ No newline at end of file diff --git a/mod/ecml/manifest.xml b/mod/ecml/manifest.xml deleted file mode 100644 index f74c78de0..000000000 --- a/mod/ecml/manifest.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<plugin_manifest> - <field key="name" value="ECML V2" /> - <field key="author" value="Curverider" /> - <field key="version" value="1.0" /> - <field key="description" value="Elgg Customizable Markup Language v2 adds support for easy customization of pages and embedding media." /> - <field key="category" value="service" /> - <field key="category" value="official" /> - <field key="provides" value="ecml2" /> - <field key="website" value="http://www.elgg.org/" /> - <field key="copyright" value="(C) Curverider 2008-2010" /> - <field key="licence" value="GNU Public License version 2" /> - <field key="elgg_version" value="2009030702" /> -</plugin_manifest> diff --git a/mod/ecml/start.php b/mod/ecml/start.php deleted file mode 100644 index d1a86f82b..000000000 --- a/mod/ecml/start.php +++ /dev/null @@ -1,143 +0,0 @@ -<?php -/** - * Provides the ECML service to plugins. - * - * @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/ - * - * @todo - * Granular access to keywords based upon view. - * Update docs / help - * Check for SQL injection problems. - * Check entity keyword views against fullview. Force to FALSE? - */ - -/** - * Init ECML - */ -function ecml_init() { - require_once(dirname(__FILE__) . '/ecml_functions.php'); - global $CONFIG; - - define('ECML_ATTR_SEPARATOR', ' '); - define('ECML_ATTR_OPERATOR', '='); - - // help page - register_page_handler('ecml', 'ecml_help_page_handler'); - - // admin access page - register_page_handler('ecml_admin', 'ecml_admin_page_handler'); - register_elgg_event_handler('pagesetup', 'system', 'ecml_pagesetup'); - - // show ECML-enabled icon on free-text input areas - elgg_extend_view('input/longtext', 'ecml/input_ext'); - elgg_extend_view('input/plaintext', 'ecml/input_ext'); - //elgg_extend_view('input/text', 'ecml/input_ext'); - - // get register the views we want to parse for ecml - // @todo will need to do profiling to see if it would be faster - // to foreach through this list and register to specific views or - // do the check in a single plugin hook. - // Wants array('view_name' => 'Short Description') - $CONFIG->ecml_parse_views = trigger_plugin_hook('get_views', 'ecml', NULL, array()); - - foreach ($CONFIG->ecml_parse_views as $view => $desc) { - register_plugin_hook('view', $view, 'ecml_parse_view'); - } - - // provide a few built-in ecml keywords. - // @todo could pull this out into an array here to save an API call. - register_plugin_hook('get_keywords', 'ecml', 'ecml_keyword_hook'); - - // grab the list of keywords and their views from plugins - $CONFIG->ecml_keywords = trigger_plugin_hook('get_keywords', 'ecml', NULL, array()); - - // grab permissions for specific views/contexts - // this is a black list. - // it's more efficient to use this as a blacklist - // but probably makes more sense from a UI perspective as a whitelist. - // uses [views][view_name] = array(keywords, not, allowed) - $CONFIG->ecml_permissions = array( - 'views' => array() - ); -} - -/** - * Page setup. Adds admin controls to the admin panel for granular permission - */ -function ecml_pagesetup(){ - if (get_context() == 'admin' && isadminloggedin()) { - global $CONFIG; - add_submenu_item(elgg_echo('ecml'), $CONFIG->wwwroot . 'pg/ecml_admin'); - } -} - -/** - * Display a help page for valid ECML keywords on this page. - * - * @param array $page - */ -function ecml_help_page_handler($page) { - - $content = elgg_view('ecml/help'); - echo page_draw(elgg_echo('ecml:help'), $content); -} - -/** - * Display a help page for valid ECML keywords on this page. - * - * @param array $page - */ -function ecml_admin_page_handler($page) { - $content = elgg_view('ecml/admin'); - echo page_draw(elgg_echo('ecml:admin'), $content); -} - -/** - * Parses a registered view / context for supported keywords. - * - * @param unknown_type $hook - * @param unknown_type $entity_type - * @param unknown_type $return_value - * @param unknown_type $params - * @return string - */ -function ecml_parse_view($hook, $entity_type, $return_value, $params) { - global $CONFIG; - - // 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]+)([^\]]+)?\]\]/'; - $CONFIG->ecml_current_view = $params['view']; - $return_value = preg_replace_callback($keyword_regex, 'ecml_parse_view_match', $return_value); - - return $return_value; -} - - -/** - * Register default keywords. - * - * @param unknown_type $hook - * @param unknown_type $entity_type - * @param unknown_type $return_value - * @param unknown_type $params - * @return unknown_type - */ -function ecml_keyword_hook($hook, $entity_type, $return_value, $params) { - $keywords = array('entity', 'view', 'youtube', 'slideshare', 'vimeo'); - - foreach ($keywords as $keyword) { - $return_value[$keyword] = array( - 'view' => "ecml/keywords/$keyword", - 'description' => elgg_echo("ecml:keywords:$keyword") - ); - } - - return $return_value; -} - -register_elgg_event_handler('init', 'system', 'ecml_init');
\ No newline at end of file diff --git a/mod/ecml/views/default/ecml/help.php b/mod/ecml/views/default/ecml/help.php deleted file mode 100644 index aed6bd2e1..000000000 --- a/mod/ecml/views/default/ecml/help.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php -/** - * Lists available keywords - * - * @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/ - */ - -$keywords = $vars['config']->sitepages_keywords; -$title = elgg_echo('ecml:keywords_title'); -$instructions = elgg_echo('ecml:keywords_instructions'); -$more_info = elgg_echo('ecml:keywords_instructions_more'); - - - -$keywords_html = ''; -foreach ($keywords as $keyword => $info) { - $desc = htmlentities($info['description']); - $keywords_html .= "<li><acronym title=\"$desc\">[[$keyword]]</acronym></li>"; -} - -echo " -<h3>$title</h3> -<p>$instructions</p> -$more_info -<ul> - $keywords_html -</ul> -";
\ No newline at end of file diff --git a/mod/ecml/views/default/ecml/input_ext.php b/mod/ecml/views/default/ecml/input_ext.php deleted file mode 100644 index 03941fb08..000000000 --- a/mod/ecml/views/default/ecml/input_ext.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php -/** - * Displays an ECML icon on ECML-enabled forms - * - * @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/ - */ - -$docs_href = "{$vars['url']}pg/ecml"; -?> -<a href="<?php echo $docs_href; ?>" target="_new"><img src="<?php echo $vars['url']; ?>mod/ecml/graphics/ecml.png" width="50" height="15" alt="ECML" /></a>
\ No newline at end of file diff --git a/mod/ecml/views/default/ecml/keywords/slideshare.php b/mod/ecml/views/default/ecml/keywords/slideshare.php deleted file mode 100644 index 1881a1a89..000000000 --- a/mod/ecml/views/default/ecml/keywords/slideshare.php +++ /dev/null @@ -1,34 +0,0 @@ -<?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/user_list.php b/mod/ecml/views/default/ecml/keywords/user_list.php deleted file mode 100644 index 2f2f09c49..000000000 --- a/mod/ecml/views/default/ecml/keywords/user_list.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php -/** - * Lists users - * - * @package SitePages - * @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/ - */ - -$only_with_avatars = (isset($vars['only_with_avatars'])) ? $vars['only_with_avatars'] : TRUE; -$list_type = (isset($vars['list_type'])) ? $vars['list_type'] : 'newest'; -$limit = (isset($vars['limit'])) ? $vars['limit'] : 10; - -$options = array( - 'type' => 'user', - 'limit' => $limit -); - -if ($only_with_avatars == TRUE) { - $options['metadata_name_value_pairs'] = array('name' => 'icontime', 'operand' => '!=', 'value' => 0); -} - -switch ($list_type) { - case 'newest': - $options['order_by'] = 'e.time_created DESC'; - break; - - case 'online': - // show people with a last action of < 10 minutes. - $last_action = time() - 10 * 60; - $options['joins'] = array("JOIN {$vars['config']->dbprefix}users_entity ue on ue.guid = e.guid"); - $options['wheres'] = array("ue.last_action > $last_action"); - break; - - case 'random': - $options['order_by'] = 'RAND()'; - break; - - default: - break; -} - -$users = elgg_get_entities_from_metadata($options); - -echo elgg_view_entity_list($users, count($users), 0, $limit, FALSE, FALSE, FALSE);
\ No newline at end of file diff --git a/mod/ecml/views/default/ecml/keywords/vimeo.php b/mod/ecml/views/default/ecml/keywords/vimeo.php deleted file mode 100644 index 6ca1294a8..000000000 --- a/mod/ecml/views/default/ecml/keywords/vimeo.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php -/** - * ECML vimeo 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, 'vimeo.com') === FALSE) { - $vid = $src; -} else { - // we love vimeo. - list($address, $vid) = explode('vimeo.com/', $src); -} - -if ($vid) { - $movie_url = "http://vimeo.com/moogaloop.swf?"; - $query = array('clip_id' => $vid, 'server' => 'vimeo.com'); - - $params = array( - 'show_title' => 1, - 'show_byline' => 1, - 'show_portrait' => 0, - 'color' => '', - 'fullscreen' => 1 - ); - - foreach ($params as $param => $default) { - $query[$param] = (isset($vars[$param])) ? $vars[$param] : $default; - } - - $query_str = http_build_query($query); - $movie_url .= $query_str; - - echo " -<object width=\"$width\" height=\"$height\"> - <param name=\"allowfullscreen\" value=\"true\" /> - <param name=\"allowscriptaccess\" value=\"always\" /> - <param name=\"movie\" value=\"$movie_url\" /> - <embed src=\"$movie_url\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" allowscriptaccess=\"always\" 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 deleted file mode 100644 index 87fb669d2..000000000 --- a/mod/ecml/views/default/ecml/keywords/youtube.php +++ /dev/null @@ -1,43 +0,0 @@ -<?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 |
