PHPDevShell 3.1.3-Stable
PHP OOP RAD Development Framework
crud Class Reference
Inheritance diagram for crud:
PHPDS_dependant

Public Member Functions

 construct ($orm=null)
 errorShow ()
 ok ()
 error ($error_message='', $field='')
 errorElse ($error_message='', $field='FORM')
 importFields ($array)
 field ($key=null, $default=null)
 REQUEST ($key=null, $default=null)
 POST ($key=null, $default=null)
 GET ($key=null, $default=null)
 select ($options, $selected)
 checkbox ($name, $options, $checked)
 radio ($name, $options, $checked)
 selectElements ($name, $options, $checked, $type)
 multiSelected ($val, $join_id=null, $columns= 'join_id, value')
 isMultipleOption ($val, $default=null)
 multiSelectedModel ($val, $join_id=null, $columns= 'join_id, value', $default=null)
 multiSelectedORM ($val, $join_id=null, $columns= 'join_id, value', $default=null)
 addField ($val, $default=null)
 is ($val, $default=null)
 isField ($val, $default=null)
 isNumeric ($val, $default=null)
 isEmail ($val, $default=null)
 isUrl ($val, $default=null)
 isIpAddress ($val, $default=null)
 isAlpha ($val, $default=null)
 isAlphaNumeric ($val, $default=null)
 isAlphaNumericDash ($val, $default=null)
 isAlphaDash ($val, $default=null)
 isInteger ($val, $default=null)
 isCreditCard ($val, $default=null)
 isRangeLength ($val, $min=0, $max=0, $default=null)
 isMinLength ($val, $min, $default=null)
 isMaxLength ($val, $max, $default=null)
 isMaxValue ($val, $max, $default=null)
 isMinValue ($val, $min, $default=null)
 isRangeValue ($val, $min, $max, $default=null)
 isLength ($val, $length, $default=null)
 isDecimal ($val, $default=null)
 isHexColor ($val, $default=null)
 isRegex ($val, $expression, $default=null)
 isMatches ($val, $value, $default=null)
 isEmpty ($val, $default=null)
 isDate ($val, $default=null)
 isEnum ($val, $arr, $default=null)
 isMd5 ($val, $default=null)
 isBase64 ($val, $default=null)
 isUnique ($val, $default=null)
 isRgb ($val, $default=null)
 isBoolean ($val, $default=null)
 isToken ($val, $default=null)
 isEmailDomain ($val, $default=null)
 isPhone ($val, $lengths=null, $default=null)
 isUtf8 ($val, $default=null)
 isLower ($val, $default=null)
 isUpper ($val, $default=null)
 isPincode ($val, $country= 'us', $default=null)
 isUrlExists ($val, $default=null)
 isJsSafe ($val, $default=null)
 isHtmlSafe ($val, $default=null)
 isMultiLine ($val, $default=null)
 isExists ($val, $arr, $default=null)
 isAscii ($val, $default=null)
 isMacAddress ($val, $default=null)
 isUsssn ($val, $default=null)
 isDateDE ($val, $default=null)
 isDateISO ($val, $default=null)
 isTimezone ($val, $default=null)
 isTime24 ($val, $default=null)
 isTime12 ($val, $default=null)

Data Fields

 $get
 $post
 $request
 $protect = true
 $from = 'post'
 $orm = null
 $f
 $lastField
 $selectWrite
 $errorExist = array()

Detailed Description

RedBeanPHP ORM plugin.

Author:
Jason Schoeman, maheshchari.com

Member Function Documentation

addField ( val,
default = null 
)

a Clean way to add more variable to crud stack.

Parameters:
stringexpecting form field name
mixeda Default value to set the field to if failing.
mixedThe default value that should be used when empty.
Returns:
mixed
checkbox ( name,
options,
checked 
)

Makes check boxes easy to create and maintain.

Parameters:
type$name
type$options
type$checked
Returns:
string
Author:
Jason Schoeman
construct ( orm = null)

This method does the actual security check, other security checks are done on a per call basis to this method in specific scripts. Improved version reduces the cost of queries by 3, I also believe that this is a more secure method.

Parameters:
boolean$validate_crypt_keySet if you would like the system to verify an encryption before accepting global $_POST variables. Use with method send_crypt_key_validation in your form.
Returns:
string
Author:
Jason Schoeman
error ( error_message = '',
field = '' 
)

Ater each validation, add this as the condition to report the error and its message.

Parameters:
string$error_message
string$fieldThis should be the field name, else it will auto detect.
Author:
Jason Schoeman
errorElse ( error_message = '',
field = 'FORM' 
)

