File/common/pcf.phpinc

Description

Common Functions

Constants
_OCSP_PCF_COMMON_FUNCTIONS_LOADED_ = true (line 19)
Functions
echoDebug (line 1458)

echos a debug message this method is planed for using different debug output methods

  • since: pk-05-12-14
void echoDebug (string $srcfile,  $message, [int $level = 0], string $messsage)
  • string $srcfile
  • string $messsage
  • int $level: debug level
  • $message
echoDebugLine (line 1474)

echos a debug message with line

void echoDebugLine (string $srcfile, int $line, string $message, [int $level = 0])
  • string $srcfile
  • int $line
  • string $message
  • int $level
echoDebugMethod (line 1511)

echos the debug infos of a class method

  • version: pk-08-12-04
  • since: pk-06-02-10
void echoDebugMethod (string $srcfile, string $class, string $method, [string $message = ""], [int $level = 0])
  • string $srcfile
  • string $class
  • string $method
  • string $message
  • int $level
ocsp_logError (line 1558)

logs an error

  • since: pk-07-05-04
void ocsp_logError (string $srcfile, int $line, string $message, [int $level = E_WARNING])
  • string $srcfile
  • int $line
  • string $message
  • int $level: @see http://www.php.net/manual/en/ref.errorfunc.php#errorfunc.constants
pcf_addzero (line 194)
void pcf_addzero ( $aInt, [ $length = 2])
  • $aInt
  • $length
pcf_apcEnabled (line 1281)

returns if apc is installed

void pcf_apcEnabled ()
pcf_apcFetch (line 1293)

returns the cache value of a var

mixed pcf_apcFetch (string $varName)
  • string $varName
pcf_apcSet (line 1312)

sets an apc varibale

void pcf_apcSet (string $varName, mixed $value, [int $ttl = 3600])
  • string $varName
  • mixed $value
  • int $ttl
pcf_array_copy (line 116)
void pcf_array_copy ( $aArray, [ $from = 0], [ $till = 0])
  • $aArray
  • $from
  • $till
pcf_array_getKeyPartArray (line 152)
void pcf_array_getKeyPartArray ( $aArray,  $keyPart, [ $debug = FALSE])
  • $aArray
  • $keyPart
  • $debug
pcf_array_getRKeyPartArray (line 171)
void pcf_array_getRKeyPartArray ( $aArray,  $keyPart, [ $debug = FALSE])
  • $aArray
  • $keyPart
  • $debug
pcf_array_strIdx (line 135)
void pcf_array_strIdx ( $aArray)
  • $aArray
pcf_cache_SettingTbl (line 1405)

writes setting table to a file

  • since: pk-05-11-15
boolean pcf_cache_SettingTbl (string $tbl, [string $section = ""], [string $fName = ""], [boolean $debug = FALSE])
  • string $tbl
  • string $section
  • string $fName
  • boolean $debug
pcf_castObject (line 1211)

casts a object form one type to an other the class source for the new object must exist in case of an error NULL is returned

Note: if the new object has set CLASSVARIABLES (string seperated with ,) this values are not overwritten when copying the values from $src to the new object

  • since: pk-05-11-21
object pcf_castObject (object $src, string $className, [boolean $debug = FALSE])
  • object $src
  • string $className
  • boolean $debug
pcf_class_implements (line 1029)

checks if an object implements an interface

  • since: pk-08-06-16
boolean pcf_class_implements ( &$obj, string $aInterface, object $obj)
  • object $obj
  • string $aInterface
  • &$obj
pcf_copy_object (line 1181)

function copies all values of $src to $dest

  • since: pk-04-08-25
boolean pcf_copy_object (object $src, object &$dest)
  • object $src
  • object &$dest
pcf_disableHTML (line 317)

replaces < and > with $lt; and $gt;

  • since: pk-07-02-28
string pcf_disableHTML (string $str)
  • string $str
pcf_div (line 190)
void pcf_div ( $a,  $b)
  • $a
  • $b
pcf_escape_doubleQuote (line 560)

escapes " with /" and /" with ///"

  • version: pk-07-07-26
  • since: pk-04-07-23
string pcf_escape_doubleQuote (string $aString, [ $debug = FALSE])
  • string $aString
  • $debug
pcf_formatCurrency (line 219)

returns a string out of a double with . seperating each 1000 and , as

  • version: pk-05-11-22
string pcf_formatCurrency (double $aDouble, [int $digits = 2], [boolean $debug = FALSE])
  • double $aDouble
  • int $digits
  • boolean $debug
