Converting Old Extensions to Joomla 1.5 and 1.6

March 20, 2009

Reading time ~21 minutes

Jump to converting 1.5 to 1.6, 1.0 to 1.5

Joomla 1.5 to 1.6

Joomla 1.6 was released on 10 January 2011. There are several changes that are required to allow extension to install on Joomla 1.6, and also other changes required for them to take advantage of new requirements and features.

Key points for 1.6 to remember are the minimum server requirements being PHP 5.2.4+ and MySQL 5.0.4+.  Also see What's new in Joomla 1.6 for developers.

Changes to database tables in Joomla 1.6
Name in Joomla 1.5 Name in Joomla 1.6
Changes to the table names
jos_banner jos_banners
jos_bannerclient jos_banner_clients
jos_bannertrack jos_banner_tracks
jos_components Removed and merged into jos_extensions
jos_core_acl_aro No equivalent
jos_core_acl_aro_groups jos_usergroups
jos_core_aro_map No equivalent
jos_core_acl_aro_sections No equivalent
jos_core_acl_groups_aro_map jos_user_usergroup_map
jos_core_log_items No equivalent
jos_groups jos_viewlevels
jos_plugins Removed and merged into jos_extensions
jos_poll* Extension removed
jos_sections Removed and merged into jos_categories
jos_stats_agents No equivalent
jos_templates_menu Removed and merged into jos_menu
Changes to table field names
jos_banner.showBanner jos_banners.state Removed
jos_categories.ordering jos_categories.lft
jos_categories.section jos_categories.extension
jos_categories.image Removed
jos_categories.image_position Removed
jos_categories.editor jos_categories.created_user_id
jos_categories.count Removed jos_menu.title
jos_menu.parent jos_menu.parent_id
jos_modules.numnews Removed
jos_modules.iscore Removed
jos_modules.control Removed
jos_session.gid Removed
jos_users.gid Removed
jos_weblinks.published jos_weblinks.state
Other New Tables

For more information on database changes see the article Database upgrades in Joomla 1.6.

Changes to plugin events in Joomla 1.6
Usage in Joomla 1.5 Usage in Joomla 1.6
Events that have been renamed
onAfterContentSave onContentAfterSave
onAfterDisplayTitle onContentAfterTitle
onAfterDisplayContent onContentAfterDisplay
onBeforeDisplayContent onContentBeforeDisplay
onBeforeContentSave onContentBeforeSave
onSearch onContentSearch
onSearchAreas onContentSearchAreas
onAuthenticate onUserAuthenticate
onAfterDeleteUser onUserAfterDelete
onAfterStoreUser onUserAfterSave
onBeforeDeleteUser onUserBeforeDelete
onBeforeStoreUser onUserBeforeSave
onLoginFailure onUserLoginFailure
onLoginUser onUserLogin
onLogoutUser onUserLogout
New events
n/a onBeforeCompileHead
n/a onBeforeRender
n/a onContentBeforeDelete
n/a onContentAfterDelete
n/a onContentChangeState
n/a onContentPrepare
n/a onContentPrepareData
n/a onContentPrepareForm
n/a onExtensionBeforeInstall
n/a onExtensionBeforeSave
n/a onExtensionBeforeUpdate
n/a onExtensionBeforeUninstall
n/a onExtensionAfterInstall
n/a onExtensionAfterSave
n/a onExtensionAfterUpdate
n/a onExtensionAfterUninstall

Note carefully that all content events (except for search and search areas) now pass a 'context' variable as the first argument to advise the plugin as to what type of content is being passed. The plugin events have been rationalised to avoid collisions with, and possible errors caused by using the 1.5 argument list.  While 1.5-named events will stop working in 1.6, they at least will not cause unexpected errors due to the change in the argument list.  However, this does allow you to create dual 1.5/1.6 compatible plugins with one set of events for 1.5 and the other for 1.6 in the same file.

The plugin event should test this context variable to see if it is interested in processing the content. You can no longer assume that content events are from articles.  All core content components (banners, articles, weblinks, et al) use the onContent before and after save.  Extensions (modules, plugins, etc) use onExtension before and after save.  Example plugins with events are provided in the Joomla 1.6 distribution.

