Ejemplo n.º 1
0
 public function __construct($filename, $context)
 {
     // Call parent
     parent::__construct($filename);
     // Pass image context
     $this->setContext($context);
 }
Ejemplo n.º 2
0
 public function __construct($filename)
 {
     try {
         parent::__construct($filename);
     } catch (\RuntimeException $e) {
         throw new FileNotFoundException($filename);
     }
 }
Ejemplo n.º 3
0
 public function __construct($filename, $mode = 'r', $use_include_path = false, $context = null)
 {
     parent::__construct($filename);
     $this->setFlags(SplFileObject::READ_CSV);
     $this->setCsvControl($this->_delimiter, $this->_enclosure);
     $this->rewind();
     $this->_map = parent::current();
 }
Ejemplo n.º 4
0
 /**
  * ( excerpt from http://php.net/manual/en/spltempfileobject.construct.php
  * )
  *
  * Construct a new temporary file object.
  *
  * @maxMemory  mixed   The maximum amount of memory (in bytes, default is 2
  *                     MB) for the temporary file to use. If the temporary
  *                     file exceeds this size, it will be moved to a file
  *                     in the system's temp directory.
  *
  *                     If max_memory is negative, only memory will be
  *                     used. If max_memory is zero, no memory will be used.
  *
  * @return     mixed   No value is returned.
  */
 public function __construct($maxMemory = null)
 {
     if ($maxMemory === null) {
         parent::__construct('php://temp', 'r+');
     } else {
         parent::__construct("php://temp/maxmemory:{$maxMemory}", 'r+');
     }
 }
Ejemplo n.º 5
0
 /**
  * @param string $filename
  * @param int $columnTitlesIndex
  * @param string $open_mode
  * @param bool $use_include_path
  * @param null $context
  */
 public function __construct($filename, $columnTitlesIndex = -1, $open_mode = 'r', $use_include_path = false, $context = null)
 {
     $this->columnTitlesIndex = $columnTitlesIndex;
     if (is_null($context)) {
         parent::__construct($filename, $open_mode, $use_include_path);
     } else {
         parent::__construct($filename, $open_mode, $use_include_path, $context);
     }
 }
Ejemplo n.º 6
0
 /**
  * @constructor
  *
  * @param {?string} $defaultContentType Default mimetype of the uploading file,
  *                                      when finfo failed in guessing one.
  */
 function __construct($defaultContentType = 'application/octet-stream')
 {
     if ($defaultContentType) {
         $this->defaultContentType = $defaultContentType;
     }
     $file = tempnam(sys_get_temp_dir(), 'tmp.');
     stream_copy_to_stream(fopen('php://input', 'r'), fopen($file, 'r'));
     parent::__construct($file);
 }
Ejemplo n.º 7
0
 public function __construct($filename, $openMode = 'r', $useIncludePath = 'false', $context = null)
 {
     if (isset($context)) {
         parent::__construct($filename, $openMode, $useIncludePath, $context);
     } else {
         parent::__construct($filename, $openMode, $useIncludePath);
     }
     $this->setFileClass('Stalxed\\FileSystem\\FileObject');
     $this->setInfoClass('Stalxed\\FileSystem\\FileInfo');
 }
Ejemplo n.º 8
0
 /**
  * CsvFileReader constructor.
  *
  * @param string|File $filePath CSVファイルのFileインスタンスかファイルパス
  */
 public function __construct($filePath)
 {
     if (is_a($filePath, 'File')) {
         $filePath = $filePath->path;
     }
     $tmp = NetCommonsFile::getTemporaryFileConvertSjisWin2Utf8($filePath);
     $path = $tmp->path;
     parent::__construct($path);
     $this->setFlags(SplFileObject::READ_CSV);
 }
Ejemplo n.º 9
0
 /**
  * Creates an extended SplFileObject from the given filename, which
  * prevents against null byte injections and unprintable characters.
  *
  * @param string $path the path to the file (path && file name)
  *
  * @return does not return a value.
  */
 function __construct($path)
 {
     try {
         @parent::__construct($path);
     } catch (Exception $e) {
         throw new EnterpriseSecurityException('Failed to open stream', 'Failed to open stream ' . $e->getMessage());
     }
     $this->_doDirCheck($path);
     $this->_doFileCheck($path);
     $this->_doExtraCheck($path);
 }
Ejemplo n.º 10
0
 /**
  * @constructor
  *
  * @param {array|string} Either path to target file, or an array in $_FILES format.
  */
 function __construct($file, $open_mode = 'r', $use_include_path = false, $resource = null)
 {
     if (is_array($file)) {
         // POST filename
         if (trim(@$file['name'])) {
             $this->filename = $file['name'];
         }
         $filename = $file['tmp_name'];
     } else {
         $filename = (string) $file;
     }
     parent::__construct($filename, $open_mode, $use_include_path, $resource);
 }
 public function __construct($path, $mime_type = null, $width = null, $height = null)
 {
     if (!is_file($path)) {
         throw new \Exception('File not found : ' . $path);
     }
     parent::__construct($path);
     $this->findMimeType($path);
     $this->mimeType = $mime_type ?: $this->findMimeType($path);
     if (in_array($this->mimeType, $this->resizableMimeType)) {
         $this->width = $width;
         $this->height = $height;
     }
 }
