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