Example #1
0
    }
}
if (isset($image_url) && strlen($image_url) > 4) {
    if ($options['indexseitenbild-size'] == 1) {
        echo '<div class="content-header-big">';
    } else {
        echo '<div class="content-header">';
    }
    ?>
    		    		    		        
		   <h1 class="post-title"><span><?php 
    printf(__('%s', 'piratenkleider'), get_the_author());
    ?>
</span></h1>
		   <div class="symbolbild"><img src="<?php 
    echo piratenkleider_make_link_relative($image_url);
    ?>
" alt="">	
		    <?php 
    if (isset($attribs["credits"]) && strlen($attribs["credits"]) > 1) {
        echo '<div class="caption">' . $attribs["credits"] . '</div>';
    }
    ?>
		       
		   </div>
		</div>  	
	    <?php 
}
?>
	
      <div class="skin" itemprop="mainContentOfPage">
Example #2
0
function piratenkleider_make_nice_links($content)
{
    // Abort if content is empty or mb_convert_encoding function is not available
    if (empty($content) || !function_exists('mb_convert_encoding')) {
        return $content;
    }
    // Suppress errors while parsing HTML content
    libxml_use_internal_errors(true);
    // Parse HTML content and look for A and IMG tags
    $dom = new DOMDocument();
    $dom->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', get_bloginfo('charset')));
    foreach ($dom->getElementsByTagName('a') as $node) {
        $url = trim($node->getAttribute('href'));
        $url_scheme = parse_url($url, PHP_URL_SCHEME);
        if ($url_scheme == 'http' || $url_scheme == 'https') {
            $node->setAttribute('href', piratenkleider_make_link_relative($url));
            if (!$node->hasAttribute('class') && !piratenkleider_is_internal_link($url)) {
                $node->setAttribute('class', 'extern');
            }
        }
    }
    foreach ($dom->getElementsByTagName('img') as $node) {
        $url = trim($node->getAttribute('src'));
        $node->setAttribute('src', piratenkleider_make_link_relative($url));
    }
    // Before returning new content we need to get rid of unneeded tags which were inserted automatically
    $new_content = $dom->saveHTML();
    $new_content = preg_replace('~<(?:!DOCTYPE|/?(?:html|body))[^>]*>\\s*~i', '', $new_content);
    return $new_content;
}