Actions

Difference between revisions of "BasicPHPFileTemplates"

From Mahara Wiki

(removed reference to non-existant /examples, removed require('init.php) for non-hittable files)
(clarify licensing related stuff)
Line 2: Line 2:
  
 
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">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">http://www.gnu.org/copyleft/gpl.html</span>] ).
 
<div id="section_1">
 
  
 
===Template for files you expect to be hit by visitors===
 
===Template for files you expect to be hit by visitors===
  
 
  .
 
  .
 +
/**
 +
  * Mahara: Electronic portfolio, weblog, resume builder and social networking
 +
  * Copyright (C) 2011 Copyright Holder
 +
  *
 +
  * (rest of the GPL statement)
 
   *
 
   *
 
   * @package    mahara
 
   * @package    mahara
   * @subpackage core
+
   * @subpackage core or plugintype/pluginname
 
   * @author    Firstname Lastname
 
   * @author    Firstname Lastname
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 
  * @copyright  (C) 2010 Firstname Lastname
 
  *
 
 
   */
 
   */
 
   
 
   
Line 22: Line 22:
 
   // Your code here :)
 
   // Your code here :)
 
   
 
   
 
</div><div id="section_2">
 
  
 
===Template for files you do NOT want to be hit by visitors===
 
===Template for files you do NOT want to be hit by visitors===
  
 
  .
 
  .
 +
/**
 +
  * Mahara: Electronic portfolio, weblog, resume builder and social networking
 +
  * Copyright (C) 2011 Copyright Holder
 +
  *
 +
  * (rest of the GPL statement)
 
   *
 
   *
 
   * @package    mahara
 
   * @package    mahara
 
   * @subpackage core or plugintype/pluginname
 
   * @subpackage core or plugintype/pluginname
 
   * @author    Firstname Lastname
 
   * @author    Firstname Lastname
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 
  * @copyright  (C) 2010 Firstname Lastname
 
  *
 
 
   */
 
   */
 
   
 
   
Line 45: Line 45:
  
 
* Omit the closing php tag "?&gt;"
 
* Omit the closing php tag "?&gt;"
* Catalyst employees should assign copyright to "Catalyst IT Ltd [http://catalyst.net.nz/ <span style="white-space: nowrap">http://catalyst.net.nz</span>]", if they are working on the project in company time.
+
* Catalyst employees should assign copyright to "Catalyst IT Ltd", if they are working on the project in company time.
 
+
* The author field should always be a person (or more than one), not a company
</div>
 

Revision as of 11:52, 24 November 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.

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 ).

Template for files you expect to be hit by visitors

.
/**
  * Mahara: Electronic portfolio, weblog, resume builder and social networking
  * Copyright (C) 2011 Copyright Holder
  *
  * (rest of the GPL statement)
  *
  * @package    mahara
  * @subpackage core or plugintype/pluginname
  * @author     Firstname Lastname
  */

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

 // Your code here :)

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

.
/**
  * Mahara: Electronic portfolio, weblog, resume builder and social networking
  * Copyright (C) 2011 Copyright Holder
  *
  * (rest of the GPL statement)
  *
  * @package    mahara
  * @subpackage core or plugintype/pluginname
  * @author     Firstname Lastname
  */

 defined('INTERNAL') || die();

 // Your code here :)

Notes:

  • Omit the closing php tag "?>"
  • Catalyst employees should assign copyright to "Catalyst IT Ltd", if they are working on the project in company time.
  • The author field should always be a person (or more than one), not a company