-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.php
36 lines (28 loc) · 792 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
class Labels_To_Tags extends Plugin {
private $host;
public function about() {
return array(1.0,
'Add labels as tags in generated feeds',
'vnab',
true);
}
public function api_version() {
return 2;
}
public function init( $host ) {
$this->host = $host;
$host->add_hook( $host::HOOK_ARTICLE_EXPORT_FEED, $this );
}
public function hook_article_export_feed( $line, $feed, $is_cat, $owner_uid ) {
// get all LABELS for this article / line
$labels = Article::_get_labels($line['id'], $owner_uid);
if (count($labels) > 0) {
foreach ($labels as $label) {
array_push($line['tags'], $label[1]); // the name of the label is in [1]
}
$line['tags'] = array_unique($line['tags']);
}
return $line;
}
}