Joomla! 1.5框架结构简述

        一个软件的框架结构是为软件系统的可重用性而设计的。这是对于某一特定类型软件中抽象类及其实例间合作集的一种表述。软件框架可以是一个面向对象的设计,虽然设计不一定必须是面向对象而实现的,但通常是面向对象的。一个软件框架可能以包含支持程序、代码库、脚本语言以及一些其他的软件的方式来帮助开发,或者将不同的软件项目组件融合在一起。各式各样的框架结构都可能通过API的方式被导出,以供使用。(From Wikipedia

Joomla Architecture 

Joomla! 1.5 是一个三层系统:

  • 顶层 - 为扩展层,包含对Joomla Framework和应用程序的扩展
    • Modules (模块),是对页面展示的一种轻量而灵活的扩展。有时候它可能被连接到Components ,例如"Lastest news"模块,这个模块连接到了内容组件"com_content",以显示连接到最新内容列表。模块在大多时候是作为用户可见的"box"被组织在某个组件之上(包装组件),例如,登陆模块。模块可以被分配给菜单项,例如你可以决定在某个组件(菜单项)被使用时,登陆模块的显示或隐藏。无论如何,模块是可以不被关联到任何组件的,而只是作为一个静态HTML或者文本。 模块可以被置于Module Position,Positions被定义在Joomla模版中。另外,你可以通过在前端URL的末尾添加 ?tp=1 或 &tp=1来查看你使用的模版有哪些可用的Positions。
    • Components (组件)
    • Templates (模版),有两种模版类型:前端模版和后端模版。从 template contest 下载模版
  • 中间层 - 应用程序层,包含扩展Joomla Framework JApplication class的applications,目前在Joomla的发行版中存在4个applications。
    • JInstallation 负责Joomla 在Web服务器上的安装,安装完成后被删除以完成安装过程。
    • JAdministrator 负责Joomla的后端管理。
    • JSite 负责Web站点的前端
    • XML-RPC 支持Joomla站点的远程管理
  • 底层 - 框架层,包含
    • Joomla Framework自身, whose classes are listed below.
    • Libraries ,是Framework 所必须的,或者被安装用于第三方开发人员
    • Plugins,用于扩展在 Framework 中的可用功能。Joomla! Plugin服务于多种目的,作为模块用以增强Web最终输出页面的效果,而Joomla! Plugin则可以增强数据,以及而外的可安装功能。虽然一些可能类型的插件几乎是无限的,但有一些被Joomla!使用的核心插件类型,这些类型的核心插件被组织在/plugins/目录下,他们是:
      • authentication —— allow you to authenticate (to allow you to login) against different sources.  By default you will authenticate against the Joomla! user database when you try to login.  However, there are other methods available such as by OpenID, by a Google account, LDAP, and many others.  Wherever a source has a public API, you can write an authentication plugin to verify the login credentials against this source.  For example, you could write a plugin to authenticate against Twitter accounts because they have a public API.
      • content —— modify and add features to displayed content.  For example, content plugins can cloak email address or can convert URL's into SEF format.  Content plugins can also look for markers in content and replace them with other text or HTML.  For example, the Load Module plugin will take {*loadmodule banner1*} (you would remove the *'s in practice.  They are included to actually prevent the plugin from working in this article), load all the modules in the banner1 position and replace the marker with that output.
      • editors —— allow you to add new content editors (usually WYSIYWG).
      • editors-xtd —— allow you to add additional buttons to the editors.  For example, the Image, Pagebreak and Read more buttons below the default editor are actually plugins.
      • search —— allow you to search different content from different components.  For example, search plugins for Articles, Contacts and Weblinks are already provided in Joomla!.
      • system —— allow you to perform actions at various points in the execution of the PHP code that runs a Joomla! Web site.
      • user —— allow you to perform actions at different times with respect to users.  Such times include logging in and out and also saving a user.  User plugins are typically user to "bridge" between web applications (such as creating a Joomla! to phpBB bridge).
      • xmlrpc —— allow you to provide additional XML-RPC web services for your site.  When your Web site exposes web services, it gives you the ability to interact remotely, possibly from a desktop application.  Web services are a fairly advanced topic and will not be covered in much detail here.

Packages and Classes


