/** * Generate CSV file to path from $fileName * * @param String $fileName */ function __construct($fileName, $fileMode) { $this->file = new Gpf_Io_File($fileName); $this->file->setFileMode($fileMode); $this->file->setFilePermissions(0777); $this->delimiter = ","; $this->enclosure = '"'; $this->actualLineNumber = 0; }
private function writeEmpty(Gpf_Io_File $file) { $file->open('w'); $file->setFilePermissions(0777); $file->write('<?PHP /* */ ?>'); $file->close(); }
public function createEmpty() { $file = new Gpf_Io_File($this->getSettingFileName()); $file->setFileMode('w'); $file->setFilePermissions(0777); $file->write(''); $file->close(); }
private function writeSettingToFile(Gpf_Io_File $file) { $file->setFilePermissions(0777); if (defined('ENABLE_ENGINECONFIG_LOG')) { Gpf_Log::info('(writeSettingsValues - before write) file ' . @$file->getFileName() . ' size: ' . @$file->getSize() . ', permissions: ' . @$file->getFilePermissions() . ', owner: ' . @$file->getFileOwner()); } $file->open('w'); $text = '<?php /*' . "\n"; foreach ($this->parameters as $key => $value) { $text .= $key . '=' . $value . "\r\n"; } $text .= '*/ ?>'; $file->write($text); $file->close(); if (defined('ENABLE_ENGINECONFIG_LOG')) { Gpf_Log::info('(writeSettingsValues - after write) file ' . @$file->getFileName() . ' size: ' . @$file->getSize() . ', permissions: ' . @$file->getFilePermissions() . ', owner: ' . @$file->getFileOwner()); } }
private function exportServerCacheFile($dirName) { $file = new Gpf_Io_File($this->getCacheFileName($dirName, true)); $file->setFileMode('w'); if (!$file->isExists()) { $file->setFilePermissions(0777); } $file->write("<?php\n"); $file->write("// DON'T CHANGE THIS FILE !!!\n\n\$_code='" . $this->getCode() . "';\n\$_name='" . $this->getMetaValue(self::LANG_NAME) . "';\n\$_engName='" . $this->getMetaValue(self::LANG_ENG_NAME) . "';\n\$_author='" . $this->getMetaValue(self::LANG_AUTHOR) . "';\n\$_version='" . $this->getMetaValue(self::LANG_VERSION) . "';\n\$_dateFormat='" . $this->getMetaValue(self::LANG_DATE_FORMAT) . "';\n\$_timeFormat='" . $this->getMetaValue(self::LANG_TIME_FORMAT) . "';\n\$_thousandsSeparator='" . $this->getMetaValue(self::LANG_THOUSANDS_SEPARATOR) . "';\n\$_decimalSeparator='" . $this->getMetaValue(self::LANG_DECIMAL_SEPARATOR) . "';\n"); $file->write("\$_dict=array(\n"); foreach ($this->translations as $translation) { if ($translation->getType() == Gpf_Lang_Parser_Translation::TYPE_SERVER || $translation->getType() == Gpf_Lang_Parser_Translation::TYPE_BOTH) { if ($translation->getStatus() != 'D') { $file->write('\'' . addcslashes($translation->getSourceMessage(), "'") . '\'=>\'' . addcslashes($translation->getDestinationMessage(), "'") . "',\n"); } } } $file->write("'_dateFormat'=>'" . $this->getMetaValue(self::LANG_DATE_FORMAT) . "',\n'_timeFormat'=>'" . $this->getMetaValue(self::LANG_TIME_FORMAT) . "',\n'_thousandsSeparator'=>'" . $this->getMetaValue(self::LANG_THOUSANDS_SEPARATOR) . "',\n'_decimalSeparator'=>'" . $this->getMetaValue(self::LANG_DECIMAL_SEPARATOR) . "');\n"); $file->write("?>"); $file->close(); }