Actions

BasicPHPFileTemplates

From Mahara Wiki

Revision as of 01:57, 5 August 2011 by Brki (talk | contribs) (removed reference to non-existant /examples, removed require('init.php) for non-hittable files)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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

.
  *
  * @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();

 // Your code here :)

Notes:

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