Once you start building applications, you will add PHP code to events. Below is a list of pre-set functions you can use

clean_htmlClean HTML string removing all element attributes and elements which are not in the provided whitelist (but keeping their allowed children).function clean_html($html, array $whitelist)sanitized htmlbased upon
closeSessionCloses the session by unsetting it, destroying it, closes the write buffer and clears the session cookie.function closeSession()nothing
downloadDownload a filedownload($path, $file)
encryptpswEncrypts the password with the given method (none, md5, sha, php)encryptpsw($passwrd, $method)password
extractFieldNameExtract the fieldname of a table.field pairextractFieldName($theField)field name
getGUIDRetrieves a unique stringfunction getGUID()stringReturns a string that can be used for validation situations, i.e. for confirming credentials etc. In PHsPeed this string is used to let users validate their account.
getHTMLColorsRetrieves an array of html colorsgetHTMLColors()html colors
getProtocolReturns the used protocol as HTTP: or HTTPS: function getProtocol()HTTP: or HTTPS:
inPostStateTests if the form has received form data or is in it's initials statefunction inPostState();true, falseif(inPostState() ){…}
isHTTPSVerifies if the application runs under httpsisHTTPS()true, false
isTrueTest if a value is truetoClass($strin)true, falseChecks for all kind of values: t, T, y, Y, true, TRUE, yes, YES
getExternalSessionVarGet a session var of another modulegetExternalSessionVar($theVar, $default=,$origin=
setExternalSessionVarSets a session var for an external modulesetExternalSessionVar($theVar, $theVal, $origin=)
setSessionVarSets a session variablefunction setSessionVar($theVar, $value)nothingThis function sets a session variable that is maintained over the same session.
showMessageDisplays a modal messageshowMessage($msg)nothing
In general this function can be used to submit and in ajax stage to display a popup message, but only on events that passes the $app object.

Example: $app→showMessage('process complete');

See also macro notation (@@showMessage('…');
session_stopTerminates a sessionsession_stop()
sessionVarExists sessionVarExists($theVar)true,false
setFormMode($mode)Set next form mode to edit, delete, update, createsetFormMode($mode) Use this funciton before redirecting to the required module
setSessionVarSets a session variablefunction setSessionVar($theVar, $value)nothingThis function sets a session variable that is maintained over the same session.
unsetSessionVarUnsets a session variableunsetSessionVar($theVar)
toClassConverts a table.field name into a table_field name classtoClass($strin). → _
findComponentsearch component reference on component namefindComponentByName($theCompName)component reference or falseTraverses the component tree to find the required component
loginwrapper around the root component to loginlogin($uid, $pwd)true/false
logoffwrapper around the root component to logofflogoff()true/false
redirectredirect to the given urlRedirect($theUrl, $origin, $parms=,$initialformmode) Can be used in a regular status and within an ajax event. Origin: current module as recepient, parms: a=b&c=d&… parameter pairs, initialformmode: the form mode to start the next application in (insert, edit, delete, none) The parameter string will be encrypted using the project settings for security.
showMessageSets a session variableshowMessage($theMsg)nothingThis function sets a session variable that is maintained over the same session.
@@login(…)will be translated to $app→login(…) For some commonly used functions, it is more convenient to use the @@ notation as PHsPeed will 'know' in what module the function resides. So you don't have to remember that login is part of the $app.
@@showMessagewill be translated to $app>showMessage(…)

  • functions.txt
  • Last modified: 2020/10/07 15:47
  • by aducomadmin