| 1 |
<?php |
| 2 |
// Exit if accessed directly |
| 3 |
if( ! defined( 'ABSPATH' ) ) exit; |
| 4 |
?> |
| 5 |
|
| 6 |
<div id="wpf-admin-wrap" class="wrap"> |
| 7 |
<h1 style="padding:10px 10px 0;"><?php _e( 'Forum Dashboard', 'wpforo' ); ?></h1> |
| 8 |
<?php WPF()->notice->show() ?> |
| 9 |
|
| 10 |
<div id="dashboard-widgets-wrap"> |
| 11 |
<div class="metabox-holder" id="dashboard-widgets"> |
| 12 |
|
| 13 |
<?php if( current_user_can( 'administrator' ) || current_user_can( 'editor' ) || current_user_can( 'author' ) ): ?> |
| 14 |
|
| 15 |
<div class="postbox-container" style="width: 100%;"> |
| 16 |
<div class="wpf-box-wrap"> |
| 17 |
|
| 18 |
<div class="postbox wpf-dash-box" id="wpforo_dashboard_widget_statistic"> |
| 19 |
<h2 class="wpf-box-header"><span><?php _e( 'Board Statistic', 'wpforo' ); ?></span></h2> |
| 20 |
<div class="inside"> |
| 21 |
<div class="main"> |
| 22 |
<table style="width:98%; margin:0 auto; text-align:left;"> |
| 23 |
<?php $statistic = WPF()->statistic(); ?> |
| 24 |
<tr class="wpf-dw-tr"> |
| 25 |
<td class="wpf-dw-td"><?php _e( 'Forums', 'wpforo' ); ?></td> |
| 26 |
<td class="wpf-dw-td-value"><?php echo intval( $statistic['forums'] ) ?></td> |
| 27 |
</tr> |
| 28 |
<tr class="wpf-dw-tr"> |
| 29 |
<td class="wpf-dw-td"><?php _e( 'Topics', 'wpforo' ); ?></td> |
| 30 |
<td class="wpf-dw-td-value"><?php echo intval( $statistic['topics'] ) ?></td> |
| 31 |
</tr> |
| 32 |
<tr class="wpf-dw-tr"> |
| 33 |
<td class="wpf-dw-td"><?php _e( 'Posts', 'wpforo' ); ?></td> |
| 34 |
<td class="wpf-dw-td-value"><?php echo intval( $statistic['posts'] ) ?></td> |
| 35 |
</tr> |
| 36 |
<tr class="wpf-dw-tr"> |
| 37 |
<td class="wpf-dw-td"><?php _e( 'Members', 'wpforo' ); ?></td> |
| 38 |
<td class="wpf-dw-td-value"><?php echo intval( $statistic['members'] ) ?></td> |
| 39 |
</tr> |
| 40 |
<tr class="wpf-dw-tr"> |
| 41 |
<td class="wpf-dw-td"><?php _e( 'Members Online', 'wpforo' ); ?></td> |
| 42 |
<td class="wpf-dw-td-value"><?php echo intval( $statistic['online_members_count'] ) ?></td> |
| 43 |
</tr> |
| 44 |
<?php |
| 45 |
$size_avatar = wpforo_dir_size( WPF()->folders['avatars']['dir'] ); |
| 46 |
$size_da = wpforo_dir_size( WPF()->folders['default_attachments']['dir'] ); |
| 47 |
$size_aa = wpforo_dir_size( WPF()->folders['attachments']['dir'] ); |
| 48 |
?> |
| 49 |
<tr class="wpf-dw-tr"> |
| 50 |
<td class="wpf-dw-td"><?php _e( 'Avatars Size', 'wpforo' ); ?></td> |
| 51 |
<td class="wpf-dw-td-value"><?php echo wpforo_human_filesize( $size_avatar ); ?></td> |
| 52 |
</tr> |
| 53 |
<tr class="wpf-dw-tr"> |
| 54 |
<td class="wpf-dw-td"><?php _e( 'Default Attachments Size', 'wpforo' ); ?></td> |
| 55 |
<td class="wpf-dw-td-value"><?php echo wpforo_human_filesize( $size_da ); ?></td> |
| 56 |
</tr> |
| 57 |
<?php if( isset( $statistic['attachments'] ) && $statistic['attachment_sizes'] ) : ?> |
| 58 |
<tr class="wpf-dw-tr"> |
| 59 |
<td class="wpf-dw-td"><?php _e( 'Advanced Attachments', 'wpforo' ); ?></td> |
| 60 |
<td class="wpf-dw-td-value"><?php echo esc_html( $statistic['attachments'] ) ?><?php _e( 'file(s)', 'wpforo' ); ?></td> |
| 61 |
</tr> |
| 62 |
<tr class="wpf-dw-tr"> |
| 63 |
<td class="wpf-dw-td"><?php _e( 'Advanced Attachments Size', 'wpforo' ); ?></td> |
| 64 |
<td class="wpf-dw-td-value"><?php echo wpforo_human_filesize( $size_aa ); ?></td> |
| 65 |
</tr> |
| 66 |
<?php endif ?> |
| 67 |
<tr class="wpf-dw-tr"> |
| 68 |
<td class="wpf-dw-td"><?php _e( 'Total Size', 'wpforo' ); ?></td> |
| 69 |
<td class="wpf-dw-td-value"> |
| 70 |
<strong style="font-size:14px;"> |
| 71 |
<?php |
| 72 |
$total = $size_avatar + $size_da + $size_aa; |
| 73 |
echo wpforo_human_filesize( $total ); |
| 74 |
?> |
| 75 |
</strong> |
| 76 |
</td> |
| 77 |
</tr> |
| 78 |
</table> |
| 79 |
</div> |
| 80 |
</div> |
| 81 |
</div><!-- widget / postbox --> |
| 82 |
|
| 83 |
<?php if( wpforo_current_user_is( 'admin' ) ) : ?> |
| 84 |
<div class="postbox wpf-dash-box" id="wpforo_dashboard_widget_0" style="width: 50%;"> |
| 85 |
<h2 class="wpf-box-header"> |
| 86 |
<span><?php _e( 'Forum Maintenance', 'wpforo' ); ?></span> |
| 87 |
</h2> |
| 88 |
<p class="wpf-info" style="padding:10px;"><?php _e( "This process may take a few seconds or dozens of minutes, please be patient and don't close this page. If you got 500 Server Error please don't worry, the data updating process is still working in MySQL server.", 'wpforo' ); ?></p> |
| 89 |
<div class="inside"> |
| 90 |
<div class="main"> |
| 91 |
<div style="width:100%; padding:7px 0;"> |
| 92 |
<?php |
| 93 |
$reset_cache = wp_nonce_url( admin_url( 'admin.php?page=' . wpforo_prefix_slug( 'dashboard' ) . '&wpfaction=reset_all_caches' ), 'wpforo_reset_cache' ); |
| 94 |
$clean_up = wp_nonce_url( admin_url( 'admin.php?page=' . wpforo_prefix_slug( 'dashboard' ) . '&wpfaction=clean_up' ), 'wpforo_clean_up' ); |
| 95 |
$reset_forums_stat_url = wp_nonce_url( admin_url( 'admin.php?page=' . wpforo_prefix_slug( 'dashboard' ) . '&wpfaction=reset_forums_stats' ), 'wpforo_reset_forums_stat' ); |
| 96 |
$reset_topics_stat_url = wp_nonce_url( admin_url( 'admin.php?page=' . wpforo_prefix_slug( 'dashboard' ) . '&wpfaction=reset_topics_stats' ), 'wpforo_reset_topics_stat' ); |
| 97 |
$reset_phrase_cache = wp_nonce_url( admin_url( 'admin.php?page=' . wpforo_prefix_slug( 'dashboard' ) . '&wpfaction=reset_phrase_cache' ), 'wpforo_reset_phrase_cache' ); |
| 98 |
$recrawl_phrases = wp_nonce_url( admin_url( 'admin.php?page=' . wpforo_prefix_slug( 'dashboard' ) . '&wpfaction=recrawl_phrases' ), 'wpforo_recrawl_phrases' ); |
| 99 |
$rebuild_threads = wp_nonce_url( admin_url( 'admin.php?page=' . wpforo_prefix_slug( 'dashboard' ) . '&wpfaction=rebuild_threads' ), 'wpforo_rebuild_threads' ); |
| 100 |
$flush_perma_soft = wp_nonce_url( admin_url( 'admin.php?page=' . wpforo_prefix_slug( 'dashboard' ) . '&wpfaction=flush_permalinks&flush_type=soft' ), 'wpforo_flush_permalinks' ); |
| 101 |
$flush_perma_hard = wp_nonce_url( admin_url( 'admin.php?page=' . wpforo_prefix_slug( 'dashboard' ) . '&wpfaction=flush_permalinks&flush_type=hard' ), 'wpforo_flush_permalinks' ); |
| 102 |
?> |
| 103 |
<a href="<?php echo esc_url( (string) $reset_cache ); ?>" style="min-width:160px; margin-bottom:10px; text-align:center;" class="button button-secondary"><?php _e( 'Delete All Caches', 'wpforo' ); ?></a> |
| 104 |
<a href="<?php echo esc_url( (string) $clean_up ); ?>" style="min-width:160px; margin-bottom:10px; text-align:center;" class="button button-secondary"><?php _e( 'Clean Up', 'wpforo' ); ?></a> |
| 105 |
<a href="<?php echo esc_url( (string) $reset_forums_stat_url ); ?>" style="min-width:160px; margin-bottom:10px; text-align:center;" class="button button-secondary"><?php _e( 'Update Forums Statistic', 'wpforo' ); ?></a> |
| 106 |
<a href="<?php echo esc_url( (string) $reset_topics_stat_url ); ?>" style="min-width:160px; margin-bottom:10px; text-align:center;" class="button button-secondary"><?php _e( 'Update Topics Statistic', 'wpforo' ); ?></a> |
| 107 |
<a href="<?php echo esc_url( (string) $recrawl_phrases ); ?>" style="min-width:160px; margin-bottom:10px; text-align:center;" class="button button-secondary"><?php _e( 'Rebuild Phrases', 'wpforo' ); ?></a> |
| 108 |
<a href="<?php echo esc_url( (string) $reset_phrase_cache ); ?>" style="min-width:160px; margin-bottom:10px; text-align:center;" class="button button-secondary"><?php _e( 'Delete Phrase Cache', 'wpforo' ); ?></a> |
| 109 |
<a href="<?php echo esc_url( (string) $rebuild_threads ); ?>" style="min-width:160px; margin-bottom:10px; text-align:center;" class="button button-secondary"><?php _e( 'Rebuild Threads', 'wpforo' ); ?></a> |
| 110 |
<hr style="margin-bottom: 12px;"> |
| 111 |
<a href="<?php echo esc_url( (string) $flush_perma_soft ); ?>" style="min-width:48%; margin-bottom:10px; text-align:center;" class="button button-secondary"><?php _e( 'Soft Flush Permalinks', 'wpforo' ); ?></a> |
| 112 |
<a href="<?php echo esc_url( (string) $flush_perma_hard ); ?>" style="min-width:48%; margin-bottom:10px; text-align:center;" class="button button-secondary"><?php _e( 'Hard Flush Permalinks', 'wpforo' ); ?></a> |
| 113 |
<p style="margin: 0;"><?php _e('Whether to update .htaccess (hard flush) or just update rewrite_rules option (soft flush). The hard option creates "rewrite_rules_bk_{sec}" record in "wp_options" table and .htaccess-bk-{sec} backup file in the root directory.', 'wpforo') ?></p> |
| 114 |
</div> |
| 115 |
</div> |
| 116 |
</div> |
| 117 |
</div><!-- widget / postbox --> |
| 118 |
<?php endif ?> |
| 119 |
|
| 120 |
<?php do_action( 'wpforo_dashboard_widgets_col2', WPF() ); ?> |
| 121 |
|
| 122 |
</div><!-- normal-sortables --> |
| 123 |
</div><!-- wpforo_postbox_container --> |
| 124 |
<?php endif; ?> |
| 125 |
|
| 126 |
<div class="postbox-container" id="postbox-container-3"> |
| 127 |
<div class="wpf-box-wrap"> |
| 128 |
|
| 129 |
<?php do_action( 'wpforo_dashboard_widgets_col3', WPF() ); ?> |
| 130 |
|
| 131 |
</div><!-- normal-sortables --> |
| 132 |
</div><!-- wpforo_postbox_container --> |
| 133 |
|
| 134 |
</div><!-- dashboard-widgets --> |
| 135 |
</div><!-- dashboard-widgets-wrap --> |
| 136 |
|
| 137 |
</div><!-- wpwrap --> |
| 138 |
|
| 139 |
|