For a general form error, this can be used to halt the ok process.

Parameters:
string$error_message
string$idThis should be the element id name, else it will use the form tag.
Author:
Jason Schoeman
errorShow ( )

After each form validation methods, use this to compile error fields if any.

Author:
Jason Schoeman
field ( key = null,
default = null 
)

Allows system to do general check on specified form receive type.

Parameters:
mixed$key
mixed$default
Returns:
mixed
Author:
Jason Schoeman
GET ( key = null,
default = null 
)

Return a value from the GET meta array

Parameters:
string | null$keythe name of the get variable to fetch; if null, the entire array is returned
mixed | array$defaulta default value to return when the get variable is not set; when returning the entire array, an array can be given here with default values
Returns:
scalar|array the content of the get variable or the whole array, possibly with default value(s)
Author:
Jason Schoeman
importFields ( array)

Allows import of arrays and converts them to properties for easy access.

Parameters:
type$array
Author:
Jason Schoeman
is ( val,
default = null 
)

check if field empty string ,orject,array

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isAlpha ( val,
default = null 
)

Matches only alpha letters

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isAlphaDash ( val,
default = null 
)

Matches alpha and dashes like -,_

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isAlphaNumeric ( val,
default = null 
)

Matches alpha and numbers only

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isAlphaNumericDash ( val,
default = null 
)

Matches alpha ,numbers,-,_ values

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isAscii ( val,
default = null 
)

is given string is ascii format?

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isBase64 ( val,
default = null 
)

Matches base64 enoding string

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isBoolean ( val,
default = null 
)

is given field is boolean value or not

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isCreditCard ( val,
default = null 
)

Valid Credit Card

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isDate ( val,
default = null 
)

Check if given string matches any format date

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isDateDE ( val,
default = null 
)

Checks given value matches date de

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isDateISO ( val,
default = null 
)

Checks given value matches us citizen social security number

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isDecimal ( val,
default = null 
)

check decimal with . is optional and after decimal places up to 6th precision

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isEmail ( val,
default = null 
)

valid email

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isEmailDomain ( val,
default = null 
)

Checks that a field is exactly the right length.

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty. not added to Windows until PHP 5.3.0 boolean
isEmpty ( val,
default = null 
)

check if field empty string ,orject,array

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isEnum ( val,
arr,
default = null 
)

check given string againest given array values

Parameters:
stringexpecting form field name
array
mixedThe default value that should be used when empty.
Returns:
boolean
isExists ( val,
arr,
default = null 
)

check given array key element exists?

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isField ( val,
default = null 
)

Returns fields value

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isHexColor ( val,
default = null 
)

Valid hexadecimal color ,that may have #,

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isHtmlSafe ( val,
default = null 
)

given sting has html tags?

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isInteger ( val,
default = null 
)

Matches exactly number

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isIpAddress ( val,
default = null 
)

Valid IP address

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isJsSafe ( val,
default = null 
)

Check given sting has script tags

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isLength ( val,
length,
default = null 
)

check for exactly length of string

Parameters:
stringexpecting form field name
intexpecting lenght of string
mixedThe default value that should be used when empty.
Returns:
boolean
isLower ( val,
default = null 
)

Given sting is lower cased

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isMacAddress ( val,
default = null 
)

Checks given value again MAC address of the computer

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isMatches ( val,
value,
default = null 
)

compares two any kind of values ,stictly

Parameters:
stringexpecting form field name
mixedexpecting string to compare too
mixedThe default value that should be used when empty.
Returns:
boolean
isMaxLength ( val,
max,
default = null 
)

check string length exceeds maximum length

Parameters:
stringexpecting form field name
intmax
mixedThe default value that should be used when empty.
Returns:
boolean
isMaxValue ( val,
max,
default = null 
)

check given number exceeds max values

Parameters:
stringexpecting form field name
intmax
mixedThe default value that should be used when empty.
Returns:
boolean
isMd5 ( val,
default = null 
)

Checks that a field matches a v2 md5 string

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isMinLength ( val,
min,
default = null 
)

Check the string length has minimum length

Parameters:
stringexpecting form field name
intmin
mixedThe default value that should be used when empty.
Returns:
boolean
isMinValue ( val,
min,
default = null 
)

check given number below value

Parameters:
stringexpecting form field name
intmin
mixedThe default value that should be used when empty.
Returns:
boolean
isMultiLine ( val,
default = null 
)

check given sring has multilines

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isMultipleOption ( val,
default = null 
)

Simple check for multiple options.

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isNumeric ( val,
default = null 
)

