<?php
-// the output:page hook is triggered by page_draw().
+// the output:page hook is triggered by elgg_view_page().
register_plugin_hook('output', 'page', 'example_plugin_hook_handler', 600);
register_plugin_hook('output', 'page', 'example_plugin_hook_handler_2', 601);
return $value;
}
-function example_plugin_hook_handler($event, $type, $value, $params) {
+function example_plugin_hook_handler_2($event, $type, $value, $params) {
// change S to $
$value = str_replace('S', '$', $value);
$content = 'This is some Sample Content.';
-page_draw('Title', $content);
\ No newline at end of file
+echo elgg_view_page('Title', $content);
\ No newline at end of file
* @param array $vars Optional vars array to pass to the page
* shell. Automatically adds title, body, and sysmessages
*
- * @return NULL
+ * @return string The contents of the page
+ * @since 1.8
*/
-function page_draw($title, $body, $page_shell = 'page_shells/default', $vars = array()) {
+function elgg_view_page($title, $body, $page_shell = 'page_shells/default', $vars = array()) {
// get messages - try for errors first
$sysmessages = system_messages(NULL, "errors");
$vars['page_shell'] = $page_shell;
// Allow plugins to mod output
- $output = trigger_plugin_hook('output', 'page', $vars, $output);
-
- $split_output = str_split($output, 1024);
+ return trigger_plugin_hook('output', 'page', $vars, $output);
+}
- foreach ($split_output as $chunk) {
- echo $chunk;
- }
+/**
+ * @deprecated 1.8 Use elgg_view_page()
+ */
+function page_draw($title, $body, $page_shell = 'page_shells/default', $vars = array()) {
+ elgg_deprecated_notice("page_draw() was deprecated in favor of elgg_view_page() in 1.8.", 1.8);
+ echo elgg_view_page($title, $body, $page_shell, $vars);
}
/**