Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Commit

Permalink
Merge pull request #77 from Jorenm/master
Browse files Browse the repository at this point in the history
Tweak to the doctype issue fix.
  • Loading branch information
bensternthal committed Jan 9, 2015
2 parents 075c374 + 2e0aaa9 commit 085ad7f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions themes/theopenstandard/content-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ function startsWith($haystack, $needle) {

// Parse out consequtive p::content and put them into block grids.
function add_block_grids($content) {

$content = mb_convert_encoding($content, 'utf-8', mb_detect_encoding($content));
$content = mb_convert_encoding($content, 'html-entities', 'utf-8');

$content = qp($content);
$blocks = $content->xpath("//p[starts-with(.,'::')]");

Expand All @@ -20,9 +24,9 @@ function add_block_grids($content) {

$innerHTML = str_replace('::', '', $block->html());

if ($block_group
if ($block_group
&& (
count($prev)
count($prev)
&& startsWith($prev->text(), '::')
)
) {
Expand All @@ -44,8 +48,8 @@ function add_block_grids($content) {
$block->replaceWith($block_grid);
}

return $content->html();
return $content->find('body')->innerHTML();
}

add_filter('the_content', 'add_block_grids');
?>
?>

0 comments on commit 085ad7f

Please sign in to comment.