PHP Class Grav\Plugin\Admin\AdminController

Inheritance: extends AdminBaseController
Show file Open project: getgrav/grav-plugin-admin Class Usage Examples

Public Properties

Property Type Description
$data array | null
$grav Grav\Common\Grav
$post array
$route string
$task string
$view string

Protected Properties

Property Type Description
$admin Admin
$redirect string
$redirectCode integer
$upload_errors
$uri Grav\Common\Uri

Public Methods

Method Description
checkValidFrontmatter ( string $frontmatter ) : boolean
determineFilenameIncludingLanguage ( string $current_filename, string $language ) : string The what should be the new filename when saving as a new language
initialize ( Grav\Common\Grav $grav = null, string $view = null, string $task = null, string $route = null, array $post = null )
taskActivate ( ) : boolean Set the default theme.
taskContinue ( ) : boolean Continue to the new page.
taskDisable ( ) : boolean Disable a plugin.
taskEnable ( ) : boolean Enable a plugin.
taskReset ( ) : boolean Handle the reset password action.
taskSave ( ) : boolean Handles form and saves the input data if its valid.
taskSaveNewFolder ( ) : boolean Handles creating an empty page folder (without markdown file)
taskUninstall ( ) : boolean Handles uninstalling plugins and themes
taskUpdategrav ( ) : boolean Handles updating Grav

Protected Methods

Method Description
findFirstAvailable ( string $item, Grav\Common\Page\Page $page ) : string Find the first available $item ('slug' | 'folder') for a page Used when copying a page, to determine the first available slot
prepareData ( array $data ) : object Gets the configuration data for a given view & post
preparePage ( Grav\Common\Page\Page $page, boolean $clean_header = false, string $language = '' ) Prepare a page to be stored: update its folder, name, template, header and content
taskAddmedia ( ) : boolean Handles adding a media file to a page
taskBackup ( ) : boolean Handle the backup action
taskClearCache ( ) : boolean Clear the cache.
taskCopy ( ) : boolean Save page as a new copy.
taskDelete ( ) : boolean Delete page.
taskDelmedia ( ) : boolean Handles deleting a media file from a page
taskFilterPages ( ) Handles filtering the page by modular/visible/routable in the pages list.
taskForgot ( ) : boolean Handle the email password recovery procedure.
taskGetNewsFeed ( )
taskGetNotifications ( ) Get Notifications from cache.
taskGetPackagesDependencies ( ) : boolean Handle getting a new package dependencies needed to be installed
taskGpmRelease ( ) Toggle the gpm.releases setting
taskHideNotification ( ) : boolean Clear the cache.
taskInstallDependenciesOfPackages ( )
taskInstallPackage ( )
taskKeepAlive ( ) Keep alive
taskListmedia ( ) : boolean Determines the file types allowed to be uploaded
taskLogin ( ) : boolean Handle login.
taskLogout ( ) : boolean Handle logout.
taskProcessMarkdown ( ) : boolean Process the page Markdown
taskProcessNotifications ( ) : boolean Process Notifications. Store the notifications object locally.
taskRemovePackage ( ) : boolean Handle removing a package
taskReorder ( ) : boolean Reorder pages.
taskSaveas ( ) : boolean Save the current page in a different language. Automatically switches to that language.
taskSwitchlanguage ( ) Switch the content language. Optionally redirect to a different page.

Private Methods

Method Description
getNextOrderInFolder ( $path ) : string Get the next available ordering number in a folder

Method Details

checkValidFrontmatter() public method

public checkValidFrontmatter ( string $frontmatter ) : boolean
$frontmatter string
return boolean

determineFilenameIncludingLanguage() public method

The what should be the new filename when saving as a new language
public determineFilenameIncludingLanguage ( string $current_filename, string $language ) : string
$current_filename string the current file name, including .md. Example: default.en.md
$language string The new language it will be saved as. Example: 'it' or 'en-GB'.
return string The new filename. Example: 'default.it'

findFirstAvailable() protected method

Find the first available $item ('slug' | 'folder') for a page Used when copying a page, to determine the first available slot
protected findFirstAvailable ( string $item, Grav\Common\Page\Page $page ) : string
$item string
$page Grav\Common\Page\Page
return string The first available slot

initialize() public method

public initialize ( Grav\Common\Grav $grav = null, string $view = null, string $task = null, string $route = null, array $post = null )
$grav Grav\Common\Grav
$view string
$task string
$route string
$post array

prepareData() protected method

Gets the configuration data for a given view & post
protected prepareData ( array $data ) : object
$data array
return object

preparePage() protected method

