[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/libraries/joomla/form/fields/ -> editors.php (source)

   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 Platform.
  16   * Provides a list of installed editors.
  17   *
  18   * @package     Joomla.Platform
  19   * @subpackage  Form
  20   * @see         JFormFieldEditor
  21   * @since       11.1
  22   * @deprecated  21.1 Use JFormFieldPlugins instead (with folder="editors")
  23   */
  24  class JFormFieldEditors extends JFormFieldList
  25  {
  26      /**
  27       * The form field type.
  28       *
  29       * @var    string
  30       * @since  11.1
  31       */
  32      public $type = 'Editors';
  33  
  34      /**
  35       * Method to get the field options for the list of installed editors.
  36       *
  37       * @return  array  The field option objects.
  38       *
  39       * @since   11.1
  40       */
  41  	protected function getOptions()
  42      {
  43          JLog::add('JFormFieldEditors is deprecated. Use JFormFieldPlugins instead (with folder="editors").', JLog::WARNING, 'deprecated');
  44  
  45          // Get the database object and a new query object.
  46          $db = JFactory::getDBO();
  47          $query = $db->getQuery(true);
  48  
  49          // Build the query.
  50          $query->select('element AS value, name AS text');
  51          $query->from('#__extensions');
  52          $query->where('folder = ' . $db->quote('editors'));
  53          $query->where('enabled = 1');
  54          $query->order('ordering, name');
  55  
  56          // Set the query and load the options.
  57          $db->setQuery($query);
  58          $options = $db->loadObjectList();
  59          $lang = JFactory::getLanguage();
  60          foreach ($options as $i => $option)
  61          {
  62              $lang->load('plg_editors_' . $option->value, JPATH_ADMINISTRATOR, null, false, false)
  63                  || $lang->load('plg_editors_' . $option->value, JPATH_PLUGINS . '/editors/' . $option->value, null, false, false)
  64                  || $lang->load('plg_editors_' . $option->value, JPATH_ADMINISTRATOR, $lang->getDefault(), false, false)
  65                  || $lang->load('plg_editors_' . $option->value, JPATH_PLUGINS . '/editors/' . $option->value, $lang->getDefault(), false, false);
  66              $options[$i]->text = JText::_($option->text);
  67          }
  68  
  69          // Check for a database error.
  70          if ($db->getErrorNum())
  71          {
  72              JError::raiseWarning(500, $db->getErrorMsg());
  73          }
  74  
  75          // Merge any additional options in the XML definition.
  76          $options = array_merge(parent::getOptions(), $options);
  77  
  78          return $options;
  79      }
  80  }


Generated: Tue Apr 3 11:40:28 2012 Cross-referenced by PHPXref 0.7.1