Documentation

BanIP extends AdminFormPage
in package

Class BanIP

Table of Contents

Properties

$translators  : array<string|int, mixed>
$action_buttons  : array<string|int, mixed>
$blocked_ips  : array<string|int, mixed>
$container  : ContainerInterface
$current_user  : array<string|int, mixed>|object|null
$current_user_model  : AccountModel|null
$page_title  : string
$request  : Request|null
$response  : Response
$route_info  : RouteInfo|null
$template  : Template|null

Methods

__call()  : mixed
{@inheritdoc}
__construct()  : mixed
BasePage constructor.
__toString()  : string
toString magic method
addActionButton()  : self
adds an action button
addActionLink()  : self
adds an action link
addBackButton()  : void
adds a back button to page
addErrorFlashMessage()  : self
adds a error flash message
addFlashMessage()  : self
adds a flash message for next response
addInfoFlashMessage()  : self
adds an info flash message
addSuccessFlashMessage()  : self
adds a success flash message
addWarningFlashMessage()  : self
adds a warning flash message
calcTokenId()  : string
calculates JWT token id
canBeFPC()  : bool
specifies if this controller is eligible for full page cache
checkPermission()  : bool
checks if current user has permission
containerCall()  : mixed
call method through container
containerMake()  : mixed
create object through container
dropFlashMessages()  : self
removes all currently stored flash messages
formSubmitted()  : mixed
handles form submission
formValidate()  : bool|string
validates form submission
getAccessPermission()  : string
gets access permission name
getAdminPageLink()  : array<string|int, mixed>|null
returns admin sidebar link info array, if any
getApp()  : App
gets app object
getAppRouteInfo()  : RouteInfo|null
gets route info
getAppWebsite()  : Website|null
gets current website
getAssets()  : Manager
gets assets manager
getBaseTemplateData()  : array<string|int, mixed>
prepares basic template data
getCache()  : Manager
get cache manager
getCacheKey()  : string
gets cache key
getContainer()  : ContainerInterface
gets container object
getControllerUrl()  : string
gets current controller url
getCrudRouter()  : Crud
gets crud service
getCurrentLocale()  : string|null
{@inheritdoc}
getCurrentUser()  : AccountModel|null
gets current user
getDb()  : Database
gets db object
getDebugbar()  : StandardDebugBar
gets debugbar object
getDestParam()  : string
gets the destination param
getEnv()  : mixed
gets env variable
getEventManager()  : SharedEventEmitter
gets events manager service
getFlashMessages()  : array<string|int, mixed>|null
gets currently stored flash messages
getForm()  : Form|null
get form object
getFormDefinition()  : Form
gets form definition object
getFpcCacheKey()  : string
gets fpc cache key
getGoogleAuthenticator()  : PHPGangsta_GoogleAuthenticator
gets google authenticator service
getGuzzle()  : Client
gets guzzle service
getHtmlRenderer()  : HtmlPartsRenderer
gets html renderer service
getIcons()  : Icons
gets icons service
getImagine()  : Imagine
gets imagine service
getInfo()  : array<string|int, mixed>
gets info about current page
getLog()  : Logger
gets log object
getMailer()  : Mailer
gets mailer service
getPageRouteName()  : string
gets controller route name
getPageTitle()  : string
gets page title
getPdo()  : PDO
gets PDO object
getRedis()  : Manager
gets redis service
getRequest()  : Request
get request object
getRewriteObject()  : Rewrite|null
gets rewrite object
getRouteGroup()  : string|null
gets route group
getRouteInfo()  : RouteInfo|null
get route_info
getRouteName()  : string
gets current route name
getRouters()  : array<string|int, mixed>
gets routers
getRouteVerbs()  : array<string|int, mixed>
returns valid route HTTP verbs
getSchema()  : Schema
gets schema object
getSearch()  : Manager
gets search service
getSesMailer()  : SesClient
gets SES mailer service
getSidebarSize()  : string
get sidebar size
getSiteData()  : SiteData
gets site data service
getSmtpMailer()  : Swift_Mailer
gets SMTP mailer service
getTemplate()  : Template|null
get current template
getTemplateData()  : array<string|int, mixed>
gets current page template data
getTemplateName()  : string
gets current page template name
getTemplates()  : Engine
gets plates engine object
getTranslator()  : Translator
gets translator
getUrl()  : string
gets url by route_name and params
getUtils()  : Globals
gets global utils service
getWebhooksRouter()  : Webhooks
gets webhooks service
getWebRouter()  : Web
gets routing service
getZip()  : Zip
gets zip service
hasLoggedUser()  : bool
checks if user is logged in
isCrud()  : bool
isEnabled()  : bool
determines if route is available for router
isHomePage()  : bool
checks if current is homepage
isWeb()  : bool
process()  : Response
controller action
removeAction()  : self
removes an action link / button
renderPage()  : BasePage|Response
controller entrypoint
requestUrl()  : string|bool
executes an http request
setRouteInfo()  : BasePage
set route info
tokenIsActive()  : bool
checks if token is still active
addSubmitButton()  : Form
adds submit button to form
beforeRender()  : Response|self
{@intheritdocs}
checkCredentials()  : bool
checks user credentials
doRedirect()  : RedirectResponse
returns a redirect object
fillConfirmationForm()  : Form
gets a form for confirmation
getBanFileContents()  : string
gets new ban IPS file contents
getBanFileName()  : string
gets ban IPS file path
getFormId()  : string
gets form id
getResponse()  : Response
get response object
getRouteData()  : mixed
gets route data
getService()  : mixed
gets registered service
getTokenData()  : mixed
gets token data
isSubmitted()  : bool
check if form is submitted
normalizeCacheKey()  : string
prepareTemplate()  : Template
{@inheritfocs}
refreshPage()  : RedirectResponse
returns a redirect object to same page
renderActionButtons()  : string
renders action buttons
processFormSubmit()  : void
process form submission