check a number optional -,+,. values

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isPhone ( val,
lengths = null,
default = null 
)

Matches a phone number that length optional numbers 7,10,11

Parameters:
stringexpecting form field name
intexpecting number lenght
mixedThe default value that should be used when empty.
Returns:
boolean
isPincode ( val,
country = 'us',
default = null 
)

Checks that given value matches following country pin codes. at = austria au = australia ca = canada de = german ee = estonia nl = netherlands it = italy pt = portugal se = sweden uk = united kingdom us = united states

Parameters:
Stringexpecting form field name
Stringexpecting country code
mixedThe default value that should be used when empty.
Returns:
boolean
isRangeLength ( val,
min = 0,
max = 0,
default = null 
)

check given string length is between given range

Parameters:
stringexpecting form field name
intmin
intmax
mixedThe default value that should be used when empty.
Returns:
boolean
isRangeValue ( val,
min,
max,
default = null 
)

check given number between given values

Parameters:
stringexpecting form field name
intmin
intmax
mixedThe default value that should be used when empty.
Returns:
boolean
isRegex ( val,
expression,
default = null 
)

Matches againest given regular expression ,including delimeters

Parameters:
stringexpecting form field name
stringregular expression string to compare against
mixedThe default value that should be used when empty.
Returns:
boolean
isRgb ( val,
default = null 
)

Check is rgb color value

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isTime12 ( val,
default = null 
)

Time in 12 hours format with optional seconds 08:00AM | 10:00am | 7:00pm

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isTime24 ( val,
default = null 
)

Time in 24 hours format with optional seconds 12:15 | 10:26:59 | 22:01:15

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isTimezone ( val,
default = null 
)

Checks given value matches a time zone +00:00 | -05:00

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isToken ( val,
default = null 
)

A token that don't have any white space

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isUnique ( val,
default = null 
)

check if array has unique elements,it must have minimum one element

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isUpper ( val,
default = null 
)

Given string is upper cased?

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isUrl ( val,
default = null 
)

Valid URL or web address

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isUrlExists ( val,
default = null 
)

Check given url really exists?

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isUsssn ( val,
default = null 
)

Checks given value matches us citizen social security number

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
isUtf8 ( val,
default = null 
)

check given sting is UTF8

Parameters:
stringexpecting form field name
mixedThe default value that should be used when empty.
Returns:
boolean
multiSelected ( val,
join_id = null,
columns = 'join_id,
value'   
)

Allows you to easily maintain selected fields.

Parameters:
string$val
int$join_id
string$columns
Returns:
array
multiSelectedModel ( val,
join_id = null,
columns = 'join_id,
value'  ,
default = null 
)

Allows you to easily maintain selected fields.

Parameters:
string$val
int$join_id
string$columns
mixedThe default value that should be used when empty.
Returns:
array
multiSelectedORM ( val,
join_id = null,
columns = 'join_id,
value'  ,
default = null 
)

Allows you to easily maintain selected fields.

Parameters:
string$val
int$join_id
string$columns
mixedThe default value that should be used when empty.
Returns:
array
ok ( )

Check if the data was submitted ok and make sure there are no errors.

Returns:
boolean
Author:
Jason Schoeman
POST ( key = null,
default = null 
)

Return a value from the POST array

Parameters:
string | null$keythe name of the post variable to fetch; if null, the entire array is returned
mixed | array$defaulta default value to return when the post variable is not set; when returning the entire array, an array can be given here with default values
Returns:
scalar|array the content of the post variable or the whole array, possibly with default value(s)
Author:
Jason Schoeman
radio ( name,
options,
checked 
)

Makes radio buttons easy to create and maintain.

Parameters:
type$name
type$options
type$checked
Returns:
string
Author:
Jason Schoeman
REQUEST ( key = null,
default = null 
)

Return a value from the REQUEST array

Parameters:
string | null$keythe name of the post variable to fetch; if null, the entire array is returned
mixed | array$defaulta default value to return when the post variable is not set; when returning the entire array, an array can be given here with default values
Returns:
scalar|array the content of the post variable or the whole array, possibly with default value(s)
Author:
Jason Schoeman
select ( options,
selected 
)

Makes select fields easy to create and maintain.

Parameters:
type$options
type$selected
Returns:
string
Author:
Jason Schoeman
selectElements ( name,
options,
checked,
type 
)

Maintainer for radio checkboxes and select fields.

Parameters:
type$name
type$options
type$checked
type$type
Returns:
string

Field Documentation

$errorExist = array()
$f
$from = 'post'
$get
$lastField
$orm = null
$post
$protect = true
$request
$selectWrite

The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Enumerations