diff options
Diffstat (limited to 'mod')
47 files changed, 0 insertions, 1918 deletions
diff --git a/mod/ecml/README.txt b/mod/ecml/README.txt deleted file mode 100644 index 3c18998cc..000000000 --- a/mod/ecml/README.txt +++ /dev/null @@ -1,226 +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. Embed support - 6. 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 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) - - -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 view, a description, - and usage instructions. - - Optionally, the array can pass a 'restricted' => array() value of views - that this keyword is valid in. This is not overrideable by the admin - interface and is useful for forcing security on possibly dangerous - keywords. - - 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( - 'name' => 'Buttonizer', - 'view' => 'buttonizer/ecml/buttonizer', - 'description' => 'Makes your text a button! What could be better?', - 'usage' => 'Use [buttonizer text="My text"] to make "My text" a button!' - ); - - 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!"] - - or even: - - [view src="input/button" value="This is my button!" type="button"] - - but is much simpler for the user. - - -5. EMBED SUPPORT - - ECML and the Embed plugin are closely related in that Embed serves - as a sort of front end for ECML. Especially with 3rd party web - services, where URLs and embed codes vary greatly, having a system - in place that allows a user to easily generate and insert ECML - is benificial. - - Currently, only web services ECML keywords are supported in the - embed plugin. Registering a web service keyword looks like this: - - $value[youtube] = array( - 'name' => 'Youtube', - 'view' => "ecml/keywords/youtube", - 'description' => 'Embed YouTube videos', - 'usage' => 'Use src="URL".', - - // important bits - 'type' => 'web_service', - 'params' => array('src', 'width', 'height') // a list of supported params - 'embed' => 'src="%s"' // a sprintf string of the require param format. Added automatically to [keyword $here] - ); - - -6. 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. - - * Are disabled keywords in comments still working? This is probably - because a parent view is including comments directly. For example: - - blog page handler: - ...logic... - echo elgg_view_entity($blog); - ...logic... - - view object/blog: - ...logic... - echo $blog; - echo elgg_view_comments($blog); - - The output of object/blog includes the output of the comments, so if - the view object/blog allows the youtube the comments will also be parsed - for ECML. The solution is to keep views for the object and comments - separate. - - blog page handler: - echo elgg_view_entity($blog); - ...logic... - echo elgg_view_comments($blog); - - view object/blog: - ...logic... - echo $blog - - Alternatively, you can keep the blog and comments in the object view, but - pull out the blog into its own view to register with ECML. - - view object/blog: - ...logic... - echo elgg_view('blog/blog', array('blog' => $blog); - ...logic... - elgg_view_comments($blog); - - view blog/blog: - ...logic... - echo $blog
\ No newline at end of file diff --git a/mod/ecml/actions/save_permissions.php b/mod/ecml/actions/save_permissions.php deleted file mode 100644 index f32544d86..000000000 --- a/mod/ecml/actions/save_permissions.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * Saves granular access - * - * @package ECML - */ - -$whitelist = get_input('whitelist', array()); -$keywords = $CONFIG->ecml_keywords; -$views = $CONFIG->ecml_parse_views; - -// the front end uses a white list but the backend uses a -// blacklist for performance and extensibility. -// gotta convert. -$perms = array(); - -foreach ($views as $view => $view_info) { - foreach ($keywords as $keyword => $keyword_info) { - - // don't need to add perms for restricted keywords - // because those perms are checked separately - if (isset($keyword_info['restricted'])) { - continue; - } - if (!isset($whitelist[$view]) || !in_array($keyword, $whitelist[$view])) { - $perms[$view][] = $keyword; - } - } -} - -if (set_plugin_setting('ecml_permissions', serialize($perms), 'ecml')) { - system_message(elgg_echo('ecml:admin:permissions_saved')); -} else { - register_error(elgg_echo('ecml:admin:cannot_save_permissions')); -} - -forward(REFERER); diff --git a/mod/ecml/ecml_functions.php b/mod/ecml/ecml_functions.php deleted file mode 100644 index 4d30ee9c7..000000000 --- a/mod/ecml/ecml_functions.php +++ /dev/null @@ -1,289 +0,0 @@ -<?php -/** - * Helper functions for ECML. - * - * @package ECML - */ - -/** - * Parses a string for ECML. - * - * @param string $string - * @return string $string with ECML replaced by HTML. - */ -function ecml_parse_string($string, $view = NULL) { - global $CONFIG; - - $CONFIG->ecml_current_view = $view; - - return preg_replace_callback(ECML_KEYWORD_REGEX, 'ecml_parse_view_match', $string); -} - -/** - * Returns ECML-style keywords found in $string. - * Doesn't validate them. - * Returns an array of keyword => arguments - * - * @param string $string - * @return array - */ -function ecml_extract_keywords($string) { - $return = array(); - - if (preg_match_all(ECML_KEYWORD_REGEX, $string, $matches)) { - foreach ($matches[1] as $i => $keyword) { - $return[] = array('keyword' => $keyword, 'params' => $matches[2][$i]); - } - } - - return $return; -} - -/** - * 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_list': - $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['list_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. - // @todo this might be undesirable. will show ugly code everywhere - // if you delete a file or something. - 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; - } - - // don't check against views. Already know it's a real one. - if (!$view) { - return TRUE; - } - - // this keyword is restricted to certain views - if (isset($CONFIG->ecml_keywords[$keyword]['restricted']) - && !in_array($view, $CONFIG->ecml_keywords[$keyword]['restricted'])) { - return FALSE; - } - - $views = $CONFIG->ecml_permissions; - - // this is a blacklist, so return TRUE by default. - $r = TRUE; - - if (isset($views[$view]) && in_array($keyword, $views[$view])) { - $r = FALSE; - } - - return $r; -} - -/** - * Grab the ECML keywords as saved in $CONFIG or regenerate. - */ -function ecml_get_keywords($recache = FALSE) { - global $CONFIG; - - if (isset($CONFIG->ecml_keywords) && !$recache) { - return $CONFIG->ecml_keywords; - } - - $keywords = elgg_trigger_plugin_hook('get_keywords', 'ecml', NULL, array()); - $CONFIG->ecml_keywords = $keywords; - return $keywords; -} - -/** - * Return basic info about the keyword. - * - * @param string $keyword - * @return array - */ -function ecml_get_keyword_info($keyword) { - global $CONFIG; - - if (isset($CONFIG->ecml_keywords[$keyword])) { - return $CONFIG->ecml_keywords[$keyword]; - } - - return FALSE; -}
\ No newline at end of file diff --git a/mod/ecml/graphics/dailymotion.png b/mod/ecml/graphics/dailymotion.png Binary files differdeleted file mode 100644 index 67950f81c..000000000 --- a/mod/ecml/graphics/dailymotion.png +++ /dev/null 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/graphics/googlemaps.png b/mod/ecml/graphics/googlemaps.png Binary files differdeleted file mode 100644 index 6e4d2f490..000000000 --- a/mod/ecml/graphics/googlemaps.png +++ /dev/null diff --git a/mod/ecml/graphics/logo_bliptv.gif b/mod/ecml/graphics/logo_bliptv.gif Binary files differdeleted file mode 100644 index 13620b9fd..000000000 --- a/mod/ecml/graphics/logo_bliptv.gif +++ /dev/null diff --git a/mod/ecml/graphics/logo_dailymotion.gif b/mod/ecml/graphics/logo_dailymotion.gif Binary files differdeleted file mode 100644 index 48d4cff8d..000000000 --- a/mod/ecml/graphics/logo_dailymotion.gif +++ /dev/null diff --git a/mod/ecml/graphics/logo_googlemaps.gif b/mod/ecml/graphics/logo_googlemaps.gif Binary files differdeleted file mode 100644 index 0f8835304..000000000 --- a/mod/ecml/graphics/logo_googlemaps.gif +++ /dev/null diff --git a/mod/ecml/graphics/logo_livevideo.gif b/mod/ecml/graphics/logo_livevideo.gif Binary files differdeleted file mode 100644 index 86afeabe4..000000000 --- a/mod/ecml/graphics/logo_livevideo.gif +++ /dev/null diff --git a/mod/ecml/graphics/logo_redlasso.gif b/mod/ecml/graphics/logo_redlasso.gif Binary files differdeleted file mode 100644 index 96ac9b78c..000000000 --- a/mod/ecml/graphics/logo_redlasso.gif +++ /dev/null diff --git a/mod/ecml/graphics/logo_slideshare.gif b/mod/ecml/graphics/logo_slideshare.gif Binary files differdeleted file mode 100644 index ff082171e..000000000 --- a/mod/ecml/graphics/logo_slideshare.gif +++ /dev/null diff --git a/mod/ecml/graphics/logo_vimeo.gif b/mod/ecml/graphics/logo_vimeo.gif Binary files differdeleted file mode 100644 index 4215e74bc..000000000 --- a/mod/ecml/graphics/logo_vimeo.gif +++ /dev/null diff --git a/mod/ecml/graphics/logo_youtube.gif b/mod/ecml/graphics/logo_youtube.gif Binary files differdeleted file mode 100644 index 7cfdd054c..000000000 --- a/mod/ecml/graphics/logo_youtube.gif +++ /dev/null diff --git a/mod/ecml/graphics/redlasso_1.png b/mod/ecml/graphics/redlasso_1.png Binary files differdeleted file mode 100644 index caf3ae4f6..000000000 --- a/mod/ecml/graphics/redlasso_1.png +++ /dev/null diff --git a/mod/ecml/graphics/redlasso_2.png b/mod/ecml/graphics/redlasso_2.png Binary files differdeleted file mode 100644 index 2c7ba64a0..000000000 --- a/mod/ecml/graphics/redlasso_2.png +++ /dev/null diff --git a/mod/ecml/graphics/slideshare.png b/mod/ecml/graphics/slideshare.png Binary files differdeleted file mode 100644 index 19ecd6b75..000000000 --- a/mod/ecml/graphics/slideshare.png +++ /dev/null diff --git a/mod/ecml/graphics/url_status.png b/mod/ecml/graphics/url_status.png Binary files differdeleted file mode 100644 index 95c2b5635..000000000 --- a/mod/ecml/graphics/url_status.png +++ /dev/null diff --git a/mod/ecml/graphics/vimeo.png b/mod/ecml/graphics/vimeo.png Binary files differdeleted file mode 100644 index ae8b4086f..000000000 --- a/mod/ecml/graphics/vimeo.png +++ /dev/null diff --git a/mod/ecml/graphics/youtube.png b/mod/ecml/graphics/youtube.png Binary files differdeleted file mode 100644 index ed31af05a..000000000 --- a/mod/ecml/graphics/youtube.png +++ /dev/null diff --git a/mod/ecml/languages/en.php b/mod/ecml/languages/en.php deleted file mode 100644 index f56d2c1cd..000000000 --- a/mod/ecml/languages/en.php +++ /dev/null @@ -1,92 +0,0 @@ -<?php -/** - * Language definitions for ECML - * - * @package ecml - */ - -$english = array( - 'ecml' => 'ECML', - 'ecml:help' => 'ECML Help', - - // views - 'ecml:views:annotation_generic_comment' => 'Comments', - - // keywords - 'ecml:keywords:googlemaps' => 'Google Maps', - 'ecml:keywords:googlemaps:desc' => 'Embed a Google Map.', - 'ecml:keywords:googlemaps:usage' => '[googlemaps src="URL"] Use the link code from Google Maps as the src.', - 'ecml:googlemaps:view_larger_map' => 'View larger map', - - 'ecml:keywords:slideshare' => 'Slide Share', - 'ecml:keywords:slideshare:desc' => 'Embed a Slideshare slide.', - 'ecml:keywords:slideshare:usage' => '[slideshare id="slideshare_id"] Use the Wordpress.com embed code.', - - 'ecml:keywords:vimeo' => 'Vimeo', - 'ecml:keywords:vimeo:desc' => 'Embed a Vimeo video.', - 'ecml:keywords:videmo:usage' => '[videmo src="URL"] Use a standard Vimeo URL as the source.', - - 'ecml:keywords:youtube' => 'YouTube', - 'ecml:keywords:youtube:desc' => 'Embed a YouTube video.', - 'ecml:keywords:youtube:usage' => '[youtube src="URL"] Use a standard YouTube URL as the source.', - - 'ecml:keywords:blip.tv' => 'blip.tv', - 'ecml:keywords:blip.tv:desc' => 'Embed a blip.tv video.', - 'ecml:keywords:blip.tv:usage' => '[blip.tv ID] use the Wordpress.com embed code.', - - 'ecml:keywords:dailymotion' => 'Daily Motion', - 'ecml:keywords:dailymotion:desc' => 'Embed a Daily Motion video.', - 'ecml:keywords:dailymotion:usage' => '[dailymotion src="URL"] Use a standard Daily Motion URL as the source.', - - 'ecml:keywords:livevideo' => 'Live Video', - 'ecml:keywords:livevideo:desc' => 'Embed a Live Video video.', - 'ecml:keywords:livevideo:usage' => '[livevideo src="URL"] Use a standard livevideo URL as the source.', - - 'ecml:keywords:redlasso' => 'Red Lasso', - 'ecml:keywords:redlasso:desc' => 'Embed a Red Lasso video.', - 'ecml:keywords:redlasso:usage' => '[redlasso id="URL"] Use the Wordpress.com embed code.', - - // keyword help - 'ecml:keywords_title' => 'Keywords', - 'ecml:keywords_instructions' => - 'Keywords are replaced with content when viewed. They must be surrounded by - 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>', - - // admin - 'ecml:admin' => 'ECML Permissions', - 'ecml:admin:instruction' => - -'ECML allows users you easily embed views, entities, and 3rd party applications into their content -on your site by using ECML keywords. There are some ECML keywords that you may want to restrict -in certain areas of your site. To disable a keyword for a section of your site, check the box in the -grid below. -', - - 'ecml:admin:permissions_saved' => 'ECML permissions saved.', - 'ecml:admin:cannot_save_permissions' => 'Cannot save ECML permissions!', - 'ecml:admin:restricted' => 'Restricted', - - // embed support - 'ecml:embed:web_services' => 'Web Services', - 'ecml:embed:instructions' => 'Select a service for instructions on how to get embed code or paste the url in directly.', - - -); - -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 457c93914..000000000 --- a/mod/ecml/manifest.xml +++ /dev/null @@ -1,13 +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="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" /> - <field key="elgg_install_state" value="enabled" /> - <field key="admin_interface" value="advanced" /> -</plugin_manifest> diff --git a/mod/ecml/start.php b/mod/ecml/start.php deleted file mode 100644 index 4fa13b7c9..000000000 --- a/mod/ecml/start.php +++ /dev/null @@ -1,298 +0,0 @@ -<?php -/** - * Provides the ECML service to plugins. - * - * @package ECML - * - * @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', '='); - - // find alphanumerics (keywords) possibly followed by everything that is not a ] (args) and all surrounded by [ ]s - define('ECML_KEYWORD_REGEX', '/\[([a-z0-9\.]+)([^\]]+)?\]/'); - - // help page - register_page_handler('ecml', 'ecml_help_page_handler'); - - // admin access page - register_page_handler('ecml_admin', 'ecml_admin_page_handler'); - - // ecml validator for embed - register_page_handler('ecml_generate', 'ecml_generate_page_handler'); - - // CSS for admin access - elgg_extend_view('css/screen', 'ecml/admin/css'); - - // admin action to save permissions - elgg_register_action('settings/ecml/save', dirname(__FILE__) . '/actions/save_permissions.php', 'admin'); - - // show ECML-enabled icon on free-text input areas - //elgg_extend_view('input/longtext', 'ecml/input_ext', 0); - //elgg_extend_view('input/plaintext', 'ecml/input_ext'); - //elgg_extend_view('input/text', 'ecml/input_ext'); - - // add parsing for core views. - elgg_register_plugin_hook_handler('get_views', 'ecml', 'ecml_views_hook'); - - // 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 = elgg_trigger_plugin_hook('get_views', 'ecml', NULL, array()); - - foreach ($CONFIG->ecml_parse_views as $view => $desc) { - elgg_register_plugin_hook_handler('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. - elgg_register_plugin_hook_handler('get_keywords', 'ecml', 'ecml_keyword_hook'); - - // grab the list of keywords and their views from plugins - $CONFIG->ecml_keywords = elgg_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 = unserialize(get_plugin_setting('ecml_permissions', 'ecml')); - - // 3rd party media embed section - elgg_register_plugin_hook_handler('embed_get_sections', 'all', 'ecml_embed_web_services_hook'); - - // remove ecml when stripping tags - elgg_register_plugin_hook_handler('format', 'strip_tags', 'ecml_strip_tags'); -} - -/** - * Display a help page for valid ECML keywords on this page. - * - * @param array $page - */ -function ecml_help_page_handler($page) { - if (!isset($page[0]) || empty($page[0])) { - $content = elgg_view('ecml/help'); - $body = elgg_view_layout('one_column_with_sidebar', array('content' => $content)); - echo elgg_view_page(elgg_echo('ecml:help'), $body); - } else { - // asking for detailed help about a keyword - $keyword = $page[0]; - $content = elgg_view('ecml/keyword_help', array('keyword' => $keyword)); - - if (get_input('ajax', FALSE)) { - echo $content; - exit; - } else { - $body = elgg_view_layout('one_column_with_sidebar', array('content' => $content)); - echo elgg_view_page(elgg_echo('ecml:help'), $body); - } - } - - return TRUE; -} - -/** - * Generate ECML given a URL or embed link and service. - * Doesn't check if the resource actually exists. - * Outputs JSON. - * - * @param unknown_type $page - */ -function ecml_generate_page_handler($page) { - $service = trim(get_input('service')); - $resource = trim(get_input('resource')); - - // if standard ECML is passed, guess the service from that instead - // only support one. - if (elgg_substr($resource, 0, 1) == '[') { - if ($keywords = ecml_extract_keywords($resource)) { - $keyword = $keywords[0]['keyword']; - $ecml_info = ecml_get_keyword_info($keyword); - $html = ecml_parse_string($resource); - - echo json_encode(array( - 'status' => 'success', - 'ecml' => $resource, - 'html' => $html - )); - - exit; - } - } - - if (!$service || !$resource) { - echo json_encode(array( - 'status' => 'error', - 'message' => elgg_echo('ecml:embed:invalid_web_service_keyword') - )); - - exit; - } - - $ecml_info = ecml_get_keyword_info($service); - - if ($ecml_info) { - // don't allow embedding for restricted. - if (isset($ecml_info['restricted'])) { - $result = array( - 'status' => 'error', - 'message' => elgg_echo('ecml:embed:cannot_embed'), - ); - } else { - // @todo pull this out into a function. allow optional arguments. - $ecml = "[$service " . sprintf($ecml_info['embed_format'], $resource) . ']'; - $html = ecml_parse_string($ecml, NULL); - $result = array( - 'status' => 'success', - 'ecml' => $ecml, - 'html' => $html - ); - } - } else { - $result = array( - 'status' => 'error', - 'message' => elgg_echo('ecml:embed:invalid_web_service_keyword') - ); - } - - echo json_encode($result); - exit; -} - -/** - * Display a admin area for ECML - * - * @param array $page - */ -function ecml_admin_page_handler($page) { - admin_gatekeeper(); - elgg_set_context('admin'); - $content = elgg_view('ecml/admin/ecml_admin'); - $body = elgg_view_layout('one_column_with_sidebar', array('content' => $content)); - echo elgg_view_page(elgg_echo('ecml:admin'), $body); -} - -/** - * 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; - - return ecml_parse_string($return_value, $params['view']); -} - - -/** - * Register default keywords. - * - * @param unknown_type $hook - * @param unknown_type $type - * @param unknown_type $value - * @param unknown_type $params - * @return unknown_type - */ -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( - 'youtube' => array('params' => array('src', 'width', 'height'), 'embed_format' => 'src="%s"'), - 'slideshare' => array('params' => array('id', 'width', 'height'), 'embed_format' => 'id="%s"'), - 'vimeo' => array('params' => array('src', 'width', 'height'), 'embed_format' => 'src="%s"'), - 'googlemaps' => array('params' => array('src', 'width', 'height'), 'embed_format' => 'src="%s"'), - //'scribd' - 'blip.tv' => array('params' => array('width', 'height'), 'embed_format' => '%s'), - 'dailymotion' => array('params' => array('src', 'width', 'height'), 'embed_format' => 'src="%s"'), - 'livevideo' => array('params' => array('src', 'width', 'height'), 'embed_format' => 'src="%s"'), - 'redlasso' => array('params' => array('id', 'width', 'height'), 'embed_format' => 'id="%s"'), - ); - - foreach ($keywords as $keyword => $info) { - $value[$keyword] = array( - 'name' => elgg_echo("ecml:keywords:$keyword"), - 'view' => "ecml/keywords/$keyword", - 'description' => elgg_echo("ecml:keywords:$keyword:desc"), - 'usage' => elgg_echo("ecml:keywords:$keyword:usage"), - 'type' => 'web_service', - 'params' => $info['params'], - 'embed_format' => $info['embed_format'] - ); - } - - // default entity keyword - $value['entity'] = array( - 'name' => elgg_echo('ecml:keywords:entity'), - 'view' => "ecml/keywords/entity", - 'description' => elgg_echo("ecml:keywords:entity:desc"), - 'usage' => elgg_echo("ecml:keywords:entity:usage") - ); - - return $value; -} - -/** - * Register default views to parse - * - * @param unknown_type $hook - * @param unknown_type $type - * @param unknown_type $value - * @param unknown_type $params - */ -function ecml_views_hook($hook, $type, $value, $params) { - $value['annotation/generic_comment'] = elgg_echo('ecml:views:annotation_generic_comment'); - - return $value; -} - -/** - * Show the special Web Services embed section. - * - * @param unknown_type $hook - * @param unknown_type $type - * @param unknown_type $value - * @param unknown_type $params - */ -function ecml_embed_web_services_hook($hook, $type, $value, $params) { - // we're using a view override for this section's content - // so only need to pass the name. - $value['web_services'] = array( - 'name' => elgg_echo('ecml:embed:web_services') - ); - - return $value; -} - -/** - * Remove ecml code for elgg_strip_tags() - * - * @param unknown_type $hook - * @param unknown_type $type - * @param unknown_type $value - * @param unknown_type $params - */ -function ecml_strip_tags($hook, $type, $value, $params) { - return preg_replace(ECML_KEYWORD_REGEX, '', $value); -} - -// be sure to run after other plugins -elgg_register_event_handler('init', 'system', 'ecml_init', 9999);
\ No newline at end of file diff --git a/mod/ecml/views/default/ecml/admin/css.php b/mod/ecml/views/default/ecml/admin/css.php deleted file mode 100644 index 0b018733a..000000000 --- a/mod/ecml/views/default/ecml/admin/css.php +++ /dev/null @@ -1,156 +0,0 @@ -<?php -/** -* ECML CSS -*/ -?> - -.ecml_admin_table { - width:100%; -} -.ecml_admin_table td, th { - border: 1px solid gray; - text-align: center; - padding: 5px; -} -.ecml_admin_table th, .ecml_keyword_desc { - font-weight: bold; -} -.ecml_row_odd { - background-color: #EEE; -} -.ecml_row_even { - -} -.ecml_restricted { - color: #555; -} - - -/* ecml embed web services list */ -.ecml_web_service_list { - margin:0; - padding:0; -} -.ecml_web_service_list li { - list-style: none; - margin:0 0 0 0; - padding:0; - /* display:inline; */ - -} -.ecml_web_service_list li a { - display:block; - float:left; - height:41px; - width:152px; - background-position: center center; - background-repeat: no-repeat; - text-indent: -900em; - border:2px solid transparent; - margin:0 20px 10px 0; -} -.ecml_web_service_list li a.selected { - border-color:#999999; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; -} -.ecml_web_service_list li a.youtube { - background-image: url(<?php echo elgg_get_site_url(); ?>mod/ecml/graphics/logo_youtube.gif); - width:102px; -} -.ecml_web_service_list li a.slideshare { - background-image: url(<?php echo elgg_get_site_url(); ?>mod/ecml/graphics/logo_slideshare.gif); -} -.ecml_web_service_list li a.vimeo { - background-image: url(<?php echo elgg_get_site_url(); ?>mod/ecml/graphics/logo_vimeo.gif); - width:130px; -} -.ecml_web_service_list li a.googlemaps { - background-image: url(<?php echo elgg_get_site_url(); ?>mod/ecml/graphics/logo_googlemaps.gif); -} -.ecml_web_service_list li a.blip_tv { - background-image: url(<?php echo elgg_get_site_url(); ?>mod/ecml/graphics/logo_bliptv.gif); - width:102px; -} -.ecml_web_service_list li a.dailymotion { - background-image: url(<?php echo elgg_get_site_url(); ?>mod/ecml/graphics/logo_dailymotion.gif); -} -.ecml_web_service_list li a.livevideo { - background-image: url(<?php echo elgg_get_site_url(); ?>mod/ecml/graphics/logo_livevideo.gif); - width:166px; -} -.ecml_web_service_list li a.redlasso { - background-image: url(<?php echo elgg_get_site_url(); ?>mod/ecml/graphics/logo_redlasso.gif); - background-position:center 4px; - width:130px; -} - -.embed_content_section { - border:none; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - background-color:#EEEEEE; - margin:10px 0 10px 0; - padding:5px; - width:auto; -} -.ecml_generated_code { - color:#666666; - font-size:85%; - font-style:normal; - line-height: 1.3em; - margin:5px 0; -} -.ecml_embed_instructions, -.ecml_embed_preview { - background-image: url(<?php echo elgg_get_site_url(); ?>_graphics/elgg_sprites.png); - background-repeat: no-repeat; - background-position: 0px -367px; - padding-left: 12px; -} -.ecml_embed_instructions.open, -.ecml_embed_preview.open { - background-position: 0px -388px; -} -#embed_service_url { - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - background-color:#EEEEEE; - margin:10px 0 10px 0; - padding:5px; - width:auto; -} -#web_services_resource { - width:670px; -} -#url_status { - width:30px; - height:30px; - float:right; -} -#url_status.success { - background-image: url(<?php echo elgg_get_site_url(); ?>mod/ecml/graphics/url_status.png); - background-repeat: no-repeat; - background-position: left top; -} -#url_status.failure { - background-image: url(<?php echo elgg_get_site_url(); ?>mod/ecml/graphics/url_status.png); - background-repeat: no-repeat; - background-position: left bottom; -} -#embed_ecml_keyword_help, -#ecml_preview { - padding:10px; -} -#ecml_preview object, -#ecml_preview embed, -#ecml_preview iframe { - width: auto; - max-height:240px; -} -#embed_submit { - margin:10px 0 0 0; -} - - - diff --git a/mod/ecml/views/default/ecml/help.php b/mod/ecml/views/default/ecml/help.php deleted file mode 100644 index 4fca93a2a..000000000 --- a/mod/ecml/views/default/ecml/help.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php -/** - * Lists available keywords - * - * @package ECML - */ - -$keywords = $vars['config']->ecml_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 .= " -<dt>[$keyword]</dt> -<dd>$desc</dd>"; -} - -echo " -<h3>$title</h3> -<p>$instructions</p> -$more_info -<dl> - $keywords_html -</dl> -";
\ No newline at end of file diff --git a/mod/ecml/views/default/ecml/help/blip.tv.php b/mod/ecml/views/default/ecml/help/blip.tv.php deleted file mode 100644 index bac4c99c3..000000000 --- a/mod/ecml/views/default/ecml/help/blip.tv.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php -/** - * ECML help for blip.tv - */ - -echo '<h3>' . elgg_echo('ecml:keywords:blip.tv') . '</h3>'; -echo '<p>' . elgg_echo('ecml:keywords:blip.tv:desc') . '</p>'; -echo '<p>' . elgg_echo('ecml:keywords:blip.tv:usage') . '</p>'; - -?> - -<img src="<?php echo elgg_get_site_url()?>mod/ecml/graphics/blip.tv.png" />
\ No newline at end of file diff --git a/mod/ecml/views/default/ecml/help/dailymotion.php b/mod/ecml/views/default/ecml/help/dailymotion.php deleted file mode 100644 index 80efa91e7..000000000 --- a/mod/ecml/views/default/ecml/help/dailymotion.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php -/** - * ECML help for dailymotion - */ - -echo '<h3>' . elgg_echo('ecml:keywords:dailymotion') . '</h3>'; -echo '<p>' . elgg_echo('ecml:keywords:dailymotion:desc') . '</p>'; -echo '<p>' . elgg_echo('ecml:keywords:dailymotion:usage') . '</p>'; - -?> - -<img src="<?php echo elgg_get_site_url()?>mod/ecml/graphics/dailymotion.png" />
\ No newline at end of file diff --git a/mod/ecml/views/default/ecml/help/googlemaps.php b/mod/ecml/views/default/ecml/help/googlemaps.php deleted file mode 100644 index d55c351fb..000000000 --- a/mod/ecml/views/default/ecml/help/googlemaps.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php -/** - * ECML help for googlemaps - */ - -echo '<h3>' . elgg_echo('ecml:keywords:googlemaps') . '</h3>'; -echo '<p>' . elgg_echo('ecml:keywords:googlemaps:desc') . '</p>'; -echo '<p>' . elgg_echo('ecml:keywords:googlemaps:usage') . '</p>'; - -?> - -<img src="<?php echo elgg_get_site_url()?>mod/ecml/graphics/googlemaps.png" />
\ No newline at end of file diff --git a/mod/ecml/views/default/ecml/help/livevideo.php b/mod/ecml/views/default/ecml/help/livevideo.php deleted file mode 100644 index 1343a34da..000000000 --- a/mod/ecml/views/default/ecml/help/livevideo.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php -/** - * ECML help for livevideo - */ - -echo '<h3>' . elgg_echo('ecml:keywords:livevideo') . '</h3>'; -echo '<p>' . elgg_echo('ecml:keywords:livevideo:desc') . '</p>'; -echo '<p>' . elgg_echo('ecml:keywords:livevideo:usage') . '</p>'; - -?> - -<img src="<?php echo elgg_get_site_url()?>mod/ecml/graphics/livevideo.png" />
\ No newline at end of file diff --git a/mod/ecml/views/default/ecml/help/redlasso.php b/mod/ecml/views/default/ecml/help/redlasso.php deleted file mode 100644 index 07b497913..000000000 --- a/mod/ecml/views/default/ecml/help/redlasso.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php -/** - * ECML help for redlasso - */ - -echo '<h3>' . elgg_echo('ecml:keywords:redlasso') . '</h3>'; -echo '<p>' . elgg_echo('ecml:keywords:redlasso:desc') . '</p>'; -echo '<p>' . elgg_echo('ecml:keywords:redlasso:usage') . '</p>'; - -?> - -<img src="<?php echo elgg_get_site_url()?>mod/ecml/graphics/redlasso_1.png" /> -<img src="<?php echo elgg_get_site_url()?>mod/ecml/graphics/redlasso_2.png" /> diff --git a/mod/ecml/views/default/ecml/help/slideshare.php b/mod/ecml/views/default/ecml/help/slideshare.php deleted file mode 100644 index 45ada4b54..000000000 --- a/mod/ecml/views/default/ecml/help/slideshare.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php -/** - * ECML help for youtube - */ - -echo '<h3>' . elgg_echo('ecml:keywords:slideshare') . '</h3>'; -echo '<p>' . elgg_echo('ecml:keywords:slideshare:desc') . '</p>'; -echo '<p>' . elgg_echo('ecml:keywords:slideshare:usage') . '</p>'; - -?> - -<img src="<?php echo elgg_get_site_url()?>mod/ecml/graphics/slideshare.png" />
\ No newline at end of file diff --git a/mod/ecml/views/default/ecml/help/vimeo.php b/mod/ecml/views/default/ecml/help/vimeo.php deleted file mode 100644 index e5f6ae28a..000000000 --- a/mod/ecml/views/default/ecml/help/vimeo.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php -/** - * ECML help for vimeo - */ - -echo '<h3>' . elgg_echo('ecml:keywords:vimeo') . '</h3>'; -echo '<p>' . elgg_echo('ecml:keywords:vimeo:desc') . '</p>'; -echo '<p>' . elgg_echo('ecml:keywords:vimeo:usage') . '</p>'; - -?> - -<img src="<?php echo elgg_get_site_url()?>mod/ecml/graphics/vimeo.png" />
\ No newline at end of file diff --git a/mod/ecml/views/default/ecml/help/youtube.php b/mod/ecml/views/default/ecml/help/youtube.php deleted file mode 100644 index 53be4a3c0..000000000 --- a/mod/ecml/views/default/ecml/help/youtube.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php -/** - * ECML help for youtube - */ - -echo '<h3>' . elgg_echo('ecml:keywords:youtube') . '</h3>'; -echo '<p>' . elgg_echo('ecml:keywords:youtube:desc') . '</p>'; -echo '<p>' . elgg_echo('ecml:keywords:youtube:usage') . '</p>'; - -?> - -<img src="<?php echo elgg_get_site_url()?>mod/ecml/graphics/youtube.png" />
\ 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 d5da6dd13..000000000 --- a/mod/ecml/views/default/ecml/input_ext.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -/** - * Displays an ECML icon on ECML-enabled forms - * - * @package ECML - */ - -$docs_href = elgg_get_site_url()."pg/ecml"; -?> -<a href="<?php echo $docs_href; ?>" class="elgg-longtext-control" title="<?php echo elgg_echo('ecml:help'); ?>" target="_new"><img src="<?php echo elgg_get_site_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/keyword_help.php b/mod/ecml/views/default/ecml/keyword_help.php deleted file mode 100644 index 6f9021fdd..000000000 --- a/mod/ecml/views/default/ecml/keyword_help.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php -/** - * Specific keyword help. - * - * Looks for a view ecml/help/keyword - * - */ - -$keyword = elgg_get_array_value('keyword', $vars); -$content = elgg_view("ecml/help/$keyword"); - -if (!$keyword || !ecml_is_valid_keyword($keyword)) { - echo elgg_echo('ecml:help:invalid_keyword'); -} elseif (!$content) { - echo elgg_echo('ecml:help:no_help'); -} else { - echo $content; -}
\ No newline at end of file diff --git a/mod/ecml/views/default/ecml/keywords/blip.tv.php b/mod/ecml/views/default/ecml/keywords/blip.tv.php deleted file mode 100644 index 453026533..000000000 --- a/mod/ecml/views/default/ecml/keywords/blip.tv.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php -/** - * ECML Blip.tv support - * - * @package ECML - */ - -$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 deleted file mode 100644 index 4060d6117..000000000 --- a/mod/ecml/views/default/ecml/keywords/dailymotion.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php -/** - * ECML Daily Motion support - * - * @package ECML - */ - -$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/entity.php b/mod/ecml/views/default/ecml/keywords/entity.php deleted file mode 100644 index 73491f6a3..000000000 --- a/mod/ecml/views/default/ecml/keywords/entity.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php -/** - * ECML Generic Object GUID - * - * @package ECML - */ - -$guid = $vars['guid']; - -if ($entity = get_entity($guid)) { - echo elgg_view('output/url', array( - 'href' => $entity->getURL(), - 'title' => $entity->title, - 'text' => $entity->title, - 'class' => "embeded_file link", - // abusing the js attribute - 'js' => "style=\"background-image:url({$entity->getIcon('tiny')})\"" - - )); -} else { - echo elgg_echo('ecml:entity:invalid'); -}
\ No newline at end of file diff --git a/mod/ecml/views/default/ecml/keywords/googlemaps.php b/mod/ecml/views/default/ecml/keywords/googlemaps.php deleted file mode 100644 index 2e13f9f43..000000000 --- a/mod/ecml/views/default/ecml/keywords/googlemaps.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php -/** - * ECML Google Maps support - * - * @package ECML - */ - -$src = (isset($vars['src'])) ? $vars['src'] : FALSE; -$width = (isset($vars['width'])) ? $vars['width'] : 425; -$height = (isset($vars['height'])) ? $vars['height'] : 350; - -if ($src) { - $src = html_entity_decode($src); - - $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 " -<iframe width=\"$width\" height=\"$height\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" src=\"$embed_src\"></iframe> -<br /> -<small><a href=\"$link_href\" style=\"color:#0000FF;text-align:left\">" . elgg_echo('ecml:googlemaps:view_larger_map') . "</a></small> -"; -}
\ 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 deleted file mode 100644 index b445f4575..000000000 --- a/mod/ecml/views/default/ecml/keywords/livevideo.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php -/** - * ECML Live Video support - * - * @package ECML - */ - -$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[0]; - - // 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 deleted file mode 100644 index 462865bec..000000000 --- a/mod/ecml/views/default/ecml/keywords/redlasso.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php -/** - * ECML Red Lasso support - * - * @package ECML - */ - -$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 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 34db6aed5..000000000 --- a/mod/ecml/views/default/ecml/keywords/slideshare.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php -/** - * ECML Slideshare support - * - * @package ECML - */ - -// 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 b1c398e2e..000000000 --- a/mod/ecml/views/default/ecml/keywords/user_list.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php -/** - * Lists users - * - * @package SitePages - */ - -$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 263eb3740..000000000 --- a/mod/ecml/views/default/ecml/keywords/vimeo.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php -/** - * ECML vimeo support - * - * @package ECML - */ - -$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 c212f6841..000000000 --- a/mod/ecml/views/default/ecml/keywords/youtube.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/** - * ECML Youtube support - * - * @package ECML - */ - -$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 diff --git a/mod/ecml/views/default/embed/web_services/content.php b/mod/ecml/views/default/embed/web_services/content.php deleted file mode 100644 index 9e7ffbbb4..000000000 --- a/mod/ecml/views/default/embed/web_services/content.php +++ /dev/null @@ -1,220 +0,0 @@ -<?php -/** - * URL -> ECML converter for supported 3rd party services. - * - * Tries to automatically detect which site/ecml to use. - * Will highlight the correct one. - * If can find none, will show an error. - * Lets users click to force an ECML keyword, but will display a warning. - * - */ - -$internal_name = elgg_get_array_value('internal_name', $vars); - -$keywords = ecml_get_keywords(); -elgg_sort_3d_array_by_value($keywords, 'name'); - -$keyword_js_array = array(); -$keywords_html = "<ul class='ecml_web_service_list clearfix'>"; -// include support for standard ECML so you can get previews and validation. -//$keyword_html = '<li class="ecml_web_service"><a class="ecml">Generic ECML</a></li>'; - -foreach ($keywords as $i => $v) { - if (!isset($v['type']) || $v['type'] != 'web_service') { - unset ($keywords[$i]); - continue; - } - - // make sure the classname doens't have invalid chars. - $class = str_replace(array('.', ','), '_', $i); - $keyword_js_array[] = $class; - - $keywords_html .= "<li class='ecml_web_service'><a class=\"$class link\">{$v['name']}</a></li>"; -} - -$keywords_html .= "</ul>"; - -$keywords_js = json_encode($keyword_js_array); - -$input = elgg_view('input/text', array( - 'internalid' => 'web_services_resource' -)); - -$embed = elgg_view('input/submit', array( - 'name' => 'buggy', - 'internalid' => 'embed_submit', - 'type' => 'button', - 'value' => elgg_echo('embed:embed'), - 'class' => 'elgg-submit-button disabled', - 'disabled' => TRUE -)); - -echo '<p>' . elgg_echo('ecml:embed:instructions') . '</p>'; - -echo $keywords_html; - -echo "<div class='embed_content_section instructions hidden'><a class='ecml_embed_instructions link'>Instructions</a>"; -echo "<div id='embed_ecml_keyword_help' class='hidden'></div></div>"; - -echo "<div id='embed_service_url'><label>URL<br />".$input."<div id='url_status' class=''></div></label>"; -echo "<div class='ecml_generated_code hidden'>ECML: <span id='ecml_code'></span></div></div>"; - -echo "<div class='embed_content_section preview hidden'><a class='ecml_embed_preview link'>Preview</a>"; -echo "<div id='ecml_preview' class='hidden'></div></div>"; - -echo "<div class='divider margin-top'></div>"; -echo $embed; - -?> - -<script type="text/javascript"> - -$(document).ready(function() { - $('a.ecml_embed_instructions.link').click(function() { - elgg_slide_toggle($(this), '.embed_content_section.instructions', '#embed_ecml_keyword_help'); - $('.ecml_embed_instructions').toggleClass('open'); - }); - - $('a.ecml_embed_preview.link').click(function() { - elgg_slide_toggle($(this), '.embed_content_section.preview', '#ecml_preview'); - $('.ecml_embed_preview').toggleClass('open'); - }); -}); - -$(function() { - var keywords = <?php echo $keywords_js; ?>; - var selected_service = ''; - var manual_selected_service = false; - var embed_button = $('#embed_submit'); - var url_status = $('#url_status'); - var embed_resource_input = $('#web_services_resource'); - - // counter for paused input to try to validate/generate a preview. - var rest_timeout_id = null; - var rest_min_time = 750; - var embed_generate_ecml_url = '<?php echo elgg_get_site_url(); ?>pg/ecml_generate'; - var embed_ecml_keyword_help_url = '<?php echo elgg_get_site_url(); ?>pg/ecml/'; - var internal_name = '<?php echo addslashes($internal_name); ?>'; - - var web_services_ecml_update = function() { - if (rest_timeout_id) { - clearTimeout(rest_timeout_id); - } - - if (manual_selected_service) { - // fire off preview attempt - rest_timeout_id = setTimeout(generate_ecml, rest_min_time); - return true; - } - - var value = $(this).val(); - var value_length = value.length; - - if (value_length > 0) { - //embed_button.removeAttr('disabled').removeClass('disabled');//.addClass('embed_warning'); - url_status.removeClass('success').addClass('failure'); - } else { - embed_button.attr('disabled', 'disabled').addClass('disabled'); - url_status.removeClass('success').removeClass('failure'); - } - - if (value_length < 5) { - $('.ecml_web_service a').removeClass('selected'); - return true; - } - - // if this is ECML check that it's a valid keyword - if (value.substr(0, 1) == '[') { - var keyword = value.split(' ')[0]; - keyword = keyword.replace('[', ''); - keyword = keyword.replace(']', ''); - if ($.inArray(keyword, keywords) >= 0) { - select_service(keyword); - } - } else { - // check if any of the ECML keywords exist in the - // string and select that service. - $(keywords).each(function(index, keyword) { - if (value.indexOf(keyword) >= 0) { - select_service(keyword); - return true; - } - }); - } - - // fire off a preview attempt - if (selected_service) { - rest_timeout_id = setTimeout(generate_ecml, rest_min_time); - } - }; - - var select_service = function(service) { - if ($.inArray(service, keywords) === false) { - return false; - } - - selected_service = service; - $('.ecml_web_service a').removeClass('selected'); - $('.ecml_web_service a.' + service).addClass('selected'); - $('.embed_content_section.instructions').removeClass('hidden'); // reveal instructions link/panel - } - - // pings back core to generate the ecml. - // includes a status, ecml code, and the generated html. - var generate_ecml = function() { - if (!selected_service) { - return false; - } - - var resource = embed_resource_input.val(); - var post_data = {'service': selected_service, 'resource': resource}; - - $.post(embed_generate_ecml_url, post_data, function(data) { - if (data.status == 'success') { - // show previews and update embed code. - $('#ecml_preview').html(data.html); - $('#ecml_code').html(data.ecml); - $('body').data('elgg_embed_ecml', data.ecml); - $('.embed_content_section.preview').removeClass('hidden'); // reveal preview link/panel - $('.ecml_generated_code').removeClass('hidden'); // reveal ecml generated code - - // set status for embed button - embed_button.removeAttr('disabled').removeClass('disabled'); - url_status.removeClass('failure').addClass('success'); - } else { - // data failure - embed_button.attr('disabled', 'disabled').addClass('disabled'); - url_status.removeClass('success').removeClass('failure'); - } - }, 'json'); - } - - // auto guess the service. - embed_resource_input.keyup(web_services_ecml_update); - - // manually specify the service - $('.ecml_web_service a').click(function() { - select_service($(this).attr('class').split(' ')[0]); - manual_selected_service = true; - - // show tip - var help_url = embed_ecml_keyword_help_url + selected_service + '?ajax=true'; - $('#embed_ecml_keyword_help').load(help_url); - }); - - $('#embed_submit').click(function() { - // insert the ECML - // if the ECML input is empty, insert the resource. - if (!(content = $('body').data('elgg_embed_ecml'))) { - // @todo display an error? - content = embed_resource_input.val(); - } - - elggEmbedInsertContent(content, internal_name); - - return false; - }); -}); - - -</script>
\ No newline at end of file diff --git a/mod/ecml/views/default/settings/ecml/edit.php b/mod/ecml/views/default/settings/ecml/edit.php deleted file mode 100644 index 8c1a3b4a1..000000000 --- a/mod/ecml/views/default/settings/ecml/edit.php +++ /dev/null @@ -1,133 +0,0 @@ -<?php -/** - * Configs granular access - * - * @package ECML - */ - -$views = $vars['config']->ecml_parse_views; -$keywords = $vars['config']->ecml_keywords; -$perms = $vars['config']->ecml_permissions; - -ksort($views); -ksort($keywords); - -echo '<p class="margin-top">' . elgg_echo('ecml:admin:instruction') . '</p>'; - -// yes I'm using a table because this is table. -$form_body = <<<___END -<table class="ecml_admin_table"> - <tr> - <th> </th> -___END; - -foreach ($views as $view => $view_desc) { - $form_body .= "<th><acronym class=\"ecml_view ecml_check_all\" title=\"$view\">$view_desc</acronym></th>"; - $n++; -} -$form_body .= '</tr>'; - -$odd = 'odd'; -foreach ($keywords as $keyword => $keyword_info) { - $keyword_desc = $keyword_info['description']; - if (isset($keyword_info['restricted'])) { - $restricted = elgg_echo('ecml:admin:restricted'); - $form_body .= " - <tr class=\"ecml_row_$odd\"> - <td class=\"ecml_keyword_desc\"><acronym class=\"ecml_keyword ecml_restricted\" title=\"$keyword_desc\">$keyword ($restricted)</acronym></td> - "; - } else { - $form_body .= " - <tr class=\"ecml_row_$odd\"> - <td class=\"ecml_keyword_desc\"><acronym class=\"ecml_keyword ecml_check_all\" title=\"$keyword_desc\">$keyword</acronym></td> - "; - } - foreach ($views as $view => $view_info) { - // if this is restricted and we're not on the specified view don't allow changes - // since we don't save this, no need to pass a name - if (isset($keyword_info['restricted'])) { - $checked = (in_array($view, $keyword_info['restricted'])) ? 'checked="checked"' : ''; - $form_body .= "<td><input type=\"checkbox\" $checked name=\"whitelist[$view][]\" value=\"$keyword\" disabled=\"disabled\"/></td>"; - } else { - $checked = (!in_array($keyword, $perms[$view])) ? 'checked="checked"' : ''; - - // ooook. input/checkboxes isn't overly useful. - // do it ourself. - $form_body .= "<td><input type=\"checkbox\" name=\"whitelist[$view][]\" value=\"$keyword\" $checked /></td>"; - } - } - $form_body .= '</tr>'; - - $odd = ($odd == 'odd') ? 'even' : 'odd'; -} - -$form_body .= '</table>'; - -echo $form_body; - -?> -<script type="text/javascript"> - -$(document).ready(function() { - // append check all link - $('.ecml_check_all').before('<input type="checkbox" checked="checked" class="check_all">'); - - // determin initial state of checkall checkbox. - $('.ecml_check_all').each(function() { - var keyword = $(this).hasClass('ecml_keyword'); - var checkbox = $(this).parent().find('input[type=checkbox]'); - var checked; - - // no keywords checked, checkall unchecked - // any keyword checked, checkall unchecked - // all keywords checked, checkall checked - - // if keyword, check the TR - if (keyword) { - checked = true; - $(this).parent().parent().find('input').each(function() { - if (!$(this).hasClass('check_all') && !$(this).attr('disabled')) { - checked = (checked && $(this).attr('checked')); - // can't break... - } - }); - checkbox.attr('checked', checked); - } else { - checked = true; - var rowIndex = $(this).parent().parent().children().index($(this).parent()); - - $('.ecml_admin_table > tbody > tr td:nth-child(' + (rowIndex + 1) + ') input[type=checkbox]').each(function() { - if (!$(this).hasClass('check_all') && !$(this).attr('disabled')) { - checked = (checked && $(this).attr('checked')); - // can't break... - } - }); - checkbox.attr('checked', checked); - } - }); - - // handle checkall boxes - $('input.check_all').click(function() { - // yoinked from - // http://stackoverflow.com/questions/788225/table-row-and-column-number-in-jquery - var rowIndex = $(this).parent().parent().children().index($(this).parent()); - var check = $(this).attr('checked'); - - // clicked on a keyword on the left, check all boxes in the tr - if (rowIndex == 0) { - $(this).parent().parent().find('input').each(function() { - if (!$(this).attr('disabled')) { - $(this).attr('checked', check); - } - }); - } else { - boxes = $('.ecml_admin_table > tbody > tr td:nth-child(' + (rowIndex + 1) + ') input[type=checkbox]'); - boxes.each(function() { - if (!$(this).attr('disabled')) { - $(this).attr('checked', check); - } - }); - } - }); -}); -</script> |