Show
Ignore:
Timestamp:
02/16/2008 11:36:03 PM (9 months ago)
Author:
armen
Message:

in PHP > 5.2.3 its possible to use scope resolution syntax which is nice, it is possible to use such syntax for PHP < 5.2.3, now.
example:

$validation->add_rules('subject', 'valid::ip');

instead of:

$validation->add_rules('subject', array('valid', 'ip'));

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/libraries/Validation.php

    r2064 r2069  
    124124                        throw new Kohana_Exception('validation.filter_not_callable'); 
    125125 
     126                $filter = (is_string($filter) AND strpos($filter, '::') !== FALSE) ? explode('::', $filter) : $filter;                   
     127 
    126128                if ($field === TRUE) 
    127129                { 
     
    158160                        throw new Kohana_Exception('validation.filter_not_callable'); 
    159161 
     162                $filter = (is_string($filter) AND strpos($filter, '::') !== FALSE) ? explode('::', $filter) : $filter; 
     163 
    160164                if ($field === TRUE) 
    161165                { 
     
    221225                                throw new Kohana_Exception('validation.rule_not_callable'); 
    222226 
     227                        $rule = (is_string($rule) AND strpos($rule, '::') !== FALSE) ? explode('::', $rule) : $rule; 
     228 
    223229                        // Add the rule to specified field 
    224230                        $this->rules[$field][] = array($rule, $args); 
     
    258264                        if ( ! is_callable($callback, TRUE)) 
    259265                                throw new Kohana_Exception('validation.callback_not_callable'); 
     266 
     267                        $callback = (is_string($callback) AND strpos($callback, '::') !== FALSE) ? explode('::', $callback) : $callback;                                                         
    260268 
    261269                        // Add the filter to specified field