ZenMagick 0.9.8


org.zenmagick.store.mvc.toolbox.defaults.ToolboxHtml
\store\mvc\tools\ToolboxHtml.php at line 34

Class ToolboxHtml

ZMObject
└─ZMToolboxTool
└─ZMToolboxHtml
└─ToolboxHtml

public class ToolboxHtml
extends ZMToolboxHtml

HTML utilities.

Author:
DerManoMann
Version:
$Id: ToolboxHtml.php 2694 2009-12-03 22:32:18Z dermanomann $

Method Summary
string

backLink(string text, array attr, boolean echo)

Create a full back link.

string

encode(string s, boolean echo)

Encode a given string to valid HTML.

string

ezpageLink(integer id, string text, array attr, boolean echo)

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, boolean echo)

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

string

image(ZMImageInfo imageInfo, string format, mixed parameter, boolean echo)

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

string

more(string s, int max, string more, boolean echo)

Truncate text.

string

onload(string page, boolean echo)

Get optional onload handler attribute for the current page.

string

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

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

string

strip(string text, boolean echo)

Strip HTML tags from the given text.

Methods inherited from org.zenmagick.mvc.utils.ZMToolboxHtml
encode, more, text2html
Methods inherited from org.zenmagick.toolbox.ZMToolboxTool
getRequest, getToolbox, setRequest, setToolbox
Methods inherited from org.zenmagick.core.ZMObject
attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton

Method Detail

\store\mvc\tools\ToolboxHtml.php at line 140

backLink

public string backLink(string text, array attr, boolean echo)

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().
echo - If true, the URI will be echo'ed as well as returned.
Returns:
A fully formated HTML <a> tag.

\store\mvc\tools\ToolboxHtml.php at line 86

encode

public string encode(string s, boolean echo)

Encode a given string to valid HTML.

Parameters:
s - The string to encode.
echo - If true, the escaped string will be echo'ed as well as returned.
Returns:
The encoded HTML.

\store\mvc\tools\ToolboxHtml.php at line 164

ezpageLink

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

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().
echo - If true, the link will be echo'ed as well as returned.
Returns:
A full HTML link.

\store\mvc\tools\ToolboxHtml.php at line 257

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.

\store\mvc\tools\ToolboxHtml.php at line 224

hrefTarget

public string hrefTarget(boolean newWin, boolean echo)

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.
echo - If true, the formatted text will be echo'ed as well as returned.
Returns:
A preformatted attribute in the form ' name="value"'

\store\mvc\tools\ToolboxHtml.php at line 47

image

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

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.
echo - If true, the URI will be echo'ed as well as returned.
Returns:
A fully formated HTML <img> tag.

\store\mvc\tools\ToolboxHtml.php at line 240

more

public string more(string s, int max, string more, boolean echo)

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 ....
echo - If true, the URI will be echo'ed as well as returned.
Returns:
The (possibly) truncated text.

\store\mvc\tools\ToolboxHtml.php at line 282

onload

public string onload(string page, boolean echo)

Get optional onload handler attribute for the current page.

The generated HTML is in the form onload="SOME JAVASCRIPT".

Parameters:
page - The page name; default is null for the current page.
echo - If true, the URI will be echo'ed as well as returned.
Returns:
A complete onload attribute incl. value or an empty string.
Deprecated.

\store\mvc\tools\ToolboxHtml.php at line 193

productImageLink

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

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.
echo - If true, the URI will be echo'ed as well as returned.
Returns:
A fully formated HTML <a> tag.

\store\mvc\tools\ToolboxHtml.php at line 97

strip

public string strip(string text, boolean echo)

Strip HTML tags from the given text.

Parameters:
text - The text to clean up.
echo - If true, the stripped text will be echo'ed as well as returned.
Returns:
The stripped text.

ZenMagick 0.9.8