Charge un nouveau fichier en mémoire (avec le code langue courant)

@param  type $fileName  Nom du fichier INI à charger (sans les répertoires devant) ex. monfichier.ini
@return boolean         TRUE si succès
@throws \Exception
335781
protected static function loadFileInMemory($fileName)
  {
    if (!preg_match('/\.ini$/i', $fileName)) {
      $fileName .= '.ini';
    }
    $found = 0;
    foreach (self::$storages as $priority => $substorages) {
      foreach ($substorages as $storage) {
        $data = parse_ini_file(sprintf('%s/%s/%s', $storage, self::$languageCode, $fileName));
        if ($data) {
          self::$translations = array_merge(self::$translations, $data);
          $found++;
        }
      }
    }
    return $found != 0;
  }
1340418
protected function open($filename)
    {
        if (!file_exists($filename)) {
            throw new OfficeConverterException('File does not exist --'.$filename);
        }
        $this->file = realpath($filename);

        return true;
    }
213190
static public function touch($filename)
	{
	    $ret = true;
	    if ($filename && !file_exists($filename)) {
	        $ret = static::write($filename, '');
	    }
	    return $ret;
	}
357237
public function fileExists($filename)
    {
        if ($this->mediaDirectory->isFile($filename)) {
            return true;
        } else {
            return $this->coreFileStorageDatabase->saveFileToFilesystem(
                $this->mediaDirectory->getAbsolutePath($filename)
            );
        }
    }
877072
protected function _parseIniFile($filename)
    {
        set_error_handler(array($this, '_loadFileErrorHandler'));
        $iniArray = parse_ini_file($filename, true); // Warnings and errors are suppressed
        restore_error_handler();

        // Check if there was a error while loading file
        if ($this->_loadFileErrorStr !== null) {
            /**
             * @see Zend_Config_Exception
             */
            // require_once 'Zend/Config/Exception.php';
            throw new Zend_Config_Exception($this->_loadFileErrorStr);
        }

        return $iniArray;
    }
471279
public function saveToFile($fileName = "wsdata", $directory = "")
    {
        if ($directory == "")
            $directory = dirname(__FILE__);

        date_default_timezone_set("Europe/Paris");
        $line = sprintf("Paymentmethods %s,%s\r\n", date("H:i:s", time()), $this->exportAsString());

        $filename = sprintf("%s/%s.csv", $directory, $fileName);
        try {
            $fp = @fopen($filename, "w");
            @fwrite($fp, $line);
            @fclose($fp);
        } catch (Exception $e) {
            throw new Exception($e->getMessage());
        };

        return true;
    }
471193
public function addFile( $fileName )
	{
		if( !file_exists( $fileName ) )													// Make sure the file we are adding exists!
			throw new Exception( 'File "'.$fileName.'" is not existing' );
		if( $this->containsFile( $fileName ) )											// Make sure there are no other files in the archive that have this same fileName
			throw new Exception( 'File "'.$fileName.'" already existing in TAR' );

		$fileName	= str_replace( "\\", "/", $fileName );
		$fileName	= str_replace( "./", "", $fileName );
		$fileInfo	= stat( $fileName );												// Get file information
		$file		= new File_Reader( $fileName );

		$this->numFiles++;																// Add file to processed data
		$activeFile					= &$this->files[];
		$activeFile['name']			= $fileName;
		$activeFile['mode']			= $fileInfo['mode'];
		$activeFile['user_id']		= $fileInfo['uid'];
		$activeFile['group_id']		= $fileInfo['gid'];
		$activeFile['size']			= $fileInfo['size'];
		$activeFile['time']			= $fileInfo['mtime'];
#		$activeFile['checksum']		= $checksum;
		$activeFile['user_name']	= '';
		$activeFile['group_name']	= '';
		$activeFile['file']			= $file->readString();								// Read in the file's contents
		return TRUE;
	}
787356
public function load($filename)
    {
        if ($t = $this->tryLoad($filename)) {
            return $t;
        }

        throw new Exception([
            'Unable to read template from file',
            'cwd'  => getcwd(),
            'file' => $filename,
        ]);
    }
