|
|
4c79b5 |
|
|
|
4c79b5 |
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" xml:lang="en">
|
|
|
4c79b5 |
<head>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
|
4c79b5 |
<meta http-equiv="content-style-type" content="text/css" />
|
|
|
4c79b5 |
<meta http-equiv="content-language" content="en" />
|
|
|
4c79b5 |
<meta http-equiv="imagetoolbar" content="no" />
|
|
|
4c79b5 |
<meta name="resource-type" content="document" />
|
|
|
4c79b5 |
<meta name="distribution" content="global" />
|
|
|
4c79b5 |
<meta name="copyright" content="2007 phpBB Group" />
|
|
|
4c79b5 |
<meta name="keywords" content="" />
|
|
|
4c79b5 |
<meta name="description" content="Hook System explanation" />
|
|
|
4c79b5 |
<title>phpBB3 • Hook System</title>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
<style type="text/css">
|
|
|
4c79b5 |
/*
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/*
|
|
|
4c79b5 |
The original "prosilver" theme for phpBB3
|
|
|
4c79b5 |
Created by subBlue design :: http://www.subBlue.com
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
|
|
|
4c79b5 |
* { margin: 0; padding: 0; }
|
|
|
4c79b5 |
|
|
|
4c79b5 |
html { font-size: 100%; height: 100%; margin-bottom: 1px; }
|
|
|
4c79b5 |
|
|
|
4c79b5 |
body {
|
|
|
4c79b5 |
font-family: Verdana, Helvetica, Arial, sans-serif;
|
|
|
4c79b5 |
color: #828282;
|
|
|
4c79b5 |
background-color: #FFFFFF;
|
|
|
4c79b5 |
font-size: 12px;
|
|
|
4c79b5 |
margin: 0;
|
|
|
4c79b5 |
padding: 12px 0;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
img { border-width: 0; }
|
|
|
4c79b5 |
|
|
|
4c79b5 |
p {
|
|
|
4c79b5 |
line-height: 1.3em;
|
|
|
4c79b5 |
font-size: 1.1em;
|
|
|
4c79b5 |
margin-bottom: 1.5em;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
hr {
|
|
|
4c79b5 |
border: 0 none #FFFFFF;
|
|
|
4c79b5 |
border-top: 1px solid #CCCCCC;
|
|
|
4c79b5 |
height: 1px;
|
|
|
4c79b5 |
margin: 5px 0;
|
|
|
4c79b5 |
display: block;
|
|
|
4c79b5 |
clear: both;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
html, body {
|
|
|
4c79b5 |
color: #536482;
|
|
|
4c79b5 |
background-color: #FFFFFF;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#doc-description h1 {
|
|
|
4c79b5 |
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
|
|
|
4c79b5 |
margin-right: 200px;
|
|
|
4c79b5 |
color: #FFFFFF;
|
|
|
4c79b5 |
margin-top: 15px;
|
|
|
4c79b5 |
font-weight: bold;
|
|
|
4c79b5 |
font-size: 2em;
|
|
|
4c79b5 |
color: #fff;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
h1 {
|
|
|
4c79b5 |
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
|
|
|
4c79b5 |
font-weight: normal;
|
|
|
4c79b5 |
color: #000;
|
|
|
4c79b5 |
font-size: 2em;
|
|
|
4c79b5 |
margin: 0.8em 0 0.2em 0;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
h2 {
|
|
|
4c79b5 |
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
|
|
|
4c79b5 |
font-weight: normal;
|
|
|
4c79b5 |
color: #28313F;
|
|
|
4c79b5 |
font-size: 1.5em;
|
|
|
4c79b5 |
margin: 0.8em 0 0.2em 0;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
h3 {
|
|
|
4c79b5 |
font-family: Arial, Helvetica, sans-serif;
|
|
|
4c79b5 |
font-weight: bold;
|
|
|
4c79b5 |
border-bottom: 1px solid #CCCCCC;
|
|
|
4c79b5 |
margin-bottom: 3px;
|
|
|
4c79b5 |
padding-bottom: 2px;
|
|
|
4c79b5 |
font-size: 1.05em;
|
|
|
4c79b5 |
color: #115098;
|
|
|
4c79b5 |
margin-top: 20px;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
.good { color: green; }
|
|
|
4c79b5 |
.bad { color: red; }
|
|
|
4c79b5 |
|
|
|
4c79b5 |
.version {
|
|
|
4c79b5 |
margin-top: 20px;
|
|
|
4c79b5 |
text-align: left;
|
|
|
4c79b5 |
font-size: 70%;
|
|
|
4c79b5 |
color: #006600;
|
|
|
4c79b5 |
border-top: 1px solid #ccc;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
code {
|
|
|
4c79b5 |
color: #006600;
|
|
|
4c79b5 |
font-weight: normal;
|
|
|
4c79b5 |
font-family: 'Courier New', monospace;
|
|
|
4c79b5 |
border-color: #D1D7DC;
|
|
|
4c79b5 |
border-width: 1px;
|
|
|
4c79b5 |
border-style: solid;
|
|
|
4c79b5 |
background-color: #FAFAFA;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#wrap {
|
|
|
4c79b5 |
padding: 0 20px;
|
|
|
4c79b5 |
min-width: 650px;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#simple-wrap {
|
|
|
4c79b5 |
padding: 6px 10px;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#page-body {
|
|
|
4c79b5 |
margin: 4px 0;
|
|
|
4c79b5 |
clear: both;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#page-footer {
|
|
|
4c79b5 |
clear: both;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#logo {
|
|
|
4c79b5 |
float: left;
|
|
|
4c79b5 |
width: auto;
|
|
|
4c79b5 |
padding: 10px 13px 0 10px;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
a#logo:hover {
|
|
|
4c79b5 |
text-decoration: none;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#doc-description {
|
|
|
4c79b5 |
float: left;
|
|
|
4c79b5 |
width: 70%;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
#doc-description h1 {
|
|
|
4c79b5 |
margin-right: 0;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
.headerbar {
|
|
|
4c79b5 |
background: #ebebeb none repeat-x 0 0;
|
|
|
4c79b5 |
color: #FFFFFF;
|
|
|
4c79b5 |
margin-bottom: 4px;
|
|
|
4c79b5 |
padding: 0 5px;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
span.corners-top, span.corners-bottom, span.corners-top span, span.corners-bottom span {
|
|
|
4c79b5 |
font-size: 1px;
|
|
|
4c79b5 |
line-height: 1px;
|
|
|
4c79b5 |
display: block;
|
|
|
4c79b5 |
height: 5px;
|
|
|
4c79b5 |
background-repeat: no-repeat;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
span.corners-top {
|
|
|
4c79b5 |
background-image: none;
|
|
|
4c79b5 |
background-position: 0 0;
|
|
|
4c79b5 |
margin: 0 -5px;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
span.corners-top span {
|
|
|
4c79b5 |
background-image: none;
|
|
|
4c79b5 |
background-position: 100% 0;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
span.corners-bottom {
|
|
|
4c79b5 |
background-image: none;
|
|
|
4c79b5 |
background-position: 0 100%;
|
|
|
4c79b5 |
margin: 0 -5px;
|
|
|
4c79b5 |
clear: both;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
span.corners-bottom span {
|
|
|
4c79b5 |
background-image: none;
|
|
|
4c79b5 |
background-position: 100% 100%;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
.paragraph {
|
|
|
4c79b5 |
padding: 0 10px;
|
|
|
4c79b5 |
margin-bottom: 4px;
|
|
|
4c79b5 |
background-repeat: no-repeat;
|
|
|
4c79b5 |
background-position: 100% 0;
|
|
|
4c79b5 |
background-color: #ECF3F7;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
.paragraph:target .content {
|
|
|
4c79b5 |
color: #000000;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
.paragraph:target h3 a {
|
|
|
4c79b5 |
color: #000000;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
.content {
|
|
|
4c79b5 |
color: #333333;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
.content h2, .panel h2 {
|
|
|
4c79b5 |
color: #115098;
|
|
|
4c79b5 |
border-bottom-color: #CCCCCC;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
a:link { color: #898989; text-decoration: none; }
|
|
|
4c79b5 |
a:visited { color: #898989; text-decoration: none; }
|
|
|
4c79b5 |
a:hover { color: #d3d3d3; text-decoration: underline; }
|
|
|
4c79b5 |
a:active { color: #d2d2d2; text-decoration: none; }
|
|
|
4c79b5 |
|
|
|
4c79b5 |
hr {
|
|
|
4c79b5 |
border-color: #FFFFFF;
|
|
|
4c79b5 |
border-top-color: #CCCCCC;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
.menu {
|
|
|
4c79b5 |
background-color: #cadceb;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
.headerbar {
|
|
|
4c79b5 |
background-color: #12A3EB;
|
|
|
4c79b5 |
background-image: url("bg_header.gif");
|
|
|
4c79b5 |
color: #FFFFFF;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
.panel {
|
|
|
4c79b5 |
background-color: #ECF1F3;
|
|
|
4c79b5 |
color: #28313F;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
span.corners-top {
|
|
|
4c79b5 |
background-image: url("corners_left.png");
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
span.corners-top span {
|
|
|
4c79b5 |
background-image: url("corners_right.png");
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
span.corners-bottom {
|
|
|
4c79b5 |
background-image: url("corners_left.png");
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
span.corners-bottom span {
|
|
|
4c79b5 |
background-image: url("corners_right.png");
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
.error {
|
|
|
4c79b5 |
color: #BC2A4D;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
a:link { color: #105289; }
|
|
|
4c79b5 |
a:visited { color: #105289; }
|
|
|
4c79b5 |
a:hover { color: #D31141; }
|
|
|
4c79b5 |
a:active { color: #368AD2; }
|
|
|
4c79b5 |
|
|
|
4c79b5 |
.paragraph span.corners-top, .paragraph span.corners-bottom {
|
|
|
4c79b5 |
margin: 0 -10px;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
.content {
|
|
|
4c79b5 |
padding: 0;
|
|
|
4c79b5 |
line-height: 1.48em;
|
|
|
4c79b5 |
color: #333333;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
.content h2, .panel h2 {
|
|
|
4c79b5 |
color: #115098;
|
|
|
4c79b5 |
border-bottom-color: #CCCCCC;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
.notice {
|
|
|
4c79b5 |
border-top-color: #CCCCCC;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
.codebox {
|
|
|
4c79b5 |
padding: 3px;
|
|
|
4c79b5 |
background-color: #FFFFFF;
|
|
|
4c79b5 |
border: 1px solid #C9D2D8;
|
|
|
4c79b5 |
font-size: 1em;
|
|
|
4c79b5 |
margin-bottom: 10px;
|
|
|
4c79b5 |
display: block;
|
|
|
4c79b5 |
font: 0.9em Monaco, "Andale Mono","Courier New", Courier, mono;
|
|
|
4c79b5 |
line-height: 1.3em;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
* html hr { margin: 0; }
|
|
|
4c79b5 |
* html span.corners-top, * html span.corners-bottom { background-image: url("corners_left.gif"); }
|
|
|
4c79b5 |
* html span.corners-top span, * html span.corners-bottom span { background-image: url("corners_right.gif"); }
|
|
|
4c79b5 |
|
|
|
4c79b5 |
.back2top {
|
|
|
4c79b5 |
clear: both;
|
|
|
4c79b5 |
height: 11px;
|
|
|
4c79b5 |
text-align: right;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
.content ol {
|
|
|
4c79b5 |
margin-left: 25px;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/* ]]> */
|
|
|
4c79b5 |
</style>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
</head>
|
|
|
4c79b5 |
|
|
|
4c79b5 |
<body id="phpbb" class="section-docs">
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
Hook System
|
|
|
4c79b5 |
This is an explanation of how to use the phpBB3 hook system.
|
|
|
4c79b5 |
Skip
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
Hook System
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
Introduction
|
|
|
4c79b5 |
Allow hooks in functions/methods
|
|
|
4c79b5 |
Registering hooks
|
|
|
4c79b5 |
Result returning
|
|
|
4c79b5 |
Embedding your hook files/classes/methods
|
|
|
4c79b5 |
Copyright and disclaimer
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
1. Introduction
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
What is it?
|
|
|
4c79b5 |
|
|
|
4c79b5 |
The hook system allows applicaton and mod developers to hook into phpBB's or their own functions.
|
|
|
4c79b5 |
|
|
|
4c79b5 |
Pre-defined hookable phpBB3 functions
|
|
|
4c79b5 |
|
|
|
4c79b5 |
In phpBB3 there are four functions you are able to hook into with your custom functions:
|
|
|
4c79b5 |
|
|
|
4c79b5 |
phpbb_user_session_handler(); which is called within user::setup after the session and the user object is correctly initialized.
|
|
|
4c79b5 |
append_sid($url, $params = false, $is_amp = true, $session_id = false); which is called for building urls (appending the session id)
|
|
|
4c79b5 |
$template->display($handle, $include_once = true); which is called directly before outputting the (not-yet-compiled) template.
|
|
|
4c79b5 |
exit_handler(); which is called at the very end of phpBB3's execution.
|
|
|
4c79b5 |
|
|
|
4c79b5 |
There are also valid external constants you may want to use if you embed phpBB3 into your application:
|
|
|
4c79b5 |
|
|
|
4c79b5 |
|
|
|
4c79b5 |
PHPBB_MSG_HANDLER (overwrite message handler)
|
|
|
4c79b5 |
PHPBB_DB_NEW_LINK (overwrite new_link parameter for sql_connect)
|
|
|
4c79b5 |
PHPBB_ROOT_PATH (overwrite $phpbb_root_path)
|
|
|
4c79b5 |
PHPBB_ADMIN_PATH (overwrite $phpbb_admin_path)
|