Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/upstream/4.0-dev' into j4/names…
Browse files Browse the repository at this point in the history
…pace/fields
  • Loading branch information
laoneo committed May 22, 2017
2 parents ee15b9c + f06e4af commit e0a8a66
Show file tree
Hide file tree
Showing 22 changed files with 391 additions and 308 deletions.
4 changes: 2 additions & 2 deletions components/com_contact/View/Contact/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
*/
namespace Joomla\Component\Contact\Site\View\Contact;

defined('_JEXEC') or die;

use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Helper\TagsHelper;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\View\HtmlView;
use Joomla\Component\Contact\Site\Helper\Route as ContactHelperRoute;

defined('_JEXEC') or die;

/**
* HTML Contact View class for the Contact component
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Content\Site\Controller;

defined('_JEXEC') or die;

use Joomla\CMS\Controller\Form;
use Joomla\CMS\Language\Multilanguage;
use Joomla\Utilities\ArrayHelper;

/**
* Content article class.
*
* @since 1.6.0
*/
class ContentControllerArticle extends JControllerForm
class Article extends Form
{
/**
* The URL view item variable.
Expand Down Expand Up @@ -69,7 +72,7 @@ public function add()
*/
protected function allowAdd($data = array())
{
$user = JFactory::getUser();
$user = \JFactory::getUser();
$categoryId = ArrayHelper::getValue($data, 'catid', $this->input->getInt('catid'), 'int');
$allow = null;

Expand Down Expand Up @@ -103,7 +106,7 @@ protected function allowAdd($data = array())
protected function allowEdit($data = array(), $key = 'id')
{
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$user = JFactory::getUser();
$user = \JFactory::getUser();

// Zero record (id:0), return component edit permission by calling parent controller method
if (!$recordId)
Expand Down Expand Up @@ -149,7 +152,7 @@ public function cancel($key = 'a_id')
parent::cancel($key);

// Redirect to the return page.
$this->setRedirect(JRoute::_($this->getReturnPage()));
$this->setRedirect(\JRoute::_($this->getReturnPage()));
}

/**
Expand All @@ -169,7 +172,7 @@ public function edit($key = null, $urlVar = 'a_id')

if (!$result)
{
$this->setRedirect(JRoute::_($this->getReturnPage()));
$this->setRedirect(\JRoute::_($this->getReturnPage()));
}

return $result;
Expand Down Expand Up @@ -264,9 +267,9 @@ protected function getReturnPage()
{
$return = $this->input->get('return', null, 'base64');

if (empty($return) || !JUri::isInternal(base64_decode($return)))
if (empty($return) || !\JUri::isInternal(base64_decode($return)))
{
return JUri::base();
return \JUri::base();
}
else
{
Expand All @@ -287,7 +290,7 @@ protected function getReturnPage()
public function save($key = null, $urlVar = 'a_id')
{
$result = parent::save($key, $urlVar);
$app = JFactory::getApplication();
$app = \JFactory::getApplication();
$articleId = $app->input->getInt('a_id');

// Load the parameters.
Expand All @@ -299,7 +302,7 @@ public function save($key = null, $urlVar = 'a_id')
{
$lang = '';

if (JLanguageMultilang::isEnabled())
if (Multilanguage::isEnabled())
{
$item = $app->getMenu()->getItem($menuitem);
$lang = !is_null($item) && $item->language != '*' ? '&lang=' . $item->language : '';
Expand All @@ -310,15 +313,15 @@ public function save($key = null, $urlVar = 'a_id')
// If ok, redirect to the return page.
if ($result)
{
$this->setRedirect(JRoute::_(base64_decode($return)));
$this->setRedirect(\JRoute::_(base64_decode($return)));
}
}
else
{
// If ok, redirect to the return page.
if ($result)
{
$this->setRedirect(JRoute::_($this->getReturnPage()));
$this->setRedirect(\JRoute::_($this->getReturnPage()));
}
}

Expand Down Expand Up @@ -348,11 +351,11 @@ public function vote()

if ($model->storeVote($id, $user_rating))
{
$this->setRedirect($url, JText::_('COM_CONTENT_ARTICLE_VOTE_SUCCESS'));
$this->setRedirect($url, \JText::_('COM_CONTENT_ARTICLE_VOTE_SUCCESS'));
}
else
{
$this->setRedirect($url, JText::_('COM_CONTENT_ARTICLE_VOTE_FAILURE'));
$this->setRedirect($url, \JText::_('COM_CONTENT_ARTICLE_VOTE_FAILURE'));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Content\Site\Controller;

use Joomla\CMS\Mvc\Factory\MvcFactoryInterface;

defined('_JEXEC') or die;

Expand All @@ -14,20 +17,23 @@
*
* @since 1.5
*/
class ContentController extends JControllerLegacy
class Controller extends \Joomla\CMS\Controller\Controller
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
* @param MvcFactoryInterface $factory The factory.
* @param CMSApplication $app The JApplication for the dispatcher
* @param \JInput $input Input
*
* @since 12.2
*/
public function __construct($config = array())
public function __construct($config = array(), MvcFactoryInterface $factory = null, $app = null, $input = null)
{
$this->input = JFactory::getApplication()->input;
$this->input = \JFactory::getApplication()->input;

// Article frontpage Editor pagebreak proxying:
if ($this->input->get('view') === 'article' && $this->input->get('layout') === 'pagebreak')
Expand All @@ -37,11 +43,11 @@ public function __construct($config = array())
// Article frontpage Editor article proxying:
elseif ($this->input->get('view') === 'articles' && $this->input->get('layout') === 'modal')
{
JHtml::_('stylesheet', 'system/adminlist.css', array('version' => 'auto', 'relative' => true));
\JHtml::_('stylesheet', 'system/adminlist.css', array('version' => 'auto', 'relative' => true));
$config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
}

parent::__construct($config);
parent::__construct($config, $factory, $app, $input);
}

/**
Expand All @@ -50,7 +56,7 @@ public function __construct($config = array())
* @param boolean $cachable If true, the view output will be cached.
* @param boolean $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JControllerLegacy This object to support chaining.
* @return \Joomla\CMS\Controller\Controller This object to support chaining.
*
* @since 1.5
*/
Expand All @@ -67,7 +73,7 @@ public function display($cachable = false, $urlparams = false)
$vName = $this->input->getCmd('view', 'categories');
$this->input->set('view', $vName);

$user = JFactory::getUser();
$user = \JFactory::getUser();

if ($user->get('id')
|| ($this->input->getMethod() === 'POST'
Expand Down Expand Up @@ -98,7 +104,7 @@ public function display($cachable = false, $urlparams = false)
if ($vName === 'form' && !$this->checkEditId('com_content.edit.article', $id))
{
// Somehow the person just went to the form - we don't allow that.
return JError::raiseError(403, JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
return \JError::raiseError(403, \JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
}

if ($vName === 'article')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Content\Site\Model;

defined('_JEXEC') or die;

JLoader::register('ContentModelArticles', __DIR__ . '/articles.php');
use Joomla\Component\Content\Administrator\Model\Articles;

/**
* Content Component Archive Model
*
* @since 1.5
*/
class ContentModelArchive extends ContentModelArticles
class Archive extends Articles
{
/**
* Model context string.
Expand All @@ -41,7 +42,7 @@ protected function populateState($ordering = null, $direction = null)
{
parent::populateState();

$app = JFactory::getApplication();
$app = \JFactory::getApplication();

// Add archive properties
$params = $this->state->params;
Expand All @@ -66,7 +67,7 @@ protected function populateState($ordering = null, $direction = null)
$articleOrderDate = $params->get('order_date');

// No category ordering
$secondary = ContentHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate);
$secondary = \ContentHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate);

$this->setState('list.ordering', $secondary . ', a.created DESC');
$this->setState('list.direction', '');
Expand All @@ -75,7 +76,7 @@ protected function populateState($ordering = null, $direction = null)
/**
* Get the master query for retrieving a list of articles subject to the model state.
*
* @return JDatabaseQuery
* @return \JDatabaseQuery
*
* @since 1.6
*/
Expand All @@ -93,7 +94,7 @@ protected function getListQuery()

// Filter on month, year
// First, get the date field
$queryDate = ContentHelperQuery::getQueryDate($articleOrderDate);
$queryDate = \ContentHelperQuery::getQueryDate($articleOrderDate);

if ($month = $this->getState('filter.month'))
{
Expand All @@ -116,7 +117,7 @@ protected function getListQuery()
*/
public function getData()
{
$app = JFactory::getApplication();
$app = \JFactory::getApplication();

// Lets load the content if it doesn't already exist
if (empty($this->_data))
Expand All @@ -137,7 +138,7 @@ public function getData()
}

/**
* JModelLegacy override to add alternating value for $odd
* Model override to add alternating value for $odd
*
* @param string $query The query.
* @param integer $limitstart Offset.
Expand All @@ -146,7 +147,7 @@ public function getData()
* @return array An array of results.
*
* @since 12.2
* @throws RuntimeException
* @throws \RuntimeException
*/
protected function _getList($query, $limitstart=0, $limit=0)
{
Expand All @@ -167,14 +168,14 @@ protected function _getList($query, $limitstart=0, $limit=0)
* Gets the archived articles years
*
* @return array
*
*
* @since 3.6.0
*/
public function getYears()
{
$db = $this->getDbo();
$nullDate = $db->quote($db->getNullDate());
$nowDate = $db->quote(JFactory::getDate()->toSql());
$nowDate = $db->quote(\JFactory::getDate()->toSql());

$query = $db->getQuery(true);
$years = $query->year($db->qn('created'));
Expand All @@ -192,9 +193,9 @@ public function getYears()
/**
* Generate column expression for slug or catslug.
*
* @param JDatabaseQuery $query Current query instance.
* @param string $id Column id name.
* @param string $alias Column alias name.
* @param \JDatabaseQuery $query Current query instance.
* @param string $id Column id name.
* @param string $alias Column alias name.
*
* @return string
*
Expand Down

0 comments on commit e0a8a66

Please sign in to comment.