PHP Class Airship\Cabin\Bridge\Blueprint\CustomPages

Create and manage custom web pages.
Inheritance: extends Airship\Cabin\Hull\Blueprint\CustomPages, use trait Airship\Engine\Bolt\Cache
Show file Open project: paragonie/airship Class Usage Examples

Public Methods

Method Description
createDifferentCabinRedirect ( string $oldURL, string $newURL, string $cabin ) : boolean Create a redirect
createDir ( string $cabin, string $path, array $post = [] ) : boolean Create a new page (and initial page version)
createDirRedirect ( array $old, array $new ) : boolean Redirect a directory, and all of its pages.
createPage ( string $cabin, string $path, array $post = [], boolean $publish = false, boolean $raw = true ) : boolean Create a new page (and initial page version)
createPageRedirect ( array $old, array $new, boolean $allowCrossCabin = false ) : boolean Create a page redirect
createRedirectsForMove ( array $old, array $new ) : boolean Create the redirects necessary for a directory being moved.
createSameCabinRedirect ( string $oldURL, string $newURL, string $cabin ) : boolean Create a redirect
deleteDir ( integer $directoryID ) : boolean
deletePage ( integer $pageId ) : boolean Delete a page from the database, along with its revision history.
deleteRedirect ( integer $redirectID ) : boolean Delete a redirect.
getCabinForDirectory ( integer $directoryId ) : string Get the cabin assigned to a particular directory
getCustomDirChildren ( string $cabin, integer $directoryId, integer $selected, integer $skip, integer $depth ) : array Recursively grab the children of the custom directory tree
getCustomDirTree ( array $cabins, integer $selected, integer $skip ) : array Get a custom directory tree
getDirInfo ( string $cabin, string $parent = '', string $name = '' ) : array Get information about only this directory
getDirectoryPieces ( integer $directoryID ) : array Get all of the parents for a given directory, as an array
getHistory ( integer $pageId ) : array Get all of a page's revision history
getLatestDraft ( integer $pageId ) : array Get the latest version of a custom page
getLatestVersionId ( integer $pageId ) : integer Get the latest published version ID of a custom page
getNextVersionUniqueId ( integer $pageId, integer $currentVersionId ) : string Get the next version's unique ID
getPageInfo ( string $cabin, string $path = '', string $page ) : array Get information about only the page
getPageVersionByUniqueId ( string $uniqueId ) : array Get the information about a particular page version, given a unique ID
getPathByPageId ( integer $pageId, string $cabin = '' ) : array Get path information by a page ID
getPrevVersionUniqueId ( integer $pageId, integer $currentVersionId ) : string Get the next version's unique ID
getRedirect ( string $cabin, integer $redirectID ) : array Get the redirects for this particular cabin.
getRedirectsForCabin ( string $cabin ) : array Get the redirects for this particular cabin.
listCustomPages ( string $dir = '', string $cabin = CABIN_NAME ) : array List all of the custom pages contained within a given cabin and directory
listCustomPagesByDirectoryID ( integer $dir ) : array List all of the custom pages contained within a given directory ID
listSubDirectories ( string $dir = '', string $cabin = CABIN_NAME ) : array List all of the subdirectories for a given cabin and directory
listSubDirectoriesByDirectoryID ( integer $dir ) : array List all of the subdirectories contained within a given directory ID
moveDir ( integer $dirID, string $url = '', integer $parent, string $cabin = '' ) : boolean Move/rename a directory
movePage ( integer $pageId, string $url = '', integer $destinationDir ) : boolean Move a page to a new directory
movePagesToDir ( integer $parent, integer $destinationDir, boolean $createRedirect = false, string $oldCabin = '', string $newCabin = '', array $pieces = [] ) : boolean
numCustomPages ( null $published = null ) : integer Get the number of custom pages.
recursiveDelete ( integer $directoryID ) : boolean Delete everything within a given directory
updatePage ( integer $pageId, array $post = [], boolean $publish = false, boolean | null $raw = null, boolean $cache = false ) : boolean Create a new page (and initial page version)
updateRedirect ( integer $redirectID, array $post ) : boolean Save changes to a custom redirect

Protected Methods