在Joomla! Framework 中的classes 被松耦合地组合在了几个不同的packages中。
See online Joomla! 1.5 API Reference

  1. JFactory  --  定义在 /libraries/joomla/factory.php 中
    提供一中简单的方法,以组织管理被Joomla Framework请求访问的单例对象。需要说明的是该类是全局可用的,即不需要明确import到你的代码中。
    Method nameDescription
    getACL返回一个全局JAuthorisation对象引用,仅在其不存在时被创建。
    getApplication返回一个全局JApplication对象引用,仅在其不存在时被创建。
    getCache返回一个全局JCache对象引用,仅在其不存在时被创建。
    getConfig返回一个全局JRegistry对象引用,仅在其不存在时被创建。JRegistry中的data包含一些配置信息,通过stdClass实现。
    getDate返回一个全局JDate对象引用,仅在其不存在时被创建。
    getDBO返回一个全局JDatebase对象引用,仅在其不存在时被创建。
    getDocument返回一个全局JDocument对象引用,仅在其不存在时被创建。
    getEditor返回一个全局JEditor对象引用,仅在其不存在时被创建。
    getLanguage返回一个全局JLanguage对象引用,仅在其不存在时被创建。
    getMailer返回一个全局JMailer对象引用,仅在其不存在时被创建。
    getSession返回一个全局JSession对象引用,仅在其不存在时被创建。
    getTemplate

    在Joomla 1.5.x中弃用;从Joomla 1.6 以后给移除。

    返回一个全局JTemplate对象引用,仅在其不存在时被创建。patTemplate模版系统已不再使用。

    getURI返回一个全局JURI对象引用,仅在其不存在时被创建。
    getUser返回一个全局JUser对象引用,仅在其不存在时被创建。
    getXMLParser返回一个全局XML Parser对象引用,仅在其不存在时被创建。不同的解析器是可用的。
  2. JText  -- 定义在 /libraries/joomla/methods.php 中
    JText是一个文本处理类,它允许开发人员在源代码中指定文本片断,而在运行时被翻译成当前网站所使用的语言。
    Method nameDescription
    _翻译字符转到当前语言
    printf翻译字符转到当前语言,并传递给 printf 函数.
    sprintf翻译字符转到当前语言,并传递给  sprintf 函数.
  3. JApplication --  定义在 /joomla/application/application.php 中
    JApplication是Joomla应用的基类,对特定应用程序起着工厂类的作用,并提供了许多支持API方法。继承自它的子类都应实现route(),dispatch() 和render() 三个方法。
    Method nameDescription
    __construct构造器
    addCustomHeadTag废弃方法, 使用 JDocument->addCustomTag 替代(仅当文档类型为HTML时).
    addMetaTag废弃方法, 使用 JDocument->setMetaData 替代.
    appendMetaTag废弃方法, 使用 JDocument->setMetaData 替代.
    appendPathWay废弃方法, 使用  JPathWay->addItem() 替代.
    close退出应用程序.
    dispatch分配应用程序请求到相应组件.
    enqueueMessage入队系消息队列.
    getBasePath废弃方法, 使用 JURI::base() 替代.
    getBlogCategoryCount废弃方法.
    getBlogSectionCount废弃方法.
    getCfg获得configuration.php中的配置值.
    getClientId获得当前运行application的client id.
    getContentItemLinkCount废弃方法.
    getCustomPathWay弃方法, 使用 JPathway->getPathWayNames() 替代.
    getGlobalBlogSectionCount废弃方法.
    getHead废弃方法, 使用 JDocument->get( 'head' ) 替代.
    getInstance返回一个全局JApplication对象引用,仅在其不存在时被创建。
    getItemid废弃方法, 使用 ContentHelper::getItemid 替代.
    getMenu返回应用的JMenu对象的引用.
    getMessageQueue获得系统消息队列.
    getName获得应用名称
    getPageTitle废弃方法, 使用 JDocument::getTitle 替代.
    getPath废弃方法, 使用 JApplicationHelper::getPath 替代.
    getPathway返回应用的 JPathway 对象引用.
    getRouter返回应用的 JRouter 对象引用.
    getStaticContentCount废弃方法.
    getTemplate获得当前模版名称.
    getUser废弃方法, 使用 JFactory::getUser 替代.
    getUserState获得User状态.
    getUserStateFromRequestGets the value of a user state variable.
    initialise初始化Application.
    isAdminIs admin interface?
    isSiteIs site interface?
    loginLogin authentication function.
    logoutLogout authentication function.
    prependMetaTag废弃方法, 使用 JDocument->setMetaData 替代
    redirect重定向到其他的 URL.
    registerEvent注册一个handler 到特定 event group.
    render渲染应用程序。该过程为,首先将 document 缓存传递给 template 置换处理器(placeholders),而后从 document 缓存中获取数据,再将数据放JResponse 的缓存中(buffer)。
    route确定应用线路。该过程为,首先检测请求环境,以确定哪个组件(component)应该接收当前请求。接着,当应用即将被分派时,该组件的可选参数将被设置在当前请求对象中。
    setPageTitle废弃方法, 使用 JDocument::setTitle 替代.
    setUserStateSets the value of a user state variable.
    triggerEvent调用特定event group中关联的所有 handlers.
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值