Properties

$translators

public static array<string|int, mixed> $translators = []

translators

$action_buttons

protected array<string|int, mixed> $action_buttons = []

action_buttons

$blocked_ips

protected array<string|int, mixed> $blocked_ips = []

blocked ips list

$current_user

protected array<string|int, mixed>|object|null $current_user = null

current user data

$page_title

protected string $page_title

page title

$response

protected Response $response

response object

$template

protected Template|null $template = null

template object

Methods

__construct()

BasePage constructor.

public __construct(ContainerInterface $container[, Request $request = null ][, RouteInfo $route_info = null ]) : mixed
Parameters
$container : ContainerInterface
$request : Request = null
$route_info : RouteInfo = null
Tags
throws
BasicException
throws
DependencyException
throws
FormException
throws
NotFoundException
throws
PermissionDeniedException

__toString()

toString magic method

public __toString() : string
Return values
string

the form html

addActionButton()

adds an action button

public addActionButton(string $key, string $button_id, string $button_text[, string $button_class = 'btn btn-sm btn-light' ]) : self
Parameters
$key : string
$button_id : string
$button_text : string
$button_class : string = 'btn btn-sm btn-light'
Return values
self

adds an action link

public addActionLink(mixed $key, mixed $link_id, mixed $link_text[, string $link_href = '#' ][, string $link_class = 'btn btn-sm btn-light' ][, array<string|int, mixed> $attributes = [] ]) : self
Parameters
$key : mixed
$link_id : mixed
$link_text : mixed
$link_href : string = '#'
$link_class : string = 'btn btn-sm btn-light'
$attributes : array<string|int, mixed> = []
Return values
self

addBackButton()

adds a back button to page

public addBackButton([array<string|int, mixed>|null $query_params = null ]) : void
Parameters
$query_params : array<string|int, mixed>|null = null
Tags
throws
BasicException
throws
DependencyException
throws
NotFoundException

addErrorFlashMessage()

adds a error flash message

public addErrorFlashMessage(string $message[, bool $direct = false ]) : self
Parameters
$message : string
$direct : bool = false

store message in session

Tags
throws
DependencyException
throws
NotFoundException
Return values
self

