Actions

Difference between revisions of "BasicPHPFileTemplates"

From Mahara Wiki

Line 1: Line 1:
 
These are the templates for all new PHP files. There is a different template depending on whether you file is able to be publicly hittable or not. The templates are available in <code>/examples</code> in version control, and should be considered the most up to date versions of these files.
 
These are the templates for all new PHP files. There is a different template depending on whether you file is able to be publicly hittable or not. The templates are available in <code>/examples</code> in version control, and should be considered the most up to date versions of these files.
  
This project uses PHPDoc for API documentation. This project is also licensed under the GPL, which causes some header bloat (it is a requirement of licensing your program under the GPL, see [http://www.gnu.org/copyleft/gpl.html <span style="white-space: nowrap">[[Image:http.png]]http://www.gnu.org/copyleft/gpl.html</span>).
+
This project uses PHPDoc for API documentation. This project is also licensed under the GPL, which causes some header bloat (it is a requirement of licensing your program under the GPL, see [http://www.gnu.org/copyleft/gpl.html <span style="white-space: nowrap">[[Image:http.png]]http://www.gnu.org/copyleft/gpl.html</span>] ).
  
<div id="section_1"
+
<div id="section_1">
===Template for files you expect to be hit by visitors=
+
 
 +
===Template for files you expect to be hit by visitors===
  
 
  .
 
  .
* @package mahara
+
  *
* @subpackage core
+
  * @package   mahara
* @author   Firstname Lastname
+
  * @subpackage core
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
+
  * @author     Firstname Lastname
* @copyright  (C) 2010 Firstname Lastname
+
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL
* */
+
  * @copyright  (C) 2010 Firstname Lastname
   define('INTERNAL', 1) require('init.php'
+
  *
   // Your code here  
+
  */
  </div><div id="section_2"
+
===Template for files you do NOT want to be hit by visitors=
+
   define('INTERNAL', 1);
 +
  require('init.php');
 +
 +
   // Your code here :)
 +
   
 +
 
 +
</div><div id="section_2">
 +
 
 +
===Template for files you do NOT want to be hit by visitors===
  
 
  .
 
  .
* @package mahara
+
  *
* @subpackage core or plugintype/pluginname
+
  * @package   mahara
* @author   Firstname Lastname
+
  * @subpackage core or plugintype/pluginname
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
+
  * @author     Firstname Lastname
* @copyright  (C) 2010 Firstname Lastname
+
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL
* */
+
  * @copyright  (C) 2010 Firstname Lastname
 +
  *
 +
  */
 +
 
   defined('INTERNAL') || die();
 
   defined('INTERNAL') || die();
 
   require('init.php');
 
   require('init.php');

Revision as of 12:33, 12 May 2011

These are the templates for all new PHP files. There is a different template depending on whether you file is able to be publicly hittable or not. The templates are available in /examples in version control, and should be considered the most up to date versions of these files.

This project uses PHPDoc for API documentation. This project is also licensed under the GPL, which causes some header bloat (it is a requirement of licensing your program under the GPL, see File:Http.pnghttp://www.gnu.org/copyleft/gpl.html ).

Template for files you expect to be hit by visitors

.
  *
  * @package    mahara
  * @subpackage core
  * @author     Firstname Lastname
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
  * @copyright  (C) 2010 Firstname Lastname
  *
  */

 define('INTERNAL', 1);
 require('init.php');

 // Your code here :)

Template for files you do NOT want to be hit by visitors

.
  *
  * @package    mahara
  * @subpackage core or plugintype/pluginname
  * @author     Firstname Lastname
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
  * @copyright  (C) 2010 Firstname Lastname
  *
  */

 defined('INTERNAL') || die();
 require('init.php');

 // Your code here :)

Notes:

  • Omit the closing php tag "?>"
  • Catalyst employees should assign copyright to "Catalyst IT Ltd File:Http.pnghttp://catalyst.net.nz", if they are working on the project in company time.