Ejemplo n.º 12
0
 /**
  * Konstruktor
  * @param string $path Pfad zu der Datei
  * @param int $line_start_position
  * @param null $line_end_position
  * @throws FileException
  */
 public function __construct($path, $line_start_position = 0, $line_end_position = null)
 {
     if (!is_string($path)) {
         throw new \InvalidArgumentException('File: $path not a string');
     }
     $this->path = $path;
     try {
         parent::__construct($path);
     } catch (Exception $e) {
         throw new FileNotReadableException($message = 'File can not read', $code = 100, $previous = $e);
     }
     $this->line_start_position = $line_start_position;
     $this->line_end_position = $line_end_position;
 }
Ejemplo n.º 13
0
Archivo: Filter.php Proyecto: Vci/Libs
 /**
  * See the documentation for SplFileObject
  *
  * @return this
  **/
 public function __construct($filename, $openMode, $useIncludePath, $context)
 {
     // construct per the parent constructor
     if (empty($context)) {
         // stinking annoying PHP gotchas
         parent::__construct($filename, $openMode, $useIncludePath);
     } else {
         parent::__construct($filename, $openMode, $useIncludePath, $context);
     }
     // set default CSV options
     $this->setFlags(SplFileObject::READ_CSV);
     // return
     return $this;
 }
Ejemplo n.º 14
0
	/**
	 * Construct a new file object and set defaults.
	 *
	 * @param string $file
	 * @param string $mode
	 * @param bool $include
	 * @param stream $context
	 * @return Interspire_File
	 */
	public function __construct($file, $mode = 'r', $include = false, $context = null)
	{
		if ($context) {
			parent::__construct($file, $mode, $include, $context);
		}
		else {
			parent::__construct($file, $mode, $include);
		}

		if (method_exists('SplFileObject', 'getRealPath')) {
			// getRealPath is PHP >= 5.2.2
			$this->realpath = parent::getRealPath();
		} else {
			$this->realpath = realpath($file);
		}
	}
Ejemplo n.º 15
0
 public function __construct($filename = null, $open_mode = "a")
 {
     $filename = $filename ?: APP_PATH . "/log" . DS . \Yaf\ENVIRON . ".log";
     parent::__construct($filename, $open_mode);
 }
Ejemplo n.º 16
0
 public function __construct($fileName)
 {
     parent::__construct($fileName);
     $this->setFlags(self::DROP_NEW_LINE + self::READ_AHEAD + self::SKIP_EMPTY + self::READ_CSV);
 }
Ejemplo n.º 17
0
 /**
  * @param string|null $filename Leave empty to generate a tmp name
  */
 public function __construct($filename = null)
 {
     $this->fileName = $filename ?: tempnam(sys_get_temp_dir(), 'feeder');
     parent::__construct($this->fileName, 'a+');
 }
 function __construct($name)
 {
     echo __METHOD__ . "(" . str_replace(str_replace('\\', '/', dirname(__FILE__)), '*', $name) . ")\n";
     parent::__construct($name);
 }
Ejemplo n.º 19
0
 public function __construct($filename, $mode = 'r', $use_include_path = false, $context = null)
 {
     parent::__construct($filename);
     $this->rewind();
 }
Ejemplo n.º 20
0
 /**
  *
  * Constructor, duh, calls the parent constructor
  *
  * @access       public
  * @param    string  The full path to the file to be converted
  *
  */
 public function __construct($filename)
 {
     //echo "in __construct";
     parent::__construct($filename);
 }
Ejemplo n.º 21
0
 /**
  * @param mixed $fileName
  * @param string $openMode
  * @param boolean $useIncludePath
  * @param resource $context
  * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
  */
 public function __construct($fileName, $openMode = 'a+', $useIncludePath = false, $context = null)
 {
     parent::__construct($fileName, $openMode, $useIncludePath, $context);
 }
Ejemplo n.º 22
0
 public function __construct($filename)
 {
     $this->_filename = realpath($filename);
     parent::__construct($filename);
 }
Ejemplo n.º 23
0
 /**
  * @param string $pathToFile
  * @param string $delimiter
  * @param string $fieldEnclosure
  * @param string $escapeChar
  */
 public function __construct($pathToFile, $delimiter = ",", $fieldEnclosure = '"', $escapeChar = '\\')
 {
     parent::__construct($pathToFile, 'r');
     $this->setFlags(\SplFileObject::READ_CSV);
     $this->setCsvControl($delimiter, $fieldEnclosure, $escapeChar);
 }
Ejemplo n.º 24
0
 public function deleteChoices()
 {
     parent::__construct($this->getPathname(), 'w+');
     parent::__construct($this->getPathname(), 'c+');
 }
Ejemplo n.º 25
0
 /**
  * Constructor
  *
  * @param   string $path - path to directory
  * @return  none
  */
 public function __construct($path)
 {
     parent::__construct($path);
     $this->_path = $path;
     $this->_filename = basename($path);
 }
Ejemplo n.º 26
0
 function __construct($what)
 {
     echo __METHOD__ . "({$what})\n";
     parent::__construct($what);
 }
Ejemplo n.º 27
0
 public function __construct($filename)
 {
     parent::__construct($filename);
     $this->setInfoClass(SourceFileInfo::class);
 }
Ejemplo n.º 28
0
 public function __construct($filename = null, $open_mode = "a")
 {
     $filename = $filename ?: APP_PATH . "/log" . DS . date('Y-m-d') . ".log";
     parent::__construct($filename, $open_mode);
 }