Actions

API16

JInstallerLanguage/discover

From Joomla! Documentation

< API16:JInstallerLanguage
Revision as of 22:01, 13 May 2013 by JoomlaWikiBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Custom discover method Finds language files

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

discover()


Defined in

libraries/joomla/installer/adapters/language.php

Importing

jimport( 'joomla.installer.adapters.language' );

Source Body

public function discover()
{
        $results = Array();
        $site_languages = JFolder::folders(JPATH_SITE.DS.'language');
        $admin_languages = JFolder::folders(JPATH_ADMINISTRATOR.DS.'language');
        foreach ($site_languages as $language)
        {
                if (file_exists(JPATH_SITE.DS.'language'.DS.$language.DS.$language.'.xml'))
                {
                        $extension = &JTable::getInstance('extension');
                        $extension->set('type', 'language');
                        $extension->set('client_id', 0);
                        $extension->set('element', $language);
                        $extension->set('name', $language);
                        $extension->set('state', -1);
                        $results[] = $extension;
                }
        }
        foreach ($admin_languages as $language)
        {
                if (file_exists(JPATH_ADMINISTRATOR.DS.'language'.DS.$language.DS.$language.'.xml'))
                {
                        $extension = &JTable::getInstance('extension');
                        $extension->set('type', 'language');
                        $extension->set('client_id', 1);
                        $extension->set('element', $language);
                        $extension->set('name', $language);
                        $extension->set('state', -1);
                        $results[] = $extension;
                }
        }
        return $results;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />