/PHPDS_utils.inc.php

Description

PHPDevShell is a RAD Framework aimed at developing administrative applications.

Classes
Class Description
PU_tree A class to deal with tree-structured data (such as groups)
Constants
FNM_CASEFOLD = 16 (line 718)
FNM_NOESCAPE = 2 (line 716)
FNM_PATHNAME = 1 (line 715)
FNM_PERIOD = 4 (line 717)
Functions
dgettext (line 314)
void dgettext ( $domain,  $text)
  • $domain
  • $text
fnmatch (line 720)
void fnmatch ( $pattern,  $string, [ $flags = 0])
  • $pattern
  • $string
  • $flags
gettext (line 309)
void gettext ( $text)
  • $text
pcre_fnmatch (line 725)
void pcre_fnmatch ( $pattern,  $string, [ $flags = 0])
  • $pattern
  • $string
  • $flags
PU_addIncludePath (line 565)

Add an include path to check in for classes.

void PU_addIncludePath (string $path)
  • string $path
PU_ArraySearch (line 218)

Search for array values inside array and returns key.

mixed PU_ArraySearch (array $needle, array $haystack)
  • array $needle
  • array $haystack
PU_array_compact (line 481)

Get rid of null values inside an array

All values which are null in the array are remove, shortening the array

void PU_array_compact ( $a)
  • array $a: the array to compact
PU_BuildAttrString (line 84)

Build a xml-style attributes string based on an array

  • version: 1.1
  • date: 20091203
  • date: 20110203 (v1.1) (greg) added the glue parameter
string PU_BuildAttrString ([ $attributes = null], [$glue $glue = ''])
  • $attributes $attributes: array, the attribute array to compile
  • $glue $glue: string, a piece of string to insert between the values
PU_BuildGET (line 69)

Build GET part of a url

  • return: the whole parameter part of the url (including '?') ; maybe empty if there are no parameters
string PU_BuildGET ([$includeInGet $includeInGet = null], [$excludeFromGet $excludeFromGet = null], [ $glue = '&'])
  • $includeInGet $includeInGet: (optional) array of pairs: parameters to add as GET in the url
  • $excludeFromGet $excludeFromGet: (optional) array of strings: parameters to remove from GET in the url
  • $glue
PU_BuildGETArray (line 28)

Build array from get url.

TODO: it's probably faster to use PHP build-in function (array_merge...)

  • author: greg
  • date: 20110809 (v1.0.1) (greg) fixed a typo with $includeInGet
array PU_BuildGETArray ( $myGET, [array $includeInGet = null], [array $excludeFromGet = null])
  • array $myGET
  • array $includeInGet
  • array $excludeFromGet
PU_BuildGETString (line 50)

Creates a (string) url to be used with GET, including encoding

string PU_BuildGETString ( $myGET, [string $glue = '&'])
  • array $myGET
  • string $glue
PU_BuildHREF (line 167)

Build a html link (A+HREF html tag) with label and url and GET parameters

  • return: the complete html link
  • version: 1.0.1
  • date: 20091203: added $attrs parameter
string PU_BuildHREF ($label $label, [$includeInGet $includeInGet = null], [$excludeFromGet $excludeFromGet = null], [$target $target = null], [ $attrs = null])
  • $label $label: string: the text of the link
  • $includeInGet $includeInGet: (optional) array of pairs: parameters to add as GET in the url
  • $excludeFromGet $excludeFromGet: (optional) array of strings: parameters to remove from GET in the url
  • $target $target: (optional) string: the target script url (current script if missing)
  • array $attrs
PU_buildHTMLoptions (line 548)

Create a html string of <options> from an associative array

  • return: the html to display
  • author: greg
  • version: 1.0.1
  • date: 20101021 (v1.0.1) (greg) added checks on $a ; removed htmlentities
string PU_buildHTMLoptions (array $a, [string|array $selected = null])
  • array $a
  • string|array $selected: which key(s) should be marked as "selected" (optional)
PU_buildParsedURL (line 101)

Builds a parsed url.

string PU_buildParsedURL (array $p)
  • array $p
PU_BuildURL (line 140)

Build a url with GET parameters

  • return: the built url
  • author: greg
  • version: 1.1
  • date: 20100930 (v1.1) (greg) $target parameter can now be an array resulting from php's parse_url function
