<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>bbPress Support Forums Tag: kses</title>
<link>http://bbpress.org/forums/</link>
<description>bbPress Support Forums Tag: kses</description>
<language>en</language>
<pubDate>Fri, 09 Jan 2009 03:58:46 +0000</pubDate>

<item>
<title>pashka80 on "WP Integration - Slashes the root of all evil"</title>
<link>http://bbpress.org/forums/topic/wp-integration-slashes-the-root-of-all-evil#post-4918</link>
<pubDate>Mon, 26 Feb 2007 19:35:27 +0000</pubDate>
<dc:creator>pashka80</dc:creator>
<guid isPermaLink="false">4918@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;jmmhm
&#60;/p&#62;</description>
</item>
<item>
<title>baptiste on "WP Integration - Slashes the root of all evil"</title>
<link>http://bbpress.org/forums/topic/wp-integration-slashes-the-root-of-all-evil#post-4000</link>
<pubDate>Sun, 04 Feb 2007 23:20:02 +0000</pubDate>
<dc:creator>baptiste</dc:creator>
<guid isPermaLink="false">4000@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Yes. I figured that's what it was called - I just couldn't find it referenced in the source anywhere. I must have grepped badly. Will try that out.
&#60;/p&#62;</description>
</item>
<item>
<title>thomasklaiber on "WP Integration - Slashes the root of all evil"</title>
<link>http://bbpress.org/forums/topic/wp-integration-slashes-the-root-of-all-evil#post-3998</link>
<pubDate>Sun, 04 Feb 2007 21:57:08 +0000</pubDate>
<dc:creator>thomasklaiber</dc:creator>
<guid isPermaLink="false">3998@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;In bbpress it is called 'bb_init' ... do you mean this?
&#60;/p&#62;</description>
</item>
<item>
<title>baptiste on "WP Integration - Slashes the root of all evil"</title>
<link>http://bbpress.org/forums/topic/wp-integration-slashes-the-root-of-all-evil#post-3997</link>
<pubDate>Sun, 04 Feb 2007 21:38:40 +0000</pubDate>
<dc:creator>baptiste</dc:creator>
<guid isPermaLink="false">3997@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;I brain locked. bb_head is probably too late for this. Is there an equivalent of the 'init' hook for bbPress? In WordPress, that filter hook gets run after the environment initializes. That's when the code I included would need to be run. I can't seem to find an applicable filter hook called that early.
&#60;/p&#62;</description>
</item>
<item>
<title>baptiste on "WP Integration - Slashes the root of all evil"</title>
<link>http://bbpress.org/forums/topic/wp-integration-slashes-the-root-of-all-evil#post-3995</link>
<pubDate>Sun, 04 Feb 2007 17:53:20 +0000</pubDate>
<dc:creator>baptiste</dc:creator>
<guid isPermaLink="false">3995@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Would the solution be to execute a stripslashes_deep on GET, POST, etc if WP_BB is true? Seems kinda dangerous - but bbpress doesn't expect this in a non-integrated environment, so undoing what wp-settings.php does (which gets run when you include wp-config to get the WordPress API) seems harmless enough.&#60;/p&#62;
&#60;p&#62;Maybe something along the lines of:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;function bb_undo_wp_slashes() {&#60;br /&#62;
$_GET = stripslashes_deep($_GET );&#60;br /&#62;
$_POST = stripslashes_deep($_POST );&#60;br /&#62;
$_COOKIE = stripslashes_deep($_COOKIE);&#60;br /&#62;
$_SERVER = stripslashes_deep($_SERVER);&#60;br /&#62;
}&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;and call that as a filter for bb_head?&#60;/p&#62;
&#60;p&#62;&#60;code&#62;if (defined(&#38;#39;WP_BB&#38;#39;) &#38;#38;&#38;amp; WP_BB) add_action(&#38;#39;bb_head&#38;#39;, &#38;#39;bb_undo_wp_slashes&#38;#39;);&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;I think bb_head is called after the environment is setup.&#60;/p&#62;
&#60;p&#62;I may give this a try. Thoughts from developers who know more about bbPress than I?
&#60;/p&#62;</description>
</item>
<item>
<title>baptiste on "WP Integration - Slashes the root of all evil"</title>
<link>http://bbpress.org/forums/topic/wp-integration-slashes-the-root-of-all-evil#post-3994</link>
<pubDate>Sun, 04 Feb 2007 17:41:17 +0000</pubDate>
<dc:creator>baptiste</dc:creator>
<guid isPermaLink="false">3994@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Weird. I have magic quotes off. However, I notice that wp-settings adds slashes to EVERY request in wp-settings:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;// If already slashed, strip.&#60;br /&#62;
if ( get_magic_quotes_gpc() ) {&#60;br /&#62;
        $_GET    = stripslashes_deep($_GET   );&#60;br /&#62;
        $_POST   = stripslashes_deep($_POST  );&#60;br /&#62;
        $_COOKIE = stripslashes_deep($_COOKIE);&#60;br /&#62;
}&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;&#60;code&#62;// Escape with wpdb.&#60;br /&#62;
$_GET    = add_magic_quotes($_GET   );&#60;br /&#62;
$_POST   = add_magic_quotes($_POST  );&#60;br /&#62;
$_COOKIE = add_magic_quotes($_COOKIE);&#60;br /&#62;
$_SERVER = add_magic_quotes($_SERVER);&#60;br /&#62;
&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Is bbpress not expecting this? This might explain the double slashing even if magic quotes is off (I checked my php.ini - it is off)
&#60;/p&#62;</description>
</item>
<item>
<title>baptiste on "WP Integration - Slashes the root of all evil"</title>
<link>http://bbpress.org/forums/topic/wp-integration-slashes-the-root-of-all-evil#post-3993</link>
<pubDate>Sun, 04 Feb 2007 17:34:35 +0000</pubDate>
<dc:creator>baptiste</dc:creator>
<guid isPermaLink="false">3993@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;So I've been digging further into the strange behavior I've had with slashes in posts AND with HTML tag attributes being yanked out.&#60;/p&#62;
&#60;p&#62;It's all related. Apparently, there is some type of problem where slashes get added TWICE when the WP intergation is on. This is why slashes start showing up everywhere and why kses fails.&#60;/p&#62;
&#60;p&#62;I finally discovered that even though the stripslashes filter is called before bb_filter_kses, there are still slashes in front of the quotes of the attributes. So they get tossed.&#60;/p&#62;
&#60;p&#62;So I took out all the stripslashes hacks I had put into the title and post routines and called stripslashes TWICE as a pre_post filter. Voila - attributes are preserved. &#60;/p&#62;
&#60;p&#62;&#60;code&#62;add_filter('pre_post', 'stripslashes', 40);&#60;br /&#62;
add_filter('pre_post', 'stripslashes', 45); // 2nd Time&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;I also added this little section in default-filters.php:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;// Slash problems when integrated with WordPress&#60;br /&#62;
if (defined('WP_BB') &#38;#38;&#38;amp; WP_BB) {&#60;br /&#62;
        add_filter('post_text', 'stripslashes');&#60;br /&#62;
        add_filter('get_topic_title', 'stripslashes');&#60;br /&#62;
        add_filter('get_bb_title', 'stripslashes');&#60;br /&#62;
        add_filter('edit_text', 'stripslashes');&#60;br /&#62;
}&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;And it stripped out the slashes in titles, browser bars, posts, edit screens, etc. (Note there is a missing semi-colon after the sort_tag_heat_map line - you need to add on if you put this at the end)&#60;/p&#62;
&#60;p&#62;This is still a hack. I don't have magic quotes on. I still need to dig and find out why there seems to be alternate behavior when wordpress is integrated or not. Maybe WordPress is turning on magic quotes and bbPress doesn't expect it to be on?&#60;/p&#62;
&#60;p&#62;Still digging.
&#60;/p&#62;</description>
</item>
<item>
<title>baptiste on "bbPress/WordPress Integration - There ARE Problems"</title>
<link>http://bbpress.org/forums/topic/bbpresswordpress-integration-there-are-problems#post-3879</link>
<pubDate>Wed, 31 Jan 2007 13:08:02 +0000</pubDate>
<dc:creator>baptiste</dc:creator>
<guid isPermaLink="false">3879@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;This is bizarre. If bbPress integrated is using the WordPress version of kses, you'd think the same problem with href disappearing would happen in WordPress too, but it doesn't. I'm still digging, but this is really puzzling.&#60;/p&#62;
&#60;p&#62;I have confirmed, however, that ALL attributes are being stripped that should be allowed. href, rel, cite in blockquote, etc.
&#60;/p&#62;</description>
</item>
<item>
<title>baptiste on "bbPress/WordPress Integration - There ARE Problems"</title>
<link>http://bbpress.org/forums/topic/bbpresswordpress-integration-there-are-problems#post-3878</link>
<pubDate>Wed, 31 Jan 2007 12:38:57 +0000</pubDate>
<dc:creator>baptiste</dc:creator>
<guid isPermaLink="false">3878@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;All,&#60;/p&#62;
&#60;p&#62;I've posted a few things on the forums about odd behavior I've seen - href attributes in a tags getting stripped, slashes not getting stripped, etc.&#60;/p&#62;
&#60;p&#62;I've confirmed that these problems are due to the WordPress integration. I am running WordPress 2.1 and bbPress 0.75 and followed the documentation to do the integration.&#60;/p&#62;
&#60;p&#62;When I stop loading wp-config in my bbPress config, the slashes get removed and href attributes stay in posts.&#60;/p&#62;
&#60;p&#62;I'm still digging, but part of this problem is overlap between WordPress and bbPress. The docs talk about a constant WP_BB that tells the code there are possibly conflicting APIs out there. Setting it causes bbPress to use the kses code from WordPress instead. WordPress 2.1 uses kses v0.2.2 while bbPress ships with v0.2.1. My guess is something changed between the two that bbPress doesn't handle.&#60;/p&#62;
&#60;p&#62;As for the slashes in front of apostrophes, it MAY be part of it - I'm not sure yet if kses is used to strip slashes. I didn't think kses got called except during posting, not during viewing. There is another library from WordPress that bbPress uses in integration mode (l10n) for localization - not sure if this is involved in anyway (doubt it)&#60;/p&#62;
&#60;p&#62;So if you're seeing weird behavior - it may very well be intergation. But the good news is it doesn't seem to be overly difficult to fix. Still digging to find the 'right' way (though as a hack for the slash problem, you can include a stripslashes call in template-functions:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;function get_post_text() {&#60;br /&#62;
        global $bb_post;&#60;br /&#62;
        // Hack to strip slashes until Wordpress integration is fixed&#60;br /&#62;
        return stripslashes($bb_post-&#38;gt;post_text);&#60;br /&#62;
}&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Anyway - just an FYI. I'll dig more into the kses href issue and post if I find anything.
&#60;/p&#62;</description>
</item>

</channel>
</rss>
