Bump to 3.8 minimum, use namespaced classes

This commit is contained in:
Michael Babker 2017-08-17 18:22:01 -05:00
parent e9c99d9a1c
commit 4d5475bc18
18 changed files with 119 additions and 89 deletions

View File

@ -9,6 +9,8 @@
namespace PatchTester\Controller;
use Joomla\Application\AbstractApplication;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\Registry\Registry;
/**
@ -16,7 +18,7 @@ use Joomla\Registry\Registry;
*
* @since 2.0
*
* @method \JApplicationCms getApplication() getApplication() Get the application object.
* @method CMSApplication getApplication() getApplication() Get the application object.
*/
abstract class AbstractController extends \JControllerBase
{
@ -66,7 +68,7 @@ abstract class AbstractController extends \JControllerBase
$state = new Registry;
// Load the parameters.
$params = \JComponentHelper::getParams('com_patchtester');
$params = ComponentHelper::getParams('com_patchtester');
$state->set('github_user', $params->get('org', 'joomla'));
$state->set('github_repo', $params->get('repo', 'joomla-cms'));

View File

@ -8,6 +8,7 @@
namespace PatchTester\Controller;
use Joomla\CMS\Factory;
use PatchTester\Model\PullModel;
/**
@ -28,7 +29,7 @@ class ApplyController extends AbstractController
{
try
{
$model = new PullModel(null, \JFactory::getDbo());
$model = new PullModel(null, Factory::getDbo());
// Initialize the state for the model
$model->setState($this->initializeState($model));

View File

@ -8,6 +8,7 @@
namespace PatchTester\Controller;
use Joomla\CMS\Factory;
use Joomla\Registry\Registry;
/**
@ -68,17 +69,17 @@ class DisplayController extends AbstractController
if (!class_exists($viewClass))
{
throw new \RuntimeException(JText::sprintf('COM_PATCHTESTER_ERROR_VIEW_NOT_FOUND', $view, $format), 500);
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_VIEW_NOT_FOUND', $view, $format), 500);
}
}
if (!class_exists($modelClass))
{
throw new \RuntimeException(JText::sprintf('COM_PATCHTESTER_ERROR_MODEL_NOT_FOUND', $modelClass), 500);
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_MODEL_NOT_FOUND', $modelClass), 500);
}
// Initialize the model class now; need to do it before setting the state to get required data from it
$model = new $modelClass($this->context, null, \JFactory::getDbo());
$model = new $modelClass($this->context, null, Factory::getDbo());
// Initialize the state for the model
$model->setState($this->initializeState($model));

View File

@ -8,6 +8,8 @@
namespace PatchTester\Controller;
use Joomla\CMS\Factory;
use Joomla\CMS\Response\JsonResponse;
use PatchTester\Model\PullsModel;
/**
@ -33,14 +35,14 @@ class FetchController extends AbstractController
$this->getApplication()->setHeader('Pragma', 'no-cache');
$this->getApplication()->setHeader('Content-Type', $this->getApplication()->mimeType . '; charset=' . $this->getApplication()->charSet);
$session = \JFactory::getSession();
$session = Factory::getSession();
try
{
// Fetch our page from the session
$page = $session->get('com_patchtester_fetcher_page', 1);
$model = new PullsModel('com_patchtester.fetch', null, \JFactory::getDbo());
$model = new PullsModel('com_patchtester.fetch', null, Factory::getDbo());
// Initialize the state for the model
$model->setState($this->initializeState($model));
@ -49,7 +51,7 @@ class FetchController extends AbstractController
}
catch (\Exception $e)
{
$response = new \JResponseJson($e);
$response = new JsonResponse($e);
$this->getApplication()->sendHeaders();
echo json_encode($response);
@ -87,7 +89,7 @@ class FetchController extends AbstractController
}
}
$response = new \JResponseJson($status, $message, false, true);
$response = new JsonResponse($status, $message, false, true);
$this->getApplication()->sendHeaders();
echo json_encode($response);

View File

@ -8,6 +8,7 @@
namespace PatchTester\Controller;
use Joomla\CMS\Factory;
use PatchTester\Model\PullModel;
use PatchTester\Model\PullsModel;
use PatchTester\Model\TestsModel;
@ -32,9 +33,9 @@ class ResetController extends AbstractController
{
$hasErrors = false;
$pullModel = new PullModel(null, \JFactory::getDbo());
$pullsModel = new PullsModel($this->context, null, \JFactory::getDbo());
$testsModel = new TestsModel(null, \JFactory::getDbo());
$pullModel = new PullModel(null, Factory::getDbo());
$pullsModel = new PullsModel($this->context, null, Factory::getDbo());
$testsModel = new TestsModel(null, Factory::getDbo());
// Check the applied patches in the database first
$appliedPatches = $testsModel->getAppliedPatches();
@ -113,7 +114,7 @@ class ResetController extends AbstractController
if ($hasErrors)
{
$msg = \JText::sprintf(
'COM_PATCHTESTER_RESET_HAS_ERRORS', JPATH_COMPONENT . '/backups', \JFactory::getDbo()->replacePrefix('#__patchtester_tests')
'COM_PATCHTESTER_RESET_HAS_ERRORS', JPATH_COMPONENT . '/backups', Factory::getDbo()->replacePrefix('#__patchtester_tests')
);
$type = 'warning';
}

View File

@ -8,6 +8,7 @@
namespace PatchTester\Controller;
use Joomla\CMS\Factory;
use PatchTester\Model\PullModel;
/**
@ -28,7 +29,7 @@ class RevertController extends AbstractController
{
try
{
$model = new PullModel(null, \JFactory::getDbo());
$model = new PullModel(null, Factory::getDbo());
// Initialize the state for the model
$model->setState($this->initializeState($model));

View File

@ -8,9 +8,10 @@
namespace PatchTester\Controller;
use PatchTester\GitHub\Exception\UnexpectedResponse;
use Joomla\CMS\Factory;
use Joomla\CMS\Response\JsonResponse;
use Joomla\CMS\Session\Session;
use PatchTester\Helper;
use PatchTester\Model\PullsModel;
use PatchTester\Model\TestsModel;
/**
@ -37,9 +38,9 @@ class StartfetchController extends AbstractController
$this->getApplication()->setHeader('Content-Type', $this->getApplication()->mimeType . '; charset=' . $this->getApplication()->charSet);
// Check for a valid token. If invalid, send a 403 with the error message.
if (!\JSession::checkToken('request'))
if (!Session::checkToken('request'))
{
$response = new \JResponseJson(new \Exception(\JText::_('JINVALID_TOKEN'), 403));
$response = new JsonResponse(new \Exception(\JText::_('JINVALID_TOKEN'), 403));
$this->getApplication()->sendHeaders();
echo json_encode($response);
@ -55,7 +56,7 @@ class StartfetchController extends AbstractController
}
catch (\Exception $e)
{
$response = new \JResponseJson(
$response = new JsonResponse(
new \Exception(
\JText::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()),
$e->getCode(),
@ -72,9 +73,9 @@ class StartfetchController extends AbstractController
// If over the API limit, we can't build this list
if ($rate->resources->core->remaining < 10)
{
$response = new \JResponseJson(
$response = new JsonResponse(
new \Exception(
\JText::sprintf('COM_PATCHTESTER_API_LIMIT_LIST', \JFactory::getDate($rate->resources->core->reset)),
\JText::sprintf('COM_PATCHTESTER_API_LIMIT_LIST', Factory::getDate($rate->resources->core->reset)),
429
)
);
@ -85,14 +86,14 @@ class StartfetchController extends AbstractController
$this->getApplication()->close(1);
}
$testsModel = new TestsModel(null, \JFactory::getDbo());
$testsModel = new TestsModel(null, Factory::getDbo());
try
{
// Sanity check, ensure there aren't any applied patches
if (count($testsModel->getAppliedPatches()) >= 1)
{
$response = new \JResponseJson(new \Exception(\JText::_('COM_PATCHTESTER_ERROR_APPLIED_PATCHES'), 500));
$response = new JsonResponse(new \Exception(\JText::_('COM_PATCHTESTER_ERROR_APPLIED_PATCHES'), 500));
$this->getApplication()->sendHeaders();
echo json_encode($response);
@ -102,7 +103,7 @@ class StartfetchController extends AbstractController
}
catch (\Exception $e)
{
$response = new \JResponseJson($e);
$response = new JsonResponse($e);
$this->getApplication()->sendHeaders();
echo json_encode($response);
@ -111,9 +112,9 @@ class StartfetchController extends AbstractController
}
// We're able to successfully pull data, prepare our environment
\JFactory::getSession()->set('com_patchtester_fetcher_page', 1);
Factory::getSession()->set('com_patchtester_fetcher_page', 1);
$response = new \JResponseJson(
$response = new JsonResponse(
array('complete' => false, 'header' => \JText::_('COM_PATCHTESTER_FETCH_PROCESSING', true)),
\JText::sprintf('COM_PATCHTESTER_FETCH_PAGE_NUMBER', 1),
false,

View File

@ -8,6 +8,8 @@
namespace PatchTester\GitHub\Exception;
use Joomla\CMS\Http\Response;
/**
* Exception representing an unexpected response
*
@ -18,7 +20,7 @@ class UnexpectedResponse extends \DomainException
/**
* The Response object.
*
* @var \JHttpResponse
* @var Response
* @since 3.0.0
*/
private $response;
@ -26,14 +28,14 @@ class UnexpectedResponse extends \DomainException
/**
* Constructor
*
* @param \JHttpResponse $response The Response object.
* @param string $message The Exception message to throw.
* @param integer $code The Exception code.
* @param \Exception $previous The previous exception used for the exception chaining.
* @param Response $response The Response object.
* @param string $message The Exception message to throw.
* @param integer $code The Exception code.
* @param \Exception $previous The previous exception used for the exception chaining.
*
* @since 3.0.0
*/
public function __construct(\JHttpResponse $response, $message = '', $code = 0, \Exception $previous = null)
public function __construct(Response $response, $message = '', $code = 0, \Exception $previous = null)
{
parent::__construct($message, $code, $previous);
@ -43,9 +45,9 @@ class UnexpectedResponse extends \DomainException
/**
* Get the Response object.
*
* @return \JHttpResponse
* @return Response
*
* @since 3.0.0
* @since 3.0.0
*/
public function getResponse()
{

View File

@ -8,6 +8,10 @@
namespace PatchTester\GitHub;
use Joomla\CMS\Http\Http;
use Joomla\CMS\Http\HttpFactory;
use Joomla\CMS\Http\Response;
use Joomla\CMS\Uri\Uri;
use Joomla\Registry\Registry;
/**
@ -28,7 +32,7 @@ class GitHub
/**
* The HTTP client object to use in sending HTTP requests.
*
* @var \JHttp
* @var Http
* @since 3.0.0
*/
protected $client;
@ -37,14 +41,14 @@ class GitHub
* Constructor.
*
* @param Registry $options Connector options.
* @param \JHttp $client The HTTP client object.
* @param Http $client The HTTP client object.
*
* @since 3.0.0
*/
public function __construct(Registry $options = null, \JHttp $client = null)
public function __construct(Registry $options = null, Http $client = null)
{
$this->options = $options ?: new Registry;
$this->client = $client ?: \JHttpFactory::getHttp($options);
$this->client = $client ?: HttpFactory::getHttp($options);
}
/**
@ -63,8 +67,8 @@ class GitHub
*/
protected function fetchUrl($path, $page = 0, $limit = 0)
{
// Get a new JUri object fousing the api url and given path.
$uri = new \JUri($this->options->get('api.url') . $path);
// Get a new Uri object using the API URL and given path.
$uri = new Uri($this->options->get('api.url') . $path);
// Only apply basic authentication if an access token is not set
if ($this->options->get('gh.token', false) === false)
@ -103,7 +107,7 @@ class GitHub
/**
* Get the HTTP client for this connector.
*
* @return \JHttp
* @return Http
*
* @since 3.0.0
*/
@ -119,7 +123,7 @@ class GitHub
* @param string $repo The name of the GitHub repository.
* @param integer $pullId The pull request number.
*
* @return \JHttpResponse
* @return Response
*
* @since 3.0.0
*/
@ -144,7 +148,7 @@ class GitHub
* @param string $path The content path.
* @param string $ref The name of the commit/branch/tag. Default: the repositorys default branch (usually master)
*
* @return \JHttpResponse
* @return Response
*
* @since 3.0.0
*/
@ -156,7 +160,7 @@ class GitHub
if ($ref)
{
$url = new \JUri($prepared['url']);
$url = new Uri($prepared['url']);
$url->setVar('ref', $ref);
$prepared['url'] = (string) $url;
@ -172,7 +176,7 @@ class GitHub
* @param string $repo The name of the GitHub repository.
* @param integer $pullId The pull request number.
*
* @return \JHttpResponse
* @return Response
*
* @since 3.0.0
*/
@ -194,7 +198,7 @@ class GitHub
* @param integer $page The page number from which to get items.
* @param integer $limit The number of items on a page.
*
* @return \JHttpResponse
* @return Response
*
* @since 3.0.0
*/
@ -227,7 +231,7 @@ class GitHub
* @param string $repo The name of the GitHub repository.
* @param integer $pullId The pull request number.
*
* @return \JHttpResponse
* @return Response
*
* @since 3.0.0
*/
@ -244,7 +248,7 @@ class GitHub
/**
* Get the rate limit for the authenticated user.
*
* @return \JHttpResponse
* @return Response
*
* @since 3.0.0
*/
@ -258,15 +262,15 @@ class GitHub
/**
* Process the response and return it.
*
* @param \JHttpResponse $response The response.
* @param integer $expectedCode The expected response code.
* @param Response $response The response.
* @param integer $expectedCode The expected response code.
*
* @return \JHttpResponse
* @return Response
*
* @since 3.0.0
* @throws Exception\UnexpectedResponse
*/
protected function processResponse(\JHttpResponse $response, $expectedCode = 200)
protected function processResponse(Response $response, $expectedCode = 200)
{
// Validate the response code.
if ($response->code != $expectedCode)

View File

@ -8,6 +8,8 @@
namespace PatchTester;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\Registry\Registry;
use PatchTester\GitHub\GitHub;
@ -27,7 +29,7 @@ abstract class Helper
*/
public static function initializeGithub()
{
$params = \JComponentHelper::getParams('com_patchtester');
$params = ComponentHelper::getParams('com_patchtester');
$options = new Registry;
@ -54,7 +56,7 @@ abstract class Helper
// Display a message about the lowered API limit without credentials
else
{
\JFactory::getApplication()->enqueueMessage(\JText::_('COM_PATCHTESTER_NO_CREDENTIALS'), 'notice');
Factory::getApplication()->enqueueMessage(\JText::_('COM_PATCHTESTER_NO_CREDENTIALS'), 'notice');
}
return new GitHub($options);

View File

@ -8,6 +8,8 @@
namespace PatchTester\Model;
use Joomla\CMS\Factory;
use Joomla\CMS\Version;
use PatchTester\GitHub\Exception\UnexpectedResponse;
use PatchTester\Helper;
@ -158,7 +160,7 @@ class PullModel extends \JModelDatabase
if ($rate->resources->core->remaining == 0)
{
throw new \RuntimeException(
\JText::sprintf('COM_PATCHTESTER_API_LIMIT_LIST', \JFactory::getDate($rate->resources->core->reset))
\JText::sprintf('COM_PATCHTESTER_API_LIMIT_LIST', Factory::getDate($rate->resources->core->reset))
);
}
@ -309,7 +311,7 @@ class PullModel extends \JModelDatabase
$record = (object) array(
'pull_id' => $pull->number,
'data' => json_encode($parsedFiles),
'patched_by' => \JFactory::getUser()->id,
'patched_by' => Factory::getUser()->id,
'applied' => 1,
'applied_version' => JVERSION,
);
@ -327,7 +329,7 @@ class PullModel extends \JModelDatabase
)->execute();
// Change the media version
$version = new \JVersion;
$version = new Version;
$version->refreshMediaVersion();
return true;
@ -445,7 +447,7 @@ class PullModel extends \JModelDatabase
}
// Change the media version
$version = new \JVersion;
$version = new Version;
$version->refreshMediaVersion();
return $this->removeTest($testRecord);

View File

@ -8,8 +8,8 @@
namespace PatchTester\Model;
use Joomla\CMS\Pagination\Pagination;
use Joomla\Registry\Registry;
use PatchTester\GitHub\Exception\UnexpectedResponse;
use PatchTester\Helper;
@ -187,9 +187,9 @@ class PullsModel extends \JModelDatabase
}
/**
* Method to get a JPagination object for the data set.
* Method to get a Pagination object for the data set.
*
* @return \JPagination A JPagination object for the data set.
* @return Pagination A Pagination object for the data set.
*
* @since 2.0
*/
@ -205,7 +205,7 @@ class PullsModel extends \JModelDatabase
}
// Create the pagination object and add the object to the internal cache.
$this->cache[$store] = new \JPagination($this->getTotal(), $this->getStart(), (int) $this->getState()->get('list.limit', 20));
$this->cache[$store] = new Pagination($this->getTotal(), $this->getStart(), (int) $this->getState()->get('list.limit', 20));
return $this->cache[$store];
}

View File

@ -8,10 +8,6 @@
namespace PatchTester\Model;
use Joomla\Registry\Registry;
use PatchTester\Helper;
/**
* Methods supporting applied pull requests.
*

View File

@ -6,6 +6,8 @@
* @license GNU General Public License version 2 or later
*/
use Joomla\CMS\Factory;
/** @var \PatchTester\View\DefaultHtmlView $this */
\JHtml::_('jquery.framework');
@ -20,5 +22,5 @@
<div id="progress" class="progress progress-striped active">
<div id="progress-bar" class="bar bar-success" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<input id="patchtester-token" type="hidden" name="<?php echo \JFactory::getSession()->getFormToken(); ?>" value="1" />
<input id="patchtester-token" type="hidden" name="<?php echo Factory::getSession()->getFormToken(); ?>" value="1" />
</div>

View File

@ -8,6 +8,10 @@
namespace PatchTester\View\Pulls;
use Joomla\CMS\Factory;
use Joomla\CMS\Pagination\Pagination;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\Registry\Registry;
use PatchTester\TrackerHelper;
use PatchTester\View\DefaultHtmlView;
@ -47,7 +51,7 @@ class PullsHtmlView extends DefaultHtmlView
/**
* Pagination object
*
* @var \JPagination
* @var Pagination
* @since 2.0
*/
protected $pagination;
@ -55,7 +59,7 @@ class PullsHtmlView extends DefaultHtmlView
/**
* The model state
*
* @var \Joomla\Registry\Registry
* @var Registry
* @since 2.0
*/
protected $state;
@ -111,7 +115,7 @@ class PullsHtmlView extends DefaultHtmlView
// Set a warning on 4.0 branch
if (version_compare(JVERSION, '4.0', 'ge'))
{
\JFactory::getApplication()->enqueueMessage(\JText::_('COM_PATCHTESTER_40_WARNING'), 'warning');
Factory::getApplication()->enqueueMessage(\JText::_('COM_PATCHTESTER_40_WARNING'), 'warning');
}
return parent::render();
@ -130,7 +134,7 @@ class PullsHtmlView extends DefaultHtmlView
if (!count($this->envErrors))
{
$toolbar = \JToolbar::getInstance('toolbar');
$toolbar = Toolbar::getInstance('toolbar');
$toolbar->appendButton(
'Popup',

View File

@ -8,14 +8,16 @@
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
// Access check.
if (!JFactory::getUser()->authorise('core.manage', 'com_patchtester'))
if (!Factory::getUser()->authorise('core.manage', 'com_patchtester'))
{
throw new RuntimeException(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}
// Application reference
$app = JFactory::getApplication();
$app = Factory::getApplication();
// Import our Composer autoloader to load the component classes
require_once __DIR__ . '/vendor/autoload.php';

View File

@ -6,12 +6,16 @@
* @license GNU General Public License version 2 or later
*/
use Joomla\CMS\Factory;
use Joomla\CMS\Installer\Adapter\ComponentAdapter;
use Joomla\CMS\Installer\InstallerScript;
/**
* Installation class to perform additional changes during install/uninstall/update
*
* @since 2.0
*/
class Com_PatchtesterInstallerScript extends JInstallerScript
class Com_PatchtesterInstallerScript extends InstallerScript
{
/**
* Array of templates with supported overrides
@ -28,7 +32,7 @@ class Com_PatchtesterInstallerScript extends JInstallerScript
*/
public function __construct()
{
$this->minimumJoomla = '3.7';
$this->minimumJoomla = '3.8';
$this->minimumPhp = JOOMLA_MINIMUM_PHP;
$this->deleteFiles = array(
@ -44,7 +48,7 @@ class Com_PatchtesterInstallerScript extends JInstallerScript
/**
* Function to perform changes during install
*
* @param JInstallerAdapterComponent $parent The class calling this method
* @param ComponentAdapter $parent The class calling this method
*
* @return void
*
@ -58,7 +62,7 @@ class Com_PatchtesterInstallerScript extends JInstallerScript
/**
* Function to perform changes during update
*
* @param JInstallerAdapterComponent $parent The class calling this method
* @param ComponentAdapter $parent The class calling this method
*
* @return void
*
@ -72,7 +76,7 @@ class Com_PatchtesterInstallerScript extends JInstallerScript
/**
* Function to perform changes during uninstall
*
* @param JInstallerAdapterComponent $parent The class calling this method
* @param ComponentAdapter $parent The class calling this method
*
* @return void
*
@ -106,15 +110,15 @@ class Com_PatchtesterInstallerScript extends JInstallerScript
// If we couldn't remove any overrides, notify the user
if (count($errorTemplates) > 0)
{
JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_PATCHTESTER_COULD_NOT_REMOVE_OVERRIDES', implode(', ', $errorTemplates)));
Factory::getApplication()->enqueueMessage(JText::sprintf('COM_PATCHTESTER_COULD_NOT_REMOVE_OVERRIDES', implode(', ', $errorTemplates)));
}
}
/**
* Function to perform changes during postflight
*
* @param string $type The action being performed
* @param JInstallerAdapterComponent $parent The class calling this method
* @param string $type The action being performed
* @param ComponentAdapter $parent The class calling this method
*
* @return void
*
@ -168,7 +172,7 @@ class Com_PatchtesterInstallerScript extends JInstallerScript
// If we couldn't remove any overrides, notify the user
if (count($errorTemplates) > 0)
{
JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_PATCHTESTER_COULD_NOT_INSTALL_OVERRIDES', implode(', ', $errorTemplates)));
Factory::getApplication()->enqueueMessage(JText::sprintf('COM_PATCHTESTER_COULD_NOT_INSTALL_OVERRIDES', implode(', ', $errorTemplates)));
}
}
}

View File

@ -6,6 +6,9 @@
* @license GNU General Public License version 2 or later
*/
use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;
/** @var \PatchTester\View\Pulls\PullsHtmlView $this */
\JHtml::_('behavior.core');
@ -20,7 +23,7 @@ $filterBranch = $this->escape($this->state->get('filter.branch'));
$filterRtc = $this->escape($this->state->get('filter.rtc'));
$colSpan = $this->trackerAlias !== false ? 8 : 7;
\JFactory::getDocument()->addStyleDeclaration(
Factory::getDocument()->addStyleDeclaration(
'
.icon-48-patchtester { background-image:url("/media/com_patchtester/images/icon-48-patchtester.png"); }
'
@ -29,7 +32,7 @@ echo \JHtml::_(
'bootstrap.renderModal',
'modal-refresh',
array(
'url' => \JUri::root() . 'administrator/index.php?option=com_patchtester&view=fetch&tmpl=component',
'url' => Uri::root() . 'administrator/index.php?option=com_patchtester&view=fetch&tmpl=component',
'title' => \JText::_('COM_PATCHTESTER_TOOLBAR_FETCH_DATA'),
'width' => '800px',
'height' => '300px'
@ -41,25 +44,25 @@ echo \JHtml::_(
<fieldset id="filter-bar">
<legend class="element-invisible"><?php echo \JText::_('JSEARCH_FILTER_LABEL'); ?></legend>
<div class="filter-search">
<label class="filter-search-lbl" for="filter_search"><?php echo JText::_('JSEARCH_FILTER_LABEL'); ?></label>
<label class="filter-search-lbl" for="filter_search"><?php echo \JText::_('JSEARCH_FILTER_LABEL'); ?></label>
<input type="text" name="filter_search" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" title="<?php echo \JText::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION'); ?>" />
<button type="submit" class="btn"><?php echo \JText::_('JSEARCH_FILTER_SUBMIT'); ?></button>
<button type="button" onclick="document.getElementById('filter_search').value='';this.form.submit();"><?php echo \JText::_('JSEARCH_FILTER_CLEAR'); ?></button>
</div>
<div class="filter-select">
<label class="selectlabel" for="filter_applied"><?php echo JText::_('COM_PATCHTESTER_FILTER_APPLIED_PATCHES'); ?></label>
<label class="selectlabel" for="filter_applied"><?php echo \JText::_('COM_PATCHTESTER_FILTER_APPLIED_PATCHES'); ?></label>
<select name="filter_applied" id="filter_applied">
<option value=""><?php echo \JText::_('COM_PATCHTESTER_FILTER_APPLIED_PATCHES'); ?></option>
<option value="yes"<?php if ($filterApplied == 'yes') echo ' selected="selected"'; ?>><?php echo \JText::_('COM_PATCHTESTER_APPLIED'); ?></option>
<option value="no"<?php if ($filterApplied == 'no') echo ' selected="selected"'; ?>><?php echo \JText::_('COM_PATCHTESTER_NOT_APPLIED'); ?></option>
</select>
<label class="selectlabel" for="filter_rtc"><?php echo JText::_('COM_PATCHTESTER_FILTER_RTC_PATCHES'); ?></label>
<label class="selectlabel" for="filter_rtc"><?php echo \JText::_('COM_PATCHTESTER_FILTER_RTC_PATCHES'); ?></label>
<select name="filter_rtc" id="filter_rtc">
<option value=""><?php echo \JText::_('COM_PATCHTESTER_FILTER_RTC_PATCHES'); ?></option>
<option value="yes"<?php if ($filterRtc == 'yes') echo ' selected="selected"'; ?>><?php echo \JText::_('COM_PATCHTESTER_RTC'); ?></option>
<option value="no"<?php if ($filterRtc == 'no') echo ' selected="selected"'; ?>><?php echo \JText::_('COM_PATCHTESTER_NOT_RTC'); ?></option>
</select>
<label class="selectlabel" for="filter_branch"><?php echo JText::_('COM_PATCHTESTER_FILTER_BRANCH'); ?></label>
<label class="selectlabel" for="filter_branch"><?php echo \JText::_('COM_PATCHTESTER_FILTER_BRANCH'); ?></label>
<select name="filter_branch" id="filter_branch">
<option value=""><?php echo \JText::_('COM_PATCHTESTER_FILTER_BRANCH'); ?></option>
<?php echo \JHtml::_('select.options', $this->branches, 'text', 'text', $filterBranch, false);?>