| [ Index ] |
PHP Cross Reference of Joomla 2.5.4 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Joomla.Platform 4 * @subpackage Form 5 * 6 * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. 7 * @license GNU General Public License version 2 or later; see LICENSE 8 */ 9 10 defined('JPATH_PLATFORM') or die; 11 12 JFormHelper::loadFieldClass('list'); 13 14 /** 15 * Form Field class for the Joomla Framework. 16 * 17 * @package Joomla.Platform 18 * @subpackage Form 19 * @since 11.4 20 */ 21 class JFormFieldPlugins extends JFormFieldList 22 { 23 /** 24 * The field type. 25 * 26 * @var string 27 * @since 11.4 28 */ 29 protected $type = 'Plugins'; 30 31 /** 32 * Method to get a list of options for a list input. 33 * 34 * @return array An array of JHtml options. 35 * 36 * @since 11.4 37 */ 38 protected function getOptions() 39 { 40 // Initialise variables 41 $folder = $this->element['folder']; 42 43 if (!empty($folder)) 44 { 45 // Get list of plugins 46 $db = JFactory::getDbo(); 47 $query = $db->getQuery(true); 48 $query->select('element AS value, name AS text'); 49 $query->from('#__extensions'); 50 $query->where('folder = ' . $db->q($folder)); 51 $query->where('enabled = 1'); 52 $query->order('ordering, name'); 53 $db->setQuery($query); 54 55 $options = $db->loadObjectList(); 56 57 $lang = JFactory::getLanguage(); 58 foreach ($options as $i => $item) 59 { 60 $source = JPATH_PLUGINS . '/' . $folder . '/' . $item->value; 61 $extension = 'plg_' . $folder . '_' . $item->value; 62 $lang->load($extension . '.sys', JPATH_ADMINISTRATOR, null, false, false) 63 || $lang->load($extension . '.sys', $source, null, false, false) 64 || $lang->load($extension . '.sys', JPATH_ADMINISTRATOR, $lang->getDefault(), false, false) 65 || $lang->load($extension . '.sys', $source, $lang->getDefault(), false, false); 66 $options[$i]->text = JText::_($item->text); 67 } 68 69 if ($db->getErrorMsg()) 70 { 71 JError::raiseWarning(500, JText::_('JFRAMEWORK_FORM_FIELDS_PLUGINS_ERROR_FOLDER_EMPTY')); 72 return ''; 73 } 74 75 } 76 else 77 { 78 JError::raiseWarning(500, JText::_('JFRAMEWORK_FORM_FIELDS_PLUGINS_ERROR_FOLDER_EMPTY')); 79 } 80 81 // Merge any additional options in the XML definition. 82 $options = array_merge(parent::getOptions(), $options); 83 84 return $options; 85 } 86 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Tue Apr 3 11:40:28 2012 | Cross-referenced by PHPXref 0.7.1 |