pcf_gerCharTxt (line 291)

converts german spezial chars in a string to a text representation

example ä => ae

  • since: pk-04-10-21
string pcf_gerCharTxt (string $str)
  • string $str
pcf_gerHTMLspecialChars (line 261)

converts german spezial chars in a string to html code

example ᅵ=> &auml;

  • since: pk-06-01-04
string pcf_gerHTMLspecialChars (string $str)
  • string $str
pcf_getSystem (line 607)

executes a system command and sets the output to $output

  • return: (the system return code of the command
  • since: pk-07-03-13
int pcf_getSystem (string $command,  &$output, [boolean $debug = FALSE], string $output)
  • string $command
  • string $output
  • boolean $debug
  • &$output
pcf_HTML_changeURI_GetValue (line 716)

if $name is in URIs Query string the value is replaced otherwise $name=$value is appended to the uri

  • version: pk-04-02-15
  • version: pk-05-08-29
  • version: pk-05-11-30
  • since: pk-03-12-19
string pcf_HTML_changeURI_GetValue (string $uri, string $name, string $value, [boolean $debug = FALSE])
  • string $uri
  • string $name
  • string $value
  • boolean $debug
pcf_HTML_getEncodedURI (line 787)

returns an encoded url (& is replaced with &amp;) and checks that only one ? is in the url

All special characters in HREF should be encoded. "&" is a reserved character to begin an entity. (ex: &nsbp). "&" in HREF field should be encoded as his equivalent entity "&amp;", even when used as a separator for parameters in the URL.

References:

W3C spec: http://www.w3.org/TR/html4/appendix/notes.html#h-B.2.2 W3C CDATA: http://www.w3.org/TR/html4/types.html#type-cdata HtmlHelp: http://www.htmlhelp.com/tools/validator/problems.html#amp Very interesting: http://ppewww.ph.gla.ac.uk/~flavell/www/formgetbyurl.html

  • since: pk-06-10-19
string pcf_HTML_getEncodedURI (string $uri, [boolean $debug = FALSE])
  • string $uri
  • boolean $debug
pcf_include (line 101)

use this method to load an include in global scope

boolean pcf_include (string $aFile)
  • string $aFile
pcf_is_instance_of (line 1007)

checks if a object is instance of a class

not php only knows lower case class names therefore class name is treaten case insensitve

  • since: pk-04-01-08
bool pcf_is_instance_of ( &$obj, string $aClass, object $obj)
  • object $obj
  • string $aClass
  • &$obj
pcf_js_alert (line 407)

echos alert($msg) to use in javascript

  • since: pk-08-02-05
void pcf_js_alert (string $msg)
  • string $msg
pcf_js_alertError (line 492)

returns the js code for an errormsg alert box

  • since: pk-07-02-27
string pcf_js_alertError (string $errMsg, [boolean $closeWnd = FALSE], [boolean $echoHTML = FALSE], [boolean $echoDocument = FALSE], [string $bodyTag = &quot;&quot;])
  • string $errMsg
  • boolean $closeWnd: (append window.close() ?)
  • boolean $echoHTML: (inclode <script> tag)
  • boolean $echoDocument: (inclode <html><head>....</html>)
  • string $bodyTag: (can be used to show debug infos
pcf_js_debug (line 412)
void pcf_js_debug ( $msg)
  • $msg
pcf_js_escape (line 391)
  • since: pk-07-08-31
string pcf_js_escape (string $val)
  • string $val
pcf_js_escapeOnEventCmd (line 533)

escapes a js used in an on.... tag

  • since: pk-08-02-13
string pcf_js_escapeOnEventCmd (string $str_cmd, [char $quoteType = '&quot;'])
  • string $str_cmd
  • char $quoteType
pcf_js_setInnerHTML (line 438)

echos document.getElementById(...)

  • version: pk-08-10-01 $setVisible added
void pcf_js_setInnerHTML (string $domId, string $content, [boolean $try = False], [boolean $setVisible = False])
  • string $domId
  • string $content
  • boolean $try: (use try catch)
  • boolean $setVisible
pcf_mailArray (line 641)

uses an array to send a mail

the array needs the following elements set

this function is mainly used for sending debug infos to a specified receipient

  • $arr['MAILTO'] receipient of the mail
  • $arr['SUBJECT'] subject
  • $arr['BODY'] body of the mail
optional you can set the mail headers with index
  • $arr['HEADERS']

  • return: @link http://www.php.net/manual/en/function.mail.php
  • since: pk-03-12-18
bool pcf_mailArray (array $arr)
  • array $arr
pcf_makeJS_QuotedString (line 371)

returns a string which can be used in javasScript for s=" echo pcf_makeJS_QuotedString($aString); ";

  • version: pk-07-08-31
  • version: pk-07-11-16
void pcf_makeJS_QuotedString (string $aString, [char $strSign = '&quot;'], [bool $debug = FALSE])
  • string $aString
  • char $strSign
  • bool $debug
pcf_object_has_method (line 1060)

returns if a $obj has method $method

  • since: pk-05-01-11
bool pcf_object_has_method ( &$obj, string $method, [ $debug = FALSE], object $obj)
  • object $obj
  • string $method
  • &$obj
  • $debug
pcf_object_id (line 1082)
string pcf_object_id (mixed &$obj, [bolean $useVardump = FALSE])
  • mixed &$obj
  • bolean $useVardump: (use this with care as recursiv objects can lead to endless loops here)
pcf_object_info (line 1119)

returns a string discribing $obj

  • version: pk-05-01-11
string pcf_object_info (object $obj, [int $noLevels = 4], [bool $withMethods = FALSE])
  • object $obj
  • int $noLevels
  • bool $withMethods
pcf_parent_method_exists (line 1040)
void pcf_parent_method_exists ( &$obj,  $aMethod)
  • &$obj
  • $aMethod
pcf_parsePathTmpl (line 79)

parses a path with global var templates

  • since: pk-07-03-06
string pcf_parsePathTmpl (string $pathTmpl, [array $aValues = array()])
  • string $pathTmpl
  • array $aValues
pcf_parseQueryString (line 672)

parses a query string and returns an array with key values returns FALSE if an error occured

  • todo: handle arrays
  • since: pk-05-08-29
array pcf_parseQueryString (string $qs, [char $sep = '&amp;'], [boolean $debug = FALSE])
  • string $qs
  • char $sep
  • boolean $debug
pcf_pathToTmplate (line 40)

returns a template for the include path

replaces the following global vars by there template representation:

  • OCSP|FORMPATH
  • OCSP|PHPINCPATH
  • OCSP|PATH
  • PROJECT|PHPINCPATH
  • PROJECT|PATH

  • since: pk-07-03-06
string pcf_pathToTmplate (string $aPath, [boolean $debug = FALSE])
  • string $aPath
  • boolean $debug
pcf_print_r (line 1337)

like php funktion print_r but limits levels of going into keys

  • return: if $tostring=TRUE
  • since: pk-04-08-12
string pcf_print_r (mixed $variable, [ $toString = TRUE], [int $noLevels = 99], [string $intend = &quot;&quot;], [int $maxVarLen = 50], boolean $tostring)
  • mixed $variable
  • boolean $tostring
  • int $noLevels
  • string $intend: only used by recursiv calls
  • int $maxVarLen
  • $toString
pcf_require_class (line 874)

ensures a class is loaded

  • version: pk-08-06-10
  • version: pk-08-10-05 MODxxx_[MODULE]# added
  • since: pk-08-05-22
void pcf_require_class (string $className, [string $classSrc = &quot;&quot;], [boolean $debug = False])
  • string $className
  • string $classSrc
  • boolean $debug
pcf_require_function (line 839)

ensures the include file providing a function is loaded

  • since: pk-08-07-02
void pcf_require_function (string $funcName, mixed $funcInc)
  • string $funcName
  • mixed $funcInc
pcf_require_interface (line 965)

ensures an interface is loaded

  • version: pk-08-06-10
  • since: pk-08-05-22
void pcf_require_interface (string $interfaceName, string/array $interfaceSrc)
  • string $interfaceName
  • string/array $interfaceSrc
pcf_system (line 574)
void pcf_system ( $command, [ $hide = true], [ $debug = FALSE])
  • $command
  • $hide
  • $debug
pcf_t (line 341)

translates aString to language

  • todo: do the translation
  • since: pk-08-07-02
string pcf_t (string $aString, [string $toLang = &quot;&quot;], [string $module = 'OCSP'])
  • string $aString
  • string $toLang
  • string $module
t (line 346)
void t ( $aString, [ $toLang = &quot;&quot;])
  • $aString
  • $toLang
t_admin (line 351)
void t_admin ( $aString, [ $toLang = &quot;&quot;])
  • $aString
  • $toLang

Documentation generated on Thu, 08 Jan 2009 17:47:41 +0100 by phpDocumentor 1.4.0a2