jResponseBasicHtml
extends jResponse
in package
Basic HTML response. the HTML content should be provided by a simple php file.
Tags
Table of Contents
- $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
- $xhtmlContentType : bool
- says if xhtml content type should be send or not.
- $_bodyBottom : mixed
- $_bodyTop : mixed
- $_charset : string
- the charset of the document
- $_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
- says if the document is in xhtml or html
- $_lang : string
- the lang of the document
- $_outputOnlyHeaders : bool
- $_type : string
- jresponse id
- $plugins : array<string|int, jIHTMLResponsePlugin>
- list of plugins
- __construct() : mixed
- constructor; setup the charset, the lang
- addContent() : mixed
- add content to the body you can add additionnal content, before or after the content of body
- addHeadContent() : mixed
- add additional content into the document head
- addHttpHeader() : mixed
- add an http header to the response.
- cleanCacheHeaders() : mixed
- Clean the differents caches headers
- clearHttpHeaders() : mixed
- delete all http headers
- getFormatType() : string
- return the format type name (eg the family type name)
- 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
- output errors
- setExpires() : mixed
- Set an expires header to the page/ressource.
- setHttpStatus() : mixed
- set the http status code for the http header
- setLifetime() : mixed
- Set a life time for the page/ressource.
- setXhtmlOutput() : mixed
- change the type of html for the output
- _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
- sendHttpHeaders() : mixed
- send http headers
- setContentType() : mixed
- set the content-type in the http headers
Properties
$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'
$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
$_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
says if the document is in xhtml or html
protected
mixed
$_isXhtml
= alse
$_lang
the lang of the document
protected
string
$_lang
$_outputOnlyHeaders
protected
bool
$_outputOnlyHeaders
= alse
Should we output only the headers or the entire response
$_type
jresponse id
protected
string
$_type
= 'html'
$plugins
list of plugins
protected
array<string|int, jIHTMLResponsePlugin>
$plugins
= array()
Tags
Methods
__construct()
constructor; setup the charset, the lang
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 —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 —cleanCacheHeaders()
Clean the differents caches headers
public
cleanCacheHeaders() : mixed
Return values
mixed —clearHttpHeaders()
delete all http headers
public
clearHttpHeaders() : mixed
Return values
mixed —getFormatType()
return the format type name (eg the family type name)
public
getFormatType() : string
Return values
string —the name
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()
output errors
public
outputErrors() : mixed
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 —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 —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 —_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 —sendHttpHeaders()
send http headers
protected
sendHttpHeaders() : mixed
Return values
mixed —setContentType()
set the content-type in the http headers
protected
setContentType() : mixed