WebPage
extends Document
in package
Common Web Page class.
Tags
Table of Contents
Properties
- $allItems : array<string|int, mixed>
- Array of links to all embedded objects.
- $body : BodyTag
- The object of the page body itself.
- $cascadeStyles : array<string|int, mixed>
- CSS fields to render.
- $cssPrefix : string
- Default CSS location in Debian.
- $drawStatus : bool
- Has the page already been rendered ?
- $head : HeadTag
- Page head.
- $javaScripts : array<string|int, mixed>
- JavaScripts to be in page.
- $jqueryJavaScript : string
- Where to look for jQuery script.
- $jsPrefix : string
- Default JavaScripts location in Debian.
- $lastItem : object
- A link to the last element added.
- $myTable : bool|string
- Do not connect to the DB.
- $pageClosed : bool
- Is page closed for adding new contents?
- $pageParts : array<string|int, mixed>
- Array of objects and fragments to draw.
- $pageTitle : string
- Page title.
- $raiseItems : array<string|int, mixed>
- Which objects to take over from the accepting object.
- $webPage : WebPage
- A link to the base object of the page.
- $finalized : bool
- Is class finalized ?
- $embedName : string|null
- $instance : mixed
- Saves object instance (singleton...).
Methods
- __construct() : mixed
- Content to place inside of body.
- __toString() : string
- Render Obect (and its contents) as string.
- addAsFirst() : mixed
- Inserts as the first element in the object.
- addCSS() : bool
- Add another CSS definition to stack.
- addItem() : Document
- Add item into page body.
- addItemCustom() : mixed
- Inserts another element into the object.
- addItems() : array<string|int, mixed>
- Insert an array of elements.
- addJavaScript() : int
- Inserts JavaScript into the Page.
- addNextTo() : Embedable|string
- Inserts another element after the existing one.
- addToLastItem() : null|Container
- Adds an item to the last inserted item.
- addToScriptsStack() : int
- Inserts javascript into the bin of the page script.
- afterAdd() : void
- Method executed after adding object into new one.
- arrayToUrlParams() : mixed
- Returns fields as URL parameters.
- clearCascadeStylesCache() : bool
- Clears Cache of JavaScripts to be rendered into page.
- clearJavaScriptsCache() : bool
- Clears Cache of JavaScripts to be rendered into page.
- draw() : string
- Renders the contents of the object.
- drawAllContents() : void
- It recursively scans all inserted objects and calls their draw ().
- drawIfNotDrawn() : void
- Draw contents not drawn yet.
- embedablize() : Embedable
- Always returns Embedable item.
- emptyContents() : void
- Empties webpage contents.
- finalize() : void
- Method executed before rendering.
- finalizeRegistred() : void
- Finalizes all registered objects.
- getContents() : mixed
- Get body Contentets.
- getFirstPart() : mixed
- Returns the first inserted item.
- getGetValue() : string
- Returns the value of the page key parameter.
- getItemsCount() : int
- Return number of enclosed items in current page body or given object.
- getPageTitle() : string
- getPostValue() : mixed
- Returns the value of the page key parameter.
- getRendered() : string
- Returns the rendered contents of objects.
- getRequestValue() : mixed
- Returns the value of the page call parameter key.
- getRequestValues() : array<string|int, mixed>
- Returns $_REQUEST field.
- getStatusMessagesBlock() : DivTag
- Use this to show status messages on page.
- getTagID() : null|string
- Get ID for page body.
- getUri() : string
- Returns the desired address.
- includeCss() : bool
- Inserts a link to the CSS definition into the page.
- includeJavaScript() : string
- Includes Javascript into the Page.
- isEmpty() : bool
- Is body element empty ?
- isFinalized() : bool
- Returns the status of the part finalization of the flag.
- isFormPosted() : bool
- Was the page displayed after the form was submitted using the POST method?
- isPosted() : bool
- Is page called by Form Post ?
- lastItem() : Embedable|string
- Returns a link to the last inserted item.
- makePagePublic() : bool
- Open Previously closed Web Page.
- onlyForLogged() : bool
- Redirects the unlogged-in user to the login page.
- phpSelf() : string
- Returns the current URL. This is instead of PHP_SELF which is unsafe.
- redirect() : void
- Perform http redirect.
- registerItem() : void
- Registers the item for finalization.
- sanitizeAsType() : mixed
- It treats the transformation according to its expected type.
- setEmbedName() : bool
- Notify component about its embed name.
- setFinalized() : void
- Set label of parts finalized.
- setPageTitle() : void
- Sets the title of the web page.
- setTagID() : string
- Set ID for page body.
- singleton() : WebPage
- suicide() : mixed
- Allows an already inserted object to be removed from the tree for rendering.
- webPage() : WebPage
- Returns or registers an instance of a Web page.
Properties
$allItems
Array of links to all embedded objects.
public
static array<string|int, mixed>
$allItems
= []
of pointers to all items to be rendered
$body
The object of the page body itself.
public
BodyTag
$body
$cascadeStyles
CSS fields to render.
public
array<string|int, mixed>
$cascadeStyles
= []
$cssPrefix
Default CSS location in Debian.
public
string
$cssPrefix
= '/javascript/'
$drawStatus
Has the page already been rendered ?
public
bool
$drawStatus
= false
$head
Page head.
public
HeadTag
$head
$javaScripts
JavaScripts to be in page.
public
array<string|int, mixed>
$javaScripts
= []
$jqueryJavaScript
Where to look for jQuery script.
public
string
$jqueryJavaScript
= 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js'
path or URL
$jsPrefix
Default JavaScripts location in Debian.
public
string
$jsPrefix
= '/javascript/'
$lastItem
A link to the last element added.
public
object
$lastItem
$myTable
Do not connect to the DB.
public
bool|string
$myTable
= ''
$pageClosed
Is page closed for adding new contents?
public
static bool
$pageClosed
= false
$pageParts
Array of objects and fragments to draw.
public
array<string|int, mixed>
$pageParts
= []
$pageTitle
Page title.
public
string
$pageTitle
= ''
$raiseItems
Which objects to take over from the accepting object.
public
array<string|int, mixed>
$raiseItems
= ['SetUpUser' => 'User', 'webPage', 'OutputFormat']
$webPage
A link to the base object of the page.
public
static WebPage
$webPage
$finalized
Is class finalized ?
protected
bool
$finalized
= false
$embedName
private
string|null
$embedName
= null
$instance
Saves object instance (singleton...).
private
static mixed
$instance
Methods
__construct()
Content to place inside of body.
public
__construct([string $pageTitle = '' ][, array<string|int, mixed> $toBody = [] ]) : mixed
Parameters
- $pageTitle : string = ''
- $toBody : array<string|int, mixed> = []
__toString()
Render Obect (and its contents) as string.
public
__toString() : string
Return values
stringaddAsFirst()
Inserts as the first element in the object.
public
& addAsFirst(mixed $pageItem[, string $pageItemName = null ]) : mixed
Parameters
- $pageItem : mixed
-
value or EaseObject with draw () method
- $pageItemName : string = null
-
under this name, the object is inserted into the tree
Return values
mixed —A reference to the embedded object
addCSS()
Add another CSS definition to stack.
public
addCSS(string $css) : bool
Parameters
- $css : string
-
definice CSS pravidla
Return values
booladdItem()
Add item into page body.
public
& addItem(mixed $item[, string $pageItemName = null ]) : Document
Parameters
- $item : mixed
-
inserted item
- $pageItemName : string = null
-
Under this name, the object is inserted into the tree
Return values
Document —poiner to object well included
addItemCustom()
Inserts another element into the object.
public
static & addItemCustom(Embedable|string $pageItem, Embedable $context) : mixed
Parameters
- $pageItem : Embedable|string
-
value or EaseObject with draw () method
- $context : Embedable
-
Object into which elements / items are inserted
Return values
mixed —Pointer to embed object
addItems()
Insert an array of elements.
public
addItems(array<string|int, mixed> $itemes) : array<string|int, mixed>
Parameters
- $itemes : array<string|int, mixed>
-
value field or EaseObject with draw () method
Return values
array<string|int, mixed> —inserted items
addJavaScript()
Inserts JavaScript into the Page.
public
addJavaScript(string $javaScript[, string $position = '0' ][, bool $inDocumentReady = true ]) : int
Parameters
- $javaScript : string
-
JS code
- $position : string = '0'
-
final position: '+','-','0','--',...
- $inDocumentReady : bool = true
-
paste into a DocumentReady block ?
Return values
intaddNextTo()
Inserts another element after the existing one.
public
& addNextTo(mixed $pageItem) : Embedable|string
Parameters
- $pageItem : mixed
-
value or EaseObject with draw () method
Return values
Embedable|string —a link to the embedded object
addToLastItem()
Adds an item to the last inserted item.
public
addToLastItem(object $pageItem) : null|Container
Parameters
- $pageItem : object
-
value or EaseObject with draw () method
Return values
null|Container —success
addToScriptsStack()
Inserts javascript into the bin of the page script.
public
addToScriptsStack(string $code[, string $position = 0 ]) : int
Parameters
- $code : string
-
JS code
- $position : string = 0
-
final position: '+','-','0','--',...
Return values
intafterAdd()
Method executed after adding object into new one.
public
afterAdd() : void
arrayToUrlParams()
Returns fields as URL parameters.
public
static arrayToUrlParams(array<string|int, mixed> $params[, string $baseUrl = '' ]) : mixed
Parameters
- $params : array<string|int, mixed>
- $baseUrl : string = ''
clearCascadeStylesCache()
Clears Cache of JavaScripts to be rendered into page.
public
static clearCascadeStylesCache() : bool
Return values
boolclearJavaScriptsCache()
Clears Cache of JavaScripts to be rendered into page.
public
static clearJavaScriptsCache() : bool
Return values
booldraw()
Renders the contents of the object.
public
draw() : string
Return values
string —Empty string
drawAllContents()
It recursively scans all inserted objects and calls their draw ().
public
drawAllContents() : void
drawIfNotDrawn()
Draw contents not drawn yet.
public
drawIfNotDrawn() : void
embedablize()
Always returns Embedable item.
public
static embedablize(mixed $item) : Embedable
Parameters
- $item : mixed
Return values
EmbedableemptyContents()
Empties webpage contents.
public
emptyContents() : void
finalize()
Method executed before rendering.
public
finalize() : void
finalizeRegistred()
Finalizes all registered objects.
public
finalizeRegistred() : void
getContents()
Get body Contentets.
public
getContents() : mixed
getFirstPart()
Returns the first inserted item.
public
getFirstPart() : mixed
getGetValue()
Returns the value of the page key parameter.
public
static getGetValue(string $field[, string $sanitizeAs = null ]) : string
Parameters
- $field : string
-
key GET
- $sanitizeAs : string = null
-
treat the returned value as float|int|string
Return values
stringgetItemsCount()
Return number of enclosed items in current page body or given object.
public
getItemsCount() : int
Return values
intgetPageTitle()
public
getPageTitle() : string
Return values
stringgetPostValue()
Returns the value of the page key parameter.
public
static getPostValue(string $field[, string $sanitizeAs = null ]) : mixed
Parameters
- $field : string
-
key POST
- $sanitizeAs : string = null
-
treat the returned value as float|int|string
getRendered()
Returns the rendered contents of objects.
public
getRendered() : string
Return values
stringgetRequestValue()
Returns the value of the page call parameter key.
public
static getRequestValue(string $field[, string $sanitizeAs = null ]) : mixed
Parameters
- $field : string
-
key POST or GET
- $sanitizeAs : string = null
-
treat the returned value as float|int|string
getRequestValues()
Returns $_REQUEST field.
public
getRequestValues() : array<string|int, mixed>
Return values
array<string|int, mixed>getStatusMessagesBlock()
Use this to show status messages on page.
public
getStatusMessagesBlock([array<string|int, mixed> $properties = [] ]) : DivTag
Parameters
- $properties : array<string|int, mixed> = []
-
Div properties
Return values
DivTaggetTagID()
Get ID for page body.
public
getTagID() : null|string
Return values
null|string —Page BODY ID
getUri()
Returns the desired address.
public
static getUri() : string
Return values
stringincludeCss()
Inserts a link to the CSS definition into the page.
public
includeCss(string $cssFile[, bool $fwPrefix = false ][, string $media = 'screen' ]) : bool
Parameters
- $cssFile : string
-
file CSS url
- $fwPrefix : bool = false
-
Add framework path? (usually /Ease/)
- $media : string = 'screen'
-
screen|printer|braile etc
Return values
bool —success
includeJavaScript()
Includes Javascript into the Page.
public
includeJavaScript(string $javaScriptFile[, string $position = null ]) : string
Parameters
- $javaScriptFile : string
-
javascript file
- $position : string = null
-
final position: '+','-','0','--',...
Return values
stringisEmpty()
Is body element empty ?
public
isEmpty() : bool
Return values
bool —emptiness
isFinalized()
Returns the status of the part finalization of the flag.
public
isFinalized() : bool
Return values
boolisFormPosted()
Was the page displayed after the form was submitted using the POST method?
public
static isFormPosted() : bool
Tags
Return values
boolisPosted()
Is page called by Form Post ?
public
static isPosted() : bool
Return values
boollastItem()
Returns a link to the last inserted item.
public
& lastItem() : Embedable|string
Return values
Embedable|stringmakePagePublic()
Open Previously closed Web Page.
public
makePagePublic() : bool
Return values
boolonlyForLogged()
Redirects the unlogged-in user to the login page.
public
onlyForLogged([string $loginPage = 'login.php' ][, null|mixed $message = null ]) : bool
Parameters
- $loginPage : string = 'login.php'
-
login page address
- $message : null|mixed = null
Return values
bool —Logged
phpSelf()
Returns the current URL. This is instead of PHP_SELF which is unsafe.
public
static phpSelf([bool $dropqs = true ]) : string
Parameters
- $dropqs : bool = true
-
whether to drop the querystring or not. Default true
Return values
string —the current URL or NULL for php-cli
redirect()
Perform http redirect.
public
redirect(string $url) : void
Parameters
- $url : string
-
redirect to URL
registerItem()
Registers the item for finalization.
public
static registerItem(mixed &$itemPointer) : void
Parameters
- $itemPointer : mixed
sanitizeAsType()
It treats the transformation according to its expected type.
public
static sanitizeAsType(mixed $value, string $sanitizeAs) : mixed
Parameters
- $value : mixed
-
value
- $sanitizeAs : string
-
value type int|string|float|null
setEmbedName()
Notify component about its embed name.
public
setEmbedName(string $embedName) : bool
Parameters
- $embedName : string
-
parent::$pageParts[$embedName] == self
Return values
bool —success
setFinalized()
Set label of parts finalized.
public
setFinalized([bool $flag = true ]) : void
Parameters
- $flag : bool = true
-
finalization flag
setPageTitle()
Sets the title of the web page.
public
setPageTitle(string $pageTitle) : void
Parameters
- $pageTitle : string
-
title
setTagID()
Set ID for page body.
public
setTagID([null|mixed $tagID = null ]) : string
Parameters
- $tagID : null|mixed = null
Return values
stringsingleton()
public
static singleton([null|mixed $webPage = null ]) : WebPage
Parameters
- $webPage : null|mixed = null
Return values
WebPagesuicide()
Allows an already inserted object to be removed from the tree for rendering.
public
suicide() : mixed
webPage()
Returns or registers an instance of a Web page.
public
static & webPage([WebPage $oPage = null ]) : WebPage
Parameters
- $oPage : WebPage = null
-
website object to register