diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-04-12 22:23:05 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-04-12 22:23:05 +0000 |
commit | af113e044fe8225a40ddd128f9226b973b0b6437 (patch) | |
tree | 4456d4ee056a3564eb01837ab2f091b57ec540e2 /mod/sitepages/start.php | |
parent | 088d0638957cd6bc683711743d04091b6789cfd1 (diff) | |
download | elgg-af113e044fe8225a40ddd128f9226b973b0b6437.tar.gz elgg-af113e044fe8225a40ddd128f9226b973b0b6437.tar.bz2 |
Updated site pages docs.
Added ability to pass arguments to custom keywords.
Added user_list keyword.
Reject logged out front pages that don't have [[login_box]].
git-svn-id: http://code.elgg.org/elgg/trunk@5710 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/sitepages/start.php')
-rw-r--r-- | mod/sitepages/start.php | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/mod/sitepages/start.php b/mod/sitepages/start.php index 8450eb872..a1a9f6978 100644 --- a/mod/sitepages/start.php +++ b/mod/sitepages/start.php @@ -63,6 +63,7 @@ function sitepages_init() { // grab the list of keywords and their views from plugins if ($keywords = trigger_plugin_hook('get_keywords', 'sitepages', NULL, array())) { + ksort($keywords); $CONFIG->sitepages_keywords = $keywords; } @@ -184,26 +185,10 @@ function sitepages_page_handler($page) { function sitepages_parse_view($hook, $entity_type, $return_value, $params) { global $CONFIG; - // give me everything that is (string):(any thing that's not a ]) surrounded by [[ ]]s - $keyword_regex = '/\[\[([a-z]+):([^\]]+)\]\]/'; + // give me everything that is (not a ]) possibly followed by a : and surrounded by [[ ]]s + $keyword_regex = '/\[\[([a-z0-9_]+):?([^\]]+)?\]\]/'; if (in_array($params['view'], $CONFIG->sitepages_parse_views)) { - $keywords = $CONFIG->sitepages_keywords; - - $view_options = array( - 'view' => $params['view'] - ); - - foreach ($keywords as $keyword => $info) { - if (strpos($return_value, "[[$keyword]]") !== FALSE - && ($content = elgg_view($info['view'], $view_options))) { - $return_value = str_replace("[[$keyword]]", $content, $return_value); - } - } - - // parse for specialized tags: - // [[entity: key=value, key=value,etc]] - // [[view:viewname, vars_key=value,...]] $return_value = preg_replace_callback($keyword_regex, 'sitepages_parse_view_match', $return_value); } @@ -226,8 +211,13 @@ function sitepages_keyword_hook($hook, $entity_type, $return_value, $params) { 'description' => elgg_echo('sitepages:keywords:login_box') ); + $return_value['user_list'] = array( + 'view' => 'sitepages/keywords/user_list', + 'description' => elgg_echo('sitepages:keywords:user_list') + ); + $return_value['site_stats'] = array( - 'view' => 'this/doesnt/exist/yet', + 'view' => 'sitepages/keywords/site_stats', 'description' => elgg_echo('sitepages:keywords:site_stats') ); |