PHP Class Grav\Plugin\Admin\Admin

ファイルを表示 Open project: getgrav/grav-plugin-admin Class Usage Examples

Public Properties

Property Type Description
$base string
$forgot array
$grav Grav\Common\Grav
$json_response array
$location string
$route string
$task string
$user Grav\Common\User\User

Protected Properties

Property Type Description
$blueprints Grav\Common\Data\Blueprints
$gpm Grav\Common\GPM\GPM
$pages array
$pages_count integer
$permissions array
$session RocketTheme\Toolbox\Session\Session
$uri Grav\Common\Uri

Public Methods

Method Description
__construct ( Grav\Common\Grav $grav, string $base, string $location, string $route ) Constructor.
accessLevels ( ) : array Get all access levels
addPermissions ( $permissions ) Adds a permission to the permissions array
adminLanguages ( ) : array Return the languages available in the admin
authenticate ( array $data, array $post ) : boolean Authenticate user.
authorize ( string $action = 'admin.login' ) : boolean Checks user authorisation to the action.
blueprints ( string $type ) : Grav\Common\Data\Blueprint Returns blueprints for the given type.
checkPackagesCanBeInstalled ( $packages ) : boolean Check the passed packages list can be updated
cleanContent ( $content )
configurations ( ) : array Return the found configuration blueprints
data ( string $type, array $post = [] ) : mixed Gets configuration data.
dateformatToMomentJS ( string $php_format ) : string
dependenciesThatCanBeRemovedWhenRemoving ( string $slug ) : array | boolean Generate an array of dependencies for a package, used to generate a list of packages that can be removed when removing a package.
field ( string $name ) : string Converts dot notation to array notation.
findFormFields ( $type, $fields, $found_fields = [] )
getDependenciesNeededToInstall ( array $packages ) : array | boolean Get an array of dependencies needed to be installed or updated for a list of packages to be installed.
getFeed ( ) : mixed Get https://getgrav.org news feed
getLastPageName ( ) : string Static helper method to return the last used page name
getLastPageRoute ( ) : string Static helper method to return the last used page route
getNonce ( ) : string Static helper method to return the admin form nonce
getPackageFromGPM ( $package_slug )
getPackagesThatDependOnPackage ( string $slug ) : array | boolean Get list of packages that depend on the passed package slug
getPage ( $path ) : Grav\Common\Page\Page Returns the page creating it if it does not exist.
getPagePathFromToken ( $path )
getPermissions ( ) : array Gets the entire permissions array
getRouteDetails ( )
getTempDir ( )
gpm ( ) : Grav\Common\GPM\GPM Get the GPM instance
guessDateFormat ( $date ) : string Guest date format based on euro/US
isPremiumProduct ( object $info ) : boolean Determine if the plugin or theme info passed is premium
isTeamGrav ( object $info ) : boolean Determine if the plugin or theme info passed is from Team Grav
lastBackup ( ) : array Search in the logs when was the latest backup made
latestPages ( integer $count = 10 ) : array | null Used by the Dashboard in the admin to display the X latest pages that have been modified
license ( $package_slug )
logEntry ( ) : string Get log file for fatal errors.
messages ( string $type = null ) : array Fetch and delete messages from the session queue.
modularTypes ( ) : array Get all modular template types
page ( boolean $route = false, null $path = null ) : Grav\Common\Page\Page Returns edited page.
pagesCount ( ) : array Count the pages
phpinfo ( ) : string Renders phpinfo
plugins ( boolean $local = true ) : mixed Get all plugins.
processNotifications ( $notifications )
route ( ) : string Static helper method to return current route.
routes ( boolean $unique = false ) : array Get all routes.
session ( ) : RocketTheme\Toolbox\Session\Session Get current session.
setMessage ( string $msg, string $type = 'info' ) Add message into the session queue.
setPermissions ( $permissions ) Sets the entire permissions array
siteLanguages ( ) : array Return the languages available in the site
themes ( boolean $local = true ) : mixed Get all themes.
translate ( array | mixed $args, mixed $languages = null ) : string Translate a string to the user-defined language
types ( ) : array Get all template types
validateDate ( $date, $format )

Method Details

__construct() public method

Constructor.
public __construct ( Grav\Common\Grav $grav, string $base, string $location, string $route )
$grav Grav\Common\Grav
$base string
$location string
$route string

accessLevels() public method

Get all access levels
public accessLevels ( ) : array
return array

addPermissions() public method

Adds a permission to the permissions array
public addPermissions ( $permissions )
$permissions

adminLanguages() public static method

Return the languages available in the admin
public static adminLanguages ( ) : array
return array

authenticate() public method

Authenticate user.
public authenticate ( array $data, array $post ) : boolean
$data array Form data.
$post array Additional form fields.
return boolean

authorize() public method

Checks user authorisation to the action.
public authorize ( string $action = 'admin.login' ) : boolean
$action string
return boolean

blueprints() public method

Returns blueprints for the given type.
public blueprints ( string $type ) : Grav\Common\Data\Blueprint
$type string
return Grav\Common\Data\Blueprint

checkPackagesCanBeInstalled() public method

Check the passed packages list can be updated
public checkPackagesCanBeInstalled ( $packages ) : boolean
$packages
return boolean

cleanContent() public method

public cleanContent ( $content )

configurations() public static method

Return the found configuration blueprints
public static configurations ( ) : array
return array

data() public method

Gets configuration data.
public data ( string $type, array $post = [] ) : mixed
$type string
$post array
return mixed

dateformatToMomentJS() public method

public dateformatToMomentJS ( string $php_format ) : string
$php_format string
return string

dependenciesThatCanBeRemovedWhenRemoving() public method

