Exemplo n.º 1
0
 /**
  * Validate Tag Search Options
  *
  * @param array $options
  */
 protected function _validateTagSearch($options)
 {
     $valid_options = array('api_key', 'method', 'user_id', 'per_page', 'page', 'extras', 'min_upload_date', 'min_taken_date', 'max_upload_date', 'max_taken_date', 'tag_mode', 'tags');
     if (!is_array($options)) {
         return;
     }
     $this->_compareOptions($options, $valid_options);
     $filter = new Zend_InputFilter($options, false);
     if (!$filter->isBetween('per_page', 1, 500, true)) {
         throw new Zend_Service_Exception($options['per_page'] . ' is not valid for the "per_page" option');
     }
     if (!$filter->isInt('page')) {
         throw new Zend_Service_Exception($options['page'] . ' is not valid for the "page" option');
     }
     // validate extras, which are delivered in csv format
     if ($options['extras']) {
         $extras = explode(',', $options['extras']);
         $valid_extras = array('license', 'date_upload', 'date_taken', 'owner_name', 'icon_server');
         foreach ($extras as $extra) {
             /**
              * @todo The following does not do anything [yet], so it is commented out.
              */
             //in_array(trim($extra), $valid_extras);
         }
     }
 }