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

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

Hook System

f2e824
				

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

f2e824
				

Skip

f2e824
			
f2e824
f2e824
			
f2e824
		
f2e824
	
f2e824
f2e824
	
f2e824
f2e824
	
f2e824
f2e824
	

Hook System

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

    1. Introduction

    f2e824
    f2e824
    	
    f2e824
    		
    f2e824
    f2e824
    		
    f2e824
    f2e824

    What is it?

    f2e824
    f2e824

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

    f2e824
    f2e824

    Pre-defined hookable phpBB3 functions

    f2e824
    f2e824

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

    f2e824
    f2e824

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

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

    f2e824
    f2e824

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

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