Actions

API16

JInstallerPlugin/discover

From Joomla! Documentation

< API16:JInstallerPlugin
Revision as of 21:02, 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

[<! removed edit link to red link >]

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

Syntax

discover()


Returns

array(JExtension) list of extensions available

Defined in

libraries/joomla/installer/adapters/plugin.php

Importing

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

Source Body

function discover()
{
        $results = Array();
        $folder_list = JFolder::folders(JPATH_SITE.DS.'plugins');
 
        foreach ($folder_list as $folder)
        {
                $file_list = JFolder::files(JPATH_SITE.DS.'plugins'.DS.$folder,'\.xml$');
                foreach ($file_list as $file)
                {
                        $file = JFile::stripExt($file);
                        if ($file == 'example') continue; // ignore example plugins
                        $extension = &JTable::getInstance('extension');
                        $extension->set('type', 'plugin');
                        $extension->set('client_id', 0);
                        $extension->set('element', $file);
                        $extension->set('folder', $folder);
                        $extension->set('name', $file);
                        $extension->set('state', -1);
                        $results[] = $extension;
                }
                $folder_list = JFolder::folders(JPATH_SITE.DS.'plugins'.DS.$folder);
                foreach ($folder_list as $plugin_folder)
                {
                        $file_list = JFolder::files(JPATH_SITE.DS.'plugins'.DS.$folder.DS.$plugin_folder,'\.xml$');
                        foreach ($file_list as $file)
                        {
                                $file = JFile::stripExt($file);
                                if ($file == 'example') continue; // ignore example plugins
                                $extension = &JTable::getInstance('extension');
                                $extension->set('type', 'plugin');
                                $extension->set('client_id', 0);
                                $extension->set('element', $file);
                                $extension->set('folder', $folder);
                                $extension->set('name', $file);
                                $extension->set('state', -1);
                                $results[] = $extension;
                        }
                }
        }
        return $results;
}

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

Examples

<CodeExamplesForm />