-
Notifications
You must be signed in to change notification settings - Fork 23
RedSHOP for Joomla 2.5 guidelines
Some things that we need to do in order to have the code better.
-
Remove closing tags ?> in all files. PHP doesn't need it and what is after the closing tag is ignored by the PHP parser. So if there is any space or white line, a Http Response will be sent.
-
All constructors must be renamed __construct(). We need to move away from the PHP4 style, since Joomla 2.5 is only PHP5.2+ compatible.
-
Use foreach instead of for when you don't have to know the array size. Foreach is faster than For.
-
Useless references should be removed, $db = &JFactory::getDBO() => $db = JFactory::getDBO().
-
All classes must begin with an upper case letter and be camelcased : 'ProductHelper', 'CategoryViewCategory'.
-
All methods must begin with a lower case letter and be camelcased : 'getProduct', 'setValue'. No underscore allowed.
They must have a little DocComment explaining what is done in that method :
See in Joomla how the comments are clean : https://github.com/joomla/joomla-platform/blob/staging/libraries/joomla/database/driver.php
- All classes properties or methods must mention their visibility (public, protected or private).
- function test() {} must become : public function test().
- var $var must become : public $var
-
GLOBAL vars are strongly discouraged. $mainframe = JFactory::getApplication();
-
We need to drop the '_' prefix on class properties and methods. Joomla is moving away from that too.
-
For portability use the new Joomla Database API :
http://www.theartofjoomla.com/home/9-developer/135-database-upgrades-in-joomla-16.html
- Use JInput instead of JRequest. JRequest will be removed in future versions :
http://docs.joomla.org/Retrieving_request_data_using_JInput
- Be aware of the backward compatibility issue :
- Home
- Developer
- How to get Config variable
- Product
- Validate AJAX Request
- Render JLayout or redSHOP Layout
- redSHOP Joomla Plugin Architecture Types
- Creditcard Payment Gateway List
- History of redSHOP Checkout Flow
- redSHOP 1.x series development decisions
- RedSHOP for Joomla 2.5 guidelines
- redSHOP Payment Gateway Sandbox Details
- redSHOP Shipping API Test Details