Skip to content

Commit

Permalink
Additional checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Babker committed Aug 7, 2016
1 parent dd98f43 commit fbe379e
Showing 1 changed file with 37 additions and 6 deletions.
43 changes: 37 additions & 6 deletions plugins/system/phpversioncheck/phpversioncheck.php
Expand Up @@ -65,12 +65,7 @@ class PlgSystemPhpVersionCheck extends JPlugin
*/
public function onAfterDispatch()
{
if (!$this->app->isAdmin() || $this->app->getDocument()->getType() !== 'html')
{
return;
}

if (JUri::getInstance()->getVar("tmpl") === "component")
if (!$this->displayMessage())
{
return;
}
Expand Down Expand Up @@ -168,4 +163,40 @@ private function getPhpSupport()

return $supportStatus;
}

/**
* Determines if the message should be displayed
*
* @return boolean
*
* @since __DEPLOY_VERSION__
*/
private function displayMessage()
{
// Only on admin app
if (!$this->app->isAdmin())
{
return false;
}

// Only if authenticated
if (JFactory::getUser()->guest)
{
return false;
}

// Only on HTML documents
if ($this->app->getDocument()->getType() !== 'html')
{
return false;
}

// Only on full page requests
if ($this->app->input->getCmd('tmpl', 'index') === 'component')
{
return false;
}

return true;
}
}

0 comments on commit fbe379e

Please sign in to comment.