| 1 |
<?php
|
| 2 |
|
| 3 |
//$Id: cleanfeeds.module,v 1.5 2008/09/28 01:06:31 kbahey Exp $
|
| 4 |
|
| 5 |
// Copyright 2006 Khalid Baheyeldin http://2bits.com
|
| 6 |
|
| 7 |
define('CLEANFEEDS_NODE', 'cleanfeeds_node_');
|
| 8 |
|
| 9 |
function cleanfeeds_help($section) {
|
| 10 |
switch ($section) {
|
| 11 |
case 'admin/settings/cleanfeeds':
|
| 12 |
return t('Cleans up HTML in feeds.');
|
| 13 |
}
|
| 14 |
}
|
| 15 |
|
| 16 |
function cleanfeeds_menu() {
|
| 17 |
$items = array();
|
| 18 |
|
| 19 |
$items['admin/settings/cleanfeeds'] = array(
|
| 20 |
'title' => 'Cleanfeeds',
|
| 21 |
'description' => t('Settings of the Cleanfeeds module'),
|
| 22 |
'page callback' => 'drupal_get_form',
|
| 23 |
'page arguments' => array('cleanfeeds_settings'),
|
| 24 |
'access' => array('administer site configuration'),
|
| 25 |
);
|
| 26 |
|
| 27 |
return $items;
|
| 28 |
}
|
| 29 |
|
| 30 |
function cleanfeeds_settings() {
|
| 31 |
$group = 'options';
|
| 32 |
$form[$group] = array(
|
| 33 |
'#type' => 'fieldset',
|
| 34 |
'#collapsible' => true,
|
| 35 |
);
|
| 36 |
foreach(node_get_types() as $type => $obj) {
|
| 37 |
$form[$group][CLEANFEEDS_NODE . $type] = array(
|
| 38 |
'#type' => 'checkbox',
|
| 39 |
'#title' => $obj->name,
|
| 40 |
'#return_value' => 1,
|
| 41 |
'#default_value' => variable_get(CLEANFEEDS_NODE. $type, 0),
|
| 42 |
);
|
| 43 |
}
|
| 44 |
return system_settings_form($form);
|
| 45 |
}
|
| 46 |
|
| 47 |
function cleanfeeds_nodeapi(&$node, $op, $teaser, $page) {
|
| 48 |
switch($op) {
|
| 49 |
case 'rss item':
|
| 50 |
if (variable_get(CLEANFEEDS_NODE . $node->type, 0)) {
|
| 51 |
$node->body = check_plain(decode_entities(strip_tags($node->body)));
|
| 52 |
$node->teaser = check_plain(decode_entities(strip_tags($node->teaser)));
|
| 53 |
}
|
| 54 |
break;
|
| 55 |
}
|
| 56 |
}
|