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