PluginProbe
Plugin Detective – Troubleshooting Conflicts / 1.2.35
Plugin Detective – Troubleshooting Conflicts v1.2.35
1.2.35 1.2.33 1.2.32 1.2.31 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2 1.2.1 1.2.10 1.2.12 1.2.13 1.2.14 1.2.16 1.2.19 1.2.20 1.2.22 1.2.23 1.2.24 All 54 releases
← All changes | troubleshoot/includes/class-constants.php +328 -310 1.1.5 → 1.2.35 View file →
@@ -1,310 +1,328 @@
1 -<?php
2 -/**
3 - * Troubleshoot Constants.
4 - *
5 - * @since 0.0.0
6 - * @package Troubleshoot
7 - */
8 -
9 -/**
10 - * Troubleshoot Constants.
11 - *
12 - * @since 0.0.0
13 - */
14 -class PDT_Constants {
15 - /**
16 - * Parent plugin class.
17 - *
18 - * @since 0.0.0
19 - *
20 - * @var Troubleshoot
21 - */
22 - protected $plugin = null;
23 -
24 - /**
25 - * Constructor.
26 - *
27 - * @since 0.0.0
28 - *
29 - * @param Troubleshoot $plugin Main plugin object.
30 - */
31 - public function __construct( $plugin ) {
32 - $this->plugin = $plugin;
33 - $this->define_constants();
34 - }
35 -
36 - public function define_constants() {
37 - // Define the directory seperator if it isn't already
38 - if( !defined( 'DS' ) ) {
39 - if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
40 - define('DS', '\\');
41 - }
42 - else {
43 - define('DS', '/');
44 - }
45 - }
46 -
47 - // Include plugin-detective-config.php if it exists
48 - $path_to_pd_config = dirname( dirname( dirname ( $this->plugin->dir() ) ) ) . '/' . 'plugin-detective-config.php';
49 - if ( @file_exists( $path_to_pd_config ) ) {
50 - include_once( $path_to_pd_config );
51 - }
52 -
53 -
54 - // Define ABSPATH
55 - if ( !defined('ABSPATH') ) {
56 - $ABSPATH = dirname( dirname( dirname ( $this->plugin->dir() ) ) ) . '/';
57 -
58 - for ($i=0; $i < 3; $i++) {
59 - if ( @file_exists( $ABSPATH . 'wp-settings.php' ) ) {
60 - define('ABSPATH', $ABSPATH );
61 - break;
62 - } else if ( @file_exists( $ABSPATH . 'wp/wp-settings.php' ) ) {
63 - define('ABSPATH', $ABSPATH . 'wp/' );
64 - break;
65 - } else if ( @file_exists( $ABSPATH . 'wp-load.php' ) ) {
66 - define('ABSPATH', $ABSPATH . 'wp/' );
67 - break;
68 - } else if ( @file_exists( $ABSPATH . 'wp/wp-load.php' ) ) {
69 - define('ABSPATH', $ABSPATH . 'wp/' );
70 - break;
71 - }
72 -
73 - $ABSPATH = dirname( $ABSPATH ) . '/';
74 - }
75 -
76 - if ( !defined( 'ABSPATH' ) ) {
77 - echo '<p>It\'s possible you have an unusual directory structure, and we can\'t find the path to the root of your WordPress install.'.'</p>';
78 - echo '<p>You can tell Plugin Detective about your install by creating a config file here:</p>';
79 - echo '<pre>'. $path_to_pd_config .'</pre>';
80 - echo '<p>where you define the path to your WP install</p>';
81 - echo '<code>'. "define( 'ABSPATH', '/path/to/wordpress/install/' );" .'</code>';
82 - echo '<p>You may want to define other customized values like <code>WP_CONTENT_DIR</code>, <code>WP_CONTENT_URL</code> or other values from your wp-config.php file that are unique to your install</p>';
83 - echo '<p>Error details: <code>Couldn\'t find ABSPATH from plugin path: ' . $this->plugin->dir() . '</code></p>';
84 - echo '<style>code { color: #333; background-color: #ccc; padding: 5px; }</style>';
85 - exit();
86 - }
87 - }
88 -
89 - // Search for wp-config.php
90 - $wp_config_dir_path = ABSPATH . 'wp-config.php';
91 - if ( ! @file_exists( $wp_config_dir_path ) ) {
92 - $wp_config_dir_path = dirname( ABSPATH ) . '/' . 'wp-config.php';
93 -
94 - if ( ! @file_exists( $wp_config_dir_path ) ) {
95 - $wp_config_dir_path = ABSPATH . 'wp' . '/' . 'wp-config.php';
96 -
97 - if ( ! @file_exists( $wp_config_dir_path ) ) {
98 - die( "Unable to locate wp-config.php file: \n" . ABSPATH. 'wp-config.php' . "\n OR \n" . dirname( ABSPATH ) . '/' . 'wp-config.php' );
99 - }
100 - }
101 - }
102 -
103 -
104 - if ( isset($_ENV['PANTHEON_ENVIRONMENT']) ) {
105 - define('DB_NAME', $_ENV['DB_NAME']);
106 -
107 - /** MySQL database username */
108 - define('DB_USER', $_ENV['DB_USER']);
109 -
110 - /** MySQL database password */
111 - define('DB_PASSWORD', $_ENV['DB_PASSWORD']);
112 -
113 - /** MySQL hostname; on Pantheon this includes a specific port number. */
114 - define('DB_HOST', $_ENV['DB_HOST'] . ':' . $_ENV['DB_PORT']);
115 - }
116 -
117 - $config_files = array(
118 - dirname( $wp_config_dir_path ) . '/wp-config-local.php',
119 - dirname( $wp_config_dir_path ) . '/wp-config-hosting.php',
120 - $wp_config_dir_path,
121 - );
122 - $attempts = array(
123 - 'standard',
124 - 'normalize',
125 - );
126 - $methods = array(
127 - 'php-define',
128 - 'php-define-double-quote',
129 - 'php-unquoted',
130 - );
131 -
132 - foreach ($config_files as $key => $config_file_path) {
133 - if ( !file_exists( $config_file_path ) ) {
134 - continue;
135 - }
136 -
137 - foreach ($attempts as $key => $attempt) {
138 - if ( $attempt === 'normalize' ) {
139 - $config_file = new PDT_Config( $config_file_path, true );
140 - } else {
141 - $config_file = new PDT_Config( $config_file_path );
142 - }
143 - foreach ($methods as $key => $method) {
144 - $config_file->set_type( $method );
145 - if ( empty( $DB_USER ) ) {
146 - $DB_USER = $config_file->get_key( 'DB_USER' );
147 - }
148 - if ( empty( $DB_NAME ) ) {
149 - $DB_NAME = $config_file->get_key( 'DB_NAME' );
150 - }
151 - if ( empty( $DB_PASSWORD ) ) {
152 - $DB_PASSWORD = $config_file->get_key( 'DB_PASSWORD' );
153 - }
154 - if ( empty( $DB_HOST ) ) {
155 - $DB_HOST = $config_file->get_key( 'DB_HOST' );
156 - }
157 - if ( empty( $WP_CONTENT_DIR ) ) {
158 - $WP_CONTENT_DIR = $config_file->get_key( 'WP_CONTENT_DIR' );
159 - }
160 - if ( empty( $WP_CONTENT_URL ) ) {
161 - $WP_CONTENT_URL = $config_file->get_key( 'WP_CONTENT_URL' );
162 - }
163 -
164 - if ( !empty( $DB_USER ) ) {
165 - break;
166 - }
167 - }
168 - }
169 - }
170 -
171 - if ( empty( $DB_USER ) ) {
172 - echo '<h3>Unable to read database credentials from wp-config.php</h3>';
173 - echo '<h5>They should be formatted like this in your wp-config.php file:</h5>';
174 - echo "<pre>
175 -// ** MySQL settings - You can get this info from your web host ** //
176 -define( 'DB_NAME', 'database_name_here' );
177 -
178 -/** MySQL database username */
179 -define( 'DB_USER', 'username_here' );
180 -
181 -/** MySQL database password */
182 -define( 'DB_PASSWORD', 'password_here' );
183 -
184 -/** MySQL hostname */
185 -define( 'DB_HOST', 'localhost' );
186 -</pre>";
187 - echo '<h5>If you are still having trouble connecting, please contact us by emailing [email protected] with a copy of your file (you may want to remove any sensitive data first)</h5>';
188 - exit();
189 - }
190 -
191 - $DB_USER = str_replace( '");', '', $DB_USER );
192 - $DB_USER = ( strpos( $DB_USER, '"' ) === 0 ) ? substr( $DB_USER, 1 ) : $DB_USER;
193 - $DB_USER = str_replace( '\');', '', $DB_USER );
194 - $DB_USER = ( strpos( $DB_USER, '\'' ) === 0 ) ? substr( $DB_USER, 1 ) : $DB_USER;
195 -
196 -
197 - $DB_NAME = str_replace( '");', '', $DB_NAME );
198 - $DB_NAME = ( strpos( $DB_NAME, '"' ) === 0 ) ? substr( $DB_NAME, 1 ) : $DB_NAME;
199 - $DB_NAME = str_replace( '\');', '', $DB_NAME );
200 - $DB_NAME = ( strpos( $DB_NAME, '\'' ) === 0 ) ? substr( $DB_NAME, 1 ) : $DB_NAME;
201 -
202 -
203 - $DB_PASSWORD = str_replace( '");', '', $DB_PASSWORD );
204 - $DB_PASSWORD = ( strpos( $DB_PASSWORD, '"' ) === 0 ) ? substr( $DB_PASSWORD, 1 ) : $DB_PASSWORD;
205 - $DB_PASSWORD = str_replace( '\');', '', $DB_PASSWORD );
206 - $DB_PASSWORD = ( strpos( $DB_PASSWORD, '\'' ) === 0 ) ? substr( $DB_PASSWORD, 1 ) : $DB_PASSWORD;
207 -
208 -
209 - $DB_HOST = str_replace( '");', '', $DB_HOST );
210 - $DB_HOST = ( strpos( $DB_HOST, '"' ) === 0 ) ? substr( $DB_HOST, 1 ) : $DB_HOST;
211 - $DB_HOST = str_replace( '\');', '', $DB_HOST );
212 - $DB_HOST = ( strpos( $DB_HOST, '\'' ) === 0 ) ? substr( $DB_HOST, 1 ) : $DB_HOST;
213 -
214 - if ( !defined( 'DB_USER' ) ) {
215 - define( 'DB_USER', $DB_USER );
216 - }
217 - if ( !defined( 'DB_NAME' ) ) {
218 - define( 'DB_NAME', $DB_NAME );
219 - }
220 - if ( !defined( 'DB_PASSWORD' ) ) {
221 - define( 'DB_PASSWORD', $DB_PASSWORD );
222 - }
223 - if ( !defined( 'DB_HOST' ) ) {
224 - define( 'DB_HOST', $DB_HOST );
225 - }
226 -
227 - if ( !empty( $WP_CONTENT_DIR ) ) {
228 - define( 'WP_CONTENT_DIR', $WP_CONTENT_DIR );
229 - }
230 -
231 - if ( !empty( $WP_CONTENT_URL ) ) {
232 - define( 'WP_CONTENT_URL', $WP_CONTENT_URL );
233 - }
234 -
235 - $config_file->set_type( 'php-variable' );
236 - global $table_prefix;
237 - $table_prefix = $config_file->get_key( 'table_prefix' );
238 - $GLOBALS['table_prefix'] = $table_prefix;
239 -
240 - if ( !defined('WP_CONTENT_DIR') )
241 - define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down
242 -
243 - // Add define('WP_DEBUG', true); to wp-config.php to enable display of notices during development.
244 - if ( !defined('WP_DEBUG') )
245 - define( 'WP_DEBUG', false );
246 -
247 - // Add define('WP_DEBUG_DISPLAY', null); to wp-config.php use the globally configured setting for
248 - // display_errors and not force errors to be displayed. Use false to force display_errors off.
249 - if ( !defined('WP_DEBUG_DISPLAY') )
250 - define( 'WP_DEBUG_DISPLAY', true );
251 -
252 - // Add define('WP_DEBUG_LOG', true); to enable error logging to wp-content/debug.log.
253 - if ( !defined('WP_DEBUG_LOG') )
254 - define('WP_DEBUG_LOG', false);
255 -
256 - if ( !defined('WP_CACHE') )
257 - define('WP_CACHE', false);
258 -
259 - // Start of run timestamp.
260 - if ( ! defined( 'WP_START_TIMESTAMP' ) ) {
261 - define( 'WP_START_TIMESTAMP', microtime( true ) );
262 - }
263 -
264 - /**
265 - * Private
266 - */
267 - if ( !defined('MEDIA_TRASH') )
268 - define('MEDIA_TRASH', false);
269 -
270 - if ( !defined('SHORTINIT') )
271 - define('SHORTINIT', false);
272 -
273 - /**
274 - * Allows for the plugins directory to be moved from the default location.
275 - *
276 - * @since 2.6.0
277 - */
278 - if ( !defined('WP_PLUGIN_DIR') )
279 - define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash
280 -
281 - /**
282 - * Allows for the plugins directory to be moved from the default location.
283 - *
284 - * @since 2.1.0
285 - * @deprecated
286 - */
287 - if ( !defined('PLUGINDIR') )
288 - define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat.
289 -
290 - /**
291 - * Allows for the mu-plugins directory to be moved from the default location.
292 - *
293 - * @since 2.8.0
294 - */
295 - if ( !defined('WPMU_PLUGIN_DIR') )
296 - define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // full path, no trailing slash
297 -
298 - /**
299 - * Allows for the mu-plugins directory to be moved from the default location.
300 - *
301 - * @since 2.8.0
302 - * @deprecated
303 - */
304 - if ( !defined( 'MUPLUGINDIR' ) )
305 - define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat.
306 -
307 -
308 - }
309 -
310 -}
1 +<?php
2 +/**
3 + * Troubleshoot Constants.
4 + *
5 + * @since 0.0.0
6 + * @package Troubleshoot
7 + */
8 +
9 +/**
10 + * Troubleshoot Constants.
11 + *
12 + * @since 0.0.0
13 + */
14 +class PDT_Constants {
15 + /**
16 + * Parent plugin class.
17 + *
18 + * @since 0.0.0
19 + *
20 + * @var Troubleshoot
21 + */
22 + protected $plugin = null;
23 +
24 + /**
25 + * Constructor.
26 + *
27 + * @since 0.0.0
28 + *
29 + * @param Troubleshoot $plugin Main plugin object.
30 + */
31 + public function __construct( $plugin ) {
32 + $this->plugin = $plugin;
33 + $this->define_constants();
34 + }
35 +
36 + public function define_constants() {
37 + // Define the directory seperator if it isn't already
38 + if( !defined( 'DS' ) ) {
39 + if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
40 + define('DS', '\\');
41 + }
42 + else {
43 + define('DS', '/');
44 + }
45 + }
46 +
47 + // Include plugin-detective-config.php if it exists
48 + $path_to_pd_config = dirname( dirname( dirname ( $this->plugin->dir() ) ) ) . '/' . 'plugin-detective-config.php';
49 + if ( @file_exists( $path_to_pd_config ) ) {
50 + include_once( $path_to_pd_config );
51 + }
52 +
53 +
54 + // Define ABSPATH
55 + if ( !defined('ABSPATH') ) {
56 + $ABSPATH = dirname( dirname( dirname ( $this->plugin->dir() ) ) ) . '/';
57 +
58 + for ($i=0; $i < 3; $i++) {
59 + if ( @file_exists( $ABSPATH . 'wp-settings.php' ) ) {
60 + define('ABSPATH', $ABSPATH );
61 + break;
62 + } else if ( @file_exists( $ABSPATH . 'wp/wp-settings.php' ) ) {
63 + define('ABSPATH', $ABSPATH . 'wp/' );
64 + break;
65 + } else if ( @file_exists( $ABSPATH . 'wp-load.php' ) ) {
66 + define('ABSPATH', $ABSPATH . 'wp/' );
67 + break;
68 + } else if ( @file_exists( $ABSPATH . 'wp/wp-load.php' ) ) {
69 + define('ABSPATH', $ABSPATH . 'wp/' );
70 + break;
71 + }
72 +
73 + $ABSPATH = dirname( $ABSPATH ) . '/';
74 + }
75 +
76 + if ( !defined( 'ABSPATH' ) ) {
77 + echo '<p>It\'s possible you have an unusual directory structure, and we can\'t find the path to the root of your WordPress install.'.'</p>';
78 + echo '<p>You can tell Plugin Detective about your install by creating a config file here:</p>';
79 + echo '<pre>'. esc_html( $path_to_pd_config ) .'</pre>';
80 + echo '<p>where you define the path to your WP install</p>';
81 + echo '<code>'. "define( 'ABSPATH', '/path/to/wordpress/install/' );" .'</code>';
82 + echo '<p>You may want to define other customized values like <code>WP_CONTENT_DIR</code>, <code>WP_CONTENT_URL</code> or other values from your wp-config.php file that are unique to your install</p>';
83 + echo '<p>Error details: <code>Couldn\'t find ABSPATH from plugin path: ' . esc_html( $this->plugin->dir() ) . '</code></p>';
84 + echo '<style>code { color: #333; background-color: #ccc; padding: 5px; }</style>';
85 + exit();
86 + }
87 + }
88 +
89 + // Search for wp-config.php
90 + $wp_config_dir_path = ABSPATH . 'wp-config.php';
91 + if ( ! @file_exists( $wp_config_dir_path ) ) {
92 + $wp_config_dir_path = dirname( ABSPATH ) . '/' . 'wp-config.php';
93 +
94 + if ( ! @file_exists( $wp_config_dir_path ) ) {
95 + $wp_config_dir_path = ABSPATH . 'wp' . '/' . 'wp-config.php';
96 +
97 + if ( ! @file_exists( $wp_config_dir_path ) ) {
98 + die( esc_html( "Unable to locate wp-config.php file: \n" . ABSPATH . 'wp-config.php' . "\n OR \n" . dirname( ABSPATH ) . '/' . 'wp-config.php' ) );
99 + }
100 + }
101 + }
102 +
103 +
104 + if ( isset($_ENV['PANTHEON_ENVIRONMENT']) ) {
105 + // phpcs:disable WordPress.Security.ValidatedSanitizedInput -- Reading platform-provided database credentials from the Pantheon environment, not user input.
106 + define('DB_NAME', $_ENV['DB_NAME']);
107 +
108 + /** MySQL database username */
109 + define('DB_USER', $_ENV['DB_USER']);
110 +
111 + /** MySQL database password */
112 + define('DB_PASSWORD', $_ENV['DB_PASSWORD']);
113 +
114 + /** MySQL hostname; on Pantheon this includes a specific port number. */
115 + define('DB_HOST', $_ENV['DB_HOST'] . ':' . $_ENV['DB_PORT']);
116 + // phpcs:enable WordPress.Security.ValidatedSanitizedInput
117 + }
118 +
119 + $config_files = array(
120 + dirname( $wp_config_dir_path ) . '/wp-config-local.php',
121 + dirname( $wp_config_dir_path ) . '/wp-config-hosting.php',
122 + dirname( $wp_config_dir_path ) . '/wp-config-ddev.php',
123 + $wp_config_dir_path,
124 + );
125 + $attempts = array(
126 + 'standard',
127 + 'normalize',
128 + );
129 + $methods = array(
130 + 'php-define',
131 + 'php-define-double-quote',
132 + 'php-unquoted',
133 + );
134 +
135 + foreach ($config_files as $key => $config_file_path) {
136 + if ( !file_exists( $config_file_path ) ) {
137 + continue;
138 + }
139 +
140 + foreach ($attempts as $key => $attempt) {
141 + if ( $attempt === 'normalize' ) {
142 + $config_file = new PDT_Config( $config_file_path, true );
143 + } else {
144 + $config_file = new PDT_Config( $config_file_path );
145 + }
146 + foreach ($methods as $key => $method) {
147 + $config_file->set_type( $method );
148 + if ( empty( $DB_USER ) ) {
149 + $DB_USER = $config_file->get_key( 'DB_USER' );
150 + }
151 + if ( empty( $DB_NAME ) ) {
152 + $DB_NAME = $config_file->get_key( 'DB_NAME' );
153 + }
154 + if ( empty( $DB_PASSWORD ) ) {
155 + $DB_PASSWORD = $config_file->get_key( 'DB_PASSWORD' );
156 + }
157 + if ( empty( $DB_HOST ) ) {
158 + $DB_HOST = $config_file->get_key( 'DB_HOST' );
159 + }
160 + if ( empty( $WP_CONTENT_DIR ) ) {
161 + $WP_CONTENT_DIR = $config_file->get_key( 'WP_CONTENT_DIR' );
162 + }
163 + if ( empty( $WP_CONTENT_URL ) ) {
164 + $WP_CONTENT_URL = $config_file->get_key( 'WP_CONTENT_URL' );
165 + }
166 +
167 + if ( !empty( $DB_USER ) ) {
168 + break;
169 + }
170 + }
171 + }
172 + }
173 +
174 + if ( empty( $DB_USER ) ) {
175 + echo '<h3>Unable to read database credentials from wp-config.php</h3>';
176 + echo '<h5>They should be formatted like this in your wp-config.php file:</h5>';
177 + echo "<pre>
178 +// ** MySQL settings - You can get this info from your web host ** //
179 +define( 'DB_NAME', 'database_name_here' );
180 +
181 +/** MySQL database username */
182 +define( 'DB_USER', 'username_here' );
183 +
184 +/** MySQL database password */
185 +define( 'DB_PASSWORD', 'password_here' );
186 +
187 +/** MySQL hostname */
188 +define( 'DB_HOST', 'localhost' );
189 +</pre>";
190 + echo '<h5>If you are still having trouble connecting, please contact us by emailing [email protected] with a copy of your file (you may want to remove any sensitive data first)</h5>';
191 + exit();
192 + }
193 +
194 + $DB_USER = str_replace( '");', '', $DB_USER );
195 + $DB_USER = ( strpos( $DB_USER, '"' ) === 0 ) ? substr( $DB_USER, 1 ) : $DB_USER;
196 + $DB_USER = str_replace( '\');', '', $DB_USER );
197 + $DB_USER = ( strpos( $DB_USER, '\'' ) === 0 ) ? substr( $DB_USER, 1 ) : $DB_USER;
198 +
199 +
200 + $DB_NAME = str_replace( '");', '', $DB_NAME );
201 + $DB_NAME = ( strpos( $DB_NAME, '"' ) === 0 ) ? substr( $DB_NAME, 1 ) : $DB_NAME;
202 + $DB_NAME = str_replace( '\');', '', $DB_NAME );
203 + $DB_NAME = ( strpos( $DB_NAME, '\'' ) === 0 ) ? substr( $DB_NAME, 1 ) : $DB_NAME;
204 +
205 +
206 + $DB_PASSWORD = str_replace( '");', '', $DB_PASSWORD );
207 + $DB_PASSWORD = ( strpos( $DB_PASSWORD, '"' ) === 0 ) ? substr( $DB_PASSWORD, 1 ) : $DB_PASSWORD;
208 + $DB_PASSWORD = str_replace( '\');', '', $DB_PASSWORD );
209 + $DB_PASSWORD = ( strpos( $DB_PASSWORD, '\'' ) === 0 ) ? substr( $DB_PASSWORD, 1 ) : $DB_PASSWORD;
210 +
211 +
212 + $DB_HOST = str_replace( '");', '', $DB_HOST );
213 + $DB_HOST = ( strpos( $DB_HOST, '"' ) === 0 ) ? substr( $DB_HOST, 1 ) : $DB_HOST;
214 + $DB_HOST = str_replace( '\');', '', $DB_HOST );
215 + $DB_HOST = ( strpos( $DB_HOST, '\'' ) === 0 ) ? substr( $DB_HOST, 1 ) : $DB_HOST;
216 +
217 + if ( !defined( 'DB_USER' ) ) {
218 + define( 'DB_USER', $DB_USER );
219 + }
220 + if ( !defined( 'DB_NAME' ) ) {
221 + define( 'DB_NAME', $DB_NAME );
222 + }
223 + if ( !defined( 'DB_PASSWORD' ) ) {
224 + define( 'DB_PASSWORD', $DB_PASSWORD );
225 + }
226 + if ( !defined( 'DB_HOST' ) ) {
227 + define( 'DB_HOST', $DB_HOST );
228 + }
229 +
230 + if ( !empty( $WP_CONTENT_DIR ) ) {
231 + define( 'WP_CONTENT_DIR', $WP_CONTENT_DIR );
232 + }
233 +
234 + if ( !empty( $WP_CONTENT_URL ) ) {
235 + define( 'WP_CONTENT_URL', $WP_CONTENT_URL );
236 + }
237 +
238 + // Search every config file for $table_prefix, not just whichever one
239 + // was last assigned by the DB_* loop above. Split-config layouts
240 + // (DDEV, LocalWP, etc.) place credentials and $table_prefix in
241 + // different files.
242 + global $table_prefix;
243 + $table_prefix = '';
244 + foreach ( $config_files as $config_file_path ) {
245 + if ( ! file_exists( $config_file_path ) ) {
246 + continue;
247 + }
248 + $config_file = new PDT_Config( $config_file_path );
249 + $config_file->set_type( 'php-variable' );
250 + $value = $config_file->get_key( 'table_prefix' );
251 + if ( ! empty( $value ) ) {
252 + $table_prefix = $value;
253 + break;
254 + }
255 + }
256 + $GLOBALS['table_prefix'] = $table_prefix;
257 +
258 + if ( !defined('WP_CONTENT_DIR') )
259 + define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down
260 +
261 + // Add define('WP_DEBUG', true); to wp-config.php to enable display of notices during development.
262 + if ( !defined('WP_DEBUG') )
263 + define( 'WP_DEBUG', false );
264 +
265 + // Add define('WP_DEBUG_DISPLAY', null); to wp-config.php use the globally configured setting for
266 + // display_errors and not force errors to be displayed. Use false to force display_errors off.
267 + if ( !defined('WP_DEBUG_DISPLAY') )
268 + define( 'WP_DEBUG_DISPLAY', true );
269 +
270 + // Add define('WP_DEBUG_LOG', true); to enable error logging to wp-content/debug.log.
271 + if ( !defined('WP_DEBUG_LOG') )
272 + define('WP_DEBUG_LOG', false);
273 +
274 + if ( !defined('WP_CACHE') )
275 + define('WP_CACHE', false);
276 +
277 + // Start of run timestamp.
278 + if ( ! defined( 'WP_START_TIMESTAMP' ) ) {
279 + define( 'WP_START_TIMESTAMP', microtime( true ) );
280 + }
281 +
282 + /**
283 + * Private
284 + */
285 + if ( !defined('MEDIA_TRASH') )
286 + define('MEDIA_TRASH', false);
287 +
288 + if ( !defined('SHORTINIT') )
289 + define('SHORTINIT', false);
290 +
291 + /**
292 + * Allows for the plugins directory to be moved from the default location.
293 + *
294 + * @since 2.6.0
295 + */
296 + if ( !defined('WP_PLUGIN_DIR') )
297 + define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash
298 +
299 + /**
300 + * Allows for the plugins directory to be moved from the default location.
301 + *
302 + * @since 2.1.0
303 + * @deprecated
304 + */
305 + if ( !defined('PLUGINDIR') )
306 + define( 'PLUGINDIR', 'wp-content/plugins' ); // phpcs:ignore WordPress.WP.DiscouragedConstants.PLUGINDIRDeclarationFound -- Standalone bootstrap mirrors wp-settings.php and re-creates this back-compat core constant.
307 +
308 + /**
309 + * Allows for the mu-plugins directory to be moved from the default location.
310 + *
311 + * @since 2.8.0
312 + */
313 + if ( !defined('WPMU_PLUGIN_DIR') )
314 + define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // full path, no trailing slash
315 +
316 + /**
317 + * Allows for the mu-plugins directory to be moved from the default location.
318 + *
319 + * @since 2.8.0
320 + * @deprecated
321 + */
322 + if ( !defined( 'MUPLUGINDIR' ) )
323 + define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // phpcs:ignore WordPress.WP.DiscouragedConstants.MUPLUGINDIRDeclarationFound -- Standalone bootstrap mirrors wp-settings.php and re-creates this back-compat core constant.
324 +
325 +
326 + }
327 +
328 +}