class JDocument extends JObject


Located at : UKNOWVA_ROOT/libraries/joomla/document/document.php

Document class, provides an easy interface to parse and display a document

Properties

string $title Document title
string $description Document description
$link Document full URL
string $base Document base URL
string $language Contains the document language setting
string $direction Contains the document direction setting
string $_generator Document generator
string $_mdate Document modified date
string $_tab Tab string
string $_lineEnd Contains the line end string
string $_charset Contains the character encoding string
string $_mime Document mime type
string $_namespace Document namespace
string $_profile Document profile
array $_scripts Array of linked scripts
array $_script Array of scripts placed in the header
array $_styleSheets Array of linked style sheets
array $_style Array of included style declarations
array $_metaTags Array of meta tags
object $_engine The rendering engine
string $_type The document type
static mixed $_buffer Array of buffered output

Methods

__construct(array $options = array())

Class constructor.

string
__toString()

Magic method to convert the object to a string gracefully.

from JObject
mixed
def(string $property, mixed $default = null)

Sets a default value if not alreay assigned

from JObject
mixed
get(string $property, mixed $default = null)

Returns a property of the object or the default value if the property is not set.

from JObject
array
getProperties(boolean $public = true)

Returns an associative array of object properties.

from JObject
string
getError(integer $i = null, boolean $toString = true)

Get the most recent error message.

from JObject
array
getErrors()

Return all errors, if any.

from JObject
mixed
set(string $property, mixed $value = null)

Modifies a property of the object, creating it if it does not already exist.

from JObject
boolean
setProperties(mixed $properties)

Set the object properties based on a named array/hash.

from JObject
void
setError(string $error)

Add an error message.

from JObject
string
toString() deprecated

No description

from JObject
static object
getInstance($type = 'html', $attributes = array())

Returns the global JDocument object, only creating it if it doesn't already exist.

setType(string $type)

Set the document type

string
getType()

Returns the document type

The
getBuffer()

Get the contents of the document buffer

void
setBuffer(string $content, array $options = array())

Set the contents of the document buffer

string
getMetaData(string $name, bool $http_equiv = false)

Gets a meta tag.

void
setMetaData(string $name, string $content, bool $http_equiv = false, bool $sync = true)

Sets or alters a meta tag.

addScript(string $url, string $type = 'text/javascript', bool $defer = false, bool $async = false)

Adds a linked script to the page

void
addScriptDeclaration(string $content, string $type = 'text/javascript')

Adds a script to the page

void
addStyleSheet(string $url, string $type = 'text/css', string $media = null, array $attribs = array())

Adds a linked stylesheet to the page

void
addStyleDeclaration(string $content, string $type = 'text/css')

Adds a stylesheet declaration to the page

void
setCharset(string $type = 'utf-8')

Sets the document charset

string
getCharset()

Returns the document charset encoding.

void
setLanguage(string $lang = 'en-gb')

Sets the global document language declaration. Default is English (en-gb).

string
getLanguage()

Returns the document language.

void
setDirection($dir = 'ltr')

Sets the global document direction declaration. Default is left-to-right (ltr).

string
getDirection()

Returns the document direction declaration.

void
setTitle(string $title)

Sets the title of the document

string
getTitle()

Return the title of the document.

void
setBase(string $base)

Sets the base URI of the document

string
getBase()

Return the base URI of the document.

void
setDescription($description)

Sets the description of the document

string
getDescription()

Return the title of the page.

void
setLink(string $url)

Sets the document link

string
getLink()

Returns the document base url

void
setGenerator(string $generator)

Sets the document generator

string
getGenerator()

Returns the document generator

void
setModifiedDate(string $date)

Sets the document modified date

string
getModifiedDate()

Returns the document modified date

void
setMimeEncoding(string $type = 'text/html', bool $sync = true)

Sets the document MIME encoding that is sent to the browser.

string
getMimeEncoding()

Return the document MIME encoding that is sent to the browser.

