| 1 |
<?php |
| 2 |
// Exit if accessed directly |
| 3 |
if( ! defined( 'ABSPATH' ) ) exit; |
| 4 |
if( ! WPF()->usergroup->can( 'ms' ) ) exit; |
| 5 |
$tab = sanitize_key( (string) wpfval( $_GET, 'wpf_tab' ) ); |
| 6 |
WPF()->settings->init_info(); |
| 7 |
?> |
| 8 |
|
| 9 |
<div class="wrap" style="margin:10px 20px 0 20px"> |
| 10 |
<div id="wpf-setbox" class="wpf-dash"> |
| 11 |
<!-- wpf-setbox-head start --> |
| 12 |
<div class="wpf-setbox-head"> |
| 13 |
<div class="wpf-head-logo"> |
| 14 |
<img src="<?php echo esc_url_raw( WPFORO_URL . "/assets/images/dashboard/wpforo-logo.png" ); ?>" alt="wpForo Logo"> |
| 15 |
</div> |
| 16 |
<div class="wpf-head-title"> |
| 17 |
<?php //esc_html_e("wpForo", "wpforo") ?> |
| 18 |
</div> |
| 19 |
<div class="wpf-head-info"> |
| 20 |
<span><a href="https://wpforo.com/docs/wpforo-v3/" target="_blank"><?php esc_html_e( "Documentation", "wpforo" ); ?></a></span> |
| 21 |
<span><a href="https://wpforo.com/community/" target="_blank"><?php esc_html_e( "Support", "wpforo" ); ?></a></span> |
| 22 |
<span><a href="https://gvectors.com/product-category/wpforo/" target="_blank"><?php esc_html_e( "Addons", "wpforo" ); ?></a></span> |
| 23 |
</div> |
| 24 |
</div> |
| 25 |
<h1 style="width:0;height:0;margin:0;padding:0;"></h1> |
| 26 |
<?php WPF()->notice->show(); ?> |
| 27 |
<?php do_action( 'wpforo_settings_page_top' ) ?> |
| 28 |
<?php do_action( "wpforo_option_page" ); ?> |
| 29 |
<?php settings_errors( "wpforo" ); ?> |
| 30 |
<!-- wpf-setbox-head end --> |
| 31 |
|
| 32 |
<!-- wpf-setbox-body start --> |
| 33 |
<div id="wpf-admin-wrap" class="wpf-setbox-body"> |
| 34 |
<div class="wpf-section"> |
| 35 |
<h3><?php esc_html_e( "Forum Settings", "wpforo" ) ?></h3> |
| 36 |
<div class="wpf-opt-search"> |
| 37 |
<input id="wpf-opt-search-field" type="text" name="" value="" placeholder="<?php esc_attr_e( "Find an option...", "wpforo" ) ?>"/> |
| 38 |
<span class="dashicons dashicons-search"></span> |
| 39 |
<div id="wpf-opt-search-results"></div> |
| 40 |
</div> |
| 41 |
</div> |
| 42 |
<div class="wpf-section-imp-exp"> |
| 43 |
<a href="<?php echo admin_url( 'admin.php?page=' . wpforo_prefix_slug( 'settings' ) . '&wpf_settings_imp_exp=export' ); ?>"> |
| 44 |
<button class="button-secondary"> |
| 45 |
<svg height="24" width="24" viewBox="0 0 640 512"> |
| 46 |
<path fill="currentColor" |
| 47 |
d="M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6c0-53-43-96-96-96c-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160c0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128c0-61.9-44-113.6-102.4-125.4m-132.9 88.7L299.3 420.7c-6.2 6.2-16.4 6.2-22.6 0L171.3 315.3c-10.1-10.1-2.9-27.3 11.3-27.3H248V176c0-8.8 7.2-16 16-16h48c8.8 0 16 7.2 16 16v112h65.4c14.2 0 21.4 17.2 11.3 27.3"></path> |
| 48 |
</svg> <?php _e( 'Export', 'wpforo' ) ?></button> |
| 49 |
</a> |
| 50 |
<a href="<?php echo admin_url( 'admin.php?page=' . wpforo_prefix_slug( 'settings' ) . '&wpf_settings_imp_exp=import' ); ?>"> |
| 51 |
<button class="button-secondary"> |
| 52 |
<svg height="24" width="24" viewBox="0 0 640 512"> |
| 53 |
<path fill="currentColor" |
| 54 |
d="M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6c0-53-43-96-96-96c-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160c0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128c0-61.9-44-113.6-102.4-125.4M393.4 288H328v112c0 8.8-7.2 16-16 16h-48c-8.8 0-16-7.2-16-16V288h-65.4c-14.3 0-21.4-17.2-11.3-27.3l105.4-105.4c6.2-6.2 16.4-6.2 22.6 0l105.4 105.4c10.1 10.1 2.9 27.3-11.3 27.3"></path> |
| 55 |
</svg> <?php _e( 'Import', 'wpforo' ) ?></button> |
| 56 |
</a> |
| 57 |
</div> |
| 58 |
|
| 59 |
<?php if( in_array( ( $imp_exp = sanitize_key( (string) wpfval( $_GET, 'wpf_settings_imp_exp' ) ) ), [ 'import', 'export' ], true ) ): ?> |
| 60 |
<div id="wpf-settings-tab" class="wpf-box-wrap" style="align-items:flex-start;"> |
| 61 |
<!-- Settings Content start --> |
| 62 |
<div class="wpf-box wpf-setcon" style="width: 100%;"> |
| 63 |
<div class="wpf-setcon-head"> |
| 64 |
<?php echo esc_html( __( ucfirst( $_GET['wpf_settings_imp_exp'] ), 'wpforo' ) ); ?> |
| 65 |
<a class="wpf-back" href="<?php echo esc_url_raw( admin_url( "admin.php?page=" . wpfval( $_GET, 'page' ) ) ); ?>"><span |
| 66 |
class="dashicons dashicons-arrow-left-alt2"></span><?php esc_html_e( "Back", "wpforo" ) ?></a> |
| 67 |
</div> |
| 68 |
<div class="wpf-setcon-body" style="padding-top: 20px;"> |
| 69 |
<?php include_once WPFORO_DIR . '/admin/settings/' . $imp_exp . ".php"; ?> |
| 70 |
</div> |
| 71 |
</div> |
| 72 |
<div class="wpf-clear"></div> |
| 73 |
</div> |
| 74 |
<?php else: ?> |
| 75 |
<?php if( ! $tab || ( ! isset( WPF()->settings->info->core[ $tab ] ) && ! isset( WPF()->settings->info->addons[ $tab ] ) ) ) : ?> |
| 76 |
<!-- wpf-box-wrap start --> |
| 77 |
<div class="wpf-box-wrap wpf-settings-home"> |
| 78 |
<?php |
| 79 |
foreach( WPF()->settings->info->core as $tab_key => $setting ) { |
| 80 |
if( ( $_GET['page'] === 'wpforo-base-settings' && ! $setting['base'] && is_wpforo_multiboard( |
| 81 |
) ) || ( $_GET['page'] !== 'wpforo-base-settings' && $setting['base'] && is_wpforo_multiboard() ) ) { |
| 82 |
continue; |
| 83 |
} |
| 84 |
?> |
| 85 |
<!-- Settings start --> |
| 86 |
<div class="wpf-box"> |
| 87 |
<div class="wpf-box-info wpf-<?php echo esc_attr( $setting["status"] ); ?>"> |
| 88 |
<img src="<?php echo esc_url_raw( WPFORO_URL . "/assets/images/dashboard/" . $setting["status"] . ".png" ); ?>"> |
| 89 |
</div> |
| 90 |
<div class="wpf-box-head"> |
| 91 |
<a href="<?php echo esc_url_raw( admin_url( "admin.php?page=" . $_GET['page'] . "&wpf_tab=" . $tab_key ) ); ?>" |
| 92 |
title="<?php esc_attr_e( "Open Settings", "wpforo" ) ?>"> |
| 93 |
<?php echo $setting["icon"]; ?> |
| 94 |
</a> |
| 95 |
</div> |
| 96 |
<div class="wpf-box-foot"> |
| 97 |
<div class="wpf-box-title"> |
| 98 |
<a href="<?php echo esc_url_raw( admin_url( "admin.php?page=" . $_GET['page'] . "&wpf_tab=" . $tab_key ) ); ?>" |
| 99 |
title="<?php esc_attr_e( "Open Settings", "wpforo" ) ?>"> |
| 100 |
<?php echo $setting["title"] ?> |
| 101 |
</a> |
| 102 |
</div> |
| 103 |
<div class="wpf-box-arrow"> |
| 104 |
<img src="<?php echo esc_url_raw( WPFORO_URL . "/assets/images/dashboard/arrow-right.png" ); ?>"> |
| 105 |
</div> |
| 106 |
</div> |
| 107 |
</div> |
| 108 |
<!-- Settings end --> |
| 109 |
<?php |
| 110 |
} |
| 111 |
?> |
| 112 |
<div class="wpf-clear"></div> |
| 113 |
</div> |
| 114 |
<!-- wpf-box-wrap end --> |
| 115 |
<?php if( WPF()->settings->info->addons ): ?> |
| 116 |
<div class="wpf-section"> |
| 117 |
<h3><?php esc_html_e( "Addons Settings", "wpforo" ) ?></h3> |
| 118 |
</div> |
| 119 |
<!-- wpf-box-wrap start --> |
| 120 |
<div class="wpf-box-wrap wpf-box-addons wpf-settings-home"> |
| 121 |
<?php foreach( WPF()->settings->info->addons as $addon_key => $addon ) { |
| 122 |
if( ( $_GET['page'] === 'wpforo-base-settings' && ! $addon['base'] && is_wpforo_multiboard( |
| 123 |
) ) || ( $_GET['page'] !== 'wpforo-base-settings' && $addon['base'] && is_wpforo_multiboard() ) ) { |
| 124 |
continue; |
| 125 |
} |
| 126 |
?> |
| 127 |
<!-- Settings start --> |
| 128 |
<div class="wpf-box"> |
| 129 |
<div class="wpf-box-info wpf-<?php echo esc_attr( $addon["status"] ); ?>"> |
| 130 |
<img src="<?php echo esc_url_raw( WPFORO_URL . "/assets/images/dashboard/" . $addon["status"] . ".png" ); ?>" alt=""> |
| 131 |
</div> |
| 132 |
<div class="wpf-box-head"> |
| 133 |
<a href="<?php echo esc_url_raw( admin_url( "admin.php?page=" . $_GET['page'] . "&wpf_tab=" . $addon_key ) ); ?>" |
| 134 |
title="<?php esc_attr_e( "Open Settings", "wpforo" ) ?>"> |
| 135 |
<?php echo $addon["icon"]; ?> |
| 136 |
</a> |
| 137 |
</div> |
| 138 |
<div class="wpf-box-foot"> |
| 139 |
<div class="wpf-box-title"> |
| 140 |
<a href="<?php echo esc_url_raw( admin_url( "admin.php?page=" . $_GET['page'] . "&wpf_tab=" . $addon_key ) ); ?>" |
| 141 |
title="<?php esc_attr_e( "Open Settings", "wpforo" ) ?>"> |
| 142 |
<?php echo $addon["title"] ?> |
| 143 |
</a> |
| 144 |
</div> |
| 145 |
<div class="wpf-box-arrow"> |
| 146 |
<img src="<?php echo esc_url_raw( WPFORO_URL . "/assets/images/dashboard/arrow-right.png" ); ?>" alt=""> |
| 147 |
</div> |
| 148 |
</div> |
| 149 |
</div> |
| 150 |
<!-- Settings end --> |
| 151 |
<?php |
| 152 |
} ?> |
| 153 |
</div> |
| 154 |
<!-- wpf-box-wrap end --> |
| 155 |
<div class="wpf-clear"></div> |
| 156 |
<?php endif; ?> |
| 157 |
<?php else: ?> |
| 158 |
<div id="wpf-settings-tab" class="wpf-box-wrap wpf-settings-tab_<?php echo esc_attr( $tab ); ?>" style="align-items:flex-start;"> |
| 159 |
<!-- Settings Content start --> |
| 160 |
<div class="wpf-box wpf-setcon"> |
| 161 |
<?php $setting = ( wpfkey( WPF()->settings->info->core, $tab ) ) ? WPF()->settings->info->core[ $tab ] : WPF()->settings->info->addons[ $tab ]; ?> |
| 162 |
<div class="wpf-setcon-head"> |
| 163 |
<?php echo esc_html( $setting["title"] ); ?> |
| 164 |
<a class="wpf-back" href="<?php echo esc_url_raw( admin_url( "admin.php?page=" . wpfval( $_GET, 'page' ) ) ); ?>"><span |
| 165 |
class="dashicons dashicons-arrow-left-alt2"></span><?php esc_html_e( "Back", "wpforo" ) ?></a> |
| 166 |
</div> |
| 167 |
<div class="wpf-setcon-body"> |
| 168 |
<?php |
| 169 |
if( wpfval( $setting, 'with_custom_form' ) ) { |
| 170 |
if( is_callable( $setting['callback_for_page'] ) ) call_user_func( $setting['callback_for_page'], $setting ); |
| 171 |
do_action( "wpforo_settings_after", $tab, $setting ); |
| 172 |
} else { |
| 173 |
?> |
| 174 |
<form method="POST" enctype="multipart/form-data"> |
| 175 |
<?php |
| 176 |
wp_nonce_field( "wpforo_settings_save_" . sanitize_title( $tab ) ); |
| 177 |
if( is_callable( $setting['callback_for_page'] ) ) call_user_func( $setting['callback_for_page'], $setting ); |
| 178 |
do_action( "wpforo_settings_after", $tab, $setting ); |
| 179 |
?> |
| 180 |
<div class="wpf-opt-row" style="flex-wrap: wrap; margin-top: 50px; display: flex;"> |
| 181 |
<div style="display: flex;"> |
| 182 |
<input style="padding-left: 21px; padding-right: 21px;" type="submit" class="button button-primary" name="save" |
| 183 |
value="<?php esc_attr_e( "Save Options", "wpforo" ); ?>"> |
| 184 |
<?php if( ! $setting['base'] && is_wpforo_multiboard() ) : ?> |
| 185 |
<input style="order: -1;" type="submit" class="button button-primary" name="save_for_all" |
| 186 |
value="<?php esc_attr_e( "Save Options for All Boards", "wpforo" ); ?>"> |
| 187 |
<?php endif; ?> |
| 188 |
</div> |
| 189 |
<div style="order: -1;"> |
| 190 |
<input type="submit" class="button" value="<?php _e( 'Reset Options', 'wpforo' ); ?>" name="reset" |
| 191 |
onclick="return confirm('<?php _e( 'Do you really want to reset options?', 'wpforo' ) ?>')"/> |
| 192 |
</div> |
| 193 |
</div> |
| 194 |
</form> |
| 195 |
<?php do_action( "wpforo_settings_after_form", $tab, $setting ); ?> |
| 196 |
<?php |
| 197 |
} |
| 198 |
?> |
| 199 |
</div> |
| 200 |
</div> |
| 201 |
<!-- Settings Content end --> |
| 202 |
<!-- Settings Sidebar start --> |
| 203 |
<div class="wpf-setbar"> |
| 204 |
<ul class="wpf-box wpf-menu-group"> |
| 205 |
<li class="wpf-menu-head"><?php esc_html_e( "Settings", "wpforo" ) ?> <span class="dashicons dashicons-arrow-up"></span></li> |
| 206 |
<?php foreach( WPF()->settings->info->core as $tab_key => $setting ): ?> |
| 207 |
<li<?php if( $tab === $tab_key ) echo " class='wpf-active'"; ?>><a href="<?php echo esc_url_raw( |
| 208 |
admin_url( |
| 209 |
"admin.php?page=" . ( ( $setting['base'] && is_wpforo_multiboard() ) ? 'wpforo-base-settings' : wpforo_prefix_slug( |
| 210 |
'settings' |
| 211 |
) ) . "&wpf_tab=" . $tab_key |
| 212 |
) |
| 213 |
); ?>"><span class="dashicons dashicons-arrow-left-alt2"></span> <?php echo esc_html( $setting["title"] ); ?></a></li> |
| 214 |
<?php endforeach; ?> |
| 215 |
</ul> |
| 216 |
<?php if( WPF()->settings->info->addons ): ?> |
| 217 |
<ul class="wpf-box wpf-menu-group"> |
| 218 |
<li class="wpf-menu-head"><?php esc_html_e( "Addons Settings", 'wpforo' ) ?> <span class="dashicons dashicons-arrow-up"></span></li> |
| 219 |
<?php foreach( WPF()->settings->info->addons as $addon_key => $addon ): ?> |
| 220 |
<li<?php if( $tab === $addon_key ) echo " class='wpf-active'"; ?>><a href="<?php echo esc_url_raw( |
| 221 |
admin_url( |
| 222 |
"admin.php?page=" . ( ( $addon['base'] && is_wpforo_multiboard() ) ? 'wpforo-base-settings' : wpforo_prefix_slug( |
| 223 |
'settings' |
| 224 |
) ) . "&wpf_tab=" . $addon_key |
| 225 |
) |
| 226 |
); ?>"><span class="dashicons dashicons-arrow-left-alt2"></span> <?php echo esc_html( $addon["title"] ); ?></a></li> |
| 227 |
<?php endforeach; ?> |
| 228 |
</ul> |
| 229 |
<?php endif; ?> |
| 230 |
</div> |
| 231 |
<!-- Settings Sidebar end --> |
| 232 |
<div class="wpf-clear"></div> |
| 233 |
</div> |
| 234 |
<script> |
| 235 |
jQuery(document).ready(function ($) { |
| 236 |
$(document).on('click', '.wpf-setbar .wpf-menu-head .dashicons-arrow-down, .wpf-setbar .wpf-menu-head .dashicons-arrow-up', function () { |
| 237 |
var $this = $(this); |
| 238 |
var up = $this.hasClass('dashicons-arrow-up'); |
| 239 |
$this.toggleClass('dashicons-arrow-down dashicons-arrow-up'); |
| 240 |
if (up) { |
| 241 |
$this.parents('.wpf-menu-group').find('li:not(.wpf-menu-head)').hide(); |
| 242 |
} else { |
| 243 |
$this.parents('.wpf-menu-group').find('li:not(.wpf-menu-head)').show(); |
| 244 |
} |
| 245 |
}); |
| 246 |
}); |
| 247 |
</script> |
| 248 |
<?php endif; ?> |
| 249 |
<?php endif; ?> |
| 250 |
</div> |
| 251 |
<!-- wpf-setbox-body end --> |
| 252 |
|
| 253 |
</div> |
| 254 |
</div> |
| 255 |
|