jResponseHtml4
extends jResponseHtml
in package
Response class for HTML 4 or XHTML 1.x
Table of Contents
- $body : jTpl
- The template engine used to generate the body content
- $bodyErrorTpl : string
- Selector of the template used when there are some errors, instead of $bodyTpl
- $bodyTagAttributes : array<string|int, mixed>
- body attributes This attributes are written on the body tags
- $bodyTpl : string
- selector of the main template file This template should contains the body content, and is used by the $body template engine
- $favicon : string
- favicon url linked to the document
- $forcedHttpVersion : mixed
- $htmlFile : string
- full path of php file to output. it should content php instruction to display these variables: - $HEADTOP: content added just after the opening <head> tag - $HEADBOTTOM: content before the closing </head> tag - $BODYTOP: content just after the <body> tag, at the top of the page - $BODYBOTTOM: content just before the </body> tag, at the bottom of the page - $BASEPATH: base path of the application, for links of your style sheets etc.
- $httpVersion : mixed
- $IECompatibilityMode : string
- $metaViewport : string
- $title : string
- Title of the document
- $xhtmlContentType : bool
- says if xhtml content type should be send or not.
- $_bodyBottom : mixed
- $_bodyTop : mixed
- $_charset : string
- the charset of the document
- $_CSSIELink : array<string|int, array<string|int, mixed>>
- list of css stylesheet for IE
- $_CSSLink : array<string|int, array<string|int, mixed>>
- list of css stylesheet
- $_endTag : string
- the end tag to finish tags. it is different if we are in XHTML mode or not
- $_headBottom : mixed
- bottom content for head
- $_headTop : mixed
- top content for head
- $_httpHeaders : array<string|int, mixed>
- $_httpHeadersSent : bool
- $_httpStatusCode : string
- $_httpStatusMsg : string
- $_isXhtml : mixed
- $_JSCode : array<string|int, string>
- inline js code to insert after js links
- $_JSCodeBefore : array<string|int, string>
- inline js code to insert before js links
- $_JSIELink : array<string|int, array<string|int, mixed>>
- list of js script for IE
- $_JSLink : array<string|int, array<string|int, mixed>>
- list of js script
- $_lang : string
- the lang of the document
- $_Link : array<string|int, mixed>
- list of information to generate link tags
- $_Meta : array<string|int, array<string|int, mixed>>
- $_MetaAuthor : string
- content of the meta author tag
- $_MetaDescription : array<string|int, string>
- list of descriptions to add into a meta description tag
- $_MetaGenerator : string
- content of the meta generator tag
- $_MetaKeywords : array<string|int, string>
- list of keywords to add into a meta keyword tag
- $_MetaOldContentType : bool
- $_outputOnlyHeaders : bool
- $_strictDoctype : bool
- says if the document uses a Strict or Transitional Doctype
- $_Styles : array<string|int, string>
- list of CSS code
- $_type : string
- $plugins : array<string|int, jIHTMLResponsePlugin>
- list of plugins
- __construct() : mixed
- constructor
- addContent() : mixed
- add content to the body you can add additionnal content, before or after the content of body
- addCSSLink() : mixed
- add a link to a css stylesheet in the document head
- addCSSLinkModule() : mixed
- add a link to a css stylesheet stored into modules
- addCSSThemeLinkModule() : mixed
- add a link to a csstheme stylesheet stored into modules
- addHeadContent() : mixed
- add additional content into the document head
- addHttpHeader() : mixed
- add an http header to the response.
- addJSCode() : mixed
- add inline javascript code (inside a <script> tag)
- addJSLink() : mixed
- add a link to a javascript script in the document head
- addJSLinkModule() : mixed
- add a link to a javascript script stored into modules
- addLink() : mixed
- add a generic link to the head
- addMeta() : mixed
- add a meta element
- addMetaAuthor() : mixed
- add author(s) in a author meta tag
- addMetaDescription() : mixed
- add a description in a description meta tag
- addMetaGenerator() : mixed
- add generator a generator meta tag
- addMetaKeywords() : mixed
- add some keywords in a keywords meta tag
- addStyle() : mixed
- add inline css style into the document (inside a <style> tag)
- cleanCacheHeaders() : mixed
- Clean the differents caches headers
- clearHtmlHeader() : mixed
- used to erase some head properties
- clearHttpHeaders() : mixed
- delete all http headers
- endTag() : string
- return the end of a html tag : "/>" or ">", depending if it will generate xhtml or html
- getCSSIELinks() : array<string|int, mixed>
- returns all CSS links for IE
- getCSSLinks() : array<string|int, mixed>
- returns all CSS links
- getFormatType() : string
- return the format type name (eg the family type name)
- getJSIELinks() : array<string|int, mixed>
- returns all JS links for IE
- getJSLinks() : array<string|int, mixed>
- returns all JS links
- getPlugin() : jIHTMLResponsePlugin|null
- return the corresponding plugin
- getType() : string
- return the response type name
- isValidCache() : bool
- Use the HTPP headers Last-Modified to see if the ressource in client cache is fresh
- isXhtml() : bool
- says if the response will be xhtml or html
- output() : bool
- output the html content
- outputErrors() : mixed
- Send a response with a generic error message.
- setBodyAttributes() : mixed
- set attributes on the body tag
- setCSSIELinks() : mixed
- set all CSS links for IE
- setCSSLinks() : mixed
- set all CSS links
- setExpires() : mixed
- Set an expires header to the page/ressource.
- setHttpStatus() : mixed
- set the http status code for the http header
- setJSIELinks() : mixed
- set all JS links for IE
- setJSLinks() : mixed
- set all JS links
- setLifetime() : mixed
- Set a life time for the page/ressource.
- setTitle() : mixed
- set the title of the page
- setXhtmlOutput() : mixed
- change the type of html for the output
- strictDoctype() : mixed
- activate / deactivate the strict Doctype (activated by default)
- _checkRequestType() : mixed
- check if the request is of type GET or HEAD
- _normalizeDate() : string
- Normalize a date into GMT format
- doAfterActions() : mixed
- The method you can overload in your inherited html response overload it if you want to add processes (stylesheet, head settings, additionnal content etc..) after any actions
- outputCssLinkTag() : mixed
- outputDoctype() : mixed
- generate the doctype. You can override it if you want to have your own doctype, like XHTML+MATHML.
- outputHtmlHeader() : mixed
- generate the content of the <head> content
- outputJsScriptTag() : mixed
- outputMetaTag() : mixed
- sendHttpHeaders() : mixed
- send http headers
- setContentType() : mixed
- set the content-type in the http headers
Properties
$body
The template engine used to generate the body content
public
jTpl
$body
=
ull
$bodyErrorTpl
Selector of the template used when there are some errors, instead of $bodyTpl
public
string
$bodyErrorTpl
= ''
$bodyTagAttributes
body attributes This attributes are written on the body tags
public
array<string|int, mixed>
$bodyTagAttributes
= array()
$bodyTpl
selector of the main template file This template should contains the body content, and is used by the $body template engine
public
string
$bodyTpl
= ''
$favicon
favicon url linked to the document
public
string
$favicon
= ''
Tags
$forcedHttpVersion
public
mixed
$forcedHttpVersion
= alse
$htmlFile
full path of php file to output. it should content php instruction to display these variables: - $HEADTOP: content added just after the opening <head> tag - $HEADBOTTOM: content before the closing </head> tag - $BODYTOP: content just after the <body> tag, at the top of the page - $BODYBOTTOM: content just before the </body> tag, at the bottom of the page - $BASEPATH: base path of the application, for links of your style sheets etc.
public
string
$htmlFile
= ''
.
$httpVersion
public
mixed
$httpVersion
= '1.1'
$IECompatibilityMode
public
string
$IECompatibilityMode
= ''
indicate the value for the X-UA-Compatible meta element, which indicate the compatiblity mode of IE. Exemple: "IE=edge" In future version, default will be "IE=edge".
Tags
$metaViewport
public
string
$metaViewport
= ''
the content of the viewport meta element
Tags
$title
Title of the document
public
string
$title
= ''
$xhtmlContentType
says if xhtml content type should be send or not.
public
bool
$xhtmlContentType
= alse
it true, a verification of HTTP_ACCEPT is done.
$_bodyBottom
protected
mixed
$_bodyBottom
= array()
$_bodyTop
protected
mixed
$_bodyTop
= array()
$_charset
the charset of the document
protected
string
$_charset
$_CSSIELink
list of css stylesheet for IE
protected
array<string|int, array<string|int, mixed>>
$_CSSIELink
= array()
key = url, value=link attributes + optional parameter _iecondition
$_CSSLink
list of css stylesheet
protected
array<string|int, array<string|int, mixed>>
$_CSSLink
= array()
key = url, value=link attributes
$_endTag
the end tag to finish tags. it is different if we are in XHTML mode or not
protected
string
$_endTag
= "/>
"
$_headBottom
bottom content for head
protected
mixed
$_headBottom
= array()
$_headTop
top content for head
protected
mixed
$_headTop
= array()
$_httpHeaders
protected
array<string|int, mixed>
$_httpHeaders
= array()
list of http headers that will be send to the client
$_httpHeadersSent
protected
bool
$_httpHeadersSent
= alse
indicates if http headers have already been sent to the client
$_httpStatusCode
protected
string
$_httpStatusCode
= '200'
the http status code to send
$_httpStatusMsg
protected
string
$_httpStatusMsg
= 'OK'
the http status message to send
$_isXhtml
protected
mixed
$_isXhtml
= rue
$_JSCode
inline js code to insert after js links
protected
array<string|int, string>
$_JSCode
= array()
list of js source code
$_JSCodeBefore
inline js code to insert before js links
protected
array<string|int, string>
$_JSCodeBefore
= array()
list of js source code
$_JSIELink
list of js script for IE
protected
array<string|int, array<string|int, mixed>>
$_JSIELink
= array()
key = url, value=link attributes + optional parameter _iecondition
$_JSLink
list of js script
protected
array<string|int, array<string|int, mixed>>
$_JSLink
= array()
key = url, value=link attributes
$_lang
the lang of the document
protected
string
$_lang
$_Link
list of information to generate link tags
protected
array<string|int, mixed>
$_Link
= array()
keys are the href value, valu is an array ('rel','type','title')
$_Meta
protected
array<string|int, array<string|int, mixed>>
$_Meta
= array()
list of arrays containing attributes for each meta elements
Tags
$_MetaAuthor
content of the meta author tag
protected
string
$_MetaAuthor
= ''
$_MetaDescription
list of descriptions to add into a meta description tag
protected
array<string|int, string>
$_MetaDescription
= array()
$_MetaGenerator
content of the meta generator tag
protected
string
$_MetaGenerator
= ''
$_MetaKeywords
list of keywords to add into a meta keyword tag
protected
array<string|int, string>
$_MetaKeywords
= array()
$_MetaOldContentType
protected
bool
$_MetaOldContentType
= rue
false if it should be output or true for the default old behavior : <meta content="text/html; charset=""../>
Tags
$_outputOnlyHeaders
protected
bool
$_outputOnlyHeaders
= alse
Should we output only the headers or the entire response
$_strictDoctype
says if the document uses a Strict or Transitional Doctype
protected
bool
$_strictDoctype
= rue
$_Styles
list of CSS code
protected
array<string|int, string>
$_Styles
= array()
$_type
protected
string
$_type
=
ull
ident of the response type
$plugins
list of plugins
protected
array<string|int, jIHTMLResponsePlugin>
$plugins
= array()
Tags
Methods
__construct()
constructor
public
__construct() : mixed
Return values
mixed —addContent()
add content to the body you can add additionnal content, before or after the content of body
public
addContent(string $content[, bool $before = false ]) : mixed
Parameters
- $content : string
-
additionnal html content
- $before : bool = false
-
true if you want to add it before the content, else false for after
Return values
mixed —addCSSLink()
add a link to a css stylesheet in the document head
public
addCSSLink(string $src[, array<string|int, mixed> $params = array() ][, mixed $forIE = false ]) : mixed
$forIe parameter exists since 1.0b2
Parameters
- $src : string
-
the link
- $params : array<string|int, mixed> = array()
-
additionnals attributes for the link tag
- $forIE : mixed = false
-
if true, the style sheet will be only for IE browser. string values possible (ex:'lt IE 7')
Return values
mixed —addCSSLinkModule()
add a link to a css stylesheet stored into modules
public
addCSSLinkModule(string $module, mixed $src[, mixed $params = array() ][, bool $forIE = false ]) : mixed
Parameters
- $module : string
-
the module where file is stored
- $src : mixed
-
the relative path inside the {module}/www/ directory
- $params : mixed = array()
- $forIE : bool = false
-
if true, the script sheet will be only for IE browser. string values possible (ex:'lt IE 7')
Tags
Return values
mixed —addCSSThemeLinkModule()
add a link to a csstheme stylesheet stored into modules
public
addCSSThemeLinkModule(string $module, mixed $src[, mixed $params = array() ][, bool $forIE = false ]) : mixed
Parameters
- $module : string
-
the module where file is stored
- $src : mixed
-
the relative path inside the {module}/www/themes/{currenttheme}/ directory
- $params : mixed = array()
- $forIE : bool = false
-
if true, the script sheet will be only for IE browser. string values possible (ex:'lt IE 7')
Tags
Return values
mixed —addHeadContent()
add additional content into the document head
public
final addHeadContent(string $content[, bool $toTop = false ]) : mixed
Parameters
- $content : string
- $toTop : bool = false
-
true if you want to add it at the top of the head content, else false for the bottom
Tags
Return values
mixed —addHttpHeader()
add an http header to the response.
public
addHttpHeader(string $htype, string $hcontent[, int $overwrite = true ]) : mixed
will be send during the output of the response
Parameters
- $htype : string
-
the header type ("Content-Type", "Date-modified"...)
- $hcontent : string
-
value of the header type
- $overwrite : int = true
-
false or 0 if the value should be set only if it doesn't still exist -1 to add the header with the existing values true or 1 to replace the existing header
Return values
mixed —addJSCode()
add inline javascript code (inside a <script> tag)
public
addJSCode(string $code[, bool $before = false ]) : mixed
Parameters
- $code : string
-
javascript source code
- $before : bool = false
-
will insert the code before js links if true
Return values
mixed —addJSLink()
add a link to a javascript script in the document head
public
addJSLink(string $src[, array<string|int, mixed> $params = array() ][, bool $forIE = false ]) : mixed
$forIe parameter exists since 1.0b2
Parameters
- $src : string
-
the link
- $params : array<string|int, mixed> = array()
-
additionnals attributes for the script tag
- $forIE : bool = false
-
if true, the script sheet will be only for IE browser. string values possible (ex:'lt IE 7')
Return values
mixed —addJSLinkModule()
add a link to a javascript script stored into modules
public
addJSLinkModule(string $module, mixed $src[, array<string|int, mixed> $params = array() ][, bool $forIE = false ]) : mixed
Parameters
- $module : string
-
the module where file is stored
- $src : mixed
-
the relative path inside the {module}/www/ directory
- $params : array<string|int, mixed> = array()
-
additionnal parameters for the generated tag (a media attribute for stylesheet for example)
- $forIE : bool = false
-
if true, the script sheet will be only for IE browser. string values possible (ex:'lt IE 7')
Return values
mixed —addLink()
add a generic link to the head
public
addLink(string $href, string $rel[, string $type = '' ][, string $title = '' ]) : mixed
Parameters
- $href : string
-
url of the link
- $rel : string
-
relation name
- $type : string = ''
-
mime type of the ressource
- $title : string = ''
Return values
mixed —addMeta()
add a meta element
public
addMeta(mixed $params) : mixed
Parameters
- $params : mixed
Return values
mixed —addMetaAuthor()
add author(s) in a author meta tag
public
addMetaAuthor(string $content) : mixed
Parameters
- $content : string
-
author(s)
Tags
Return values
mixed —addMetaDescription()
add a description in a description meta tag
public
addMetaDescription(string $content) : mixed
Parameters
- $content : string
-
a description
Tags
Return values
mixed —addMetaGenerator()
add generator a generator meta tag
public
addMetaGenerator(string $content) : mixed
Parameters
- $content : string
-
generator
Tags
Return values
mixed —addMetaKeywords()
add some keywords in a keywords meta tag
public
addMetaKeywords(string $content) : mixed
Parameters
- $content : string
-
keywords
Tags
Return values
mixed —addStyle()
add inline css style into the document (inside a <style> tag)
public
addStyle(string $selector[, string $def = null ]) : mixed
Parameters
- $selector : string
-
css selector
- $def : string = null
-
css properties for the given selector
Return values
mixed —cleanCacheHeaders()
Clean the differents caches headers
public
cleanCacheHeaders() : mixed
Return values
mixed —clearHtmlHeader()
used to erase some head properties
public
clearHtmlHeader([array<string|int, mixed> $what = null ]) : mixed
Parameters
- $what : array<string|int, mixed> = null
-
list of one or many of this strings : 'CSSLink', 'CSSIELink', 'Styles', 'JSLink', 'JSIELink', 'JSCode', 'Others','MetaKeywords','MetaDescription'. If null, it cleans all values.
Return values
mixed —clearHttpHeaders()
delete all http headers
public
clearHttpHeaders() : mixed
Return values
mixed —endTag()
return the end of a html tag : "/>" or ">", depending if it will generate xhtml or html
public
endTag() : string
Return values
string —getCSSIELinks()
returns all CSS links for IE
public
getCSSIELinks() : array<string|int, mixed>
Return values
array<string|int, mixed> —key = url, value=link attributes + optional parameter _iecondition
getCSSLinks()
returns all CSS links
public
getCSSLinks() : array<string|int, mixed>
Return values
array<string|int, mixed> —key = url, value=link attributes
getFormatType()
return the format type name (eg the family type name)
public
getFormatType() : string
Return values
string —the name
getJSIELinks()
returns all JS links for IE
public
getJSIELinks() : array<string|int, mixed>
Return values
array<string|int, mixed> —key = url, value=link attributes + optional parameter _iecondition
getJSLinks()
returns all JS links
public
getJSLinks() : array<string|int, mixed>
Return values
array<string|int, mixed> —key = url, value=link attributes
getPlugin()
return the corresponding plugin
public
getPlugin(string $name) : jIHTMLResponsePlugin|null
Parameters
- $name : string
-
the name of the plugin
Tags
Return values
jIHTMLResponsePlugin|null —the plugin or null if it isn't loaded
getType()
return the response type name
public
final getType() : string
Return values
string —the name
isValidCache()
Use the HTPP headers Last-Modified to see if the ressource in client cache is fresh
public
isValidCache([mixed $dateLastModified = null ][, mixed $etag = null ][, bool $cleanCacheHeader = true ]) : bool
Parameters
- $dateLastModified : mixed = null
-
Can be a jDateTime object, a DateTime object or a string understandable by strtotime
- $etag : mixed = null
- $cleanCacheHeader : bool = true
-
True for clean/delete other cache headers. Default : true.
Return values
bool —True if the client ressource version is fresh, false otherwise
isXhtml()
says if the response will be xhtml or html
public
final isXhtml() : bool
Return values
bool —true if it is xhtml
output()
output the html content
public
output() : bool
Tags
Return values
bool —true if the generated content is ok
outputErrors()
Send a response with a generic error message.
public
outputErrors() : mixed
Return values
mixed —setBodyAttributes()
set attributes on the body tag
public
setBodyAttributes(array<string|int, mixed> $attrArray) : mixed
Parameters
- $attrArray : array<string|int, mixed>
-
an associative array of attributes and their values
Return values
mixed —setCSSIELinks()
set all CSS links for IE
public
setCSSIELinks(array<string|int, mixed> $list) : mixed
Parameters
- $list : array<string|int, mixed>
-
key = url, value=link attributes
Return values
mixed —setCSSLinks()
set all CSS links
public
setCSSLinks(array<string|int, mixed> $list) : mixed
Parameters
- $list : array<string|int, mixed>
-
key = url, value=link attributes
Return values
mixed —setExpires()
Set an expires header to the page/ressource.
public
setExpires(mixed $date[, mixed $cleanCacheHeader = true ]) : mixed
Parameters
- $date : mixed
- $cleanCacheHeader : mixed = true
Tags
Return values
mixed —setHttpStatus()
set the http status code for the http header
public
setHttpStatus(string $code, string $msg) : mixed
Parameters
- $code : string
-
the status code (200, 404...)
- $msg : string
-
the message following the status code ("OK", "Not Found"..)
Return values
mixed —setJSIELinks()
set all JS links for IE
public
setJSIELinks(array<string|int, mixed> $list) : mixed
Parameters
- $list : array<string|int, mixed>
-
key = url, value=link attributes
Return values
mixed —setJSLinks()
set all JS links
public
setJSLinks(array<string|int, mixed> $list) : mixed
Parameters
- $list : array<string|int, mixed>
-
key = url, value=link attributes
Return values
mixed —setLifetime()
Set a life time for the page/ressource.
public
setLifetime(int $time[, bool $sharedCache = false ][, mixed $cleanCacheHeader = true ]) : mixed
Parameters
- $time : int
-
Time during which the page will be cached. Express in seconds.
- $sharedCache : bool = false
-
True if the lifetime concern a public/shared cache. Default : false.
- $cleanCacheHeader : mixed = true
Return values
mixed —setTitle()
set the title of the page
public
setTitle(string $title) : mixed
Parameters
- $title : string
Return values
mixed —setXhtmlOutput()
change the type of html for the output
public
setXhtmlOutput([bool $xhtml = true ]) : mixed
Parameters
- $xhtml : bool = true
-
true if you want xhtml, false if you want html
Return values
mixed —strictDoctype()
activate / deactivate the strict Doctype (activated by default)
public
strictDoctype([bool $val = true ]) : mixed
Parameters
- $val : bool = true
-
true for strict, false for transitional
Tags
Return values
mixed —_checkRequestType()
check if the request is of type GET or HEAD
protected
_checkRequestType() : mixed
Return values
mixed —_normalizeDate()
Normalize a date into GMT format
protected
_normalizeDate(mixed $date) : string
Parameters
- $date : mixed
-
Can be a jDateTime object, a DateTime object or a string understandable by strtotime
Return values
string —a date in GMT format
doAfterActions()
The method you can overload in your inherited html response overload it if you want to add processes (stylesheet, head settings, additionnal content etc..) after any actions
protected
doAfterActions() : mixed
Tags
Return values
mixed —outputCssLinkTag()
protected
outputCssLinkTag(mixed $fileUrl, mixed $cssParams) : mixed
Parameters
- $fileUrl : mixed
- $cssParams : mixed
Return values
mixed —outputDoctype()
generate the doctype. You can override it if you want to have your own doctype, like XHTML+MATHML.
protected
outputDoctype() : mixed
Return values
mixed —outputHtmlHeader()
generate the content of the <head> content
protected
outputHtmlHeader() : mixed
Return values
mixed —outputJsScriptTag()
protected
outputJsScriptTag(mixed $fileUrl, mixed $scriptParams) : mixed
Parameters
- $fileUrl : mixed
- $scriptParams : mixed
Return values
mixed —outputMetaTag()
protected
outputMetaTag(array<string|int, string> $params) : mixed
Parameters
- $params : array<string|int, string>
-
list of attributes to add to a meta element
Tags
Return values
mixed —sendHttpHeaders()
send http headers
protected
sendHttpHeaders() : mixed
Return values
mixed —setContentType()
set the content-type in the http headers
protected
setContentType() : mixed