]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-includes/default-constants.php
Wordpress 3.0.4
[autoinstalls/wordpress.git] / wp-includes / default-constants.php
1 <?php
2 /**
3  * Defines constants and global variables that can be overridden, generally in wp-config.php.
4  *
5  * @package WordPress
6  */
7
8 /**
9  * Defines initial WordPress constants
10  *
11  * @see wp_debug_mode()
12  *
13  * @since 3.0.0
14  */
15 function wp_initial_constants( ) {
16         global $blog_id;
17
18         // set memory limits
19         if ( !defined('WP_MEMORY_LIMIT') ) {
20                 if( is_multisite() ) {
21                         define('WP_MEMORY_LIMIT', '64M');
22                 } else {
23                         define('WP_MEMORY_LIMIT', '32M');
24                 }
25         }
26
27         /**
28          * The $blog_id global, which you can change in the config allows you to create a simple
29          * multiple blog installation using just one WordPress and changing $blog_id around.
30          *
31          * @global int $blog_id
32          * @since 2.0.0
33          */
34         if ( ! isset($blog_id) )
35                 $blog_id = 1;
36
37         // set memory limits.
38         if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) )
39                 @ini_set('memory_limit', WP_MEMORY_LIMIT);
40
41         if ( !defined('WP_CONTENT_DIR') )
42                 define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down
43
44         // Add define('WP_DEBUG', true); to wp-config.php to enable display of notices during development.
45         if ( !defined('WP_DEBUG') )
46                 define( 'WP_DEBUG', false );
47
48         // Add define('WP_DEBUG_DISPLAY', false); to wp-config.php use the globally configured setting for display_errors and not force errors to be displayed.
49         if ( !defined('WP_DEBUG_DISPLAY') )
50                 define( 'WP_DEBUG_DISPLAY', true );
51
52         // Add define('WP_DEBUG_LOG', true); to enable error logging to wp-content/debug.log.
53         if ( !defined('WP_DEBUG_LOG') )
54                 define('WP_DEBUG_LOG', false);
55
56         if ( !defined('WP_CACHE') )
57                 define('WP_CACHE', false);
58
59         /**
60          * Private
61          */
62         if ( !defined('MEDIA_TRASH') )
63                 define('MEDIA_TRASH', false);
64
65         if ( !defined('SHORTINIT') )
66                 define('SHORTINIT', false);
67 }
68
69 /**
70  * Defines plugin directory WordPress constants
71  *
72  * Defines must-use plugin directory constants, which may be overridden in the sunrise.php drop-in
73  *
74  * @since 3.0.0
75  */
76 function wp_plugin_directory_constants( ) {
77         if ( !defined('WP_CONTENT_URL') )
78                 define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up
79
80         /**
81          * Allows for the plugins directory to be moved from the default location.
82          *
83          * @since 2.6.0
84          */
85         if ( !defined('WP_PLUGIN_DIR') )
86                 define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash
87
88         /**
89          * Allows for the plugins directory to be moved from the default location.
90          *
91          * @since 2.6.0
92          */
93         if ( !defined('WP_PLUGIN_URL') )
94                 define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // full url, no trailing slash
95
96         /**
97          * Allows for the plugins directory to be moved from the default location.
98          *
99          * @since 2.1.0
100          * @deprecated
101          */
102         if ( !defined('PLUGINDIR') )
103                 define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH.  For back compat.
104
105         /**
106          * Allows for the mu-plugins directory to be moved from the default location.
107          *
108          * @since 2.8.0
109          */
110         if ( !defined('WPMU_PLUGIN_DIR') )
111                 define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // full path, no trailing slash
112
113         /**
114          * Allows for the mu-plugins directory to be moved from the default location.
115          *
116          * @since 2.8.0
117          */
118         if ( !defined('WPMU_PLUGIN_URL') )
119                 define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); // full url, no trailing slash
120
121         /**
122          * Allows for the mu-plugins directory to be moved from the default location.
123          *
124          * @since 2.8.0
125          * @deprecated
126          */
127         if ( !defined( 'MUPLUGINDIR' ) )
128                 define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH.  For back compat.
129 }
130
131 /**
132  * Defines cookie related WordPress constants
133  *
134  * Defines constants after multisite is loaded. Cookie-related constants may be overridden in ms_network_cookies().
135  * @since 3.0.0
136  */
137 function wp_cookie_constants( ) {
138         global $wp_default_secret_key;
139
140         /**
141          * Used to guarantee unique hash cookies
142          * @since 1.5
143          */
144         if ( !defined( 'COOKIEHASH' ) ) {
145                 $siteurl = get_site_option( 'siteurl' );
146                 if ( $siteurl )
147                         define( 'COOKIEHASH', md5( $siteurl ) );
148                 else
149                         define( 'COOKIEHASH', '' );
150         }
151
152         /**
153          * Should be exactly the same as the default value of SECRET_KEY in wp-config-sample.php
154          * @since 2.5.0
155          */
156         $wp_default_secret_key = 'put your unique phrase here';
157
158         /**
159          * @since 2.0.0
160          */
161         if ( !defined('USER_COOKIE') )
162                 define('USER_COOKIE', 'wordpressuser_' . COOKIEHASH);
163
164         /**
165          * @since 2.0.0
166          */
167         if ( !defined('PASS_COOKIE') )
168                 define('PASS_COOKIE', 'wordpresspass_' . COOKIEHASH);
169
170         /**
171          * @since 2.5.0
172          */
173         if ( !defined('AUTH_COOKIE') )
174                 define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH);
175
176         /**
177          * @since 2.6.0
178          */
179         if ( !defined('SECURE_AUTH_COOKIE') )
180                 define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH);
181
182         /**
183          * @since 2.6.0
184          */
185         if ( !defined('LOGGED_IN_COOKIE') )
186                 define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH);
187
188         /**
189          * @since 2.3.0
190          */
191         if ( !defined('TEST_COOKIE') )
192                 define('TEST_COOKIE', 'wordpress_test_cookie');
193
194         /**
195          * @since 1.2.0
196          */
197         if ( !defined('COOKIEPATH') )
198                 define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) );
199
200         /**
201          * @since 1.5.0
202          */
203         if ( !defined('SITECOOKIEPATH') )
204                 define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) );
205
206         /**
207          * @since 2.6.0
208          */
209         if ( !defined('ADMIN_COOKIE_PATH') )
210                 define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
211
212         /**
213          * @since 2.6.0
214          */
215         if ( !defined('PLUGINS_COOKIE_PATH') )
216                 define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL)  );
217
218         /**
219          * @since 2.0.0
220          */
221         if ( !defined('COOKIE_DOMAIN') )
222                 define('COOKIE_DOMAIN', false);
223 }
224
225 /**
226  * Defines cookie related WordPress constants
227  *
228  * @since 3.0.0
229  */
230 function wp_ssl_constants( ) {
231         /**
232          * @since 2.6.0
233          */
234         if ( !defined('FORCE_SSL_ADMIN') )
235                 define('FORCE_SSL_ADMIN', false);
236         force_ssl_admin(FORCE_SSL_ADMIN);
237
238         /**
239          * @since 2.6.0
240          */
241         if ( !defined('FORCE_SSL_LOGIN') )
242                 define('FORCE_SSL_LOGIN', false);
243         force_ssl_login(FORCE_SSL_LOGIN);
244 }
245
246 /**
247  * Defines functionality related WordPress constants
248  *
249  * @since 3.0.0
250  */
251 function wp_functionality_constants( ) {
252         /**
253          * @since 2.5.0
254          */
255         if ( !defined( 'AUTOSAVE_INTERVAL' ) )
256                 define( 'AUTOSAVE_INTERVAL', 60 );
257
258         /**
259          * @since 2.9.0
260          */
261         if ( !defined( 'EMPTY_TRASH_DAYS' ) )
262                 define( 'EMPTY_TRASH_DAYS', 30 );
263
264         if ( !defined('WP_POST_REVISIONS') )
265                 define('WP_POST_REVISIONS', true);
266 }
267
268 /**
269  * Defines templating related WordPress constants
270  *
271  * @since 3.0.0
272  */
273 function wp_templating_constants( ) {
274         /**
275          * Web Path to the current active template directory
276          * @since 1.5.0
277          */
278         define('TEMPLATEPATH', get_template_directory());
279
280         /**
281          * Web Path to the current active template stylesheet directory
282          * @since 2.1.0
283          */
284         define('STYLESHEETPATH', get_stylesheet_directory());
285
286         /**
287          * Slug of the default theme for this install.
288          * Used as the default theme when installing new sites.
289          * Will be used as the fallback if the current theme doesn't exist.
290          * @since 3.0.0
291          */
292         if ( !defined('WP_DEFAULT_THEME') )
293                 define( 'WP_DEFAULT_THEME', 'twentyten' );
294
295 }
296
297 ?>