Viewing 4 replies - 1 through 4 (of 4 total)
  • In the latest version(s) the developer has disallowed certain html elements by filtering through wp_kses_data(). The allowed tags are as follows (from kses.php in wp-includes dir)

    $allowedtags = array(
    		'a' => array(
    			'href' => true,
    			'title' => true,
    		),
    		'abbr' => array(
    			'title' => true,
    		),
    		'acronym' => array(
    			'title' => true,
    		),
    		'b' => array(),
    		'blockquote' => array(
    			'cite' => true,
    		),
    		'cite' => array(),
    		'code' => array(),
    		'del' => array(
    			'datetime' => true,
    		),
    		'em' => array (), 'i' => array (),
    'cite' => array()),
    		'q' => array(
    			'cite' => true,
    		),
    		'strike' => array(),
    		'strong' => array(),
    	);

    There are two functions in quotes-collection-admin.php which filter the quote data in this manner.. you would look for this:

    $quote = wp_kses_data( stripslashes($quote) );

    I believe the image tags you had in your quotes before will have been overwritten, so you’d have to re-enter them if you chose to modify the plugin. Of course, it goes without saying that if you do so, you won’t be able to update it without losing that data again.

    I have adapted the plugin for my own purposes and this was one of the modifications I made.

    Hope tha helps!

    Thread Starter martin1

    (@martin1)

    This is way above my comfort zone:-). I have no idea what you just said or what I need to do to get those images back.

    Would it be to much trouble to ask you to clarify a bit further like you would to a six year old :-).

    Hi Martin1,

    In case I wasn’t clear about it, there’s no way to “get the images back”. The image files are untouched, they haven’t gone anywhere, but you will have to “insert” references to them into your quotes from scratch.

    The other stuff in my first post is just pointing you in the right direction if you wanted to modify the plugin. Given that you’re telling me it didn’t make sense, here’s as simple as I can make it for you if you want to do a similar modification.

    One caveat… you should understand that the reason for this constraint in the first place is to prevent users from inputting poorly formed (or ill-advised) html into their quote content, which can break a page layout or worse). you have been warned! ??

    So the simplest thing you could do is change two lines in the file: quotes-collection-admin.php

    These lines are 22 & 59. They are both identical.

    $quote = wp_kses_data( stripslashes($quote) );

    here’s the line after your edit:

    $quote = wp_kses_post( stripslashes($quote) );

    This will allow all kinds of html tags (anything you can put into post content)

    So that’s a quick and dirty fix (I’d say it qualifies as a hack)
    To do it more properly, you could define a global variable $myAllowedTags, copy the code from my first post, but add ‘img’ to the array with attributes ‘src’ and ‘alt’, then plug that into each function like this:

    global $myAllowedTags;
    $quote = wp_kses( stripslashes($quote), $myAllowedTags );

    Have fun!

    Thread Starter martin1

    (@martin1)

    Hi,

    Thanks this works perfectly ?? and was just what I was looking for except for one detail I hope you know how to solve:-).
    I also added some html (strong and a span style color) to the author section which now longer works.

    Would you know how to get that working as well?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Quotes Collection] In the latest version of this plugin my images get removed.’ is closed to new replies.