Actions

J1.5

Difference between revisions of "Adapting a Joomla 1.0 extension to Joomla 1.5"

From Joomla! Documentation

m
Line 1: Line 1:
 +
{{RightTOC}}
 
[[Category:Development]]
 
[[Category:Development]]
 
====== Adapting Joomla 1.0 extensions to Joomla 1.5 ======
 
====== Adapting Joomla 1.0 extensions to Joomla 1.5 ======
Line 91: Line 92:
  
 
[[:start|Back to the Startpage]]
 
[[:start|Back to the Startpage]]
 +
[[Category:JED]]

Revision as of 20:24, 8 May 2010

Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Adapting Joomla 1.0 extensions 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.

Components

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.

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 at for instance at $form, do first a:

 $form = mosGetParam( $_REQUEST, 'reportform');
 $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 components which do not access ACL tables wildly are ok. Please report incompatibilities, so they can be fixed in the core.

Modules

Modules share most of the Components changes above. In addition:

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. \\ This remark applies on content plugins vs content mambots\\ \\

    • Remark #1**\\

Accordingly with general Joomla changes the old way for deny access for external direct call :\\ \\ \\

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

\\

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

\\

    • Remark #2**\\

Registering the event\\

\\

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

\\


\\

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

\\

\\ 


    • Remark #3**\\

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 was published or not \\

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

\\

\\

    • Remark #4**\\

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

It can be used to know plugins paramaters here is an example:\\ \\

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

\\ Please note that we pass at the constructor the data of instace prevoiusly declared at remark #3 and the we can manage the plugins paramater, for example we assume that the Mybot Plugin have 3 parameter : P1,P2,P3 so retriving paramater values is easy ,

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

Other changes

__There is another section covering the joomla plugins... link?__

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


Back to the Startpage