Login / Status
developer.Resource
Home . Documentation . Document Library . Core Documentation
Sponsors
hosted by punkt.deTYPO3 and Open Source Magazine

Chapter 1. Project Coding Guidelines

Extension Key: doc_core_cgl

Copyright 2000-2007, Kasper Skårhøj, <kasper@typo3.com>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

---------------

Revision “CGL360”

1.1. Introduction

This document is intended for those who are interested in helping with the TYPO3 project by programming extensions or changes to the core.

The guidelines in this document must be followed when you write anything to the core of TYPO3.

If you program your own extensions you may follow these guidelines but in order to get a review of your extensions with an outcome of “Cigar” or “Cohiba” you will have to follow these rules.

Some people may object to the visual guidelines since everyone has his own habits. You will have to overcome that in the case of TYPO3; the visual guidelines must be followed along with coding guidelines for security. We want all contributions to the project to be as similar in style as possible.

Summary of TYPO3 3.6.0 coding standard

Version 3.6.0 has been cleaned up from the bottom of the code base to reflect a standard for all extensions and future work. Of course all TYPO3 3.6.0 code should comply with these guidelines in general, but in comparison to version 3.5.0 this is the essense of the change:

  1. XHTML (transitional) / CSS compliance

  2. Single quotes are used every where.

  3. XSS and SQL injection prevented by usage of htmlspecialchars(), $GLOBALS['TYPO3_DB']->addslashes(), intval()

  4. All functions and classes are commented fully with parameters and return values.

  5. Classes have @package/@subpackage tags, contain a function index and have the CVS keyword “$Id$” in the header comment of the document.

It will be possible to find deviations from this standard in the core of TYPO3 but that will be less than 1% cases and therefore there will be no doubt about the general style and standard of the code.

We encourage everyone to bring their code up to this standard.

Extension Review Scorecard

For the extension review group there is a scorecard document which is listing a set of issues an extension reviewer will go through one by one. The scorecard will also be useful to read through this that is a more practical step-by-step guide to what makes an extension good.