-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrecommend.php
60 lines (44 loc) · 981 Bytes
/
recommend.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
function mantis_recommend_html()
{
ob_start();
$site = get_option('mantis_site_id');
require(MANTIS_ROOT . '/html/publisher/recommend.php');
$html = ob_get_contents();
ob_end_clean();
return $html;
}
function mantis_recommend_comments($file)
{
global $mantis_comments;
if ($mantis_comments) {
return $mantis_comments;
}
$mantis_comments = $file;
return MANTIS_ROOT . '/comments.php';
}
function mantis_recommend_after($content)
{
if (is_home()) {
return $content;
}
return $content . mantis_recommend_html();
}
function mantis_recommend_render()
{
echo mantis_recommend_html();
}
function mantis_recommend()
{
$location = get_option('mantis_recommend');
switch ($location) {
case 'after_content':
add_filter('the_content', 'mantis_recommend_after', 2);
break;
case 'before_comments':
case 'after_comments':
add_filter('comments_template', 'mantis_recommend_comments');
break;
}
}
add_action('init', 'mantis_recommend');