<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>hyperlink &#8211; Blackbams Blog</title>
	<atom:link href="https://blog.blackbam.at/tag/hyperlink/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.blackbam.at</link>
	<description>development - digital arts - internet</description>
	<lastBuildDate>Wed, 05 Oct 2011 17:23:04 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>
	<item>
		<title>Using HTML line breaks and link sanitizer in WordPress comments</title>
		<link>https://blog.blackbam.at/2011/09/30/using-html-line-breaks-and-link-sanitizer-in-wordpress-comments/</link>
					<comments>https://blog.blackbam.at/2011/09/30/using-html-line-breaks-and-link-sanitizer-in-wordpress-comments/#respond</comments>
		
		<dc:creator><![CDATA[Blackbam]]></dc:creator>
		<pubDate>Fri, 30 Sep 2011 12:43:20 +0000</pubDate>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP Scripts]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[hyperlink]]></category>
		<category><![CDATA[line break]]></category>
		<category><![CDATA[sanitizer]]></category>
		<guid isPermaLink="false">https://blog.blackbam.at/?p=1686</guid>

					<description><![CDATA[Recently we had an issue with the line-breaks in WordPress comments &#8211; the comments are saved to the database as they are submitted from the textarea in your theme, and depending on the theme so they are displayed. If your comments are displayed as HTML and there is no mechanism to add line breaks anywhere, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Recently we had an issue with the line-breaks in WordPress comments &#8211; the comments are saved to the database as they are submitted from the textarea in your theme, and depending on the theme so they are displayed. If your comments are displayed as HTML and there is no mechanism to add line breaks anywhere, then the comments do not have any line-breaks (as HTML line breaks must be created with a br-tag or something similar).</p>
<p>&nbsp;</p>
<p>Another anoying thing is when commenters do not make links to hyperlinks, as these are not linked and clickable afterwards. We have found a solution for these problem &#8211; just copy the following script to your functions.php-file and your comments will be sanitized:</p>
<p>&nbsp;</p>
<pre lang="php">
add_filter('preprocess_comment','format_the_comment_html');
 
function format_the_comment_html($comment_data) {
	$comment_data['comment_content']=nl2br(makeClickableLinks($comment_data['comment_content']));
	return $comment_data;
}
 
function makeClickableLinks($text) {
	$text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)','<a href="\\1">\\1</a>', $text);
	$text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)','\\1<a href="http://\\2">\\2</a>', $text);
	$text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})','<a href="mailto:\\1">\\1</a>', $text);
	return $text;
}
</pre>
<p><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fblog.blackbam.at%2F2011%2F09%2F30%2Fusing-html-line-breaks-and-link-sanitizer-in-wordpress-comments%2F&#038;title=Using%20HTML%20line%20breaks%20and%20link%20sanitizer%20in%20WordPress%20comments" data-a2a-url="https://blog.blackbam.at/2011/09/30/using-html-line-breaks-and-link-sanitizer-in-wordpress-comments/" data-a2a-title="Using HTML line breaks and link sanitizer in WordPress comments"><img src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://blog.blackbam.at/2011/09/30/using-html-line-breaks-and-link-sanitizer-in-wordpress-comments/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
