]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Refs #2360: Deprecated page_draw in favor of elgg_view_page. Updated packaged docume...
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 2 Nov 2010 23:51:12 +0000 (23:51 +0000)
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 2 Nov 2010 23:51:12 +0000 (23:51 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7208 36083f99-b078-4883-b0ff-0f9b5a30f544

documentation/examples/hooks/register/advanced.php
engine/lib/views.php

index a21a2e232fc264b12abf2d53e19344ec6296efd8..627bb545444c394bdceb585f2f3c7df3d51c9904 100644 (file)
@@ -1,6 +1,6 @@
 <?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);
 
@@ -11,7 +11,7 @@ function example_plugin_hook_handler($event, $type, $value, $params) {
        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);
        
@@ -20,4 +20,4 @@ function example_plugin_hook_handler($event, $type, $value, $params) {
 
 $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
index 82be10118e1c96de784c34a6dfa09361bfece7a5..f9ceafd2dd9db3d147e0d8eb941c8159835c97e5 100644 (file)
@@ -1303,9 +1303,10 @@ function autoregister_views($view_base, $folder, $base_location_path, $viewtype)
  * @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");
 
@@ -1327,13 +1328,15 @@ function page_draw($title, $body, $page_shell = 'page_shells/default', $vars = a
        $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);
 }
 
 /**