PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.5.1
Forumax – AI Powered Advanced Community Forum Plugin v2.5.1
2.5.1 2.5.0 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 trunk 1.0.8 1.1.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 All 31 releases
bbp-core / includes / admin / menu / admin_ui / topics.php

topics.php in Forumax – AI Powered Advanced Community Forum Plugin 2.5.1, at includes/admin/menu/admin_ui/topics.php

191 lines 8.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <ul class="easydocs-accordion">
2 <?php
3 while ( $children->have_posts() ) :
4 $children->the_post();
5 $current_topic_id = get_the_ID();
6
7 // Batched in admin_ui.php via forumax_admin_reply_stats().
8 $total_replies = (int) ( $reply_stats['total'][ $current_topic_id ] ?? 0 );
9 $pending_replies = $reply_stats['pending'][ $current_topic_id ] ?? [];
10
11 $no_reply = 0 === $total_replies ? 'no-reply' : '';
12 $is_solved = isset($GLOBALS['forumax_solve_topic']) && $GLOBALS['forumax_solve_topic']->is_solved( $current_topic_id ) ? ' solved' : ' unsolved';
13 $is_open = bbp_is_topic_closed( $current_topic_id ) ? ' closed-topics' : ' open-topics';
14 $is_hidden = bbp_is_topic_spam( $current_topic_id ) || bbp_is_topic_pending( $current_topic_id ) ? ' hidden-topics' : '';
15 $approve_btn = '';
16
17 if ( bbp_is_topic_spam( $current_topic_id ) ) {
18 $url = wp_nonce_url( admin_url( 'admin.php?bbpc_approve_topic_id=' . $current_topic_id ), 'bbpc_approve_topic_' . $current_topic_id );
19 $approve_btn = sprintf( '<a class="bbpc-approve-btn" href="%1$s"><span class="dashicons dashicons-yes" title="%2$s"></span></a>', esc_url( $url ), esc_attr__( 'Approve this Topic', 'forumax' ) );
20 }
21
22 $filter_class = $no_reply . $is_solved . $is_open . $is_hidden;
23
24 ?>
25 <li <?php post_class( 'easydocs-accordion-item accordion ez-section-acc-item mix ' . esc_attr( $filter_class ) ); ?> data-id="<?php echo esc_attr( $current_topic_id ); ?>">
26 <div class="accordion-title ez-section-title">
27 <?php
28 $edit_link = 'javascript:void( 0 )';
29 $target = '_self';
30 $topic_status = bbp_get_topic_status( $current_topic_id );
31 if ( current_user_can( 'editor' ) || current_user_can( 'administrator' ) ) {
32 $edit_link = get_edit_post_link( $current_topic_id );
33 $target = '_blank';
34 }
35 ?>
36 <div class="left-content">
37 <span class="topic-status">
38 <?php
39 // Return the Topic status icon Open, Close, Hidden (spam & pending) and which topic has No reply, is Resolved, is Unresolved.
40 if ( bbp_is_topic_closed( $current_topic_id ) ) {
41 echo '<span class="dashicons dashicons-dismiss" title="'.esc_attr__('Status: Closed.', 'forumax').'"></span>';
42 } elseif ( bbp_is_topic_spam( $current_topic_id ) || bbp_is_topic_pending( $current_topic_id ) ) {
43 $hidden_status = bbp_is_topic_spam( $current_topic_id ) ? 'Spam ' : 'Pending ';
44 echo '<span class="dashicons dashicons-hidden" title="' . esc_attr( $hidden_status . __( 'Status: Topic', 'forumax' ) ) . '"></span>';
45 } elseif ( bbp_is_topic_open( $current_topic_id ) ) {
46 ?> <img src="<?php echo esc_url( FORUMAX_IMG . 'icon/open.svg' ); ?>" alt="<?php esc_attr_e( 'Open icon', 'forumax' ) ?>" title="<?php echo esc_attr__( 'Open Topic', 'forumax' ) ?>"> <?php
47 } else {
48 echo '<span class="dashicons dashicons-info-outline"></span>';
49 }
50 ?>
51 </span>
52 <h4>
53 <a href="<?php echo esc_attr( $edit_link ); ?>" target="<?php echo esc_attr( $target ); ?>">
54 <?php echo esc_html( get_the_title( $current_topic_id ) ); ?>
55 </a>
56 </h4>
57 <!-- Topic Author -->
58 <span class="bbpc-author-name">
59 <?php
60 esc_html_e( '&nbsp; By: ', 'forumax' );
61
62 echo wp_kses_post(
63 bbp_get_topic_author_link(
64 array(
65 'post_id' => $current_topic_id,
66 'type' => 'name',
67 )
68 )
69 );
70 ?>
71 </span>
72
73 <?php
74 // Pending replies count and Approve button
75 $allowed_html = [
76 'a' => [
77 'href' => [],
78 'class' => [],
79 ],
80 'span' => [
81 'class' => [],
82 'title' => [],
83 ],
84 ];
85
86 echo wp_kses( $approve_btn, $allowed_html );
87
88 $pending_replies_count = count( $pending_replies );
89 $reply_count = $total_replies - $pending_replies_count;
90 ?>
91 <div
92 title="<?php echo esc_attr( sprintf(
93 /* translators: %d: Number of published replies */
94 __( '%d Published replies', 'forumax' ),
95 $reply_count
96 ) ); ?>">
97
98 <span class="bbpc-reply-count bbpc-published-replies">
99 <?php echo esc_html( $reply_count ); ?>
100 </span>
101 </div>
102
103 <?php
104 if ( $pending_replies_count > 0 ) :
105 ?>
106 <div click-target='<?php echo esc_attr( $current_topic_id ); ?>'
107 title="<?php echo esc_attr( sprintf(
108 /* translators: %d: Number of Pending replies */
109 __( '%d Pending replies', 'forumax' ),
110 $pending_replies_count
111 ) ); ?>">
112 <span class="bbpc-reply-count bbpc-pending-replies">
113 <?php echo esc_html( $pending_replies_count ); ?>
114 </span>
115 </div>
116 <?php
117 endif;
118 ?>
119
120 <ul class="actions">
121 <li>
122 <a href="<?php echo esc_url( get_permalink( $current_topic_id ) ); ?>" target="_blank" title="<?php esc_attr_e( 'View this reply in new tab', 'forumax' ); ?>">
123 <span class="dashicons dashicons-external"></span>
124 </a>
125 </li>
126
127 <?php if ( current_user_can( 'editor' ) || current_user_can( 'administrator' ) ) : ?>
128 <li class="delete">
129 <a href="javascript:void(0)" bbp_topic_ID="<?php echo esc_attr( $current_topic_id ); ?>" class="section-delete" title="<?php esc_attr_e( 'Move this topic to the Trash', 'forumax' ); ?>">
130 <span class="dashicons dashicons-trash"></span>
131 </a>
132 </li>
133 <?php endif; ?>
134 </ul>
135 </div>
136 <div class="right-content">
137 <!-- Topic Refresh Time -->
138 <span class="progress-text">
139 <?php bbp_topic_freshness_link( $current_topic_id ); ?>
140 </span>
141 <!-- ./Topic Refresh Time -->
142 </div>
143 </div>
144 <!-- Accordion children -->
145 <div class="easydocs-accordion-body nesting-accordion">
146 <?php if ( ! empty( $pending_replies_count ) ) : ?>
147 <ul class="bbpc-nested-replies" reply-target=<?php echo esc_attr( $current_topic_id ); ?>>
148 <?php
149 foreach ( $pending_replies as $p_reply ) {
150 ?>
151 <li reply-id="<?php echo esc_attr( $p_reply ); ?>" class="bbpc-reply-wrap">
152 <?php
153 echo esc_html( wp_trim_words( get_post_field( 'post_content', $p_reply ), 10, '...' ) );
154 echo ' - ';
155 echo esc_html( bbp_get_reply_author_display_name( $p_reply ) );
156 ?>
157 <?php
158 if ( bbp_is_reply_pending( $p_reply ) ) {
159 $url = wp_nonce_url( admin_url( 'admin.php?bbpc_approve_reply_id=' . $p_reply ), 'bbpc_approve_reply_' . $p_reply );
160 $approve_btn = sprintf( '<a class="bbpc-approve-btn" href="%1$s"><span class="dashicons dashicons-yes" title="%2$s"></span></a>', esc_url( $url ), esc_attr__( 'Approve This Reply', 'forumax' ) );
161 }
162
163 $allowed_html = [
164 'a' => [
165 'href' => [],
166 'class' => [],
167 ],
168 'span' => [
169 'class' => [],
170 'title' => [],
171 ],
172
173 ];
174
175 echo wp_kses( $approve_btn, $allowed_html );
176 ?>
177 </li>
178 <?php
179 }
180 ?>
181 </ul>
182 <?php endif; ?>
183 </div>
184 <!-- ./Accordion children ends -->
185 </li>
186 <?php
187 endwhile;
188 wp_reset_postdata();
189 ?>
190 </ul>
191