JApplicationHelper/ja

出典: Joomla! ドキュメンテーション

[[Category:

Articles actively undergoing construction]] JApplicationHelper is a class which provides helper functions for using JApplication. JApplicationHelper has functions to help you get client information, paths, and parse XML files into associative arrays.

目次

Defined in

/joomla/application/helper.php

Methods

In the following examples and text, "Site" refers to the front-end of Joomla and "Admin" refers to the Administrator/back-end area.

getClientInfo

Gets information on a specific client id. This method will be useful in future versions when we start mapping applications in the database.

Function Definition

function &getClientInfo( $id = null , $byName = false )


Param: $id
$id does not refer to a user id or number. It is an id/identifier of which client info we want to return. Calling this method without any params will return the following:
array(4) {
  [0]=>
    object(stdClass)#3 (3) {
      ["id"]=>   int(0)
      ["name"]=> string(4) "site"
      ["path"]=> string(11) "<root directory>"
  }
  [1]=>
    object(stdClass)#4 (3) {
      ["id"]=>   int(1)
      ["name"]=> string(13) "administrator"
      ["path"]=> string(25) "<root directory>/administrator"
  }
  [2]=>
    object(stdClass)#5 (3) {
      ["id"]=>   int(2)
      ["name"]=> string(12) "installation"
      ["path"]=> string(24) "<root directory>/installation"
  }
  [3]=>
    object(stdClass)#6 (3) {
    ["id"]=>   int(3)
    ["name"]=> string(6) "xmlrpc"
    ["path"]=> string(18) "<root directory>/xmlrpc"
  }
}


Param: $byName


Returns: $null
mixed: $null, the object describing the client or false if not known


getPath

This function returns a path to a specific file on the site.


Function Definition

function getPath( $varname , $user_option = null )


Param: $varname
$varname tells Joomla where you want to look in this component
Note: If no $user_option is specified, $user_option will default to "com_<component name>", "mod_<module name>", or <plugin name> depending on if you are using this method from a component, module, or plugin.
  • front: returns the path to the component's front end (Site)
    • Scope: Site Only
$result = "root / components / $user_option / <component name>.php "
  • html:
  • front_html:
    • Scope: Site Only
  • toolbar:
    • Scope: Admin Only
root / administrator / components / $user_option / toolbar.<component name>.php
  • toolbar_html:
    • Scope: Admin Only
root / administrator / components / $user_option / toolbar.<component name>.html.php
  • toolbar_default:
  • toolbar_front:
    • Scope: Site Only
root / includes / HTML_toolbar.php
  • admin: returns the path to the component's main admin html file
    • Scope: Admin Only
root / administrator / components / $user_option / admin.<component name>.php
  • admin_html: returns the path to the component's main admin html file
    • Scope: Admin Only
root / administrator / components / $user_option / admin.<component name>.html.php
  • admin_functions:
    • Scope: Admin Only
root / administrator / components / $user_option / <component name>.functions.php
  • class:
    • Scope: Site, then Admin ( if not found in Site, add /administrator after root )
root / components / $user_option / <component name>.class.php
  • helper:
    • Scope: Site, then Admin ( if not found in Site, add /administrator after root )
root / components / $user_option / <component name>.helper.php
  • com_xml:
    • Scope: Site, then Admin ( if not found in Site, add /administrator after root )
root / components / $user_option / <component name>.xml
  • mod0_xml:
    • Scope: Site, then Admin ( if not found in Site, add /administrator after root )
    • Special Notes: Must specify $user_option = "mod_<module name>"
root / modules / $user_option / mod_<component name>.xml
  • mod1_xml:
    • Scope: Admin Only
    • Special Notes: Must specify $user_option = "mod_<module name>"
root / administrator / modules / $user_option / $user_option.xml
  • bot_xml: ( Legacy code )
  • plg_xml:
    • Scope: Site Only
    • Special Notes: Must specify $user_option = "<plugin name>"
root / plugins / $user_option.xml
  • menu_xml:
    • Scope: Admin Only
    • Special Notes: Must specify $user_option = "<plugin name>"
$result = "root / administrator / components / com_menus / $user_option / $user_option.xml "


Param: $user_option
$user_option tells Joomla which other component you want to look for $varname in
Example - from any component, front-end or back-end, the following code:
 echo JApplicationHelper::getPath( 'admin' , 'com_contact' );
will echo the following to screen:
root /administrator/components/com_contact/admin.contact.php


Returns: $result
string: $result, the requested path or null if the file/path could not be found


parseXMLInstallFile

Parses an XML Install File.


Function Definition

function parseXMLInstallFile( $path )


Param: $path


Method Returns


parseXMLLangMetaFile

Parses an XML Language File.


Function Definition

function parseXMLLangMetaFile( $path )


Param: $path


Method Returns


See Also