Method Description
uniqueId ( string $table, string $column = 'uniqueid' ) : string Get a unique ID (and make sure it doesn't exist)

Method Details

createDifferentCabinRedirect() public method

Create a redirect
public createDifferentCabinRedirect ( string $oldURL, string $newURL, string $cabin ) : boolean
$oldURL string
$newURL string
$cabin string
return boolean

createDir() public method

Create a new page (and initial page version)
public createDir ( string $cabin, string $path, array $post = [] ) : boolean
$cabin string
$path string
$post array
return boolean

createDirRedirect() public method

Redirect a directory, and all of its pages.
public createDirRedirect ( array $old, array $new ) : boolean
$old array
$new array
return boolean

createPage() public method

Create a new page (and initial page version)
public createPage ( string $cabin, string $path, array $post = [], boolean $publish = false, boolean $raw = true ) : boolean
$cabin string
$path string
$post array
$publish boolean
$raw boolean
return boolean

createPageRedirect() public method

Create a page redirect
public createPageRedirect ( array $old, array $new, boolean $allowCrossCabin = false ) : boolean
$old array
$new array
$allowCrossCabin boolean
return boolean

createRedirectsForMove() public method

Create the redirects necessary for a directory being moved.
public createRedirectsForMove ( array $old, array $new ) : boolean
$old array
$new array
return boolean

createSameCabinRedirect() public method

Create a redirect
public createSameCabinRedirect ( string $oldURL, string $newURL, string $cabin ) : boolean
$oldURL string
$newURL string
$cabin string
return boolean

deleteDir() public method

public deleteDir ( integer $directoryID ) : boolean
$directoryID integer
return boolean

deletePage() public method

Delete a page from the database, along with its revision history.
public deletePage ( integer $pageId ) : boolean
$pageId integer
return boolean

deleteRedirect() public method

Delete a redirect.
public deleteRedirect ( integer $redirectID ) : boolean
$redirectID integer
return boolean

getCabinForDirectory() public method

Get the cabin assigned to a particular directory
public getCabinForDirectory ( integer $directoryId ) : string
$directoryId integer
return string

getCustomDirChildren() public method

Recursively grab the children of the custom directory tree
public getCustomDirChildren ( string $cabin, integer $directoryId, integer $selected, integer $skip, integer $depth ) : array
$cabin string Cabin
$directoryId integer Parent directory for which to list directories
$selected integer Which directory is selected by default?
$skip integer Which directory to skip when recusring (for moving and deleting)
$depth integer
return array

getCustomDirTree() public method

Get a custom directory tree
public getCustomDirTree ( array $cabins, integer $selected, integer $skip ) : array
$cabins array
$selected integer
$skip integer
return array

getDirInfo() public method

Get information about only this directory
public getDirInfo ( string $cabin, string $parent = '', string $name = '' ) : array
$cabin string
$parent string
$name string
return array

getDirectoryPieces() public method

Get all of the parents for a given directory, as an array
public getDirectoryPieces ( integer $directoryID ) : array
$directoryID integer
return array

getHistory() public method

Get all of a page's revision history
public getHistory ( integer $pageId ) : array
$pageId integer
return array

getLatestDraft() public method

Get the latest version of a custom page
public getLatestDraft ( integer $pageId ) : array
$pageId integer
return array

getLatestVersionId() public method

Get the latest published version ID of a custom page
public getLatestVersionId ( integer $pageId ) : integer
$pageId integer
return integer

getNextVersionUniqueId() public method

Get the next version's unique ID
public getNextVersionUniqueId ( integer $pageId, integer $currentVersionId ) : string
$pageId integer
$currentVersionId integer
return string

getPageInfo() public method

Get information about only the page
public getPageInfo ( string $cabin, string $path = '', string $page ) : array
$cabin string
$path string
$page string
return array

getPageVersionByUniqueId() public method

Get the information about a particular page version, given a unique ID
public getPageVersionByUniqueId ( string $uniqueId ) : array
$uniqueId string
return array

getPathByPageId() public method

Get path information by a page ID
public getPathByPageId ( integer $pageId, string $cabin = '' ) : array
$pageId integer
$cabin string
return array string[3] (cabin, directory, page)

getPrevVersionUniqueId() public method

Get the next version's unique ID
public getPrevVersionUniqueId ( integer $pageId, integer $currentVersionId ) : string
$pageId integer
$currentVersionId integer
return string

getRedirect() public method

Get the redirects for this particular cabin.
public getRedirect ( string $cabin, integer $redirectID ) : array
$cabin string
$redirectID integer
return array

getRedirectsForCabin() public method

Get the redirects for this particular cabin.
public getRedirectsForCabin ( string $cabin ) : array
$cabin string
return array

listCustomPages() public method

List all of the custom pages contained within a given cabin and directory
public listCustomPages ( string $dir = '', string $cabin = CABIN_NAME ) : array
$dir string
$cabin string
return array

listCustomPagesByDirectoryID() public method

List all of the custom pages contained within a given directory ID
public listCustomPagesByDirectoryID ( integer $dir ) : array
$dir integer
return array

listSubDirectories() public method

List all of the subdirectories for a given cabin and directory
public listSubDirectories ( string $dir = '', string $cabin = CABIN_NAME ) : array
$dir string
$cabin string
return array

listSubDirectoriesByDirectoryID() public method

List all of the subdirectories contained within a given directory ID

moveDir() public method

Move/rename a directory
public moveDir ( integer $dirID, string $url = '', integer $parent, string $cabin = '' ) : boolean
$dirID integer
$url string
$parent integer
$cabin string
return boolean

movePage() public method

Move a page to a new directory
public movePage ( integer $pageId, string $url = '', integer $destinationDir ) : boolean
$pageId integer the page we're changing
$url string the new URL
$destinationDir integer the new directory
return boolean

movePagesToDir() public method

public movePagesToDir ( integer $parent, integer $destinationDir, boolean $createRedirect = false, string $oldCabin = '', string $newCabin = '', array $pieces = [] ) : boolean
$parent integer
$destinationDir integer
$createRedirect boolean
$oldCabin string
$newCabin string
$pieces array
return boolean

numCustomPages() public method

Get the number of custom pages.
public numCustomPages ( null $published = null ) : integer
$published null
return integer

recursiveDelete() public method

Delete everything within a given directory
public recursiveDelete ( integer $directoryID ) : boolean
$directoryID integer
return boolean

uniqueId() protected method

Get a unique ID (and make sure it doesn't exist)
protected uniqueId ( string $table, string $column = 'uniqueid' ) : string
$table string
$column string
return string

updatePage() public method

Create a new page (and initial page version)
public updatePage ( integer $pageId, array $post = [], boolean $publish = false, boolean | null $raw = null, boolean $cache = false ) : boolean
$pageId integer
$post array
$publish boolean (This is set to FALSE by the Landing if the permission check fails)
$raw boolean | null
$cache boolean
return boolean

updateRedirect() public method

Save changes to a custom redirect
public updateRedirect ( integer $redirectID, array $post ) : boolean
$redirectID integer
$post array
return boolean