For more information on plugins see the article more on upgrading plugins to Joomla 1.6.

Joomla 1.0 to 1.5

Joomla 1.0 end-of-life occurred on July 22, 2009.  Joomla 1.5 provides a legacy layer to allow many Joomla 1.0 extensions to run in Joomla 1.5.   The following tables outline many of the API changes in a simple "old way" versus "new way" format.

The best way to convert your extensions to run natively with Joomla 1.5 is to turn legacy mode off and observe the errors that occur.  Use the tables to look up the missing functions or classes and make the appropriate replacements.

Please note that these tables are only to be used to assist in converting your extensions to run natively on Joomla 1.5.  In some cases there are "better" ways to do things, or there are new features in Joomla 1.5 that you can take advantage of that replace some of the Joomla 1.0 ways of doing things.  To find out more about the "Joomla Way" in Joomla 1.5 I encourgage you to subscribe to the Art of Joomla Developer Reference.

Translations available: IT DE

Changes to template functions
Usage in Joomla 1.0 Usage in Joomla 1.5
Display the component
<?php echo mosMainBody();?> <jdoc:include type="component" />
 Count the number of modules in a position
<?php if (mosCountModules('left')) : ?> <?php if ($this->countModules('left')) : ?>
<?php if (mosCountModules('left') || mosCountModules('right')) : ?> <?php if ($this->countModules('left OR right')) : ?>
Loading modules in a position
<?php mosLoadModules('left', 0);?> <jdoc:include type="modules" name="left" style="table"/>
<?php mosLoadModules('left', -1);?> <jdoc:include type="modules" name="left" style="raw"/>
<?php mosLoadModules('left', -2);?> <jdoc:include type="modules" name="left" style="xhtml"/>
<?php mosLoadModules('left', -3);?> <jdoc:include type="modules" name="left" style="rounded"/>
Load a single module
<?php mosLoadModule('Banners', -1);?> <jdoc:include type="module" name="Banners" style="raw" />
<?php mosLoadModule('Latest News', -2);?> <jdoc:include type="module" name="Latest News" style="xhtml" />
<?php mosLoadModule('Newsflash', -3);?> <jdoc:include type="module" name="Newsflash" style="rounded" />
Include directives in the HEAD tag
<?php mosShowHead();?> <jdoc:include type="head" />
Displaying the pathway
<?php mosPathWay();?> Include a module position to use the "breadcrumbs" module.
Changes involving global variables
Usage in Joomla 1.0 Usage in Joomla 1.5
File system path to the site
				global $mosConfig_abosolute_path;
$path = $mosConfig_abosolute_path.'/file.php';
				$path = JPATH_SITE.DS.'file.php';
File system path to adminstrator 
				global $mosConfig_abosolute_path;
$path = $mosConfig_abosolute_path.'/administrator/file.php';
				$path = JPATH_ADMINISTRATOR.DS.'file.php';
File system path to the current component 
				$path = JPATH_COMPONENT.DS.'file.php';
URL to the site 
global $mosConfig_live_site; $url = JUri::base(true);
The application object 
global $mainframe; $app = &JFactory::getApplication();
$path = $mainframe->getBasePath(0);
$path = $mainframe->getBasePath('site');
$path = $mainframe->getBasePath('front');
$path = JPATH_SITE.DS;
$path = $mainframe->getBasePath(2);
$path = $mainframe->getBasePath('installation');
$path = $mainframe->getBasePath(1);
$path = $mainframe->getBasePath('admin');
$path = $mainframe->getBasePath('administrator');
				$document=& JFactory::getDocument();
				$document=& JFactory::getDocument();
$title = $document->getTitle();
Accessing configuration file variables 
global $mosConfig_list_limit;
				$app = &JFactory::getApplication();
$limit = $app->getCfg('list_limit');

global $mosConfig_offset_user;

				$user = &JFactory::getUser();
$userOffset = $user->getParam('timezone');
				global $mosConfig_debug;

