Skip to content

Commit fe01a43

Browse files
committed
Added section about special constants able to be used.
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10007 89ea8834-ac86-4346-8a33-228a782c2dd0
1 parent 6262263 commit fe01a43

2 files changed

Lines changed: 94 additions & 13 deletions

File tree

phpBB/docs/coding-guidelines.html

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ <h1>Coding Guidelines</h1>
5757
<li><a href="#editorsettings">Editor Settings</a></li>
5858
<li><a href="#fileheader">File Header</a></li>
5959
<li><a href="#locations">File Locations</a></li>
60+
<li><a href="#constants">Special Constants</a></li>
6061
</ol>
6162
</li>
6263
<li><a href="#code">Code Layout/Guidelines</a>
@@ -223,6 +224,54 @@ <h4>Code following the header but only functions/classes file:</h4>
223224
<li><strong>styles</strong><br /><code>/styles</code>, <code>style.php</code><br />phpBB Styles/Templates/Themes/Imagesets</li>
224225
</ul>
225226

227+
<a name="constants"></a></h3>1.iv. Special Constants</h3>
228+
229+
<p>There are some special constants application developers are able to utilize to bend some of phpBB's internal functionality to suit their needs.</p>
230+
231+
<div class="codebox"><pre>
232+
PHPBB_MSG_HANDLER (overwrite message handler)
233+
PHPBB_DB_NEW_LINK (overwrite new_link parameter for sql_connect)
234+
PHPBB_ROOT_PATH (overwrite $phpbb_root_path)
235+
PHPBB_ADMIN_PATH (overwrite $phpbb_admin_path)
236+
PHPBB_USE_BOARD_URL_PATH (use generate_board_url() for image paths instead of $phpbb_root_path)
237+
PHPBB_DISABLE_ACP_EDITOR (disable ACP style editor for templates)
238+
PHPBB_DISABLE_CONFIG_CHECK (disable ACP config.php writeable check)
239+
240+
PHPBB_ACM_MEMCACHE_PORT (overwrite memcached port, default is 11211)
241+
PHPBB_ACM_MEMCACHE_COMPRESS (overwrite memcached compress setting, default is disabled)
242+
PHPBB_ACM_MEMCACHE_HOST (overwrite memcached host name, default is localhost)
243+
244+
PHPBB_QA (Set board to QA-Mode, which means the updater also checks for RC-releases)
245+
</pre></div>
246+
247+
<h4>PHPBB_USE_BOARD_URL_PATH</h4>
248+
249+
<p>If the <code>PHPBB_USE_BOARD_URL_PATH</code> constant is set to true, phpBB uses generate_board_url() (this will return the boards url with the script path included) on all instances where web-accessible images are loaded. The exact locations are:</p>
250+
251+
<ul>
252+
<li>/includes/session.php - user::img()</li>
253+
<li>/includes/functions_content.php - smiley_text()</li>
254+
</ul>
255+
256+
<p>Path locations for the following template variables are affected by this too:</p>
257+
258+
<ul>
259+
<li>{T_THEME_PATH} - styles/xxx/theme</li>
260+
<li>{T_TEMPLATE_PATH} - styles/xxx/template</li>
261+
<li>{T_SUPER_TEMPLATE_PATH} - styles/xxx/template</li>
262+
<li>{T_IMAGESET_PATH} - styles/xxx/imageset</li>
263+
<li>{T_IMAGESET_LANG_PATH} - styles/xxx/imageset/yy</li>
264+
<li>{T_IMAGES_PATH} - images/</li>
265+
<li>{T_SMILIES_PATH} - $config['smilies_path']/</li>
266+
<li>{T_AVATAR_PATH} - $config['avatar_path']/</li>
267+
<li>{T_AVATAR_GALLERY_PATH} - $config['avatar_gallery_path']/</li>
268+
<li>{T_ICONS_PATH} - $config['icons_path']/</li>
269+
<li>{T_RANKS_PATH} - $config['ranks_path']/</li>
270+
<li>{T_UPLOAD_PATH} - $config['upload_path']/</li>
271+
<li>{T_STYLESHEET_LINK} - styles/xxx/theme/stylesheet.css (or link to style.php if css is parsed dynamically)</li>
272+
<li>New template variable {BOARD_URL} for the board url + script path.</li>
273+
</ul>
274+
226275
</div>
227276

228277
<div class="back2top"><a href="#wrap" class="top">Back to Top</a></div>
@@ -1123,7 +1172,7 @@ <h4>Including files</h4>
11231172
<p>Template defined variables can also be utilised.
11241173
<div class="codebox"><pre>
11251174
<span class="comment">&lt;!-- DEFINE $SOME_VAR = 'my_file.html' --&gt;</span>
1126-
<span class="comment">&lt;!-- INCLUDE {$SOME_VAR} --&gt;</span>
1175+
<span class="comment">&lt;!-- INCLUDE {$SOME_VAR} --&gt;</span>
11271176
</pre></div>
11281177

