Book Image

Mastering Joomla! 1.5 Extension and Framework Development Second Edition

Book Image

Mastering Joomla! 1.5 Extension and Framework Development Second Edition

Overview of this book

Joomla! is one of the world’s top open source content management systems, which enables you to build websites and powerful online applications. Out of the box, Joomla! does a great job of managing the content needed to enhance the functionality of your website. But for many people, the true power of Joomla! lies in its application framework that makes it possible for thousands of developers around the world to create powerful add-ons and extensions. This book will guide you through the complexities of implementing add-ons, components, modules, and plugins in Joomla! 1.5. If you feel that you’ve mastered the basics of creating Joomla! extensions, then this book will take you to the next level. Packed with expert advice on all aspects of programming with Joomla!, this book is an invaluable reference guide you will turn to again and again for your Joomla! development tasks. The book starts by explaining the structure and design of the Joomla! Framework. Then we move on to extending and storing data in standard fields and dealing with multilingual requirements. Further, you will discover best practices, design, and coding methods for Joomla! components, modules, plugins, and other extensions. Along the way, you will actually design and create a component, module, and plugin that work together to add functionality to the Joomla! framework. You will also learn about customizing the page output using JavaScript effects, making use of Web Services from within Joomla! and ensuring that your code is secure and error-free. You will discover how to easily create sophisticated extensions that are robust, user-friendly, and professional by taking advantage of the many libraries and utilities provided by the Joomla! framework. A comprehensive, up-to-date reference to the Joomla! Framework API is also included in the book. Finally, we will discuss advanced methods for rendering your extensions more robust, secure, and professional.
Table of Contents (18 chapters)
Mastering Joomla! 1.5 Extension and Framework Development
Credits
About the Author
About the Reviewer
Preface

Joomla! 1.5 Framework


A software framework is a reusable design for a software system (or subsystem). This is expressed as a set of abstract classes and the way their instances collaborate for a specific type of software. Software frameworks can be object-oriented designs. Although designs do not have to be implemented in an object-oriented language, they usually are. A software framework may include support programs, code libraries, a scripting language, or other software to help develop and glue together the different components of a software project. Various parts of the framework may be exposed through an application programming interface (API).

From http://docs.joomla.org/Framework

Joomla! 1.5 is implemented on a software framework that provides far greater flexibility, security, and extensibility than ever before. The Joomla! 1.5 framework is comprised of three layers or tiers. The Framework layer provides the core functionality upon which the upper layers depend, the Application layer contains applications that extend the core framework functionality, and the Extension layer adds specific functionality to the basic system.

Framework layer

The Framework layer provides core functionality through an extensive set of libraries, plugins, and the Joomla! framework.

Libraries

Many, but not all, of the libraries provide Joomla! with required functionality that was originally developed and distributed by third-parties for general use, not specifically for Joomla!.

The following table details the base libraries that are included in Joomla!:

Library

Description

License

archive

TAR file management class (www.phpconcept.net)

PHP License 3

bitfolge

Feed and vCard utilities (www.bitfolge.de)

GNU LGPL

domit

DOM (Document Object Model) XML Parser (www.phpclasses.org/browse/package/1468.html)

GNU LGPL

geshi

Generic Syntax Highlighter (qbnz.com/highlighter)

GNU GPL

joomla

Core Joomla! library

GNU GPL

openid

Remote login management (www.openidenabled.com)

GNU LGPL

pattemplate

Template handling (www.php-tools.net)

GNU LGPL

pcl

Archive handling (www.phpconcept.net)

GNU GPL

pear

PHP Extension and Application Repository (pear.php.net)

Mixed

phpgacl

Generic Access Control (phpgacl.sourceforge.net)

GNU LGPL

phpinputfilter

Filter out unwanted PHP / Javascript / HTML tags (www.phpclasses.org/browse/package/2189.html)

GNU GPL

phpmailer

Class for sending email using either sendmail, PHP mail(), or SMTP (phpmailer.sourceforge.net)

GNU LGPL

phputf8

UTF8 and ASCII tools (phputf8.sourceforge.net)

Mixed

phpxmlrpc

XML-RPC protocol (phpxmlrpc.sourceforge.net)

Special

simplepie

RSS and Atom reader (simplepie.org)

GNU LGPL

tcpdf

PDF generator that does not require additional libraries (tcpdf.sourceforge.net)

GNU LGPL

Framework

The framework consists of a comprehensive set of classes that provide core functionality. A list of many of the Joomla! classes can be found in the Appendices or you can browse the Joomla! Framework at http://api.joomla.org. Classes that make up the framework are loosely grouped into packages for easier classification and identification.

The packages that make up the framework are listed in the following table:

Package

Description

Application

JApplication and related classes

Base

Base classes

Cache

Cache classes

Client

FTP and LDAP classes

Database

JDatabase and related classes

Document

Classes for creating and rendering pages

Environment

URI, Request/Response handling, and browser classes

Error

Error handling, logging, and profiling classes

Event

Dispatch and Event classes

Filesystem

Classes supporting file access

Filter

Input and output filter classes

HTML

Classes for rendering HTML

Installer

Classes for installing extensions

Language

Language translation classes

Mail

e-mail related classes

Plugin

Core Plugin classes

Registry

Configuration classes

Session

User session handler and storage of session data classes

User

Site user classes

Utilities

Miscellaneous classes

In addition to the packages, the framework includes the core JFactory and JVersion classes.

Plugins

Plugins extend the functionality of the framework. Joomla! comes with eight core groups of plugins, each designed to handle a specific set of events.

The following table describes the different core plugin types:

Plugin Type

Description

authentication

Authenticate users during the login process

content

Process content items before they are displayed

editors

WYSIWYG editors that can be used to edit content

editors-xtd

Editor extensions (normally additional editor buttons)

search

Search data when using the search component

system

System event listeners

user

Process a user when actions are performed

xmlrpc

Create XML-RPC responses

In addition to the core plugin types, we can define our own types. Many components use their own plugins for dealing with their own events. Plugins will be discussed in detail in Chapter 7, Plugin Design.

Application layer

The Application layer extends the core JApplication class with applications designed for managing and performing specific tasks.

The JInstallation application runs when you install Joomla!. After successfully installing Joomla!, you are required to remove the installation folder, which contains the JInstallation application, before proceeding. The installation of extensions (components, modules, plugins, templates, and languages) is accomplished using the install functionality of the JAdministrator application.

The application for the Joomla! Administrator is JAdministrator. This application directs all of the backend administrative functions.

The application that is responsible for composing and delivering the frontend pages is JSite.

A Joomla! website can be administered remotely by using the XML-RPC application.

Extension layer

The Extension layer extends the Joomla! framework and applications, specifically with components, modules, templates, and languages. Plugins are also extensions but are placed in the Framework layer because they extend the framework, not applications. Joomla! is installed with a set of extensions including components for both the frontend and backend applications, templates, and modules.