当前位置: 首页>>代码示例>>PHP>>正文


PHP FileWriter::write方法代码示例

本文整理汇总了PHP中FileWriter::write方法的典型用法代码示例。如果您正苦于以下问题:PHP FileWriter::write方法的具体用法?PHP FileWriter::write怎么用?PHP FileWriter::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileWriter的用法示例。


在下文中一共展示了FileWriter::write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 function create(&$dto)
 {
     if (!$dto->copyImageDir) {
         $dto->copyImageDir = IMAGES_DIR;
     }
     if ($dto->copyImageDir == THEME_IMAGES_DIR . "thumbnail/") {
         $filename = $this->config->getValue("WEBAPP_THEME_DIR");
         $pathList = explode("_", $dto->actionName);
         if (isset($pathList[1])) {
             $filename .= "/" . $pathList[0] . "/images/" . $pathList[1] . "/";
         } else {
             $filename .= "/" . $pathList[0] . "/images/";
         }
     } else {
         if ($dto->copyImageDir == THEME_IMAGES_DIR . "images/") {
             $filename = $this->config->getValue("WEBAPP_THEME_DIR");
             $filename .= "/" . $dto->themeName . "/images/";
         } else {
             if ($dto->templateDir) {
                 $filename = $this->config->getValue("WEBAPP_MODULE_DIR") . "/" . $dto->moduleName . "/files/images/" . $dto->templateDir . "/";
             } else {
                 $filename = $this->config->getValue("WEBAPP_MODULE_DIR") . "/" . $dto->moduleName . "/files/images/";
             }
         }
     }
     return $this->writer->write($filename, $dto->copyImageDir);
 }
开发者ID:RikaFujiwara,项目名称:NetCommons2,代码行数:27,代码来源:Images.class.php

示例2: addReport

 public function addReport(AnalyzerReport $analyzerReport)
 {
     $report = $analyzerReport->getTimestampedReport()->getReport();
     if ($this->task->isHaltonerror() && '' === $this->buildErrorMessage && $analyzerReport->getAnalyzer()->getSeverity() === Severity::ERROR) {
         $this->buildErrorMessage = $report->report();
     }
     if ($this->logfileWriter && $this->logFormat === 'plain') {
         /** @noinspection PhpParamsInspection */
         $this->logfileWriter->write(Plain::formatReportReadable($analyzerReport));
     } else {
         $this->task->log(self::formatReport($analyzerReport), self::severityToPhingLevel($analyzerReport->getAnalyzer()->getSeverity()));
     }
 }
开发者ID:mfn,项目名称:php-analyzer,代码行数:13,代码来源:Phing.php

示例3: output

 /**
  * $templateを読み込んで$outputFileに書き出す
  * 文字エンコーディングには$outputEncodingを使用する
  * $varsはテンプレートから $skeleton としてアクセスできる
  * 
  * 基本的に処理は$writerに委譲し、
  * 結果を配列の形にまとめる
  * 
  * $templateの指定がない場合、getTemplateFileで自動生成
  * $outputEncodingの指定がない場合、SCRIPT_CODEを使用
  * 
  * @param  String    $outputFile
  * @param  array     $vars
  * @param  String    $outputEncoding  [optional]
  * @param  String    $template [optional]
  * @return array
  */
 function output($outputFile, $vars, $outputEncoding = 'SCRIPT_CODE', $template = "")
 {
     if ($template == "") {
         $template = $this->getTemplateFile();
     }
     $stat = '';
     if (file_exists($outputFile)) {
         $stat = 'exists';
     } else {
         $stat = $this->writer->write($template, $outputFile, $vars, $outputEncoding) ? 'create' : 'fail';
     }
     return array($outputFile => $stat);
 }
开发者ID:RikaFujiwara,项目名称:NetCommons2,代码行数:30,代码来源:SingleFile.class.php

示例4: writeLocalConfigurationArray

 protected function writeLocalConfigurationArray()
 {
     $configuration = new ConfigurationUtility($this->localConfiguration);
     $phpCode = $configuration->getLocalConfigurationArray();
     $this->fileWriter->write($phpCode);
     $this->fileWriter->close();
 }
开发者ID:dreadlabs,项目名称:typo3-cms-phing-helper,代码行数:7,代码来源:GenerateLocalConfigurationTask.php

