[Customisation Database Commits] r990 - in /trunk/titania/includes: core/titania.php hooks/ hooks/_hook_phpbb.com.php hooks/index.htm
Nathan Guse
exreaction at phpbb.com
Sun Apr 4 22:46:32 BST 2010
Author: exreaction
Date: Sun Apr 4 22:46:32 2010
New Revision: 990
Log:
Hooks (needed to load the phpbb.com header). Just rename _hook_phpbb.com.php to hook_phpbb.com.php and it will be loaded.
Added:
trunk/titania/includes/hooks/
trunk/titania/includes/hooks/_hook_phpbb.com.php (with props)
trunk/titania/includes/hooks/index.htm
Modified:
trunk/titania/includes/core/titania.php
Modified: trunk/titania/includes/core/titania.php
==============================================================================
*** trunk/titania/includes/core/titania.php (original)
--- trunk/titania/includes/core/titania.php Sun Apr 4 22:46:32 2010
***************
*** 43,48 ****
--- 43,55 ----
public static $cache;
/**
+ * Hooks instance
+ *
+ * @var phpbb_hook
+ */
+ public static $hook;
+
+ /**
* Request time (unix timestamp)
*
* @var int
***************
*** 132,137 ****
--- 139,147 ----
self::generate_breadcrumbs(array(
'CUSTOMISATION_DATABASE' => titania_url::build_url(''),
));
+
+ // Load hooks
+ self::load_hooks();
}
/**
***************
*** 320,325 ****
--- 330,338 ----
'T_STYLESHEET_LINK' => (!phpbb::$user->theme['theme_storedb']) ? self::$absolute_board . '/styles/' . phpbb::$user->theme['theme_path'] . '/theme/stylesheet.css' : self::$absolute_board . 'style.' . PHP_EXT . '?sid=' . phpbb::$user->session_id . '&id=' . phpbb::$user->theme['style_id'] . '&lang=' . phpbb::$user->data['user_lang'],
'T_STYLESHEET_NAME' => phpbb::$user->theme['theme_name'],
));
+
+ // Header hook
+ self::$hook->call_hook('titania_page_header', $page_title);
}
/**
***************
*** 377,382 ****
--- 390,398 ----
'U_PURGE_CACHE' => (phpbb::$auth->acl_get('a_')) ? titania_url::append_url(titania_url::$current_page, array_merge(titania_url::$params, array('cache' => 'purge'))) : '',
));
+ // Footer hook
+ self::$hook->call_hook('titania_page_footer', $run_cron, $template_body);
+
// Call the phpBB footer function
phpbb::page_footer($run_cron);
}
***************
*** 660,665 ****
--- 676,711 ----
}
/**
+ * Load the hooks
+ * Using something very similar to the phpBB hook system
+ */
+ public static function load_hooks()
+ {
+ if (self::$hook)
+ {
+ return;
+ }
+
+ // Add own hook handler
+ phpbb::_include('hooks/index', false, 'phpbb_hook');
+ self::$hook = new phpbb_hook(array('titania_page_header'));
+
+ // Now search for hooks...
+ $dh = @opendir(TITANIA_ROOT . 'includes/hooks/');
+ if ($dh)
+ {
+ while (($file = readdir($dh)) !== false)
+ {
+ if (strpos($file, 'hook_') === 0 && substr($file, -(strlen(PHP_EXT) + 1)) === '.' . PHP_EXT)
+ {
+ include(TITANIA_ROOT . 'includes/hooks/' . $file);
+ }
+ }
+ closedir($dh);
+ }
+ }
+
+ /**
* Include a Titania includes file
*
* @param string $file The name of the file
Added: trunk/titania/includes/hooks/_hook_phpbb.com.php
==============================================================================
*** trunk/titania/includes/hooks/_hook_phpbb.com.php (added)
--- trunk/titania/includes/hooks/_hook_phpbb.com.php Sun Apr 4 22:46:32 2010
***************
*** 0 ****
--- 1,32 ----
+ <?php
+ /**
+ *
+ * @package Titania
+ * @version $Id$
+ * @copyright (c) 2008 phpBB Customisation Database Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ *
+ */
+
+ /**
+ * @ignore
+ */
+ if (!defined('IN_TITANIA'))
+ {
+ exit;
+ }
+
+ titania::$hook->register('titania_page_header', 'phpbb_com_header');
+
+ function phpbb_com_header($page_title)
+ {
+ // Setup the phpBB.com header
+ include(TITANIA_ROOT . '../../vars.' . PHP_EXT);
+ phpbb::$template->set_custom_template(TITANIA_ROOT . '../../template/');
+ phpbb::$template->set_filenames(array(
+ 'phpbb_com_header' => 'overall_header.html',
+ ));
+ phpbb::$template->assign_display('phpbb_com_header', 'PHPBB_COM_HEADER', false);
+
+ titania::set_custom_template();
+ }
\ No newline at end of file
Propchange: trunk/titania/includes/hooks/_hook_phpbb.com.php
------------------------------------------------------------------------------
svn:keywords = Revision Author Date Id
Added: trunk/titania/includes/hooks/index.htm
==============================================================================
*** trunk/titania/includes/hooks/index.htm (added)
--- trunk/titania/includes/hooks/index.htm Sun Apr 4 22:46:32 2010
***************
*** 0 ****
--- 1,10 ----
+ <html>
+ <head>
+ <title></title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ </head>
+
+ <body bgcolor="#FFFFFF" text="#000000">
+
+ </body>
+ </html>
More information about the customisationdb-commits
mailing list