Changeset 27158
- Timestamp:
- 02/10/2014 10:59:40 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/plugin.php
r27033 r27158 538 538 wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error 539 539 ob_start(); 540 include_once(WP_PLUGIN_DIR . '/' . $plugin); 540 wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin ); 541 include_once( WP_PLUGIN_DIR . '/' . $plugin ); 541 542 542 543 if ( ! $silent ) { … … 922 923 923 924 define('WP_UNINSTALL_PLUGIN', $file); 925 wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . dirname( $file ) ); 924 926 include WP_PLUGIN_DIR . '/' . dirname($file) . '/uninstall.php'; 925 927 … … 933 935 unset($uninstallable_plugins); 934 936 937 wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $file ); 935 938 include WP_PLUGIN_DIR . '/' . $file; 936 939 -
trunk/src/wp-admin/plugins.php
r26518 r27158 144 144 // Go back to "sandbox" scope so we get the same errors as before 145 145 function plugin_sandbox_scrape( $plugin ) { 146 wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin ); 146 147 include( WP_PLUGIN_DIR . '/' . $plugin ); 147 148 } -
trunk/src/wp-admin/update.php
r25951 r27158 85 85 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 ); 86 86 @ini_set('display_errors', true); //Ensure that Fatal errors are displayed. 87 include(WP_PLUGIN_DIR . '/' . $plugin); 87 wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin ); 88 include( WP_PLUGIN_DIR . '/' . $plugin ); 88 89 } 89 90 iframe_footer(); -
trunk/src/wp-includes/functions.php
r27154 r27158 1432 1432 1433 1433 return rtrim($base, '/') . '/' . ltrim($path, '/'); 1434 } 1435 1436 /** 1437 * Normalize a filesystem path. 1438 * 1439 * Replaces backslashes with forward slashes for Windows systems, 1440 * and ensures no duplicate slashes exist. 1441 * 1442 * @since 3.9.0 1443 * 1444 * @param string $path Path to normalize. 1445 * @return string Normalized path. 1446 */ 1447 function wp_normalize_path( $path ) { 1448 $path = str_replace( '\\', '/', $path ); 1449 $path = preg_replace( '|/+|','/', $path ); 1450 return $path; 1434 1451 } 1435 1452 -
trunk/src/wp-includes/plugin.php
r26868 r27158 593 593 * @uses WP_PLUGIN_DIR 594 594 */ 595 function plugin_basename($file) { 596 $file = str_replace('\\','/',$file); // sanitize for Win32 installs 597 $file = preg_replace('|/+|','/', $file); // remove any duplicate slash 598 $plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs 599 $plugin_dir = preg_replace('|/+|','/', $plugin_dir); // remove any duplicate slash 600 $mu_plugin_dir = str_replace('\\','/',WPMU_PLUGIN_DIR); // sanitize for Win32 installs 601 $mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove any duplicate slash 595 function plugin_basename( $file ) { 596 global $wp_plugin_paths; 597 598 foreach ( $wp_plugin_paths as $dir => $realdir ) { 599 if ( strpos( $file, $realdir ) === 0 ) { 600 $file = $dir . substr( $file, strlen( $realdir ) ); 601 } 602 } 603 604 $file = wp_normalize_path( $file ); 605 $plugin_dir = wp_normalize_path( WP_PLUGIN_DIR ); 606 $mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR ); 607 602 608 $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir 603 609 $file = trim($file, '/'); 604 610 return $file; 611 } 612 613 /** 614 * Register a plugin's real path. 615 * 616 * This is used in {@see plugin_basename()} to resolve symlinked paths. 617 * 618 * @param string $file Known path to the file. 619 */ 620 function wp_register_plugin_realpath( $file ) { 621 global $wp_plugin_paths; 622 623 $plugin_path = wp_normalize_path( dirname( $file ) ); 624 $plugin_realpath = wp_normalize_path( dirname( realpath( $file ) ) ); 625 626 if ( $plugin_path !== $plugin_realpath ) { 627 $wp_plugin_paths[ $plugin_path ] = $plugin_realpath; 628 } 605 629 } 606 630 -
trunk/src/wp-settings.php
r26997 r27158 165 165 wp_plugin_directory_constants(); 166 166 167 $GLOBALS['wp_plugin_paths'] = array(); 168 167 169 // Load must-use plugins. 168 170 foreach ( wp_get_mu_plugins() as $mu_plugin ) { 171 wp_register_plugin_realpath( $mu_plugin ); 169 172 include_once( $mu_plugin ); 170 173 } … … 174 177 if ( is_multisite() ) { 175 178 foreach( wp_get_active_network_plugins() as $network_plugin ) { 179 wp_register_plugin_realpath( $network_plugin ); 176 180 include_once( $network_plugin ); 177 181 } … … 207 211 208 212 // Load active plugins. 209 foreach ( wp_get_active_and_valid_plugins() as $plugin ) 213 foreach ( wp_get_active_and_valid_plugins() as $plugin ) { 214 wp_register_plugin_realpath( $plugin ); 210 215 include_once( $plugin ); 216 } 211 217 unset( $plugin ); 212 218
Note: See TracChangeset
for help on using the changeset viewer.