/** * Class constructor * * @param string $filename the name of the odt file * @throws OdfException */ public function __construct($file, $config = array()) { if (is_resource($file)) { $tmp_filename = tempnam(sys_get_temp_dir(), 'ODT_'); file_put_contents($tmp_filename, $file); parent::__construct($tmp_filename, $config); } else { $tmp_filename = $file; parent::__construct($file, $config); } $zipHandler = $this->config['ZIP_PROXY']; $this->file = new $zipHandler($this->tmpdir); if ($this->file->open($tmp_filename) !== true) { // This also create the tmpdir directory throw new OdfException("Error while Opening the file '{$filename}' - Check your odt filename"); } if (($this->stylesXml = $this->file->getFromName('styles.xml')) === false) { throw new OdfException("Nothing to parse - Check that the styles.xml file is correctly formed in source file '{$tmp_filename}'"); } $this->file->close(); }
public function __construct($filename, $config = array()) { $this->_filename = \GO\Base\Fs\File::utf8Basename($filename); return parent::__construct($filename, $config); }