Changeset 2344
- Timestamp:
- 03/25/2008 09:21:45 AM (8 months ago)
- Files:
-
- 1 modified
-
trunk/system/libraries/Validation.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/libraries/Validation.php
r2334 r2344 138 138 public function pre_filter($filter, $field = TRUE) 139 139 { 140 if (method_exists($this, $filter)) 141 { 142 // Make the filter a valid callback 143 $filter = array($this, $filter); 144 } 145 140 146 if ( ! is_callable($filter)) 141 147 throw new Kohana_Exception('validation.filter_not_callable'); … … 174 180 public function post_filter($filter, $field = TRUE) 175 181 { 182 if (method_exists($this, $filter)) 183 { 184 // Make the filter a valid callback 185 $filter = array($this, $filter); 186 } 187 176 188 if ( ! is_callable($filter, TRUE)) 177 189 throw new Kohana_Exception('validation.filter_not_callable'); … … 587 599 } 588 600 601 /** 602 * Filter: prep_url. Prepares a URL for valid::url(). 603 * 604 * @param string possibly incomplete URL 605 * @return string 606 */ 607 public function prep_url($str = '') 608 { 609 if ($str === '' OR $str === 'http://' OR $str === 'https://') 610 return ''; 611 612 if (substr($str, 0, 7) !== 'http://' AND substr($str, 0, 8) !== 'https://') 613 return 'http://'.$str; 614 } 615 589 616 } // End Validation
