@dbltoe & @mc12345678 - guys, I think you missed the point. I wasn't trying to discuss the SEO aspect nor the reason *why* someone would want to do that. But okay, let's talk about it.
This was just a simple example so I stripped alt and title tags because it makes no difference. You can have alt, title, data-* or whatever you want - if it's inside a standalone img tag, it just gets stripped without notice. It's like you're trying to upload something malicious and you get blocked. My first thought was sanitizer and I had spent half an hour debugging it without success so I had to rule it out, only to find this piece of code.
Now imagine being a store owner - you have no clue this will happen and you do this for 20 categories. Again, let's NOT discuss whether this is a good idea or if it should/shouldn't be done. So, you do this for 20 categories, and then you go check what you've done and nothing's there. OK, something went wrong, you go again, add 5 descriptions/images this time, go check your work and again, nothing's there. All of a sudden, an innocent passerby gets struck by a laptop that went flying out the window...
Originally Posted by
mc12345678
As far as putting some content, wouldn't a suffice?
It probably would, but do you think the store owner from the story above knows about it? Even if you put this in the docs, will he/she find it? Will it make any sense?
What I'm saying - we either need a warning in messagestack to let the store owner know that the code was stripped down, or we shouldn't strip it down. Or maybe something else, dunno. Just not a silent strip down.
Now for a real life example: let's say a category with balloons where the main category image is a balloon, but when you access the category, there's a banner with some examples and information about the balloons in that category presented as a single image. Yeah, not the best approach, but this is not the topic here.
So, back to the original question - is there an actual reason why this would be stripped? Like security issues or something really significant?
As a solution, may I suggest this:
Code:
$sql_data_array = [
'categories_name' => zen_db_prepare_input($categories_name_array[$language_id]),
'categories_description' => empty(trim(strip_tags($categories_description_array[$language_id]))) ? '' : zen_db_prepare_input($categories_description_array[$language_id])
];
Code:
$sql_data_array = [
'categories_name' => zen_db_prepare_input($categories_name_array[$language_id]),
'categories_description' => empty(trim(strip_tags($categories_description_array[$language_id], '<img>'))) ? '' : zen_db_prepare_input($categories_description_array[$language_id])
];
This way we still strip empty tags, but img tags are allowed.
Bookmarks