11291178
<h4>PHP</h4>
@@ -2297,13 +2346,13 @@ <h4>Spelling, punctuation, grammar, et cetera:</h4>
22972346
</ul>
22982347
</li>
22992348
</ul>
2300-
2349+
23012350
<a name="commitmessage"></a><h3>7.ii. Commit Messages</h3>
23022351

23032352
<p>The commit message should contain a brief explanation of all changes made within the commit. Often identical to the changelog entry. A bug ticket can be referenced by specifying the ticket ID with a hash, e.g. #12345. A reference to another revision should simply be prefixed with r, e.g. r12345.</p>
23042353

23052354
<p>Junior Developers need to have their patches approved by a development team member first. The commit message must end in a line with the following format:</p>
2306-
2355+
23072356
<div class="codebox"><pre>
23082357
Authorised by: developer1[, developer2[, ...]]
23092358
</pre></div>
@@ -2322,7 +2371,11 @@ <h4>Spelling, punctuation, grammar, et cetera:</h4>
23222371
<div class="inner"><span class="corners-top"><span></span></span>
23232372

23242373
<div class="content">
2374+
<h3>Revision 10007</h3>
23252375

2376+
<ul>
2377+
<li>Added <a href="#constants">Special Constants</a> section.</li>
2378+
</ul>
23262379

23272380
<h3>Revision 9817</h3>
23282381

phpBB/docs/hook_system.html

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@
104104
border-top: 1px solid #ccc;
105105
}
106106

107-
code {
108-
color: #006600;
109-
font-weight: normal;
110-
font-family: 'Courier New', monospace;
111-
border-color: #D1D7DC;
112-
border-width: 1px;
113-
border-style: solid;
114-
background-color: #FAFAFA;
107+
code {
108+
color: #006600;
109+
font-weight: normal;
110+
font-family: 'Courier New', monospace;
111+
border-color: #D1D7DC;
112+
border-width: 1px;
113+
border-style: solid;
114+
background-color: #FAFAFA;
115115
}
116116

117117
#wrap {
@@ -387,8 +387,36 @@ <h3>Pre-defined hookable phpBB3 functions</h3>
387387
PHPBB_DB_NEW_LINK (overwrite new_link parameter for sql_connect)
388388
PHPBB_ROOT_PATH (overwrite $phpbb_root_path)
389389
PHPBB_ADMIN_PATH (overwrite $phpbb_admin_path)
390+
PHPBB_USE_BOARD_URL_PATH (use generate_board_url() for image paths instead of $phpbb_root_path)
390391
</pre></div>
391392

393+
<p>If the <code>PHPBB_USE_BOARD_URL_PATH</code> constant is set to true, phpBB uses generate_board_url() (this will return the boards url with the script path included) on all instances where web-accessible images are loaded. The exact locations are:</p>
394+
395+
<ul>
396+
<li>/includes/session.php - user::img()</li>
397+
<li>/includes/functions_content.php - smiley_text()</li>
398+
</ul>
399+
400+
<p>Path locations for the following template variables are affected by this too:</p>
401+
402+
<ul>
403+
<li>{T_THEME_PATH} - styles/xxx/theme</li>
404+
<li>{T_TEMPLATE_PATH} - styles/xxx/template</li>
405+
<li>{T_SUPER_TEMPLATE_PATH} - styles/xxx/template</li>
406+
<li>{T_IMAGESET_PATH} - styles/xxx/imageset</li>
407+
<li>{T_IMAGESET_LANG_PATH} - styles/xxx/imageset/yy</li>
408+
<li>{T_IMAGES_PATH} - images/</li>
409+
<li>{T_SMILIES_PATH} - $config['smilies_path']/</li>
410+
<li>{T_AVATAR_PATH} - $config['avatar_path']/</li>
411+
<li>{T_AVATAR_GALLERY_PATH} - $config['avatar_gallery_path']/</li>
412+
<li>{T_ICONS_PATH} - $config['icons_path']/</li>
413+
<li>{T_RANKS_PATH} - $config['ranks_path']/</li>
414+
<li>{T_UPLOAD_PATH} - $config['upload_path']/</li>
415+
<li>{T_STYLESHEET_LINK} - styles/xxx/theme/stylesheet.css (or link to style.php if css is parsed dynamically)</li>
416+
<li>New template variable {BOARD_URL} for the board url + script path.</li>
417+
</ul>
418+
419+
392420
</div>
393421

394422
<div class="back2top"><a href="#wrap" class="top">Back to Top</a></div>
@@ -616,7 +644,7 @@ <h3>Only allowing hooks for some objects</h3>
616644

617645
<div class="codebox"><pre>
618646
not hooked
619-
hooked
647+
hooked
620648
</pre></div>
621649

622650
<p>A different possibility would be using a function variable (which could be left out on passing the function variables to the hook):</p>
@@ -670,7 +698,7 @@ <h3>Only allowing hooks for some objects</h3>
670698

671699
<div class="codebox"><pre>
672700
not hooked
673-
hooked
701+
hooked
674702
</pre></div>
675703

676704
</div>

0 commit comments

Comments
 (0)