This repository has been archived by the owner on Sep 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass-commentbar.php
80 lines (65 loc) · 2.29 KB
/
class-commentbar.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
require_once("class-basebar.php");
class Commentbar extends Basebar {
function __construct($paged, $max_page) {
parent::__construct($paged, $max_page);
if (! $this->pbOptions = get_option('commentbar') ) {
pagebar_activate();
$this->pbOptions = get_option('commentbar');
}
$this->div_name = "commentbar";
if ($this->pbOptions['inherit']) {
$tmp_pbOptions = get_option('postbar');
foreach ($tmp_pbOptions as $key=>$val )
if (isset($this->pbOptions[$key]))
$this->pbOptions[$key] = $tmp_pbOptions[$key];
$this->div_name = "pagebar";
}
$this->action = 'commentbar';
$this->display();
} //__construct()
function Commentbar($paged, $max_page) {
$this->__construct($paged, $max_page);
}
// -----------------------------------------------------------------------------
function leave() {
// TODO: leave parameters
if (get_query_var('all')) // all parts displayed
return 1;
if ($this->max_page <= 1)
return 1;
return 0;
} //leave()
// -----------------------------------------------------------------------------
function create_link($page) {
return esc_url( get_comments_pagenum_link( $page, $this->max_page ) );
} //create_link()
// -----------------------------------------------------------------------------
function display() {
parent::display();
} //display()
// -----------------------------------------------------------------------------
function div_end() {
/*if ($this->pbOptions['all'])
echo $this->allPagesLink();
*/echo "</div>";
}//div_end()
// -----------------------------------------------------------------------------
function allPagesLink() {
global $post;
if ( '' == get_option('permalink_structure') || 'draft' == $post->post_status ) {
$page_link_type = '&page=';
$page_link_all = '&all=1';
} //if
else {
$page_link_type = '/';
$page_link_all = '/all/1';
$url = get_permalink();
if ( '/' == $url[strlen($url)-1])
$slash_yes = '/';
} //else
return '<a href="'. untrailingslashit(get_permalink()) .
$page_link_all . '">' . $this->pbOptions['label_all'] . '</a></li>';
} //allPagesLink()
} // class Commentbar
?>