[譯文:KB(20%)]phpBB 官方外掛安裝說明檔範本使用說明

phpBB.com Docs & KB Translation
收集所有官方的技術文件以及知識庫之譯文,以利分享!
(僅供瀏覽,由版主群維護)
回覆文章
bu
版面管理員
版面管理員
文章: 443
註冊時間: 2003-02-23 12:46
來自: 25° 4′N 121° 29′E
聯繫:

[譯文:KB(20%)]phpBB 官方外掛安裝說明檔範本使用說明

文章 bu »

這篇文章是在說明 http://phpbb-tw.net/phpbb/viewtopic.php?p=181067#181067 這篇文章的格式

phpBB 官方設計了一套「外掛範本」,供所有想把外掛放到官方資料庫的人使用\r

所有送審的外掛都必須以英文寫成,還有範本也必須要使用英文。
所有送審的外掛都必須subSilver 為風格部份設計指標。
所有送審的外掛都必須沒有問題。
所有送審的外掛都必須使用 phpBB2 的 DBAL(資料庫存取類別)、範本系統、語系檔。

外掛範本,第一部份:

代碼: 選擇全部

############################################################## 
## MOD Title: mod_title_goes_here [color=red](外掛名稱)[/color]
## MOD Author: your_phpBB_username < your_email > (your_real_name) your_url [color=red](外掛發表人,要用官方的論壇帳號喔(當然是要發到官方去的話 ^^"))[/color]
## MOD Description: some_description_goes_here [color=red](外掛說明)[/color]
## MOD Version: x.x.x [color=red](外掛版本)[/color]
## 
## Installation Level: (Easy/Intermediate/Advanced) [color=red](難易度)[/color]

## Installation Time: x Minutes [color=red](安裝時間)[/color]

## Files To Edit: file_1, file_2, file_3, etc [color=red](外掛要修改的檔案)[/color]

## Included Files: (n/a, or list of included/required files) [color=red](外掛包附加的檔案)[/color]
##############################################################




以下是這段文字的詳細說明:

MOD Title: - 呃...所有外掛都有個名子吧\r
MOD Author: -
這段由四個部份組成:
你的官方phpbb帳號< 你的電子郵件 > (你的真實名子) 你的網站

phpBB_username - 你在官方論壇的帳號 (很重要,官方需要用這個帳號和你連絡)

your email - 你的電子郵件 (請放在 < > 中,非必要,但如果想要留空,請以 N/A 代替)

your_name - 你的真實姓名 (非必要,但如果想要留空,請以 N/A 代替)

your_url - 如果想留下你的網站,就放這吧! (非必要,但如果想要留空,請以 N/A 代替)

外掛說明: 這應該是一份有關於您外掛的簡短說明。



外掛版本: - 當你的外掛沒有問題後,你的外掛的第一個版本必須要為 1.0.0。 以及其後的版本,都應用合理的版本號碼依序增加,有關這方面的事項,請見【版本編碼原則】



難易度: -



This is how hard you feel it is to install your MOD.

The only three options are: Easy/Intermediate/Advanced

('the phpBB Group' may deny a MOD, should they feel your 'Installation Level' is not correct)





Installation Time: - How long it will take to install this MOD (this should always be in minutes)



Files To Edit: - A list of files that will have to be edited to install your MOD.



Included Files: - If there are additional files need for this MOD (.tpl, .php, .gif, etc) include them here.









That concludes the initial part (the header) of the "MOD Template".







Code:



##############################################################

## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the

## latest version of this MOD. Downloading this MOD from other sites could cause malicious code

## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered

## in our MOD-Database, located at: http://www.phpbb.com/mods/

##############################################################







License/Security Disclaimer.



We require that all MOD's submitted into our database, retain the above License/Security Statement.





Let us briefly explain why we request this statement:



The entire phpBB Code is licensed under the GPL License. As such, to ensure the 'spirit of GPL', we (the phpBB Group) are placing all released MOD's into GPL. At the same time 95% of all MOD's submitted in the past would legally have to fall under the GPL. Reasons being: If you take a -single- line of code from phpBB and include it into your MOD, then it must legally fall under the GPL. Chances are, somewhere within your MOD, there is code from within the phpBB Core-Code. This said, the acutal code does remain the 'Intelectual Property' of the MOD-Author(s).

