\s*
|', "\n\n", $pee);
// Space things out a little
// *insertion* of section|article|aside|header|footer|hgroup|figure|details|figcaption|summary
$allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr|fieldset|legend|section|article|aside|header|footer|hgroup|figure|details|figcaption|summary)';
$pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee);
$pee = preg_replace('!(' . $allblocks . '>)!', "$1\n\n", $pee);
$pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
if ( strpos($pee, '
', '', $pee);
$pee = preg_replace('!\s*(?' . $allblocks . '[^>]*>)!', "$1", $pee);
$pee = preg_replace('!(?' . $allblocks . '[^>]*>)\s*
!', "$1", $pee);
if ($br) {
$pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', create_function('$matches', 'return str_replace("\n", "", $matches[0]);'), $pee);
$pee = preg_replace('|(?)\s*\n|', "
\n", $pee); // optionally make line breaks
$pee = str_replace('', "\n", $pee);
}
$pee = preg_replace('!(?' . $allblocks . '[^>]*>)\s*
!', "$1", $pee);
// *insertion* of img|figcaption|summary
$pee = preg_replace('!
(\s*?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol|img|figcaption|summary)[^>]*>)!', '$1', $pee);
if (strpos($pee, ']*>)(.*?)
!is', 'clean_pre', $pee );
$pee = preg_replace( "|\n$|", '', $pee );
return $pee;
}
// remove the original wpautop function
remove_filter('the_excerpt', 'wpautop');
remove_filter('the_content', 'wpautop');
// add our new html5autop function
add_filter('the_excerpt', 'html5wpautop');
add_filter('the_content', 'html5wpautop');
// widget function
if ( function_exists('register_sidebars') )
register_sidebars(0);
function fb_widget_register() {
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'name' => 'Sidebar',
'before_widget' => "\n\t\t" . '',
'after_widget' => '',
'before_title' => "\n\t" . '',
));
}
}
add_action('widgets_init', 'fb_widget_register', 1);
/**
* no pings from your own site
* also as plugin: http://wordpress.org/extend/plugins/no-self-ping/
*/
if ( !function_exists('fb_noself_ping') ) {
function fb_noself_ping(&$links) {
$home = get_option('home');
foreach($links as $l => $link)
if ( 0 === strpos($link, $home) )
unset($links[$l]);
}
add_action( 'pre_ping', 'fb_noself_ping' );
}
/**
* comments for > WP 2.7
*/
if ( !function_exists('fb_theme_comment') ) {
function fb_theme_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
id="comment-">
ID;
if ( !$post_id )
return;
if ( !isset($cjd_comment_count_cache[$post_id]) ) {
$p = get_post($post_id);
$p = array($p);
fb_update_comment_type_cache($p);
}
;
if ( $type == 'pingback' || $type == 'trackback' || $type == 'comment' )
$count = $cjd_comment_count_cache[$post_id][$type];
elseif ( $type == 'pings' )
$count = $cjd_comment_count_cache[$post_id]['pingback'] + $cjd_comment_count_cache[$post_id]['trackback'];
else
$count = array_sum((array) $cjd_comment_count_cache[$post_id]);
return apply_filters('fb_get_comment_type_count', $count);
}
// comment, trackback, pingback, pings, all
function fb_comment_type_count( $type='all', $zero = false, $one = false, $more = false, $post_id = 0 ) {
$number = fb_get_comment_type_count( $type, $zero, $one, $more, $post_id );
if ($type == 'all') {
$type_string_single = __('Kommentar', FB_BASIS_TEXTDOMAIN);
$type_string_plural = __('Kommentare', FB_BASIS_TEXTDOMAIN);
} elseif ($type == 'pings') {
$type_string_single = __('Ping und Trackback', FB_BASIS_TEXTDOMAIN);
$type_string_plural = __('Pings und Trackbacks', FB_BASIS_TEXTDOMAIN);
} elseif ($type == 'pingback') {
$type_string_single = __('Pingback', FB_BASIS_TEXTDOMAIN);
$type_string_plural = __('Pingbacks', FB_BASIS_TEXTDOMAIN);
} elseif ($type == 'trackback') {
$type_string_single = __('Trackback', FB_BASIS_TEXTDOMAIN);
$type_string_plural = __('Trackbacks', FB_BASIS_TEXTDOMAIN);
} elseif ($type == 'comment') {
$type_string_single = __('Kommentar', FB_BASIS_TEXTDOMAIN);
$type_string_plural = __('Kommentare', FB_BASIS_TEXTDOMAIN);
}
if ( $number > 1 )
$output = str_replace('%', number_format_i18n($number), ( false === $more ) ? __('%', FB_BASIS_TEXTDOMAIN) . ' ' . $type_string_plural : $more);
elseif ( $number == 0 )
$output = ( false === $zero ) ? __('Keine', FB_BASIS_TEXTDOMAIN) . ' ' . $type_string_plural : $zero;
else // must be one
$output = ( false === $one ) ? __('Ein', FB_BASIS_TEXTDOMAIN) . ' ' . $type_string_single : $one;
echo apply_filters('fb_comment_type_count', $output, $number);
}
}
if ( !function_exists('fb_update_comment_type_cache') ) {
function fb_update_comment_type_cache($queried_posts) {
global $cjd_comment_count_cache, $wpdb;
if ( !$queried_posts )
return $queried_posts;
foreach ( (array) $queried_posts as $post )
if ( !isset($cjd_comment_count_cache[$post->ID]) )
$post_id_list[] = $post->ID;
if ( $post_id_list ) {
$post_id_list = implode(',', $post_id_list);
foreach ( array('', 'pingback', 'trackback') as $type ) {
$counts = $wpdb->get_results("SELECT ID, COUNT( comment_ID ) AS ccount
FROM $wpdb->posts
LEFT JOIN $wpdb->comments ON ( comment_post_ID = ID AND comment_approved = '1' AND comment_type='$type' )
WHERE (post_status = 'publish' OR (post_status = 'inherit' AND post_type = 'attachment')) AND ID IN ($post_id_list)
GROUP BY ID");
if ( $counts ) {
if ( '' == $type )
$type = 'comment';
foreach ( $counts as $count )
$cjd_comment_count_cache[$count->ID][$type] = $count->ccount;
}
}
}
return $queried_posts;
}
add_filter('the_posts', 'fb_update_comment_type_cache');
}
/**
* void fb_comment_paging_noindex_meta()
* add meta noindex rules on singular comment page section
*
* @author Avice D
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
* @link http://blog.kaizeku.com/wordpress/prevent-wordpress-27-duplicate-content/
*
* @todo Check for duplicate meta-robots tag generated by
* meta-tag type plugins (SEO plugins)
*
* @uses $wp_query Wp_query object
* @return string Output HTML meta noindex
*/
if ( !function_exists('fb_comment_paging_noindex_meta') ) {
function fb_comment_paging_noindex_meta() {
global $wp_query;
if ( version_compare( (float) get_bloginfo('version'), 2.7, '>=') ) {
if ( $wp_query->is_singular && get_option('page_comments') ) { // comments pagination enabled
if ( isset($wp_query->query['cpage'] ) && absint( $wp_query->query['cpage']) >= 1 ) {
echo '' . PHP_EOL;
}
}
}
}
add_action('wp_head','fb_comment_paging_noindex_meta');
}
?>