Not all parts of the feeds are cleaned
TfR75 - November 14, 2007 - 11:03
| Project: | Clean Feeds |
| Version: | 5.x-1.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
It seems to me that Clean Feeds only cleans the actual text but not the links etc. that are part of the Drupal RSS feeds. RSS output on my site looks like this
<description>JISC have recently published a briefing paper entitled Research in the arts and humanities: an overview of JISC activities.
<span class='read-more'><a href="http://www.arts-humanities.net/forum/how_can_we_raise_awareness_digital_resources"><span style="color:#f37916">[read more...]</span></a></span></description> Is there any setting I can change or is this actually a bug?

#1
Any news on this?
#2
There is no such setting, and I have never seen such a case. The module should clean all HTML tags.
If you have a patch that fixes this for your case, I will include it.
#3
The feeds that go through Clean Feeds are definitely much "cleaner" than the standard ones, but it does not clean up things such as links or HTML code for inverted commas and the like - and it does not seem to me that this is a issue that would be something specific relating to my site / sites.
Unfortunately, my PHP skills (at this stage) are not good enough to contribute a patch
#4
Hi,
The cleanfeeds module can indeed appear not to clean correctly. The problem of not all HTML being cleaned lies in the order of execution of the _nodeapi's, in particular the cleanfeeds module. The cleanfeeds_nodeapi function should be called last, to ensure all HTML is cleaned properly (if this is desired behaviour).
For example, increasing the weight in the system table for this module ensures it will be called after any theme code etc. has been added via the event module.
I have controlled the weight directly in the DB to resolve this issue, my question is: where is the appropriate place to set the weights for modules?
#5
@kiran_lakhotia
There are two ways of doing this:
1. Download this http://drupal.org/project/moduleweight and install it and assign cleanfeed a high number.
2. Create a patch that goes in the clean feeds .install and sets the weight to a very high number. This would be an update_x and in _install as well.
Let me know if 1 fixes it for you, or you want to submit a patch for 2.
#6
Hi kbahey
I think 2) is the better option. I'm very new to drupal, so please have a look at the cleanfeeds.install file and see if this is ok.
Thanks,
Kiran
#7
Good effort.
I made a few minor changes in the code.
Can you please test it?
Can others please test it too?
#8
Hi,
I have tested the install and it works. However, I have added an "uninstall hook" too. This is just for completeness sake to remove the cleanfeeds from the system table and force the install file to be run when re-installing. Please have a look at attached file.
Also I have added a weight option to the admin settings, it's a simple text box. See code below. If you think this is useful then I'm happy to create a patch for this.
<?php
function cleanfeeds_settings(){
....
$weight_query = db_query("SELECT weight FROM {system} WHERE name = 'cleanfeeds' AND type = 'module';");
$wr = db_fetch_array($weight_query);
$form[$group]['module_weight'] = array(
'#type' => 'textfield',
'#title' => t('Cleanfeeds module weight'),
'#default_value' => $wr['weight'],
'#size' => 10,
'#maxlength' => 50,
'#required' => TRUE
);
....
}
?>
and added the validation function
<?phpfunction cleanfeeds_settings_validate($form_id, $data) {
if (strcmp($data['module_weight'],"") == 0
|| !is_numeric($data['module_weight'])) {
form_set_error('module_weight', 'A weight must be numeric.');
}else {
db_query("UPDATE {system} SET weight = ".$data['module_weight']." WHERE name = 'cleanfeeds' AND type = 'module';");
}
}
?>
#9
PS: the update should probably be in a _submit hook, but you get the general idea.
Kiran
#10
The uninstall is not needed. When the module is uninstalled, the system table will be adjusted by Drupal itself.
The settings is overly complex and the moduleweight module does that already. No need to have overkill features.
I committed the .install for 1.1.
Thank you
#11
Automatically closed -- issue fixed for two weeks with no activity.