PHP 클래스 Pommo_Validate, poMMo

This file is part of poMMo (http://www.pommo.org) poMMo is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or any later version. poMMo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with program; see the file docs/LICENSE. If not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
파일 보기 프로젝트 열기: soonick/poMMo 1 사용 예제들

공개 메소드들

메소드 설명
addData ( string $name, string $type, $isEmptyAllowed, string $regex = null ) : void addData Adds Data to the array to be checked
addPasswordMatch ( $name1, $name2 ) : void addPasswordMatch Adds Data to the password match array to be checked
checkData ( ) : boolean checkData Runs the checks on the data fields and password matches
getErrors ( ) : array getErrors Returns what the validation errors were
setPost ( array $post ) : void setPost Recieves the incoming post into the array
subscriberData ( array &$in, $p = [] ) : boolean subscriberData Validates supplied subscriber data against fields

비공개 메소드들

메소드 설명
validateDate ( $date ) : boolean validateDate Validates a date value
validateDateTime ( $date ) : boolean validateDateTime Validates a datetime value
validateEmail ( $email ) : boolean validateEmail Validates an E-mail address
validateTime ( $time ) : boolean validateTime Validates a time value for mysql
validateUrl ( $url ) : boolean validateUrl Validates an URL. This validation is part of smarty_validate plugin.
validatematchRegex ( $regex, $string ) : boolean validatematchRegex Validates that a string matches a regex

메소드 상세

addData() 공개 메소드

@param string $name - Name of the input type (ie ID='name')
public addData ( string $name, string $type, $isEmptyAllowed, string $regex = null ) : void
$name string
$type string - Type to check. Valid Values Email date dateTime Time Url matchRegex Other (ie if you just want an empty check)
$regex string - if matchRegex was choosen in $type, then this is the regex that is going to be checked @return void
리턴 void

addPasswordMatch() 공개 메소드

@param string $name - Name of the input type (ie ID='name') string $name2 - Name of the 2nd input type
public addPasswordMatch ( $name1, $name2 ) : void
리턴 void

checkData() 공개 메소드

@param void
public checkData ( ) : boolean
리턴 boolean True if NO errors

getErrors() 공개 메소드

@param void
public getErrors ( ) : array
리턴 array Array containing all error messages

setPost() 공개 메소드

@param array $post - Incoming post
public setPost ( array $post ) : void
$post array
리턴 void

subscriberData() 공개 정적인 메소드

@param array $in - The subscriber Data array $p - A parameter array with values as follows :- boolean prune - if true, prune the data array (passed by reference) to only recognized/checked fields boolean ignore - if true, invalid fields will be pruned from $in array -- no error thrown boolean ignoreInactive - if true, invalid inactive fields will be pruned from $in array - no error thrown boolean active - if true, only check data against active fields. Typically true if subscribing via form, false if admin importing. boolean skipReq - if true, skip the required check AND empty fields. boolean log - if true, log invalid fields as error. Typically true if subscribing via form, false if admin importing.
public static subscriberData ( array &$in, $p = [] ) : boolean
$in array
리턴 boolean validation status NOTE: has the MAGIC FUNCTIONALITY of converting date field input to a UNIX TIMESTAMP. This is necessary for quick SQL comparisson of dates, etc. NOTE: has the MAGIC FUNCTINALITY of changing "true"/"false" to checkbox "on"/off equivelent NOTE: has the MAGIC FUNCTIONALITY of trimming leading and trailing whitepace NOTE: has the MAGIC FUNCTIONALITY of shortening value to 60 characters (or 255 if a comment type) TODO -> should fields be passed by reference? e.g. are they usually already available when subscriberData() is called?