phpPeanuts  2.2.0
phpPeanuts framework
 All Data Structures Namespaces Files Functions Variables
Static Public Member Functions
PntGen Class Reference

Inherited by Gen.

Static Public Member Functions

static getPntVersion ()
 
static tryIncludeClass ($className, $dirPath='')
 
static includeClass ($className, $dirPath='', $debug=false)
 
static is_a ($obj, $className)
 
static class_hasMethod ($className, $methodName)
 
static tryIncludeOnce ($filePath)
 
static isBrowserIE ()
 
static is_ofType ($value, $type)
 
static toString ($value, $max=4)
 
static valueToString ($value)
 
static exceptionToString ($e)
 
static assocsToStrings ($array, $max=null)
 
static labelFromObject ($value)
 
static labelFrom ($value)
 
static printBacktrace ($traceArray)
 
static getRelativePath ($path)
 
static pntGetFsSeparator ()
 
static array_searchCaseInsensitive ($needle, $haystack, $strict=false)
 
static is_typeEqual ($first, $second)
 
static getSubstr ($oString, $sString, $eString, $sPos=0)
 
static toCsvString ($array, $separator=';', $qualifier='"')
 
static fromCsvString ($str, $separator=';', $qualifier='"')
 
static splitFilePath ($filePath)
 
static sum_from ($propertyName, &$arr)
 
static stripQueryParam ($url, $paramName)
 
static asInt ($value)
 
static getBaseUrl ($serverVars, $funkyPattern=null)
 
static dt_add ($dateAndOrTime, $years=0, $months=0, $days=0, $hours=0, $minutes=0, $seconds=0)
 
static dt_largerOrNone ($value, $ref, $incl=false)
 

Member Function Documentation

static array_searchCaseInsensitive (   $needle,
  $haystack,
  $strict = false 
)
static

Like array_seach, but uses case insensitive stringcompare

Parameters
mixed$needle
arrayhaystack [
boolstrict]
static asInt (   $value)
static

Convert the argument to int, but if it === null or an empty string, return null

static assocsToStrings (   $array,
  $max = null 
)
static
Parameters
Array$arrayan associative array $return An array with strings representing the associations
static class_hasMethod (   $className,
  $methodName 
)
static
Parameters
String$classNamename of the class
String$methodNamemethod name in correct case
Returns
boolean Wheather the class defines or inherits the method and it is in the scope of the potential caller
static dt_add (   $dateAndOrTime,
  $years = 0,
  $months = 0,
  $days = 0,
  $hours = 0,
  $minutes = 0,
  $seconds = 0 
)
static

Adds the arguments to a date, time or datetime

Parameters
string$dateAndOrTimecontaining date, time or timestamp in ValueValidator internal format
Returns
string same type as $dateAndOrTime
static dt_largerOrNone (   $value,
  $ref,
  $incl = false 
)
static
Returns
boolean wheather the first param is larger then the second.
Parameters
string$valuewith date, time or timestamp
string$refwith date, time or timestamp, but same type as $value
boolean$inclwheather equal should result in true
static exceptionToString (   $e)
static

For debugging purposes, for user interface string use StringConverter

Returns
string from which the value van be recognized
Parameters
Exception$value
static fromCsvString (   $str,
  $separator = ';',
  $qualifier = '"' 
)
static

explodes csv string only to be used if strings are qualified, if not, use normal explode

Parameters
string$strwith qualified strings separated by a separator
string$separatorby which the elements are seperated
string$qualifierby wich the elements are surrounded. The qualifier itself is expected to be doubled witing the qualified string. $return array of string
static getBaseUrl (   $serverVars,
  $funkyPattern = null 
)
static

The baseUrl is the the url to the folder that holds all applications folders and the classes folder etc. Normally this is the parent folder of the folder where the current script is running. This method is used for the initialization of the baseUrl field of Site if it has not been set. With normal urls, the implementation assumes one folder and one scriptname between the basUrl and the question mark or the end of the url. With funky urls the implementation assumes the baseUrl to end where the $funkyPattern starts. It these assumptions are incorrect this method should be overridden or not be used.

Parameters
array$serverVarswith validated variables from $_SERVER
string$funkyPatternfor splitting funkyUrl or null if normal url
Returns
String The baseUrl
static getPntVersion ( )
static
Returns phpPeanuts version identifier 
Returns
String
static getRelativePath (   $path)
static
Returns
the path relative to the script
Parameters
string$pathto a http or file resource
static getSubstr (   $oString,
  $sString,
  $eString,
  $sPos = 0 
)
static

