Skip to content

Commit

Permalink
Added an isAdminPlugin() helper method in Utils
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Apr 13, 2016
1 parent 4034812 commit 8bdceb6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
6 changes: 1 addition & 5 deletions system/src/Grav/Common/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,7 @@ public function config()
*/
public function isAdmin()
{
if (isset($this->grav['admin'])) {
return true;
}

return false;
return Utils::isAdminPlugin();
}

/**
Expand Down
14 changes: 14 additions & 0 deletions system/src/Grav/Common/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -622,4 +622,18 @@ public static function verifyNonce($nonce, $action)
//Invalid nonce
return false;
}

/**
* Simple helper method to get whether or not the admin plugin is active
*
* @return bool
*/
public static function isAdminPlugin()
{
if (isset(Grav::instance()['admin'])) {
return true;
}

return false;
}
}

0 comments on commit 8bdceb6

Please sign in to comment.