gump.class.php
protected function validate_contains($field, $input, $param = null)
    {
        if (!isset($input[$field])) {
            return;
        }

        $param = trim(strtolower($param));

        $value = trim(strtolower($input[$field]));

        if (preg_match_all('#\'(.+?)\'#', $param, $matches, PREG_PATTERN_ORDER)) {
            $param = $matches[1];
        } else {
            $param = explode(chr(32), $param);
        }

        if (in_array($value, $param)) { // valid, return nothing
            return;
        }

        return array(
            'field' => $field,
            'value' => $value,
            'rule' => __FUNCTION__,
            'param' => $param,
        );
    }
protected function validate_contains($field, $input, $param = null)
    {
        if (!isset($input[$field])) {
            return;
        }

        $param = trim(strtolower($param));

        $value = trim(strtolower($input[$field]));

        if (preg_match_all('#\'(.+?)\'#', $param, $matches, PREG_PATTERN_ORDER)) {
            $param = $matches[1];
        } else {
            $param = explode(chr(32), $param);
        }

        if (in_array($value, $param)) { // valid, return nothing
            return;
        }

        return array(
            'field' => $field,
            'value' => $value,
            'rule' => __FUNCTION__,
            'param' => $param,
        );
    }
protected function validate_contains ( $ field , $ input , $ param = null ) { if ( ! isset ( $ input [ $ field ] ) ) { return ; } $ param = trim ( strtolower ( $ param ) ) ; $ value = trim ( strtolower ( $ input [ $ field ] ) ) ; if ( preg_match_all ( '#\'(.+?)\'#' , $ param , $ matches , PREG_PATTERN_ORDER ) ) { $ param = $ matches [ 1 ] ; } else { $ param = explode ( chr ( 32 ) , $ param ) ; } if ( in_array ( $ value , $ param ) ) { // valid, return nothing return ; } return array ( 'field' => $ field , 'value' => $ value , 'rule' => __FUNCTION__ , 'param' => $ param , ) ; }
Verify that a value is contained within the pre-defined value set.

Usage: '<index>' => 'contains,value value value'

@param string $field
@param array  $input
@param null   $param

@return mixed
Verify that a value is contained within the pre - defined value set .