Example #1
0
 /**
  * @covers \Pressbooks\Sanitize\decode
  */
 public function test_decode()
 {
     $test = '012345&6789';
     $test = \Pressbooks\Sanitize\decode($test);
     $this->assertEquals('012345&6789', $test);
     $test = '012345&6789';
     $test = \Pressbooks\Sanitize\decode($test);
     $this->assertEquals('012345&6789', $test);
 }
Example #2
0
		<nav epub:type="toc">
			<h1 class="title"><?php 
_e('Table of Contents', 'pressbooks');
?>
</h1>
			<ol epub:type="list">
				<?php 
// Map has a [ Part -> Chapter ] <NavPoint> hierarchy
$part_open = false;
foreach ($manifest as $k => $v) {
    if (true == $part_open && !preg_match('/^chapter-/', $k)) {
        $part_open = false;
        echo '</ol></li>' . "\n";
    }
    if (get_post_meta($v['ID'], 'pb_part_invisible', true) !== 'on') {
        $text = strip_tags(\Pressbooks\Sanitize\decode($v['post_title']));
        if (!$text) {
            $text = ' ';
        }
        if (preg_match('/^part-/', $k)) {
            echo '<li><a href="OEBPS/' . $v['filename'] . '">' . $text . '</a>' . "\n";
        } else {
            echo '<li><a href="OEBPS/' . $v['filename'] . '">' . $text . '</a></li>' . "\n";
        }
        if (preg_match('/^part-/', $k)) {
            $part_open = true;
            echo '<ol>' . "\n";
        }
    }
}
if (true == $part_open) {
Example #3
0
/**
 * Shortcut to \Pressbooks\Sanitize\decode();
 *
 * @param $val
 *
 * @return mixed
 */
function pb_decode($val)
{
    return \Pressbooks\Sanitize\decode($val);
}