zygmoont
Forum Replies Created
-
Forum: Requests and Feedback
In reply to: Media uploader – why force HTTP?Thank you, the Relative Image URLs plugin should do it. Or maybe I will just stay with converting
src="http://tosrc="https://onif is_ssl()on the post output. Anyway, I am surprised that so few people have problem with https mixed content, based on the number of threads on the internet and the popularity of this kind of plugins, which is minimal.Forum: Hacks
In reply to: Comment post – different Firefox and Chrome resultsAnd, if anyone is interested, here is the working solution to paste into
functions.php:function allowAdditionalTags() { global $allowedposttags, $allowedtags; $allowedtags["a"]["target"] = true; $allowedposttags["a"]["target"] = true; $allowedtags["p"][""] = true; $allowedposttags["p"][""] = true; } add_action('init', 'allowAdditionalTags');Working solution thanks to http://cynng.wordpress.com/2013/05/28/adding-html-attribute-exceptions-to-wordpress-kses/
Forum: Hacks
In reply to: Comment post – different Firefox and Chrome resultsI knew that the problem will eventually become a very silly one – it was too weird to be true.
Browser had nothing to do with it – I even changed the Firefox user agent to be Chrome user-agent but still commenting from Firefox was wrong. It turned out that the reason it worked in Chrome was because I was logged in as admin in Chrome… I am heavily modifying my wordpress to work with my own framework (living next to wordpress), and that includes sharing same users. So some time ago I played around setting fake user cookies in wordpress and didn’t even know I was still logged in as admin. That’s the reason why Chrome comments weren’t filtered.
Thank you znuffn for telling me the files where to look for. Thanks to your tips I finally got to kses.php which was filtering some of my html code.
It’s a great thing that admins are allowed to do more in comments, that’s a brilliant idea. It’s a shame though that it took me so long to figure it out – I believe the WordPress documentation should have some more information – the accurate path of comment should be described somewhere there.
Once again, thank you znuffn and sorry for the fuss.
EDIT: I forgot to post the solution! Here is the link that helped me add moddifications to kses.php filtering – http://cynng.wordpress.com/2013/05/28/adding-html-attribute-exceptions-to-wordpress-kses/
Forum: Hacks
In reply to: Comment post – different Firefox and Chrome resultsThank you for your guidance, I will log the output from these files to see what’s going on there.
And btw. the correction you suggested from
$incoming_comment['comment_content'] = str_replace( "'", ''', $incoming_comment['comment_content'] );
to
$incoming_comment['comment_content'] = str_replace( "'", '\'', $incoming_comment['comment_content'] );
I don’t think is necessary. The forum stripped my& apos ;tag (it strips HTML char codes even incode). Initially it was:
str_replace( "'", '& apos ;', $incoming_comment['comment_content'] );
As you can see, there was apos code which WP.org forum converted to the real apostrophe. I got the code from here: http://www.theblog.ca/literal-commentsOkay, once again thanks for your input, I really hope to solve this unusual mystery. Once I do, I’ll share it here. I am sure logging the output from wordpress files before saving it to database will give me some answers. I am sure there is something wrong with my configuration, but I still don’t understand how it may depend on the browser.
Cheers,
DanForum: Hacks
In reply to: Comment post – different Firefox and Chrome resultsThank you znuffn, I changed that line. I’m glad you spotted it!
It’s interesting that it works for you. I’ve been testing it for hours, I traced it from the beginning to the end – I tested POST data sent by browsers and I just did data logging in PHP. I logged the
$incoming_comment['comment_content']after every line in functions.php and it is always good. Right before thereturn( $incoming_comment );line everything is perfect, which means that it leaves functions.php always properly formatted (no matter what the posting browser was). So it has to get broken somewhere after my filter function returns the filtered data.Where does this data go after being filtered in functions.php? What is the php file that saves it in the database? Maybe I could log it right before saving in database to see what it looks like at the final stage.
I looked at the database and this is the databse result after posting in chrome:
<blockquote><p><strong>John Doe</strong> wrote:</p><p>Something Chrome</p></blockquote>
And this is the result after posting in Firefox:
<blockquote><strong>John Doe</strong> wrote:Something Firefox</blockquote>
The<p>tags are stripped after posting from Firefox (they are still there after leaving my functions.php!). I thought that posting from Firefox (and Opera) strips just the middle</p><p>, because that’s what I saw in Inspect element feature (both in Chrome and FF), but in the database there are no<p>and</p>at all when posting from Firefox or Opera.For the URL this is the comment content stored in database after posting in Chrome:
<a href="http://chrome.com" target="_blank" rel="nofollow">http://chrome.com</a>
And this is database comment content after posting from Firefox or Opera:
<a href="http://firefox.com" rel="nofollow">http://firefox.com</a>
So it strips thetargetatribute and its value.So I would be grateful if you could tell me the direction where I should be heading – where does the posted comment data go after being filtered in functions.php? Any other suggestions are highly appreciated.
I am still amazed that server-side processing may somehow depend on the browser – the data that gets to server is the same from all browsers, which I carefully logged after each line in functions.php. The data that leaves functions.php (i.e. is returned by my filtering function) is exactly the same after posting in both Chrome and Firefox. It gets broken on the server side, after functions.php, depending on the browser… How weird is that?