Converting Joomla 1.0 code to Joomla 1.5 code
Reference
| 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 (mosCountModules('left') || mosCountModules('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. |
| Usage in Joomla 1.0 | Usage in Joomla 1.5 |
|---|---|
| File system path to the site | |
global $mosConfig_abosolute_path; |
$path = JPATH_SITE.DS.'file.php'; |
| File system path to adminstrator | |
global $mosConfig_abosolute_path; |
$path = JPATH_ADMINISTRATOR.DS.'file.php'; |
| File system path to the current component | |
| N/A |
$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 = JPATH_INSTALLATION.DS; |
$path = $mainframe->getBasePath(1);$path = $mainframe->getBasePath('admin');$path = $mainframe->getBasePath('administrator'); |
$path = JPATH_ADMINISTRATOR.DS; |
$mainframe->setPageTitle($title); |
$document=& JFactory::getDocument(); |
$mainframe->getPageTitle(); |
$document=& JFactory::getDocument(); |
| Accessing configuration file variables | |
global $mosConfig_list_limit; |
$app = &JFactory::getApplication(); |
|
|
$user = &JFactory::getUser(); |
global $mosConfig_debug; |
if (JDEBUG) // ... |
| 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(); |
| 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'); |
| Parameters | |
$params = new mosParameters($ini); |
$params = new JParameter($ini); |
| Getting Joomla component parameters | |
$comp = new mosComponent($database); |
$params = JComponentHelper::getParams('com_foobar');
|
| Bind data to objects | |
mosBindArrayToObject($array, &$obj, $ignore, $prefix, $checkSlashes); |
// Providing object is derived from JTable |
| 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); |
jimport('joomla.filesystem.path');
|
| 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(); |
jimport('joomla.user.helper');
|
| Redirecting to a new page | |
mosRedirect($url, $msg); |
$app = &JFactory::getApplication(); |
| Managing folders | |
$result = mosMakePath($base, $path, $mode); |
jimport('joomla.filesystem.folder');
|
$result = deldir($path); |
jimport('joomla.filesystem.folder');
|
| Converting an array to integers | |
mosArrayToInts($array, $default); |
JArrayHelper::toInteger($array, $default); |
| File permissions | |
$result = mosChmod($path); |
jimport('joomla.filesystem.path');
|
$result = mosChmodRecursive($path, $filemode, $dirmode); |
jimport('joomla.filesystem.path');
|
$result = mosIsChmodable($file); |
jimport('joomla.filesystem.path');
|
| Getting browser information | |
$browser = mosGetBrowser($agent); |
jimport('joomla.environment.browser');
|
$os = mosGetOS($agent); |
jimport('joomla.environment.browser');
|
| Displaying an ordering select list | |
mosGetOrderingList($sql, $chop) |
JHTML::_('list.genericordering', $sql, $chop) |
| Parsing INI formatted strings | |
$params = mosParseParams($txt) |
$registry = new JRegistry(); |
| Using Editors | |
initEditor(); |
$editor = &JFactory::getEditor(); |
getEditorContents($editorArea, $hiddenField); |
jimport('joomla.html.editor');
|
editorArea($name, $content, $hiddenField, $width, $height, $col, $row); |
jimport( 'joomla.html.editor' ); |
| Menu based authorisation | |
$allowed = mosMenuCheck($Itemid, $menu_option, $task, $gid); |
$user =& JFactory::getUser(); |
| 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 | |
josSpoofValue($alt); |
Place the following code before the end of your form:
|
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 | |
mosBackTrace($message); |
|
mosCreateMail($from, $fromname, $subject, $body); |
|
mosShowSource($filename, $withLineNums); |
|
mosLoadComponent($name); |
Handled by JDocument. |
|
|
Only ever used at the application level. Doesn't affect extensions. |
| Usage in Joomla 1.0 | Usage in Joomla 1.5 |
|---|---|
| Database table classes | |
class MyTable extends mosDBTable {
|
class MyTable extends JTable {
|
| Limits in database queries | |
$sql = 'SELECT *' |
$db = &JFactory::getDbo(); |
| Loading an object from the database | |
$db->loadObject($object); |
$object = $db->loadObject(); |
| 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 = JComponentHelper::getParams('com_foobar');
|
| 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::_('image.site', $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 |
| 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 | |
mosCache::cleanCache($group) |
$cache =& JFactory::getCache($group); |
| Usage in Joomla 1.0 | Usage in Joomla 1.5 |
|---|---|
class MyClass extends mosAbstractTasker |
class MyController extends JController |
$object = new mosEmpty; |
$object = new JObject; |
MENU_Default::MENU_Default(); |
JToolBarHelper::publishList(); |
$tabs = new mosTabs($useCookies); |
$pane = new JPaneTabs(array('useCookies' => $useCookies)); |
| 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) |
jimport('joomla.html.html.grid');
|
mosCommonHTML::CheckedOutProcessing($row, $i) |
jimport('joomla.html.html.grid');
|
| 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');?> |
| Usage in Joomla 1.0 | Usage in Joomla 1.5 |
|---|---|
mosMenuBar::startTable(); |
No longer used. |
mosMenuBar::endTable(); |
No longer used. |
mosMenuBar::addNew(); |
JToolbarHelper::addNew('new', 'New'); |
mosMenuBar::saveedit(); |
|
mosToolbar |
JToolbarHelper |
| 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); |
| 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 ); |
mosMambotHandler::call($event); |
$dispatcher =& JDispatcher::getInstance(); |
| Usage in Joomla 1.0 | Usage in Joomla 1.5 |
|---|---|
| Translation files | |
/language/english.php |
/language/en-GB/en-GB.php/language/en-GB/en-GB.com_content.php/language/en-GB/en-GB.mod_latest_news.php/language/en-GB/en-GB.plg_content_code.php |
<?php |
# Files must be saved as UTF-8 in INI format |