The security statement is there for the following reason: Should someone download your MOD from our MOD Database and decide to add it to a database at another site, but before they add it to another sites database, they decide to add a few lines of malicious code, or remove a few lines of code that ensures phpBB security, this could not only bring a disastrous affect upon the user who get's your MOD from this non-official site, but it could affect you (as they will see your name as the author) and it would ultimately affect phpBB. As such, all MOD's submitted to our MOD-Database must have this Security Disclaimer in place.







Code:



##############################################################

## Author Notes:

##

##############################################################







The "Author Notes" section gives you the ability to leave any specific notes about your MOD, which you feel the end-user needs to know.



This section is -not- for displaying a "demo url", nor any such 'contact information'.



This section -is- for notes specifically applicable to the MOD and it's operation.



All "how to's" should be included in here, not within the "ACTION" statements.



Do Not place your notes on the same line as the header 'Author Notes'. Please use the line(s) underneath the section header.





Code:



##############################################################

## MOD History:

##

## YYYY-MM-DD - Version x.x.x

## - version notes go here

##

##############################################################







The MOD History: section is designed for notes about each release of your MOD.



With each new release a new section should be added.



An example of this might be:



Code:



##############################################################

## MOD History:

##

## 2003-05-30 - Version 1.0.0

## - Initial Release :)

##

## 2003-06-13 - Version 1.0.1

## - added better SQL statements, added new language file, removed on .php file no longer needed!

##

##############################################################







We ask that everyone follow the above format.





Code:



##############################################################

## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD

##############################################################







This is a simple remind which should -not- be removed, for obvious reasons.









Code:



##############################################################

## Possible Actions:

##

## SQL

## COPY

## OPEN

## FIND

## REPLACE WITH

## AFTER, ADD

## BEFORE, ADD

## IN-LINE FIND

## IN-LINE AFTER, ADD

## IN-LINE BEFORE, ADD

## IN-LINE REPLACE WITH

##############################################################







This entire block of text does not need to be included within the "MOD Template".

It serves only as a "guide" for you, the MOD-Author.









Our next section of the "MOD Template" is what we call "Actions".



'Actions' are the specific step-by-step process that is required for the end-user to install your MOD.



Code:



#

#-----[ SQL ]------------------------------------------

#







Code:



#

#-----[ COPY ]------------------------------------------

#







Code:

#

#-----[ OPEN ]------------------------------------------

#





Code:

#

#-----[ FIND ]------------------------------------------

#





Code:

#

#-----[ REPLACE WITH ]------------------------------------------

#





Code:

#

#-----[ AFTER, ADD ]------------------------------------------

#





Code:

#

#-----[ BEFORE, ADD ]------------------------------------------

#





Code:



#

#-----[ IN-LINE FIND ]------------------------------------------

#







Code:



#

#-----[ IN-LINE AFTER, ADD ]------------------------------------------

#







Code:



#

#-----[ IN-LINE BEFORE, ADD ]------------------------------------------

#







Code:



#

#-----[ IN-LINE REPLACE WITH ]------------------------------------------

#









There are eleven (11) possible "Actions":



SQL - Perform a given SQL Statement.



COPY - Copy files to a location on the server



OPEN - Open a specific file.



FIND - Find a piece of code within the opened file



REPLACE WITH - Replace a piece of code (whatever we "FIND") with this code



AFTER, ADD - After a piece of code, add this piece of code



BEFORE, ADD - Before a piece of code, add this piece of code



IN-LINE FIND - Find a piece of code within a code line



IN-LINE AFTER, ADD - After a piece of code in a code line, add this piece of code



IN-LINE BEFORE, ADD - Before a piece of code in a code line, add this piece of code



IN-LINE REPLACE WITH - Will preform a 'replace' with the line of code in previous 'IN-LINE FIND'





*If you find that the above eleven (11) 'actions' are not sufficient, please contact the MOD Team Leader (Nuttzy99) via Private Message.





Here are examples of each 'Action':



Code:



#

#-----[ SQL ]------------------------------------------

#

