Smutty


Smutty.Smutty_Utils

Class Smutty_Utils

Smutty_Utils

public class Smutty_Utils

this is a utility class that provides a number of static method for doing various things within Smutty

/


Method Summary
static array

arrayObjDiff(array x, array y, String p)

computes the difference of arrays composed of objects

static String

getBaseUrl()

returns the base URL for the appliation

static String

getFullUrl(array params)

this function is just like getUrl(), only it includes the protocol://server:port part to.

static String

getSmuttyUrl()

this function returns the smutty url (ie.

static String

getUniqueId()

returns a unique 10 char id string

static String

getUrl(array params, array args)

gets the url for a controller/action/etc...

static hash

strToHash(String str)

this function turns a commer seperated string into a hash (associative array).

Method Detail

arrayObjDiff

public static array arrayObjDiff(array x, array y, String p)

computes the difference of arrays composed of objects

Parameters:
x - main array
y - array to comp against
p - array index property
Returns:
the difference of arrays
Go to code

getBaseUrl

public static String getBaseUrl()

returns the base URL for the appliation

Returns:
the application base url
Go to code

getFullUrl

public static String getFullUrl(array params)

this function is just like getUrl(), only it includes the protocol://server:port part to.

Parameters:
params - array of params
Returns:
base url with proto://domain:port
Go to code

getSmuttyUrl

public static String getSmuttyUrl()

this function returns the smutty url (ie. with any base url and query string stipped off)

Returns:
the url
Go to code

getUniqueId

public static String getUniqueId()

returns a unique 10 char id string

Returns:
character string
Go to code

getUrl

public static String getUrl(array params, array args)

gets the url for a controller/action/etc... it's assumed that the controller is the current controller unless you specify otherwise.

this tries to make the url extra pretty by stripping off anything on the end of the url that isn't needed (default values, etc...)

Parameters:
params - hash of params
args - query string args
Returns:
the url
Go to code

strToHash

public static hash strToHash(String str)

this function turns a commer seperated string into a hash (associative array). it treats the string as having commer seperated values like...

name,value,name,value

Parameters:
str - the string to convert
Returns:
assoc array
Go to code

Smutty