PHP Class Grav\Plugin\Admin\Admin

Afficher le fichier Open project: getgrav/grav-plugin-admin Class Usage Examples

Méthodes publiques

Свойство 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

Свойство 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

Méthodes publiques

Méthode 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 méthode

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 méthode

Get all access levels
public accessLevels ( ) : array
Résultat array

addPermissions() public méthode

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

adminLanguages() public static méthode

Return the languages available in the admin
public static adminLanguages ( ) : array
Résultat array

authenticate() public méthode

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

authorize() public méthode

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

blueprints() public méthode

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

checkPackagesCanBeInstalled() public méthode

Check the passed packages list can be updated
public checkPackagesCanBeInstalled ( $packages ) : boolean
$packages
Résultat boolean

cleanContent() public méthode

public cleanContent ( $content )

configurations() public static méthode

Return the found configuration blueprints
public static configurations ( ) : array
Résultat array

data() public méthode

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

dateformatToMomentJS() public méthode

public dateformatToMomentJS ( string $php_format ) : string
$php_format string
Résultat string

dependenciesThatCanBeRemovedWhenRemoving() public méthode

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
Résultat array | boolean

field() public méthode

Converts dot notation to array notation.
public field ( string $name ) : string
$name string
Résultat string

findFormFields() public méthode

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

getDependenciesNeededToInstall() public méthode

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
Résultat array | boolean

getFeed() public méthode

Get https://getgrav.org news feed
public getFeed ( ) : mixed
Résultat mixed

getLastPageName() public static méthode

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

getLastPageRoute() public static méthode

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

getNonce() public static méthode

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

getPackageFromGPM() public méthode

public getPackageFromGPM ( $package_slug )

getPackagesThatDependOnPackage() public méthode

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

getPage() public méthode

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

getPagePathFromToken() public méthode

public getPagePathFromToken ( $path )

getPermissions() public méthode

Gets the entire permissions array
public getPermissions ( ) : array
Résultat array

getRouteDetails() public méthode

public getRouteDetails ( )

getTempDir() public static méthode

public static getTempDir ( )

gpm() public méthode

Get the GPM instance
public gpm ( ) : Grav\Common\GPM\GPM
Résultat Grav\Common\GPM\GPM The GPM instance

guessDateFormat() public méthode

Guest date format based on euro/US
public guessDateFormat ( $date ) : string
$date
Résultat string

isPremiumProduct() public méthode

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

isTeamGrav() public méthode

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

lastBackup() public méthode

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

latestPages() public méthode

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
Résultat array | null

license() public méthode

public license ( $package_slug )

logEntry() public méthode

Get log file for fatal errors.
public logEntry ( ) : string
Résultat string

messages() public méthode

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

modularTypes() public méthode

Get all modular template types
public modularTypes ( ) : array
Résultat array

page() public méthode

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

pagesCount() public méthode

Count the pages
public pagesCount ( ) : array
Résultat array

phpinfo() public méthode

Renders phpinfo
public phpinfo ( ) : string
Résultat string The phpinfo() output

plugins() public méthode

Get all plugins.
public plugins ( boolean $local = true ) : mixed
$local boolean
Résultat mixed

processNotifications() public méthode

public processNotifications ( $notifications )

route() public static méthode

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

routes() public méthode

Get all routes.
public routes ( boolean $unique = false ) : array
$unique boolean
Résultat array

session() public méthode

Get current session.
public session ( ) : RocketTheme\Toolbox\Session\Session
Résultat RocketTheme\Toolbox\Session\Session

setMessage() public méthode

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

setPermissions() public méthode

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

siteLanguages() public static méthode

Return the languages available in the site
public static siteLanguages ( ) : array
Résultat array

themes() public méthode

Get all themes.
public themes ( boolean $local = true ) : mixed
$local boolean
Résultat mixed

translate() public méthode

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

types() public méthode

Get all template types
public types ( ) : array
Résultat array

validateDate() public méthode

public validateDate ( $date, $format )

Property Details

$base public_oe property

public string $base
Résultat string

$blueprints protected_oe property

protected Blueprints,Grav\Common\Data $blueprints
Résultat Grav\Common\Data\Blueprints

$forgot public_oe property

public array $forgot
Résultat array

$gpm protected_oe property

protected GPM,Grav\Common\GPM $gpm
Résultat Grav\Common\GPM\GPM

$grav public_oe property

public Grav,Grav\Common $grav
Résultat Grav\Common\Grav

$json_response public_oe property

public array $json_response
Résultat array

$location public_oe property

public string $location
Résultat string

$pages protected_oe property

protected array $pages
Résultat array

$pages_count protected_oe property

protected int $pages_count
Résultat integer

$permissions protected_oe property

protected array $permissions
Résultat array

$route public_oe property

public string $route
Résultat string

$session protected_oe property

protected Session,RocketTheme\Toolbox\Session $session
Résultat RocketTheme\Toolbox\Session\Session

$task public_oe property

public string $task
Résultat string

$uri protected_oe property

protected Uri,Grav\Common $uri
Résultat Grav\Common\Uri

$user public_oe property

public User,Grav\Common\User $user
Résultat Grav\Common\User\User