string PU_BuildURL ([string|array $target = null], [array $includeInGet = null], [array $excludeFromGet = null], [ $glue = '&amp;amp;'])
  • string|array $target: (optional) string: the target script url (current script if missing)
  • array $includeInGet: (optional) array of pairs: parameters to add as GET in the url
  • array $excludeFromGet: (optional) array of strings: parameters to remove from GET in the url
  • $glue
PU_cleanBuffers (line 384)

Get rid of all buffer, optionaly flushing (i.e. writing to the browser) Default behavior is to ignore.

void PU_cleanBuffers ([boolean $flush = false])
  • boolean $flush: do we flush or ignore?
PU_CleanString (line 186)

Clean a string from possibly harmful chars

These are removed: single and double quotes, backslashes, optionnaly html tags (everything between < and >)

A cleaned string should be safe to include in an html output

string PU_CleanString ($string $string, [$clean_htlm $clean_htlm = false])
  • $string $string: the string to clean
  • $clean_htlm $clean_htlm: if true, HTML tags are deleted too
PU_dumpArray (line 360)

Outputs an array in html

A slightly better version of print_r()

  • author: greg
  • version: 1.2
  • date: 20100825 (greg) (v1.1) updated to deal with associative arrays
  • date: 20110211 (greg) (v1.2) added $htmlize parameter
void PU_dumpArray (array $a, [string $title = null], [boolean $htmlize = false])
  • array $a
  • string $title
  • boolean $htmlize: (default to false) if true html is escaped to be displayed as source
PU_exitToAJAX (line 467)

OBSOLETE don't use

void PU_exitToAJAX ($data $data)
  • $data $data
PU_isAJAX (line 430)

Determines if the current request has been made by some kind of ajax call (i.e. XMLHttpRequest)

  • author: greg <greg@phpdevshell.org>
  • version: 1.0.1
  • date: 20110809 (v1.0.1) (greg) use PU_silentHeader to prevent unit tests from failing
boolean PU_isAJAX ([boolean $json = false])
  • boolean $json: set to true if you want to force the request's result as json
PU_isJSON (line 453)

Checks for a json context and if so, outputs data

  • return: false if it's not JSON, or the encoded data
  • author: greg <greg@phpdevshell.org>
  • version: 1.1
  • date: 20110309 (v1.0) (greg) added
  • since: v3.0.1
  • date: 20110316 (v1.1) (greg) returns instead of printing (for buffering)
boolean, PU_isJSON ($data $data, [$force $force = false])
  • $data $data: mixed, the data to be encoded and sent
  • $force $force: boolean, (optionnal) do we pretend it's json context even if it's not?
PU_MakeString (line 201)

Convert a string to UTF8 (default) or to HTML

string PU_MakeString ($string $string, [$htmlize $htmlize = false])
  • $string $string: the string to convert
  • $htmlize $htmlize: if true the string is converted to HTML, otherwise to UTF8
PU_silentHeader (line 413)

Add a header if and only if headers have not been sent yet

nothing PU_silentHeader (string $header)
  • string $header: the header string to add
PU_sprintfn (line 507)

version of sprintf for cases where named arguments are desired (python syntax)

with sprintf: sprintf('second: %2$s ; first: %1$s', '1st', '2nd');

with sprintfn: sprintfn('second: %(second)s ; first: %(first)s', array( 'first' => '1st', 'second'=> '2nd' ));

  • return: result of sprintf call, or bool false on error
  • author: nate at frickenate dot com
string|false PU_sprintfn (string $format, [ $args = array()])
  • string $format: sprintf format string, with any number of named arguments
  • array $args: array of [ 'arg_name' => 'arg value', ... ] replacements to be made
textdomain (line 339)
void textdomain ( $textdomain)
  • $textdomain
_ (line 319)
void _ ( $text)
  • $text
_e (line 281)

This function echos the returning text.

void _e (text $text)
  • text $text
__ (line 253)

Wrapper for $core->__() method.

Converts text to use gettext PO system. Does the same as $core->__();

  • return: Will return converted string or same string if not available.
  • author: Jason Schoeman
string __ ( $gettext, [string $domain = false], string $say_what)
  • string $say_what: The string required to output or convert.
  • string $domain: Override textdomain that should be looked under for this text string.
  • $gettext
__e (line 291)

This function echos the returning text inside a domain.

void __e (text $text,  $domain)
  • text $text
  • $domain
___ (line 271)

Specifically meant for core translation domain.

string ___ ( $gettext, string $say_what)
  • string $say_what: The string required to output or convert.
  • $gettext

Documentation generated on Tue, 09 Aug 2011 09:05:32 +0200 by phpDocumentor 1.4.3