PageRenderTime 50ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

/wp-content/plugins/bbpress/includes/admin/settings.php

https://github.com/bfay/maniacal-kitten
PHP | 1519 lines | 716 code | 299 blank | 504 comment | 21 complexity | 76fc474cce160fb450503e3d220114a4 MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0, AGPL-1.0, LGPL-3.0, LGPL-2.1

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /**
  3. * bbPress Admin Settings
  4. *
  5. * @package bbPress
  6. * @subpackage Administration
  7. */
  8. // Exit if accessed directly
  9. if ( !defined( 'ABSPATH' ) ) exit;
  10. /** Sections ******************************************************************/
  11. /**
  12. * Get the Forums settings sections.
  13. *
  14. * @since bbPress (r4001)
  15. * @return array
  16. */
  17. function bbp_admin_get_settings_sections() {
  18. return (array) apply_filters( 'bbp_admin_get_settings_sections', array(
  19. 'bbp_settings_main' => array(
  20. 'title' => __( 'Main Settings', 'bbpress' ),
  21. 'callback' => 'bbp_admin_setting_callback_main_section',
  22. 'page' => 'bbpress',
  23. ),
  24. 'bbp_settings_theme_compat' => array(
  25. 'title' => __( 'Theme Packages', 'bbpress' ),
  26. 'callback' => 'bbp_admin_setting_callback_subtheme_section',
  27. 'page' => 'bbpress',
  28. ),
  29. 'bbp_settings_per_page' => array(
  30. 'title' => __( 'Per Page', 'bbpress' ),
  31. 'callback' => 'bbp_admin_setting_callback_per_page_section',
  32. 'page' => 'bbpress',
  33. ),
  34. 'bbp_settings_per_rss_page' => array(
  35. 'title' => __( 'Per RSS Page', 'bbpress' ),
  36. 'callback' => 'bbp_admin_setting_callback_per_rss_page_section',
  37. 'page' => 'bbpress',
  38. ),
  39. 'bbp_settings_root_slugs' => array(
  40. 'title' => __( 'Archive Slugs', 'bbpress' ),
  41. 'callback' => 'bbp_admin_setting_callback_root_slug_section',
  42. 'page' => 'bbpress',
  43. ),
  44. 'bbp_settings_single_slugs' => array(
  45. 'title' => __( 'Single Slugs', 'bbpress' ),
  46. 'callback' => 'bbp_admin_setting_callback_single_slug_section',
  47. 'page' => 'bbpress',
  48. ),
  49. 'bbp_settings_buddypress' => array(
  50. 'title' => __( 'BuddyPress', 'bbpress' ),
  51. 'callback' => 'bbp_admin_setting_callback_buddypress_section',
  52. 'page' => 'bbpress',
  53. ),
  54. 'bbp_settings_akismet' => array(
  55. 'title' => __( 'Akismet', 'bbpress' ),
  56. 'callback' => 'bbp_admin_setting_callback_akismet_section',
  57. 'page' => 'bbpress'
  58. )
  59. ) );
  60. }
  61. /**
  62. * Get all of the settings fields.
  63. *
  64. * @since bbPress (r4001)
  65. * @return type
  66. */
  67. function bbp_admin_get_settings_fields() {
  68. return (array) apply_filters( 'bbp_admin_get_settings_fields', array(
  69. /** Main Section ******************************************************/
  70. 'bbp_settings_main' => array(
  71. // Edit lock setting
  72. '_bbp_edit_lock' => array(
  73. 'title' => __( 'Disallow editing after', 'bbpress' ),
  74. 'callback' => 'bbp_admin_setting_callback_editlock',
  75. 'sanitize_callback' => 'intval',
  76. 'args' => array()
  77. ),
  78. // Throttle setting
  79. '_bbp_throttle_time' => array(
  80. 'title' => __( 'Throttle posting every', 'bbpress' ),
  81. 'callback' => 'bbp_admin_setting_callback_throttle',
  82. 'sanitize_callback' => 'intval',
  83. 'args' => array()
  84. ),
  85. // Allow topic and reply revisions
  86. '_bbp_allow_revisions' => array(
  87. 'title' => __( 'Revisions', 'bbpress' ),
  88. 'callback' => 'bbp_admin_setting_callback_revisions',
  89. 'sanitize_callback' => 'intval',
  90. 'args' => array()
  91. ),
  92. // Allow favorites setting
  93. '_bbp_enable_favorites' => array(
  94. 'title' => __( 'Favorites', 'bbpress' ),
  95. 'callback' => 'bbp_admin_setting_callback_favorites',
  96. 'sanitize_callback' => 'intval',
  97. 'args' => array()
  98. ),
  99. // Allow subscriptions setting
  100. '_bbp_enable_subscriptions' => array(
  101. 'title' => __( 'Subscriptions', 'bbpress' ),
  102. 'callback' => 'bbp_admin_setting_callback_subscriptions',
  103. 'sanitize_callback' => 'intval',
  104. 'args' => array()
  105. ),
  106. // Allow topic tags
  107. '_bbp_allow_topic_tags' => array(
  108. 'title' => __( 'Topic tags', 'bbpress' ),
  109. 'callback' => 'bbp_admin_setting_callback_topic_tags',
  110. 'sanitize_callback' => 'intval',
  111. 'args' => array()
  112. ),
  113. // Allow anonymous posting setting
  114. '_bbp_allow_anonymous' => array(
  115. 'title' => __( 'Anonymous posting', 'bbpress' ),
  116. 'callback' => 'bbp_admin_setting_callback_anonymous',
  117. 'sanitize_callback' => 'intval',
  118. 'args' => array()
  119. ),
  120. // Allow global access (on multisite)
  121. '_bbp_default_role' => array(
  122. 'title' => __( 'Default user role', 'bbpress' ),
  123. 'callback' => 'bbp_admin_setting_callback_default_role',
  124. 'sanitize_callback' => 'sanitize_text_field',
  125. 'args' => array()
  126. ),
  127. // Allow global access (on multisite)
  128. '_bbp_allow_global_access' => array(
  129. 'title' => __( 'Auto role', 'bbpress' ),
  130. 'callback' => 'bbp_admin_setting_callback_global_access',
  131. 'sanitize_callback' => 'intval',
  132. 'args' => array()
  133. ),
  134. // Allow fancy editor setting
  135. '_bbp_use_wp_editor' => array(
  136. 'title' => __( 'Fancy editor', 'bbpress' ),
  137. 'callback' => 'bbp_admin_setting_callback_use_wp_editor',
  138. 'args' => array(),
  139. 'sanitize_callback' => 'intval'
  140. ),
  141. // Allow auto embedding setting
  142. '_bbp_use_autoembed' => array(
  143. 'title' => __( 'Auto-embed links', 'bbpress' ),
  144. 'callback' => 'bbp_admin_setting_callback_use_autoembed',
  145. 'sanitize_callback' => 'intval',
  146. 'args' => array()
  147. )
  148. ),
  149. /** Theme Packages ****************************************************/
  150. 'bbp_settings_theme_compat' => array(
  151. // Replies per page setting
  152. '_bbp_theme_package_id' => array(
  153. 'title' => __( 'Current Package', 'bbpress' ),
  154. 'callback' => 'bbp_admin_setting_callback_subtheme_id',
  155. 'sanitize_callback' => 'esc_sql',
  156. 'args' => array()
  157. )
  158. ),
  159. /** Per Page Section **************************************************/
  160. 'bbp_settings_per_page' => array(
  161. // Replies per page setting
  162. '_bbp_topics_per_page' => array(
  163. 'title' => __( 'Topics', 'bbpress' ),
  164. 'callback' => 'bbp_admin_setting_callback_topics_per_page',
  165. 'sanitize_callback' => 'intval',
  166. 'args' => array()
  167. ),
  168. // Replies per page setting
  169. '_bbp_replies_per_page' => array(
  170. 'title' => __( 'Replies', 'bbpress' ),
  171. 'callback' => 'bbp_admin_setting_callback_replies_per_page',
  172. 'sanitize_callback' => 'intval',
  173. 'args' => array()
  174. )
  175. ),
  176. /** Per RSS Page Section **********************************************/
  177. 'bbp_settings_per_rss_page' => array(
  178. // Replies per page setting
  179. '_bbp_topics_per_rss_page' => array(
  180. 'title' => __( 'Topics', 'bbpress' ),
  181. 'callback' => 'bbp_admin_setting_callback_topics_per_rss_page',
  182. 'sanitize_callback' => 'intval',
  183. 'args' => array()
  184. ),
  185. // Replies per page setting
  186. '_bbp_replies_per_rss_page' => array(
  187. 'title' => __( 'Replies', 'bbpress' ),
  188. 'callback' => 'bbp_admin_setting_callback_replies_per_rss_page',
  189. 'sanitize_callback' => 'intval',
  190. 'args' => array()
  191. )
  192. ),
  193. /** Front Slugs *******************************************************/
  194. 'bbp_settings_root_slugs' => array(
  195. // Root slug setting
  196. '_bbp_root_slug' => array(
  197. 'title' => __( 'Forums base', 'bbpress' ),
  198. 'callback' => 'bbp_admin_setting_callback_root_slug',
  199. 'sanitize_callback' => 'esc_sql',
  200. 'args' => array()
  201. ),
  202. // Topic archive setting
  203. '_bbp_topic_archive_slug' => array(
  204. 'title' => __( 'Topics base', 'bbpress' ),
  205. 'callback' => 'bbp_admin_setting_callback_topic_archive_slug',
  206. 'sanitize_callback' => 'esc_sql',
  207. 'args' => array()
  208. )
  209. ),
  210. /** Single Slugs ******************************************************/
  211. 'bbp_settings_single_slugs' => array(
  212. // Include root setting
  213. '_bbp_include_root' => array(
  214. 'title' => __( 'Forum Prefix', 'bbpress' ),
  215. 'callback' => 'bbp_admin_setting_callback_include_root',
  216. 'sanitize_callback' => 'intval',
  217. 'args' => array()
  218. ),
  219. // Forum slug setting
  220. '_bbp_forum_slug' => array(
  221. 'title' => __( 'Forum slug', 'bbpress' ),
  222. 'callback' => 'bbp_admin_setting_callback_forum_slug',
  223. 'sanitize_callback' => 'sanitize_title',
  224. 'args' => array()
  225. ),
  226. // Topic slug setting
  227. '_bbp_topic_slug' => array(
  228. 'title' => __( 'Topic slug', 'bbpress' ),
  229. 'callback' => 'bbp_admin_setting_callback_topic_slug',
  230. 'sanitize_callback' => 'sanitize_title',
  231. 'args' => array()
  232. ),
  233. // Topic tag slug setting
  234. '_bbp_topic_tag_slug' => array(
  235. 'title' => __( 'Topic tag slug', 'bbpress' ),
  236. 'callback' => 'bbp_admin_setting_callback_topic_tag_slug',
  237. 'sanitize_callback' => 'sanitize_title',
  238. 'args' => array()
  239. ),
  240. // Reply slug setting
  241. '_bbp_reply_slug' => array(
  242. 'title' => __( 'Reply slug', 'bbpress' ),
  243. 'callback' => 'bbp_admin_setting_callback_reply_slug',
  244. 'sanitize_callback' => 'sanitize_title',
  245. 'args' => array()
  246. ),
  247. // User slug setting
  248. '_bbp_user_slug' => array(
  249. 'title' => __( 'User slug', 'bbpress' ),
  250. 'callback' => 'bbp_admin_setting_callback_user_slug',
  251. 'sanitize_callback' => 'sanitize_title',
  252. 'args' => array()
  253. ),
  254. // View slug setting
  255. '_bbp_view_slug' => array(
  256. 'title' => __( 'Topic view slug', 'bbpress' ),
  257. 'callback' => 'bbp_admin_setting_callback_view_slug',
  258. 'sanitize_callback' => 'sanitize_title',
  259. 'args' => array()
  260. ),
  261. // Search slug setting
  262. '_bbp_search_slug' => array(
  263. 'title' => __( 'Search slug', 'bbpress' ),
  264. 'callback' => 'bbp_admin_setting_callback_search_slug',
  265. 'sanitize_callback' => 'sanitize_title',
  266. 'args' => array()
  267. )
  268. ),
  269. /** BuddyPress ********************************************************/
  270. 'bbp_settings_buddypress' => array(
  271. // Are group forums enabled?
  272. '_bbp_enable_group_forums' => array(
  273. 'title' => __( 'Enable Group Forums', 'bbpress' ),
  274. 'callback' => 'bbp_admin_setting_callback_group_forums',
  275. 'sanitize_callback' => 'intval',
  276. 'args' => array()
  277. ),
  278. // Group forums parent forum ID
  279. '_bbp_group_forums_root_id' => array(
  280. 'title' => __( 'Group Forums Parent', 'bbpress' ),
  281. 'callback' => 'bbp_admin_setting_callback_group_forums_root_id',
  282. 'sanitize_callback' => 'intval',
  283. 'args' => array()
  284. )
  285. ),
  286. /** Akismet ***********************************************************/
  287. 'bbp_settings_akismet' => array(
  288. // Should we use Akismet
  289. '_bbp_enable_akismet' => array(
  290. 'title' => __( 'Use Akismet', 'bbpress' ),
  291. 'callback' => 'bbp_admin_setting_callback_akismet',
  292. 'sanitize_callback' => 'intval',
  293. 'args' => array()
  294. )
  295. )
  296. ) );
  297. }
  298. /**
  299. * Get settings fields by section.
  300. *
  301. * @since bbPress (r4001)
  302. * @param string $section_id
  303. * @return mixed False if section is invalid, array of fields otherwise.
  304. */
  305. function bbp_admin_get_settings_fields_for_section( $section_id = '' ) {
  306. // Bail if section is empty
  307. if ( empty( $section_id ) )
  308. return false;
  309. $fields = bbp_admin_get_settings_fields();
  310. $retval = isset( $fields[$section_id] ) ? $fields[$section_id] : false;
  311. return (array) apply_filters( 'bbp_admin_get_settings_fields_for_section', $retval, $section_id );
  312. }
  313. /** Main Section **************************************************************/
  314. /**
  315. * Main settings section description for the settings page
  316. *
  317. * @since bbPress (r2786)
  318. */
  319. function bbp_admin_setting_callback_main_section() {
  320. ?>
  321. <p><?php _e( 'Main forum settings for enabling features and setting time limits', 'bbpress' ); ?></p>
  322. <?php
  323. }
  324. /**
  325. * Edit lock setting field
  326. *
  327. * @since bbPress (r2737)
  328. *
  329. * @uses bbp_form_option() To output the option value
  330. */
  331. function bbp_admin_setting_callback_editlock() {
  332. ?>
  333. <input name="_bbp_edit_lock" type="number" min="0" step="1" id="_bbp_edit_lock" value="<?php bbp_form_option( '_bbp_edit_lock', '5' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_edit_lock' ); ?> />
  334. <label for="_bbp_edit_lock"><?php _e( 'minutes', 'bbpress' ); ?></label>
  335. <?php
  336. }
  337. /**
  338. * Throttle setting field
  339. *
  340. * @since bbPress (r2737)
  341. *
  342. * @uses bbp_form_option() To output the option value
  343. */
  344. function bbp_admin_setting_callback_throttle() {
  345. ?>
  346. <input name="_bbp_throttle_time" type="number" min="0" step="1" id="_bbp_throttle_time" value="<?php bbp_form_option( '_bbp_throttle_time', '10' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_throttle_time' ); ?> />
  347. <label for="_bbp_throttle_time"><?php _e( 'seconds', 'bbpress' ); ?></label>
  348. <?php
  349. }
  350. /**
  351. * Allow favorites setting field
  352. *
  353. * @since bbPress (r2786)
  354. *
  355. * @uses checked() To display the checked attribute
  356. */
  357. function bbp_admin_setting_callback_favorites() {
  358. ?>
  359. <input id="_bbp_enable_favorites" name="_bbp_enable_favorites" type="checkbox" id="_bbp_enable_favorites" value="1" <?php checked( bbp_is_favorites_active( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_enable_favorites' ); ?> />
  360. <label for="_bbp_enable_favorites"><?php _e( 'Allow users to mark topics as favorites', 'bbpress' ); ?></label>
  361. <?php
  362. }
  363. /**
  364. * Allow subscriptions setting field
  365. *
  366. * @since bbPress (r2737)
  367. *
  368. * @uses checked() To display the checked attribute
  369. */
  370. function bbp_admin_setting_callback_subscriptions() {
  371. ?>
  372. <input id="_bbp_enable_subscriptions" name="_bbp_enable_subscriptions" type="checkbox" id="_bbp_enable_subscriptions" value="1" <?php checked( bbp_is_subscriptions_active( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_enable_subscriptions' ); ?> />
  373. <label for="_bbp_enable_subscriptions"><?php _e( 'Allow users to subscribe to topics', 'bbpress' ); ?></label>
  374. <?php
  375. }
  376. /**
  377. * Allow topic tags setting field
  378. *
  379. * @since bbPress (r####)
  380. *
  381. * @uses checked() To display the checked attribute
  382. */
  383. function bbp_admin_setting_callback_topic_tags() {
  384. ?>
  385. <input id="_bbp_allow_topic_tags" name="_bbp_allow_topic_tags" type="checkbox" id="_bbp_allow_topic_tags" value="1" <?php checked( bbp_allow_topic_tags( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_topic_tags' ); ?> />
  386. <label for="_bbp_allow_topic_tags"><?php _e( 'Allow topics to have tags', 'bbpress' ); ?></label>
  387. <?php
  388. }
  389. /**
  390. * Allow topic and reply revisions
  391. *
  392. * @since bbPress (r3412)
  393. *
  394. * @uses checked() To display the checked attribute
  395. */
  396. function bbp_admin_setting_callback_revisions() {
  397. ?>
  398. <input id="_bbp_allow_revisions" name="_bbp_allow_revisions" type="checkbox" id="_bbp_allow_revisions" value="1" <?php checked( bbp_allow_revisions( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_revisions' ); ?> />
  399. <label for="_bbp_allow_revisions"><?php _e( 'Allow topic and reply revision logging', 'bbpress' ); ?></label>
  400. <?php
  401. }
  402. /**
  403. * Allow anonymous posting setting field
  404. *
  405. * @since bbPress (r2737)
  406. *
  407. * @uses checked() To display the checked attribute
  408. */
  409. function bbp_admin_setting_callback_anonymous() {
  410. ?>
  411. <input id="_bbp_allow_anonymous" name="_bbp_allow_anonymous" type="checkbox" id="_bbp_allow_anonymous" value="1" <?php checked( bbp_allow_anonymous( false ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_anonymous' ); ?> />
  412. <label for="_bbp_allow_anonymous"><?php _e( 'Allow guest users without accounts to create topics and replies', 'bbpress' ); ?></label>
  413. <?php
  414. }
  415. /**
  416. * Allow global access setting field
  417. *
  418. * @since bbPress (r3378)
  419. *
  420. * @uses checked() To display the checked attribute
  421. */
  422. function bbp_admin_setting_callback_global_access() {
  423. ?>
  424. <input id="_bbp_allow_global_access" name="_bbp_allow_global_access" type="checkbox" id="_bbp_allow_global_access" value="1" <?php checked( bbp_allow_global_access( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_allow_global_access' ); ?> />
  425. <label for="_bbp_allow_global_access"><?php _e( 'Automatically assign default role to new, registered users upon visiting the site.', 'bbpress' ); ?></label>
  426. <?php
  427. }
  428. /**
  429. * Output forum role selector (for user edit)
  430. *
  431. * @since bbPress (r4284)
  432. */
  433. function bbp_admin_setting_callback_default_role() {
  434. $default_role = bbp_get_default_role(); ?>
  435. <select name="_bbp_default_role" id="_bbp_default_role" <?php bbp_maybe_admin_setting_disabled( '_bbp_default_role' ); ?>>
  436. <?php foreach ( bbp_get_dynamic_roles() as $role => $details ) : ?>
  437. <option <?php selected( $default_role, $role ); ?> value="<?php echo esc_attr( $role ); ?>"><?php echo translate_user_role( $details['name'] ); ?></option>
  438. <?php endforeach; ?>
  439. </select>
  440. <?php
  441. }
  442. /**
  443. * Use the WordPress editor setting field
  444. *
  445. * @since bbPress (r3586)
  446. *
  447. * @uses checked() To display the checked attribute
  448. */
  449. function bbp_admin_setting_callback_use_wp_editor() {
  450. ?>
  451. <input id="_bbp_use_wp_editor" name="_bbp_use_wp_editor" type="checkbox" id="_bbp_use_wp_editor" value="1" <?php checked( bbp_use_wp_editor( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_use_wp_editor' ); ?> />
  452. <label for="_bbp_use_wp_editor"><?php _e( 'Use the fancy WordPress editor to create and edit topics and replies', 'bbpress' ); ?></label>
  453. <?php
  454. }
  455. /**
  456. * Main subtheme section
  457. *
  458. * @since bbPress (r2786)
  459. */
  460. function bbp_admin_setting_callback_subtheme_section() {
  461. ?>
  462. <p><?php _e( 'How your forum content is displayed within your existing theme.', 'bbpress' ); ?></p>
  463. <?php
  464. }
  465. /**
  466. * Use the WordPress editor setting field
  467. *
  468. * @since bbPress (r3586)
  469. *
  470. * @uses checked() To display the checked attribute
  471. */
  472. function bbp_admin_setting_callback_subtheme_id() {
  473. // Declare locale variable
  474. $theme_options = '';
  475. $current_package = bbp_get_theme_package_id( 'default' );
  476. // Note: This should never be empty. /templates/ is the
  477. // canonical backup if no other packages exist. If there's an error here,
  478. // something else is wrong.
  479. //
  480. // @see bbPress::register_theme_packages()
  481. foreach ( (array) bbpress()->theme_compat->packages as $id => $theme ) {
  482. $theme_options .= '<option value="' . esc_attr( $id ) . '"' . selected( $theme->id, $current_package, false ) . '>' . sprintf( __( '%1$s - %2$s', 'bbpress' ), esc_html( $theme->name ), esc_html( str_replace( WP_CONTENT_DIR, '', $theme->dir ) ) ) . '</option>';
  483. }
  484. if ( !empty( $theme_options ) ) : ?>
  485. <select name="_bbp_theme_package_id" id="_bbp_theme_package_id" <?php bbp_maybe_admin_setting_disabled( '_bbp_theme_package_id' ); ?>><?php echo $theme_options ?></select>
  486. <label for="_bbp_theme_package_id"><?php _e( 'will serve all bbPress templates', 'bbpress' ); ?></label>
  487. <?php else : ?>
  488. <p><?php _e( 'No template packages available.', 'bbpress' ); ?></p>
  489. <?php endif;
  490. }
  491. /**
  492. * Allow oEmbed in replies
  493. *
  494. * @since bbPress (r3752)
  495. *
  496. * @uses checked() To display the checked attribute
  497. */
  498. function bbp_admin_setting_callback_use_autoembed() {
  499. ?>
  500. <input id="_bbp_use_autoembed" name="_bbp_use_autoembed" type="checkbox" id="_bbp_use_autoembed" value="1" <?php checked( bbp_use_autoembed( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_use_autoembed' ); ?> />
  501. <label for="_bbp_use_autoembed"><?php _e( 'Embed media (YouTube, Twitter, Flickr, etc...) directly into topics and replies', 'bbpress' ); ?></label>
  502. <?php
  503. }
  504. /** Per Page Section **********************************************************/
  505. /**
  506. * Per page settings section description for the settings page
  507. *
  508. * @since bbPress (r2786)
  509. */
  510. function bbp_admin_setting_callback_per_page_section() {
  511. ?>
  512. <p><?php _e( 'How many topics and replies to show per page', 'bbpress' ); ?></p>
  513. <?php
  514. }
  515. /**
  516. * Topics per page setting field
  517. *
  518. * @since bbPress (r2786)
  519. *
  520. * @uses bbp_form_option() To output the option value
  521. */
  522. function bbp_admin_setting_callback_topics_per_page() {
  523. ?>
  524. <input name="_bbp_topics_per_page" type="number" min="1" step="1" id="_bbp_topics_per_page" value="<?php bbp_form_option( '_bbp_topics_per_page', '15' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_topics_per_page' ); ?> />
  525. <label for="_bbp_topics_per_page"><?php _e( 'per page', 'bbpress' ); ?></label>
  526. <?php
  527. }
  528. /**
  529. * Replies per page setting field
  530. *
  531. * @since bbPress (r2786)
  532. *
  533. * @uses bbp_form_option() To output the option value
  534. */
  535. function bbp_admin_setting_callback_replies_per_page() {
  536. ?>
  537. <input name="_bbp_replies_per_page" type="number" min="1" step="1" id="_bbp_replies_per_page" value="<?php bbp_form_option( '_bbp_replies_per_page', '15' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_replies_per_page' ); ?> />
  538. <label for="_bbp_replies_per_page"><?php _e( 'per page', 'bbpress' ); ?></label>
  539. <?php
  540. }
  541. /** Per RSS Page Section ******************************************************/
  542. /**
  543. * Per page settings section description for the settings page
  544. *
  545. * @since bbPress (r2786)
  546. */
  547. function bbp_admin_setting_callback_per_rss_page_section() {
  548. ?>
  549. <p><?php _e( 'How many topics and replies to show per RSS page', 'bbpress' ); ?></p>
  550. <?php
  551. }
  552. /**
  553. * Topics per RSS page setting field
  554. *
  555. * @since bbPress (r2786)
  556. *
  557. * @uses bbp_form_option() To output the option value
  558. */
  559. function bbp_admin_setting_callback_topics_per_rss_page() {
  560. ?>
  561. <input name="_bbp_topics_per_rss_page" type="number" min="1" step="1" id="_bbp_topics_per_rss_page" value="<?php bbp_form_option( '_bbp_topics_per_rss_page', '25' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_topics_per_rss_page' ); ?> />
  562. <label for="_bbp_topics_per_rss_page"><?php _e( 'per page', 'bbpress' ); ?></label>
  563. <?php
  564. }
  565. /**
  566. * Replies per RSS page setting field
  567. *
  568. * @since bbPress (r2786)
  569. *
  570. * @uses bbp_form_option() To output the option value
  571. */
  572. function bbp_admin_setting_callback_replies_per_rss_page() {
  573. ?>
  574. <input name="_bbp_replies_per_rss_page" type="number" min="1" step="1" id="_bbp_replies_per_rss_page" value="<?php bbp_form_option( '_bbp_replies_per_rss_page', '25' ); ?>" class="small-text"<?php bbp_maybe_admin_setting_disabled( '_bbp_replies_per_rss_page' ); ?> />
  575. <label for="_bbp_replies_per_rss_page"><?php _e( 'per page', 'bbpress' ); ?></label>
  576. <?php
  577. }
  578. /** Slug Section **************************************************************/
  579. /**
  580. * Slugs settings section description for the settings page
  581. *
  582. * @since bbPress (r2786)
  583. */
  584. function bbp_admin_setting_callback_root_slug_section() {
  585. // Flush rewrite rules when this section is saved
  586. if ( isset( $_GET['settings-updated'] ) && isset( $_GET['page'] ) )
  587. flush_rewrite_rules(); ?>
  588. <p><?php printf( __( 'Custom root slugs to prefix your forums and topics with. These can be partnered with WordPress pages to allow more flexibility.', 'bbpress' ), get_admin_url( null, 'options-permalink.php' ) ); ?></p>
  589. <?php
  590. }
  591. /**
  592. * Root slug setting field
  593. *
  594. * @since bbPress (r2786)
  595. *
  596. * @uses bbp_form_option() To output the option value
  597. */
  598. function bbp_admin_setting_callback_root_slug() {
  599. ?>
  600. <input name="_bbp_root_slug" type="text" id="_bbp_root_slug" class="regular-text code" value="<?php bbp_form_option( '_bbp_root_slug', 'forums', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_root_slug' ); ?> />
  601. <?php
  602. // Slug Check
  603. bbp_form_slug_conflict_check( '_bbp_root_slug', 'forums' );
  604. }
  605. /**
  606. * Topic archive slug setting field
  607. *
  608. * @since bbPress (r2786)
  609. *
  610. * @uses bbp_form_option() To output the option value
  611. */
  612. function bbp_admin_setting_callback_topic_archive_slug() {
  613. ?>
  614. <input name="_bbp_topic_archive_slug" type="text" id="_bbp_topic_archive_slug" class="regular-text code" value="<?php bbp_form_option( '_bbp_topic_archive_slug', 'topics', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_topic_archive_slug' ); ?> />
  615. <?php
  616. // Slug Check
  617. bbp_form_slug_conflict_check( '_bbp_topic_archive_slug', 'topics' );
  618. }
  619. /** Single Slugs **************************************************************/
  620. /**
  621. * Slugs settings section description for the settings page
  622. *
  623. * @since bbPress (r2786)
  624. */
  625. function bbp_admin_setting_callback_single_slug_section() {
  626. ?>
  627. <p><?php printf( __( 'Custom slugs for single forums, topics, replies, tags, users, and views here. If you change these, existing permalinks will also change.', 'bbpress' ), get_admin_url( null, 'options-permalink.php' ) ); ?></p>
  628. <?php
  629. }
  630. /**
  631. * Include root slug setting field
  632. *
  633. * @since bbPress (r2786)
  634. *
  635. * @uses checked() To display the checked attribute
  636. */
  637. function bbp_admin_setting_callback_include_root() {
  638. ?>
  639. <input id="_bbp_include_root" name="_bbp_include_root" type="checkbox" id="_bbp_include_root" value="1" <?php checked( get_option( '_bbp_include_root', true ) ); bbp_maybe_admin_setting_disabled( '_bbp_include_root' ); ?> />
  640. <label for="_bbp_include_root"><?php _e( 'Prefix your forum area with the Forum Base slug (Recommended)', 'bbpress' ); ?></label>
  641. <?php
  642. }
  643. /**
  644. * Forum slug setting field
  645. *
  646. * @since bbPress (r2786)
  647. *
  648. * @uses bbp_form_option() To output the option value
  649. */
  650. function bbp_admin_setting_callback_forum_slug() {
  651. ?>
  652. <input name="_bbp_forum_slug" type="text" id="_bbp_forum_slug" class="regular-text code" value="<?php bbp_form_option( '_bbp_forum_slug', 'forum', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_forum_slug' ); ?> />
  653. <?php
  654. // Slug Check
  655. bbp_form_slug_conflict_check( '_bbp_forum_slug', 'forum' );
  656. }
  657. /**
  658. * Topic slug setting field
  659. *
  660. * @since bbPress (r2786)
  661. *
  662. * @uses bbp_form_option() To output the option value
  663. */
  664. function bbp_admin_setting_callback_topic_slug() {
  665. ?>
  666. <input name="_bbp_topic_slug" type="text" id="_bbp_topic_slug" class="regular-text code" value="<?php bbp_form_option( '_bbp_topic_slug', 'topic', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_topic_slug' ); ?> />
  667. <?php
  668. // Slug Check
  669. bbp_form_slug_conflict_check( '_bbp_topic_slug', 'topic' );
  670. }
  671. /**
  672. * Reply slug setting field
  673. *
  674. * @since bbPress (r2786)
  675. *
  676. * @uses bbp_form_option() To output the option value
  677. */
  678. function bbp_admin_setting_callback_reply_slug() {
  679. ?>
  680. <input name="_bbp_reply_slug" type="text" id="_bbp_reply_slug" class="regular-text code" value="<?php bbp_form_option( '_bbp_reply_slug', 'reply', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_reply_slug' ); ?> />
  681. <?php
  682. // Slug Check
  683. bbp_form_slug_conflict_check( '_bbp_reply_slug', 'reply' );
  684. }
  685. /**
  686. * Topic tag slug setting field
  687. *
  688. * @since bbPress (r2786)
  689. *
  690. * @uses bbp_form_option() To output the option value
  691. */
  692. function bbp_admin_setting_callback_topic_tag_slug() {
  693. ?>
  694. <input name="_bbp_topic_tag_slug" type="text" id="_bbp_topic_tag_slug" class="regular-text code" value="<?php bbp_form_option( '_bbp_topic_tag_slug', 'topic-tag', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_topic_tag_slug' ); ?> />
  695. <?php
  696. // Slug Check
  697. bbp_form_slug_conflict_check( '_bbp_topic_tag_slug', 'topic-tag' );
  698. }
  699. /** Other Slugs ***************************************************************/
  700. /**
  701. * User slug setting field
  702. *
  703. * @since bbPress (r2786)
  704. *
  705. * @uses bbp_form_option() To output the option value
  706. */
  707. function bbp_admin_setting_callback_user_slug() {
  708. ?>
  709. <input name="_bbp_user_slug" type="text" id="_bbp_user_slug" class="regular-text code" value="<?php bbp_form_option( '_bbp_user_slug', 'users', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_user_slug' ); ?> />
  710. <?php
  711. // Slug Check
  712. bbp_form_slug_conflict_check( '_bbp_user_slug', 'users' );
  713. }
  714. /**
  715. * View slug setting field
  716. *
  717. * @since bbPress (r2789)
  718. *
  719. * @uses bbp_form_option() To output the option value
  720. */
  721. function bbp_admin_setting_callback_view_slug() {
  722. ?>
  723. <input name="_bbp_view_slug" type="text" id="_bbp_view_slug" class="regular-text code" value="<?php bbp_form_option( '_bbp_view_slug', 'view', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_view_slug' ); ?> />
  724. <?php
  725. // Slug Check
  726. bbp_form_slug_conflict_check( '_bbp_view_slug', 'view' );
  727. }
  728. /**
  729. * Search slug setting field
  730. *
  731. * @since bbPress (r4579)
  732. *
  733. * @uses bbp_form_option() To output the option value
  734. */
  735. function bbp_admin_setting_callback_search_slug() {
  736. ?>
  737. <input name="_bbp_search_slug" type="text" id="_bbp_search_slug" class="regular-text code" value="<?php bbp_form_option( '_bbp_search_slug', 'search', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_search_slug' ); ?> />
  738. <?php
  739. // Slug Check
  740. bbp_form_slug_conflict_check( '_bbp_search_slug', 'search' );
  741. }
  742. /** BuddyPress ****************************************************************/
  743. /**
  744. * Extension settings section description for the settings page
  745. *
  746. * @since bbPress (r3575)
  747. */
  748. function bbp_admin_setting_callback_buddypress_section() {
  749. ?>
  750. <p><?php _e( 'Forum settings for BuddyPress', 'bbpress' ); ?></p>
  751. <?php
  752. }
  753. /**
  754. * Allow BuddyPress group forums setting field
  755. *
  756. * @since bbPress (r3575)
  757. *
  758. * @uses checked() To display the checked attribute
  759. */
  760. function bbp_admin_setting_callback_group_forums() {
  761. ?>
  762. <input id="_bbp_enable_group_forums" name="_bbp_enable_group_forums" type="checkbox" id="_bbp_enable_group_forums" value="1" <?php checked( bbp_is_group_forums_active( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_enable_group_forums' ); ?> />
  763. <label for="_bbp_enable_group_forums"><?php _e( 'Allow BuddyPress Groups to have their own forums', 'bbpress' ); ?></label>
  764. <?php
  765. }
  766. /**
  767. * Replies per page setting field
  768. *
  769. * @since bbPress (r3575)
  770. *
  771. * @uses bbp_form_option() To output the option value
  772. */
  773. function bbp_admin_setting_callback_group_forums_root_id() {
  774. // Output the dropdown for all forums
  775. bbp_dropdown( array(
  776. 'selected' => bbp_get_group_forums_root_id(),
  777. 'show_none' => __( '&mdash; Forum root &mdash;', 'bbpress' ),
  778. 'orderby' => 'title',
  779. 'order' => 'ASC',
  780. 'select_id' => '_bbp_group_forums_root_id',
  781. 'disable_categories' => false,
  782. 'disabled' => '_bbp_group_forums_root_id'
  783. ) ); ?>
  784. <label for="_bbp_group_forums_root_id"><?php _e( 'is the parent for all group forums', 'bbpress' ); ?></label>
  785. <p class="description"><?php _e( 'Using the Forum Root is not recommended. Changing this does not move existing forums.', 'bbpress' ); ?></p>
  786. <?php
  787. }
  788. /** Akismet *******************************************************************/
  789. /**
  790. * Extension settings section description for the settings page
  791. *
  792. * @since bbPress (r3575)
  793. */
  794. function bbp_admin_setting_callback_akismet_section() {
  795. ?>
  796. <p><?php _e( 'Forum settings for Akismet', 'bbpress' ); ?></p>
  797. <?php
  798. }
  799. /**
  800. * Allow Akismet setting field
  801. *
  802. * @since bbPress (r3575)
  803. *
  804. * @uses checked() To display the checked attribute
  805. */
  806. function bbp_admin_setting_callback_akismet() {
  807. ?>
  808. <input id="_bbp_enable_akismet" name="_bbp_enable_akismet" type="checkbox" id="_bbp_enable_akismet" value="1" <?php checked( bbp_is_akismet_active( true ) ); bbp_maybe_admin_setting_disabled( '_bbp_enable_akismet' ); ?> />
  809. <label for="_bbp_enable_akismet"><?php _e( 'Allow Akismet to actively prevent forum spam.', 'bbpress' ); ?></label>
  810. <?php
  811. }
  812. /** Settings Page *************************************************************/
  813. /**
  814. * The main settings page
  815. *
  816. * @since bbPress (r2643)
  817. *
  818. * @uses screen_icon() To display the screen icon
  819. * @uses settings_fields() To output the hidden fields for the form
  820. * @uses do_settings_sections() To output the settings sections
  821. */
  822. function bbp_admin_settings() {
  823. ?>
  824. <div class="wrap">
  825. <?php screen_icon(); ?>
  826. <h2><?php _e( 'Forums Settings', 'bbpress' ) ?></h2>
  827. <form action="options.php" method="post">
  828. <?php settings_fields( 'bbpress' ); ?>
  829. <?php do_settings_sections( 'bbpress' ); ?>
  830. <p class="submit">
  831. <input type="submit" name="submit" class="button-primary" value="<?php esc_attr_e( 'Save Changes', 'bbpress' ); ?>" />
  832. </p>
  833. </form>
  834. </div>
  835. <?php
  836. }
  837. /** Converter Section *********************************************************/
  838. /**
  839. * Main settings section description for the settings page
  840. *
  841. * @since bbPress (r3813)
  842. */
  843. function bbp_converter_setting_callback_main_section() {
  844. ?>
  845. <p><?php _e( 'Information about your previous forums database so that they can be converted. <strong>Backup your database before proceeding.</strong>', 'bbpress' ); ?></p>
  846. <?php
  847. }
  848. /**
  849. * Edit Platform setting field
  850. *
  851. * @since bbPress (r3813)
  852. */
  853. function bbp_converter_setting_callback_platform() {
  854. $platform_options = '';
  855. $curdir = opendir( bbpress()->admin->admin_dir . 'converters/' );
  856. // Bail if no directory was found (how did this happen?)
  857. if ( empty( $curdir ) )
  858. return;
  859. // Loop through files in the converters folder and assemble some options
  860. while ( $file = readdir( $curdir ) ) {
  861. if ( ( stristr( $file, '.php' ) ) && ( stristr( $file, 'index' ) === false ) ) {
  862. $file = preg_replace( '/.php/', '', $file );
  863. $platform_options .= '<option value="' . $file . '">' . $file . '</option>';
  864. }
  865. }
  866. closedir( $curdir ); ?>
  867. <select name="_bbp_converter_platform" id="_bbp_converter_platform" /><?php echo $platform_options ?></select>
  868. <label for="_bbp_converter_platform"><?php _e( 'is the previous forum software', 'bbpress' ); ?></label>
  869. <?php
  870. }
  871. /**
  872. * Edit Database Server setting field
  873. *
  874. * @since bbPress (r3813)
  875. */
  876. function bbp_converter_setting_callback_dbserver() {
  877. ?>
  878. <input name="_bbp_converter_db_server" type="text" id="_bbp_converter_db_server" value="<?php bbp_form_option( '_bbp_converter_db_server', 'localhost' ); ?>" class="medium-text" />
  879. <label for="_bbp_converter_db_server"><?php _e( 'IP or hostname', 'bbpress' ); ?></label>
  880. <?php
  881. }
  882. /**
  883. * Edit Database Server Port setting field
  884. *
  885. * @since bbPress (r3813)
  886. */
  887. function bbp_converter_setting_callback_dbport() {
  888. ?>
  889. <input name="_bbp_converter_db_port" type="text" id="_bbp_converter_db_port" value="<?php bbp_form_option( '_bbp_converter_db_port', '3306' ); ?>" class="small-text" />
  890. <label for="_bbp_converter_db_port"><?php _e( 'Use default 3306 if unsure', 'bbpress' ); ?></label>
  891. <?php
  892. }
  893. /**
  894. * Edit Database User setting field
  895. *
  896. * @since bbPress (r3813)
  897. */
  898. function bbp_converter_setting_callback_dbuser() {
  899. ?>
  900. <input name="_bbp_converter_db_user" type="text" id="_bbp_converter_db_user" value="<?php bbp_form_option( '_bbp_converter_db_user' ); ?>" class="medium-text" />
  901. <label for="_bbp_converter_db_user"><?php _e( 'User for your database connection', 'bbpress' ); ?></label>
  902. <?php
  903. }
  904. /**
  905. * Edit Database Pass setting field
  906. *
  907. * @since bbPress (r3813)
  908. */
  909. function bbp_converter_setting_callback_dbpass() {
  910. ?>
  911. <input name="_bbp_converter_db_pass" type="password" id="_bbp_converter_db_pass" value="<?php bbp_form_option( '_bbp_converter_db_pass' ); ?>" class="medium-text" />
  912. <label for="_bbp_converter_db_pass"><?php _e( 'Password to access the database', 'bbpress' ); ?></label>
  913. <?php
  914. }
  915. /**
  916. * Edit Database Name setting field
  917. *
  918. * @since bbPress (r3813)
  919. */
  920. function bbp_converter_setting_callback_dbname() {
  921. ?>
  922. <input name="_bbp_converter_db_name" type="text" id="_bbp_converter_db_name" value="<?php bbp_form_option( '_bbp_converter_db_name' ); ?>" class="medium-text" />
  923. <label for="_bbp_converter_db_name"><?php _e( 'Name of the database with your old forum data', 'bbpress' ); ?></label>
  924. <?php
  925. }
  926. /**
  927. * Main settings section description for the settings page
  928. *
  929. * @since bbPress (r3813)
  930. */
  931. function bbp_converter_setting_callback_options_section() {
  932. ?>
  933. <p><?php _e( 'Some optional parameters to help tune the conversion process.', 'bbpress' ); ?></p>
  934. <?php
  935. }
  936. /**
  937. * Edit Table Prefix setting field
  938. *
  939. * @since bbPress (r3813)
  940. */
  941. function bbp_converter_setting_callback_dbprefix() {
  942. ?>
  943. <input name="_bbp_converter_db_prefix" type="text" id="_bbp_converter_db_prefix" value="<?php bbp_form_option( '_bbp_converter_db_prefix' ); ?>" class="medium-text" />
  944. <label for="_bbp_converter_db_prefix"><?php _e( '(If converting from BuddyPress Forums, use "wp_bb_" or your custom prefix)', 'bbpress' ); ?></label>
  945. <?php
  946. }
  947. /**
  948. * Edit Rows Limit setting field
  949. *
  950. * @since bbPress (r3813)
  951. */
  952. function bbp_converter_setting_callback_rows() {
  953. ?>
  954. <input name="_bbp_converter_rows" type="text" id="_bbp_converter_rows" value="<?php bbp_form_option( '_bbp_converter_rows', '100' ); ?>" class="small-text" />
  955. <label for="_bbp_converter_rows"><?php _e( 'rows to process at a time', 'bbpress' ); ?></label>
  956. <p class="description"><?php _e( 'Keep this low if you experience out-of-memory issues.', 'bbpress' ); ?></p>
  957. <?php
  958. }
  959. /**
  960. * Edit Delay Time setting field
  961. *
  962. * @since bbPress (r3813)
  963. */
  964. function bbp_converter_setting_callback_delay_time() {
  965. ?>
  966. <input name="_bbp_converter_delay_time" type="text" id="_bbp_converter_delay_time" value="<?php bbp_form_option( '_bbp_converter_delay_time', '1' ); ?>" class="small-text" />
  967. <label for="_bbp_converter_delay_time"><?php _e( 'second(s) delay between each group of rows', 'bbpress' ); ?></label>
  968. <p class="description"><?php _e( 'Keep this high to prevent too-many-connection issues.', 'bbpress' ); ?></p>
  969. <?php
  970. }
  971. /**
  972. * Edit Restart setting field
  973. *
  974. * @since bbPress (r3813)
  975. */
  976. function bbp_converter_setting_callback_restart() {
  977. ?>
  978. <input id="_bbp_converter_restart" name="_bbp_converter_restart" type="checkbox" id="_bbp_converter_restart" value="1" <?php checked( get_option( '_bbp_converter_restart', false ) ); ?> />
  979. <label for="_bbp_converter_restart"><?php _e( 'Start a fresh conversion from the beginning', 'bbpress' ); ?></label>
  980. <p class="description"><?php _e( 'You should clean old conversion information before starting over.', 'bbpress' ); ?></p>
  981. <?php
  982. }
  983. /**
  984. * Edit Clean setting field
  985. *
  986. * @since bbPress (r3813)
  987. */
  988. function bbp_converter_setting_callback_clean() {
  989. ?>
  990. <input id="_bbp_converter_clean" name="_bbp_converter_clean" type="checkbox" id="_bbp_converter_clean" value="1" <?php checked( get_option( '_bbp_converter_clean', false ) ); ?> />
  991. <label for="_bbp_converter_clean"><?php _e( 'Purge all information from a previously attempted import', 'bbpress' ); ?></label>
  992. <p class="description"><?php _e( 'Use this if an import failed and you want to remove that incomplete data.', 'bbpress' ); ?></p>
  993. <?php
  994. }
  995. /**
  996. * Edit Convert Users setting field
  997. *
  998. * @since bbPress (r3813)
  999. */
  1000. function bbp_converter_setting_callback_convert_users() {
  1001. ?>
  1002. <input id="_bbp_converter_convert_users" name="_bbp_converter_convert_users" type="checkbox" id="_bbp_converter_convert_users" value="1" <?php checked( get_option( '_bbp_converter_convert_users', false ) ); ?> />
  1003. <label for="_bbp_converter_convert_users"><?php _e( 'Attempt to import user accounts from previous forums', 'bbpress' ); ?></label>
  1004. <p class="description"><?php _e( 'Non-bbPress passwords cannot be automatically converted. They will be converted as each user logs in.', 'bbpress' ); ?></p>
  1005. <?php
  1006. }
  1007. /** Converter Page ************************************************************/
  1008. /**
  1009. * The main settings page
  1010. *
  1011. * @uses screen_icon() To display the screen icon
  1012. * @uses settings_fields() To output the hidden fields for the form
  1013. * @uses do_settings_sections() To output the settings sections
  1014. */
  1015. function bbp_converter_settings() {
  1016. ?>
  1017. <div class="wrap">
  1018. <?php screen_icon( 'tools' ); ?>
  1019. <h2 class="nav-tab-wrapper"><?php bbp_tools_admin_tabs( __( 'Import Forums', 'bbpress' ) ); ?></h2>
  1020. <form action="#" method="post" id="bbp-converter-settings">
  1021. <?php settings_fields( 'bbpress_converter' ); ?>
  1022. <?php do_settings_sections( 'bbpress_converter' ); ?>
  1023. <p class="submit">
  1024. <input type="button" name="submit" class="button-primary" id="bbp-converter-start" value="<?php esc_attr_e( 'Start', 'bbpress' ); ?>" onclick="bbconverter_start()" />
  1025. <input type="button" name="submit" class="button-primary" id="bbp-converter-stop" value="<?php esc_attr_e( 'Stop', 'bbpress' ); ?>" onclick="bbconverter_stop()" />
  1026. <img id="bbp-converter-progress" src="">
  1027. </p>
  1028. <div class="bbp-converter-updated" id="bbp-converter-message"></div>
  1029. </form>
  1030. </div>
  1031. <?php
  1032. }
  1033. /** Helpers *******************************************************************/
  1034. /**
  1035. * Contextual help for Forums settings page
  1036. *
  1037. * @since bbPress (r3119)
  1038. * @uses get_current_screen()
  1039. */
  1040. function bbp_admin_settings_help() {
  1041. $current_screen = get_current_screen();
  1042. // Bail if current screen could not be found
  1043. if ( empty( $current_screen ) )
  1044. return;
  1045. // Overview
  1046. $current_screen->add_help_tab( array(
  1047. 'id' => 'overview',
  1048. 'title' => __( 'Overview', 'bbpress' ),
  1049. 'content' => '<p>' . __( 'This screen provides access to all of the Forums settings.', 'bbpress' ) . '</p>' .
  1050. '<p>' . __( 'Please see the additional help tabs for more information on each indiviual section.', 'bbpress' ) . '</p>'
  1051. ) );
  1052. // Main Settings
  1053. $current_screen->add_help_tab( array(
  1054. 'id' => 'main_settings',
  1055. 'title' => __( 'Main Settings', 'bbpress' ),
  1056. 'content' => '<p>' . __( 'In the Main Settings you have a number of options:', 'bbpress' ) . '</p>' .
  1057. '<p>' .
  1058. '<ul>' .
  1059. '<li>' . __( 'You can choose to lock a post after a certain number of minutes. "Locking post editing" will prevent the author from editing some amount of time after saving a post.', 'bbpress' ) . '</li>' .
  1060. '<li>' . __( '"Throttle time" is the amount of time required between posts from a single author. The higher the throttle time, the longer a user will need to wait between posting to the forum.', 'bbpress' ) . '</li>' .
  1061. '<li>' . __( 'Favorites are a way for users to save and later return to topics they favor. This is enabled by default.', 'bbpress' ) . '</li>' .
  1062. '<li>' . __( 'Subscriptions allow users to subscribe for notifications to topics that interest them. This is enabled by default.', 'bbpress' ) . '</li>' .
  1063. '<li>' . __( 'Topic-Tags allow users to filter topics between forums. This is enabled by default.', 'bbpress' ) . '</li>' .
  1064. '<li>' . __( '"Anonymous Posting" allows guest users who do not have accounts on your site to both create topics as well as replies.', 'bbpress' ) . '</li>' .
  1065. '<li>' . __( 'The Fancy Editor brings the luxury of the Visual editor and HTML editor from the traditional WordPress dashboard into your theme.', 'bbpress' ) . '</li>' .
  1066. '<li>' . __( 'Auto-embed will embed the media content from a URL directly into the replies. For example: links to Flickr and YouTube.', 'bbpress' ) . '</li>' .
  1067. '</ul>' .
  1068. '</p>' .
  1069. '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.', 'bbpress' ) . '</p>'
  1070. ) );
  1071. // Per Page
  1072. $current_screen->add_help_tab( array(
  1073. 'id' => 'per_page',
  1074. 'title' => __( 'Per Page', 'bbpress' ),
  1075. 'content' => '<p>' . __( 'Per Page settings allow you to control the number of topics and replies appear on each page.', 'bbpress' ) . '</p>' .
  1076. '<p>' . __( 'This is comparable to the WordPress "Reading Settings" page, where you can set the number of posts that should show on blog pages and in feeds.', 'bbpress' ) . '</p>' .
  1077. '<p>' . __( 'These are broken up into two separate groups: one for what appears in your theme, another for RSS feeds.', 'bbpress' ) . '</p>'
  1078. ) );
  1079. // Slugs
  1080. $current_screen->add_help_tab( array(
  1081. 'id' => 'slus',
  1082. 'title' => __( 'Slugs', 'bbpress' ),
  1083. 'content' => '<p>' . __( 'The Slugs section allows you to control the permalink structure for your forums.', 'bbpress' ) . '</p>' .
  1084. '<p>' . __( '"Archive Slugs" are used as the "root" for your forums and topics. If you combine these values with existing page slugs, bbPress will attempt to output the most correct title and content.', 'bbpress' ) . '</p>' .
  1085. '<p>' . __( '"Single Slugs" are used as a prefix when viewing an individual forum, topic, reply, user, or view.', 'bbpress' ) . '</p>' .
  1086. '<p>' . __( 'In the event of a slug collision with WordPress or BuddyPress, a warning will appear next to the problem slug(s).', 'bbpress' ) . '</p>'
  1087. ) );
  1088. // Help Sidebar
  1089. $current_screen->set_help_sidebar(
  1090. '<p><strong>' . __( 'For more information:', 'bbpress' ) . '</strong></p>' .
  1091. '<p>' . __( '<a href="http://codex.bbpress.org" target="_blank">bbPress Documentation</a>', 'bbpress' ) . '</p>' .
  1092. '<p>' . __( '<a href="http://bbpress.org/forums/" target="_blank">bbPress Support Forums</a>', 'bbpress' ) . '</p>'
  1093. );
  1094. }
  1095. /**
  1096. * Disable a settings field if the value is forcibly set in bbPress's global
  1097. * options array.
  1098. *
  1099. * @since bbPress (r4347)
  1100. *
  1101. * @param string $option_key
  1102. */
  1103. function bbp_maybe_admin_setting_disabled( $option_key = '' ) {
  1104. disabled( isset( bbpress()->options[$option_key] ) );
  1105. }
  1106. /**
  1107. * Output settings API option
  1108. *
  1109. * @since bbPress (r3203)
  1110. *
  1111. * @uses bbp_get_bbp_form_option()
  1112. *
  1113. * @param string $option
  1114. * @param string $default
  1115. * @param bool $slug
  1116. */
  1117. function bbp_form_option( $option, $default = '' , $slug = false ) {
  1118. echo bbp_get_form_option( $option, $default, $slug );
  1119. }
  1120. /**
  1121. * Return settings API option
  1122. *
  1123. * @since bbPress (r3203)
  1124. *
  1125. * @uses get_option()
  1126. * @uses esc_attr()
  1127. * @uses apply_filters()
  1128. *
  1129. * @param string $option
  1130. * @param string $default
  1131. * @param bool $slug
  1132. */
  1133. function bbp_get_form_option( $option, $default = '', $slug = false ) {
  1134. // Get the option and sanitize it
  1135. $value = get_option( $option, $default );
  1136. // Slug?
  1137. if ( true === $slug ) {
  1138. $value = esc_attr( apply_filters( 'editable_slug', $value ) );
  1139. // Not a slug
  1140. } else {
  1141. $value = esc_attr( $value );
  1142. }
  1143. // Fallback to default
  1144. if ( empty( $value ) )
  1145. $value = $default;
  1146. // Allow plugins to further filter the output
  1147. return apply_filters( 'bbp_get_form_option', $value, $option );
  1148. }
  1149. /**
  1150. * Used to check if a bbPress slug conflicts with an existing known slug.
  1151. *
  1152. * @since bbPress (r3306)
  1153. *
  1154. * @param string $slug
  1155. * @param string $default
  1156. *
  1157. * @uses bbp_get_form_option() To get a sanitized slug string
  1158. */
  1159. function bbp_form_slug_conflict_check( $slug, $default ) {
  1160. // Only set the slugs once ver page load
  1161. static $the_core_slugs = array();
  1162. // Get the form value
  1163. $this_slug = bbp_get_form_option( $slug, $default, true );
  1164. if ( empty( $the_core_slugs ) ) {
  1165. // Slugs to check
  1166. $core_slugs = apply_filters( 'bbp_slug_conflict_check', array(
  1167. /** WordPress Core ****************************************************/
  1168. // Core Post Types
  1169. 'post_base' => array( 'name' => __( 'Posts', 'bbpress' ), 'default' => 'post', 'context' => 'WordPress' ),
  1170. 'page_base' => array( 'name' => __( 'Pages', 'bbpress' ), 'default' => 'page', 'context' => 'WordPress' ),
  1171. 'revision_base' => array( 'name' => __( 'Revisions', 'bbpress' ), 'default' => 'revision', 'context' => 'WordPress' ),
  1172. 'attachment_base' => array( 'name' => __( 'Attachments', 'bbpress' ), 'default' => 'attachment', 'context' => 'WordPress' ),
  1173. 'nav_menu_base' => array( 'name' => __( 'Menus', 'bbpress' ), 'default' => 'nav_menu_item', 'context' => 'WordPress' ),
  1174. // Post Tags
  1175. 'tag_base' => array( 'name' => __( 'Tag base', 'bbpress' ), 'default' => 'tag', 'context' => 'WordPress' ),
  1176. // Post Categories
  1177. 'category_base' => array( 'name' => __( 'Category base', 'bbpress' ), 'default' => 'category', 'context' => 'WordPress' ),
  1178. /** bbPress Core ******************************************************/
  1179. // Forum archive slug
  1180. '_bbp_root_slug' => array( 'name' => __( 'Forums base', 'bbpress' ), 'default' => 'forums', 'context' => 'bbPress' ),
  1181. // Topic archive slug
  1182. '_bbp_topic_archive_slug' => array( 'name' => __( 'Topics base', 'bbpress' ), 'default' => 'topics', 'context' => 'bbPress' ),
  1183. // Forum slug
  1184. '_bbp_forum_slug' => array( 'name' => __( 'Forum slug', 'bbpress' ), 'default' => 'forum', 'context' => 'bbPress' ),
  1185. // Topic slug
  1186. '_bbp_topic_slug' => array( 'name' => __( 'Topic slug', 'bbpress' ), 'default' => 'topic', 'context' => 'bbPress' ),
  1187. // Reply slug
  1188. '_bbp_reply_slug' => array( 'name' => __( 'Reply slug', 'bbpress' ), 'default' => 'reply', 'context' => 'bbPress' ),
  1189. // User profile slug
  1190. '_bbp_user_slug' => array( 'name' => __( 'User base', 'bbpress' ), 'default' => 'users', 'context' => 'bbPress' ),
  1191. // View slug
  1192. '_bbp_view_slug' => array( 'name' => __( 'View base', 'bbpress' ), 'default' => 'view', 'context' => 'bbPress' ),
  1193. // Topic tag slug
  1194. '_bbp_topic_tag_slug' => array( 'name' => __( 'Topic tag slug', 'bbpress' ), 'default' => 'topic-tag', 'context' => 'bbPress' ),
  1195. ) );
  1196. /** BuddyPress Core *******************************************************/
  1197. if ( defined( 'BP_VERSION' ) ) {
  1198. $bp = buddypress();
  1199. // Loop through root slugs and check for conflict
  1200. if ( !empty( $bp->pages ) ) {
  1201. foreach ( $bp->pages as $page => $page_data ) {
  1202. $page_base = $page . '_base';
  1203. $page_title = sprintf( __( '%s page', 'bbpress' ), $page_data->title );
  1204. $core_slugs[$page_base] = array( 'name' => $page_title, 'default' => $page_data->slug, 'context'

Large files files are truncated, but you can click here to view the full file