[ XREF Home ] [ Index ]

PHP Cross Reference of WordPress Trunk

Provided by Yoast

title

Body

[close]

/wp-includes/ -> default-constants.php (source)

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


Generated: Wed Jun 1 08:30:02 2011 Cross-referenced by PHPXref 0.7
Provided by Yoast and awesome WordPress Hosting