ZenMagick 0.9.10


zenmagick.store.shared.mvc.toolbox.defaults\ZMToolboxHtml
mvc\toolbox\ZMToolboxHtml.php at line 33

Class ZMToolboxHtml

ZMObject
└─ZMToolboxTool
└─ZMToolboxHtml

public class ZMToolboxHtml
extends ZMToolboxTool

HTML utilities.

Author:
DerManoMann

Fields inherited from org.zenmagick.mvc.toolbox\ZMToolboxTool
request_, toolbox_
Fields inherited from org.zenmagick.core\ZMObject
properties_
Method Summary
string

backLink(string text, array attr)

Create a full back link.

static string

encode(string s)

Encode a given string to valid HTML.

string

ezpageLink(integer id, string text, array attr)

Create a full HTML <a> tag pointig to an ezpage.

string

fieldMessages(string name, boolean echo)

Show form field specific error messages.

string

hrefTarget(boolean newWin)

Create a HTML target or onclick attribute for a HTML <a> tag.

string

image(ZMImageInfo imageInfo, string format, mixed parameter)

Creates a HTML <img> tag for the given ZMImageInfo.

static string

more(string s, int max, string more)

Truncate text.

string

productImageLink(ZMProduct product, int categoryId, array attr, string format)

Create a HTML <a> tag with the product image of the given product.

string

strip(string text)

Strip HTML tags from the given text.

static string

text2html(string s)

Convert text based user input into HTML.

Methods inherited from org.zenmagick.mvc.toolbox\ZMToolboxTool
__construct, getRequest, getToolbox, setRequest, setToolbox
Methods inherited from org.zenmagick.core\ZMObject
__construct, attachMethod, get, getAttachedMethods, getProperties, getPropertyNames, set, singleton

Method Detail

mvc\toolbox\ZMToolboxHtml.php at line 155

backLink

public string backLink(string text, array attr)

Create a full back link.

Return a full HTML <a> tag.

Since the link text may be HTML, no HTML escaping is done in this method.

Parameters:
text - The link text (can be plain text or HTML).
attr - Optional HTML attribute map; default is an empty array().
Returns:
A fully formated HTML <a> tag.

mvc\toolbox\ZMToolboxHtml.php at line 41

encode

public static string encode(string s)

Encode a given string to valid HTML.

Parameters:
s - The string to encode.
Returns:
The encoded HTML.

mvc\toolbox\ZMToolboxHtml.php at line 177

ezpageLink

public string ezpageLink(integer id, string text, array attr)

Create a full HTML <a> tag pointig to an ezpage.

Since the link text may be HTML, no HTML escaping is done on the $text parameter.

Parameters:
id - The EZ page id.
text - Optional link text; default is null to use the ezpage title as link text.
attr - Optional HTML attribute map; default is an empty array().
Returns:
A full HTML link.

mvc\toolbox\ZMToolboxHtml.php at line 252

fieldMessages

public string fieldMessages(string name, boolean echo)

Show form field specific error messages.

The generated ul tag will have the value [$name]Info as id, and a class of fieldMsg. Each li will have the type as class assigned.

Messages are HTML escaped/encoded but no further localization is done.

Parameters:
name - The field name.
echo - If true, the URI will be echo'ed as well as returned.
Returns:
HTML unordered list of messages or null.

mvc\toolbox\ZMToolboxHtml.php at line 233

hrefTarget

public string hrefTarget(boolean newWin)

Create a HTML target or onclick attribute for a HTML <a> tag.

Behaviour is controlled with the ZenMagick setting isJSTarget.

Parameters:
newWin - If true, HTML for opening in a new window will be created.
Returns:
A preformatted attribute in the form ' name="value"'

mvc\toolbox\ZMToolboxHtml.php at line 77

image

public string image(ZMImageInfo imageInfo, string format, mixed parameter)

Creates a HTML <img> tag for the given ZMImageInfo.

Parameters:
imageInfo - The image info.
format - Can be either of ZMProducts::IMAGE_SMALL, ZMProducts::IMAGE_MEDIUM or ZMProducts::IMAGE_LARGE; default is >ZMProducts::IMAGE_SMALL.
parameter - Additional parameter for the <mg> tag; can be either a query string style list of name/value pairs or a map.
Returns:
A fully formated HTML <img> tag.

mvc\toolbox\ZMToolboxHtml.php at line 63

more

public static string more(string s, int max, string more)

Truncate text.

Parameters:
s - The text.
max - The number of allowed characters; default is 0 for all.
more - Optional string that will be appended to indicate that the text was truncated; default is ....
Returns:
The (possibly) truncated text.

mvc\toolbox\ZMToolboxHtml.php at line 204

productImageLink

public string productImageLink(ZMProduct product, int categoryId, array attr, string format)

Create a HTML <a> tag with the product image of the given product.

This one will return a fully encoded HTML <img> tag.

Parameters:
product - A product.
categoryId - Optional category id.
attr - Optional HTML attribute map; default is null.
format - Can be either of ZMProducts::IMAGE_SMALL, ZMProducts::IMAGE_MEDIUM or ZMProducts::IMAGE_LARGE; default is ZMProducts::IMAGE_SMALL.
Returns:
A fully formated HTML <a> tag.

mvc\toolbox\ZMToolboxHtml.php at line 114

strip

public string strip(string text)

Strip HTML tags from the given text.

Parameters:
text - The text to clean up.
Returns:
The stripped text.

mvc\toolbox\ZMToolboxHtml.php at line 51

text2html

public static string text2html(string s)

Convert text based user input into HTML.

Parameters:
s - The input string.
Returns:
HTML formatted text.

ZenMagick 0.9.10