Documentation

AbstractSite extends CoreObject
in package
implements Site uses FileConfiguration

AbstractYes

An abstract implementation of the Site interface

Tags
author

Jason Savell jsavell@library.tamu.edu

Table of Contents

Interfaces

Site
An interface defining a Site Sites provide a single, unified application context throughout the execution of the application, providing state information to components, and allowing them to alter the flow of the application without direct knowledge of the inner workings of the other components.

Constants

SITE_PAGES_CONFIG_FILE  = "site.pages"

Properties

$currentPage  : SitePage
$sanitizedInputData  : array<string|int, string>
$systemMessages  : array<string|int, SystemMessage>
$configs  : array<string, array<string|int, mixed>>
$globalUser  : User
$pages  : array<string|int, SitePage>
$siteConfig  : array<string|int, mixed>
$viewRenderer  : ViewRenderer

Methods

addSystemMessage()  : void
Push a new message string to the Site's system messages
generateSanitizedInputData()  : void
Generate safe input data from GET/POST/REQUEST Restricts basic repo actions (insert,remove,update) to POST Override this method to restrict additional app specific actions
getAppConfiguration()  : array<string|int, mixed>
Provides a single instance of the global app configuration to all extenders of CoreObject
getControllerClass()  : string
Get the Controller class associated with the given name
getCurrentPage()  : SitePage
Gets the currently requested page
getDataRepository()  : DataRepository|null
Provides a uniform approach to fetching Interfaces\DataRepository Should handle all instantiation and any desired caching of repositories
getGlobalUser()  : User
Get a representation of the application user associated with a request.
getHelper()  : AbstractHelper|null
Provides a uniform approach to fetching Helper service classes Should handle all instantiation and any desired caching of Helpers
getLogger()  : Logger
Provides a single instance of a configured Logger to all extenders of CoreObject
getPages()  : array<string|int, SitePage>
Get the pages defined for the Site.
getSanitizedInputData()  : array<string|int, mixed>
Provide a sanitized and secured version of user input data (POST,GET,COOKIE,etc) to components All components should access user input data exclusively through this method.
getSiteConfig()  : array<string|int, mixed>
Returns the site configuration
getSystemMessages()  : array<string|int, SystemMessage>
Get the Site's SystemMessages
getViewRenderer()  : ViewRenderer
Get the ViewRenderer. Components like Controllers can access this method to configure the set ViewRenderer.
hasRedirectUrl()  : bool
redirect()  : void
setCurrentPage()  : void
Sets the currently requested page
setRedirectUrl()  : void
Define a redirect URL.
setViewRenderer()  : void
Set the ViewRenderer.
configurationFileExists()  : bool
Checks for the existence of a file with the given filename
getConfigurationFromFileName()  : array<string|int, mixed>
Retrieves a config array by its corresponding filename
setGlobalUser()  : void
Set a representation of the application user associated with a request.
setPages()  : void
Set the pages for the Site.
setSiteConfig()  : void
Sets the site configuration
setUser()  : void
Sets the logged in user
loadConfigurationFile()  : void
Loads and parses a php ini file into an array keyed by ini sections

Constants

SITE_PAGES_CONFIG_FILE

private mixed SITE_PAGES_CONFIG_FILE = "site.pages"

Properties

$sanitizedInputData

protected array<string|int, string> $sanitizedInputData

HTTP Request (GET, POST, etc..) data.

$configs

private array<string, array<string|int, mixed>> $configs = []

An array of configuration arrays

$globalUser

private User $globalUser

An array containing data about the logged in user

$siteConfig

private array<string|int, mixed> $siteConfig

An array containing the site configuration

Methods

addSystemMessage()

Push a new message string to the Site's system messages

public abstract addSystemMessage(mixed $message[, mixed $type = "info" ]) : void
Parameters
$message : mixed

The message

$type : mixed = "info"

The type of the message

generateSanitizedInputData()

