Adapting a Joomla 1.0 extension to Joomla 1.5

From Joomla! Documentation

(Redirected from Adapting a Joomla 1.0 extension to Joomla 1.5)


This is a first draft... Please complete or comment so we can complete it...

Although Joomla 1.5 has been designed with Joomla 1.0 backwards compatibility in mind, there are a very few items which are not backwards compatible, and require minimal adaptations. This document sumarizes the changes which need to be made to Joomla 1.0 extensions to make them run in Joomla 1.5.


Denying direct access

The Joomla 1.0 way to deny access for a direct external call is:

defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');

which has been changed into:

defined( '_JEXEC' ) or die( 'Restricted access' );

Request/POST parameters

By default URL parameters are not translated anymore into globals of same name, but should be accessed the standard way. Here too, the change is trivial: instead of looking directly for the variable $reportform, first retrieve it using JRequest. The Joomla 1.0 way of doing this is:

 $form = mosGetParam( $_REQUEST, 'reportform');

The only official way is now:

 $form = JRequest::getVar('reportform');

This will prevent SQL injection attacks by the way, as both mosGetParam and JRequest escape the variables for malicious SQL code.

Start of changes in ACL

The tables structure of the used phpGACL has changed slightly, due to an update to latest phpGACL. The $acl->.... methods remain backwards compatible, so extensions which do not access ACL tables wildly are ok. Please report incompatibilities, so they can be fixed in the core.


Global scope

For security enhancement reasons and better encapsulation reasons, the components are not anymore just included from the main index.php, but called from a function. Thus their variables scope is not the global scope anymore. This means that variables created in the main part of a component, which are not declared as global before creation belong to the component's main execution, and are not accessible as global from the components functions. The adaptation is trivial: just add one line in the begin of the component: global .... enumerating the global variables of the component.


Modules path

Each module is installed in its own sub-directory, like components, meaning if they have images or other files, the path changes.

Joomla Plugins (previously Mambots)

Change of name

The mambots have been renamed to joomla plugins, as well as the directory, so same remark applies there.

Event registration

The Joomla 1.0 way of registering a function for an event is:

$_MAMBOTS->registerFunction( 'onPrepareContent', 'botMybot' );

which has been changed into

$mainframe->registerEvent( 'onPrepareContent', 'botMybot' );

Helper class

A new core class was developed for helping us to manage plugins, this class is JPluginHelper.

It can be used (for example) to know if a plugin is published or not.

$plugin =& JPluginHelper::getPlugin('content', 'mybot');
if (!$plugin->published){ 
  //plugin not published 
}else  { 
  //plugin published 

Parameter management class

The new core class JParameter was developed for helping us to manage plugins. It can be used to retrieve plugin paramaters, for example:

$pluginParams = new JParameter( $plugin->params );

Please note that we pass to the constructor the params member of the plugin instance created using the JPluginHelper (see above).

Retrieving parameters is now as simple as:

$pluginParams->get( 'P1', 0 );

JParameter can also be used for components and modules, see the documentation at JParameter.

Other changes

There is another section covering the joomla plugins... link?

Here is one: Fitting Community builder in 1.5 legacy mode, while preserving compatibility to Joomla 1.0 and Mambo 4.5.x