addFlashMessage()

adds a flash message for next response

public addFlashMessage(string $type, string $message[, bool $direct = false ]) : self
Parameters
$type : string
$message : string
$direct : bool = false

store message in session

Tags
throws
DependencyException
throws
NotFoundException
Return values
self

addInfoFlashMessage()

adds an info flash message

public addInfoFlashMessage(string $message[, bool $direct = false ]) : self
Parameters
$message : string
$direct : bool = false

store message in session

Tags
throws
DependencyException
throws
NotFoundException
Return values
self

addSuccessFlashMessage()

adds a success flash message

public addSuccessFlashMessage(string $message[, bool $direct = false ]) : self
Parameters
$message : string
$direct : bool = false

store message in session

Tags
throws
DependencyException
throws
NotFoundException
Return values
self

addWarningFlashMessage()

adds a warning flash message

public addWarningFlashMessage(string $message[, bool $direct = false ]) : self
Parameters
$message : string
$direct : bool = false

store message in session

Tags
throws
DependencyException
throws
NotFoundException
Return values
self

calcTokenId()

calculates JWT token id

public calcTokenId(int $uid, string $username) : string
Parameters
$uid : int
$username : string
Return values
string

canBeFPC()

specifies if this controller is eligible for full page cache

public canBeFPC() : bool
Return values
bool

checkPermission()

checks if current user has permission

public checkPermission(string $permission_name) : bool
Parameters
$permission_name : string
Tags
throws
BasicException
Return values
bool

containerCall()

call method through container

public containerCall(callable $callable[, array<string|int, mixed> $arguments = [] ]) : mixed
Parameters
$callable : callable
$arguments : array<string|int, mixed> = []

containerMake()

create object through container

public containerMake(string $className[, array<string|int, mixed> $arguments = [] ]) : mixed
Parameters
$className : string
$arguments : array<string|int, mixed> = []

dropFlashMessages()

removes all currently stored flash messages

public dropFlashMessages() : self
Return values
self

formSubmitted()

handles form submission

public formSubmitted(Form $form, array<string|int, mixed> &$form_state) : mixed
Parameters
$form : Form
$form_state : array<string|int, mixed>
Tags
throws
BasicException
throws
DependencyException
throws
NotFoundException

formValidate()

validates form submission

public formValidate(Form $form, array<string|int, mixed> &$form_state) : bool|string
Parameters
$form : Form
$form_state : array<string|int, mixed>
Return values
bool|string

getAccessPermission()

gets access permission name

public static getAccessPermission() : string
Return values
string

returns admin sidebar link info array, if any

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

getBaseTemplateData()

prepares basic template data

public getBaseTemplateData() : array<string|int, mixed>
Tags
throws
DependencyException
throws
NotFoundException
Return values
array<string|int, mixed>

getCacheKey()

gets cache key

public getCacheKey() : string
Return values
string

getContainer()

gets container object

public getContainer() : ContainerInterface
Return values
ContainerInterface

getControllerUrl()

gets current controller url

public getControllerUrl() : string
Tags
throws
BasicException
Return values
string

getCurrentLocale()

{@inheritdoc}

public getCurrentLocale() : string|null
Tags
throws
BasicException
throws
DependencyException
throws
NotFoundException
Return values
string|null

getCurrentUser()

gets current user

public getCurrentUser([bool $reset = false ]) : AccountModel|null
Parameters
$reset : bool = false
Tags
throws
DependencyException
throws
NotFoundException
Return values
AccountModel|null

getDb()

gets db object

public getDb() : Database
Tags
throws
BasicException
Return values
Database

getDebugbar()

gets debugbar object

public getDebugbar() : StandardDebugBar
Tags
throws
BasicException
Return values
StandardDebugBar

getDestParam()

gets the destination param

public getDestParam([null $destination_url = null ]) : string
Parameters
$destination_url : null = null
Tags
throws
BasicException
Return values
string

getEnv()

gets env variable

