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