PageRenderTime 43ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/df_home/static/test/portalbkd/wp-includes/ms-default-constants.php

https://gitlab.com/darmawan.fatria/df-skp-2014
PHP | 153 lines | 73 code | 17 blank | 63 comment | 27 complexity | 4e4d93eda2a8c01c8ad639f18862fc25 MD5 | raw file
  1. <?php
  2. /**
  3. * Defines constants and global variables that can be overridden, generally in wp-config.php.
  4. *
  5. * @package WordPress
  6. * @subpackage Multisite
  7. * @since 3.0.0
  8. */
  9. /**
  10. * Defines Multisite upload constants.
  11. *
  12. * Exists for backward compatibility with legacy file-serving through
  13. * wp-includes/ms-files.php (wp-content/blogs.php in MU).
  14. *
  15. * @since 3.0.0
  16. */
  17. function ms_upload_constants() {
  18. global $wpdb;
  19. // This filter is attached in ms-default-filters.php but that file is not included during SHORTINIT.
  20. add_filter( 'default_site_option_ms_files_rewriting', '__return_true' );
  21. if ( ! get_site_option( 'ms_files_rewriting' ) )
  22. return;
  23. // Base uploads dir relative to ABSPATH
  24. if ( !defined( 'UPLOADBLOGSDIR' ) )
  25. define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' );
  26. // Note, the main site in a post-MU network uses wp-content/uploads.
  27. // This is handled in wp_upload_dir() by ignoring UPLOADS for this case.
  28. if ( ! defined( 'UPLOADS' ) ) {
  29. define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" );
  30. // Uploads dir relative to ABSPATH
  31. if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) )
  32. define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" );
  33. }
  34. }
  35. /**
  36. * Defines Multisite cookie constants.
  37. *
  38. * @since 3.0.0
  39. */
  40. function ms_cookie_constants( ) {
  41. $current_site = get_current_site();
  42. /**
  43. * @since 1.2.0
  44. */
  45. if ( !defined( 'COOKIEPATH' ) )
  46. define( 'COOKIEPATH', $current_site->path );
  47. /**
  48. * @since 1.5.0
  49. */
  50. if ( !defined( 'SITECOOKIEPATH' ) )
  51. define( 'SITECOOKIEPATH', $current_site->path );
  52. /**
  53. * @since 2.6.0
  54. */
  55. if ( !defined( 'ADMIN_COOKIE_PATH' ) ) {
  56. if ( ! is_subdomain_install() || trim( parse_url( get_option( 'siteurl' ), PHP_URL_PATH ), '/' ) ) {
  57. define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH );
  58. } else {
  59. define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
  60. }
  61. }
  62. /**
  63. * @since 2.0.0
  64. */
  65. if ( !defined('COOKIE_DOMAIN') && is_subdomain_install() ) {
  66. if ( !empty( $current_site->cookie_domain ) )
  67. define('COOKIE_DOMAIN', '.' . $current_site->cookie_domain);
  68. else
  69. define('COOKIE_DOMAIN', '.' . $current_site->domain);
  70. }
  71. }
  72. /**
  73. * Defines Multisite file constants.
  74. *
  75. * Exists for backward compatibility with legacy file-serving through
  76. * wp-includes/ms-files.php (wp-content/blogs.php in MU).
  77. *
  78. * @since 3.0.0
  79. */
  80. function ms_file_constants() {
  81. /**
  82. * Optional support for X-Sendfile header
  83. * @since 3.0.0
  84. */
  85. if ( !defined( 'WPMU_SENDFILE' ) )
  86. define( 'WPMU_SENDFILE', false );
  87. /**
  88. * Optional support for X-Accel-Redirect header
  89. * @since 3.0.0
  90. */
  91. if ( !defined( 'WPMU_ACCEL_REDIRECT' ) )
  92. define( 'WPMU_ACCEL_REDIRECT', false );
  93. }
  94. /**
  95. * Defines Multisite subdomain constants and handles warnings and notices.
  96. *
  97. * VHOST is deprecated in favor of SUBDOMAIN_INSTALL, which is a bool.
  98. *
  99. * On first call, the constants are checked and defined. On second call,
  100. * we will have translations loaded and can trigger warnings easily.
  101. *
  102. * @since 3.0.0
  103. */
  104. function ms_subdomain_constants() {
  105. static $subdomain_error = null;
  106. static $subdomain_error_warn = null;
  107. if ( false === $subdomain_error ) {
  108. return;
  109. }
  110. if ( $subdomain_error ) {
  111. $vhost_deprecated = __( 'The constant <code>VHOST</code> <strong>is deprecated</strong>. Use the boolean constant <code>SUBDOMAIN_INSTALL</code> in wp-config.php to enable a subdomain configuration. Use is_subdomain_install() to check whether a subdomain configuration is enabled.' );
  112. if ( $subdomain_error_warn ) {
  113. trigger_error( __( '<strong>Conflicting values for the constants VHOST and SUBDOMAIN_INSTALL.</strong> The value of SUBDOMAIN_INSTALL will be assumed to be your subdomain configuration setting.' ) . ' ' . $vhost_deprecated, E_USER_WARNING );
  114. } else {
  115. _deprecated_argument( 'define()', '3.0', $vhost_deprecated );
  116. }
  117. return;
  118. }
  119. if ( defined( 'SUBDOMAIN_INSTALL' ) && defined( 'VHOST' ) ) {
  120. $subdomain_error = true;
  121. if ( SUBDOMAIN_INSTALL !== ( 'yes' == VHOST ) ) {
  122. $subdomain_error_warn = true;
  123. }
  124. } elseif ( defined( 'SUBDOMAIN_INSTALL' ) ) {
  125. $subdomain_error = false;
  126. define( 'VHOST', SUBDOMAIN_INSTALL ? 'yes' : 'no' );
  127. } elseif ( defined( 'VHOST' ) ) {
  128. $subdomain_error = true;
  129. define( 'SUBDOMAIN_INSTALL', 'yes' == VHOST );
  130. } else {
  131. $subdomain_error = false;
  132. define( 'SUBDOMAIN_INSTALL', false );
  133. define( 'VHOST', 'no' );
  134. }
  135. }
  136. add_action( 'init', 'ms_subdomain_constants' );