31
0
mirror of https://github.com/joomla-extensions/patchtester.git synced 2024-05-29 03:50:46 +00:00

Namespace everything

This commit is contained in:
Michael Babker 2019-08-27 20:20:49 -05:00
parent ecfeb835d4
commit fadbf7ac1e
20 changed files with 234 additions and 203 deletions

View File

@ -9,6 +9,8 @@
namespace PatchTester\Controller;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use PatchTester\Model\PullModel;
/**
@ -36,11 +38,11 @@ class ApplyController extends AbstractController
if ($model->apply($this->getInput()->getUint('pull_id')))
{
$msg = \JText::_('COM_PATCHTESTER_APPLY_OK');
$msg = Text::_('COM_PATCHTESTER_APPLY_OK');
}
else
{
$msg = \JText::_('COM_PATCHTESTER_NO_FILES_TO_PATCH');
$msg = Text::_('COM_PATCHTESTER_NO_FILES_TO_PATCH');
}
$type = 'message';
@ -52,6 +54,6 @@ class ApplyController extends AbstractController
}
$this->getApplication()->enqueueMessage($msg, $type);
$this->getApplication()->redirect(\JRoute::_('index.php?option=com_patchtester', false));
$this->getApplication()->redirect(Route::_('index.php?option=com_patchtester', false));
}
}

View File

@ -9,6 +9,7 @@
namespace PatchTester\Controller;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\Registry\Registry;
use PatchTester\Model\AbstractModel;
@ -62,13 +63,13 @@ 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(Text::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(Text::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

View File

@ -9,6 +9,7 @@
namespace PatchTester\Controller;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Response\JsonResponse;
use PatchTester\Model\PullsModel;
@ -69,9 +70,9 @@ class FetchController extends AbstractController
if ($status['complete'] || $page === $session->get('com_patchtester_fetcher_last_page', false))
{
$status['complete'] = true;
$status['header'] = \JText::_('COM_PATCHTESTER_FETCH_SUCCESSFUL', true);
$status['header'] = Text::_('COM_PATCHTESTER_FETCH_SUCCESSFUL', true);
$message = \JText::_('COM_PATCHTESTER_FETCH_COMPLETE_CLOSE_WINDOW', true);
$message = Text::_('COM_PATCHTESTER_FETCH_COMPLETE_CLOSE_WINDOW', true);
}
elseif (isset($status['page']))
{
@ -79,13 +80,13 @@ class FetchController extends AbstractController
if ($session->has('com_patchtester_fetcher_last_page'))
{
$message = \JText::sprintf(
$message = Text::sprintf(
'COM_PATCHTESTER_FETCH_PAGE_NUMBER_OF_TOTAL', $status['page'], $session->get('com_patchtester_fetcher_last_page')
);
}
else
{
$message = \JText::sprintf('COM_PATCHTESTER_FETCH_PAGE_NUMBER', $status['page']);
$message = Text::sprintf('COM_PATCHTESTER_FETCH_PAGE_NUMBER', $status['page']);
}
}

View File

@ -9,6 +9,10 @@
namespace PatchTester\Controller;
use Joomla\CMS\Factory;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\Filesystem\File;
use PatchTester\Model\PullModel;
use PatchTester\Model\PullsModel;
use PatchTester\Model\TestsModel;
@ -69,7 +73,7 @@ class ResetController extends AbstractController
$hasErrors = true;
$this->getApplication()->enqueueMessage(
\JText::sprintf('COM_PATCHTESTER_ERROR_TRUNCATING_PULLS_TABLE', $e->getMessage()), 'error'
Text::sprintf('COM_PATCHTESTER_ERROR_TRUNCATING_PULLS_TABLE', $e->getMessage()), 'error'
);
}
}
@ -85,24 +89,21 @@ class ResetController extends AbstractController
$hasErrors = true;
$this->getApplication()->enqueueMessage(
\JText::sprintf('COM_PATCHTESTER_ERROR_TRUNCATING_TESTS_TABLE', $e->getMessage()), 'error'
Text::sprintf('COM_PATCHTESTER_ERROR_TRUNCATING_TESTS_TABLE', $e->getMessage()), 'error'
);
}
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
// Check the backups directory to see if any .txt files remain; clear them if so
$backups = \JFolder::files(JPATH_COMPONENT . '/backups', '.txt');
$backups = Folder::files(JPATH_COMPONENT . '/backups', '.txt');
if (count($backups))
{
foreach ($backups as $file)
{
if (!\JFile::delete(JPATH_COMPONENT . '/backups/' . $file))
if (!File::delete(JPATH_COMPONENT . '/backups/' . $file))
{
$this->getApplication()->enqueueMessage(
\JText::sprintf('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE', JPATH_COMPONENT . '/backups/' . $file), 'error'
Text::sprintf('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE', JPATH_COMPONENT . '/backups/' . $file), 'error'
);
$hasErrors = true;
@ -113,14 +114,14 @@ class ResetController extends AbstractController
// Processing completed, inform the user of a success or fail
if ($hasErrors)
{
$msg = \JText::sprintf(
$msg = Text::sprintf(
'COM_PATCHTESTER_RESET_HAS_ERRORS', JPATH_COMPONENT . '/backups', Factory::getDbo()->replacePrefix('#__patchtester_tests')
);
$type = 'warning';
}
else
{
$msg = \JText::_('COM_PATCHTESTER_RESET_OK');
$msg = Text::_('COM_PATCHTESTER_RESET_OK');
$type = 'notice';
}
}
@ -131,6 +132,6 @@ class ResetController extends AbstractController
}
$this->getApplication()->enqueueMessage($msg, $type);
$this->getApplication()->redirect(\JRoute::_('index.php?option=com_patchtester', false));
$this->getApplication()->redirect(Route::_('index.php?option=com_patchtester', false));
}
}

View File

@ -9,6 +9,8 @@
namespace PatchTester\Controller;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use PatchTester\Model\PullModel;
/**
@ -36,7 +38,7 @@ class RevertController extends AbstractController
$model->revert($this->getInput()->getUint('pull_id'));
$msg = \JText::_('COM_PATCHTESTER_REVERT_OK');
$msg = Text::_('COM_PATCHTESTER_REVERT_OK');
$type = 'message';
}
catch (\Exception $e)
@ -46,6 +48,6 @@ class RevertController extends AbstractController
}
$this->getApplication()->enqueueMessage($msg, $type);
$this->getApplication()->redirect(\JRoute::_('index.php?option=com_patchtester', false));
$this->getApplication()->redirect(Route::_('index.php?option=com_patchtester', false));
}
}

View File

@ -9,6 +9,7 @@
namespace PatchTester\Controller;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Response\JsonResponse;
use Joomla\CMS\Session\Session;
use PatchTester\Helper;
@ -40,7 +41,7 @@ class StartfetchController extends AbstractController
// Check for a valid token. If invalid, send a 403 with the error message.
if (!Session::checkToken('request'))
{
$response = new JsonResponse(new \Exception(\JText::_('JINVALID_TOKEN'), 403));
$response = new JsonResponse(new \Exception(Text::_('JINVALID_TOKEN'), 403));
$this->getApplication()->sendHeaders();
echo json_encode($response);
@ -58,7 +59,7 @@ class StartfetchController extends AbstractController
{
$response = new JsonResponse(
new \Exception(
\JText::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()),
Text::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()),
$e->getCode(),
$e
)
@ -75,7 +76,7 @@ class StartfetchController extends AbstractController
{
$response = new JsonResponse(
new \Exception(
\JText::sprintf('COM_PATCHTESTER_API_LIMIT_LIST', Factory::getDate($rate->resources->core->reset)),
Text::sprintf('COM_PATCHTESTER_API_LIMIT_LIST', Factory::getDate($rate->resources->core->reset)),
429
)
);
@ -93,7 +94,7 @@ class StartfetchController extends AbstractController
// Sanity check, ensure there aren't any applied patches
if (count($testsModel->getAppliedPatches()) >= 1)
{
$response = new JsonResponse(new \Exception(\JText::_('COM_PATCHTESTER_ERROR_APPLIED_PATCHES'), 500));
$response = new JsonResponse(new \Exception(Text::_('COM_PATCHTESTER_ERROR_APPLIED_PATCHES'), 500));
$this->getApplication()->sendHeaders();
echo json_encode($response);
@ -115,8 +116,8 @@ class StartfetchController extends AbstractController
Factory::getSession()->set('com_patchtester_fetcher_page', 1);
$response = new JsonResponse(
array('complete' => false, 'header' => \JText::_('COM_PATCHTESTER_FETCH_PROCESSING', true)),
\JText::sprintf('COM_PATCHTESTER_FETCH_PAGE_NUMBER', 1),
array('complete' => false, 'header' => Text::_('COM_PATCHTESTER_FETCH_PROCESSING', true)),
Text::sprintf('COM_PATCHTESTER_FETCH_PAGE_NUMBER', 1),
false,
true
);

View File

@ -10,6 +10,7 @@ namespace PatchTester;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\Registry\Registry;
use PatchTester\GitHub\GitHub;
@ -56,7 +57,7 @@ abstract class Helper
// Display a message about the lowered API limit without credentials
else
{
Factory::getApplication()->enqueueMessage(\JText::_('COM_PATCHTESTER_NO_CREDENTIALS'), 'notice');
Factory::getApplication()->enqueueMessage(Text::_('COM_PATCHTESTER_NO_CREDENTIALS'), 'notice');
}
return new GitHub($options);

View File

@ -9,7 +9,10 @@
namespace PatchTester\Model;
use Joomla\CMS\Factory;
use Joomla\CMS\Filesystem\Path;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Version;
use Joomla\Filesystem\File;
use PatchTester\GitHub\Exception\UnexpectedResponse;
use PatchTester\Helper;
@ -153,14 +156,14 @@ class PullModel extends AbstractModel
}
catch (UnexpectedResponse $e)
{
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()), $e->getCode(), $e);
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()), $e->getCode(), $e);
}
// If over the API limit, we can't build this list
if ($rate->resources->core->remaining == 0)
{
throw new \RuntimeException(
\JText::sprintf('COM_PATCHTESTER_API_LIMIT_LIST', Factory::getDate($rate->resources->core->reset))
Text::sprintf('COM_PATCHTESTER_API_LIMIT_LIST', Factory::getDate($rate->resources->core->reset))
);
}
@ -171,12 +174,12 @@ class PullModel extends AbstractModel
}
catch (UnexpectedResponse $e)
{
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()), $e->getCode(), $e);
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()), $e->getCode(), $e);
}
if (is_null($pull->head->repo))
{
throw new \RuntimeException(\JText::_('COM_PATCHTESTER_REPO_IS_GONE'));
throw new \RuntimeException(Text::_('COM_PATCHTESTER_REPO_IS_GONE'));
}
try
@ -186,7 +189,7 @@ class PullModel extends AbstractModel
}
catch (UnexpectedResponse $e)
{
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()), $e->getCode(), $e);
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()), $e->getCode(), $e);
}
if (!count($files))
@ -203,7 +206,7 @@ class PullModel extends AbstractModel
case 'deleted':
if (!file_exists(JPATH_ROOT . '/' . $file->filename))
{
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_FILE_DELETED_DOES_NOT_EXIST_S', $file->filename));
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_FILE_DELETED_DOES_NOT_EXIST_S', $file->filename));
}
break;
@ -214,12 +217,12 @@ class PullModel extends AbstractModel
// If the backup file already exists, we can't apply the patch
if (file_exists(JPATH_COMPONENT . '/backups/' . md5($file->filename) . '.txt'))
{
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_CONFLICT_S', $file->filename));
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_CONFLICT_S', $file->filename));
}
if ($file->action == 'modified' && !file_exists(JPATH_ROOT . '/' . $file->filename))
{
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_FILE_MODIFIED_DOES_NOT_EXIST_S', $file->filename));
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_FILE_MODIFIED_DOES_NOT_EXIST_S', $file->filename));
}
try
@ -239,21 +242,18 @@ class PullModel extends AbstractModel
break;
default:
throw new \RuntimeException(\JText::_('COM_PATCHTESTER_ERROR_UNSUPPORTED_ENCODING'));
throw new \RuntimeException(Text::_('COM_PATCHTESTER_ERROR_UNSUPPORTED_ENCODING'));
}
}
catch (UnexpectedResponse $e)
{
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()), $e->getCode(), $e);
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()), $e->getCode(), $e);
}
break;
}
}
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.path');
// At this point, we have ensured that we have all the new files and there are no conflicts
foreach ($parsedFiles as $file)
{
@ -265,9 +265,9 @@ class PullModel extends AbstractModel
$src = JPATH_ROOT . '/' . $filename;
$dest = JPATH_COMPONENT . '/backups/' . md5($filename) . '.txt';
if (!\JFile::copy(\JPath::clean($src), $dest))
if (!File::copy(Path::clean($src), $dest))
{
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_CANNOT_COPY_FILE', $src, $dest));
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_ERROR_CANNOT_COPY_FILE', $src, $dest));
}
}
@ -275,30 +275,30 @@ class PullModel extends AbstractModel
{
case 'modified':
case 'added':
if (!\JFile::write(\JPath::clean(JPATH_ROOT . '/' . $file->filename), $file->body))
if (!File::write(Path::clean(JPATH_ROOT . '/' . $file->filename), $file->body))
{
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_CANNOT_WRITE_FILE', JPATH_ROOT . '/' . $file->filename));
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_ERROR_CANNOT_WRITE_FILE', JPATH_ROOT . '/' . $file->filename));
}
break;
case 'deleted':
if (!\JFile::delete(\JPath::clean(JPATH_ROOT . '/' . $file->filename)))
if (!File::delete(Path::clean(JPATH_ROOT . '/' . $file->filename)))
{
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE', JPATH_ROOT . '/' . $file->filename));
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE', JPATH_ROOT . '/' . $file->filename));
}
break;
case 'renamed':
if (!\JFile::delete(\JPath::clean(JPATH_ROOT . '/' . $file->originalFile)))
if (!File::delete(Path::clean(JPATH_ROOT . '/' . $file->originalFile)))
{
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE', JPATH_ROOT . '/' . $file->originalFile));
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE', JPATH_ROOT . '/' . $file->originalFile));
}
if (!\JFile::write(\JPath::clean(JPATH_ROOT . '/' . $file->filename), $file->body))
if (!File::write(Path::clean(JPATH_ROOT . '/' . $file->filename), $file->body))
{
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_CANNOT_WRITE_FILE', JPATH_ROOT . '/' . $file->filename));
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_ERROR_CANNOT_WRITE_FILE', JPATH_ROOT . '/' . $file->filename));
}
break;
@ -366,11 +366,9 @@ class PullModel extends AbstractModel
if (!$files)
{
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_READING_DATABASE_TABLE', __METHOD__, htmlentities($testRecord->data)));
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_ERROR_READING_DATABASE_TABLE', __METHOD__, htmlentities($testRecord->data)));
}
jimport('joomla.filesystem.file');
foreach ($files as $file)
{
switch ($file->action)
@ -380,17 +378,17 @@ class PullModel extends AbstractModel
$src = JPATH_COMPONENT . '/backups/' . md5($file->filename) . '.txt';
$dest = JPATH_ROOT . '/' . $file->filename;
if (!\JFile::copy($src, $dest))
if (!File::copy($src, $dest))
{
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_CANNOT_COPY_FILE', $src, $dest));
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_ERROR_CANNOT_COPY_FILE', $src, $dest));
}
if (file_exists($src))
{
if (!\JFile::delete($src))
if (!File::delete($src))
{
throw new \RuntimeException(
\JText::sprintf('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE', $src)
Text::sprintf('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE', $src)
);
}
}
@ -402,10 +400,10 @@ class PullModel extends AbstractModel
if (file_exists($src))
{
if (!\JFile::delete($src))
if (!File::delete($src))
{
throw new \RuntimeException(
\JText::sprintf('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE', $src)
Text::sprintf('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE', $src)
);
}
}
@ -417,27 +415,27 @@ class PullModel extends AbstractModel
$newSrc = JPATH_ROOT . '/' . $file->filename;
$dest = JPATH_ROOT . '/' . $file->originalFile;
if (!\JFile::copy($originalSrc, $dest))
if (!File::copy($originalSrc, $dest))
{
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_CANNOT_COPY_FILE', $originalSrc, $dest));
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_ERROR_CANNOT_COPY_FILE', $originalSrc, $dest));
}
if (file_exists($originalSrc))
{
if (!\JFile::delete($originalSrc))
if (!File::delete($originalSrc))
{
throw new \RuntimeException(
\JText::sprintf('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE', $originalSrc)
Text::sprintf('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE', $originalSrc)
);
}
}
if (file_exists($newSrc))
{
if (!\JFile::delete($newSrc))
if (!File::delete($newSrc))
{
throw new \RuntimeException(
\JText::sprintf('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE', $newSrc)
Text::sprintf('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE', $newSrc)
);
}
}

View File

@ -8,6 +8,8 @@
namespace PatchTester\Model;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Pagination\Pagination;
use Joomla\Registry\Registry;
use PatchTester\GitHub\Exception\UnexpectedResponse;
@ -327,7 +329,7 @@ class PullsModel extends AbstractModel
}
catch (UnexpectedResponse $e)
{
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_GITHUB_FETCH', $e->getMessage()), $e->getCode(), $e);
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_ERROR_GITHUB_FETCH', $e->getMessage()), $e->getCode(), $e);
}
// If this is page 1, let's check to see if we need to paginate
@ -389,8 +391,8 @@ class PullsModel extends AbstractModel
// Build the data object to store in the database
$pullData = array(
(int) $pull->number,
$this->getDb()->quote(\JHtml::_('string.truncate', $pull->title, 150)),
$this->getDb()->quote(\JHtml::_('string.truncate', $pull->body, 100)),
$this->getDb()->quote(HTMLHelper::_('string.truncate', $pull->title, 150)),
$this->getDb()->quote(HTMLHelper::_('string.truncate', $pull->body, 100)),
$this->getDb()->quote($pull->pull_request->html_url),
(int) $isRTC,
$this->getDb()->quote($branch),
@ -419,7 +421,7 @@ class PullsModel extends AbstractModel
}
catch (\RuntimeException $e)
{
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_ERROR_INSERT_DATABASE', $e->getMessage()), $e->getCode(), $e);
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_ERROR_INSERT_DATABASE', $e->getMessage()), $e->getCode(), $e);
}
// Need to make another request

View File

@ -8,6 +8,8 @@
namespace PatchTester\View;
use Joomla\CMS\Filesystem\Path;
use Joomla\CMS\Language\Text;
use PatchTester\Model\AbstractModel;
/**
@ -88,10 +90,10 @@ abstract class AbstractHtmlView extends AbstractView
public function getPath($layout)
{
// Get the layout file name.
$file = \JPath::clean($layout . '.php');
$file = Path::clean($layout . '.php');
// Find the layout file path.
$path = \JPath::find(clone $this->paths, $file);
$path = Path::find(clone $this->paths, $file);
return $path;
}
@ -132,7 +134,7 @@ abstract class AbstractHtmlView extends AbstractView
if (!$path)
{
throw new \RuntimeException(\JText::sprintf('JLIB_APPLICATION_ERROR_LAYOUTFILE_NOT_FOUND', $file), 500);
throw new \RuntimeException(Text::sprintf('JLIB_APPLICATION_ERROR_LAYOUTFILE_NOT_FOUND', $file), 500);
}
// Unset so as not to introduce into template scope

View File

@ -7,18 +7,20 @@
*/
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
/** @var \PatchTester\View\DefaultHtmlView $this */
\JHtml::_('jquery.framework');
\JHtml::_('behavior.core');
\JHtml::_('script', 'com_patchtester/fetcher.js', array('version' => 'auto', 'relative' => true));
HTMLHelper::_('jquery.framework');
HTMLHelper::_('behavior.core');
HTMLHelper::_('script', 'com_patchtester/fetcher.js', array('version' => 'auto', 'relative' => true));
?>
<div id="patchtester-container">
<h1 id="patchtester-progress-header"><?php echo \JText::_('COM_PATCHTESTER_FETCH_INITIALIZING'); ?></h1>
<p id="patchtester-progress-message"><?php echo \JText::_('COM_PATCHTESTER_FETCH_INITIALIZING_DESCRIPTION'); ?></p>
<h1 id="patchtester-progress-header"><?php echo Text::_('COM_PATCHTESTER_FETCH_INITIALIZING'); ?></h1>
<p id="patchtester-progress-message"><?php echo Text::_('COM_PATCHTESTER_FETCH_INITIALIZING_DESCRIPTION'); ?></p>
<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>

