ZenMagick 0.9.8


org.zenmagick.store.mvc.tools.ToolboxNet
\store\mvc\tools\ToolboxNet.php at line 34

Class ToolboxNet

ZMObject
└─ZMToolboxTool
└─ZMToolboxNet
└─ToolboxNet

public class ToolboxNet
extends ZMToolboxNet

Networking/URL related functions.

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

Method Summary
string

absolute(string href, boolean echo, string url)

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

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, string requestId)

Create a ZenMagick URL.

Methods inherited from org.zenmagick.mvc.utils.ZMToolboxNet
absolute, decode, encode, url
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\ToolboxNet.php at line 285

absolute

public string absolute(string href, boolean echo, string url)

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.
Todo:
different signature than parent class!

\store\mvc\tools\ToolboxNet.php at line 312

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.

\store\mvc\tools\ToolboxNet.php at line 217

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.

\store\mvc\tools\ToolboxNet.php at line 39

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.


\store\mvc\tools\ToolboxNet.php at line 255

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.

\store\mvc\tools\ToolboxNet.php at line 188

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.

\store\mvc\tools\ToolboxNet.php at line 273

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.

\store\mvc\tools\ToolboxNet.php at line 354

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.

\store\mvc\tools\ToolboxNet.php at line 375

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.

\store\mvc\tools\ToolboxNet.php at line 334

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.

\store\mvc\tools\ToolboxNet.php at line 206

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.

\store\mvc\tools\ToolboxNet.php at line 136

url

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

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.
Todo:
create store agnostic default implementations

ZenMagick 0.9.8