ZMTools
public class ZMTools
| Constant Summary | |
|---|---|
| final static str | |
| final static str | |
| final static str | |
| final static str | |
| Method Summary | |
|---|---|
| static boolean | compareStoreUrl(string url1, string url2) Compare URLs. |
| static void | fmod_round(mixed x, mixed y) fmod variant that can handle values < 1. |
| static void | ifModifiedSince(string timestamp, boolean Helper for conditional get support. |
| static array | parseDateString(string s, string format, array defaults) Parse a date according to the given format. |
| static float | parseMoney(mixed money, string currencyCode, string amount) Parse a money amount. |
| static array | parseRange(string range) Convert a numeric range definition into an array of single values. |
| static array | parseRssDate(string date) Parse RSS date. |
| static void | resolveZCClass(string clazz) Resolve the given zen-cart class. |
| static void | setFilePerms(mixed files, boolean recursive, array perms) Apply user/group settings to file(s) that should allow ftp users to modify/delete them. |
| static string | translateDateString(string s, string from, string to) Convert a (UI) date from one format to another. |
public final static str RANDOM_CHARS = 'chars'
public final static str RANDOM_DIGITS = 'digits'
public final static str RANDOM_HEX = 'hex'
public final static str RANDOM_MIXED = 'mixed'
public static boolean compareStoreUrl(string url1, string url2)
Compare URLs.
This is defined only for URLs within the store.
NOTE: This function may not work with SEO solutions.
null to compare to the current URL.true if URLs are considered equal (based on various URL parameters).public static void fmod_round(mixed x, mixed y)
fmod variant that can handle values < 1.
public static void ifModifiedSince(string timestamp, boolean true)
Helper for conditional get support.
- Parameters:
- timestamp - The last change date of whatever resource this is about.
true - if a body should be returned, false if the resource changed.
utils\ZMTools.php at line 167
parseDateString
public static array parseDateString(string s, string format, array defaults)
Parse a date according to the given format.
This function supports the following format token:
hh - hours
ii - minutes
ss - seconds
dd - day
mm - month
cc - century
yy - year
yyyy - full year (if found both cc and yy will be populated accordingly
- Parameters:
- s - A date; usually either provided by the user or a database date.
- format - The date format
- defaults - Optional defaults for components; default is
null for none.
- Returns:
- The individual date components as map using the token as keys.
utils\ZMTools.php at line 84
parseMoney
public static float parseMoney(mixed money, string currencyCode, string amount)
Parse a money amount.
- Parameters:
- amount - The amount.
- currencyCode - The currency.
- Returns:
- The amount.
utils\ZMTools.php at line 58
parseRange
public static array parseRange(string range)
Convert a numeric range definition into an array of single values.
A range might be a single value, a range; for example 3-8 or a list of both.
Valid examples of ranges are:
- 3
- 3,4,8
- 3,4-6,8
- 1,3-5,9,13,100-302
- Parameters:
- range - The range value.
- Returns:
- List of numeric (int) values.
utils\ZMTools.php at line 210
parseRssDate
public static array parseRssDate(string date)
Parse RSS date.
- Parameters:
- date - The date.
- Returns:
- An array with 3 elements in the order [day] [month] [year].
utils\ZMTools.php at line 358
resolveZCClass
public static void resolveZCClass(string clazz)
Resolve the given zen-cart class.
This function ensures that the given class is loaded.
- Parameters:
- clazz - The class name.
utils\ZMTools.php at line 305
setFilePerms
public static void setFilePerms(mixed files, boolean recursive, array perms)
Apply user/group settings to file(s) that should allow ftp users to modify/delete them.
The file group attribute is only going to be changed if the $perms parameter is not empty.
This method may be disabled by setting fs.permissions.fix to false.
- Parameters:
- files - Either a single filename or list of files.
- recursive - Optional flag to recursively process all files/folders in a given directory; default is
false.
- perms - Optional file permissions; defaults are taken from the settings fs.permissions.defaults.folder for folder, fs.permissions.defaults.file for files.
utils\ZMTools.php at line 136
translateDateString
public static string translateDateString(string s, string from, string to)
Convert a (UI) date from one format to another.
- Parameters:
- s - The date as received via the UI.
- from - The current format of the date string.
- to - The target format.
- Returns:
- The formatted date string or
'' (if $s is empty).
(System) Tools.