Documentation

Horde_PageOutput
in package

This object consolidates the elements needed to output a page to the browser.

Tags
author

Michael Slusarz slusarz@horde.org

category

Horde

copyright

2012-2017 Horde LLC

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

Table of Contents

Properties

$ajax  : bool
Output code necessary to perform AJAX operations?
$css  : Horde_Themes_Css
Stylesheet object.
$deferScripts  : bool
Defer loading of scripts until end of page?
$growler  : bool
Output code necessary to display growler notifications?
$hsl  : Horde_Script_List
Script list.
$inlineScript  : array<string|int, mixed>
List of inline scripts.
$linkTags  : array<string|int, mixed>
List of LINK tags to output.
$metaTags  : array<string|int, mixed>
List of META tags to output.
$sidebar  : bool
Load the sidebar in this page?
$smartmobileInit  : array<string|int, mixed>
Smartmobile init code that needs to be output before jquery.mobile.js is loaded.
$topbar  : bool
Load the topbar in this page?
$_compress  : bool
Has PHP userspace page compression been started?
$_view  : int
View mode.

Methods

__construct()  : mixed
Constructor.
addInlineJsVars()  : array<string|int, mixed>|void
Add inline javascript variable definitions to the output buffer.
addInlineScript()  : mixed
Add inline javascript to the output buffer.
addLinkTag()  : mixed
Adds a LINK tag.
addMetaTag()  : mixed
Adds a META tag to the page output.
addScriptFile()  : Horde_Script_File
Adds a single javascript script to the output (if output has already started), or to the list of script files to include in the output.
addScriptPackage()  : Horde_Script_Package
Adds a javascript package to the browser output.
addStylesheet()  : mixed
Adds an external stylesheet to the output.
addThemeStylesheet()  : mixed
Adds a themed stylesheet to the output.
disableCompression()  : mixed
Disables output compression. If successful, throws out all data currently in the output buffer. Must be called before any data is sent to the browser.
footer()  : mixed
Output page footer.
header()  : mixed
Output the page header.
includeFavicon()  : mixed
Generate and output the favicon tag for the current application.
includeScriptFiles()  : mixed
Outputs the necessary script tags, honoring configuration choices as to script caching.
includeStylesheetFiles()  : mixed
Generate the stylesheet tags for the current application.
metaRefresh()  : mixed
Adds a META refresh tag.
noDnsPrefetch()  : mixed
Adds a META tag to disable DNS prefetching.
outputInlineScript()  : mixed
Print pending inline javascript to the output buffer.
outputLinkTags()  : mixed
Output LINK tags.
outputMetaTags()  : mixed
Output META tags to page.
outputSmartmobileFiles()  : mixed
Output files needed for smartmobile mode.
startCompression()  : mixed
Activates output compression.
_addBasicScripts()  : mixed
Add basic framework scripts to the output.

Properties

$ajax

Output code necessary to perform AJAX operations?

public bool $ajax = \false

$deferScripts

Defer loading of scripts until end of page?

public bool $deferScripts = \true

$growler

Output code necessary to display growler notifications?

public bool $growler = \false

$inlineScript

List of inline scripts.

public array<string|int, mixed> $inlineScript = array()

$linkTags

List of LINK tags to output.

public array<string|int, mixed> $linkTags = array()

$metaTags

List of META tags to output.

public array<string|int, mixed> $metaTags = array()

$sidebar

Load the sidebar in this page?

public bool $sidebar = \true

$smartmobileInit

Smartmobile init code that needs to be output before jquery.mobile.js is loaded.

public array<string|int, mixed> $smartmobileInit = array()
Tags
since
2.12.0

$topbar

Load the topbar in this page?

public bool $topbar = \true

$_compress

Has PHP userspace page compression been started?

protected bool $_compress = \false

Methods

__construct()

Constructor.

public __construct() : mixed

addInlineJsVars()

Add inline javascript variable definitions to the output buffer.

public addInlineJsVars(array<string|int, mixed> $data[, mixed $opts = array() ]) : array<string|int, mixed>|void
Parameters
$data : array<string|int, mixed>

Keys are the variable names, values are the data to JSON encode. If the key begins with a '-', the data will be added to the output as-is.

$opts : mixed = array()

If boolean true, equivalent to setting the 'onload' option to true. Other options:

  • onload: (boolean) Wrap the definition in an onload handler? DEFAULT: false
  • ret_vars: (boolean) If true, will return the list of variable definitions instead of outputting to page. DEFAULT: false
  • top: (boolean) Add definitions to top of stack? DEFAULT: false
Return values
array<string|int, mixed>|void

Returns the variable list of 'ret_vars' option is true.

addInlineScript()

Add inline javascript to the output buffer.

