|
zoglairThis is the second core class (the other one being zObject) which is explicitly included in the bootstrap script. It wraps global configuration settings and provides critical static methods for request processing and object instantiation. This class is instantiated as the globally available $zoglair object.
string bytes2str(integer $bytes, integer $round=2, string $space='')static ⇧ Converts an integer representing a size in bytes, to its string shortcut equivalent, properly tagged. For example:
boolean debug(string $what)static ⇧ Checks the status of a binary debug flag, as set in the System settings dialog in ACP, or the debug dialog.
mixed decode64(string $str)static ⇧ The reverse of encode64().
See also encode64(). string decode_text(string $text, string $tag=self::Z_TAG_PASSTHROUGH)static ⇧ Decodes text blocks previously encoded with encode_text(). Please, be aware that while the encoding function accepts a single block which is encoded as a whole, this one accepts text (usually the page itself) which is searched for encoded fragments. All of them (marked with the same tag) are decoded in one call.
See also encode_text(). string encode64(mixed $var)static ⇧ This serializes, compresses and base64 encodes an element, in one go. It uses a slightly modified base64 character set so that the result is both url safe and fully compatible with zoglair parsing functions.
See also decode64(). string encode_html(string $html)static ⇧ A plain wrapper of htmlspecialchars() using proper values for the default parameters. Please, do not use the PHP function as it may lead to problems.
string encode_text(string $text, string $tag=self::Z_TAG_PASSTHROUGH)static ⇧ Encodes a text block, like for example a
See also decode_text(). array explode(string $str)static ⇧ This is a wrapper of explode(). The difference is that it can use the first character of the string as delimiter, as long as it is not alphanumeric. If it is, then comma is used by default. For example, in
array explode_ids(string $str)static ⇧ Returns an array filled with the comma delimited ids and/or id ranges, found in $str. For example, the input string
array filter_post(array $POST)static ⇧ Filters $_POST like arrays, by encoding unsafe html characters to their entity equivalents, unless the current user has the
string get_active(string $what)static ⇧ Returns active user preferences, falling back to default values.
string get_data_dir(string $slot, boolean $create=TRUE)static ⇧ Returns one of the predefined system-wide writable directories, as a relative path. You can make it absolute by either prepending Z_ROOT or using rel2abs(). As all directories in zoglair, the returned path has a trailing slash.
See also get_temp_file(). array get_domain_skins()static ⇧ Returns a tree of available skin.style combinatios, along with their associative logos, depending on ACP domain settings and style availability in the skin group folder.
mixed get_inrange(mixed $val, mixed $min, mixed $max)static ⇧ Makes sure that a (scalar) value is between a min and a max (inclusive).
void get_temp_file()static ⇧ Returns the path to a temporary file inside the zoglair::Z_GDD_TEMP writable slot. The filename produced is not checked for existance. The caller is responsible for deleting (unlink) it. As all paths in zoglair, this is relative! You can convert it to absolute by either prepending Z_ROOT or using rel2abs().
See also get_data_dir(). object globin(string $which='')static ⇧ Returns the instance of a global plugin. You can use this function in place of the global PHP keyword.
string hash(string $str='', string $salt='')static ⇧ Generic hash and salt function, used for passwords, session ids, etc. If called without arguments, it returns a random hex string which can be used as a salt to a subsequent string hashing. If $str is set, a hash (with optional salt) is calculated and returned. The input is hashed 1 to 3 times, as following: First it is cheched against the zoglair::Z_REX_HASH pattern for finding out if it is clear text or 1-pass hashed (for example, a password sent from a login form could be already hashed by javascript). If it is clear text then it is hashed. Next, it is hashed unconditionally. Finally, if the salt argument is not empty, it is concatenuated and hashed once more. Notice: The algorithm used is defined in zoglair::Z_REX_HASH_FUNC. The output can be preg_matched against zoglair::Z_REX_HASH and its length is always zoglair::Z_REX_HASH_LEN bytes.
string indent(string $text, integer $indent)static ⇧ Indents a text block according to the global zoglair define of Z_TAB_WIDTH spaces per tab position (4).
array ini2map(string $ini, boolean $sections=FALSE)static ⇧ Converts an *.ini-like block of text (string) to an associative array (map). Such blocks are quite common in zoglair database. The string is expected to be consisted of lines ended with Notice: This is no wrapper or substitute of parse_ini_string().
boolean is_acp()static ⇧ Used for finding out if the current request comes from inside ACP. This is needed for switching the skin and the menus, as well as for adjusting the phrasing mechanism.
boolean is_int(mixed $mixed)static ⇧ Finds whether a variable is integer or a string of digits. It substitutes is_numeric() because that one accepts sign, decimals and exponents, things that we do not want when checking for a passed id.
boolean is_map(mixed $mixed)static ⇧ Finds whether a variable is a map (associative array).
boolean is_set(mixed $mixed)static ⇧ Finds whether a variable is a set (vector of associative arrays). Not to be confused with isset()!
object load_extension(mixed $Caller, string $name, boolean $base=FALSE)static ⇧ A load_plugin() wrapper, for loading an extension, that is, a plugin which is designed to extend a parent plugin and placed under a directory named after that. For example, the
object load_plugin(string $group, string $pin, mixed $args='')static ⇧ Vital and central dynamic class loading and instantiation function, automatically adding some basic reflection properties.
array load_settings(mixed $mixed)static ⇧ Loads system or user settings: persistent grouped name=value pairs. Settings are stored in the Udf database table, along with their attributes, so that they can be editable. Every setting belongs to a group according to its scope or functionality. This function retreives the group(s) of specified settings and not individual pairs.
array load_sitemap()static ⇧ Loads the domain's sitemap, filtered by the connected user security level. The result is cached and is used for menus, link building and other internal stuff.
object load_table(string $table)static ⇧ A load_plugin() wrapper, for loading a (database) table model. If the requested table is already loaded (instantiated), then it is reused (tables are singletons).
array merge_arrays(array $A1, array $A2)static ⇧ A substitute for array_merge(), which handles array values properly (and recursively).
string next_clip_id()static ⇧ Generates a serial id, in the form
string number_format(float $number, boolean $money)static ⇧ A plain wrapper of number_format(), using proper values for the default parameters.
object process_url(string $url)static ⇧ Processes a url, either embedded or the one initially requested by the user agent. In all cases, the url is relative and completely unrelated to the underlying file structure. The method cracks the url, loads the appropriate content handler and - if required - loads the user specified skin to render the content. There are two kinds of url handlers: units (for browser urls) and clips (for embedded ones). There is only one call to process a browser url, and that is from inside the bootstrap code, by passing a special
mixed process_url2(string $url)static ⇧ This is a simple wrapper of process_url(). The only difference between them is the return value: instead of returning the object which handled the url, it returns the object's content. That is usually a string, but may be an array for JSON responces.
void redirect(string $location='', integer $status=307)static ⇧ Outputs an HTTP Redirection header and exits. If called without arguments, it will 307 redirect to the home page.
See also List of HTTP status codes. string rel2abs(string $path)static ⇧ Converts a relative path (file or directory) to an absolute one. It is aware of root vs non-root paths, and handles them accordingly.
string replace(string $text, array $MOV, boolean $vector=FALSE)static ⇧ Replaces embedded variables in a text block, with values taken from a given array, either indexed (vector) or associative (map). Variables must be enclosed in It is worth mentioning that if a value is a text block itself, then the replacement takes care of proper indentation!
string set_query_var(string $var, string $url='')static ⇧ Adds (if not exists) or changes (if exists) a given query string in a given URL. The string must be formatted as one or more
string shebang(string $text, mixed &$shbng)static ⇧ Used for extracting meta information found in the first line of a text block prefixed with a shebang. If such a line is found, then $text is splitted accordingly. Shebangs are used in various places, for example, in user content for marking up the class or style of certain paragraphs.
void shebang_merge(array &$ROW, string $prefix='')static ⇧ Given a table $ROW containing a
void split(string $str, string &$left, string &$right, string $del=' ', boolean $trim=TRUE)static ⇧ Splits a string into 2 substrings separated by a given delimiter. Useful for parsing name,value pairs.
array split_camel(string $str, boolean $lcfirst=FALSE)static ⇧ Splits a camelCase identifier into its components (words).
string trim(string $text)static ⇧ Trims a text block according to the global zoglair text formatting rule, that is:
string ucpath(string $path)static ⇧ Converts a path to a class name, acting as a map between external and internal naming conventions. For example,
void uorc_error(object $Uorc, integer $code)static ⇧ Sets the status code of a unit or clip. If its content is empty, it is set to a relevant error description.
mixed version(mixed $which=1)static ⇧ A polymorphic function to convert between version types, or retreive addon version information.
|