View File

@ -9,8 +9,10 @@
namespace PatchTester\View\Pulls;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Pagination\Pagination;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Registry\Registry;
use PatchTester\TrackerHelper;
use PatchTester\View\DefaultHtmlView;
@ -83,12 +85,12 @@ class PullsHtmlView extends DefaultHtmlView
{
if (!extension_loaded('openssl'))
{
$this->envErrors[] = \JText::_('COM_PATCHTESTER_REQUIREMENT_OPENSSL');
$this->envErrors[] = Text::_('COM_PATCHTESTER_REQUIREMENT_OPENSSL');
}
if (!in_array('https', stream_get_wrappers()))
{
$this->envErrors[] = \JText::_('COM_PATCHTESTER_REQUIREMENT_HTTPS');
$this->envErrors[] = Text::_('COM_PATCHTESTER_REQUIREMENT_HTTPS');
}
// Only process the data if there are no environment errors
@ -110,12 +112,12 @@ class PullsHtmlView extends DefaultHtmlView
$this->addToolbar();
// Make text strings available in the JavaScript API
\JText::script('COM_PATCHTESTER_CONFIRM_RESET');
Text::script('COM_PATCHTESTER_CONFIRM_RESET');
// Set a warning on 4.0 branch
if (version_compare(JVERSION, '4.0', 'ge'))
{
Factory::getApplication()->enqueueMessage(\JText::_('COM_PATCHTESTER_40_WARNING'), 'warning');
Factory::getApplication()->enqueueMessage(Text::_('COM_PATCHTESTER_40_WARNING'), 'warning');
}
return parent::render();
@ -130,7 +132,7 @@ class PullsHtmlView extends DefaultHtmlView
*/
protected function addToolbar()
{
\JToolbarHelper::title(\JText::_('COM_PATCHTESTER'), 'patchtester icon-apply');
ToolbarHelper::title(Text::_('COM_PATCHTESTER'), 'patchtester icon-apply');
if (!count($this->envErrors))
{
@ -153,7 +155,7 @@ class PullsHtmlView extends DefaultHtmlView
$toolbar->appendButton('Standard', 'expired', 'COM_PATCHTESTER_TOOLBAR_RESET', 'reset', false);
}
\JToolbarHelper::preferences('com_patchtester');
ToolbarHelper::preferences('com_patchtester');
}
/**
@ -166,17 +168,17 @@ class PullsHtmlView extends DefaultHtmlView
protected function getLimitOptions()
{
return array(
5 => \JText::_('J5'),
10 => \JText::_('J10'),
15 => \JText::_('J15'),
20 => \JText::_('J20'),
25 => \JText::_('J25'),
30 => \JText::_('J30'),
50 => \JText::_('J50'),
100 => \JText::_('J100'),
200 => \JText::_('J200'),
500 => \JText::_('J500'),
0 => \JText::_('JALL'),
5 => Text::_('J5'),
10 => Text::_('J10'),
15 => Text::_('J15'),
20 => Text::_('J20'),
25 => Text::_('J25'),
30 => Text::_('J30'),
50 => Text::_('J50'),
100 => Text::_('J100'),
200 => Text::_('J200'),
500 => Text::_('J500'),
0 => Text::_('JALL'),
);
}
@ -190,10 +192,10 @@ class PullsHtmlView extends DefaultHtmlView
protected function getSortFields()
{
return array(
'a.title ASC' => \JText::_('JGLOBAL_TITLE_ASC'),
'a.title DESC' => \JText::_('JGLOBAL_TITLE_DESC'),
'a.pull_id ASC' => \JText::_('COM_PATCHTESTER_PULL_ID_ASC'),
'a.pull_id DESC' => \JText::_('COM_PATCHTESTER_PULL_ID_DESC'),
'a.title ASC' => Text::_('JGLOBAL_TITLE_ASC'),
'a.title DESC' => Text::_('JGLOBAL_TITLE_DESC'),
'a.pull_id ASC' => Text::_('COM_PATCHTESTER_PULL_ID_ASC'),
'a.pull_id DESC' => Text::_('COM_PATCHTESTER_PULL_ID_DESC'),
);
}
}

View File

@ -6,99 +6,103 @@
* @license GNU General Public License version 2 or later
*/
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
/** @var \PatchTester\View\Pulls\PullsHtmlView $this */
\JHtml::_('behavior.core');
\JHtml::_('bootstrap.tooltip');
\JHtml::_('formbehavior.chosen', 'select');
\JHtml::_('stylesheet', 'com_patchtester/octicons.css', array('version' => '3.5.0', 'relative' => true));
\JHtml::_('script', 'com_patchtester/patchtester.js', array('version' => 'auto', 'relative' => true));
HTMLHelper::_('behavior.core');
HTMLHelper::_('bootstrap.tooltip');
HTMLHelper::_('formbehavior.chosen', 'select');
HTMLHelper::_('stylesheet', 'com_patchtester/octicons.css', array('version' => '3.5.0', 'relative' => true));
HTMLHelper::_('script', 'com_patchtester/patchtester.js', array('version' => 'auto', 'relative' => true));
$listOrder = $this->escape($this->state->get('list.fullordering', 'a.pull_id DESC'));
$filterApplied = $this->escape($this->state->get('filter.applied'));
$filterBranch = $this->escape($this->state->get('filter.branch'));
$filterRtc = $this->escape($this->state->get('filter.rtc'));
?>
<form action="<?php echo \JRoute::_('index.php?option=com_patchtester&view=pulls'); ?>" method="post" name="adminForm" id="adminForm" data-order="<?php echo $listOrder; ?>">
<form action="<?php echo Route::_('index.php?option=com_patchtester&view=pulls'); ?>" method="post" name="adminForm" id="adminForm" data-order="<?php echo $listOrder; ?>">
<div id="j-main-container">
<div id="filter-bar" class="btn-toolbar">
<div class="filter-search btn-group pull-left">
<label for="filter_search" class="element-invisible"><?php echo \JText::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION'); ?></label>
<input type="text" name="filter_search" placeholder="<?php echo \JText::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION'); ?>" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" title="<?php echo \JText::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION'); ?>" />
<label for="filter_search" class="element-invisible"><?php echo Text::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION'); ?></label>
<input type="text" name="filter_search" placeholder="<?php echo Text::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION'); ?>" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" title="<?php echo Text::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION'); ?>" />
</div>
<div class="btn-group pull-left hidden-phone">
<button class="btn tip hasTooltip" type="submit" title="<?php echo \JText::_('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
<button class="btn tip hasTooltip" type="button" onclick="document.getElementById('filter_search').value='';this.form.submit();" title="<?php echo \JText::_('JSEARCH_FILTER_CLEAR'); ?>"><i class="icon-remove"></i></button>
<button class="btn tip hasTooltip" type="submit" title="<?php echo Text::_('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
<button class="btn tip hasTooltip" type="button" onclick="document.getElementById('filter_search').value='';this.form.submit();" title="<?php echo Text::_('JSEARCH_FILTER_CLEAR'); ?>"><i class="icon-remove"></i></button>
</div>
<div class="btn-group pull-right hidden-phone">
<label for="limit" class="element-invisible"><?php echo \JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC'); ?></label>
<label for="limit" class="element-invisible"><?php echo Text::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC'); ?></label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<div class="btn-group pull-right">
<label for="list_fullordering" class="element-invisible"><?php echo \JText::_('JGLOBAL_SORT_BY'); ?></label>
<label for="list_fullordering" class="element-invisible"><?php echo Text::_('JGLOBAL_SORT_BY'); ?></label>
<select name="list_fullordering" id="list_fullordering" class="input-medium" onchange="this.form.submit();">
<option value=""><?php echo \JText::_('JGLOBAL_SORT_BY'); ?></option>
<?php echo \JHtml::_('select.options', $this->getSortFields(), 'value', 'text', $listOrder);?>
<option value=""><?php echo Text::_('JGLOBAL_SORT_BY'); ?></option>
<?php echo HTMLHelper::_('select.options', $this->getSortFields(), 'value', 'text', $listOrder);?>
</select>
</div>
<div class="btn-group pull-right">
<label for="filter_applied" class="element-invisible"><?php echo \JText::_('JSEARCH_TOOLS_DESC'); ?></label>
<label for="filter_applied" class="element-invisible"><?php echo Text::_('JSEARCH_TOOLS_DESC'); ?></label>
<select name="filter_applied" class="input-medium" onchange="this.form.submit();">
<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>
<option value=""><?php echo Text::_('COM_PATCHTESTER_FILTER_APPLIED_PATCHES'); ?></option>
<option value="yes"<?php if ($filterApplied == 'yes') echo ' selected="selected"'; ?>><?php echo Text::_('COM_PATCHTESTER_APPLIED'); ?></option>
<option value="no"<?php if ($filterApplied == 'no') echo ' selected="selected"'; ?>><?php echo Text::_('COM_PATCHTESTER_NOT_APPLIED'); ?></option>
</select>
</div>
<div class="btn-group pull-right">
<label for="filter_rtc" class="element-invisible"><?php echo \JText::_('JSEARCH_TOOLS_DESC'); ?></label>
<label for="filter_rtc" class="element-invisible"><?php echo Text::_('JSEARCH_TOOLS_DESC'); ?></label>
<select name="filter_rtc" class="input-medium" onchange="this.form.submit();">
<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>
<option value=""><?php echo Text::_('COM_PATCHTESTER_FILTER_RTC_PATCHES'); ?></option>
<option value="yes"<?php if ($filterRtc == 'yes') echo ' selected="selected"'; ?>><?php echo Text::_('COM_PATCHTESTER_RTC'); ?></option>
<option value="no"<?php if ($filterRtc == 'no') echo ' selected="selected"'; ?>><?php echo Text::_('COM_PATCHTESTER_NOT_RTC'); ?></option>
</select>
</div>
<div class="btn-group pull-right">
<label for="filter_branch" class="element-invisible"><?php echo \JText::_('JSEARCH_TOOLS_DESC'); ?></label>
<label for="filter_branch" class="element-invisible"><?php echo Text::_('JSEARCH_TOOLS_DESC'); ?></label>
<select name="filter_branch" class="input-medium" onchange="this.form.submit();">
<option value=""><?php echo \JText::_('COM_PATCHTESTER_FILTER_BRANCH'); ?></option>
<?php echo \JHtml::_('select.options', $this->branches, 'text', 'text', $filterBranch, false);?>
<option value=""><?php echo Text::_('COM_PATCHTESTER_FILTER_BRANCH'); ?></option>
<?php echo HTMLHelper::_('select.options', $this->branches, 'text', 'text', $filterBranch, false);?>
</select>
</div>
</div>
<?php if (empty($this->items)) : ?>
<div class="alert alert-no-items">
<?php echo \JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div>
<?php else : ?>
<table class="table table-striped">
<thead>
<tr>
<th width="5%" class="nowrap center">
<?php echo \JText::_('COM_PATCHTESTER_PULL_ID'); ?>
<?php echo Text::_('COM_PATCHTESTER_PULL_ID'); ?>
</th>
<th class="nowrap">
<?php echo \JText::_('JGLOBAL_TITLE'); ?>
<?php echo Text::_('JGLOBAL_TITLE'); ?>
</th>
<th width="8%" class="nowrap center hidden-phone">
<?php echo \JText::_('COM_PATCHTESTER_BRANCH'); ?>
<?php echo Text::_('COM_PATCHTESTER_BRANCH'); ?>
</th>
<th width="8%" class="nowrap center hidden-phone">
<?php echo \JText::_('COM_PATCHTESTER_READY_TO_COMMIT'); ?>
<?php echo Text::_('COM_PATCHTESTER_READY_TO_COMMIT'); ?>
</th>
<th width="8%" class="nowrap center">
<?php echo \JText::_('COM_PATCHTESTER_GITHUB'); ?>
<?php echo Text::_('COM_PATCHTESTER_GITHUB'); ?>
</th>
<?php if ($this->trackerAlias !== false) : ?>
<th width="8%" class="nowrap center">
<?php echo \JText::_('COM_PATCHTESTER_JISSUES'); ?>
<?php echo Text::_('COM_PATCHTESTER_JISSUES'); ?>
</th>
<?php endif; ?>
<th width="10%" class="nowrap center">
<?php echo \JText::_('JSTATUS'); ?>
<?php echo Text::_('JSTATUS'); ?>
</th>
<th width="15%" class="nowrap center">
<?php echo \JText::_('COM_PATCHTESTER_TEST_THIS_PATCH'); ?>
<?php echo Text::_('COM_PATCHTESTER_TEST_THIS_PATCH'); ?>
</th>
</tr>
</thead>
@ -113,6 +117,6 @@ $filterRtc = $this->escape($this->state->get('filter.rtc'));
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="pull_id" id="pull_id" value="" />
<?php echo \JHtml::_('form.token'); ?>
<?php echo HTMLHelper::_('form.token'); ?>
</div>
</form>

View File

@ -6,6 +6,8 @@
* @license GNU General Public License version 2 or later
*/
use Joomla\CMS\Language\Text;
/** @var \PatchTester\View\DefaultHtmlView $this */
foreach ($this->items as $i => $item) :
@ -23,7 +25,7 @@ foreach ($this->items as $i => $item) :
<span class="hasTooltip" title="<strong>Info</strong><br/><?php echo $this->escape($item->description); ?>"><?php echo $this->escape($item->title); ?></span>
<?php if ($item->applied) : ?>
<div class="small">
<span class="label label-info"><?php echo \JText::sprintf('COM_PATCHTESTER_APPLIED_COMMIT_SHA', substr($item->sha, 0, 10)); ?></span>
<span class="label label-info"><?php echo Text::sprintf('COM_PATCHTESTER_APPLIED_COMMIT_SHA', substr($item->sha, 0, 10)); ?></span>
</div>
<?php endif; ?>
</td>
@ -32,39 +34,39 @@ foreach ($this->items as $i => $item) :
</td>
<td class="center hidden-phone">
<?php if ($item->is_rtc) : ?>
<span class="label label-success"><?php echo \JText::_('JYES'); ?></span>
<span class="label label-success"><?php echo Text::_('JYES'); ?></span>
<?php else : ?>
<span class="label label-primary"><?php echo \JText::_('JNO'); ?></span>
<span class="label label-primary"><?php echo Text::_('JNO'); ?></span>
<?php endif; ?>
</td>
<td class="center">
<a class="btn btn-small btn-info" href="<?php echo $item->pull_url; ?>" target="_blank">
<span class="octicon octicon-mark-github"></span> <?php echo \JText::_('COM_PATCHTESTER_GITHUB'); ?>
<span class="octicon octicon-mark-github"></span> <?php echo Text::_('COM_PATCHTESTER_GITHUB'); ?>
</a>
</td>
<?php if ($this->trackerAlias !== false) : ?>
<td class="center">
<a class="btn btn-small btn-warning" href="https://issues.joomla.org/tracker/<?php echo $this->trackerAlias; ?>/<?php echo $item->pull_id; ?>" target="_blank">
<i class="icon-joomla"></i> <?php echo \JText::_('COM_PATCHTESTER_JISSUE'); ?>
<i class="icon-joomla"></i> <?php echo Text::_('COM_PATCHTESTER_JISSUE'); ?>
</a>
</td>
<?php endif; ?>
<td class="center">
<?php if ($item->applied) : ?>
<div>
<span class="label label-success"><?php echo \JText::_('COM_PATCHTESTER_APPLIED'); ?></span>
<span class="label label-success"><?php echo Text::_('COM_PATCHTESTER_APPLIED'); ?></span>
</div>
<?php else : ?>
<span class="label">
<?php echo \JText::_('COM_PATCHTESTER_NOT_APPLIED'); ?>
<?php echo Text::_('COM_PATCHTESTER_NOT_APPLIED'); ?>
</span>
<?php endif; ?>
</td>
<td class="center">
<?php if ($item->applied) : ?>
<a class="btn btn-small btn-success" href="javascript:PatchTester.submitpatch('revert', '<?php echo (int) $item->applied; ?>');"><?php echo \JText::_('COM_PATCHTESTER_REVERT_PATCH'); ?></a><br />
<a class="btn btn-small btn-success" href="javascript:PatchTester.submitpatch('revert', '<?php echo (int) $item->applied; ?>');"><?php echo Text::_('COM_PATCHTESTER_REVERT_PATCH'); ?></a><br />
<?php else : ?>
<a class="btn btn-small btn-primary" href="javascript:PatchTester.submitpatch('apply', '<?php echo (int) $item->pull_id; ?>');"><?php echo \JText::_('COM_PATCHTESTER_APPLY_PATCH'); ?></a>
<a class="btn btn-small btn-primary" href="javascript:PatchTester.submitpatch('apply', '<?php echo (int) $item->pull_id; ?>');"><?php echo Text::_('COM_PATCHTESTER_APPLY_PATCH'); ?></a>
<?php endif; ?>
</td>
</tr>

View File

@ -6,10 +6,12 @@
* @license GNU General Public License version 2 or later
*/
use Joomla\CMS\Language\Text;
/** @var \PatchTester\View\Pulls\PullsHtmlView $this */
?>
<h3><?php echo \JText::_('COM_PATCHTESTER_REQUIREMENTS_HEADING'); ?></h3>
<p><?php echo \JText::_('COM_PATCHTESTER_REQUIREMENTS_NOT_MET'); ?></p>
<h3><?php echo Text::_('COM_PATCHTESTER_REQUIREMENTS_HEADING'); ?></h3>
<p><?php echo Text::_('COM_PATCHTESTER_REQUIREMENTS_NOT_MET'); ?></p>
<ul>
<?php foreach ($this->envErrors as $error) : ?>
<li><?php echo $error; ?></li>

View File

@ -9,11 +9,12 @@
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
// Access check.
if (!Factory::getUser()->authorise('core.manage', 'com_patchtester'))
{
throw new RuntimeException(JText::_('JERROR_ALERTNOAUTHOR'), 403);
throw new RuntimeException(Text::_('JERROR_ALERTNOAUTHOR'), 403);
}
// Application reference
@ -35,7 +36,7 @@ $class = '\\PatchTester\\Controller\\' . ucfirst(strtolower($task)) . 'Controlle
if (!class_exists($class))
{
throw new InvalidArgumentException(JText::sprintf('JLIB_APPLICATION_ERROR_INVALID_CONTROLLER_CLASS', $class), 404);
throw new InvalidArgumentException(Text::sprintf('JLIB_APPLICATION_ERROR_INVALID_CONTROLLER_CLASS', $class), 404);
}
// Instantiate and execute the controller

View File

@ -7,8 +7,10 @@
*/
use Joomla\CMS\Factory;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Installer\Adapter\ComponentAdapter;
use Joomla\CMS\Installer\InstallerScript;
use Joomla\CMS\Language\Text;
/**
* Installation class to perform additional changes during install/uninstall/update
@ -88,8 +90,6 @@ class Com_PatchtesterInstallerScript extends InstallerScript
*/
public function uninstall($parent)
{
jimport('joomla.filesystem.folder');
// Initialize the error array
$errorTemplates = array();
@ -104,7 +104,7 @@ class Com_PatchtesterInstallerScript extends InstallerScript
if (is_dir($tmplRoot))
{
// If there's a failure in copying the overrides, log it to the error array
if (!JFolder::delete($overrideFolder))
if (Folder::delete($overrideFolder))
{
$errorTemplates[] = ucfirst($template);
}
@ -114,7 +114,7 @@ class Com_PatchtesterInstallerScript extends InstallerScript
// If we couldn't remove any overrides, notify the user
if (count($errorTemplates) > 0)
{
Factory::getApplication()->enqueueMessage(JText::sprintf('COM_PATCHTESTER_COULD_NOT_REMOVE_OVERRIDES', implode(', ', $errorTemplates)));
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_PATCHTESTER_COULD_NOT_REMOVE_OVERRIDES', implode(', ', $errorTemplates)));
}
}
@ -142,8 +142,6 @@ class Com_PatchtesterInstallerScript extends InstallerScript
*/
private function copyLayouts()
{
jimport('joomla.filesystem.folder');
// Initialize the error array
$errorTemplates = array();
@ -161,7 +159,7 @@ class Com_PatchtesterInstallerScript extends InstallerScript
// If there's a failure in copying the overrides, log it to the error array
try
{
if (!JFolder::copy($source, $destination, '', true))
if (Folder::copy($source, $destination, '', true))
{
$errorTemplates[] = ucfirst($template);
}
@ -176,7 +174,7 @@ class Com_PatchtesterInstallerScript extends InstallerScript
// If we couldn't remove any overrides, notify the user
if (count($errorTemplates) > 0)
{
Factory::getApplication()->enqueueMessage(JText::sprintf('COM_PATCHTESTER_COULD_NOT_INSTALL_OVERRIDES', implode(', ', $errorTemplates)));
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_PATCHTESTER_COULD_NOT_INSTALL_OVERRIDES', implode(', ', $errorTemplates)));
}
}
}

View File

@ -7,18 +7,20 @@
*/
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
/** @var \PatchTester\View\DefaultHtmlView $this */
\JHtml::_('jquery.framework');
\JHtml::_('behavior.core');
\JHtml::_('script', 'com_patchtester/fetcher.js', array('version' => 'auto', 'relative' => true));
HTMLHelper::_('jquery.framework');
HTMLHelper::_('behavior.core');
HTMLHelper::_('script', 'com_patchtester/fetcher.js', array('version' => 'auto', 'relative' => true));
?>
<div id="patchtester-container">
<h1 id="patchtester-progress-header"><?php echo \JText::_('COM_PATCHTESTER_FETCH_INITIALIZING'); ?></h1>
<p id="patchtester-progress-message"><?php echo \JText::_('COM_PATCHTESTER_FETCH_INITIALIZING_DESCRIPTION'); ?></p>
<h1 id="patchtester-progress-header"><?php echo Text::_('COM_PATCHTESTER_FETCH_INITIALIZING'); ?></h1>
<p id="patchtester-progress-message"><?php echo Text::_('COM_PATCHTESTER_FETCH_INITIALIZING_DESCRIPTION'); ?></p>
<div id="progress" class="progress">
<div id="progress-bar" class="progress-bar progress-bar-striped progress-bar-animated bg-success" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" role="progressbar"></div>
</div>

View File

@ -6,12 +6,17 @@
* @license GNU General Public License version 2 or later
*/
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
/** @var \PatchTester\View\Pulls\PullsHtmlView $this */
$searchToolsOptions = array(
'filtersHidden' => true,
'filterButton' => true,
'defaultLimit' => JFactory::getApplication()->get('list_limit', 20),
'defaultLimit' => Factory::getApplication()->get('list_limit', 20),
'searchFieldSelector' => '#filter_search',
'selectorFieldName' => 'client_id',
'showSelector' => false,
@ -21,10 +26,10 @@ $searchToolsOptions = array(
'formSelector' => '#adminForm',
);
\JHtml::_('behavior.core');
\JHtml::_('searchtools.form', '#adminForm', $searchToolsOptions);
\JHtml::_('stylesheet', 'com_patchtester/octicons.css', array('version' => '3.5.0', 'relative' => true));
\JHtml::_('script', 'com_patchtester/patchtester.js', array('version' => 'auto', 'relative' => true));
HTMLHelper::_('behavior.core');
HTMLHelper::_('searchtools.form', '#adminForm', $searchToolsOptions);
HTMLHelper::_('stylesheet', 'com_patchtester/octicons.css', array('version' => '3.5.0', 'relative' => true));
HTMLHelper::_('script', 'com_patchtester/patchtester.js', array('version' => 'auto', 'relative' => true));
$listOrder = $this->escape($this->state->get('list.fullordering', 'a.pull_id DESC'));
$listLimit = (int) ($this->state->get('list.limit'));
@ -32,7 +37,7 @@ $filterApplied = $this->escape($this->state->get('filter.applied'));
$filterBranch = $this->escape($this->state->get('filter.branch'));
$filterRtc = $this->escape($this->state->get('filter.rtc'));
?>
<form action="<?php echo \JRoute::_('index.php?option=com_patchtester&view=pulls'); ?>" method="post" name="adminForm" id="adminForm">
<form action="<?php echo Route::_('index.php?option=com_patchtester&view=pulls'); ?>" method="post" name="adminForm" id="adminForm">
<div class="row">
<div class="col-md-12">
<div id="j-main-container" class="j-main-container">
@ -42,14 +47,14 @@ $filterRtc = $this->escape($this->state->get('filter.rtc'));
<div class="btn-group mr-2">
<div class="input-group">
<label for="filter_search" class="sr-only">
<?php echo \JText::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION'); ?>
<?php echo Text::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION'); ?>
</label>
<input type="text" name="filter_search" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="form-control" placeholder="<?php echo \JText::_('JSEARCH_FILTER'); ?>">
<input type="text" name="filter_search" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="form-control" placeholder="<?php echo Text::_('JSEARCH_FILTER'); ?>">
<div role="tooltip" id="filter_search-desc">
<?php echo $this->escape(\JText::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION')); ?>
<?php echo $this->escape(Text::_('COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION')); ?>
</div>
<span class="input-group-append">
<button type="submit" class="btn btn-primary" aria-label="<?php echo \JText::_('JSEARCH_FILTER_SUBMIT'); ?>">
<button type="submit" class="btn btn-primary" aria-label="<?php echo Text::_('JSEARCH_FILTER_SUBMIT'); ?>">
<span class="fa fa-search" aria-hidden="true"></span>
</button>
</span>
@ -57,18 +62,18 @@ $filterRtc = $this->escape($this->state->get('filter.rtc'));
</div>
<div class="btn-group">
<button type="button" class="btn btn-primary hasTooltip js-stools-btn-filter">
<?php echo \JText::_('JFILTER_OPTIONS'); ?>
<?php echo Text::_('JFILTER_OPTIONS'); ?>
<span class="fa fa-angle-down" aria-hidden="true"></span>
</button>
<button type="button" class="btn btn-primary js-stools-btn-clear mr-2">
<?php echo \JText::_('JSEARCH_FILTER_CLEAR'); ?>
<?php echo Text::_('JSEARCH_FILTER_CLEAR'); ?>
</button>
</div>
<div class="ordering-select">
<div class="js-stools-field-list">
<select name="list_fullordering" id="list_fullordering" class="custom-select" onchange="this.form.submit()">
<option value=""><?php echo \JText::_('JGLOBAL_SORT_BY'); ?></option>
<?php echo \JHtml::_('select.options', $this->getSortFields(), 'value', 'text', $listOrder); ?>
<option value=""><?php echo Text::_('JGLOBAL_SORT_BY'); ?></option>
<?php echo HTMLHelper::_('select.options', $this->getSortFields(), 'value', 'text', $listOrder); ?>
</select>
</div>
<div class="js-stools-field-list">
@ -76,7 +81,7 @@ $filterRtc = $this->escape($this->state->get('filter.rtc'));
<label id="list_limit-lbl" for="list_limit">Select number of items per page.</label>
</span>
<select name="list_limit" id="list_limit" class="custom-select" onchange="this.form.submit()">
<?php echo \JHtml::_('select.options', $this->getLimitOptions(), 'value', 'text', $listLimit); ?>
<?php echo HTMLHelper::_('select.options', $this->getLimitOptions(), 'value', 'text', $listLimit); ?>
</select>
</div>
</div>
@ -86,22 +91,22 @@ $filterRtc = $this->escape($this->state->get('filter.rtc'));
<div class="js-stools-container-filters clearfix">
<div class="js-stools-field-filter">
<select name="filter_applied" class="custom-select" onchange="this.form.submit();">
<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>
<option value=""><?php echo Text::_('COM_PATCHTESTER_FILTER_APPLIED_PATCHES'); ?></option>
<option value="yes"<?php if ($filterApplied == 'yes') echo ' selected="selected"'; ?>><?php echo Text::_('COM_PATCHTESTER_APPLIED'); ?></option>
<option value="no"<?php if ($filterApplied == 'no') echo ' selected="selected"'; ?>><?php echo Text::_('COM_PATCHTESTER_NOT_APPLIED'); ?></option>
</select>
</div>
<div class="js-stools-field-filter">
<select name="filter_rtc" class="custom-select" onchange="this.form.submit();">
<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>
<option value=""><?php echo Text::_('COM_PATCHTESTER_FILTER_RTC_PATCHES'); ?></option>
<option value="yes"<?php if ($filterRtc == 'yes') echo ' selected="selected"'; ?>><?php echo Text::_('COM_PATCHTESTER_RTC'); ?></option>
<option value="no"<?php if ($filterRtc == 'no') echo ' selected="selected"'; ?>><?php echo Text::_('COM_PATCHTESTER_NOT_RTC'); ?></option>
</select>
</div>
<div class="js-stools-field-filter">
<select name="filter_branch" class="custom-select" onchange="this.form.submit();">
<option value=""><?php echo \JText::_('COM_PATCHTESTER_FILTER_BRANCH'); ?></option>
<?php echo \JHtml::_('select.options', $this->branches, 'text', 'text', $filterBranch, false); ?>
<option value=""><?php echo Text::_('COM_PATCHTESTER_FILTER_BRANCH'); ?></option>
<?php echo HTMLHelper::_('select.options', $this->branches, 'text', 'text', $filterBranch, false); ?>
</select>
</div>
</div>
@ -109,33 +114,33 @@ $filterRtc = $this->escape($this->state->get('filter.rtc'));
<div id="j-main-container" class="j-main-container">
<?php if (empty($this->items)) : ?>
<div class="alert alert-info">
<span class="fa fa-info-circle" aria-hidden="true"></span><span class="sr-only"><?php echo \JText::_('INFO'); ?></span>
<?php echo \JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
<span class="fa fa-info-circle" aria-hidden="true"></span><span class="sr-only"><?php echo Text::_('INFO'); ?></span>
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div>
<?php else : ?>
<table class="table">
<caption id="captionTable" class="sr-only">
<?php echo \JText::_('COM_PATCHTESTER_PULLS_TABLE_CAPTION'); ?>, <?php echo \JText::_('JGLOBAL_SORTED_BY'); ?>
<?php echo Text::_('COM_PATCHTESTER_PULLS_TABLE_CAPTION'); ?>, <?php echo Text::_('JGLOBAL_SORTED_BY'); ?>
</caption>
<thead>
<tr>
<th scope="col" style="width:5%" class="text-center">
<?php echo \JText::_('COM_PATCHTESTER_PULL_ID'); ?>
<?php echo Text::_('COM_PATCHTESTER_PULL_ID'); ?>
</th>
<th scope="col" style="min-width:100px">
<?php echo \JText::_('JGLOBAL_TITLE'); ?>
<?php echo Text::_('JGLOBAL_TITLE'); ?>
</th>
<th scope="col" style="width:8%" class="d-none d-md-table-cell text-center">
<?php echo \JText::_('COM_PATCHTESTER_BRANCH'); ?>
<?php echo Text::_('COM_PATCHTESTER_BRANCH'); ?>
</th>
<th scope="col" style="width:8%" class="d-none d-md-table-cell text-center">
<?php echo \JText::_('COM_PATCHTESTER_READY_TO_COMMIT'); ?>
<?php echo Text::_('COM_PATCHTESTER_READY_TO_COMMIT'); ?>
</th>
<th scope="col" style="width:10%" class="text-center">
<?php echo \JText::_('JSTATUS'); ?>
<?php echo Text::_('JSTATUS'); ?>
</th>
<th scope="col" style="width:15%" class="text-center">
<?php echo \JText::_('COM_PATCHTESTER_TEST_THIS_PATCH'); ?>
<?php echo Text::_('COM_PATCHTESTER_TEST_THIS_PATCH'); ?>
</th>
</tr>
</thead>
@ -150,7 +155,7 @@ $filterRtc = $this->escape($this->state->get('filter.rtc'));
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="pull_id" id="pull_id" value="" />
<?php echo \JHtml::_('form.token'); ?>
<?php echo HTMLHelper::_('form.token'); ?>
</div>
</div>
</div>

View File

@ -6,6 +6,8 @@
* @license GNU General Public License version 2 or later
*/
use Joomla\CMS\Language\Text;
/** @var \PatchTester\View\DefaultHtmlView $this */
foreach ($this->items as $i => $item) :
@ -27,17 +29,17 @@ foreach ($this->items as $i => $item) :
<div class="row">
<div class="col-md-auto">
<a class="badge badge-info" href="<?php echo $item->pull_url; ?>" target="_blank">
<?php echo \JText::_('COM_PATCHTESTER_VIEW_ON_GITHUB'); ?>
<?php echo Text::_('COM_PATCHTESTER_VIEW_ON_GITHUB'); ?>
</a>
</div>
<div class="col-md-auto">
<a class="badge badge-info" href="https://issues.joomla.org/tracker/<?php echo $this->trackerAlias; ?>/<?php echo $item->pull_id; ?>" target="_blank">
<?php echo \JText::_('COM_PATCHTESTER_VIEW_ON_JOOMLA_ISSUE_TRACKER'); ?>
<?php echo Text::_('COM_PATCHTESTER_VIEW_ON_JOOMLA_ISSUE_TRACKER'); ?>
</a>
</div>
<?php if ($item->applied) : ?>
<div class="col-md-auto">
<span class="badge badge-info"><?php echo \JText::sprintf('COM_PATCHTESTER_APPLIED_COMMIT_SHA', substr($item->sha, 0, 10)); ?></span>
<span class="badge badge-info"><?php echo Text::sprintf('COM_PATCHTESTER_APPLIED_COMMIT_SHA', substr($item->sha, 0, 10)); ?></span>
</div>
<?php endif; ?>
</div>
@ -47,23 +49,23 @@ foreach ($this->items as $i => $item) :
</td>
<td class="d-none d-md-table-cell text-center">
<?php if ($item->is_rtc) : ?>
<span class="badge badge-success"><?php echo \JText::_('JYES'); ?></span>
<span class="badge badge-success"><?php echo Text::_('JYES'); ?></span>
<?php else : ?>
<span class="badge badge-secondary"><?php echo \JText::_('JNO'); ?></span>
<span class="badge badge-secondary"><?php echo Text::_('JNO'); ?></span>
<?php endif; ?>
</td>
<td class="text-center">
<?php if ($item->applied) : ?>
<span class="badge badge-success"><?php echo \JText::_('COM_PATCHTESTER_APPLIED'); ?></span>
<span class="badge badge-success"><?php echo Text::_('COM_PATCHTESTER_APPLIED'); ?></span>
<?php else : ?>
<span class="badge badge-secondary"><?php echo \JText::_('COM_PATCHTESTER_NOT_APPLIED'); ?></span>
<span class="badge badge-secondary"><?php echo Text::_('COM_PATCHTESTER_NOT_APPLIED'); ?></span>
<?php endif; ?>
</td>
<td class="text-center">
<?php if ($item->applied) : ?>
<button class="btn btn-sm btn-success" onclick="PatchTester.submitpatch('revert', '<?php echo (int) $item->applied; ?>');"><?php echo \JText::_('COM_PATCHTESTER_REVERT_PATCH'); ?></button>
<button class="btn btn-sm btn-success" onclick="PatchTester.submitpatch('revert', '<?php echo (int) $item->applied; ?>');"><?php echo Text::_('COM_PATCHTESTER_REVERT_PATCH'); ?></button>
<?php else : ?>
<button class="btn btn-sm btn-primary" onclick="PatchTester.submitpatch('apply', '<?php echo (int) $item->pull_id; ?>');"><?php echo \JText::_('COM_PATCHTESTER_APPLY_PATCH'); ?></button>
<button class="btn btn-sm btn-primary" onclick="PatchTester.submitpatch('apply', '<?php echo (int) $item->pull_id; ?>');"><?php echo Text::_('COM_PATCHTESTER_APPLY_PATCH'); ?></button>
<?php endif; ?>
</td>
</tr>