示例5: save

 public static function save(Utility $utility)
 {
     $file = UTILITIES . "/{$utility->name}";
     FileWriter::write($file, $utility->body, Symphony::Configuration()->core()->symphony->{'file-write-mode'});
     //General::writeFile($file, $utility->body,Symphony::Configuration()->core()->symphony->{'file-write-mode'});
     return file_exists($file);
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:7,代码来源:class.utility.php

示例6: testWriter

 public function testWriter()
 {
     $filename = tempnam(sys_get_temp_dir(), 'phpwriter');
     $writer = new FileWriter($filename);
     $writer->write('some text');
     $writer->close();
     $this->assertEquals('some text', file_get_contents($filename));
     // clean up temp file
     unlink($filename);
 }
开发者ID:jrdnull,项目名称:phpwriter,代码行数:10,代码来源:FileWriterTest.php

示例7: connect

 /**
  * Returns routes to connect to the given application.
  *
  * @param Application $app An Application instance
  *
  * @return ControllerCollection A ControllerCollection instance
  */
 public function connect(Application $app)
 {
     $controllers = $app['controllers_factory'];
     $controllers->get('{_locale}', function ($_locale) use($app) {
         $directoryTrans = __DIR__ . '/../../../../../../app/trans/en.json';
         $oldCatalogue = new DataCatalogue();
         $oldCatalogue->load($directoryTrans, 'json', 'en');
         $extractor = new FileExtractor($this->twig);
         $catalogue = $extractor->extract();
         $fileWriter = new FileWriter();
         $fileWriter->write($catalogue, $directoryTrans, 'json');
         return $app['twig']->render('Demo/Default/test.html.twig');
     })->bind('blueLinesHome');
     return $controllers;
 }
开发者ID:selmanouni,项目名称:blue-lines,代码行数:22,代码来源:DefaultControllerProvider.php

示例8: main

 public function main()
 {
     if (NULL === $this->base) {
         throw new BuildException('You must specify the base file!');
     }
     if (NULL === $this->update) {
         throw new BuildException('You must specify the update file!');
     }
     $baseConfiguration = (array) (include $this->base->getAbsolutePath());
     $updateConfiguration = (array) (include $this->update->getAbsolutePath());
     $mergedConfiguration = ArrayUtility::array_merge_recursive_overrule($baseConfiguration, $updateConfiguration, FALSE, $this->includeEmptyValues);
     $configuration = new ConfigurationUtility($mergedConfiguration);
     $phpCode = $configuration->getLocalConfigurationArray();
     if (NULL === $this->fileWriter) {
         $this->addFileWriter();
     }
     $this->fileWriter->write($phpCode);
     $this->fileWriter->close();
 }
开发者ID:dreadlabs,项目名称:typo3-cms-phing-helper,代码行数:19,代码来源:MergeLocalConfigurationTask.php

示例9: transform

 private function transform(DOMDocument $document)
 {
     $dir = new PhingFile($this->toDir);
     if (!$dir->exists()) {
         throw new BuildException("Directory '" . $this->toDir . "' does not exist");
     }
     $xslfile = $this->getStyleSheet();
     $xsl = new DOMDocument();
     $xsl->load($xslfile->getAbsolutePath());
     $proc = new XSLTProcessor();
     $proc->importStyleSheet($xsl);
     if ($this->format == "noframes") {
         $writer = new FileWriter(new PhingFile($this->toDir, "checkstyle-noframes.html"));
         $writer->write($proc->transformToXML($document));
         $writer->close();
     } else {
         ExtendedFileStream::registerStream();
         // no output for the framed report
         // it's all done by extension...
         $dir = new PhingFile($this->toDir);
         $proc->setParameter('', 'output.dir', $dir->getAbsolutePath());
         $proc->transformToXML($document);
     }
 }
开发者ID:hellogerard,项目名称:pox-framework,代码行数:24,代码来源:CheckstyleReportTask.php

示例10: main

 /**
  * Execute lint check against PhingFile or a FileSet
  */
 public function main()
 {
     if (!isset($this->file) and count($this->filesets) == 0) {
         throw new BuildException("Missing either a nested fileset or attribute 'file' set");
     }
     if ($this->file instanceof PhingFile) {
         $this->lint($this->file->getPath());
     } else {
         // process filesets
         $project = $this->getProject();
         foreach ($this->filesets as $fs) {
             $ds = $fs->getDirectoryScanner($project);
             $files = $ds->getIncludedFiles();
             $dir = $fs->getDir($this->project)->getPath();
             foreach ($files as $file) {
                 $this->lint($dir . DIRECTORY_SEPARATOR . $file);
             }
         }
     }
     // write list of 'bad files' to file (if specified)
     if ($this->tofile) {
         $writer = new FileWriter($this->tofile);
         foreach ($this->badFiles as $file => $messages) {
             foreach ($messages as $msg) {
                 $writer->write($file . "=" . $msg . PHP_EOL);
             }
         }
         $writer->close();
     }
     // save list of 'bad files' with errors to property errorproperty (if specified)
     if ($this->errorProperty) {
         $message = '';
         foreach ($this->badFiles as $file => $messages) {
             foreach ($messages as $msg) {
                 $message .= $file . "=" . $msg . PHP_EOL;
             }
         }
         $this->project->setProperty($this->errorProperty, $message);
     }
     if ($this->haltOnFailure && $this->hasErrors) {
         throw new BuildException('Syntax error(s) in PHP files: ' . implode(', ', $this->badFiles));
     }
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:46,代码来源:PhpLintTask.php

示例11: testWriteToNonexistentDirectory

 /**
  * @covers Zepto\FileWriter::write()
  * @expectedException Exception
  */
 public function testWriteToNonexistentDirectory()
 {
     $this->writer->write(ROOT_DIR . 'tests/fail/testfile.txt', 'Test content');
 }
开发者ID:hassankhan,项目名称:sonic,代码行数:8,代码来源:FileWriterTest.php

示例12: main

 /**
  * Execute lint check against PhingFile or a FileSet
  */
 public function main()
 {
     if (!isset($this->file) and count($this->filesets) == 0) {
         throw new BuildException("Missing either a nested fileset or attribute 'file' set");
     }
     exec($this->executable, $output);
     if (!preg_match('/JavaScript\\sLint/', implode('', $output))) {
         throw new BuildException('Javascript Lint not found');
     }
     if ($this->file instanceof PhingFile) {
         $this->lint($this->file->getPath());
     } else {
         // process filesets
         $project = $this->getProject();
         foreach ($this->filesets as $fs) {
             $ds = $fs->getDirectoryScanner($project);
             $files = $ds->getIncludedFiles();
             $dir = $fs->getDir($this->project)->getPath();
             foreach ($files as $file) {
                 $this->lint($dir . DIRECTORY_SEPARATOR . $file);
             }
         }
     }
     // write list of 'bad files' to file (if specified)
     if ($this->tofile) {
         $writer = new FileWriter($this->tofile);
         foreach ($this->badFiles as $file => $messages) {
             foreach ($messages as $msg) {
                 $writer->write($file . "=" . $msg . PHP_EOL);
             }
         }
         $writer->close();
     }
     if ($this->haltOnFailure && $this->hasErrors) {
         throw new BuildException('Syntax error(s) in JS files:' . implode(', ', array_keys($this->badFiles)));
     }
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:40,代码来源:JslLintTask.php

示例13: main

 /**
  * Default constructor.
  * @return     void
  * @throws     BuildException
  */
 public function main()
 {
     $this->log("Propel - CreoleToXMLSchema starting");
     $this->log("Your DB settings are:");
     $this->log("driver : " . ($this->dbDriver ? $this->dbDriver : "(default)"));
     $this->log("URL : " . $this->dbUrl);
     //(not yet supported) $this->log("schema : " . $this->dbSchema);
     //DocumentTypeImpl docType = new DocumentTypeImpl(null, "database", null,
     //	   "http://jakarta.apache.org/turbine/dtd/database.dtd");
     $this->doc = new DOMDocument('1.0', 'utf-8');
     $this->doc->formatOutput = true;
     // pretty printing
     $this->doc->appendChild($this->doc->createComment("Autogenerated by CreoleToXMLSchema!"));
     try {
         $this->generateXML();
         $this->log("Writing XML to file: " . $this->xmlSchema);
         $outFile = new PhingFile($this->xmlSchema);
         $out = new FileWriter($outFile);
         $xmlstr = $this->doc->saveXML();
         $out->write($xmlstr);
         $out->close();
     } catch (Exception $e) {
         $this->log("There was an error building XML from metadata: " . $e->getMessage(), PROJECT_MSG_ERR);
     }
     $this->log("Propel - CreoleToXMLSchema finished");
 }
开发者ID:nmicht,项目名称:tlalokes-in-acst,代码行数:31,代码来源:PropelCreoleTransformTask.php

示例14: _writeFile

 /**
  * Writing a file.
  * 
  * @param  PhingFile $file    The file to write
  * @param  mixed     $content The file's content
  * @return void
  * @throws BuildException
  * @access protected
  **/
 protected function _writeFile(PhingFile $file, $content)
 {
     if ($this->_preserveLastModified) {
         $lastModified = $file->lastModified();
     }
     $output = new FileWriter($file);
     $output->write($content);
     $output->close();
     if ($this->_preserveLastModified) {
         $file->setLastModified($lastModified);
     }
 }
开发者ID:piouPiouM,项目名称:phing-header,代码行数:21,代码来源:HeaderTask.php

示例15: appendFile

 private function appendFile(FileWriter $writer, PhingFile $f)
 {
     $in = FileUtils::getChainedReader(new FileReader($f), $this->filterChains, $this->project);
     while (-1 !== ($buffer = $in->read())) {
         // -1 indicates EOF
         $writer->write($buffer);
     }
     $this->log("Appending contents of " . $f->getPath() . " to " . $this->to->getPath());
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:9,代码来源:AppendTask.php


注:本文中的FileWriter::write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。