void
setLineEnd(string $style)

Sets the line end style to Windows, Mac, Unix or a custom string.

string
_getLineEnd()

Returns the lineEnd

void
setTab(string $string)

Sets the string used to indent HTML

string
_getTab()

Returns a string containing the unit for indenting HTML

mixed
loadRenderer(string $type)

Load a renderer

null
parse($params = array())

Parses the document and prepares the buffers

The
render($cache = false, $params = array())

Outputs the document

Details

at line 196
JObject __construct(array $options = array())

Class constructor.

Parameters

array $options Associative array of options

Return Value

JObject

in JObject at line 56
string __toString()

Magic method to convert the object to a string gracefully.

Return Value

string The classname.

in JObject at line 70
mixed def(string $property, mixed $default = null)

Sets a default value if not alreay assigned

Parameters

string $property The name of the property.
mixed $default The default value.

Return Value

mixed

in JObject at line 88
mixed get(string $property, mixed $default = null)

Returns a property of the object or the default value if the property is not set.

Parameters

string $property The name of the property.
mixed $default The default value.

Return Value

mixed The value of the property.

See also

getProperties()

in JObject at line 107
array getProperties(boolean $public = true)

Returns an associative array of object properties.

Parameters

boolean $public If true, returns only the public properties.

Return Value

array

See also

get()

in JObject at line 133
string getError(integer $i = null, boolean $toString = true)

Get the most recent error message.

Parameters

integer $i Option error index.
boolean $toString Indicates if JError objects should return their error message.

Return Value

string Error message

in JObject at line 165
array getErrors()

Return all errors, if any.

Return Value

array Array of error messages or JErrors.

in JObject at line 180
mixed set(string $property, mixed $value = null)

Modifies a property of the object, creating it if it does not already exist.

Parameters

string $property The name of the property.
mixed $value The value of the property to set.

Return Value

mixed Previous value of the property.

in JObject at line 198
boolean setProperties(mixed $properties)

Set the object properties based on a named array/hash.

Parameters

mixed $properties Either an associative array or another object.

Return Value

boolean

See also

set()

in JObject at line 222
void setError(string $error)

Add an error message.

Parameters

string $error Error message.

Return Value

void

in JObject at line 235
string toString() deprecated

deprecated 12.1 Use magic method __toString()

Return Value

string

See also

__toString()

at line 239
static object getInstance($type = 'html', $attributes = array())

Returns the global JDocument object, only creating it if it doesn't already exist.

Parameters

$type
$attributes

Return Value

object The document object.

at line 293
setType(string $type)

Set the document type

Parameters

string $type

at line 305
string getType()

Returns the document type

Return Value

string

at line 316
The getBuffer()

Get the contents of the document buffer

Return Value

The contents of the document buffer

at line 330
void setBuffer(string $content, array $options = array())

Set the contents of the document buffer

Parameters

string $content The content to be set in the buffer.
array $options Array of optional elements.

Return Value

void

at line 344
string getMetaData(string $name, bool $http_equiv = false)

Gets a meta tag.

Parameters

string $name Value of name or http-equiv tag
bool $http_equiv META type "http-equiv" defaults to null

Return Value

string

at line 377
void setMetaData(string $name, string $content, bool $http_equiv = false, bool $sync = true)

Sets or alters a meta tag.

Parameters

string $name Value of name or http-equiv tag
string $content Value of the content tag
bool $http_equiv META type "http-equiv" defaults to null
bool $sync Should http-equiv="content-type" by synced with HTTP-header?

Return Value

void

at line 413
addScript(string $url, string $type = 'text/javascript', bool $defer = false, bool $async = false)

Adds a linked script to the page

Parameters

string $url URL to the linked script
string $type Type of script. Defaults to 'text/javascript'
bool $defer Adds the defer attribute.
bool $async Adds the async attribute.

at line 430
void addScriptDeclaration(string $content, string $type = 'text/javascript')