substring between the start marker and the end marker, not including the markers.

Parameters
String$oStringmay contain the substring
String$sStringmarks the start
String$eStringmarks the end
number$sPosposition to start searching
Returns
String The substring
static includeClass (   $className,
  $dirPath = '',
  $debug = false 
)
static
See Also
tryIncludeClass(), same method, but triggers a warning if class file is not found. each class file is only (try)included once We do use include instead of require because the use of a method like this one will unlike require, not tell the line number where it was called from when a file is not found. letting the execution continue may cause an error that reveals more about the caller that tried to include the class that was not found.

WARNING: Do not use this method with parameters that may be manipulated or corrupted especially not with data from the request or the session. For performance reasons this method does not check its parameters to prevent the inclusion of code from outside the classes folder. PntRequestHandler::useClass does check.

static is_a (   $obj,
  $className 
)
static

Replacement of php4's is_a that has been depricated in php5 :-(((

static is_ofType (   $value,
  $type 
)
static

Returns wheather the supllied value is within the specified type for objects is_a is used, for $type = number is_numeric. otherwise type == get_type PS: is_numeric is locale dependent, this is consistent with implicit type conversion

Parameters
mixed$value
String$type
Returns
Boolean
static is_typeEqual (   $first,
  $second 
)
static
Returns
wheather the type of both parameters is equal
Parameters
mixed$first
mixed$second
static isBrowserIE ( )
static
Returns
boolean wheather the browser is Microsoft Internet Explorer
static labelFrom (   $value)
static
Parameters
mixed$valueanything but an array $return string from which the value can be recognized within its class, if not an object, the value is casted to string
static labelFromObject (   $value)
static
Parameters
object$value$return string from which the object can be recognized within its class, if not available ::valueToString is used
static pntGetFsSeparator ( )
static
Returns
string file system specific direcotry separator
static printBacktrace (   $traceArray)
static

Prints a backtrace in html.

Parameters
array$traceArrayarray from php's debug_backtrace method
static splitFilePath (   $filePath)
static
Returns
array with the directory path at index 0 and the file name at the index 1.
Parameters
string$filePatha file name or a file path separated by forward slashes
static stripQueryParam (   $url,
  $paramName 
)
static

Strip the query parameter (with its value). Does not work with funky parameters, does work with funky urls to strip from the non-funky additional query string part becuase lookup in associative arrays like $REQUEST are case senistive, query parameter stripping is also case sensitive.

Parameters
String$urlUrl, uri or query string. $param String parameter name without ?, = or & in correct case
Returns
String stripped $url
static sum_from (   $propertyName,
$arr 
)
static

Return the sum of the values of the property for the objects in the array

Exceptions
PntError
static toCsvString (   $array,
  $separator = ';',
  $qualifier = '"' 
)
static
static toString (   $value,
  $max = 4 
)
static

For debugging purposes, for user interface string use StringConverter

Returns
string from which the value van be recognized
Parameters
mixed$value
int$maxthe maximum number of array elements to be shown. If not all array elements are shown, ' ..' is added after the last element
static tryIncludeClass (   $className,
  $dirPath = '' 
)
static

Tries to include a class whose file name follows the pnt class file name rule: $fileName = "class$className.php" relative to the ../classes directory Registers included classes so that their names in correct case can be retrieved by classname in lowercase (=result of get_class() ) Each class file is only (try)included once, so if you dynamically generate class files during the same request that should include them, only use this service if you understand its implementation

WARNING: Do not use this with parameters that may be manipulated or corrupted especially not with data from the request or the session. For performance reasons this does not check its parameters to prevent the inclusion of code from outside the classes folder

Parameters
String$classNameThe name of the class in correct case
String$dirPaththe pathName of the directory relative to the current one
Returns
boolean Wheater the include file was found and included
static tryIncludeOnce (   $filePath)
static

Tries to include a file once. Returns wheater the file was included or included before. Does not trigger warnings. SECURITY WARNING: This method may be exploited to include code obtained from arbitrary servers using network protocols.

static valueToString (   $value)
static

For debugging purposes, for user interface string use StringConverter

Returns
string from which the value van be recognized
Parameters
mixed$valueanything but an array

The documentation for this class was generated from the following file: