Blame Identity/Webenv/phpBB/3.0.4/docs/hook_system.html

ef5584
ef5584
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" xml:lang="en">
ef5584
<head>
ef5584
ef5584
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
ef5584
<meta http-equiv="content-style-type" content="text/css" />
ef5584
<meta http-equiv="content-language" content="en" />
ef5584
<meta http-equiv="imagetoolbar" content="no" />
ef5584
<meta name="resource-type" content="document" />
ef5584
<meta name="distribution" content="global" />
ef5584
<meta name="copyright" content="2007 phpBB Group" />
ef5584
<meta name="keywords" content="" />
ef5584
<meta name="description" content="Hook System explanation" />
ef5584
<title>phpBB3 • Hook System</title>
ef5584
ef5584
<style type="text/css">
ef5584
/* 
ef5584
ef5584
/*
ef5584
	The original "prosilver" theme for phpBB3
ef5584
	Created by subBlue design :: http://www.subBlue.com
ef5584
*/
ef5584
ef5584
* { margin: 0; padding: 0; }
ef5584
ef5584
html { font-size: 100%; height: 100%; margin-bottom: 1px; }
ef5584
ef5584
body {
ef5584
	font-family: Verdana, Helvetica, Arial, sans-serif;
ef5584
	color: #828282;
ef5584
	background-color: #FFFFFF;
ef5584
	font-size: 12px;
ef5584
	margin: 0;
ef5584
	padding: 12px 0;
ef5584
}
ef5584
ef5584
img { border-width: 0; }
ef5584
ef5584
p {
ef5584
	line-height: 1.3em;
ef5584
	font-size: 1.1em;
ef5584
	margin-bottom: 1.5em;
ef5584
}
ef5584
ef5584
hr {
ef5584
	border: 0 none #FFFFFF;
ef5584
	border-top: 1px solid #CCCCCC;
ef5584
	height: 1px;
ef5584
	margin: 5px 0;
ef5584
	display: block;
ef5584
	clear: both;
ef5584
}
ef5584
ef5584
html, body {
ef5584
	color: #536482;
ef5584
	background-color: #FFFFFF;
ef5584
}
ef5584
ef5584
#doc-description h1 {
ef5584
	font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
ef5584
	margin-right: 200px;
ef5584
	color: #FFFFFF;
ef5584
	margin-top: 15px;
ef5584
	font-weight: bold;
ef5584
	font-size: 2em;
ef5584
	color: #fff;
ef5584
}
ef5584
ef5584
h1 {
ef5584
	font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
ef5584
	font-weight: normal;
ef5584
	color: #000;
ef5584
	font-size: 2em;
ef5584
	margin: 0.8em 0 0.2em 0;
ef5584
}
ef5584
ef5584
h2 {
ef5584
	font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
ef5584
	font-weight: normal;
ef5584
	color: #28313F;
ef5584
	font-size: 1.5em;
ef5584
	margin: 0.8em 0 0.2em 0;
ef5584
}
ef5584
ef5584
h3 {
ef5584
	font-family: Arial, Helvetica, sans-serif;
ef5584
	font-weight: bold;
ef5584
	border-bottom: 1px solid #CCCCCC;
ef5584
	margin-bottom: 3px;
ef5584
	padding-bottom: 2px;
ef5584
	font-size: 1.05em;
ef5584
	color: #115098;
ef5584
	margin-top: 20px;
ef5584
}
ef5584
ef5584
.good { color: green; }
ef5584
.bad { color: red; }
ef5584
ef5584
.version {
ef5584
	margin-top: 20px;
ef5584
	text-align: left;
ef5584
	font-size: 70%;
ef5584
	color: #006600;
ef5584
	border-top: 1px solid #ccc;
ef5584
}
ef5584
ef5584
code { 
ef5584
	color: #006600; 
ef5584
	font-weight: normal; 
ef5584
	font-family: 'Courier New', monospace; 
ef5584
	border-color: #D1D7DC; 
ef5584
	border-width: 1px; 
ef5584
	border-style: solid; 
ef5584
	background-color: #FAFAFA; 
ef5584
}
ef5584
ef5584
#wrap {
ef5584
	padding: 0 20px;
ef5584
	min-width: 650px;
ef5584
}
ef5584
ef5584
#simple-wrap {
ef5584
	padding: 6px 10px;
