-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.php
36 lines (29 loc) · 1020 Bytes
/
init.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
* TT-RSS Plugin which removes category tags of a feed.
*/
class Af_Drop_Categories extends Plugin {
private $host;
function about() {
return array("0.1",
"Removes category tags from every feed.",
"aschilling");
}
function init($host) {
$this->host = $host;
$host->add_hook($host::HOOK_FEED_FETCHED, $this);
}
/**
* After the feed is fetched, clean the category tags from $feed_data.
*/
function hook_feed_fetched($feed_data, $fetch_url, $owner_uid, $feed) {
_debug("category_cleaner: Removing category tags");
$feed_data_cleaned = preg_replace("/(<category.*?<\\/category>)/", "", $feed_data);
$feed_data_cleaned = preg_replace("/(<category.*?\\/>)/", "", $feed_data_cleaned);
return $feed_data_cleaned;
}
function api_version() {
return 2;
}
}
?>