From 99a301cd791d767c2b6ee9e2ff608ad9cbf1d281 Mon Sep 17 00:00:00 2001 From: brettp Date: Fri, 16 Apr 2010 15:46:07 +0000 Subject: ECML now only requires a single square bracket. git-svn-id: http://code.elgg.org/elgg/trunk@5775 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/ecml/README.txt | 38 ++++++++++++++++++------------------ mod/ecml/languages/en.php | 22 ++++++++++----------- mod/ecml/start.php | 7 ++++--- mod/ecml/views/default/ecml/help.php | 2 +- 4 files changed, 35 insertions(+), 34 deletions(-) diff --git a/mod/ecml/README.txt b/mod/ecml/README.txt index 67d452241..63a9aacdc 100644 --- a/mod/ecml/README.txt +++ b/mod/ecml/README.txt @@ -28,13 +28,13 @@ CONTENTS: 3. USING ECML KEYWORDS - All ECML keywords are surrounded by two square brackets: [[ and ]]. + 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 + [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' @@ -43,9 +43,9 @@ CONTENTS: 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]]. + The two utility keywords available are [entity] and [view]. - [[entity]] - Displays a list of entities using similar arguments to the + [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. @@ -53,20 +53,20 @@ CONTENTS: * 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]] + [entity type=object subtype=blog owner=admin] Example: Displays newest group created: - [[entity type=object subtype=group limit=1]] + [entity type=object subtype=group limit=1] - [[view]] - Displays a valid Elgg view passing any optional parameters to + [view] - Displays a valid Elgg view passing any optional parameters to the view. Example: Display a text input: - [[view src="input/text"]] + [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!"]] + [view src="input/longtext" value="This is an example of a quoted value!"] 3.2 EMBEDDED 3RD PARTY MEDIA @@ -74,10 +74,10 @@ CONTENTS: 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.) + * 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) @@ -107,7 +107,7 @@ CONTENTS: How a user will call the keyword: - [[buttonizer text="This is my button!"]] + [buttonizer text="This is my button!"] How to implement this in a plugin: @@ -118,7 +118,7 @@ CONTENTS: $value['buttonizer'] = array( '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!' + 'usage' => 'Use [buttonizer text="My text"] to make "My text" a button!' ); return $value; @@ -134,11 +134,11 @@ CONTENTS: This is exactly the same as saying: - [[view src="buttonizer/ecml/buttonizer" text="This is my button!"]] + [view src="buttonizer/ecml/buttonizer" text="This is my button!"] or even: - [[view src="input/button" value="This is my button!" type="button"]] + [view src="input/button" value="This is my button!" type="button"] but is much simpler for the user. diff --git a/mod/ecml/languages/en.php b/mod/ecml/languages/en.php index 2d1b873ad..2b9b9118b 100644 --- a/mod/ecml/languages/en.php +++ b/mod/ecml/languages/en.php @@ -19,45 +19,45 @@ $english = array( // keywords 'ecml:keywords:desc:entity' => 'Displays a list of any Elgg entity.', - 'ecml:keywords:usage:entity' => '[[entity]] supports all options in elgg_get_entities()', + 'ecml:keywords:usage:entity' => '[entity] supports all options in elgg_get_entities()', 'ecml:keywords:desc:view' => 'Displays any Elgg view.', - 'ecml:keywords:usage:view' => '[[view src="valid/view" arg1=value1 arg2=value2]]', + 'ecml:keywords:usage:view' => '[view src="valid/view" arg1=value1 arg2=value2]', 'ecml:keywords:desc:googlemaps' => 'Embed a Google Map.', - 'ecml:keywords:usage:entity' => '[[googlemaps src="URL"]] Use the link code from Google Maps as the src.', + 'ecml:keywords:usage:entity' => '[googlemaps src="URL"] Use the link code from Google Maps as the src.', 'ecml:keywords:desc:slideshare' => 'Embed a Slideshare slide.', - 'ecml:keywords:usage:entity' => '[[slideshare id="slideshare_id"]] Use the Wordpress.com embed code, but make sure there are two [s and ]s surrounding it!', + 'ecml:keywords:usage:entity' => '[slideshare id="slideshare_id"] Use the Wordpress.com embed code.', 'ecml:keywords:desc:vimeo' => 'Embed a Vimeo video.', - 'ecml:keywords:usage:videmo' => '[[videmo src="URL"]] Use a standard Vimeo URL as the source.', + 'ecml:keywords:usage:videmo' => '[videmo src="URL"] Use a standard Vimeo URL as the source.', 'ecml:keywords:desc:youtube' => 'Embed a YouTube video.', - 'ecml:keywords:usage:entity' => '[[youtube src="URL"]] Use a standard YouTube URL as the source.', + 'ecml:keywords:usage:entity' => '[youtube src="URL"] Use a standard YouTube URL as the source.', // keyword help '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. + 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' => '

You can build your own keywords for views and entities.

-

[[entity: type=type, subtype=subtype, owner=username, limit=number]]
+

[entity: type=type, subtype=subtype, owner=username, limit=number]
EX: To show 5 blog posts by admin:
- [[entity: type=object, subtype=blog, owner=admin, limit=5]]

+ [entity: type=object, subtype=blog, owner=admin, limit=5]

You can also specify a valid Elgg view:
- [[view: elgg_view, name=value]]

+ [view: elgg_view, name=value]

Ex: To show a text input with a default value:
- [[view: input/text, value=This is a default value]]

', + [view: input/text, value=This is a default value]

', // admin 'ecml:admin:admin' => 'ECML Permissions', diff --git a/mod/ecml/start.php b/mod/ecml/start.php index 287bdc730..941bd90a2 100644 --- a/mod/ecml/start.php +++ b/mod/ecml/start.php @@ -118,9 +118,9 @@ function ecml_admin_page_handler($page) { 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 + // give me everything that is not a ], possibly followed by a :, and surrounded by [ ]s //$keyword_regex = '/\[\[([a-z0-9_]+):?([^\]]+)?\]\]/'; - $keyword_regex = '/\[\[([a-z0-9\.]+)([^\]]+)?\]\]/'; + $keyword_regex = '/\[([a-z0-9\.]+)([^\]]+)?\]/'; $CONFIG->ecml_current_view = $params['view']; $return_value = preg_replace_callback($keyword_regex, 'ecml_parse_view_match', $return_value); @@ -179,4 +179,5 @@ function ecml_views_hook($hook, $type, $value, $params) { return $value; } -register_elgg_event_handler('init', 'system', 'ecml_init'); \ No newline at end of file +// be sure to run after other plugins +register_elgg_event_handler('init', 'system', 'ecml_init', 9999); \ No newline at end of file diff --git a/mod/ecml/views/default/ecml/help.php b/mod/ecml/views/default/ecml/help.php index ed2d1eeec..2b33f4f7a 100644 --- a/mod/ecml/views/default/ecml/help.php +++ b/mod/ecml/views/default/ecml/help.php @@ -18,7 +18,7 @@ $keywords_html = ''; foreach ($keywords as $keyword => $info) { $desc = htmlentities($info['description']); $keywords_html .= " -
[[$keyword]]
+
[$keyword]
$desc
"; } -- cgit v1.2.3