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


PHP Book::tagSubsections方法代码示例

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


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

示例1: createBackMatter

 /**
  * @param array $book_contents
  * @param array $metadata
  */
 protected function createBackMatter($book_contents, $metadata)
 {
     $back_matter_printf = '<div class="back-matter %s" id="%s">';
     $back_matter_printf .= '<div class="back-matter-title-wrap"><h3 class="back-matter-number">%s</h3><h1 class="back-matter-title">%s</h1></div>';
     $back_matter_printf .= '<div class="ugc back-matter-ugc">%s</div>%s';
     $back_matter_printf .= '</div>';
     $vars = array('post_title' => '', 'stylesheet' => $this->stylesheet, 'post_content' => '', 'isbn' => @$metadata['pb_ebook_isbn']);
     $i = 1;
     foreach ($book_contents['back-matter'] as $back_matter) {
         if (!$back_matter['export']) {
             continue;
         }
         // Skip
         $id = $back_matter['ID'];
         $subclass = \PressBooks\Taxonomy\back_matter_type($id);
         $slug = $back_matter['post_name'];
         $title = get_post_meta($id, 'pb_show_title', true) ? $back_matter['post_title'] : '';
         $content = $this->kneadHtml($back_matter['post_content'], 'back-matter', $i);
         $short_title = trim(get_post_meta($id, 'pb_short_title', true));
         $subtitle = trim(get_post_meta($id, 'pb_subtitle', true));
         $author = trim(get_post_meta($id, 'pb_section_author', true));
         if (\PressBooks\Export\Export::shouldParseSections() == true) {
             $sections = \PressBooks\Book::getSubsections($id);
             if ($sections) {
                 $content = \PressBooks\Book::tagSubsections($content, $id);
             }
         }
         if ($author) {
             $content = '<h2 class="chapter-author">' . Sanitize\decode($author) . '</h2>' . $content;
         }
         if ($subtitle) {
             $content = '<h2 class="chapter-subtitle">' . Sanitize\decode($subtitle) . '</h2>' . $content;
         }
         if ($short_title) {
             $content = '<h6 class="short-title">' . Sanitize\decode($short_title) . '</h6>' . $content;
         }
         $vars['post_title'] = $back_matter['post_title'];
         $vars['post_content'] = sprintf($back_matter_printf, $subclass, $slug, $i, Sanitize\decode($title), $content, '');
         $file_id = 'back-matter-' . sprintf("%03s", $i);
         $filename = "{$file_id}-{$slug}.{$this->filext}";
         file_put_contents($this->tmpDir . "/OEBPS/{$filename}", $this->loadTemplate($this->dir . '/templates/xhtml.php', $vars));
         $this->manifest[$file_id] = array('ID' => $back_matter['ID'], 'post_title' => $back_matter['post_title'], 'filename' => $filename);
         ++$i;
     }
 }
开发者ID:samsruti,项目名称:pressbooks,代码行数:49,代码来源:class-pb-epub201.php

示例2: echoBackMatter

 /**
  * @param array $book_contents
  * @param array $metadata
  */
 protected function echoBackMatter($book_contents, $metadata)
 {
     $back_matter_printf = '<div class="back-matter %s" id="%s">';
     $back_matter_printf .= '<div class="back-matter-title-wrap"><h3 class="back-matter-number">%s</h3><h1 class="back-matter-title">%s</h1></div>';
     $back_matter_printf .= '<div class="ugc back-matter-ugc">%s</div>%s';
     $back_matter_printf .= '</div>';
     $i = $s = 1;
     foreach ($book_contents['back-matter'] as $back_matter) {
         if (!$back_matter['export']) {
             continue;
         }
         $id = $back_matter['ID'];
         $subclass = \PressBooks\Taxonomy\back_matter_type($id);
         $slug = $back_matter['post_name'];
         $title = get_post_meta($id, 'pb_show_title', true) ? $back_matter['post_title'] : '<span class="display-none">' . $back_matter['post_title'] . '</span>';
         // Preserve auto-indexing in Prince using hidden span
         $content = $back_matter['post_content'];
         $short_title = trim(get_post_meta($id, 'pb_short_title', true));
         $subtitle = trim(get_post_meta($id, 'pb_subtitle', true));
         $author = trim(get_post_meta($id, 'pb_section_author', true));
         $sections = \PressBooks\Book::getSubsections($id);
         if ($sections) {
             $content = \PressBooks\Book::tagSubsections($content);
         }
         if ($author) {
             $content = '<h2 class="chapter-author">' . Sanitize\decode($author) . '</h2>' . $content;
         }
         if ($subtitle) {
             $content = '<h2 class="chapter-subtitle">' . Sanitize\decode($subtitle) . '</h2>' . $content;
         }
         if ($short_title) {
             $content = '<h6 class="short-title">' . Sanitize\decode($short_title) . '</h6>' . $content;
         }
         printf($back_matter_printf, $subclass, $slug, $i, Sanitize\decode($title), $content, $this->doEndnotes($id));
         echo "\n";
         ++$i;
     }
 }
开发者ID:jflowers45,项目名称:pressbooks,代码行数:42,代码来源:class-pb-xhtml11.php

示例3: pb_tag_sections

/**
 * Tag the subsections
 *
 * @param $content string
 *
 * @return string
 */
function pb_tag_sections($content, $id)
{
    return \PressBooks\Book::tagSubsections($content, $id);
}
开发者ID:stackpoet,项目名称:pressbooks,代码行数:11,代码来源:functions.php


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