| [ Index ] |
PHP Cross Reference of Joomla 1.5.26 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @version $Id: plugins.php 14401 2010-01-26 14:10:00Z louis $ 4 * @package Joomla 5 * @subpackage Menus 6 * @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. 7 * @license GNU/GPL, see LICENSE.php 8 * Joomla! is free software. This version may have been modified pursuant to the 9 * GNU General Public License, and as distributed it includes or is derivative 10 * of works licensed under the GNU General Public License or other free or open 11 * source software licenses. See COPYRIGHT.php for copyright notices and 12 * details. 13 */ 14 15 // no direct access 16 defined( '_JEXEC' ) or die( 'Restricted access' ); 17 18 // Import library dependencies 19 require_once(dirname(__FILE__).DS.'extension.php'); 20 21 /** 22 * Installer Plugins Model 23 * 24 * @package Joomla 25 * @subpackage Installer 26 * @since 1.5 27 */ 28 class InstallerModelPlugins extends InstallerModel 29 { 30 /** 31 * Extension Type 32 * @var string 33 */ 34 var $_type = 'plugin'; 35 36 /** 37 * Overridden constructor 38 * @access protected 39 */ 40 function __construct() 41 { 42 global $mainframe; 43 44 // Call the parent constructor 45 parent::__construct(); 46 47 // Set state variables from the request 48 $this->setState('filter.group', $mainframe->getUserStateFromRequest( "com_installer.plugins.group", 'group', '', 'cmd' )); 49 $this->setState('filter.string', $mainframe->getUserStateFromRequest( "com_installer.plugins.string", 'filter', '', 'string' )); 50 } 51 52 function &getGroups() 53 { 54 // Get a database connector object 55 $db = &$this->getDBO(); 56 57 // get list of Positions for dropdown filter 58 $query = 'SELECT folder AS value, folder AS text' . 59 ' FROM #__plugins' . 60 ' GROUP BY folder' . 61 ' ORDER BY folder'; 62 $db->setQuery( $query ); 63 64 $types[] = JHTML::_('select.option', '', JText::_( 'All' ) ); 65 $types = array_merge( $types, $db->loadObjectList() ); 66 67 return $types; 68 } 69 70 function _loadItems() 71 { 72 global $mainframe, $option; 73 74 // Get a database connector 75 $db = & JFactory::getDBO(); 76 77 $where = null; 78 if ($this->_state->get('filter.group')) { 79 if ($search = $this->_state->get('filter.string')) 80 { 81 $where = ' WHERE folder = "'.$db->getEscaped($this->_state->get('filter.group')).'"'; 82 $where .= ' AND name LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); 83 } 84 else { 85 $where = ' WHERE folder = "'.$db->getEscaped($this->_state->get('filter.group')).'"'; 86 } 87 } else { 88 if ($search = $this->_state->get('filter.string')) { 89 $where .= ' WHERE name LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); 90 } 91 } 92 93 $query = 'SELECT id, name, folder, element, client_id, iscore' . 94 ' FROM #__plugins' . 95 $where . 96 ' ORDER BY iscore, folder, name'; 97 $db->setQuery($query); 98 $rows = $db->loadObjectList(); 99 100 // Get the plugin base path 101 $baseDir = JPATH_ROOT.DS.'plugins'; 102 103 $numRows = count($rows); 104 for ($i = 0; $i < $numRows; $i ++) { 105 $row = & $rows[$i]; 106 107 // Get the plugin xml file 108 $xmlfile = $baseDir.DS.$row->folder.DS.$row->element.".xml"; 109 110 if (file_exists($xmlfile)) { 111 if ($data = JApplicationHelper::parseXMLInstallFile($xmlfile)) { 112 foreach($data as $key => $value) 113 { 114 $row->$key = $value; 115 } 116 } 117 } 118 } 119 120 $this->setState('pagination.total', $numRows); 121 // if the offset is greater than the total, then can the offset 122 if($this->_state->get('pagination.offset') > $this->_state->get('pagination.total')) { 123 $this->setState('pagination.offset',0); 124 } 125 126 if($this->_state->get('pagination.limit') > 0) { 127 $this->_items = array_slice( $rows, $this->_state->get('pagination.offset'), $this->_state->get('pagination.limit') ); 128 } else { 129 $this->_items = $rows; 130 } 131 } 132 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Mar 28 15:54:07 2012 | Cross-referenced by PHPXref 0.7.1 |