Make WordPress Core

Ticket #16953: 16953.5.diff

File 16953.5.diff, 3.2 KB (added by rmccue, 11 years ago)

Once more with more pizazzHHHH documentation

  • wp-includes/functions.php

    diff --git wp-includes/functions.php wp-includes/functions.php
    index c4dc1e7..6367dce 100644
    function path_join( $base, $path ) { 
    14291429}
    14301430
    14311431/**
     1432 * Normalize a filesystem path
     1433 *
     1434 * Replaces backslashes with forward slashes for Windows systems, and ensures
     1435 * no duplicate slashes exist.
     1436 *
     1437 * @param string $path Path to normalize
     1438 * @return string Normalized path
     1439 */
     1440function wp_normalize_path( $path ) {
     1441        $path = str_replace( '\\', '/', $file );
     1442        $path = preg_replace( '|/+|','/', $file );
     1443        return $path;
     1444}
     1445
     1446/**
    14321447 * Determines a writable directory for temporary files.
    14331448 * Function's preference is the return value of <code>sys_get_temp_dir()</code>,
    14341449 * followed by your PHP temporary upload directory, followed by WP_CONTENT_DIR,
  • wp-includes/plugin.php

    diff --git wp-includes/plugin.php wp-includes/plugin.php
    index 03c4ac3..c8029f4 100644
    function remove_all_actions($tag, $priority = false) { 
    574574 * @uses WP_PLUGIN_DIR
    575575 */
    576576function plugin_basename($file) {
    577         $file = str_replace('\\','/',$file); // sanitize for Win32 installs
    578         $file = preg_replace('|/+|','/', $file); // remove any duplicate slash
    579         $plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs
    580         $plugin_dir = preg_replace('|/+|','/', $plugin_dir); // remove any duplicate slash
    581         $mu_plugin_dir = str_replace('\\','/',WPMU_PLUGIN_DIR); // sanitize for Win32 installs
    582         $mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove any duplicate slash
     577        global $wp_plugin_paths;
     578        $original_file = $file;
     579
     580        foreach ($wp_plugin_paths as $dir => $realdir) {
     581                if (strpos($file, $realdir) === 0) {
     582                        $file = $dir . substr( $file, strlen( $realdir ) );
     583                }
     584        }
     585
     586        $file = wp_normalize_path($file);
     587        $plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
     588        $mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR );
     589
    583590        $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir
    584591        $file = trim($file, '/');
    585         return $file;
     592
     593        /**
     594         * Filter the plugin's basename.
     595         *
     596         * @since 3.7.0
     597         *
     598         * @param string $file Resolved basename.
     599         * @param string $original_file Filename passed into the function.
     600         */
     601        return apply_filters( 'plugin_basename', $file, $original_file );
    586602}
    587603
    588604/**
  • wp-settings.php

    diff --git wp-settings.php wp-settings.php
    index 24aee93..2618326 100644
    create_initial_post_types(); 
    194194register_theme_directory( get_theme_root() );
    195195
    196196// Load active plugins.
    197 foreach ( wp_get_active_and_valid_plugins() as $plugin )
     197$wp_plugin_paths = array();
     198foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
     199        $plugin_path = wp_normalize_path( dirname( $plugin ) );
     200        $plugin_realpath = wp_normalize_path( dirname( realpath( $plugin ) ) );
     201
     202        if ( $plugin_path !== $plugin_realpath ) {
     203                $wp_plugin_paths[ $plugin_path ] = $plugin_realpath;
     204        }
     205
    198206        include_once( $plugin );
    199 unset( $plugin );
     207}
     208unset( $plugin, $plugin_path, $plugin_realpath );
    200209
    201210// Load pluggable functions.
    202211require( ABSPATH . WPINC . '/pluggable.php' );