if ($mosConfig_debug) // ...
				if (JDEBUG) // ...

// or

$app = &JFactory::getApplication();
if ($app->getCfg('debug')) // ...
Getting the option or component name 
global $option; $option = JRequest::getCmd('option');
Getting the current user object 
global $my; $user = &JFactory::getUser();
Getting the database object 
global $database; $db = &JFactory::getDbo();


General API and function changes
Usage in Joomla 1.0 Usage in Joomla 1.5
Direct access check
defined('_VALID_MOS') or die; defined('_JEXEC') or die;
Translating text
<?php echo _COMMENTS_TITLE;?> <?php echo JText::_('Comments_Title');?>
Accessing request variables 
$cid = mosGetParam($_REQUEST, 'cid', array()); $cid = JRequest::getVar('cid', array());
$ints = josGetArrayInts($name, $type);
				$ints = JRequest::getVar($name, array(), 'method', 'array');
$params = new mosParameters($ini); $params = new JParameter($ini);
Getting component parameters 
				$comp = new mosComponent($database);
$params = new mosParameters($comp->params);
				$params = JComponentHelper::getParams('com_foobar');
Bind data to objects
mosBindArrayToObject($array, &$obj, $ignore, $prefix, $checkSlashes);
				// Providing object is derived from JTable
$object->bind($array, $ignore);
Hash a string
$value = mosHash($seed); $value = JUtility::getHash($seed);
Bounce an unauthorised user
mosNotAuth(); JError::raiseError('401', JText::_('ALERTNOTAUTH'));
 Display an error popup
mosErrorAlert($text, $action, $mode); No direct replacement. Recommend raising a notice using JError::raiseNotice or a warning using JError::raiseWarning and redirecting the page.
Clean a file system path
mosPathName($p_path, $p_addtrailingslash);
$path = JPath::clean($p_path);
// Handle trailing slash manually
Sending mails
mosMail($from, $fromname, $recipient, $subject, $body, $mode, $cc, $bcc, $attachment, $replyto, $replytoname )
JUtility::sendMail($from, $fromname, $recipient, $subject, $body, $mode, $cc, $bcc, $attachment, $replyto, $replytoname );
mosSendAdminMail($adminName, $adminEmail, $email, $type, $title, $author); JUtility::sendAdminMail($adminName, $adminEmail, $email, $type, $title, $author)
Making a password
$pwd = mosMakePassword();
$pwd = JUserHelper::genRandomPassword();
Redirecting to a new page
mosRedirect($url, $msg);
				$app = &JFactory::getApplication();
$app->redirect($url, $msg);
Managing folders
$result = mosMakePath($base, $path, $mode);
$result = JFolder::create($base.$path, $mode == null ? 0755 : $mode);
$result = deldir($path);
$result = JFolder::delete($path);
Converting an array to integers
mosArrayToInts($array, $default); JArrayHelper::toInteger($array, $default);
File permissions
$result = mosChmod($path);
$result = JPath::setPermissions($path);
$result = mosChmodRecursive($path, $filemode, $dirmode);
$result = JPath::setPermissions($path, $filemode, $dirmode);
$result = mosIsChmodable($file);
$result = JPath::canChmod($file);
Getting browser information
$browser = mosGetBrowser($agent);
$browser = &JBrowser::getInstance();
$os = mosGetOS($agent);
$browser = &JBrowser::getInstance();
$os = $instance->getPlatform();
Displaying an ordering select list
mosGetOrderingList($sql, $chop) JHTML::_('list.genericordering', $sql, $chop)
Parsing INI formatted strings
$params = mosParseParams($txt)
				$registry = new JRegistry();
$params = $registry->toObject();
// or
$params = new JParameter($txt);
Using Editors
				$editor = &JFactory::getEditor();
echo $editor->initialise();
getEditorContents($editorArea, $hiddenField);
$editor = &JFactory::getEditor();
echo $editor->save($hiddenField);
editorArea($name, $content, $hiddenField, $width, $height, $col, $row);
				jimport( 'joomla.html.editor' );