public getEnv(string $variable[, mixed $default = null ]) : mixed
Parameters
$variable : string
$default : mixed = null
Tags
throws
BasicException

getEventManager()

gets events manager service

public getEventManager() : SharedEventEmitter
Tags
throws
BasicException
Return values
SharedEventEmitter

getFlashMessages()

gets currently stored flash messages

public getFlashMessages([bool $direct = false ]) : array<string|int, mixed>|null
Parameters
$direct : bool = false

session stored flash messages

Return values
array<string|int, mixed>|null

getForm()

get form object

public getForm() : Form|null
Return values
Form|null

getFormDefinition()

gets form definition object

public getFormDefinition(Form $form, array<string|int, mixed> &$form_state) : Form
Parameters
$form : Form
$form_state : array<string|int, mixed>
Tags
throws
BasicException
throws
DependencyException
throws
FormException
throws
NotFoundException
Return values
Form

getFpcCacheKey()

gets fpc cache key

public getFpcCacheKey() : string
Return values
string

getGoogleAuthenticator()

gets google authenticator service

public getGoogleAuthenticator() : PHPGangsta_GoogleAuthenticator
Tags
throws
BasicException
Return values
PHPGangsta_GoogleAuthenticator

getGuzzle()

gets guzzle service

public getGuzzle() : Client
Tags
throws
BasicException
Return values
Client

getIcons()

gets icons service

public getIcons() : Icons
Tags
throws
BasicException
Return values
Icons

getImagine()

gets imagine service

public getImagine() : Imagine
Tags
throws
BasicException
Return values
Imagine

getInfo()

gets info about current page

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

getLog()

gets log object

public getLog() : Logger
Tags
throws
BasicException
Return values
Logger

getPageRouteName()

gets controller route name

public static getPageRouteName() : string
Return values
string

getPageTitle()

gets page title

public getPageTitle() : string
Return values
string

getPdo()

gets PDO object

public getPdo() : PDO
Tags
throws
BasicException
Return values
PDO

getRequest()

get request object

public getRequest() : Request
Return values
Request

getRouteGroup()

gets route group

public static getRouteGroup() : string|null
Return values
string|null

getRouteName()

gets current route name

public getRouteName() : string
Return values
string

getRouters()

gets routers

public getRouters() : array<string|int, mixed>
Tags
throws
BasicException
Return values
array<string|int, mixed>

getRouteVerbs()

returns valid route HTTP verbs

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

getSchema()

gets schema object

public getSchema() : Schema
Tags
throws
BasicException
Return values
Schema

getSesMailer()

gets SES mailer service

public getSesMailer() : SesClient
Tags
throws
BasicException
Return values
SesClient

getSidebarSize()

get sidebar size

public getSidebarSize() : string
Return values
string

getSmtpMailer()

gets SMTP mailer service

public getSmtpMailer() : Swift_Mailer
Tags
throws
BasicException
Return values
Swift_Mailer

getTemplate()

get current template

public getTemplate() : Template|null
Return values
Template|null

getTemplateData()

gets current page template data

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

getTemplateName()

gets current page template name

public getTemplateName() : string
Return values
string

getTemplates()

gets plates engine object

public getTemplates() : Engine
Tags
throws
BasicException
Return values
Engine

getTranslator()

gets translator

public getTranslator([string|null $locale_code = null ]) : Translator
Parameters
$locale_code : string|null = null
Tags
throws
DependencyException
throws
NotFoundException
Return values
Translator

getUrl()

gets url by route_name and params

public getUrl(string $route_name[, array<string|int, mixed> $route_params = [] ]) : string
Parameters
$route_name : string
$route_params : array<string|int, mixed> = []
Tags
throws
BasicException
Return values
string

hasLoggedUser()

checks if user is logged in

public hasLoggedUser() : bool
Tags
throws
DependencyException
throws
NotFoundException
Return values
bool

isEnabled()

determines if route is available for router

public static isEnabled() : bool
Return values
bool

isHomePage()

checks if current is homepage

public isHomePage() : bool
Tags
throws
BasicException
throws
DependencyException
throws
NotFoundException
throws
PhpfastcacheSimpleCacheException
Return values
bool