Generate an array of dependencies for a package, used to generate a list of packages that can be removed when removing a package.
public dependenciesThatCanBeRemovedWhenRemoving ( string $slug ) : array | boolean
$slug string The package slug
return array | boolean

field() public method

Converts dot notation to array notation.
public field ( string $name ) : string
$name string
return string

findFormFields() public method

public findFormFields ( $type, $fields, $found_fields = [] )

getDependenciesNeededToInstall() public method

Get an array of dependencies needed to be installed or updated for a list of packages to be installed.
public getDependenciesNeededToInstall ( array $packages ) : array | boolean
$packages array The packages slugs
return array | boolean

getFeed() public method

Get https://getgrav.org news feed
public getFeed ( ) : mixed
return mixed

getLastPageName() public static method

Static helper method to return the last used page name
public static getLastPageName ( ) : string
return string

getLastPageRoute() public static method

Static helper method to return the last used page route
public static getLastPageRoute ( ) : string
return string

getNonce() public static method

Static helper method to return the admin form nonce
public static getNonce ( ) : string
return string

getPackageFromGPM() public method

public getPackageFromGPM ( $package_slug )

getPackagesThatDependOnPackage() public method

Get list of packages that depend on the passed package slug
public getPackagesThatDependOnPackage ( string $slug ) : array | boolean
$slug string The package slug
return array | boolean

getPage() public method

Returns the page creating it if it does not exist.
public getPage ( $path ) : Grav\Common\Page\Page
$path
return Grav\Common\Page\Page

getPagePathFromToken() public method

public getPagePathFromToken ( $path )

getPermissions() public method

Gets the entire permissions array
public getPermissions ( ) : array
return array

getRouteDetails() public method

public getRouteDetails ( )

getTempDir() public static method

public static getTempDir ( )

gpm() public method

Get the GPM instance
public gpm ( ) : Grav\Common\GPM\GPM
return Grav\Common\GPM\GPM The GPM instance

guessDateFormat() public method

Guest date format based on euro/US
public guessDateFormat ( $date ) : string
$date
return string

isPremiumProduct() public method

Determine if the plugin or theme info passed is premium
public isPremiumProduct ( object $info ) : boolean
$info object Plugin or Theme info object
return boolean

isTeamGrav() public method

Determine if the plugin or theme info passed is from Team Grav
public isTeamGrav ( object $info ) : boolean
$info object Plugin or Theme info object
return boolean

lastBackup() public method

Search in the logs when was the latest backup made
public lastBackup ( ) : array
return array Array containing the latest backup information

latestPages() public method

Used by the Dashboard in the admin to display the X latest pages that have been modified
public latestPages ( integer $count = 10 ) : array | null
$count integer number of pages to pull back
return array | null

license() public method

public license ( $package_slug )

logEntry() public method

Get log file for fatal errors.
public logEntry ( ) : string
return string

messages() public method

Fetch and delete messages from the session queue.
public messages ( string $type = null ) : array
$type string
return array

modularTypes() public method

Get all modular template types
public modularTypes ( ) : array
return array

page() public method

Returns edited page.
public page ( boolean $route = false, null $path = null ) : Grav\Common\Page\Page
$route boolean
$path null
return Grav\Common\Page\Page

pagesCount() public method

Count the pages
public pagesCount ( ) : array
return array

phpinfo() public method

Renders phpinfo
public phpinfo ( ) : string
return string The phpinfo() output

plugins() public method

Get all plugins.
public plugins ( boolean $local = true ) : mixed
$local boolean
return mixed

processNotifications() public method

public processNotifications ( $notifications )

route() public static method

Static helper method to return current route.
public static route ( ) : string
return string

routes() public method

Get all routes.
public routes ( boolean $unique = false ) : array
$unique boolean
return array

session() public method

Get current session.
public session ( ) : RocketTheme\Toolbox\Session\Session
return RocketTheme\Toolbox\Session\Session

setMessage() public method

Add message into the session queue.
public setMessage ( string $msg, string $type = 'info' )
$msg string
$type string

setPermissions() public method

Sets the entire permissions array
public setPermissions ( $permissions )
$permissions

siteLanguages() public static method

Return the languages available in the site
public static siteLanguages ( ) : array
return array

themes() public method

Get all themes.
public themes ( boolean $local = true ) : mixed
$local boolean
return mixed

translate() public method

Translate a string to the user-defined language
public translate ( array | mixed $args, mixed $languages = null ) : string
$args array | mixed
$languages mixed
return string

types() public method

Get all template types
public types ( ) : array
return array

validateDate() public method

public validateDate ( $date, $format )

Property Details

$base public_oe property

public string $base
return string

$blueprints protected_oe property

protected Blueprints,Grav\Common\Data $blueprints
return Grav\Common\Data\Blueprints

$forgot public_oe property

public array $forgot
return array

$gpm protected_oe property

protected GPM,Grav\Common\GPM $gpm
return Grav\Common\GPM\GPM

$grav public_oe property

public Grav,Grav\Common $grav
return Grav\Common\Grav

$json_response public_oe property

public array $json_response
return array

$location public_oe property

public string $location
return string

$pages protected_oe property

protected array $pages
return array

$pages_count protected_oe property

protected int $pages_count
return integer

$permissions protected_oe property

protected array $permissions
return array

$route public_oe property

public string $route
return string

$session protected_oe property

protected Session,RocketTheme\Toolbox\Session $session
return RocketTheme\Toolbox\Session\Session

$task public_oe property

public string $task
return string

$uri protected_oe property

protected Uri,Grav\Common $uri
return Grav\Common\Uri

$user public_oe property

public User,Grav\Common\User $user
return Grav\Common\User\User