Generate safe input data from GET/POST/REQUEST Restricts basic repo actions (insert,remove,update) to POST Override this method to restrict additional app specific actions

public generateSanitizedInputData() : void

getAppConfiguration()

Provides a single instance of the global app configuration to all extenders of CoreObject

public getAppConfiguration() : array<string|int, mixed>
Return values
array<string|int, mixed>

getControllerClass()

Get the Controller class associated with the given name

public abstract getControllerClass(mixed $controllerName) : string
Parameters
$controllerName : mixed
Return values
string

$controllerClass An instantiable string representation of the Controller class name

getCurrentPage()

Gets the currently requested page

public getCurrentPage() : SitePage
Return values
SitePage

The currently requested SitePage

getDataRepository()

Provides a uniform approach to fetching Interfaces\DataRepository Should handle all instantiation and any desired caching of repositories

public abstract getDataRepository(string $repositoryName) : DataRepository|null
Parameters
$repositoryName : string

The name of the desired Interfaces\DataRepository

Return values
DataRepository|null

getGlobalUser()

Get a representation of the application user associated with a request.

public getGlobalUser() : User
Return values
User

getHelper()

Provides a uniform approach to fetching Helper service classes Should handle all instantiation and any desired caching of Helpers

public abstract getHelper(string $helperName) : AbstractHelper|null
Parameters
$helperName : string

The name of the desired Helper

Return values
AbstractHelper|null

getLogger()

Provides a single instance of a configured Logger to all extenders of CoreObject

public getLogger() : Logger
Return values
Logger

getPages()

Get the pages defined for the Site.

public getPages() : array<string|int, SitePage>
Return values
array<string|int, SitePage>

getSanitizedInputData()

Provide a sanitized and secured version of user input data (POST,GET,COOKIE,etc) to components All components should access user input data exclusively through this method.

public getSanitizedInputData() : array<string|int, mixed>
Return values
array<string|int, mixed>

getSiteConfig()

Returns the site configuration

public getSiteConfig() : array<string|int, mixed>
Return values
array<string|int, mixed>

$siteConfig

getViewRenderer()

Get the ViewRenderer. Components like Controllers can access this method to configure the set ViewRenderer.

public getViewRenderer() : ViewRenderer
Return values
ViewRenderer

The currently set ViewRenderer

hasRedirectUrl()

public abstract hasRedirectUrl() : bool
Return values
bool

setCurrentPage()

Sets the currently requested page

public setCurrentPage(SitePage $page) : void
Parameters
$page : SitePage

The currently requested SitePage

setRedirectUrl()

Define a redirect URL.

public abstract setRedirectUrl(mixed $redirectUrl) : void
Parameters
$redirectUrl : mixed

setViewRenderer()

Set the ViewRenderer.

public setViewRenderer(mixed $viewRenderer) : void
Parameters
$viewRenderer : mixed

configurationFileExists()

Checks for the existence of a file with the given filename

protected configurationFileExists(string $configurationFileName) : bool
Parameters
$configurationFileName : string

The name of the file without extension or path

Return values
bool

getConfigurationFromFileName()

Retrieves a config array by its corresponding filename

protected getConfigurationFromFileName(string $configurationFileName) : array<string|int, mixed>
Parameters
$configurationFileName : string

The name of the file without extension or path

Return values
array<string|int, mixed>

setGlobalUser()

Set a representation of the application user associated with a request.

protected setGlobalUser(User $globalUser) : void
Parameters
$globalUser : User

The application user

setPages()

Set the pages for the Site.

protected setPages() : void

setSiteConfig()

Sets the site configuration

protected setSiteConfig(array<string|int, mixed> $siteConfig) : void
Parameters
$siteConfig : array<string|int, mixed>

The site configuration

setUser()

Sets the logged in user

protected abstract setUser() : void

loadConfigurationFile()

Loads and parses a php ini file into an array keyed by ini sections

private loadConfigurationFile(string $configurationFileName) : void
Parameters
$configurationFileName : string

The name of the file without extension or path


        
On this page

Search results