|
1 <div id="social"> |
|
2 <?php |
|
3 ob_start(); |
|
4 ?> |
|
5 <?php if (post_password_required()): ?> |
|
6 <p class="nopassword"><?php _e('This post is password protected. Enter the password to view any comments.', 'social'); ?></p> |
|
7 <?php else: ?> |
|
8 <div class="social-post"> |
|
9 <div id="loading" style="display:none"> |
|
10 <input type="hidden" id="reload_url" value="<?php echo esc_url(home_url('index.php?social_controller=auth&social_action=reload_form&redirect_to='.get_permalink(get_the_ID()).'&post_id='.get_the_ID())); ?>" /> |
|
11 <?php _e('Logging In...', 'social'); ?> |
|
12 </div> |
|
13 <?php |
|
14 if (comments_open()) { |
|
15 if (get_option('comment_registration') and !is_user_logged_in()) { |
|
16 ?> |
|
17 <p class="must-log-in"><?php printf(__('You must be <a href="%s">logged in</a> to post a comment.', 'social'), wp_login_url(apply_filters('the_permalink', get_permalink(get_the_ID())))); ?></p> |
|
18 <?php |
|
19 do_action('comment_form_must_log_in_after'); |
|
20 } |
|
21 |
|
22 echo Social_Comment_Form::instance(get_the_ID()); |
|
23 } |
|
24 else { |
|
25 do_action('comment_form_comments_closed'); |
|
26 ?> |
|
27 <p class="nocomments"><?php _e('Comments are closed.', 'social'); ?></p> |
|
28 <?php |
|
29 } |
|
30 ?> |
|
31 </div> |
|
32 <?php |
|
33 $form = ob_get_clean(); |
|
34 |
|
35 ob_start(); |
|
36 ?> |
|
37 <div id="social-tabs-comments"> |
|
38 <?php |
|
39 if (have_comments()): |
|
40 $groups = array(); |
|
41 $social_items = array(); |
|
42 if (get_comments_number()) { |
|
43 $comments = apply_filters('social_comments_array', $comments, $post->ID); |
|
44 |
|
45 if (isset($comments['social_items'])) { |
|
46 $social_items = $comments['social_items']; |
|
47 unset($comments['social_items']); |
|
48 } |
|
49 |
|
50 if (isset($comments['social_groups'])) { |
|
51 $groups = $comments['social_groups']; |
|
52 unset($comments['social_groups']); |
|
53 } |
|
54 } |
|
55 |
|
56 $last_reply_time = 0; |
|
57 if (count($comments)) { |
|
58 foreach ($comments as $key => $comment) { |
|
59 $time = strtotime($comment->comment_date_gmt); |
|
60 if ($time > $last_reply_time) { |
|
61 $last_reply_time = $time; |
|
62 } |
|
63 } |
|
64 } |
|
65 |
|
66 if (count($social_items)) { |
|
67 $latest_item = 0; |
|
68 foreach ($social_items as $service => $items) { |
|
69 foreach ($items as $comment) { |
|
70 if ($latest_item === 0) { |
|
71 $latest_item = strtotime($comment->comment_date_gmt); |
|
72 } |
|
73 else { |
|
74 $time = strtotime($comment->comment_date_gmt); |
|
75 if ($time > $latest_item) { |
|
76 $latest_item = $time; |
|
77 } |
|
78 } |
|
79 } |
|
80 } |
|
81 |
|
82 if ($latest_item > $last_reply_time) { |
|
83 $last_reply_time = $latest_item; |
|
84 } |
|
85 } |
|
86 |
|
87 Social::add_social_items_count($social_items, $groups); |
|
88 ?> |
|
89 <ul class="social-nav social-clearfix"> |
|
90 <li class="social-all social-tab-main<?php echo (!isset($_GET['social_tab']) ? ' social-current-tab' : ''); ?>"><a href="#" rel="social-all"><span><?php comments_number(__('0 Replies', 'social'), __('1 Reply', 'social'), __('% Replies', 'social')); ?></span></a></li> |
|
91 <li class="social-wordpress<?php echo ((isset($_GET['social_tab']) and $_GET['social_tab'] == 'wordpress') ? ' social-current-tab' : ''); ?>"><a href="#" rel="wordpress"><span><?php printf(_n('1 Comment', '%1$s Comments', (isset($groups['wordpress']) ? $groups['wordpress'] : 0), 'social'), (isset($groups['wordpress']) ? $groups['wordpress'] : 0)); ?></span></a></li> |
|
92 <li class="social-twitter<?php echo ((isset($_GET['social_tab']) and $_GET['social_tab'] == 'social-twitter') ? ' social-current-tab' : ''); ?>"><a href="#" rel="social-twitter"><span><?php printf(_n('1 Tweet', '%1$s Tweets', (isset($groups['social-twitter']) ? $groups['social-twitter'] : 0), 'social'), (isset($groups['social-twitter']) ? $groups['social-twitter'] : 0)); ?></span></a></li> |
|
93 <li class="social-facebook<?php echo ((isset($_GET['social_tab']) and $_GET['social_tab'] == 'social-facebook') ? ' social-current-tab' : ''); ?>"><a href="#" rel="social-facebook"><span><?php printf(_n('1 Facebook', '%1$s Facebook', (isset($groups['social-facebook']) ? $groups['social-facebook'] : 0), 'social'), (isset($groups['social-facebook']) ? $groups['social-facebook'] : 0)); ?></span></a></li> |
|
94 <li class="social-pingback<?php echo ((isset($_GET['social_tab']) and $_GET['social_tab'] == 'social-pingback') ? ' social-current-tab' : ''); ?>"><a href="#" rel="social-pingback"><span><?php printf(_n('1 Pingback', '%1$s Pingbacks', (isset($groups['pingback']) ? $groups['pingback'] : 0), 'social'), (isset($groups['pingback']) ? $groups['pingback'] : 0)); ?></span></a></li> |
|
95 </ul> |
|
96 |
|
97 <!-- panel items --> |
|
98 <div id="social-comments-tab-all" class="social-tabs-panel social-tabs-first-panel"> |
|
99 <div id="comments" class="social-comments"> |
|
100 <?php |
|
101 if ($last_reply_time) { |
|
102 echo '<div class="social-last-reply-when">'.sprintf(__('Last reply was %s', 'social'), Social_Date::span_comment($last_reply_time)).'</div>'; |
|
103 } |
|
104 if (count($social_items)) { |
|
105 echo '<div id="social-items-wrapper">'; |
|
106 foreach ($social_items as $group => $items) { |
|
107 $service = Social::instance()->service($group); |
|
108 if ($service !== false and count($items)) { |
|
109 $avatar_size = apply_filters('social_items_avatar_size', array( |
|
110 'width' => 24, |
|
111 'height' => 24, |
|
112 )); |
|
113 echo Social_View::factory('comment/social_item', compact('items', 'service', 'avatar_size')); |
|
114 } |
|
115 } |
|
116 echo '</div>'; |
|
117 } |
|
118 |
|
119 if ($last_reply_time or count($social_items)) { |
|
120 echo '<div class="cf-clearfix"></div>'; |
|
121 } |
|
122 if (count($comments)) { |
|
123 ?> |
|
124 <ol class="social-commentlist"> |
|
125 <?php |
|
126 wp_list_comments(array( |
|
127 'callback' => array(Social::instance(), 'comment'), |
|
128 'walker' => new Social_Walker_Comment, |
|
129 ), $comments); |
|
130 ?> |
|
131 </ol> |
|
132 <?php |
|
133 } |
|
134 if (get_comment_pages_count() > 1 and get_option('page_comments')): |
|
135 ?> |
|
136 <nav id="comment-nav-below"> |
|
137 <h1 class="assistive-text"><?php _e('Comment navigation', 'social'); ?></h1> |
|
138 <div class="nav-previous"><?php previous_comments_link(__('← Older Comments', 'social')); ?></div> |
|
139 <div class="nav-next"><?php next_comments_link(__('Newer Comments →', 'social')); ?></div> |
|
140 </nav> |
|
141 <?php endif; ?> |
|
142 </div> |
|
143 </div> |
|
144 <?php endif; ?> |
|
145 </div> |
|
146 <!-- #Comments Tabs --> |
|
147 <?php endif; ?> |
|
148 <?php |
|
149 $comments = ob_get_clean(); |
|
150 |
|
151 $order = apply_filters('social_comment_block_order', array('form', 'comments')); |
|
152 |
|
153 foreach ($order as $block) { |
|
154 if (isset($$block)) { |
|
155 echo $$block; |
|
156 } |
|
157 } |
|
158 ?> |
|
159 </div> |