JAB12 - Changes in the API are Blowin' in the Wind
Upcoming SlideShare
Loading in...5

JAB12 - Changes in the API are Blowin' in the Wind



Session from J & Beyond 2012 concerning changes in the Joomla Platform affecting the CMS as the transition is made from 2.5 to 3.0.

Session from J & Beyond 2012 concerning changes in the Joomla Platform affecting the CMS as the transition is made from 2.5 to 3.0.



Total Views
Views on SlideShare
Embed Views



7 Embeds 479

http://www.babdev.com 430
http://jandbeyond.org 43
http://elearning.fatinafar.com 2
http://elearning.tadelformacion.com 1
https://twimg0-a.akamaihd.net 1
http://www.linkedin.com 1
http://local-babdev.com 1



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • First, to give an idea in numbers about how active development has been on the Platform, here’s some stats about the changes in Platform 12.1. Almost 1,000 commits were made to the Platform in the 342 pull requests submitted by 51 different contributors. Including the Platform documentation and test suite, over 96,000 lines were modified over the course of the last four months.\n
  • - Support for PHP 5.2 has been dropped as it is a EOL product. To get around a bug with our language handling and PHP 5.3.0, 5.3.1 is our minimum version requirement at this time.\n\n- To migrate from the legacy error handling, much work has gone into converting the use of JError and JDatabase’s error handling logic to using PHP Exceptions.\n\n- The MooTools compatibility layer which enabled backwards compatibility to MooTools 1.2 has been removed. Scripts should be updated to be compatible with MooTools 1.4.\n\n- Many classes that extended JObject no longer do so. A full list is available on docs.joomla.org in the “Potential B/C issues in J! 3.0” article.\n\n- In the CMS, the DS constant has been removed. PHP is able to handle the mixed use of slashes without issue. If for some reason you really need it, you can use PHP's DIRECTORY_SEPARATOR constant.\n\n\n
  • \n
  • - Support for extension manifests with the base tag has been removed. Since 1.6, extensions should be using as their base tag, except for language packs which use .\n\n- Automatic loading of non-MVC style files such as admin.content.html.php has been removed. Extensions wishing to continue using these style files will need to load them on their own. Best practice would be to refactor your extension to use the MVC structure.\n\n- Support for the pre-1.6 file structure for plugins has been removed. All plugins must now be in separate folders within their plugin types.\n\n- Legacy support for modules named without the mod_ prefix has been removed. This is holdover from J! 1.0.\n\n- Support for com_install and com_install, and the associated install_script and uninstall_script tags in extension manifests, has been removed. Extensions should instead use a script file. All extension types except for language, library, and templates support these classes.\n\n- Support for client=both in the tag of language packs has been removed. Those distributing language packs should specify the client (site or administrator) and install the packs for each client separately. Best practice for distributing language packs for both applications would be to use a package extension.\n
  • Within JFactory, the getXMLParser and _create** methods have been removed. getXMLParser is replaced by getFeedParser, and the _create** methods are replaced by non-underscored methods. Lastly, support for the no_html parameter, which was used in JFactory::getDocument, has been removed, and the method now returns only a JDocumentHtml instance.\n
  • JAccess’ getActions method has been deprecated. Replacing it are two new methods, getActionsFromFile and getActionsFromData. The file method attempts to load the data from a specified file, while the data method works directly with a SimpleXMLElement instance.\n
  • The Application package (referring to what is now considered legacy) has been cleaned up a bit to remove code dealing with CMS 1.0 and 1.5 conventions.\n\nIn JApplicationHelper, the methods dealing with loading files using older naming conventions (i.e. admin.content.html.php and toolbar.content.php) have been completely removed.\n\nIn JController, the setAccessControl method which dealt with the CMS 1.5 ACL has been removed as well as the authorize (with a z) method. The latter is replaced by the authorise (with a s) method, though this too is now deprecated and set to be removed soon.\n
  • In addition to the database package having been refactored (more on that later), several deprecated methods have been removed. On the screen are just a few of those methods and listed next to them are their replacement methods. In addition to these methods, also removed are the addQuoted, hasUTF, explain, isQuoted, and queryBatch methods. Right now, the getErrorNum, getErrorMsg, and stderr methods remain in the legacy JDatabase class, but these are deprecated in favor of catching the RuntimeExceptions that are thrown.\n
  • Several methods have been removed from the HTML package. The JHtmlBehavior::framework() method replaces JHtml::core() and JHtmlBehavior::mootools(). In JHtmlGrid, the access method which was coupled into CMS 1.5 ACL has been removed.\n\nIn JHtmlList, the access, category, and specificordering methods have been removed. The first is replaced by JHtmlAccess::assetgrouplist(), the category method is replaced by JHtmlCategory, and specificordering by the ordering method in the same class.\n
  • In the Log package, the addEntry and getInstance methods have been removed. In place of the getInstance method, users should create their log using the addLogger method. Entries should be written using JLog’s add method.\n
  • JUtility itself earned its own slide since all methods but one were removed from the class. The only two without replacements are array_unshift_ref and dump. The getHash and isWinOS methods are now in the JApplication legacy class, sendMail and sendAdminMail are now handled by JMail, getToken is now handled by JSession, and return_bytes is handled by JHtmlNumber::bytes().\n
  • Here’s some of the other methods in the Utilities package that were removed.\n\nIn JDate, the setOffset method, which dealt with setting timezones for CMS 1.5, has been removed in favor of setTimezone. The toFormat method has been replaced by format. Lastly, the toMySQL method has been replaced by toSql as an improved method for formatting timestamps for the various databases.\n\nJXmlElement itself has now been deprecated and is slotted for removal with Platform 13.3. Users should now access data directly from SimpleXMLElement instead. Aside from this deprecation, the previously deprecated data and getAttribute methods have both been removed without an API replacement.\n
  • The legacy tree is a tree of classes that are ready to be retired from the Platform. Located at libraries/legacy, this tree is a collection of classes that are either CMS specific (such as JHelp) or are legacy in nature (such as the previously deprecated JError and JRequest classes). This tree exists to help the CMS transition to Platform 12 by making these classes available to developers still, but their use is discouraged in many cases as these classes will go away with a future CMS and Platform version (note that CMS classes will eventually be moved to libraries/cms).\n
  • Platform 12 has brought about some great new features that the CMS will be able to take advantage of in the 3.x series, with the biggest one being new MVC structure.\n\nThe stemmer classes used with the Smart Search component have been ported into the Language package on the platform.\n\nThe autoloader has been vastly improved upon in Platform 12. It allows other libraries to register their prefix, enabling the libraries to be autoloaded instead of using require statements. Multiple paths can also be assigned to a single prefix (i.e. the J prefix assigned to libraries/cms, joomla, and legacy).\n\nA new class has been added to the Filesystem package that allows users to work with DIFFs between files.\n\nA replacement for JSimpleCrypt has been added in the form of the Crypt package. It offers improved encryption and decryption support to the Platform and offers four “ciphers” at the moment.\n\nIn JDocument, basic support for checking for HTML5 has been added. Downstream users can set the HTML5 state when using a JDocumentHtml instance, which enables template developers to set the HTML5 state and extension developers to better create output supporting their environment.\n\nIn JDatabaseQuery, support has been added for the UNION element. This allows users to build queries using UNION or UNION DISTINCT.\n
  • During Platform 12.1 development, the database package underwent a heavy review and refactor. The end result is that three new database drivers were added and the class structure was reorganized to add flexibility and be proactive for future development. All of the legacy JDatabase child classes will still be present through CMS 3.x to allow for backwards compatibility during the transition.\n\nAlong with the refactor, several new features are added to the package. Through the new JDatabaseIterator, support is present for PHP’s Countable and Iterator interfaces. As well is a new JDatabaseFactory with support for retrieving the child objects for any of the database drivers (importer, exporter, iterator).\n\nThe drivers now use a lazy connection method. The API checks to ensure a connection is not already established before doing so and properly disconnects upon completion. Also supported is the drivers attempting to reconnect to servers which have had their connections dropped.\n\nThanks to Gabrielle, who’s gone to great lengths to get the PostgreSQL driver added to the Platform, there is now partial support for sub-queries in the database package. Currently, it is only supported by the INSERT and FROM elements.\n
  • \n
  • \n

