PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.2.0
Forumax – AI Powered Advanced Community Forum Plugin v2.2.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 2.0.0 2.1.0 All 29 releases
← All changes | includes/admin/menu/admin_ui.php +201 -171 1.3.02.2.0 View file →
@@ -1,172 +1,202 @@
1 -<?php
2 -if ( ! class_exists( 'bbPress' ) ) {
3 - return;
4 -}
5 -
6 -$parent_forums = [];
7 -$fcount = wp_count_posts( bbp_get_forum_post_type() );
8 -$forum_count = (int) ( $fcount->publish + $fcount->hidden + $fcount->spam );
9 -$bbpc_opt = get_option( 'bbp_core_settings' );
10 -?>
11 -<div class="wrap">
12 -<div class="body-dark">
13 - <?php
14 - if ( $forum_count > 0 ) :
15 - include __DIR__ . '/admin_ui/header.php';
16 - ?>
17 - <main>
18 - <div class="easydocs-sidebar-menu">
19 - <div class="tab-container">
20 - <?php
21 - $forum_query = new WP_Query( [
22 - 'post_type' => bbp_get_forum_post_type(),
23 - 'posts_per_page' => -1,
24 - 'post_parent' => 0,
25 - 'orderby' => 'menu_order',
26 - 'order' => 'ASC',
27 - 'post_status' => 'publish',
28 - ] );
29 - $count = $forum_query->found_posts;
30 - // Left Sidebar Forums.
31 - include __DIR__ . '/admin_ui/forums.php';
32 - ?>
33 - <div class="easydocs-tab-content">
34 - <?php
35 - $ids = 0;
36 - $container = 1;
37 - if ( is_array( $parent_forums ) ) :
38 - foreach ( $parent_forums as $item ) :
39 - $ids ++;
40 - $container ++;
41 - $active = $ids == 1 ? ' tab-active' : '';
42 -
43 - $children = new WP_Query(
44 - [
45 - 'post_parent' => $item,
46 - 'post_type' => bbp_get_topic_post_type(),
47 - 'orderby' => 'menu_order',
48 - 'order' => 'asc',
49 - 'posts_per_page' => -1,
50 - 'post_status' => [ 'any', 'spam' ],
51 - ]
52 - );
53 -
54 - $count_open = 0;
55 - $count_closed = 0;
56 - $count_hidden = 0;
57 - $count_no_reply = 0;
58 - $count_solved = 0;
59 - $count_unsolved = 0;
60 - $count_trash = 0;
61 -
62 - while ( $children->have_posts() ) : $children->the_post();
63 - $topic_id = get_the_ID();
64 - $replies = get_children( [
65 - 'post_parent' => $topic_id,
66 - 'post_type' => bbp_get_reply_post_type(),
67 - 'post_status' => [ 'publish', 'draft', 'pending' ],
68 - ] );
69 -
70 - // Count open/closed topics.
71 - if ( bbp_is_topic_closed( $topic_id ) ) {
72 - $count_closed++;
73 - } else {
74 - $count_open++;
75 - }
76 -
77 - // Count spam( hidden ) topics.
78 - if ( bbp_is_topic_spam( $topic_id ) || bbp_is_topic_pending( $topic_id ) ) {
79 - $count_hidden++;
80 - }
81 -
82 - // Replies count.
83 - if ( 0 == count( $replies ) ) {
84 - $count_no_reply++;
85 - }
86 -
87 - // Count solved.
88 - // Before using $GLOBALS['bbp_solved_topic'], check if it is set
89 - if (isset($GLOBALS['bbp_solved_topic']) && $GLOBALS['bbp_solved_topic']->is_solved($topic_id)) {
90 - $count_solved++;
91 - } else {
92 - $count_unsolved++;
93 - }
94 - endwhile;
95 - wp_reset_postdata();
96 -
97 - $trash_topic = new WP_Query( [
98 - 'post_parent' => $item,
99 - 'post_type' => bbp_get_topic_post_type(),
100 - 'posts_per_page' => -1,
101 - 'post_status' => [ 'trash' ],
102 - ] );
103 -
104 - while ( $trash_topic->have_posts() ) :
105 - $trash_topic->the_post();
106 - $trash_topic_id = get_the_ID();
107 - // Count trash.
108 - if ( bbp_is_topic_trash( $trash_topic_id ) ) {
109 - $count_trash++;
110 - }
111 - endwhile;
112 - wp_reset_postdata();
113 - ?>
114 - <div class="easydocs-tab <?php echo esc_attr( $active ); ?>" id="tab-<?php echo esc_attr( $item ); ?>">
115 -
116 - <!-- Tab filters. -->
117 - <?php include __DIR__ . '/admin_ui/tab_filters.php'; ?>
118 -
119 - <!-- Children topics. -->
120 - <?php include __DIR__ . '/admin_ui/topics.php'; ?>
121 -
122 - <a class="easydocs-btn easydocs-btn-outline-blue easydocs-btn-sm easydocs-btn-round button button-info section-doc" id="bbpc-topic" target="_blank" name="submit" href="javascript:void(0)" bbp_forum_id="<?php echo esc_attr( $item ); ?>">
123 - <?php esc_html_e( 'Add Topic', 'bbp-core' ); ?>
124 - </a>
125 - </div>
126 - <?php
127 - endforeach;
128 - endif;
129 - ?>
130 - </div>
131 - </div>
132 - </div>
133 - </main>
134 - <?php
135 - else :
136 - ?>
137 - <div class="eazydocs-no-content">
138 - <img src="<?php echo BBPC_IMG; ?>/icon/folder-open.png" alt="<?php esc_attr_e( 'Folder Open', 'bbp-core' ); ?>">
139 - <p class="big-p"> <?php esc_html_e( 'No forum has been found . Perhaps', 'bbp-core' ); ?> </p>
140 - <p> <br>
141 - <a href="javascript:void(0)" type="button" id="bbpc-forum" class="button button-primary ezd-btn btn-lg">
142 - <?php esc_html_e( 'Create Forum', 'bbp-core' ); ?>
143 - </a>
144 - </p>
145 - </div>
146 - <?php
147 - endif;
148 - ?>
149 - </div>
150 -</div>
151 -
152 -<script>
153 - (function ($) {
154 - $(document).ready(function () {
155 - let docContainer = document.querySelectorAll('.easydocs-tab');
156 - var config = {
157 - controls: {
158 - scope: 'local',
159 - },
160 - animation: {
161 - enable: false,
162 - },
163 - load: {
164 - filter: '<?php echo esc_js( $bbpc_opt['default_filter'] ?? '.open-topics' ); ?>'
165 - }
166 - };
167 - for (let i = 0; i < docContainer.length; i++) {
168 - var mixer1 = mixitup(docContainer[i], config);
169 - }
170 - });
171 -})(jQuery);
1 +<?php
2 +if ( ! class_exists( 'bbPress' ) ) {
3 + return;
4 +}
5 +
6 +$parent_forums = [];
7 +$fcount = wp_count_posts( bbp_get_forum_post_type() );
8 +$forum_count = (int) ( $fcount->publish + $fcount->hidden + $fcount->spam );
9 +?>
10 +<div class="wrap">
11 +<div class="body-dark">
12 + <?php
13 + if ( $forum_count > 0 ) :
14 + include __DIR__ . '/admin_ui/header.php';
15 + ?>
16 + <main>
17 + <div class="easydocs-sidebar-menu">
18 + <div class="tab-container">
19 + <?php
20 + $forum_query = new WP_Query( [
21 + 'post_type' => bbp_get_forum_post_type(),
22 + 'posts_per_page' => -1,
23 + 'post_parent' => 0,
24 + 'orderby' => 'menu_order',
25 + 'order' => 'ASC',
26 + 'post_status' => 'publish',
27 + ] );
28 + $count = $forum_query->found_posts;
29 + // Left Sidebar Forums.
30 + include __DIR__ . '/admin_ui/forums.php';
31 + ?>
32 + <div class="easydocs-tab-content">
33 + <?php
34 + $ids = 0;
35 + $container = 1;
36 + if ( is_array( $parent_forums ) ) :
37 + foreach ( $parent_forums as $item ) :
38 + $ids ++;
39 + $container ++;
40 + $active = $ids == 1 ? ' tab-active' : '';
41 +
42 + $children = new WP_Query(
43 + [
44 + 'post_parent' => $item,
45 + 'post_type' => bbp_get_topic_post_type(),
46 + 'orderby' => 'menu_order',
47 + 'order' => 'asc',
48 + 'posts_per_page' => -1,
49 + 'post_status' => [ 'any', 'spam' ],
50 + ]
51 + );
52 +
53 + $count_open = 0;
54 + $count_closed = 0;
55 + $count_hidden = 0;
56 + $count_no_reply = 0;
57 + $count_solved = 0;
58 + $count_unsolved = 0;
59 + $count_trash = 0;
60 +
61 + while ( $children->have_posts() ) : $children->the_post();
62 + $topic_id = get_the_ID();
63 + $replies = get_children( [
64 + 'post_parent' => $topic_id,
65 + 'post_type' => bbp_get_reply_post_type(),
66 + 'post_status' => [ 'publish', 'draft', 'pending' ],
67 + ] );
68 +
69 + // Count open/closed topics.
70 + if ( bbp_is_topic_closed( $topic_id ) ) {
71 + $count_closed++;
72 + } else {
73 + $count_open++;
74 + }
75 +
76 + // Count spam( hidden ) topics.
77 + if ( bbp_is_topic_spam( $topic_id ) || bbp_is_topic_pending( $topic_id ) ) {
78 + $count_hidden++;
79 + }
80 +
81 + // Replies count.
82 + if ( 0 == count( $replies ) ) {
83 + $count_no_reply++;
84 + }
85 +
86 + // Count solved.
87 + // Before using $GLOBALS['forumax_solve_topic'], check if it is set
88 + if (isset($GLOBALS['forumax_solve_topic']) && $GLOBALS['forumax_solve_topic']->is_solved($topic_id)) {
89 + $count_solved++;
90 + } else {
91 + $count_unsolved++;
92 + }
93 + endwhile;
94 + wp_reset_postdata();
95 +
96 + $trash_topic = new WP_Query( [
97 + 'post_parent' => $item,
98 + 'post_type' => bbp_get_topic_post_type(),
99 + 'posts_per_page' => -1,
100 + 'post_status' => [ 'trash' ],
101 + ] );
102 +
103 + while ( $trash_topic->have_posts() ) :
104 + $trash_topic->the_post();
105 + $trash_topic_id = get_the_ID();
106 + // Count trash.
107 + if ( bbp_is_topic_trash( $trash_topic_id ) ) {
108 + $count_trash++;
109 + }
110 + endwhile;
111 + wp_reset_postdata();
112 + ?>
113 + <div class="easydocs-tab <?php echo esc_attr( $active ); ?>" id="tab-<?php echo esc_attr( $item ); ?>">
114 +
115 + <!-- Tab filters. -->
116 + <?php include __DIR__ . '/admin_ui/tab_filters.php'; ?>
117 +
118 + <!-- Children topics. -->
119 + <?php include __DIR__ . '/admin_ui/topics.php'; ?>
120 +
121 + <?php
122 + if ( $children->post_count > 10 ) :
123 + ?>
124 + <div class="controls bbpc-admin-pagination">
125 + <div class="mixitup-control mixitup-page-list"></div>
126 + </div>
127 + <?php
128 + endif;
129 + ?>
130 +
131 + <a class="easydocs-btn easydocs-btn-outline-blue easydocs-btn-sm easydocs-btn-round button button-info section-doc" id="bbpc-topic" target="_blank" name="submit" href="javascript:void(0)" bbp_forum_id="<?php echo esc_attr( $item ); ?>">
132 + <?php esc_html_e( 'Add Topic', 'forumax' ); ?>
133 + </a>
134 + </div>
135 + <?php
136 + endforeach;
137 + endif;
138 + ?>
139 + </div>
140 + </div>
141 + </div>
142 + </main>
143 + <?php
144 + else :
145 + ?>
146 + <div class="eazydocs-no-content">
147 + <img src="<?php echo esc_url( FORUMAX_IMG . 'icon/folder-open.png' ); ?>" alt="<?php esc_attr_e( 'Folder Open', 'forumax' ); ?>">
148 + <p class="big-p"> <?php esc_html_e( 'No forums found. Get started by creating a new forum or importing demo data.', 'forumax' ); ?> </p>
149 + <p class="forumax-empty-actions">
150 + <a href="javascript:void(0)" type="button" id="bbpc-forum" class="button button-primary ezd-btn btn-lg">
151 + <span class="dashicons dashicons-plus-alt2"></span>
152 + <?php esc_html_e( 'Create Forum', 'forumax' ); ?>
153 + </a>
154 + <span class="forumax-actions-separator"><?php esc_html_e( 'or', 'forumax' ); ?></span>
155 + <a href="javascript:void(0)" type="button" id="forumax-import-demo" class="button ezd-btn btn-lg forumax-import-demo-btn">
156 + <span class="dashicons dashicons-database-import"></span>
157 + <?php esc_html_e( 'Import Demo Data', 'forumax' ); ?>
158 + </a>
159 + </p>
160 + </div>
161 + <?php
162 + endif;
163 + ?>
164 + </div>
165 +</div>
166 +
167 +<script>
168 + (function ($) {
169 + $(document).ready(function () {
170 + let docContainer = document.querySelectorAll('.easydocs-tab');
171 + var config = {
172 + controls: {
173 + scope: 'local',
174 + },
175 + animation: {
176 + enable: false,
177 + },
178 + load: {
179 + filter: '<?php echo esc_js( forumax_get_opt( 'default_filter', '.open-topics' ) ); ?>'
180 + },
181 + pagination: {
182 + limit: 10,
183 + },
184 + callbacks: {
185 + onMixEnd: function(state) {
186 + var pagination = state.container.querySelector('.bbpc-admin-pagination');
187 + if ( pagination ) {
188 + if ( state.totalShow === 0 ) {
189 + pagination.style.display = 'none';
190 + } else {
191 + pagination.style.display = 'block';
192 + }
193 + }
194 + }
195 + }
196 + };
197 + for (let i = 0; i < docContainer.length; i++) {
198 + var mixer1 = mixitup(docContainer[i], config);
199 + }
200 + });
201 +})(jQuery);
172 202 </script>