aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/hello_world
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--plugins/hello_world/index.php18
-rw-r--r--plugins/hello_world/main.inc.php30
2 files changed, 30 insertions, 18 deletions
diff --git a/plugins/hello_world/index.php b/plugins/hello_world/index.php
deleted file mode 100644
index d2a8bcddb..000000000
--- a/plugins/hello_world/index.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php /*
-Plugin Name: Hello World !
-Author: PhpWebGallery team
-Description: This example plugin changes the page banner for the administration page
-*/
-
-add_event_handler('page_banner', 'hello_world_banner' );
-
-function hello_world_banner($banner)
-{
- global $page;
- if ( isset($page['body_id']) and $page['body_id']=='theAdminPage')
- {
- return '<h1>Hello world from PhpWebGallery plugin!</h1>';
- }
- return $banner;
-}
-?>
diff --git a/plugins/hello_world/main.inc.php b/plugins/hello_world/main.inc.php
new file mode 100644
index 000000000..eb5f98b82
--- /dev/null
+++ b/plugins/hello_world/main.inc.php
@@ -0,0 +1,30 @@
+<?php /*
+Plugin Name: Hello World !
+Author: PhpWebGallery team
+Description: This example plugin changes the page banner for the administration page.
+*/
+
+add_event_handler('loc_begin_page_header', 'hello_world_begin_header' );
+
+function hello_world_begin_header()
+{
+ global $page;
+ if ( isset($page['body_id']) and $page['body_id']=='theAdminPage')
+ {
+ $hellos = array( 'Aloha', 'Ahoy', 'Guten tag', 'Hello', 'Hoi', 'Hola', 'Salut', 'Yo' );
+ shuffle($hellos);
+ $page['page_banner'] = $hellos[0];
+ // just as an example we modify it a little bit later
+ add_event_handler('loc_end_page_header', 'hello_world_end_header');
+ }
+}
+
+
+function hello_world_end_header()
+{
+ global $template, $page;
+ $template->assign_var( 'PAGE_BANNER',
+ '<h1>"'.$page['page_banner'].'" from PhpWebGallery plugin!</h1>');
+}
+
+?> \ No newline at end of file