Skip to content

Commit

Permalink
Replace deprecated isSite() and isAdmin() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
frankmayer committed Dec 10, 2016
1 parent f621f08 commit ed1aa97
Show file tree
Hide file tree
Showing 64 changed files with 101 additions and 101 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

$app = JFactory::getApplication();

if ($app->isSite())
if ($app->isClient('site'))
{
JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN'));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

$app = JFactory::getApplication();

if ($app->isSite())
if ($app->isClient('site'))
{
JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN'));
}
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_content/models/article.php
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ public function getForm($data = array(), $loadData = true)
$assoc = JLanguageAssociations::isEnabled();

// Check if article is associated
if ($this->getState('article.id') && $app->isSite() && $assoc)
if ($this->getState('article.id') && $app->isClient('site') && $assoc)
{
$associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $id);

Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_content/models/articles.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ public function getItems()
{
$items = parent::getItems();

if (JFactory::getApplication()->isSite())
if (JFactory::getApplication()->isClient('site'))
{
$groups = JFactory::getUser()->getAuthorisedViewLevels();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

$app = JFactory::getApplication();

if ($app->isSite())
if ($app->isClient('site'))
{
JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN'));
}
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_finder/controllers/filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ public function save($key = null, $urlVar = null)

$this->setMessage(
JText::_(
(JFactory::getLanguage()->hasKey($this->text_prefix . ($recordId == 0 && $app->isSite() ? '_SUBMIT' : '') . '_SAVE_SUCCESS')
? $this->text_prefix : 'JLIB_APPLICATION') . ($recordId == 0 && $app->isSite() ? '_SUBMIT' : '') . '_SAVE_SUCCESS'
(JFactory::getLanguage()->hasKey($this->text_prefix . ($recordId == 0 && $app->isClient('site') ? '_SUBMIT' : '') . '_SAVE_SUCCESS')
? $this->text_prefix : 'JLIB_APPLICATION') . ($recordId == 0 && $app->isClient('site') ? '_SUBMIT' : '') . '_SAVE_SUCCESS'
)
);

Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_login/models/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ protected static function _load($module)
->where('e.enabled = 1');

// Filter by language.
if ($app->isSite() && $app->getLanguageFilter())
if ($app->isClient('site') && $app->getLanguageFilter())
{
$query->where('m.language IN (' . $db->quote($lang) . ',' . $db->quote('*') . ')');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function display($tpl = null)
$app = JFactory::getApplication();
$config = JComponentHelper::getParams('com_media');

if (!$app->isAdmin())
if (!$app->isClient('administrator'))
{
return $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'warning');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function display($tpl = null)
{
$app = JFactory::getApplication();

if (!$app->isAdmin())
if (!$app->isClient('administrator'))
{
return $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'warning');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

$app = JFactory::getApplication();

if ($app->isSite())
if ($app->isClient('site'))
{
JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN'));
}
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_modules/models/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected function populateState($ordering = 'a.position', $direction = 'asc')
$this->setState('filter.access', $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', '', 'cmd'));

// If in modal layout on the frontend, state and language are always forced.
if ($app->isSite() && $layout === 'modal')
if ($app->isClient('site') && $layout === 'modal')
{
$this->setState('filter.language', 'current');
$this->setState('filter.state', 1);
Expand All @@ -100,7 +100,7 @@ protected function populateState($ordering = 'a.position', $direction = 'asc')
}

// Special case for the client id.
if ($app->isSite() || $layout === 'modal')
if ($app->isClient('site') || $layout === 'modal')
{
$this->setState('client_id', 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

defined('_JEXEC') or die;

if (JFactory::getApplication()->isSite())
if (JFactory::getApplication()->isClient('site'))
{
JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN'));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function display($tpl = null)
$this->filterForm->removeField('client_id', '');

// If in the frontend state and language should not activate the search tools.
if (JFactory::getApplication()->isSite())
if (JFactory::getApplication()->isClient('site'))
{
unset($this->activeFilters['state']);
unset($this->activeFilters['language']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

$app = JFactory::getApplication();

if ($app->isSite())
if ($app->isClient('site'))
{
JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN'));
}
Expand Down
4 changes: 2 additions & 2 deletions components/com_config/controller/display.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function execute()

$componentFolder = $this->input->getWord('option', 'com_config');

if ($this->app->isAdmin())
if ($this->app->isClient('administrator'))
{
$viewName = $this->input->getWord('view', 'application');
}
Expand All @@ -61,7 +61,7 @@ public function execute()
// Register the layout paths for the view
$paths = new SplPriorityQueue;

if ($this->app->isAdmin())
if ($this->app->isClient('administrator'))
{
$paths->insert(JPATH_ADMINISTRATOR . '/components/' . $componentFolder . '/view/' . $viewName . '/tmpl', 1);
}
Expand Down
2 changes: 1 addition & 1 deletion components/com_config/controller/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function parseController($app)
// Some special handling for com_config administrator
$option = $app->input->get('option');

if ($app->isAdmin() && $option == 'com_config')
if ($app->isClient('administrator') && $option == 'com_config')
{
$component = $app->input->get('component');

Expand Down
2 changes: 1 addition & 1 deletion components/com_tags/models/tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ protected function populateState($ordering = 'c.core_title', $direction = 'ASC')
$app = JFactory::getApplication();

// Load the parameters.
$params = $app->isAdmin() ? JComponentHelper::getParams('com_tags') : $app->getParams();
$params = $app->isClient('administrator') ? JComponentHelper::getParams('com_tags') : $app->getParams();

$this->setState('params', $params);

Expand Down
6 changes: 3 additions & 3 deletions components/com_users/models/registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function activate($token)
$data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false);

// Remove administrator/ from activate url in case this method is called from admin
if (JFactory::getApplication()->isAdmin())
if (JFactory::getApplication()->isClient('administrator'))
{
$adminPos = strrpos($data['activate'], 'administrator/');
$data['activate'] = substr_replace($data['activate'], '', $adminPos, 14);
Expand Down Expand Up @@ -444,7 +444,7 @@ public function register($temp)
$data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false);

// Remove administrator/ from activate url in case this method is called from admin
if (JFactory::getApplication()->isAdmin())
if (JFactory::getApplication()->isClient('administrator'))
{
$adminPos = strrpos($data['activate'], 'administrator/');
$data['activate'] = substr_replace($data['activate'], '', $adminPos, 14);
Expand Down Expand Up @@ -488,7 +488,7 @@ public function register($temp)
$data['activate'] = $base . JRoute::_('index.php?option=com_users&task=registration.activate&token=' . $data['activation'], false);

// Remove administrator/ from activate url in case this method is called from admin
if (JFactory::getApplication()->isAdmin())
if (JFactory::getApplication()->isClient('administrator'))
{
$adminPos = strrpos($data['activate'], 'administrator/');
$data['activate'] = substr_replace($data['activate'], '', $adminPos, 14);
Expand Down
2 changes: 1 addition & 1 deletion libraries/cms/application/cms.php
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ protected function render()

$caching = false;

if ($this->isSite() && $this->get('caching') && $this->get('caching', 2) == 2 && !JFactory::getUser()->get('id'))
if ($this->isClient('site') && $this->get('caching') && $this->get('caching', 2) == 2 && !JFactory::getUser()->get('id'))
{
$caching = true;
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/cms/form/field/captcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function setup(SimpleXMLElement $element, $value, $group = null)

$default = $app->get('captcha');

if ($app->isSite())
if ($app->isClient('site'))
{
$default = $app->getParams()->get('captcha', $default);
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/cms/form/field/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ protected function getExcluded()
*/
public function appendXMLFieldTag($field, DOMElement $parent, JForm $form)
{
if (JFactory::getApplication()->isSite())
if (JFactory::getApplication()->isClient('site'))
{
// The user field is not working on the front end
return;
Expand Down
2 changes: 1 addition & 1 deletion libraries/cms/form/rule/captcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function test(SimpleXMLElement $element, $value, $group = null, Registry
$app = JFactory::getApplication();
$plugin = $app->get('captcha');

if ($app->isSite())
if ($app->isClient('site'))
{
$plugin = $app->getParams()->get('captcha', $plugin);
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/cms/html/behavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ public static function keepalive()
}

// If we are in the frontend or logged in as a user, we can use the ajax component to reduce the load
$uri = 'index.php' . (JFactory::getApplication()->isSite() || !JFactory::getUser()->guest ? '?option=com_ajax&format=json' : '');
$uri = 'index.php' . (JFactory::getApplication()->isClient('site') || !JFactory::getUser()->guest ? '?option=com_ajax&format=json' : '');

// Include core and polyfill for browsers lower than IE 9.
static::core();
Expand Down
2 changes: 1 addition & 1 deletion libraries/cms/language/multilang.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static function isEnabled()
$app = JFactory::getApplication();

// If being called from the frontend, we can avoid the database query.
if ($app->isSite())
if ($app->isClient('site'))
{
$enabled = $app->getLanguageFilter();

Expand Down
2 changes: 1 addition & 1 deletion libraries/cms/layout/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ public function setClient($client)
break;

default:
$client = (int) JFactory::getApplication()->isAdmin();
$client = (int) JFactory::getApplication()->isClient('administrator');
break;
}

Expand Down
4 changes: 2 additions & 2 deletions libraries/cms/menu/site.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function getItems($attributes, $values, $firstonly = false)
$attributes = (array) $attributes;
$values = (array) $values;

if ($this->app->isSite())
if ($this->app->isClient('site'))
{
// Filter by language if not set
if (($key = array_search('language', $attributes)) === false)
Expand Down Expand Up @@ -193,7 +193,7 @@ public function getItems($attributes, $values, $firstonly = false)
*/
public function getDefault($language = '*')
{
if (array_key_exists($language, $this->_default) && $this->app->isSite() && $this->app->getLanguageFilter())
if (array_key_exists($language, $this->_default) && $this->app->isClient('site') && $this->app->getLanguageFilter())
{
return $this->_items[$this->_default[$language]];
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/cms/module/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public static function getModuleList()
->where('(mm.menuid = ' . (int) $Itemid . ' OR mm.menuid <= 0)');

// Filter by language
if ($app->isSite() && $app->getLanguageFilter())
if ($app->isClient('site') && $app->getLanguageFilter())
{
$query->where('m.language IN (' . $db->quote($lang) . ',' . $db->quote('*') . ')');
$cacheId .= $lang . '*';
Expand Down
6 changes: 3 additions & 3 deletions libraries/cms/pagination/pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ public function getLimitBox()
$selected = $this->viewall ? 0 : $this->limit;

// Build the select list.
if ($this->app->isAdmin())
if ($this->app->isClient('administrator'))
{
$html = JHtml::_(
'select.genericlist',
Expand Down Expand Up @@ -715,7 +715,7 @@ protected function _item_active(JPaginationObject $item)
$class = 'hasTooltip ';
}

if ($this->app->isAdmin())
if ($this->app->isClient('administrator'))
{
return '<a' . $title . ' href="#" onclick="document.adminForm.' . $this->prefix
. 'limitstart.value=' . ($item->base > 0 ? $item->base : '0') . '; Joomla.submitform();return false;">' . $item->text . '</a>';
Expand All @@ -738,7 +738,7 @@ protected function _item_active(JPaginationObject $item)
*/
protected function _item_inactive(JPaginationObject $item)
{
if ($this->app->isAdmin())
if ($this->app->isClient('administrator'))
{
return '<span>' . $item->text . '</span>';
}
Expand Down
4 changes: 2 additions & 2 deletions libraries/fof/integration/joomla/platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ protected function isCliAdmin()
}
else
{
$isAdmin = !JFactory::$application ? false : JFactory::getApplication()->isAdmin();
$isAdmin = !JFactory::$application ? false : JFactory::getApplication()->isClient('administrator');
}
}

Expand Down Expand Up @@ -817,7 +817,7 @@ public function loginUser($authInfo)
$response->email = $user->email;
$response->fullname = $user->name;

if (JFactory::getApplication()->isAdmin())
if (JFactory::getApplication()->isClient('administrator'))
{
$response->language = $user->getParam('admin_language');
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/joomla/cache/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ public static function setWorkarounds($data, $options = array())
$cached['mime_encoding'] = $document->getMimeEncoding();

// Pathway data
if ($app->isSite() && $loptions['nopathway'] != 1)
if ($app->isClient('site') && $loptions['nopathway'] != 1)
{
$cached['pathway'] = is_array($data) && isset($data['pathway']) ? $data['pathway'] : $app->getPathway()->getPathway();
}
Expand Down
8 changes: 4 additions & 4 deletions libraries/joomla/cache/storage/redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected function getConnection()
{
static::$_redis = null;

if ($app->isAdmin())
if ($app->isClient('administrator'))
{
JError::raiseWarning(500, 'Redis connection failed');
}
Expand All @@ -116,7 +116,7 @@ protected function getConnection()

if ($auth == false)
{
if ($app->isAdmin())
if ($app->isClient('administrator'))
{
JError::raiseWarning(500, 'Redis authentication failed');
}
Expand All @@ -130,7 +130,7 @@ protected function getConnection()
{
static::$_redis = null;

if ($app->isAdmin())
if ($app->isClient('administrator'))
{
JError::raiseWarning(500, 'Redis failed to select database');
}
Expand All @@ -146,7 +146,7 @@ protected function getConnection()
{
static::$_redis = null;

if ($app->isAdmin())
if ($app->isClient('administrator'))
{
JError::raiseWarning(500, 'Redis ping failed');
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/joomla/document/renderer/html/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function render($position, $params = array(), $content = null)

$app = JFactory::getApplication();
$user = JFactory::getUser();
$frontediting = ($app->isSite() && $app->get('frontediting', 1) && !$user->guest);
$frontediting = ($app->isClient('site') && $app->get('frontediting', 1) && !$user->guest);
$menusEditing = ($app->get('frontediting', 1) == 2) && $user->authorise('core.edit', 'com_menus');

foreach (JModuleHelper::getModules($position) as $mod)
Expand Down

0 comments on commit ed1aa97

Please sign in to comment.