ZenMagick 0.9.6


org.zenmagick.rp.toolbox.defaults.ZMToolboxNet

Class ZMToolboxNet

ZMObject
|
+--ZMToolboxNet

public class ZMToolboxNet
extends ZMObject

Networking/URL related functions.

Author:
DerManoMann
Version:
$Id: ZMToolboxNet.php 2149 2009-04-13 22:59:14Z dermanomann $

Fields inherited from org.zenmagick.ZMObject
properties_
Method Summary
string

absolute(string href, boolean echo)

Convert a given relative href/URL into an absolute one based on the current context.

string

ajax(string controller, string method, string params, boolean echo)

Create an Ajax URL for the given controller and method.

string

decode(string url)

Decode a HTML encoded URL.

string

encode(string url)

Encode a given URL to valid HTML.

string

ezpage(ZMEZPage page, boolean echo)

Build an ez-page URL.

void

furl(mixed page, mixed params, mixed transport, mixed addSessionId, mixed seo, mixed isStatic, mixed useContext)

ZenMagick implementation of zen-cart's zen_href_link function.

string

image(string src, boolean echo)

Create an absolute image path/URL for the given image.

string

product(int productId, int categoryId, boolean echo)

Convenience function to build a product URL.

string

redirect(string action, string id, boolean echo)

Create an redirect URL for the given action and id.

string

resultListBack(ZMResultList resultList, boolean secure, boolean echo)

Build a result list URL pointing to the previous page.

string

resultListNext(ZMResultList resultList, boolean secure, boolean echo)

Build a URL pointing to the next page.

string

rssFeed(string channel, string key, boolean echo)

Build a RSS feed URL.

string

staticPage(string name, boolean echo)

Create a static page URL for the given static page name.

string

url(string page, string params, boolean secure, boolean echo)

Create a ZenMagick URL.

Methods inherited from org.zenmagick.ZMObject
attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton

Method Detail

absolute

public string absolute(string href, boolean echo)

Convert a given relative href/URL into an absolute one based on the current context.

Parameters:
href - The URL to convert.
echo - If true, the URI will be echo'ed as well as returned.
Returns:
The absolute href.

ajax

public string ajax(string controller, string method, string params, boolean echo)

Create an Ajax URL for the given controller and method.

NOTE: Ampersand are not encoded in this function.

Parameters:
controller - The controller name without the leading ajax_.
method - The name of the method to call.
params - Query string style parameter; if null add all current parameter
echo - If true, the URI will be echo'ed as well as returned.
Returns:
A complete Ajax URL.

decode

public string decode(string url)

Decode a HTML encoded URL.

Parameters:
url - The url to decode.
Returns:
The decoded URL.

encode

public string encode(string url)

Encode a given URL to valid HTML.

Parameters:
url - The url to encode.
Returns:
The URL encoded in valid HTM.

ezpage

public string ezpage(ZMEZPage page, boolean echo)

Build an ez-page URL.

Parameters:
page - A ZMEZPage instance.
echo - If true, the URI will be echo'ed as well as returned.
Returns:
A complete URL for the given ez-page.

furl

public void furl(mixed page, mixed params, mixed transport, mixed addSessionId, mixed seo, mixed isStatic, mixed useContext)

ZenMagick implementation of zen-cart's zen_href_link function. /


image

public string image(string src, boolean echo)

Create an absolute image path/URL for the given image.

Parameters:
src - The relative image name (relative to zen-cart's image folder).
echo - If true, the URI will be echo'ed as well as returned.
Returns:
The image URI.

product

public string product(int productId, int categoryId, boolean echo)

Convenience function to build a product URL.

Please note that in ZenMagick all product URLs use the same view name. The actual view name gets resolved only when the href is used.

Parameters:
productId - The product id.
categoryId - Optional category id.
echo - If true, the URI will be echo'ed as well as returned.
Returns:
A full URL.
A complete product URL.

redirect

public string redirect(string action, string id, boolean echo)

Create an redirect URL for the given action and id.

All messages created up to this point during request handling will be saved and restored with the next request handling cycle.

Parameters:
action - The redirect action.
id - The redirect id.
echo - If true, the URI will be echo'ed as well as returned.
Returns:
A full URL.

resultListBack

public string resultListBack(ZMResultList resultList, boolean secure, boolean echo)

Build a result list URL pointing to the previous page.

Parameters:
resultList - The current result list.
secure - If true, the URI will be secure; default is null to use the current * request state.
echo - If true, the URI will be echo'ed as well as returned.
Returns:
A URL pointing to the previous page or null.

resultListNext

public string resultListNext(ZMResultList resultList, boolean secure, boolean echo)

Build a URL pointing to the next page.

Parameters:
resultList - The current result list.
secure - If true, the URI will be secure; default is null to use the current * request state.
echo - If true, the URI will be echo'ed as well as returned.
Returns:
A URL pointing to the next page or null.

rssFeed

public string rssFeed(string channel, string key, boolean echo)

Build a RSS feed URL.

Parameters:
channel - The channel.
key - Optional key; for example, 'new' for the product channel.
echo - If true, the URI will be echo'ed as well as returned.
Returns:
A complete URL.

staticPage

public string staticPage(string name, boolean echo)

Create a static page URL for the given static page name.

Parameters:
name - The static page name.
echo - If true, the URI will be echo'ed as well as returned.
Returns:
A complete URL for the given static page.

url

public string url(string page, string params, boolean secure, boolean echo)

Create a ZenMagick URL.

Mother of all other URL related methods in this class.

If the page parameter is null, the current page/view will be used. The provided parameter will be merged into the current query string.

Parameters:
page - The page name (ie. the page name as referred to by the parameter ZM_PAGE_KEY)
params - Query string style parameter; if null add all current parameter
secure - Flag indicating whether to create a secure or non secure URL; default is false.
echo - If true, the URL will be echo'ed as well as returned.
Returns:
A full URL.

ZenMagick 0.9.6