Adds a script to the page

Parameters

string $content Script
string $type Scripting mime (defaults to 'text/javascript')

Return Value

void

at line 452
void addStyleSheet(string $url, string $type = 'text/css', string $media = null, array $attribs = array())

Adds a linked stylesheet to the page

Parameters

string $url URL to the linked style sheet
string $type Mime encoding type
string $media Media type that this stylesheet applies to
array $attribs Array of attributes

Return Value

void

at line 468
void addStyleDeclaration(string $content, string $type = 'text/css')

Adds a stylesheet declaration to the page

Parameters

string $content Style declarations
string $type Type of stylesheet (defaults to 'text/css')

Return Value

void

at line 486
void setCharset(string $type = 'utf-8')

Sets the document charset

Parameters

string $type Charset encoding string

Return Value

void

at line 496
string getCharset()

Returns the document charset encoding.

Return Value

string

at line 508
void setLanguage(string $lang = 'en-gb')

Sets the global document language declaration. Default is English (en-gb).

Parameters

string $lang

Return Value

void

at line 518
string getLanguage()

Returns the document language.

Return Value

string

at line 530
void setDirection($dir = 'ltr')

Sets the global document direction declaration. Default is left-to-right (ltr).

Parameters

$dir

Return Value

void

at line 541
string getDirection()

Returns the document direction declaration.

Return Value

string

at line 553
void setTitle(string $title)

Sets the title of the document

Parameters

string $title

Return Value

void

at line 564
string getTitle()

Return the title of the document.

Return Value

string

at line 576
void setBase(string $base)

Sets the base URI of the document

Parameters

string $base

Return Value

void

at line 588
string getBase()

Return the base URI of the document.

Return Value

string

at line 600
void setDescription($description)

Sets the description of the document

Parameters

$description

Return Value

void

at line 612
string getDescription()

Return the title of the page.

Return Value

string

Sets the document link

Parameters

string $url A url

Return Value

void

Returns the document base url

Return Value

string

at line 647
void setGenerator(string $generator)

Sets the document generator

Parameters

string $generator

Return Value

void

at line 658
string getGenerator()

Returns the document generator

Return Value

string

at line 670
void setModifiedDate(string $date)

Sets the document modified date

Parameters

string $date

Return Value

void

at line 681
string getModifiedDate()

Returns the document modified date

Return Value

string

at line 700
void setMimeEncoding(string $type = 'text/html', bool $sync = true)

Sets the document MIME encoding that is sent to the browser.

This usually will be text/html because most browsers cannot yet accept the proper mime settings for XHTML: application/xhtml+xml and to a lesser extent application/xml and text/xml. See the W3C note ({@link http://www.w3.org/TR/xhtml-media-types/ http://www.w3.org/TR/xhtml-media-types/}) for more details.

Parameters

string $type
bool $sync Should the type be synced with HTML?

Return Value

void

at line 716
string getMimeEncoding()

Return the document MIME encoding that is sent to the browser.

Return Value

string

at line 728
void setLineEnd(string $style)

Sets the line end style to Windows, Mac, Unix or a custom string.

Parameters

string $style "win", "mac", "unix" or custom string.

Return Value

void

at line 752
string _getLineEnd()

Returns the lineEnd

Return Value

string

at line 764
void setTab(string $string)

Sets the string used to indent HTML

Parameters

string $string String used to indent ("\11", "\t", ' ', etc.).

Return Value

void

at line 775
string _getTab()

Returns a string containing the unit for indenting HTML

Return Value

string

at line 788
mixed loadRenderer(string $type)

Load a renderer

Parameters

string $type The renderer type

Return Value

mixed Object or null if class does not exist

at line 817
null parse($params = array())

Parses the document and prepares the buffers

Parameters

$params

Return Value

null

at line 831
The render($cache = false, $params = array())

Outputs the document

Parameters

$cache
$params

Return Value

The rendered data