[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/administrator/components/com_plugins/helpers/ -> plugins.php (source)

   1  <?php
   2  /**
   3   * @copyright    Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
   4   * @license        GNU General Public License version 2 or later; see LICENSE.txt
   5   */
   6  
   7  // No direct access.
   8  defined('_JEXEC') or die;
   9  
  10  /**
  11   * Plugins component helper.
  12   *
  13   * @package        Joomla.Administrator
  14   * @subpackage    com_plugins
  15   * @since        1.6
  16   */
  17  class PluginsHelper
  18  {
  19      public static $extension = 'com_plugins';
  20  
  21      /**
  22       * Configure the Linkbar.
  23       *
  24       * @param    string    The name of the active view.
  25       */
  26  	public static function addSubmenu($vName)
  27      {
  28          // No submenu for this component.
  29      }
  30  
  31      /**
  32       * Gets a list of the actions that can be performed.
  33       *
  34       * @return    JObject
  35       */
  36  	public static function getActions()
  37      {
  38          $user        = JFactory::getUser();
  39          $result        = new JObject;
  40          $assetName    = 'com_plugins';
  41  
  42          $actions = array(
  43              'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'
  44          );
  45  
  46          foreach ($actions as $action) {
  47              $result->set($action,    $user->authorise($action, $assetName));
  48          }
  49  
  50          return $result;
  51      }
  52  
  53      /**
  54       * Returns an array of standard published state filter options.
  55       *
  56       * @return    string            The HTML code for the select tag
  57       */
  58  	public static function stateOptions()
  59      {
  60          // Build the active state filter options.
  61          $options    = array();
  62          $options[]    = JHtml::_('select.option', '1', 'JENABLED');
  63          $options[]    = JHtml::_('select.option', '0', 'JDISABLED');
  64  
  65          return $options;
  66      }
  67  
  68      /**
  69       * Returns an array of standard published state filter options.
  70       *
  71       * @return    string            The HTML code for the select tag
  72       */
  73  	public static function folderOptions()
  74      {
  75          $db        = JFactory::getDbo();
  76          $query    = $db->getQuery(true);
  77  
  78          $query->select('DISTINCT(folder) AS value, folder AS text');
  79          $query->from('#__extensions');
  80          $query->where($db->quoteName('type').' = '.$db->quote('plugin'));
  81          $query->order('folder');
  82  
  83          $db->setQuery($query);
  84          $options = $db->loadObjectList();
  85  
  86          if ($error = $db->getErrorMsg()) {
  87              JError::raiseWarning(500, $error);
  88          }
  89  
  90          return $options;
  91      }
  92  	function parseXMLTemplateFile($templateBaseDir, $templateDir)
  93      {
  94          $data = new JObject;
  95  
  96          // Check of the xml file exists
  97          $filePath = JPath::clean($templateBaseDir.'/templates/'.$templateDir.'/templateDetails.xml');
  98          if (is_file($filePath)) {
  99              $xml = JApplicationHelper::parseXMLInstallFile($filePath);
 100  
 101              if ($xml['type'] != 'template') {
 102                  return false;
 103              }
 104  
 105              foreach ($xml as $key => $value) {
 106                  $data->set($key, $value);
 107              }
 108          }
 109  
 110          return $data;
 111      }
 112  }


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