PluginProbe
bbPress / 2.0-rc-2
bbPress v2.0-rc-2
2.6.17 trunk 2.0 2.0-beta-1 2.0-beta-2b 2.0-beta-3 2.0-beta-3b 2.0-rc-2 2.0-rc-3 2.0-rc-4 2.0-rc-5 2.0.1 2.0.2 2.0.3 2.1 2.1-beta-1 2.1-rc1 2.1-rc2 2.1-rc3 2.1-rc4 2.1.1 2.1.2 2.1.3 2.2 2.2.1 All 72 releases
bbpress / bbp-includes / bbp-core-options.php

bbp-core-options.php in bbPress 2.0-rc-2, at bbp-includes/bbp-core-options.php

228 lines 5.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * bbPress Options
5 *
6 * @package bbPress
7 * @subpackage Options
8 */
9
10 // Exit if accessed directly
11 if ( !defined( 'ABSPATH' ) ) exit;
12
13 /**
14 * Add default options
15 *
16 * Hooked to bbp_activate, it is only called once when bbPress is activated.
17 * This is non-destructive, so existing settings will not be overridden.
18 *
19 * @uses add_option() Adds default options
20 * @uses do_action() Calls 'bbp_add_options'
21 */
22 function bbp_add_options() {
23
24 // Default options
25 $options = array (
26
27 /** Database **********************************************************/
28
29 // DB version
30 '_bbp_db_version' => '110',
31
32 /** Settings **********************************************************/
33
34 // Lock post editing after 5 minutes
35 '_bbp_edit_lock' => '5',
36
37 // Throttle post time to 10 seconds
38 '_bbp_throttle_time' => '10',
39
40 // Favorites
41 '_bbp_enable_favorites' => true,
42
43 // Subscriptions
44 '_bbp_enable_subscriptions' => true,
45
46 // Allow anonymous posting
47 '_bbp_allow_anonymous' => false,
48
49 // Users from all sites can post
50 '_bbp_allow_global_access' => false,
51
52 /** Per Page **********************************************************/
53
54 // Topics per page
55 '_bbp_topics_per_page' => '15',
56
57 // Replies per page
58 '_bbp_replies_per_page' => '15',
59
60 // Forums per page
61 '_bbp_forums_per_page' => '50',
62
63 // Topics per RSS page
64 '_bbp_topics_per_rss_page' => '25',
65
66 // Replies per RSS page
67 '_bbp_replies_per_rss_page' => '25',
68
69 /** Page For **********************************************************/
70
71 // Page for forums
72 '_bbp_page_for_forums' => '0',
73
74 // Page for forums
75 '_bbp_page_for_topics' => '0',
76
77 // Page for login
78 '_bbp_page_for_login' => '0',
79
80 // Page for register
81 '_bbp_page_for_register' => '0',
82
83 // Page for lost-pass
84 '_bbp_page_for_lost_pass' => '0',
85
86 /** Archive Slugs *****************************************************/
87
88 // Forum archive slug
89 '_bbp_root_slug' => 'forums',
90
91 // Topic archive slug
92 '_bbp_topic_archive_slug' => 'topics',
93
94 /** Single Slugs ******************************************************/
95
96 // Include Forum archive before single slugs
97 '_bbp_include_root' => true,
98
99 // Forum slug
100 '_bbp_forum_slug' => 'forum',
101
102 // Topic slug
103 '_bbp_topic_slug' => 'topic',
104
105 // Reply slug
106 '_bbp_reply_slug' => 'reply',
107
108 // Topic tag slug
109 '_bbp_topic_tag_slug' => 'topic-tag',
110
111 /** Other Slugs *******************************************************/
112
113 // User profile slug
114 '_bbp_user_slug' => 'users',
115
116 // View slug
117 '_bbp_view_slug' => 'view',
118
119 /** Topics ************************************************************/
120
121 // Title Max Length
122 '_bbp_title_max_length' => '80',
123
124 // Super stickies
125 '_bbp_super_sticky_topics' => '',
126
127 /** Forums ************************************************************/
128
129 // Private forums
130 '_bbp_private_forums' => '',
131
132 // Hidden forums
133 '_bbp_hidden_forums' => '',
134 );
135
136 // Add default options
137 foreach ( $options as $key => $value )
138 add_option( $key, $value );
139
140 // Allow previously activated plugins to append their own options.
141 // This is an extremely rare use-case.
142 do_action( 'bbp_add_options' );
143 }
144
145 /** Active? *******************************************************************/
146
147 /**
148 * Checks if favorites feature is enabled.
149 *
150 * @since bbPress (r2658)
151 *
152 * @param $default bool Optional.Default value
153 *
154 * @uses get_option() To get the favorites option
155 * @return bool Is favorites enabled or not
156 */
157 function bbp_is_favorites_active( $default = true ) {
158 return apply_filters( 'bbp_is_favorites_active', (bool) get_option( '_bbp_enable_favorites', $default ) );
159 }
160
161 /**
162 * Checks if subscription feature is enabled.
163 *
164 * @since bbPress (r2658)
165 *
166 * @param $default bool Optional.Default value
167 *
168 * @uses get_option() To get the subscriptions option
169 * @return bool Is subscription enabled or not
170 */
171 function bbp_is_subscriptions_active( $default = true ) {
172 return apply_filters( 'bbp_is_subscriptions_active', (bool) get_option( '_bbp_enable_subscriptions', $default ) );
173 }
174
175 /**
176 * Is the anonymous posting allowed?
177 *
178 * @since bbPress (r2659)
179 *
180 * @param $default bool Optional. Default value
181 *
182 * @uses get_option() To get the allow anonymous option
183 * @return bool Is anonymous posting allowed?
184 */
185 function bbp_allow_anonymous( $default = false ) {
186 return apply_filters( 'bbp_allow_anonymous', (bool) get_option( '_bbp_allow_anonymous', $default ) );
187 }
188
189 /**
190 * Is this forum available to all users on all sites in this installation?
191 *
192 * @since bbPress (r3378)
193 *
194 * @param $default bool Optional. Default value
195 *
196 * @uses get_option() To get the global access option
197 * @return bool Is global access allowed?
198 */
199 function bbp_allow_global_access( $default = false ) {
200 return apply_filters( 'bbp_allow_global_access', (bool) get_option( '_bbp_allow_global_access', $default ) );
201 }
202
203 /**
204 * Output the maximum length of a title
205 *
206 * @since bbPress (r3246)
207 *
208 * @param $default bool Optional. Default value
209 */
210 function bbp_title_max_length( $default = '80' ) {
211 echo bbp_get_title_max_length( $default );
212 }
213 /**
214 * Return the maximum length of a title
215 *
216 * @since bbPress (r3246)
217 *
218 * @param $default bool Optional. Default value
219 *
220 * @uses get_option() To get the maximum title length
221 * @return int Is anonymous posting allowed?
222 */
223 function bbp_get_title_max_length( $default = '80' ) {
224 return apply_filters( 'bbp_get_title_max_length', (int) get_option( '_bbp_title_max_length', $default ) );
225 }
226
227 ?>
228