process()

controller action

public process([RouteInfo|null $route_info = null ][, array<string|int, mixed> $route_data = [] ]) : Response
Parameters
$route_info : RouteInfo|null = null
$route_data : array<string|int, mixed> = []
Tags
throws
BasicException
throws
Throwable
throws
PhpfastcacheSimpleCacheException
Return values
Response

removeAction()

removes an action link / button

public removeAction(mixed $key) : self
Parameters
$key : mixed
Return values
self

renderPage()

controller entrypoint

public renderPage([RouteInfo|null $route_info = null ][, array<string|int, mixed> $route_data = [] ]) : BasePage|Response
Parameters
$route_info : RouteInfo|null = null
$route_data : array<string|int, mixed> = []
Tags
throws
BasicException
throws
DependencyException
throws
NotFoundException
throws
PermissionDeniedException
throws
PhpfastcacheSimpleCacheException
throws
Throwable
throws
DebugBarException
Return values
BasePage|Response

requestUrl()

executes an http request

public requestUrl(string $url[, string $method = 'GET' ][, array<string|int, mixed> $options = [] ]) : string|bool
Parameters
$url : string
$method : string = 'GET'
$options : array<string|int, mixed> = []
Tags
throws
Exception
throws
GuzzleException
Return values
string|bool

tokenIsActive()

checks if token is still active

public tokenIsActive(Token $token) : bool
Parameters
$token : Token
Return values
bool

addSubmitButton()

adds submit button to form

protected addSubmitButton(Form $form[, bool $inline_button = false ][, mixed $isConfirmation = false ]) : Form
Parameters
$form : Form
$inline_button : bool = false
$isConfirmation : mixed = false
Tags
throws
FormException
Return values
Form

beforeRender()

{@intheritdocs}

protected beforeRender() : Response|self
Tags
throws
BasicException
throws
DependencyException
throws
NotFoundException
throws
PermissionDeniedException
Return values
Response|self

checkCredentials()

checks user credentials

protected checkCredentials() : bool
Tags
throws
BasicException
Return values
bool

doRedirect()

returns a redirect object

protected doRedirect(mixed $url[, array<string|int, mixed> $additional_headers = [] ]) : RedirectResponse
Parameters
$url : mixed
$additional_headers : array<string|int, mixed> = []
Return values
RedirectResponse

fillConfirmationForm()

gets a form for confirmation

protected fillConfirmationForm(string $confirm_message, Form $form[, null $cancel_url = null ]) : Form
Parameters
$confirm_message : string
$form : Form
$cancel_url : null = null
Tags
throws
BasicException
throws
DependencyException
throws
NotFoundException
Return values
Form

getBanFileContents()

gets new ban IPS file contents

protected getBanFileContents() : string
Return values
string

getBanFileName()

gets ban IPS file path

protected getBanFileName() : string
Return values
string

getFormId()

gets form id

protected getFormId() : string
Return values
string

getResponse()

get response object

protected getResponse() : Response
Return values
Response

getRouteData()

gets route data

protected getRouteData([null $var_name = null ]) : mixed
Parameters
$var_name : null = null

getService()

gets registered service

protected getService(string $service_key) : mixed
Parameters
$service_key : string
Tags
throws
BasicException

getTokenData()

gets token data

protected getTokenData() : mixed

isSubmitted()

check if form is submitted

protected isSubmitted() : bool
Return values
bool

normalizeCacheKey()

protected normalizeCacheKey(mixed $key) : string
Parameters
$key : mixed
Return values
string

prepareTemplate()

{@inheritfocs}

protected prepareTemplate() : Template
Tags
throws
BasicException
throws
DependencyException
throws
NotFoundException
Return values
Template

refreshPage()

returns a redirect object to same page

protected refreshPage() : RedirectResponse
Return values
RedirectResponse

renderActionButtons()

renders action buttons

protected renderActionButtons() : string
Tags
throws
DependencyException
throws
NotFoundException
Return values
string

        
On this page

Search results