$editor = &JFactory::getEditor();
echo $editor->display($hiddenField, $content, $width, $height, $col, $row);
Menu based authorisation
$allowed = mosMenuCheck($Itemid, $menu_option, $task, $gid);
				$user =& JFactory::getUser();
$menus =& JSite::getMenu();
$allowed = $menus->authorize($Itemid, $user->get('aid')); 
Converting an object to an array
$array = mosObjectToArray($p_obj, $recurse, $regex); $array = JArrayHelper::fromObject($p_obj, $recurse, $regex);
Date functions
echo mosFormatDate($date, $format, $offset); echo JHTML::_('date', $date, $format ? $format : JText::_('DATE_FORMAT_LC1'), $offset);
echo mosCurrentDate($format); echo JHTML::_('date', 'now', $format ? $format : JText::_('DATE_FORMAT_LC1'));
Preparing an variables for safe output
mosMakeHtmlSafe($row, $quote_style, $exclude_keys); JFilterOutput::objectHTMLSafe($row, $quote_style, $exclude_keys);
<?php echo ampReplace($text);?> <?php echo JFilterOutput::ampReplace($text);?>
Sorting an array of objects
SortArrayObjects($array, $k, $sort_direction); JArrayHelper::sortObjects($array, $k, $sort_direction);
CSRF (spoof) checking

Place the following code before the end of your form:

<?php echo JHtml::_('form.token'); ?>

josSpoofCheck($header, $alternate); JRequest::checkToken() or die(JText::_('Invalid Token'));
Load javascript tooltip support
loadOverlib(); JHTML::_('behavior.tooltip');
mosToolTip($tooltip, $title, $width, $image, $text, $href, $link); JHTML::_('tooltip', $tooltip, $title, $image, $text, $href, $link)
<?php echo mosWarning($warning, $title);?> <?php echo JHTML::tooltip($warning, $title, 'warning.png', null, null, null);?>
Routing URLs
<?php echo sefRelToAbs($link);?>  <?php echo JRoute::_($link);?>
Traversing tree data
mosTreeRecurse($id, $indent, $list, $children, $maxlevel, $level, $type); JHTML::_('menu.treerecurse', $id, $indent, $list, $children, $maxlevel, $level, $type)
Functions without direct replacements
mosCreateMail($from, $fromname, $subject, $body);  
mosShowSource($filename, $withLineNums);  
mosLoadComponent($name); Handled by JDocument.


Only ever used at the application level. Doesn't affect extensions.