Prepare a page to be stored: update its folder, name, template, header and content
protected preparePage ( Grav\Common\Page\Page $page, boolean $clean_header = false, string $language = '' )
$page Grav\Common\Page\Page
$clean_header boolean
$language string

taskActivate() public method

Set the default theme.
public taskActivate ( ) : boolean
return boolean True if the action was performed.

taskAddmedia() protected method

Handles adding a media file to a page
protected taskAddmedia ( ) : boolean
return boolean True if the action was performed.

taskBackup() protected method

Handle the backup action
protected taskBackup ( ) : boolean
return boolean True if the action was performed.

taskClearCache() protected method

Clear the cache.
protected taskClearCache ( ) : boolean
return boolean True if the action was performed.

taskContinue() public method

Continue to the new page.
public taskContinue ( ) : boolean
return boolean True if the action was performed.

taskCopy() protected method

Save page as a new copy.
protected taskCopy ( ) : boolean
return boolean True if the action was performed.

taskDelete() protected method

Delete page.
protected taskDelete ( ) : boolean
return boolean True if the action was performed.

taskDelmedia() protected method

Handles deleting a media file from a page
protected taskDelmedia ( ) : boolean
return boolean True if the action was performed.

taskDisable() public method

Disable a plugin.
public taskDisable ( ) : boolean
return boolean True if the action was performed.

taskEnable() public method

Enable a plugin.
public taskEnable ( ) : boolean
return boolean True if the action was performed.

taskFilterPages() protected method

Handles filtering the page by modular/visible/routable in the pages list.
protected taskFilterPages ( )

taskForgot() protected method

Handle the email password recovery procedure.
protected taskForgot ( ) : boolean
return boolean True if the action was performed.

taskGetNewsFeed() protected method

protected taskGetNewsFeed ( )

taskGetNotifications() protected method

Get Notifications from cache.
protected taskGetNotifications ( )

taskGetPackagesDependencies() protected method

Handle getting a new package dependencies needed to be installed

taskGpmRelease() protected method

Toggle the gpm.releases setting
protected taskGpmRelease ( )

taskHideNotification() protected method

Clear the cache.
protected taskHideNotification ( ) : boolean
return boolean True if the action was performed.

taskInstallDependenciesOfPackages() protected method

taskInstallPackage() protected method

protected taskInstallPackage ( )

taskKeepAlive() protected method

Keep alive
protected taskKeepAlive ( )

taskListmedia() protected method

Determines the file types allowed to be uploaded
protected taskListmedia ( ) : boolean
return boolean True if the action was performed.

taskLogin() protected method

Handle login.
protected taskLogin ( ) : boolean
return boolean True if the action was performed.

taskLogout() protected method

Handle logout.
protected taskLogout ( ) : boolean
return boolean True if the action was performed.

taskProcessMarkdown() protected method

Process the page Markdown
protected taskProcessMarkdown ( ) : boolean
return boolean True if the action was performed.

taskProcessNotifications() protected method

Process Notifications. Store the notifications object locally.
protected taskProcessNotifications ( ) : boolean
return boolean

taskRemovePackage() protected method

Handle removing a package
protected taskRemovePackage ( ) : boolean
return boolean

taskReorder() protected method

Reorder pages.
protected taskReorder ( ) : boolean
return boolean True if the action was performed.

taskReset() public method

Handle the reset password action.
public taskReset ( ) : boolean
return boolean True if the action was performed.

taskSave() public method

Handles form and saves the input data if its valid.
public taskSave ( ) : boolean
return boolean True if the action was performed.

taskSaveNewFolder() public method

Handles creating an empty page folder (without markdown file)
public taskSaveNewFolder ( ) : boolean
return boolean True if the action was performed.

taskSaveas() protected method

Save the current page in a different language. Automatically switches to that language.
protected taskSaveas ( ) : boolean
return boolean True if the action was performed.

taskSwitchlanguage() protected method

Switch the content language. Optionally redirect to a different page.
protected taskSwitchlanguage ( )

taskUninstall() public method

Handles uninstalling plugins and themes
Deprecation:
public taskUninstall ( ) : boolean
return boolean True if the action was performed

taskUpdategrav() public method

Handles updating Grav
public taskUpdategrav ( ) : boolean
return boolean True if the action was performed

Property Details

$admin protected property

protected Admin,Grav\Plugin\Admin $admin
return Admin

$data public property

public array|null $data
return array | null

$grav public property

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

$post public property

public array $post
return array

$redirect protected property

protected string $redirect
return string

$redirectCode protected property

protected int $redirectCode
return integer

$route public property

public string $route
return string

$task public property

public string $task
return string

$upload_errors protected property

protected $upload_errors

$uri protected property

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

$view public property

public string $view
return string