Skip to content

Commit

Permalink
Merge branch '4.0-dev' into ns-front-contact
Browse files Browse the repository at this point in the history
  • Loading branch information
brianteeman committed Jun 28, 2018
2 parents 0bc66c2 + c52c23e commit 77cb5c4
Show file tree
Hide file tree
Showing 35 changed files with 278 additions and 219 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ CREATE TABLE IF NOT EXISTS `#__csp` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;

INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`, `namespace`) VALUES
(35, 'com_csp', 'component', 'com_csp', '', 0, 0, 1, 0, '', '{}', '', '', 0, '0000-00-00 00:00:00', 0, 0, 'Joomla\\Component\\Csp');
INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `checked_out`, `checked_out_time`, `ordering`, `state`, `namespace`) VALUES
(35, 'com_csp', 'component', 'com_csp', '', 0, 0, 1, 0, '', '{}', 0, '0000-00-00 00:00:00', 0, 0, 'Joomla\\Component\\Csp');
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ CREATE TABLE IF NOT EXISTS "#__csp" (
PRIMARY KEY ("id")
);

INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state", "namespace") VALUES
(35, 'com_csp', 'component', 'com_csp', ' ', 0, 0, 1, 0, '', '{}', '', '', 0, '1970-01-01 00:00:00', 0, 0, 'Joomla\\Component\\Csp');
INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "checked_out", "checked_out_time", "ordering", "state", "namespace") VALUES
(35, 'com_csp', 'component', 'com_csp', ' ', 0, 0, 1, 0, '', '{}', 0, '1970-01-01 00:00:00', 0, 0, 'Joomla\\Component\\Csp');
42 changes: 25 additions & 17 deletions components/com_ajax/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@

defined('_JEXEC') or die;

use Joomla\CMS\Response\JsonResponse;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Log\Log;
use Joomla\CMS\Table\Table;
use Joomla\CMS\Helper\ModuleHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;

/*
* References
* Support plugins in your component
Expand All @@ -19,7 +27,7 @@
*/

// Reference global application object
$app = JFactory::getApplication();
$app = Factory::getApplication();

// JInput object
$input = $app->input;
Expand All @@ -34,7 +42,7 @@
// Check for valid format
if (!$format)
{
$results = new InvalidArgumentException(JText::_('COM_AJAX_SPECIFY_FORMAT'), 404);
$results = new InvalidArgumentException(Text::_('COM_AJAX_SPECIFY_FORMAT'), 404);
}
/*
* Module support.
Expand All @@ -47,10 +55,10 @@
elseif ($input->get('module'))
{
$module = $input->get('module');
$moduleObject = JModuleHelper::getModule('mod_' . $module, null);
$moduleObject = ModuleHelper::getModule('mod_' . $module, null);

/*
* As JModuleHelper::isEnabled always returns true, we check
* As ModuleHelper::isEnabled always returns true, we check
* for an id other than 0 to see if it is published.
*/
if ($moduleObject->id != 0)
Expand Down Expand Up @@ -92,7 +100,7 @@
{
// Load language file for module
$basePath = JPATH_BASE;
$lang = JFactory::getLanguage();
$lang = Factory::getLanguage();
$lang->load('mod_' . $module, $basePath, null, false, true)
|| $lang->load('mod_' . $module, $basePath . '/modules/mod_' . $module, null, false, true);

Expand All @@ -108,19 +116,19 @@
// Method does not exist
else
{
$results = new LogicException(JText::sprintf('COM_AJAX_METHOD_NOT_EXISTS', $method . 'Ajax'), 404);
$results = new LogicException(Text::sprintf('COM_AJAX_METHOD_NOT_EXISTS', $method . 'Ajax'), 404);
}
}
// The helper file does not exist
else
{
$results = new RuntimeException(JText::sprintf('COM_AJAX_FILE_NOT_EXISTS', 'mod_' . $module . '/helper.php'), 404);
$results = new RuntimeException(Text::sprintf('COM_AJAX_FILE_NOT_EXISTS', 'mod_' . $module . '/helper.php'), 404);
}
}
// Module is not published, you do not have access to it, or it is not assigned to the current menu item
else
{
$results = new LogicException(JText::sprintf('COM_AJAX_MODULE_NOT_ACCESSIBLE', 'mod_' . $module), 404);
$results = new LogicException(Text::sprintf('COM_AJAX_MODULE_NOT_ACCESSIBLE', 'mod_' . $module), 404);
}
}
/*
Expand All @@ -135,12 +143,12 @@
elseif ($input->get('plugin'))
{
$group = $input->get('group', 'ajax');
JPluginHelper::importPlugin($group);
PluginHelper::importPlugin($group);
$plugin = ucfirst($input->get('plugin'));

try
{
$results = JFactory::getApplication()->triggerEvent('onAjax' . $plugin);
$results = Factory::getApplication()->triggerEvent('onAjax' . $plugin);
}
catch (Exception $e)
{
Expand All @@ -158,7 +166,7 @@
elseif ($input->get('template'))
{
$template = $input->get('template');
$table = JTable::getInstance('extension');
$table = Table::getInstance('extension');
$templateId = $table->find(array('type' => 'template', 'element' => $template));

if ($templateId && $table->load($templateId) && $table->enabled)
Expand Down Expand Up @@ -200,7 +208,7 @@
if (method_exists($class, $method . 'Ajax'))
{
// Load language file for template
$lang = JFactory::getLanguage();
$lang = Factory::getLanguage();
$lang->load('tpl_' . $template, $basePath, null, false, true)
|| $lang->load('tpl_' . $template, $basePath . '/templates/' . $template, null, false, true);

Expand All @@ -216,19 +224,19 @@
// Method does not exist
else
{
$results = new LogicException(JText::sprintf('COM_AJAX_METHOD_NOT_EXISTS', $method . 'Ajax'), 404);
$results = new LogicException(Text::sprintf('COM_AJAX_METHOD_NOT_EXISTS', $method . 'Ajax'), 404);
}
}
// The helper file does not exist
else
{
$results = new RuntimeException(JText::sprintf('COM_AJAX_FILE_NOT_EXISTS', 'tpl_' . $template . '/helper.php'), 404);
$results = new RuntimeException(Text::sprintf('COM_AJAX_FILE_NOT_EXISTS', 'tpl_' . $template . '/helper.php'), 404);
}
}
// Template is not assigned to the current menu item
else
{
$results = new LogicException(JText::sprintf('COM_AJAX_TEMPLATE_NOT_ACCESSIBLE', 'tpl_' . $template), 404);
$results = new LogicException(Text::sprintf('COM_AJAX_TEMPLATE_NOT_ACCESSIBLE', 'tpl_' . $template), 404);
}
}

Expand All @@ -237,7 +245,7 @@
{
// JSONinzed
case 'json' :
echo new JResponseJson($results, null, false, $input->get('ignoreMessages', true, 'bool'));
echo new JsonResponse($results, null, false, $input->get('ignoreMessages', true, 'bool'));

break;

Expand All @@ -247,7 +255,7 @@
if ($results instanceof Exception)
{
// Log an error
JLog::add($results->getMessage(), JLog::ERROR);
Log::add($results->getMessage(), Log::ERROR);

// Set status header code
$app->setHeader('status', $results->getCode(), true);
Expand Down
8 changes: 5 additions & 3 deletions components/com_banners/Model/BannerModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Cache\Exception\CacheExceptionInterface;
use Joomla\CMS\Factory;

/**
* Banner model for the Joomla Banners component.
Expand Down Expand Up @@ -75,7 +77,7 @@ public function click()

if ($trackClicks > 0)
{
$trackDate = \JFactory::getDate()->format('Y-m-d H');
$trackDate = Factory::getDate()->format('Y-m-d H');

$query->clear()
->select($db->quoteName('count'))
Expand Down Expand Up @@ -146,7 +148,7 @@ public function &getItem()
if (!isset($this->_item))
{
/** @var \JCacheControllerCallback $cache */
$cache = \JFactory::getCache('com_banners', 'callback');
$cache = Factory::getCache('com_banners', 'callback');

$id = $this->getState('banner.id');

Expand Down Expand Up @@ -177,7 +179,7 @@ public function &getItem()
{
$this->_item = $cache->get($loader, array($id), md5(__METHOD__ . $id));
}
catch (\JCacheException $e)
catch (CacheExceptionInterface $e)
{
$this->_item = $loader($id);
}
Expand Down
19 changes: 11 additions & 8 deletions components/com_banners/Model/BannersModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\Registry\Registry;
use Joomla\Utilities\ArrayHelper;
use Joomla\Database\DatabaseQuery;
use Joomla\Database\Exception\ExecutionFailureException;
use Joomla\CMS\Factory;

/**
* Banners model for the Joomla Banners component.
Expand Down Expand Up @@ -48,9 +51,9 @@ protected function getStoreId($id = '')
}

/**
* Method to get a \JDatabaseQuery object for retrieving the data set from a database.
* Method to get a DatabaseQuery object for retrieving the data set from a database.
*
* @return \JDatabaseQuery A \JDatabaseQuery object to retrieve the data set.
* @return DatabaseQuery A DatabaseQuery object to retrieve the data set.
*
* @since 1.6
*/
Expand All @@ -65,7 +68,7 @@ protected function getListQuery()
$keywords = $this->getState('filter.keywords');
$randomise = ($ordering === 'random');
$nullDate = $db->quote($db->getNullDate());
$nowDate = $db->quote(\JFactory::getDate()->toSql());
$nowDate = $db->quote(Factory::getDate()->toSql());

$query->select(
'a.id as id,'
Expand Down Expand Up @@ -184,7 +187,7 @@ protected function getListQuery()
// Filter by language
if ($this->getState('filter.language'))
{
$query->where('a.language in (' . $db->quote(\JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
$query->where('a.language in (' . $db->quote(Factory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
}

$query->order('a.sticky DESC,' . ($randomise ? $query->Rand() : 'a.ordering'));
Expand Down Expand Up @@ -223,7 +226,7 @@ public function getItems()
*/
public function impress()
{
$trackDate = \JFactory::getDate()->format('Y-m-d H');
$trackDate = Factory::getDate()->format('Y-m-d H');
$items = $this->getItems();
$db = $this->getDbo();
$query = $db->getQuery(true);
Expand All @@ -249,7 +252,7 @@ public function impress()
{
$db->execute();
}
catch (\JDatabaseExceptionExecuting $e)
catch (ExecutionFailureException $e)
{
throw new \Exception($e->getMessage(), 500);
}
Expand Down Expand Up @@ -287,7 +290,7 @@ public function impress()
{
$db->execute();
}
catch (\JDatabaseExceptionExecuting $e)
catch (ExecutionFailureException $e)
{
throw new \Exception($e->getMessage(), 500);
}
Expand All @@ -312,7 +315,7 @@ public function impress()
{
$db->execute();
}
catch (\JDatabaseExceptionExecuting $e)
catch (ExecutionFailureException $e)
{
throw new \Exception($e->getMessage(), 500);
}
Expand Down
6 changes: 3 additions & 3 deletions components/com_content/tmpl/archive/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
?>
<div class="archive">
<div class="com-content-archive archive">
<?php if ($this->params->get('show_page_heading')) : ?>
<div class="page-header">
<h1>
<?php echo $this->escape($this->params->get('page_heading')); ?>
</h1>
</div>
<?php endif; ?>
<form id="adminForm" action="<?php echo JRoute::_('index.php'); ?>" method="post" class="form-inline">
<fieldset class="filters">
<form id="adminForm" action="<?php echo JRoute::_('index.php'); ?>" method="post" class="com-content-archive__form form-inline">
<fieldset class="com-content-archive__filters filters">
<div class="filter-search">
<?php if ($this->params->get('filter_field') !== 'hide') : ?>
<label class="filter-search-lbl sr-only" for="filter-search"><?php echo JText::_('COM_CONTENT_TITLE_FILTER_LABEL') . '&#160;'; ?></label>
Expand Down
13 changes: 7 additions & 6 deletions components/com_content/tmpl/archive/default_items.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
$params = $this->params;
?>

<div id="archive-items">
<div id="archive-items" class="com-content-archive__items">
<?php foreach ($this->items as $i => $item) : ?>
<?php $info = $item->params->get('info_block_position', 0); ?>
<div class="row<?php echo $i % 2; ?>" itemscope itemtype="https://schema.org/Article">
Expand Down Expand Up @@ -46,7 +46,7 @@
<?php $useDefList = ($params->get('show_modify_date') || $params->get('show_publish_date') || $params->get('show_create_date')
|| $params->get('show_hits') || $params->get('show_category') || $params->get('show_parent_category')); ?>
<?php if ($useDefList && ($info == 0 || $info == 2)) : ?>
<div class="article-info text-muted">
<div class="com-content-archive__info article-info text-muted">
<dl class="article-info">
<dt class="article-info-term">
<?php echo JText::_('COM_CONTENT_ARTICLE_INFO'); ?>
Expand Down Expand Up @@ -213,12 +213,13 @@
</div>
<?php endforeach; ?>
</div>
<div class="w-100">
<div class="com-content-archive__navigation w-100">
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter float-right pt-3 pr-2">
<p class="com-content-archive__counter counter float-right pt-3 pr-2">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php endif; ?>

<?php echo $this->pagination->getPagesLinks(); ?>
<div class="com-content-archive__pagination">
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
</div>
6 changes: 3 additions & 3 deletions components/com_content/tmpl/article/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// Check if associations are implemented. If they are, define the parameter.
$assocParam = (JLanguageAssociations::isEnabled() && $params->get('show_associations'));
?>
<div class="item-page<?php echo $this->pageclass_sfx; ?>" itemscope itemtype="https://schema.org/Article">
<div class="com-content-article item-page<?php echo $this->pageclass_sfx; ?>" itemscope itemtype="https://schema.org/Article">
<meta itemprop="inLanguage" content="<?php echo ($this->item->language === '*') ? JFactory::getConfig()->get('language') : $this->item->language; ?>">
<?php if ($this->params->get('show_page_heading')) : ?>
<div class="page-header">
Expand Down Expand Up @@ -104,7 +104,7 @@
<?php if (isset ($this->item->toc)) :
echo $this->item->toc;
endif; ?>
<div itemprop="articleBody">
<div itemprop="articleBody" class="com-content-article__body">
<?php echo $this->item->text; ?>
</div>

Expand Down Expand Up @@ -138,7 +138,7 @@
<?php $itemId = $active->id; ?>
<?php $link = new JUri(JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId, false)); ?>
<?php $link->setVar('return', base64_encode(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language))); ?>
<p class="readmore">
<p class="com-content-article__readmore readmore">
<a href="<?php echo $link; ?>" class="register">
<?php $attribs = json_decode($this->item->attribs); ?>
<?php
Expand Down
4 changes: 2 additions & 2 deletions components/com_content/tmpl/article/default_links.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
$params = $this->item->params;
if ($urls && (!empty($urls->urla) || !empty($urls->urlb) || !empty($urls->urlc))) :
?>
<div class="content-links">
<div class="com-content-article__links content-links">
<ul class="nav nav-tabs nav-stacked">
<?php
$urlarray = array(
Expand All @@ -40,7 +40,7 @@
// If no target is present, use the default
$target = $target ?: $params->get('target' . $id);
?>
<li class="content-links-<?php echo $id; ?>">
<li class="com-content-article__link content-links-<?php echo $id; ?>">
<?php
// Compute the correct link

Expand Down
2 changes: 1 addition & 1 deletion components/com_content/tmpl/categories/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
});
});");
?>
<div class="categories-list">
<div class="com-content-categories categories-list">
<?php
echo JLayoutHelper::render('joomla.content.categories_default', $this);
echo $this->loadTemplate('items');
Expand Down

0 comments on commit 77cb5c4

Please sign in to comment.