Changes involving the database
Usage in Joomla 1.0 Usage in Joomla 1.5
Database table classes 
				class MyTable extends mosDBTable {
 // lots of variables defined
 function MyTable(&$db) {
  $this->mosDBTable('#__table_name', 'id', $db);
				class MyTable extends JTable {
 // lots of variables defined
 function __construct(&$db) {
   parent::__construct('#__table_name', 'id', $db);
Limits in database queries 
				$sql = 'SELECT *'
     . ' FROM #__table_name'
     . ' LIMIT 10, 20';
				$db = &JFactory::getDbo();
 .' FROM #__table_name'
 .' LIMIT 10, 20',
 10, 20
Loading an object from the database 
$db->loadObject($object); $object = $db->loadObject();


Changes to components
Usage in Joomla 1.0 Usage in Joomla 1.5
Getting a predefined path
$mainframe->getPath('admin_html'); JApplicationHelper::getPath('admin_html');
Getting component parameters 
				$comp = new mosComponent($database);
$params = new mosParameters($comp->params);
				$params = JComponentHelper::getParams('com_foobar');


Changes to the Administrator menus helper
Usage in Joomla 1.0 Usage in Joomla 1.5
Display an ordering select list
mosAdminMenus::Ordering($row, $id)
JHTML::_('menu.ordering', $row, $id)
Display an access level select list
 mosAdminMenus::Access($row) JHTML::_('list.accesslevel', $row)
Display a published state select list
  mosAdminMenus::Published($row) JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published)
Display a multi-select menu list
mosAdminMenus::MenuLinks($lookup, $all, $none, $unassigned) JHTML::_('select.genericlist', $options, 'selections[]', 'class="inputbox" size="15" multiple="multiple"', 'value', 'text', $lookup, 'selections' )
Display a category select list
mosAdminMenus::Category($menu, $id, $javascript) No direct replacement
Display a section select list
mosAdminMenus::Section($menu, $id, $all) No direct replacement
Display a component select list
mosAdminMenus::Component($menu, $id) No direct replacement
Get the name of a component
mosAdminMenus::ComponentName($menu, $id) No direct replacement
Display a select list of images
mosAdminMenus::Images($name, $active, $javascript, $directory) JHTML::_('list.images', $name, $active, $javascript, $directory)
Display a select list of ordering values
mosAdminMenus::SpecificOrdering($row, $id, $query, $neworder) JHTML::_('list.specificordering', $row, $id, $query, $neworder)
Display a select list of users
mosAdminMenus::UserSelect( $name, $active, $nouser, $javascript, $order, $reg) JHTML::_('list.users', $name, $active, $nouser, $javascript, $order, $reg);
Display a select list of alignment positions
mosAdminMenus::Positions($name, $active, $javascript, $none, $center, $left, $right, $id) JHTML::_('list.positions', $name, $active, $javascript, $none, $center, $left, $right, $id)
Display a select list of component categories
mosAdminMenus::ComponentCategory($name, $section, $active, $javascript, $order, $size, $sel_cat) JHTML::_('list.category', $name, $section, $active, $javascript, $order, $size, $sel_cat)
Display a select list of sections
mosAdminMenus::SelectSection($name, $active, $javascript, $order) JHTML::_('list.section', $name, $active, $javascript, $order)
Display a select list of menu items of a given type
mosAdminMenus::Links2Menu($type, $and) No direct replacement
Display a select list of menu items
mosAdminMenus::MenuSelect($name, $javascript) No direct replacement
Return a named array (by folder) of images in folders
mosAdminMenus::ReadImages($imagePath, $folderPath, $folders, $images) No direct replacement
Display a special select list of image folders
mosAdminMenus::GetImageFolders($folders, $path) No direct replacement
Display a special select list of images with preview behaviours
mosAdminMenus::GetImages($images, $path) No direct replacement
Display a special select list of images with preview behaviours
mosAdminMenus::GetSavedImages($row, $path)  No direct replacement
 Display a frontend image checking for a template override
mosAdminMenus::ImageCheck($file, $directory, $param, $param_directory=, $alt, $name, $type, $align) JHTML::_('', $file, $directory, $param, $param_directory, $alt, array('align' => $align), $type)
 Display a backend image checking for a template override
mosAdminMenus::ImageCheckAdmin($file, $directory, $param, $param_directory, $alt, $name, $type, $align) JHTML::_('image.administrator', $file, $directory, $param, $param_directory, $alt, array('align' => $align), $type)
Deprecated method
mosAdminMenus::menutypes() No longer used
Deprecated method
mosAdminMenus::menuItem($item)  No longer used


Changes to the cache API
Usage in Joomla 1.0 Usage in Joomla 1.5
Get the cache for a group
$cache = mosCache::getCache($group); return JFactory::getCache($group);
 Clean the cache for a group
				$cache =& JFactory::getCache($group);


Changes to miscellaneous classes
Usage in Joomla 1.0 Usage in Joomla 1.5
class MyClass extends mosAbstractTasker class MyController extends JController
$object = new mosEmpty; $object = new JObject;
$tabs = new mosTabs($useCookies); $pane = new JPaneTabs(array('useCookies' => $useCookies));


Changes to HTML helper classes
Usage in Joomla 1.0 Usage in Joomla 1.5
mosCommonHTML::ContentLegend() No direct replacement.
mosCommonHTML::menuLinksContent($menus) No direct replacement.
mosCommonHTML::menuLinksSecCat($menus) No direct replacement.
Display a checkbox or checkout icon
mosCommonHTML::checkedOut($row, $overlib)
echo JHTML::_('grid.checkedOut',$row, $overlib);
mosCommonHTML::CheckedOutProcessing($row, $i)
echo JHTML::_('grid.checkedout', $row, $i);
Load javascript tooltip support
mosCommonHTML::loadOverlib(); JHTML::_('behavior.tooltip');
Load javascript calendar support
mosCommonHTML::loadCalendar(); JHTML::_('behavior.calendar');
Display a link that cycles through the access levels
mosCommonHTML::AccessProcessing($row, $i, $archived) JHTML::_('grid.access',  $row, $i, $archived);
Display a published state icon
mosCommonHTML::PublishedProcessing($row, $i, $imgY, $imgX) JHTML::_('grid.published',$row, $i, $imgY, $imgX)
Display a published state icon with toggle
mosCommonHTML::selectState($filter_state, $published, $unpublished, $archived) JHTML::_('grid.state', $filter_state, $published, $unpublished, $archived)
Display a save order button
mosCommonHTML::saveorderButton($rows, $image); echo JHTML::_('grid.order', $rows, $image)
Display the ordering icon in a column heading
mosCommonHTML::tableOrdering($text, $ordering, $lists, $task); echo JHTML::_('grid.sort',  $text, $ordering, @$lists['order_Dir'], @$lists['order'], $task);
Display a back button
<?php mosHTML::BackButton ($params, $hide_js);?> No direct replacement.
Clean and prepare text for output
<?php echo mosHTML::cleanText ($text);?>  <?php echo JFilterOutput::cleanText($text);?>
Displaying a print button
<?php mosHTML::PrintIcon($row, &$params, $hide_js, $link, $status);?> No direct replacement.
Cloak an email
<?php echo mosHTML::emailCloaking($mail, $mailto, $text, $email);?> <?php echo JHTML::_('email.cloak', $mail, $mailto, $text, $email);?>
Load support to keep the page alive (avoiding session time-outs)
<?php mosHTML::keepAlive();?> <?php echo JHTML::_('behavior.keepalive');?>


Working with the menubar and toolbars
Usage in Joomla 1.0 Usage in Joomla 1.5
No longer used.
No longer used.
JToolbarHelper::addNew('new', 'New');


mosToolbar JToolbarHelper


Changes to the core database table classes
Usage in Joomla 1.0 Usage in Joomla 1.5
mosCategory JTableCategory
mosContent JTableContent
mosComponent JTableComponent
mosMambot JTablePlugin
mosMambotHandler JDispatcher
mosMenu JTableMenu
mosModule JTableModule
mosSection JTableSection
mosSession JTableSession
mosUser JTableUser
Updating the order of items
$result = $row->updateOrder($where); $result = $row->reorder($where);
Publishing a list of items
$result = $row->publish_array($cid, $publish, $user_id) $result = $row->publish($cid, $publish, $user_id);


Working with plugins
Usage in Joomla 1.0 Usage in Joomla 1.5
mosMambotHandler::loadBotGroup($group); JPluginHelper::importPlugin($group, null, false);
mosMambotHandler::loadBot($folder, $element, $published, $params); JPluginHelper::importPlugin($folder, $element);
mosMambotHandler::registerFunction( $event, $function ) JApplication::registerEvent( $event, $function );
				$dispatcher =& JDispatcher::getInstance();
$result = $dispatcher->trigger($event, $arguments);


File formats
Usage in Joomla 1.0 Usage in Joomla 1.5
Translation files
/language/english.php /language/en-GB/en-GB.ini
// Files saved as PHP files
define('_COMMENTS_TITLE', 'Title');
define('_COMMENTS_GUEST_TO_POST', 'Allow guests to post');
				# Files must be saved as UTF-8 in INI format
COMMENTS_GUEST_TO_POST=Allow guests to post

Advanced Test Driven Development for Node - Part 1

Part 1 of my attempt to port Robert C. Martin's talk '8LU:Advanced Concepts in TDD' to Node. Continue reading

Semantic versioning for retail software

Published on December 11, 2014

Better Grunt files (for organised developers)

Published on December 02, 2014