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


PHP HtmlHelper::appendRelativeResourcePaths方法代码示例

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


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

示例1: process

 /**
  * Create a new Mobi document from data provided
  *
  * @throws \Exception
  */
 public function process()
 {
     $result = $this->validate();
     if (count($result) > 0) {
         throw new \Exception("Invalid Phindle setup. Additional configuration options required. " . implode('. ', $result));
     }
     $this->generateUniqueId();
     $this->sortContent();
     //Get the first content item
     $this->setAttribute('start', reset($this->content)->getAnchorPath());
     //If a default instance of TableOfContents provided by this package was used then we need to tell
     //the TableOfContents instance about the contents of the Phindle file. It is not required that you use
     //TableOfContents, as long as you implement the ContentsInterface and so in these cases the generate
     //method may not exist.
     if ($this->toc instanceof TableOfContents) {
         $this->toc->generate($this->content);
     }
     //We will add the table of contents as a "normal" content element as well because it will implement getHtml
     //and so we can write it out as a temporary static file as needed
     $this->addContent($this->toc);
     $this->sortContent();
     $this->setAttribute('toc', $this->toc->getAnchorPath());
     //Now we need to generate and write out the static html files for kindlegen to process
     foreach ($this->content as $content) {
         $html = $content->getHtml();
         //If ingredients are provided then we'll try to automatically set relative static resource paths in html files
         if ($this->htmlHelper && $this->attributeExists('staticResourcePath')) {
             $html = $this->htmlHelper->appendRelativeResourcePaths($html);
         }
         /** @var \Develpr\Phindle\ContentInterface $content */
         $this->fileHandler->writeTempFile($content->getUniqueIdentifier() . '.html', $html);
     }
     $this->fileHandler->writeTempFile($this->getAttribute('uniqueId') . '.opf', $this->opfRenderer->render($this->attributes, $this->content, $this->toc));
     $this->fileHandler->writeTempFile($this->getAttribute('uniqueId') . '.ncx', $this->ncxRenderer->render($this->attributes, $this->content));
     $this->generateMobi();
     //Remove all temporary files
     $this->fileHandler->clean();
     return true;
 }
开发者ID:develpr,项目名称:phindle,代码行数:44,代码来源:Phindle.php


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