WordPress 3.0 beta 1 documentation kindly provided to you by Hay Kranen
| [ Index ] |
PHP Cross Reference of WordPress 3.0 beta 1 |
|
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * These functions are needed to load WordPress. 4 * 5 * @package WordPress 6 */ 7 8 /** 9 * Turn register globals off. 10 * 11 * @access private 12 * @since 2.1.0 13 * @return null Will return null if register_globals PHP directive was disabled 14 */ 15 function wp_unregister_GLOBALS() { 16 if ( !ini_get( 'register_globals' ) ) 17 return; 18 19 if ( isset( $_REQUEST['GLOBALS'] ) ) 20 die( /*WP_I18N_GLOBALS_OVERWRITE*/'GLOBALS overwrite attempt detected'/*/WP_I18N_GLOBALS_OVERWRITE*/ ); 21 22 // Variables that shouldn't be unset 23 $no_unset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix' ); 24 25 $input = array_merge( $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset( $_SESSION ) && is_array( $_SESSION ) ? $_SESSION : array() ); 26 foreach ( $input as $k => $v ) 27 if ( !in_array( $k, $no_unset ) && isset( $GLOBALS[$k] ) ) { 28 $GLOBALS[$k] = null; 29 unset( $GLOBALS[$k] ); 30 } 31 } 32 33 /** 34 * Fix $_SERVER variables for various setups. 35 * 36 * @access private 37 * @since 3.0.0 38 */ 39 function wp_fix_server_vars() { 40 global $PHP_SELF; 41 42 $default_server_values = array( 43 'SERVER_SOFTWARE' => '', 44 'REQUEST_URI' => '', 45 ); 46 47 $_SERVER = array_merge( $default_server_values, $_SERVER ); 48 49 // Fix for IIS when running with PHP ISAPI 50 if ( empty( $_SERVER['REQUEST_URI'] ) || ( php_sapi_name() != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) { 51 52 // IIS Mod-Rewrite 53 if ( isset( $_SERVER['HTTP_X_ORIGINAL_URL'] ) ) { 54 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL']; 55 } 56 // IIS Isapi_Rewrite 57 else if ( isset( $_SERVER['HTTP_X_REWRITE_URL'] ) ) { 58 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL']; 59 } else { 60 // Use ORIG_PATH_INFO if there is no PATH_INFO 61 if ( !isset( $_SERVER['PATH_INFO'] ) && isset( $_SERVER['ORIG_PATH_INFO'] ) ) 62 $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO']; 63 64 // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice) 65 if ( isset( $_SERVER['PATH_INFO'] ) ) { 66 if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] ) 67 $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO']; 68 else 69 $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO']; 70 } 71 72 // Append the query string if it exists and isn't null 73 if ( ! empty( $_SERVER['QUERY_STRING'] ) ) { 74 $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; 75 } 76 } 77 } 78 79 // Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests 80 if ( isset( $_SERVER['SCRIPT_FILENAME'] ) && ( strpos( $_SERVER['SCRIPT_FILENAME'], 'php.cgi' ) == strlen( $_SERVER['SCRIPT_FILENAME'] ) - 7 ) ) 81 $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED']; 82 83 // Fix for Dreamhost and other PHP as CGI hosts 84 if ( strpos( $_SERVER['SCRIPT_NAME'], 'php.cgi' ) !== false ) 85 unset( $_SERVER['PATH_INFO'] ); 86 87 // Fix empty PHP_SELF 88 $PHP_SELF = $_SERVER['PHP_SELF']; 89 if ( empty( $PHP_SELF ) ) 90 $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace( '/(\?.*)?$/', '', $_SERVER["REQUEST_URI"] ); 91 } 92 93 /** 94 * Check for the required PHP version, and the MySQL extension or a database drop-in. 95 * 96 * Dies if requirements are not met. 97 * 98 * @access private 99 * @since 3.0.0 100 */ 101 function wp_check_php_mysql_versions() { 102 // we can probably extend this function to check if wp_die() exists then use translated strings, and then use it in install.php etc. 103 104 global $required_php_version, $wp_version; 105 $php_version = phpversion(); 106 if ( version_compare( $required_php_version, $php_version, '>' ) ) 107 die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %1$s but WordPress %2%s requires at least %2%s.'/*/WP_I18N_OLD_PHP*/, $php_version, $wp_version, $required_php_version ) ); 108 109 if ( !extension_loaded( 'mysql' ) && !file_exists( WP_CONTENT_DIR . '/db.php' ) ) 110 die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ ); 111 } 112 113 /** 114 * Don't load all of WordPress when handling a favicon.ico request. 115 * Instead, send the headers for a zero-length favicon and bail. 116 * 117 * @since 3.0.0 118 */ 119 function wp_favicon_request() { 120 if ( '/favicon.ico' == $_SERVER['REQUEST_URI'] ) { 121 header('Content-Type: image/vnd.microsoft.icon'); 122 header('Content-Length: 0'); 123 exit; 124 } 125 } 126 127 /** 128 * Dies with a maintenance message when conditions are met. 129 * 130 * Checks for a file in the WordPress root directory named ".maintenance". 131 * This file will contain the variable $upgrading, set to the time the file 132 * was created. If the file was created less than 10 minutes ago, WordPress 133 * enters maintenance mode and displays a message. 134 * 135 * The default message can be replaced by using a drop-in (maintenance.php in 136 * the wp-content directory). 137 * 138 * @access private 139 * @since 3.0.0 140 */ 141 function wp_maintenance() { 142 if ( !file_exists( ABSPATH . '.maintenance' ) || defined( 'WP_INSTALLING' ) ) 143 return; 144 145 include( ABSPATH . '.maintenance' ); 146 // If the $upgrading timestamp is older than 10 minutes, don't die. 147 if ( ( time() - $upgrading ) >= 600 ) 148 return; 149 150 if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) { 151 require_once( WP_CONTENT_DIR . '/maintenance.php' ); 152 die(); 153 } 154 155 $protocol = $_SERVER["SERVER_PROTOCOL"]; 156 if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol ) 157 $protocol = 'HTTP/1.0'; 158 header( "$protocol 503 Service Unavailable", true, 503 ); 159 header( 'Content-Type: text/html; charset=utf-8' ); 160 header( 'Retry-After: 600' ); 161 ?> 162 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 163 <html xmlns="http://www.w3.org/1999/xhtml"> 164 <head> 165 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 166 <title><?php echo /*WP_I18N_MAINTENANCE*/'Maintenance'/*/WP_I18N_MAINTENANCE*/; ?></title> 167 168 </head> 169 <body> 170 <h1><?php echo /*WP_I18N_MAINT_MSG*/'Briefly unavailable for scheduled maintenance. Check back in a minute.'/*/WP_I18N_MAINT_MSG*/; ?></h1> 171 </body> 172 </html> 173 <?php 174 die(); 175 } 176 177 /** 178 * PHP 4 standard microtime start capture. 179 * 180 * @access private 181 * @since 0.71 182 * @global int $timestart Seconds and Microseconds added together from when function is called. 183 * @return bool Always returns true. 184 */ 185 function timer_start() { 186 global $timestart; 187 $mtime = explode( ' ', microtime() ); 188 $timestart = $mtime[1] + $mtime[0]; 189 return true; 190 } 191 192 /** 193 * Return and/or display the time from the page start to when function is called. 194 * 195 * You can get the results and print them by doing: 196 * <code> 197 * $nTimePageTookToExecute = timer_stop(); 198 * echo $nTimePageTookToExecute; 199 * </code> 200 * 201 * Or instead, you can do: 202 * <code> 203 * timer_stop(1); 204 * </code> 205 * which will do what the above does. If you need the result, you can assign it to a variable, but 206 * most cases, you only need to echo it. 207 * 208 * @since 0.71 209 * @global int $timestart Seconds and Microseconds added together from when timer_start() is called 210 * @global int $timeend Seconds and Microseconds added together from when function is called 211 * 212 * @param int $display Use '0' or null to not echo anything and 1 to echo the total time 213 * @param int $precision The amount of digits from the right of the decimal to display. Default is 3. 214 * @return float The "second.microsecond" finished time calculation 215 */ 216 function timer_stop( $display = 0, $precision = 3 ) { // if called like timer_stop(1), will echo $timetotal 217 global $timestart, $timeend; 218 $mtime = microtime(); 219 $mtime = explode( ' ', $mtime ); 220 $timeend = $mtime[1] + $mtime[0]; 221 $timetotal = $timeend - $timestart; 222 $r = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision ); 223 if ( $display ) 224 echo $r; 225 return $r; 226 } 227 228 /** 229 * Sets PHP error handling and handles WordPress debug mode. 230 * 231 * Uses three constants: WP_DEBUG, WP_DEBUG_DISPLAY, and WP_DEBUG_LOG. All three can be 232 * defined in wp-config.php. Example: <code> define( 'WP_DEBUG', true ); </code> 233 * 234 * WP_DEBUG_DISPLAY and WP_DEBUG_LOG perform no function unless WP_DEBUG is true. 235 * WP_DEBUG defaults to false. 236 * 237 * When WP_DEBUG is true, all PHP notices are reported. WordPress will also display 238 * notices, including one when a deprecated WordPress function, function argument, 239 * or file is used. Deprecated code may be removed from a later version. 240 * 241 * It is strongly recommended that plugin and theme developers use WP_DEBUG in their 242 * development environments. 243 * 244 * When WP_DEBUG_DISPLAY is true, WordPress will force errors to be displayed. 245 * WP_DEBUG_DISPLAY defaults to true. Defining it as false prevents WordPress from 246 * changing the global configuration setting. (Defining WP_DEBUG_DISPLAY as false 247 * will never force errors to be hidden.) 248 * 249 * When WP_DEBUG_LOG is true, errors will be logged to wp-content/debug.log. 250 * WP_DEBUG_LOG defaults to false. 251 * 252 * @access private 253 * @since 3.0.0 254 */ 255 function wp_debug_mode() { 256 if ( WP_DEBUG ) { 257 if ( defined( 'E_DEPRECATED' ) ) 258 error_reporting( E_ALL & ~E_DEPRECATED & ~E_STRICT ); 259 else 260 error_reporting( E_ALL ); 261 262 if ( WP_DEBUG_DISPLAY ) 263 ini_set( 'display_errors', 1 ); 264 265 if ( WP_DEBUG_LOG ) { 266 ini_set( 'log_errors', 1 ); 267 ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' ); 268 } 269 } else { 270 if ( defined( 'E_RECOVERABLE_ERROR' ) ) 271 error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); 272 else 273 error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING ); 274 } 275 } 276 277 /** 278 * Sets the location of the language directory. 279 * 280 * To set directory manually, define <code>WP_LANG_DIR</code> in wp-config.php. 281 * 282 * First looks for language folder in WP_CONTENT_DIR and uses that folder if it 283 * exists. Or it uses the "languages" folder in WPINC. 284 * 285 * The WP_LANG_DIR constant was introduced in 2.1.0. 286 * 287 * @access private 288 * @since 3.0.0 289 */ 290 function wp_set_lang_dir() { 291 if ( !defined( 'WP_LANG_DIR' ) ) { 292 if ( file_exists( WP_CONTENT_DIR . '/languages' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) ) { 293 define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' ); // no leading slash, no trailing slash, full path, not relative to ABSPATH 294 if ( !defined( 'LANGDIR' ) ) { 295 // Old static relative path maintained for limited backwards compatibility - won't work in some cases 296 define( 'LANGDIR', 'wp-content/languages' ); 297 } 298 } else { 299 define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' ); // no leading slash, no trailing slash, full path, not relative to ABSPATH 300 if ( !defined( 'LANGDIR' ) ) { 301 // Old relative path maintained for backwards compatibility 302 define( 'LANGDIR', WPINC . '/languages' ); 303 } 304 } 305 } 306 } 307 308 /** 309 * Sets the database table prefix and the format specifiers for database table columns. 310 * 311 * Columns not listed here default to %s. 312 * 313 * @see wpdb::$field_types Since 2.8.0 314 * @see wpdb::prepare() 315 * @see wpdb::insert() 316 * @see wpdb::update() 317 * @see wpdb::set_prefix() 318 * 319 * @access private 320 * @since 3.0.0 321 */ 322 function wp_set_wpdb_vars() { 323 global $wpdb, $table_prefix; 324 if ( !empty( $wpdb->error ) ) 325 dead_db(); 326 327 $wpdb->field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d', 328 'parent' => '%d', 'count' => '%d','object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'commment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d', 329 'user_id' => '%d', 'link_id' => '%d', 'link_owner' => '%d', 'link_rating' => '%d', 'option_id' => '%d', 'blog_id' => '%d', 'meta_id' => '%d', 'post_id' => '%d', 330 'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d', 331 // multisite: 332 'active' => '%d', 'cat_id' => '%d', 'deleted' => '%d', 'lang_id' => '%d', 'mature' => '%d', 'public' => '%d', 'site_id' => '%d', 'spam' => '%d', 333 ); 334 335 $prefix = $wpdb->set_prefix( $table_prefix ); 336 337 if ( is_wp_error( $prefix ) ) 338 wp_die( /*WP_I18N_BAD_PREFIX*/'<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.'/*/WP_I18N_BAD_PREFIX*/ ); 339 } 340 341 /** 342 * Starts the WordPress object cache. 343 * 344 * If an object-cache.php file exists in the wp-content directory, 345 * it uses that drop-in as an external object cache. 346 * 347 * @access private 348 * @since 3.0.0 349 */ 350 function wp_start_object_cache() { 351 $first_init = false; 352 if ( ! function_exists( 'wp_cache_init' ) ) { 353 global $_wp_using_ext_object_cache; 354 if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { 355 require_once ( WP_CONTENT_DIR . '/object-cache.php' ); 356 $_wp_using_ext_object_cache = true; 357 } else { 358 require_once ( ABSPATH . WPINC . '/cache.php' ); 359 $_wp_using_ext_object_cache = false; 360 } 361 $first_init = true; 362 } 363 364 // If cache supports reset, reset instead of init if already initialized. 365 // Reset signals to the cache that global IDs have changed and it may need to update keys 366 // and cleanup caches. 367 if ( !$first_init && function_exists('wp_cache_reset') ) 368 wp_cache_reset(); 369 else 370 wp_cache_init(); 371 372 if ( function_exists( 'wp_cache_add_global_groups' ) ) { 373 wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss' ) ); 374 wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) ); 375 } 376 } 377 378 /** 379 * Redirects to the installer if WordPress is not installed. 380 * 381 * Dies with an error message when multisite is enabled. 382 * 383 * @access private 384 * @since 3.0.0 385 */ 386 function wp_not_installed() { 387 if ( is_multisite() ) { 388 if ( ! is_blog_installed() && ! defined( 'WP_INSTALLING' ) ) 389 wp_die( __( 'The blog you have requested is not installed properly. Please contact the system administrator.' ) ); 390 } elseif ( ! is_blog_installed() && false === strpos( $_SERVER['PHP_SELF'], 'install.php' ) && !defined( 'WP_INSTALLING' ) ) { 391 if ( defined( 'WP_SITEURL' ) ) 392 $link = WP_SITEURL . '/wp-admin/install.php'; 393 elseif ( false !== strpos( $_SERVER['PHP_SELF'], 'wp-admin' ) ) 394 $link = preg_replace( '|/wp-admin/?.*?$|', '/', $_SERVER['PHP_SELF'] ) . 'wp-admin/install.php'; 395 else 396 $link = preg_replace( '|/[^/]+?$|', '/', $_SERVER['PHP_SELF'] ) . 'wp-admin/install.php'; 397 require ( ABSPATH . WPINC . '/kses.php' ); 398 require ( ABSPATH . WPINC . '/pluggable.php' ); 399 require ( ABSPATH . WPINC . '/formatting.php' ); 400 wp_redirect( $link ); 401 die(); 402 } 403 } 404 405 /** 406 * Returns array of must-use plugin files to be included in global scope. 407 * 408 * The default directory is wp-content/mu-plugins. To change the default directory 409 * manually, define <code>WPMU_PLUGIN_DIR</code> and <code>WPMU_PLUGIN_URL</code> 410 * in wp-config.php. 411 * 412 * @access private 413 * @since 3.0.0 414 * @return array Files to include 415 */ 416 function wp_get_mu_plugins() { 417 $mu_plugins = array(); 418 if ( !is_dir( WPMU_PLUGIN_DIR ) ) 419 return $mu_plugins; 420 if ( ! $dh = opendir( WPMU_PLUGIN_DIR ) ) 421 return $mu_plugins; 422 while ( ( $plugin = readdir( $dh ) ) !== false ) { 423 if ( substr( $plugin, -4 ) == '.php' ) 424 $mu_plugins[] = WPMU_PLUGIN_DIR . '/' . $plugin; 425 } 426 closedir( $dh ); 427 sort( $mu_plugins ); 428 429 return $mu_plugins; 430 } 431 432 /** 433 * Returns array of plugin files to be included in global scope. 434 * 435 * The default directory is wp-content/plugins. To change the default directory 436 * manually, define <code>WP_PLUGIN_DIR</code> and <code>WP_PLUGIN_URL</code> 437 * in wp-config.php. 438 * 439 * @access private 440 * @since 3.0.0 441 * @return array Files to include 442 */ 443 function wp_get_active_and_valid_plugins() { 444 $plugins = array(); 445 $active_plugins = (array) get_option( 'active_plugins', array() ); 446 447 // Get active network plugins 448 if ( is_multisite() ) { 449 $active_sitewide_plugins = (array) get_site_option( 'active_sitewide_plugins', array() ); 450 if ( !empty($active_sitewide_plugins) ) { 451 $active_plugins = array_merge( $active_plugins, array_keys( $active_sitewide_plugins ) ); 452 sort( $active_plugins ); 453 } 454 } 455 456 // Check for hacks file if the option is enabled 457 if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) { 458 _deprecated_file( 'my-hacks.php', '1.5' ); 459 array_unshift( $plugins, ABSPATH . 'my-hacks.php' ); 460 } 461 462 if ( empty( $active_plugins ) || defined( 'WP_INSTALLING' ) ) 463 return $plugins; 464 465 foreach ( $active_plugins as $plugin ) { 466 if ( ! validate_file( $plugin ) // $plugin must validate as file 467 && '.php' == substr( $plugin, -4 ) // $plugin must end with '.php' 468 && file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist 469 ) 470 $plugins[] = WP_PLUGIN_DIR . '/' . $plugin; 471 } 472 return $plugins; 473 } 474 475 /** 476 * Sets internal encoding using mb_internal_encoding(). 477 * 478 * In most cases the default internal encoding is latin1, which is of no use, 479 * since we want to use the mb_ functions for utf-8 strings. 480 * 481 * @access private 482 * @since 3.0.0 483 */ 484 function wp_set_internal_encoding() { 485 if ( function_exists( 'mb_internal_encoding' ) ) { 486 if ( !@mb_internal_encoding( get_option( 'blog_charset' ) ) ) 487 mb_internal_encoding( 'UTF-8' ); 488 } 489 } 490 491 /** 492 * Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER. 493 * 494 * Also forces $_REQUEST to be $_GET + $_POST. If $_SERVER, $_COOKIE, 495 * or $_ENV are needed, use those superglobals directly. 496 * 497 * @access private 498 * @since 3.0.0 499 */ 500 function wp_magic_quotes() { 501 // If already slashed, strip. 502 if ( get_magic_quotes_gpc() ) { 503 $_GET = stripslashes_deep( $_GET ); 504 $_POST = stripslashes_deep( $_POST ); 505 $_COOKIE = stripslashes_deep( $_COOKIE ); 506 } 507 508 // Escape with wpdb. 509 $_GET = add_magic_quotes( $_GET ); 510 $_POST = add_magic_quotes( $_POST ); 511 $_COOKIE = add_magic_quotes( $_COOKIE ); 512 $_SERVER = add_magic_quotes( $_SERVER ); 513 514 // Force REQUEST to be GET + POST. 515 $_REQUEST = array_merge( $_GET, $_POST ); 516 } 517 518 /** 519 * Runs just before PHP shuts down execution. 520 * 521 * @access private 522 * @since 1.2.0 523 */ 524 function shutdown_action_hook() { 525 do_action( 'shutdown' ); 526 wp_cache_close(); 527 } 528 529 /** 530 * Copy an object. 531 * 532 * Returns a cloned copy of an object. 533 * 534 * @since 2.7.0 535 * 536 * @param object $object The object to clone 537 * @return object The cloned object 538 */ 539 function wp_clone( $object ) { 540 static $can_clone; 541 if ( !isset( $can_clone ) ) 542 $can_clone = version_compare( phpversion(), '5.0', '>=' ); 543 544 return $can_clone ? clone( $object ) : $object; 545 } 546 547 /** 548 * Whether the current request is in WordPress admin Panel 549 * 550 * Does not inform on whether the user is an admin! Use capability checks to 551 * tell if the user should be accessing a section or not. 552 * 553 * @since 1.5.1 554 * 555 * @return bool True if inside WordPress administration pages. 556 */ 557 function is_admin() { 558 if ( defined( 'WP_ADMIN' ) ) 559 return WP_ADMIN; 560 return false; 561 } 562 563 /** 564 * Whether Multisite support is enabled 565 * 566 * @since 3.0.0 567 * 568 * @return bool True if multisite is enabled, false otherwise. 569 */ 570 function is_multisite() { 571 if ( ( defined( 'MULTISITE' ) && MULTISITE ) || defined( 'VHOST' ) || defined( 'SUNRISE' ) ) 572 return true; 573 574 return false; 575 } 576 577 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Apr 5 14:26:09 2010 | Cross-referenced by PHPXref 0.7 |