1006203
public static function isVcsFile($fileName)
    {
        foreach (self::$vcsPatterns as $pattern) {
            if (strpos($fileName, $pattern) !== false) {
                return true;
            }
        }
        return false;
    }
720691
public function isImageFileExtensionKosher($filename) {

        // must have acceptable file extension
        $imageFileExtension = $this->ImagesHelper->filenameWithExtensionOnly($filename);

        $haystack = Config::get('lasallecmsfrontend.acceptable_image_extensions_for_uploading');

        if (in_array(strtolower($imageFileExtension), $haystack)) {
            return true;
        }

        return false;
    }
768253
public function save( $fileName = false )
	{
		if( !$fileName )
		{
			if( !$this->fileName )
				throw new Exception( "No TGZ file name for saving given." );
			$fileName = $this->fileName;
		}
		$this->generateTar();												// Encode processed files into TAR file format
		$f = new FS_File_Arc_Gzip( $fileName );
		$f->writeString( $this->content);
		return true;
	}
292133
public function loadFile( $fileName )
	{
		if( !file_exists( $fileName ) )
			throw new Exception( 'XML File "'.$fileName.'" is not existing.' );
		$this->document	= new DOMDocument();
		$this->document->load( $fileName );
		$this->xPath	= new DOMXpath( $this->document );
		return true;
	}
467239
public static function detectMimeType($fileName)
    {
        $fileInfo = finfo_open(FILEINFO_MIME_TYPE);
        $mime = finfo_file($fileInfo, $fileName);
        finfo_close($fileInfo);

        return $mime;
    }
1278986
public function setTemplate( $fileName )
	{
		if( empty( $fileName ) )
			return FALSE;
			
		if( !file_exists( $fileName ) )
			throw new Exception_Template( Exception_Template::FILE_NOT_FOUND, $fileName );

		$this->fileName	= $fileName;
		$this->template = file_get_contents( $fileName );
		return TRUE;
	}
767430
protected function checkFileSize($filename) {

        if ( filesize($filename) > $this->config['max_size'] ) {
            $this->errNum = 1;
        }

        //如果是图片还要检查图片的宽度和高度是否超标
        $size = getimagesize($filename);
        if ( $size != false ) {

            $this->fileInfo['is_image'] = 1;
            if ( ($this->config['max_width'] > 0 && $size[0] > $this->config['max_width'])
                || ($this->config['max_height'] > 0 && $size[1] > $this->config['max_height']) )  {
                $this->errNum = 9;
            }
            $this->fileInfo['image_width'] = $size[0];
            $this->fileInfo['image_height'] = $size[1];

        } else {

            $this->fileInfo['is_image'] = 0;

        }

	}
1266586
public function imageCreateJpegfromExif($filename)
    {
        $img = imagecreatefromjpeg($filename);

        if (!function_exists('exif_read_data') || !isset($this->source_info['APP1'])  || strpos($this->source_info['APP1'], 'Exif') !== 0) {
            return $img;
        }

        try {
            $exif = @exif_read_data($filename);
        } catch (Exception $e) {
            $exif = null;
        }

        if (!$exif || !isset($exif['Orientation'])) {
            return $img;
        }

        $orientation = $exif['Orientation'];

        if ($orientation === 6 || $orientation === 5) {
            $img = imagerotate($img, 270, null);
        } elseif ($orientation === 3 || $orientation === 4) {
            $img = imagerotate($img, 180, null);
        } elseif ($orientation === 8 || $orientation === 7) {
            $img = imagerotate($img, 90, null);
        }

        if ($orientation === 5 || $orientation === 4 || $orientation === 7) {
            if(function_exists('imageflip')) {
                imageflip($img, IMG_FLIP_HORIZONTAL);
            } else {
                $this->imageFlip($img, IMG_FLIP_HORIZONTAL);
            }
        }

        return $img;
    }
967222
private function _addFile($filename)
		{
			if (true === $this->_enabled) {
				if (File::exists($filename)) {
					if (is_dir($filename)) {
						return $this->_zip->addEmptyDir($filename);
					} else {
						return $this->_zip->addFile($filename);
					}
				}
			}

			return false;
		}