ef5584
}
ef5584
ef5584
#page-body {
ef5584
	margin: 4px 0;
ef5584
	clear: both;
ef5584
}
ef5584
ef5584
#page-footer {
ef5584
	clear: both;
ef5584
}
ef5584
ef5584
#logo {
ef5584
	float: left;
ef5584
	width: auto;
ef5584
	padding: 10px 13px 0 10px;
ef5584
}
ef5584
ef5584
a#logo:hover {
ef5584
	text-decoration: none;
ef5584
}
ef5584
ef5584
#doc-description {
ef5584
	float: left;
ef5584
	width: 70%;
ef5584
}
ef5584
ef5584
#doc-description h1 {
ef5584
	margin-right: 0;
ef5584
}
ef5584
ef5584
.headerbar {
ef5584
	background: #ebebeb none repeat-x 0 0;
ef5584
	color: #FFFFFF;
ef5584
	margin-bottom: 4px;
ef5584
	padding: 0 5px;
ef5584
}
ef5584
ef5584
span.corners-top, span.corners-bottom, span.corners-top span, span.corners-bottom span {
ef5584
	font-size: 1px;
ef5584
	line-height: 1px;
ef5584
	display: block;
ef5584
	height: 5px;
ef5584
	background-repeat: no-repeat;
ef5584
}
ef5584
ef5584
span.corners-top {
ef5584
	background-image: none;
ef5584
	background-position: 0 0;
ef5584
	margin: 0 -5px;
ef5584
}
ef5584
ef5584
span.corners-top span {
ef5584
	background-image: none;
ef5584
	background-position: 100% 0;
ef5584
}
ef5584
ef5584
span.corners-bottom {
ef5584
	background-image: none;
ef5584
	background-position: 0 100%;
ef5584
	margin: 0 -5px;
ef5584
	clear: both;
ef5584
}
ef5584
ef5584
span.corners-bottom span {
ef5584
	background-image: none;
ef5584
	background-position: 100% 100%;
ef5584
}
ef5584
ef5584
.paragraph {
ef5584
	padding: 0 10px;
ef5584
	margin-bottom: 4px;
ef5584
	background-repeat: no-repeat;
ef5584
	background-position: 100% 0;
ef5584
	background-color: #ECF3F7;
ef5584
}
ef5584
ef5584
.paragraph:target .content {
ef5584
	color: #000000;
ef5584
}
ef5584
ef5584
.paragraph:target h3 a {
ef5584
	color: #000000;
ef5584
}
ef5584
ef5584
.content {
ef5584
	color: #333333;
ef5584
}
ef5584
ef5584
.content h2, .panel h2 {
ef5584
	color: #115098;
ef5584
	border-bottom-color:  #CCCCCC;
ef5584
}
ef5584
ef5584
a:link	{ color: #898989; text-decoration: none; }
ef5584
a:visited	{ color: #898989; text-decoration: none; }
ef5584
a:hover	{ color: #d3d3d3; text-decoration: underline; }
ef5584
a:active	{ color: #d2d2d2; text-decoration: none; }
ef5584
ef5584
hr {
ef5584
	border-color: #FFFFFF;
ef5584
	border-top-color: #CCCCCC;
ef5584
}
ef5584
ef5584
.menu {
ef5584
	background-color: #cadceb;
ef5584
}
ef5584
ef5584
.headerbar {
ef5584
	background-color: #12A3EB;
ef5584
	background-image: url("bg_header.gif");
ef5584
	color: #FFFFFF;
ef5584
}
ef5584
ef5584
.panel {
ef5584
	background-color: #ECF1F3;
ef5584
	color: #28313F;
ef5584
}
ef5584
ef5584
ef5584
span.corners-top {
ef5584
	background-image: url("corners_left.png");
ef5584
}
ef5584
ef5584
span.corners-top span {
ef5584
	background-image: url("corners_right.png");
ef5584
}
ef5584
ef5584
span.corners-bottom {
ef5584
	background-image: url("corners_left.png");
ef5584
}
ef5584
ef5584
span.corners-bottom span {
ef5584
	background-image: url("corners_right.png");
ef5584
}
ef5584
ef5584
.error {
ef5584
	color: #BC2A4D;
ef5584
}
ef5584
ef5584
a:link	{ color: #105289; }
ef5584
a:visited	{ color: #105289; }
ef5584
a:hover	{ color: #D31141; }
ef5584
a:active	{ color: #368AD2; }
ef5584
ef5584
.paragraph span.corners-top, .paragraph span.corners-bottom {
ef5584
	margin: 0 -10px;
ef5584
}
ef5584
ef5584
.content {
ef5584
	padding: 0;
ef5584
	line-height: 1.48em;
ef5584
	color: #333333;
ef5584
}
ef5584
ef5584
.content h2, .panel h2 {
ef5584
	color: #115098;
ef5584
	border-bottom-color:  #CCCCCC;
ef5584
}
ef5584
ef5584
.notice {
ef5584
	border-top-color:  #CCCCCC;
ef5584
}
ef5584
ef5584
.codebox {
ef5584
	padding: 3px;
ef5584
	background-color: #FFFFFF;
ef5584
	border: 1px solid #C9D2D8;
ef5584
	font-size: 1em;
ef5584
	margin-bottom: 10px;
ef5584
	display: block;
ef5584
	font: 0.9em Monaco, "Andale Mono","Courier New", Courier, mono;
ef5584
	line-height: 1.3em;
ef5584
}
ef5584
ef5584
* html hr { margin: 0; }
ef5584
* html span.corners-top, * html span.corners-bottom { background-image: url("corners_left.gif"); }
ef5584
* html span.corners-top span, * html span.corners-bottom span { background-image: url("corners_right.gif"); }
ef5584
ef5584
.back2top {
ef5584
	clear: both;
ef5584
	height: 11px;
ef5584
	text-align: right;
ef5584
}
ef5584
ef5584
.content ol {
ef5584
	margin-left: 25px;
ef5584
}
ef5584
ef5584
/* ]]> */
ef5584
</style>
ef5584
ef5584
</head>
ef5584
ef5584
<body id="phpbb" class="section-docs">
ef5584
ef5584
ef5584
	
ef5584
	
ef5584
		
ef5584
			
ef5584
ef5584
			
ef5584
				
ef5584
				

Hook System

ef5584
				

This is an explanation of how to use the phpBB3 hook system.

ef5584
				

Skip

ef5584
			
ef5584
ef5584
			
ef5584
		
ef5584
	
ef5584
ef5584
	
ef5584
ef5584
	
ef5584
ef5584
	

Hook System

ef5584
ef5584
	
ef5584
		
ef5584
ef5584
		
ef5584
ef5584
			
    ef5584
    				
  1. Introduction
  2. ef5584
    				
  3. Allow hooks in functions/methods
  4. ef5584
    				
  5. Registering hooks
  6. ef5584
    				
  7. Result returning
  8. ef5584
    				
  9. Embedding your hook files/classes/methods
  10. ef5584
    				
  11. Copyright and disclaimer
  12. ef5584
    			
    ef5584
    ef5584
    		
    ef5584
    ef5584
    		
    ef5584
    	
    ef5584
    ef5584
    	
    ef5584
    ef5584
    	

    1. Introduction

    ef5584
    ef5584
    	
    ef5584
    		
    ef5584
    ef5584
    		
    ef5584
    ef5584

    What is it?

    ef5584
    ef5584

    The hook system allows applicaton and mod developers to hook into phpBB's or their own functions.

    ef5584
    ef5584

    Pre-defined hookable phpBB3 functions

    ef5584
    ef5584

    In phpBB3 there are four functions you are able to hook into with your custom functions:

    ef5584
    ef5584

    phpbb_user_session_handler(); which is called within user::setup after the session and the user object is correctly initialized.

    ef5584
    append_sid($url, $params = false, $is_amp = true, $session_id = false); which is called for building urls (appending the session id)
    ef5584
    $template->display($handle, $include_once = true); which is called directly before outputting the (not-yet-compiled) template.
    ef5584
    exit_handler(); which is called at the very end of phpBB3's execution.

    ef5584
    ef5584

    There are also valid external constants you may want to use if you embed phpBB3 into your application:

    ef5584
    ef5584
    ef5584
    PHPBB_MSG_HANDLER (overwrite message handler)
    ef5584
    PHPBB_DB_NEW_LINK (overwrite new_link parameter for sql_connect)
    ef5584
    PHPBB_ROOT_PATH   (overwrite $phpbb_root_path)
    ef5584
    PHPBB_ADMIN_PATH  (overwrite $phpbb_admin_path)