public addInlineScript(string|array<string|int, mixed> $script[, bool|string $onload = false ][, bool $top = false ]) : mixed
Parameters
$script : string|array<string|int, mixed>

The script text(s) to add.

$onload : bool|string = false

Load the script after the page (DOM) has loaded? If a string (either 'prototype' or 'jquery'), that JS framework's method is used. Defaults to Prototype. @since Horde_Core 2.28.0

$top : bool = false

Add script to top of stack?

addLinkTag()

Adds a LINK tag.

public addLinkTag([array<string|int, mixed> $opts = array() ]) : mixed

All attributes are HTML-encoded. Only pass raw, unencoded attribute values to avoid double escaping.

Parameters
$opts : array<string|int, mixed> = array()

Non-default tag elements.

addMetaTag()

Adds a META tag to the page output.

public addMetaTag(string $name, string $content[, bool $http_equiv = true ]) : mixed
Parameters
$name : string

The name value.

$content : string

The content of the META tag.

$http_equiv : bool = true

Output http-equiv instead of name?

addScriptFile()

Adds a single javascript script to the output (if output has already started), or to the list of script files to include in the output.

public addScriptFile(mixed $file[, string $app = null ]) : Horde_Script_File
Parameters
$file : mixed

Either a Horde_Script_File object, or the full javascript file name.

$app : string = null

If $file is a file name, this is the application where the file is located. Defaults to the current registry application.

Return values
Horde_Script_File

Script file object.

addScriptPackage()

Adds a javascript package to the browser output.

public addScriptPackage(mixed $package) : Horde_Script_Package
Parameters
$package : mixed

Either a classname, basename of a Horde_Core_Script_Package class, or a Horde_Script_Package object.

Tags
throws
Horde_Exception
Return values
Horde_Script_Package

Package object.

addStylesheet()

Adds an external stylesheet to the output.

public addStylesheet(Horde_Themes_Element|string $file[, string $url = null ]) : mixed
Parameters
$file : Horde_Themes_Element|string

Either a Horde_Themes_Element object or the CSS filepath.

$url : string = null

If $file is a string, this must be a CSS URL.

addThemeStylesheet()

Adds a themed stylesheet to the output.

public addThemeStylesheet(string $file) : mixed
Parameters
$file : string

The stylesheet name.

disableCompression()

Disables output compression. If successful, throws out all data currently in the output buffer. Must be called before any data is sent to the browser.

public disableCompression() : mixed

Output page footer.

public footer([array<string|int, mixed> $opts = array() ]) : mixed
Parameters
$opts : array<string|int, mixed> = array()

Options:

  • NONE currently

header()

Output the page header.

public header([array<string|int, mixed> $opts = array() ]) : mixed
Parameters
$opts : array<string|int, mixed> = array()

Options:

  • body_class: (string)
  • body_id: (string)
  • html_id: (string)
  • smartmobileinit: (string) (@deprecated; use $this->smartmobileInit instead)
  • stylesheet_opts: (array)
  • title: (string)
  • view: (integer)

includeFavicon()

Generate and output the favicon tag for the current application.

public includeFavicon() : mixed

includeScriptFiles()

Outputs the necessary script tags, honoring configuration choices as to script caching.

public includeScriptFiles([bool $full = false ]) : mixed
Parameters
$full : bool = false

Return a full URL?

Tags
throws
Horde_Exception

includeStylesheetFiles()

Generate the stylesheet tags for the current application.

public includeStylesheetFiles([array<string|int, mixed> $opts = array() ][, bool $full = false ]) : mixed
Parameters
$opts : array<string|int, mixed> = array()

Options to pass to Horde_Themes_Css::getStylesheetUrls().

$full : bool = false

Return a full URL? @since Horde_Core 2.28.0

metaRefresh()

Adds a META refresh tag.

public metaRefresh(int $time, string $url) : mixed
Parameters
$time : int

Refresh time.

$url : string

Refresh URL

noDnsPrefetch()

Adds a META tag to disable DNS prefetching.

public noDnsPrefetch() : mixed

See Horde Bug #8836.

outputInlineScript()

Print pending inline javascript to the output buffer.

public outputInlineScript([bool $raw = false ]) : mixed
Parameters
$raw : bool = false

Return the raw script (not wrapped in CDATA tags or observe wrappers)?

outputLinkTags()

Output LINK tags.

public outputLinkTags() : mixed

outputMetaTags()

Output META tags to page.

public outputMetaTags() : mixed

outputSmartmobileFiles()

Output files needed for smartmobile mode.

public outputSmartmobileFiles() : mixed
Tags
deprecated

startCompression()

Activates output compression.

public startCompression() : mixed

_addBasicScripts()

Add basic framework scripts to the output.

protected _addBasicScripts() : mixed

        
On this page

Search results