summaryrefslogtreecommitdiff
path: root/init.php
blob: d6772f6b4646527bc029d255ce9fb39d0a6756a1 (plain)
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
<?php
class Api_Content_Lang extends Plugin {
	private $host;

	function about() {
		return array(1.0,
			"Sets lang=zh to article content returned via API (Chrome issue workaround)",
			"fox");
	}

	function init($host) {
		$this->host = $host;

		$host->add_hook($host::HOOK_RENDER_ARTICLE_API, $this);
	}

	function hook_render_article_api($row) {
		$article = isset($row['headline']) ? $row['headline'] : $row['article'];

		$article['content'] = "<div lang='zh'>" . $article['content'] . "</div>";

		return $article;
	}

	function api_version() {
		return 2;
	}
}