當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。