JAB12 - Changes in the API are Blowin' in the Wind JAB12 - Changes in the API are Blowin' in the Wind Presentation Transcript

  • Changes in the API are Blowin in the Wind Michael Babker BabDev.com
  • Who Am I?• Joomla! Junkie• Soldier in US Army• College Grad• Loves to Travel
  • Looking Forward• Retired Code - What’s been removed?• Ready to Retire - The legacy classes• Rookie Code - New Features
  • Some Stats• Platform 12.1 • 995 commits in 342 Pull Requests • 51 Contributors • 96,000+ lines edited
  • General Changes• Minimum PHP Version - 5.3.1• Conversion from JError and $db->getError to Exceptions• MooTools 1.2 compatibility dropped• Broken dependency on JObject• CMS - DS constant removed
  • Retired Code - Classes• JParameter• JElement• JHtmlImage• JPane• JSimpleXML
  • Retired Code - Extension Installation & Structure• <install> extension • Modules without manifests mod_ prefix• Non-MVC structure • com_install and component files (i.e. com_uninstall admin.content.php) • Support for• 1.5 file structure client=both in (plugins/system/ language extensions sef.php)
  • Retired Code - Methods: JFactory• getXMLParser• _create** methods• Support for no_html URL parameter
  • Retired Code - Methods: Access Package• JAccess::getActions deprecated• Replaced by: • getActionsFromFile • getActionsFromData
  • Retired Code - Methods: Application Package (Legacy)• JApplicationHelper • getPath • _checkPath• JController • authorize • setAccessControl
  • Retired Code - Methods: Database PackageDeprecated Method Replacement• debug • setDebug• getEscaped • escape• getTableFields • getTableColumns• getTicker • getCount• loadResultArray • loadColumn• nameQuote (nq) • quoteName (qn)
  • Retired Code - Methods: HTML Package• JHtml • JHtmlList • core • access• JHtmlBehavior • category • mootools • specificordering• JHtmlGrid • access
  • Retired Code - Methods: Log Package• JLog • addEntry • getInstance
  • Retired Code - Methods: JUtility• array_unshift_ref • sendMail• dump • sendAdminMail• getHash• getToken• isWinOS• return_bytes
  • Retired Code - Methods: Utilities Package• JDate • JXmlElement • setOffset • data • toFormat • getAttribute • toMySQL
  • Ready to Retire - Legacy• Located at libraries/legacy• Collection of CMS specific and legacy classes• Eases transition during CMS 3.x• Includes legacy MVC, package specific exceptions, JTableContent, and many CMS specific form fields and HTML helpers
  • Rookie Code - New Features• MVC structure • Crypt Package• JLanguageStemmer • Basic HTML5 support in• JDocumentImage JDocument• Improved • DB Union autoloader• JFilesystemPatcher
  • Refactored Database Package• Legacy JDatabase • New deprecated JDatabaseFactory• New base is • Lazy connection JDatabaseDriver handling• Countable and • Partial sub-query Iterator support support• Three new drivers
  • And Much, Much, More...
  • Questions?• Contact• Web: http://www.babdev.com• Twitter: @mbabker• GitHub: https://github.com/mbabker