• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List

E:/E/GEAMP/www/openbiz/openbiz/others/Zend/Validate/File/NotExists.php

00001 <?php
00025 require_once 'Zend/Validate/File/Exists.php';
00026 
00035 class Zend_Validate_File_NotExists extends Zend_Validate_File_Exists
00036 {
00040     const DOES_EXIST = 'fileNotExistsDoesExist';
00041 
00045     protected $_messageTemplates = array(
00046         self::DOES_EXIST => "The file '%value%' does exist"
00047     );
00048 
00058     public function isValid($value, $file = null)
00059     {
00060         $directories = $this->getDirectory(true);
00061         if (($file !== null) and (!empty($file['destination']))) {
00062             $directories[] = $file['destination'];
00063         } else if (!isset($file['name'])) {
00064             $file['name'] = $value;
00065         }
00066 
00067         foreach ($directories as $directory) {
00068             if (empty($directory)) {
00069                 continue;
00070             }
00071 
00072             $check = true;
00073             if (file_exists($directory . DIRECTORY_SEPARATOR . $file['name'])) {
00074                 return $this->_throw($file, self::DOES_EXIST);
00075             }
00076         }
00077 
00078         if (!isset($check)) {
00079             return $this->_throw($file, self::DOES_EXIST);
00080         }
00081 
00082         return true;
00083     }
00084 }

Generated on Thu Apr 19 2012 17:01:18 for openbiz by  doxygen 1.7.2