Example #1
0
 /**
  * @covers \Pressbooks\Sanitize\filter_title
  */
 public function test_filter_title()
 {
     // Acceptable Tags: <br />, <span> with class, <em>, and <strong>.
     $test = '<h1><em>Hello</em><br/><strong>World!</strong></h1>';
     $test = \Pressbooks\Sanitize\filter_title($test);
     $this->assertEquals('<em>Hello</em><br /><strong>World!</strong>', $test);
     $test = '<span class="pb" style="font-weight:bold;"><i><b>Foobar</b></i></span><p /><div>Foobaz</div>';
     $test = \Pressbooks\Sanitize\filter_title($test);
     $this->assertEquals('<span class="pb">Foobar</span>Foobaz', $test);
 }
Example #2
0
 /**
  * Return formatted headers.
  *
  * @param bool $display
  * @param string $content
  *  The post type being added to the page
  *
  * @return string
  */
 function getHeader($display = true, $content = '')
 {
     // bail early
     if (false == $display) {
         return '';
     }
     // override
     $header = apply_filters('mpdf_get_header', $content);
     //sanitize
     $header = \Pressbooks\Sanitize\filter_title($header);
     return $header;
 }