Development

Changeset 1360

You must first sign up to be able to contribute.

Changeset 1360

Show
Ignore:
Timestamp:
05/14/06 11:15:22 (3 years ago)
Author:
fabien
Message:

added predefined categories support in sfFileValidator

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/validator/sfFileValidator.class.php

    r943 r1360  
    8484    $this->getParameterHolder()->add($parameters); 
    8585 
     86    // pre-defined categories 
     87    $categories = array( 
     88      '@web_images' => array( 
     89        'image/jpeg', 
     90        'image/pjpeg', 
     91        'image/png', 
     92        'image/x-png', 
     93        'image/gif', 
     94      ), 
     95    ); 
     96 
     97    if (!is_array($this->getParameter('mime_types'))) 
     98    { 
     99      if (isset($categories[$this->getParameter('mime_types')])) 
     100      { 
     101        $this->setParameter('mime_types', $categories[$this->getParameter('mime_types')]); 
     102      } 
     103      else 
     104      { 
     105        $this->setParameter('mime_types', array($this->getParameter('mime_types'))); 
     106      } 
     107    } 
     108 
    86109    return true; 
    87110  }