Actions

API16

JInstallerComponent/discover

From Joomla! Documentation

< API16:JInstallerComponent
Revision as of 17:45, 22 March 2010 by Doxiki (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.

[Edit Descripton]

Description:JInstallerComponent/discover

Contents

Syntax

discover()


Defined in

libraries/joomla/installer/adapters/component.php

Importing

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

Source Body

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

[Edit See Also] SeeAlso:JInstallerComponent/discover

Examples

<CodeExamplesForm />