CREATE TABLE `phpbb_config` (

`config_name` varchar(255) NOT NULL default '',

`config_value` varchar(255) NOT NULL default '',

PRIMARY KEY (`config_name`)

) TYPE=MyISAM;







With this command, the end-user would need to perform the above create table within their SQL Database.





Code:



#

#-----[ COPY ]------------------------------------------

#

copy foo_body.tpl to templates/subSilver/foo_body.tpl

copy foo_body.tpl to templates/subSilver/

copy *.* to templates/subSilver/







With this command you can upload/copy the user files to the server







Code:



#

#-----[ OPEN ]------------------------------------------

#

includes/constants.php







Do not start the OPEN action with a slash and do not use /phpBB2/ or something like that



First, we call the 'Action', which in this case is "OPEN".

The "OPEN" action will -always- be the first action of your MOD, after SQL and COPY Actions.



In the above example, we are opening the file: constants.php

which is located in the 'includes' directory, under the root directory.





Code:



#

#-----[ FIND ]------------------------------------------

#



{L_NEW_POSTS}









In this instance, we are going to look within the file we previously opened, and FIND the text: {L_NEW_POSTS}



FIND is simply a way for the end-user to know exactly where something else is going to take place.







Code:



#

#-----[ REPLACE WITH ]------------------------------------------

#



{L_YOUR_VARIABLE}









In this instance, we are REPLACING {L_NEW_POSTS} WITH {L_YOUR_VARIABLE}



REPLACE WITH is a way of replacing whatever we "FIND" with your new block of code





Code:



#

#-----[ AFTER, ADD ]------------------------------------------

#



<img src="templates/subSilver/images/some_new_image.gif" alt="{L_YOUR_VARIABLE}"/>









In this instance, AFTER {L_NEW_POSTS} we are ADDING a new image.



AFTER, ADD is a way of instructing the end-user to add a new block of code AFTER their "FIND"





Code:

#

#-----[ BEFORE, ADD ]------------------------------------------

#





<img src="templates/subSilver/images/some_new_image.gif" alt="{L_YOUR_VARIABLE}"/>







In this instance, BEFORE {L_NEW_POSTS} we are ADDING a new image.



BEFORE, ADD is a way of instructing the end-user to add a new block of code BEFORE their "FIND"







IN-LINE FIND with this action you can find code in a code line



Code:



#

#-----[ IN-LINE FIND ]------------------------------------------

#

user_from = '" . str_replace("\'", "''", $location) . "',







For finding code in a code line









IN-LINE AFTER, ADD is way to add code directly after in already present code line



Code:



#

#

#-----[ IN-LINE AFTER, ADD ]------------------------------------------

#

user_from_flag = '$user_flag',







This example adds 'user_from_flag = '$user_flag', ' directly after the code line you have used in the FIND action



IN-LINE BEFORE, ADD is way to add code directly before in already present code line



Code:



#

#

#-----[ IN-LINE BEFORE, ADD ]------------------------------------------

#

user_from_flag = '$user_flag',







This example adds 'user_from_flag = '$user_flag', ' directly before the code line you have used in the FIND action



Code:



#

#

#-----[ IN-LINE REPLACE WITH ]------------------------------------------

#

user_from_flag = '$user_flag',







This example Replaces:

Code:

user_from = '" . str_replace("\'", "''", $location) . "',



with:

Code:

user_from_flag = '$user_flag',





with the code line you have used in the IN-LINE FIND Action.





This concludes our eleven (11) 'Actions'.









Finally, at the -very end- of your MOD, include:









Code:

#

#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------

#

# EoM







This is simply a reminder to "Save and Close" all the files we've just edited.



QUOTES



How to use quotes:



If you define a string such as "Hello!" PHP will parse that string and attempt to replace any variables it finds within it ... most of the time this is an unnecessary step and goes against phpBB coding standards. Whereas a string defined 'Hello!' doesn't see PHP attempting variable substitution.







(oh, btw, EoM simply means: End of MOD for those wondering<grin>)
*譯文資料在phpBB 技術文件
bu.femto-size
*和我聯絡,請寄 or Google Talk 圖檔
*作品: Intergrated Toplist & Message Can
回覆文章

回到「phpBB 技術文件與知識庫」