WordPress.org

Make WordPress Core

Ticket #43170: 43170.diff

File 43170.diff, 86.0 KB (added by jorbin, 10 months ago)
  • src/wp-admin/admin-functions.php

     
    99 * @subpackage Administration
    1010 */
    1111
    12 _deprecated_file( basename( __FILE__ ), '2.5.0', 'wp-admin/includes/admin.php' );
     12_deprecated_file( wp_basename( __FILE__ ), '2.5.0', 'wp-admin/includes/admin.php' );
    1313
    1414/** WordPress Administration API: Includes all Administration functions. */
    1515require_once( ABSPATH . 'wp-admin/includes/admin.php' );
  • src/wp-admin/custom-background.php

     
    494494                $url      = $file['url'];
    495495                $type     = $file['type'];
    496496                $file     = $file['file'];
    497                 $filename = basename( $file );
     497                $filename = wp_basename( $file );
    498498
    499499                // Construct the object array
    500500                $object = array(
  • src/wp-admin/custom-header.php

     
    820820                        return $this->finished();
    821821                } elseif ( $width > $max_width ) {
    822822                        $oitar = $width / $max_width;
    823                         $image = wp_crop_image( $attachment_id, 0, 0, $width, $height, $max_width, $height / $oitar, false, str_replace( basename( $file ), 'midsize-' . basename( $file ), $file ) );
     823                        $image = wp_crop_image( $attachment_id, 0, 0, $width, $height, $max_width, $height / $oitar, false, str_replace( wp_basename( $file ), 'midsize-' . wp_basename( $file ), $file ) );
    824824                        if ( ! $image || is_wp_error( $image ) ) {
    825825                                wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
    826826                        }
     
    828828                        /** This filter is documented in wp-admin/custom-header.php */
    829829                        $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication
    830830
    831                         $url    = str_replace( basename( $url ), basename( $image ), $url );
     831                        $url    = str_replace( wp_basename( $url ), wp_basename( $image ), $url );
    832832                        $width  = $width / $oitar;
    833833                        $height = $height / $oitar;
    834834                } else {
     
    895895                $url      = $file['url'];
    896896                $type     = $file['type'];
    897897                $file     = $file['file'];
    898                 $filename = basename( $file );
     898                $filename = wp_basename( $file );
    899899
    900900                // Construct the object array
    901901                $object = array(
     
    984984                $this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) );
    985985
    986986                // Cleanup.
    987                 $medium = str_replace( basename( $original ), 'midsize-' . basename( $original ), $original );
     987                $medium = str_replace( wp_basename( $original ), 'midsize-' . wp_basename( $original ), $original );
    988988                if ( file_exists( $medium ) ) {
    989989                        wp_delete_file( $medium );
    990990                }
     
    12081208        final public function create_attachment_object( $cropped, $parent_attachment_id ) {
    12091209                $parent     = get_post( $parent_attachment_id );
    12101210                $parent_url = wp_get_attachment_url( $parent->ID );
    1211                 $url        = str_replace( basename( $parent_url ), basename( $cropped ), $parent_url );
     1211                $url        = str_replace( wp_basename( $parent_url ), wp_basename( $cropped ), $parent_url );
    12121212
    12131213                $size       = @getimagesize( $cropped );
    12141214                $image_type = ( $size ) ? $size['mime'] : 'image/jpeg';
     
    12151215
    12161216                $object = array(
    12171217                        'ID'             => $parent_attachment_id,
    1218                         'post_title'     => basename( $cropped ),
     1218                        'post_title'     => wp_basename( $cropped ),
    12191219                        'post_mime_type' => $image_type,
    12201220                        'guid'           => $url,
    12211221                        'context'        => 'custom-header',
  • src/wp-admin/includes/ajax-actions.php

     
    36513651                        $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication.
    36523652
    36533653                        $parent_url = wp_get_attachment_url( $attachment_id );
    3654                         $url        = str_replace( basename( $parent_url ), basename( $cropped ), $parent_url );
     3654                        $url        = str_replace( wp_basename( $parent_url ), wp_basename( $cropped ), $parent_url );
    36553655
    36563656                        $size       = @getimagesize( $cropped );
    36573657                        $image_type = ( $size ) ? $size['mime'] : 'image/jpeg';
    36583658
    36593659                        $object = array(
    3660                                 'post_title'     => basename( $cropped ),
     3660                                'post_title'     => wp_basename( $cropped ),
    36613661                                'post_content'   => $url,
    36623662                                'post_mime_type' => $image_type,
    36633663                                'guid'           => $url,
  • src/wp-admin/includes/class-pclzip.php

     
    29622962
    29632963      // ----- Look for all path to remove
    29642964      if ($p_remove_all_dir) {
    2965         $v_stored_filename = basename($p_filename);
     2965        $v_stored_filename = wp_basename($p_filename);
    29662966      }
    29672967      // ----- Look for partial path remove
    29682968      else if ($p_remove_dir != "") {
     
    36423642            return $v_result;
    36433643        }
    36443644
    3645         // ----- Get the basename of the path
    3646         $p_entry['filename'] = basename($p_entry['filename']);
     3645        // ----- Get the wp_basename of the path
     3646        $p_entry['filename'] = wp_basename($p_entry['filename']);
    36473647    }
    36483648
    36493649    // ----- Look for path to remove
  • src/wp-admin/includes/class-wp-filesystem-direct.php

     
    439439         */
    440440        public function dirlist( $path, $include_hidden = true, $recursive = false ) {
    441441                if ( $this->is_file( $path ) ) {
    442                         $limit_file = basename( $path );
     442                        $limit_file = wp_basename( $path );
    443443                        $path       = dirname( $path );
    444444                } else {
    445445                        $limit_file = false;
  • src/wp-admin/includes/class-wp-filesystem-ftpext.php

     
    530530         */
    531531        public function dirlist( $path = '.', $include_hidden = true, $recursive = false ) {
    532532                if ( $this->is_file( $path ) ) {
    533                         $limit_file = basename( $path );
     533                        $limit_file = wp_basename( $path );
    534534                        $path       = dirname( $path ) . '/';
    535535                } else {
    536536                        $limit_file = false;
  • src/wp-admin/includes/class-wp-filesystem-ftpsockets.php

     
    461461         */
    462462        public function dirlist( $path = '.', $include_hidden = true, $recursive = false ) {
    463463                if ( $this->is_file( $path ) ) {
    464                         $limit_file = basename( $path );
     464                        $limit_file = wp_basename( $path );
    465465                        $path       = dirname( $path ) . '/';
    466466                } else {
    467467                        $limit_file = false;
  • src/wp-admin/includes/class-wp-filesystem-ssh2.php

     
    551551         */
    552552        public function dirlist( $path, $include_hidden = true, $recursive = false ) {
    553553                if ( $this->is_file( $path ) ) {
    554                         $limit_file = basename( $path );
     554                        $limit_file = wp_basename( $path );
    555555                        $path       = dirname( $path );
    556556                } else {
    557557                        $limit_file = false;
  • src/wp-admin/includes/class-wp-site-icon.php

     
    8585        public function create_attachment_object( $cropped, $parent_attachment_id ) {
    8686                $parent     = get_post( $parent_attachment_id );
    8787                $parent_url = wp_get_attachment_url( $parent->ID );
    88                 $url        = str_replace( basename( $parent_url ), basename( $cropped ), $parent_url );
     88                $url        = str_replace( wp_basename( $parent_url ), wp_basename( $cropped ), $parent_url );
    8989
    9090                $size       = @getimagesize( $cropped );
    9191                $image_type = ( $size ) ? $size['mime'] : 'image/jpeg';
     
    9292
    9393                $object = array(
    9494                        'ID'             => $parent_attachment_id,
    95                         'post_title'     => basename( $cropped ),
     95                        'post_title'     => wp_basename( $cropped ),
    9696                        'post_content'   => $url,
    9797                        'post_mime_type' => $image_type,
    9898                        'guid'           => $url,
  • src/wp-admin/includes/class-wp-upgrader-skins.php

     
    77 * @since 2.8.0
    88 */
    99
    10 _deprecated_file( basename( __FILE__ ), '4.7.0', 'class-wp-upgrader.php' );
     10_deprecated_file( wp_basename( __FILE__ ), '4.7.0', 'class-wp-upgrader.php' );
    1111
    1212/** WP_Upgrader_Skin class */
    1313require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader-skin.php';
  • src/wp-admin/includes/class-wp-upgrader.php

     
    231231                                        break;
    232232                                default:
    233233                                        if ( ! $wp_filesystem->find_folder( $dir ) ) {
    234                                                 return new WP_Error( 'fs_no_folder', sprintf( $this->strings['fs_no_folder'], esc_html( basename( $dir ) ) ) );
     234                                                return new WP_Error( 'fs_no_folder', sprintf( $this->strings['fs_no_folder'], esc_html( wp_basename( $dir ) ) ) );
    235235                                        }
    236236                                        break;
    237237                        }
     
    312312                }
    313313
    314314                // We need a working directory - Strip off any .tmp or .zip suffixes
    315                 $working_dir = $upgrade_folder . basename( basename( $package, '.tmp' ), '.zip' );
     315                $working_dir = $upgrade_folder . wp_basename( wp_basename( $package, '.tmp' ), '.zip' );
    316316
    317317                // Clean up working directory
    318318                if ( $wp_filesystem->is_dir( $working_dir ) ) {
     
    540540                }
    541541
    542542                if ( in_array( $destination, $protected_directories ) ) {
    543                         $remote_destination = trailingslashit( $remote_destination ) . trailingslashit( basename( $source ) );
    544                         $destination        = trailingslashit( $destination ) . trailingslashit( basename( $source ) );
     543                        $remote_destination = trailingslashit( $remote_destination ) . trailingslashit( wp_basename( $source ) );
     544                        $destination        = trailingslashit( $destination ) . trailingslashit( wp_basename( $source ) );
    545545                }
    546546
    547547                if ( $clear_destination ) {
     
    595595                        $wp_filesystem->delete( $remote_source, true );
    596596                }
    597597
    598                 $destination_name = basename( str_replace( $local_destination, '', $destination ) );
     598                $destination_name = wp_basename( str_replace( $local_destination, '', $destination ) );
    599599                if ( '.' == $destination_name ) {
    600600                        $destination_name = '';
    601601                }
     
    795795                         *     @type string $action       Type of action. Default 'update'.
    796796                         *     @type string $type         Type of update process. Accepts 'plugin', 'theme', 'translation', or 'core'.
    797797                         *     @type bool   $bulk         Whether the update process is a bulk update. Default true.
    798                          *     @type array  $plugins      Array of the basename paths of the plugins' main files.
     798                         *     @type array  $plugins      Array of the wp_basename paths of the plugins' main files.
    799799                         *     @type array  $themes       The theme slugs.
    800800                         *     @type array  $translations {
    801801                         *         Array of translations update data.
  • src/wp-admin/includes/file.php

     
    7272 * @global array $wp_file_descriptions Theme file descriptions.
    7373 * @global array $allowed_files        List of allowed files.
    7474 * @param string $file Filesystem path or filename
    75  * @return string Description of file from $wp_file_descriptions or basename of $file if description doesn't exist.
    76  *                Appends 'Page Template' to basename of $file if the file is a page template
     75 * @return string Description of file from $wp_file_descriptions or wp_basename of $file if description doesn't exist.
     76 *                Appends 'Page Template' to wp_basename of $file if the file is a page template
    7777 */
    7878function get_file_description( $file ) {
    7979        global $wp_file_descriptions, $allowed_files;
     
    8181        $dirname = pathinfo( $file, PATHINFO_DIRNAME );
    8282
    8383        $file_path = $allowed_files[ $file ];
    84         if ( isset( $wp_file_descriptions[ basename( $file ) ] ) && '.' === $dirname ) {
    85                 return $wp_file_descriptions[ basename( $file ) ];
     84        if ( isset( $wp_file_descriptions[ wp_basename( $file ) ] ) && '.' === $dirname ) {
     85                return $wp_file_descriptions[ wp_basename( $file ) ];
    8686        } elseif ( file_exists( $file_path ) && is_file( $file_path ) ) {
    8787                $template_data = implode( '', file( $file_path ) );
    8888                if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) ) {
     
    9090                }
    9191        }
    9292
    93         return trim( basename( $file ) );
     93        return trim( wp_basename( $file ) );
    9494}
    9595
    9696/**
     
    630630                $filename = uniqid();
    631631        }
    632632
    633         // Use the basename of the given file without the extension as the name for the temporary directory
    634         $temp_filename = basename( $filename );
     633        // Use the wp_basename of the given file without the extension as the name for the temporary directory
     634        $temp_filename = wp_basename( $filename );
    635635        $temp_filename = preg_replace( '|\.[^.]*$|', '', $temp_filename );
    636636
    637637        // If the folder is falsey, use its parent directory name instead.
     
    857857                        if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) {
    858858                                $error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir'];
    859859                        } else {
    860                                 $error_path = basename( $uploads['basedir'] ) . $uploads['subdir'];
     860                                $error_path = wp_basename( $uploads['basedir'] ) . $uploads['subdir'];
    861861                        }
    862862                        return $upload_error_handler( $file, sprintf( __( 'The uploaded file could not be moved to %s.' ), $error_path ) );
    863863                }
     
    976976                return new WP_Error( 'http_no_url', __( 'Invalid URL Provided.' ) );
    977977        }
    978978
    979         $url_filename = basename( parse_url( $url, PHP_URL_PATH ) );
     979        $url_filename = wp_basename( parse_url( $url, PHP_URL_PATH ) );
    980980
    981981        $tmpfname = wp_tempnam( $url_filename );
    982982        if ( ! $tmpfname ) {
  • src/wp-admin/includes/image-edit.php

     
    3333        $backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
    3434        $can_restore  = false;
    3535        if ( ! empty( $backup_sizes ) && isset( $backup_sizes['full-orig'], $meta['file'] ) ) {
    36                 $can_restore = $backup_sizes['full-orig']['file'] != basename( $meta['file'] );
     36                $can_restore = $backup_sizes['full-orig']['file'] != wp_basename( $meta['file'] );
    3737        }
    3838
    3939        if ( $msg ) {
  • src/wp-admin/includes/image.php

     
    4747        }
    4848
    4949        if ( ! $dst_file ) {
    50                 $dst_file = str_replace( basename( $src_file ), 'cropped-' . basename( $src_file ), $src_file );
     50                $dst_file = str_replace( wp_basename( $src_file ), 'cropped-' . wp_basename( $src_file ), $src_file );
    5151        }
    5252
    5353        /*
     
    5656         */
    5757        wp_mkdir_p( dirname( $dst_file ) );
    5858
    59         $dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) );
     59        $dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), wp_basename( $dst_file ) );
    6060
    6161        $result = $editor->save( $dst_file );
    6262        if ( is_wp_error( $result ) ) {
     
    189189                                        $ext = '.png';
    190190                                        break;
    191191                        }
    192                         $basename = str_replace( '.', '-', basename( $file ) ) . '-image' . $ext;
     192                        $basename = str_replace( '.', '-', wp_basename( $file ) ) . '-image' . $ext;
    193193                        $uploaded = wp_upload_bits( $basename, '', $metadata['image']['data'] );
    194194                        if ( false === $uploaded['error'] ) {
    195195                                $image_attachment = array(
     
    711711        }
    712712
    713713        if ( $src_file ) {
    714                 $dst_file = str_replace( basename( $dst_file ), 'copy-' . basename( $dst_file ), $dst_file );
    715                 $dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) );
     714                $dst_file = str_replace( wp_basename( $dst_file ), 'copy-' . wp_basename( $dst_file ), $dst_file );
     715                $dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), wp_basename( $dst_file ) );
    716716
    717717                /*
    718718                 * The directory containing the original file may no longer
  • src/wp-admin/includes/import.php

     
    9999
    100100        // Construct the object array
    101101        $object = array(
    102                 'post_title'     => basename( $upload['file'] ),
     102                'post_title'     => wp_basename( $upload['file'] ),
    103103                'post_content'   => $upload['url'],
    104104                'post_mime_type' => $upload['type'],
    105105                'guid'           => $upload['url'],
  • src/wp-admin/includes/media.php

     
    434434        $url     = $file['url'];
    435435        $type    = $file['type'];
    436436        $file    = $file['file'];
    437         $title   = preg_replace( '/\.[^.]+$/', '', basename( $file ) );
     437        $title   = preg_replace( '/\.[^.]+$/', '', wp_basename( $file ) );
    438438        $content = '';
    439439
    440440        // Use image exif/iptc data for title and caption defaults if possible.
     
    826826                if ( isset( $_POST['media_type'] ) && 'image' != $_POST['media_type'] ) {
    827827                        $title = esc_html( wp_unslash( $_POST['title'] ) );
    828828                        if ( empty( $title ) ) {
    829                                 $title = esc_html( basename( $src ) );
     829                                $title = esc_html( wp_basename( $src ) );
    830830                        }
    831831
    832832                        if ( $title && $src ) {
     
    930930                }
    931931
    932932                $file_array         = array();
    933                 $file_array['name'] = basename( $matches[0] );
     933                $file_array['name'] = wp_basename( $matches[0] );
    934934
    935935                // Download file to temp location.
    936936                $file_array['tmp_name'] = download_url( $file );
  • src/wp-admin/includes/menu.php

     
    5252                if ( isset( $hook_args['post_type'] ) ) {
    5353                        $hook_name = $hook_args['post_type'];
    5454                } else {
    55                         $hook_name = basename( $hook_name, '.php' );
     55                        $hook_name = wp_basename( $hook_name, '.php' );
    5656                }
    5757                unset( $hook_args );
    5858        } else {
    59                 $hook_name = basename( $menu_page[2], '.php' );
     59                $hook_name = wp_basename( $menu_page[2], '.php' );
    6060        }
    6161        $hook_name = sanitize_title( $hook_name );
    6262
  • src/wp-admin/includes/misc.php

     
    362362                                aria-posinset="<?php echo esc_attr( $index ); ?>">
    363363                                <?php
    364364                                $file_description = esc_html( get_file_description( $filename ) );
    365                                 if ( $file_description !== $filename && basename( $filename ) !== $file_description ) {
     365                                if ( $file_description !== $filename && wp_basename( $filename ) !== $file_description ) {
    366366                                        $file_description .= '<br /><span class="nonessential">(' . esc_html( $filename ) . ')</span>';
    367367                                }
    368368
  • src/wp-admin/includes/ms.php

     
    687687        $output = array();
    688688
    689689        foreach ( (array) $lang_files as $val ) {
    690                 $code_lang = basename( $val, '.mo' );
     690                $code_lang = wp_basename( $val, '.mo' );
    691691
    692692                if ( $code_lang == 'en_US' ) { // American English
    693693                        $flag          = true;
  • src/wp-admin/includes/plugin.php

     
    153153                                        load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) );
    154154                                }
    155155                        }
    156                 } elseif ( 'hello.php' == basename( $plugin_file ) ) {
     156                } elseif ( 'hello.php' == wp_basename( $plugin_file ) ) {
    157157                        $textdomain = 'default';
    158158                }
    159159                if ( $textdomain ) {
     
    648648                         * Fires as a specific plugin is being activated.
    649649                         *
    650650                         * This hook is the "activation" hook used internally by register_activation_hook().
    651                          * The dynamic portion of the hook name, `$plugin`, refers to the plugin basename.
     651                         * The dynamic portion of the hook name, `$plugin`, refers to the plugin wp_basename.
    652652                         *
    653653                         * If a plugin is silently activated (such as during an update), this hook does not fire.
    654654                         *
     
    763763                         * Fires as a specific plugin is being deactivated.
    764764                         *
    765765                         * This hook is the "deactivation" hook used internally by register_deactivation_hook().
    766                          * The dynamic portion of the hook name, `$plugin`, refers to the plugin basename.
     766                         * The dynamic portion of the hook name, `$plugin`, refers to the plugin wp_basename.
    767767                         *
    768768                         * If a plugin is silently deactivated (such as during an update), this hook does not fire.
    769769                         *
     
    11301130                /**
    11311131                 * Fires in uninstall_plugin() once the plugin has been uninstalled.
    11321132                 *
    1133                  * The action concatenates the 'uninstall_' prefix with the basename of the
     1133                 * The action concatenates the 'uninstall_' prefix with the wp_basename of the
    11341134                 * plugin passed to uninstall_plugin() to create a dynamically-named action.
    11351135                 *
    11361136                 * @since 2.7.0
  • src/wp-admin/includes/update-core.php

     
    965965        // Check to see which files don't really need updating - only available for 3.7 and higher
    966966        if ( function_exists( 'get_core_checksums' ) ) {
    967967                // Find the local version of the working directory
    968                 $working_dir_local = WP_CONTENT_DIR . '/upgrade/' . basename( $from ) . $distro;
     968                $working_dir_local = WP_CONTENT_DIR . '/upgrade/' . wp_basename( $from ) . $distro;
    969969
    970970                $checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' );
    971971                if ( is_array( $checksums ) && isset( $checksums[ $wp_version ] ) ) {
     
    13851385                }
    13861386
    13871387                // The path when the file is accessed via WP_Filesystem may differ in the case of FTP
    1388                 $remote_file = $gen_dir . basename( $file );
     1388                $remote_file = $gen_dir . wp_basename( $file );
    13891389
    13901390                if ( ! $wp_filesystem->exists( $remote_file ) ) {
    13911391                        continue;
  • src/wp-admin/includes/update.php

     
    363363/**
    364364 * Displays update information for a plugin.
    365365 *
    366  * @param string $file        Plugin basename.
     366 * @param string $file        Plugin wp_basename.
    367367 * @param array  $plugin_data Plugin information.
    368368 * @return false|void
    369369 */
  • src/wp-admin/includes/upgrade.php

     
    31903190        $plugins = __get_option( 'active_plugins' );
    31913191
    31923192        foreach ( (array) $plugins as $plugin ) {
    3193                 if ( basename( $plugin ) == 'widgets.php' ) {
     3193                if ( wp_basename( $plugin ) == 'widgets.php' ) {
    31943194                        array_splice( $plugins, array_search( $plugin, $plugins ), 1 );
    31953195                        update_option( 'active_plugins', $plugins );
    31963196                        break;
  • src/wp-admin/plugin-editor.php

     
    293293        $referer                    = wp_get_referer();
    294294        $excluded_referer_basenames = array( 'plugin-editor.php', 'wp-login.php' );
    295295
    296         if ( $referer && ! in_array( basename( parse_url( $referer, PHP_URL_PATH ) ), $excluded_referer_basenames, true ) ) {
     296        if ( $referer && ! in_array( wp_basename( parse_url( $referer, PHP_URL_PATH ) ), $excluded_referer_basenames, true ) ) {
    297297                $return_url = $referer;
    298298        } else {
    299299                $return_url = admin_url( '/' );
  • src/wp-admin/theme-editor.php

     
    326326        $referer                    = wp_get_referer();
    327327        $excluded_referer_basenames = array( 'theme-editor.php', 'wp-login.php' );
    328328
    329         if ( $referer && ! in_array( basename( parse_url( $referer, PHP_URL_PATH ) ), $excluded_referer_basenames, true ) ) {
     329        if ( $referer && ! in_array( wp_basename( parse_url( $referer, PHP_URL_PATH ) ), $excluded_referer_basenames, true ) ) {
    330330                $return_url = $referer;
    331331        } else {
    332332                $return_url = admin_url( '/' );
  • src/wp-admin/update.php

     
    153153                $submenu_file = 'plugin-install.php';
    154154                require_once( ABSPATH . 'wp-admin/admin-header.php' );
    155155
    156                 $title = sprintf( __( 'Installing Plugin from uploaded file: %s' ), esc_html( basename( $file_upload->filename ) ) );
     156                $title = sprintf( __( 'Installing Plugin from uploaded file: %s' ), esc_html( wp_basename( $file_upload->filename ) ) );
    157157                $nonce = 'plugin-upload';
    158158                $url   = add_query_arg( array( 'package' => $file_upload->id ), 'update.php?action=upload-plugin' );
    159159                $type  = 'upload'; //Install plugin type, From Web or an Upload.
     
    271271
    272272                require_once( ABSPATH . 'wp-admin/admin-header.php' );
    273273
    274                 $title = sprintf( __( 'Installing Theme from uploaded file: %s' ), esc_html( basename( $file_upload->filename ) ) );
     274                $title = sprintf( __( 'Installing Theme from uploaded file: %s' ), esc_html( wp_basename( $file_upload->filename ) ) );
    275275                $nonce = 'theme-upload';
    276276                $url   = add_query_arg( array( 'package' => $file_upload->id ), 'update.php?action=upload-theme' );
    277277                $type  = 'upload'; //Install plugin type, From Web or an Upload.
  • src/wp-admin/upgrade-functions.php

     
    88 * @subpackage Administration
    99 */
    1010
    11 _deprecated_file( basename( __FILE__ ), '2.5.0', 'wp-admin/includes/upgrade.php' );
     11_deprecated_file( wp_basename( __FILE__ ), '2.5.0', 'wp-admin/includes/upgrade.php' );
    1212require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
  • src/wp-content/themes/twentyten/loop-attachment.php

     
    138138                                                        <div class="nav-next"><?php next_image_link( false ); ?></div>
    139139                                                </div><!-- #nav-below -->
    140140                <?php else : ?>
    141                                                 <a href="<?php echo esc_url( wp_get_attachment_url() ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php echo esc_html( basename( get_permalink() ) ); ?></a>
     141                                                <a href="<?php echo esc_url( wp_get_attachment_url() ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php echo esc_html( wp_basename( get_permalink() ) ); ?></a>
    142142        <?php endif; ?>
    143143                                                </div><!-- .entry-attachment -->
    144144                                                <div class="entry-caption">
  • src/wp-includes/ID3/getid3.lib.php

     
    13801380                        if (include_once($filename)) {
    13811381                                return true;
    13821382                        } else {
    1383                                 $diemessage = basename($sourcefile).' depends on '.$filename.', which has errors';
     1383                                $diemessage = wp_basename($sourcefile).' depends on '.$filename.', which has errors';
    13841384                        }
    13851385                } else {
    1386                         $diemessage = basename($sourcefile).' depends on '.$filename.', which is missing';
     1386                        $diemessage = wp_basename($sourcefile).' depends on '.$filename.', which is missing';
    13871387                }
    13881388                if ($DieOnFailure) {
    13891389                        throw new Exception($diemessage);
  • src/wp-includes/Requests/Exception/HTTP.php

     
    6868
    6969                return 'Requests_Exception_HTTP_Unknown';
    7070        }
    71 }
    72  No newline at end of file
     71}
  • src/wp-includes/Requests/Proxy/HTTP.php

     
    148148        public function get_auth_string() {
    149149                return $this->user . ':' . $this->pass;
    150150        }
    151 }
    152  No newline at end of file
     151}
  • src/wp-includes/SimplePie/Core.php

     
    5454class SimplePie_Core extends SimplePie
    5555{
    5656
    57 }
    58  No newline at end of file
     57}
  • src/wp-includes/Text/Diff.php

     
    4444        if ($engine == 'auto') {
    4545            $engine = extension_loaded('xdiff') ? 'xdiff' : 'native';
    4646        } else {
    47             $engine = basename($engine);
     47            $engine = wp_basename($engine);
    4848        }
    4949
    5050        // WP #7391
  • src/wp-includes/canonical.php

     
    322322                                        'wp-rss.php'          => 'rss2',
    323323                                        'wp-rss2.php'         => 'rss2',
    324324                                );
    325                                 if ( isset( $old_feed_files[ basename( $redirect['path'] ) ] ) ) {
    326                                         $redirect_url = get_feed_link( $old_feed_files[ basename( $redirect['path'] ) ] );
     325                                if ( isset( $old_feed_files[ wp_basename( $redirect['path'] ) ] ) ) {
     326                                        $redirect_url = get_feed_link( $old_feed_files[ wp_basename( $redirect['path'] ) ] );
    327327                                        wp_redirect( $redirect_url, 301 );
    328328                                        die();
    329329                                }
     
    361361                        $redirect_url = $redirect['scheme'] . '://' . $redirect['host'] . $redirect['path'];
    362362                }
    363363
    364                 if ( 'wp-register.php' == basename( $redirect['path'] ) ) {
     364                if ( 'wp-register.php' == wp_basename( $redirect['path'] ) ) {
    365365                        if ( is_multisite() ) {
    366366                                /** This filter is documented in wp-login.php */
    367367                                $redirect_url = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) );
  • src/wp-includes/category.php

     
    128128        $category_path  = str_replace( '%2F', '/', $category_path );
    129129        $category_path  = str_replace( '%20', ' ', $category_path );
    130130        $category_paths = '/' . trim( $category_path, '/' );
    131         $leaf_path      = sanitize_title( basename( $category_paths ) );
     131        $leaf_path      = sanitize_title( wp_basename( $category_paths ) );
    132132        $category_paths = explode( '/', $category_paths );
    133133        $full_path      = '';
    134134        foreach ( (array) $category_paths as $pathdir ) {
  • src/wp-includes/class-IXR.php

     
    5757
    5858require_once( ABSPATH . WPINC . '/IXR/class-IXR-request.php' );
    5959
    60 require_once( ABSPATH . WPINC . '/IXR/class-IXR-value.php' );
    61  No newline at end of file
     60require_once( ABSPATH . WPINC . '/IXR/class-IXR-value.php' );
  • src/wp-includes/class-feed.php

     
    66 * @subpackage Feed
    77 */
    88
    9 _deprecated_file( basename( __FILE__ ), '4.7.0', 'fetch_feed()' );
     9_deprecated_file( wp_basename( __FILE__ ), '4.7.0', 'fetch_feed()' );
    1010
    1111if ( ! class_exists( 'SimplePie', false ) ) {
    1212        require_once( ABSPATH . WPINC . '/class-simplepie.php' );
  • src/wp-includes/class-http.php

     
    137137         *                                             Default ABSPATH . WPINC . '/certificates/ca-bundle.crt'.
    138138         *     @type bool         $stream              Whether to stream to a file. If set to true and no filename was
    139139         *                                             given, it will be droped it in the WP temp dir and its name will
    140          *                                             be set using the basename of the URL. Default false.
     140         *                                             be set using the wp_basename of the URL. Default false.
    141141         *     @type string       $filename            Filename of the file to write to when streaming. $stream must be
    142142         *                                             set to true. Default null.
    143143         *     @type int          $limit_response_size Size in bytes to limit the response to. Default null.
     
    280280                }
    281281
    282282                // If we are streaming to a file but no filename was given drop it in the WP temp dir
    283                 // and pick its name using the basename of the $url
     283                // and pick its name using the wp_basename of the $url
    284284                if ( $r['stream'] ) {
    285285                        if ( empty( $r['filename'] ) ) {
    286                                 $r['filename'] = get_temp_dir() . basename( $url );
     286                                $r['filename'] = get_temp_dir() . wp_basename( $url );
    287287                        }
    288288
    289289                        // Force some settings if we are streaming to a file and check for existence and perms of destination directory
  • src/wp-includes/class-phpmailer.php

     
    25152515                $type = self::filenameToType($path);
    25162516            }
    25172517
    2518             $filename = basename($path);
     2518            $filename = wp_basename($path);
    25192519            if ($name == '') {
    25202520                $name = $filename;
    25212521            }
     
    30033003        $this->attachment[] = array(
    30043004            0 => $string,
    30053005            1 => $filename,
    3006             2 => basename($filename),
     3006            2 => wp_basename($filename),
    30073007            3 => $encoding,
    30083008            4 => $type,
    30093009            5 => true, // isStringAttachment
     
    30413041            $type = self::filenameToType($path);
    30423042        }
    30433043
    3044         $filename = basename($path);
     3044        $filename = wp_basename($path);
    30453045        if ($name == '') {
    30463046            $name = $filename;
    30473047        }
     
    34323432                    // Do not change absolute URLs, including anonymous protocol
    34333433                    && !preg_match('#^[a-z][a-z0-9+.-]*:?//#i', $url)
    34343434                ) {
    3435                     $filename = basename($url);
     3435                    $filename = wp_basename($url);
    34363436                    $directory = dirname($url);
    34373437                    if ($directory == '.') {
    34383438                        $directory = '';
  • src/wp-includes/class-snoopy.php

     
    33/**
    44 * Deprecated. Use WP_HTTP (http.php) instead.
    55 */
    6 _deprecated_file( basename( __FILE__ ), '3.0.0', WPINC . '/http.php' );
     6_deprecated_file( wp_basename( __FILE__ ), '3.0.0', WPINC . '/http.php' );
    77
    88if ( ! class_exists( 'Snoopy', false ) ) :
    99/*************************************************
     
    12411241                                                $fp = fopen($file_name, "r");
    12421242                                                $file_content = fread($fp, filesize($file_name));
    12431243                                                fclose($fp);
    1244                                                 $base_name = basename($file_name);
     1244                                                $base_name = wp_basename($file_name);
    12451245
    12461246                                                $postdata .= "--".$this->_mime_boundary."\r\n";
    12471247                                                $postdata .= "Content-Disposition: form-data; name=\"$field_name\"; filename=\"$base_name\"\r\n\r\n";
  • src/wp-includes/class-wp-customize-manager.php

     
    13601360                                if ( ! $attachment_id ) {
    13611361
    13621362                                        // Copy file to temp location so that original file won't get deleted from theme after sideloading.
    1363                                         $temp_file_name = wp_tempnam( basename( $file_path ) );
     1363                                        $temp_file_name = wp_tempnam( wp_basename( $file_path ) );
    13641364                                        if ( $temp_file_name && copy( $file_path, $temp_file_name ) ) {
    13651365                                                $file_array['tmp_name'] = $temp_file_name;
    13661366                                        }
     
    16211621                        } else {
    16221622                                continue;
    16231623                        }
    1624                         $file_name = basename( $attachment['file'] );
     1624                        $file_name = wp_basename( $attachment['file'] );
    16251625
    16261626                        // Skip file types that are not recognized.
    16271627                        $checked_filetype = wp_check_filetype( $file_name );
     
    45944594
    45954595                if ( $this->return_url ) {
    45964596                        $return_url = $this->return_url;
    4597                 } elseif ( $referer && ! in_array( basename( parse_url( $referer, PHP_URL_PATH ) ), $excluded_referer_basenames, true ) ) {
     4597                } elseif ( $referer && ! in_array( wp_basename( parse_url( $referer, PHP_URL_PATH ) ), $excluded_referer_basenames, true ) ) {
    45984598                        $return_url = $referer;
    45994599                } elseif ( $this->preview_url ) {
    46004600                        $return_url = $this->preview_url;
  • src/wp-includes/class-wp-editor.php

     
    659659                                $page_template = get_page_template_slug( $post );
    660660
    661661                                if ( $page_template !== false ) {
    662                                         $page_template = empty( $page_template ) ? 'default' : str_replace( '.', '-', basename( $page_template, '.php' ) );
     662                                        $page_template = empty( $page_template ) ? 'default' : str_replace( '.', '-', wp_basename( $page_template, '.php' ) );
    663663                                        $body_class   .= ' page-template-' . sanitize_html_class( $page_template );
    664664                                }
    665665                        }
  • src/wp-includes/class-wp-theme.php

     
    202202
    203203                // Correct a situation where the theme is 'some-directory/some-theme' but 'some-directory' was passed in as part of the theme root instead.
    204204                if ( ! in_array( $theme_root, (array) $wp_theme_directories ) && in_array( dirname( $theme_root ), (array) $wp_theme_directories ) ) {
    205                         $this->stylesheet = basename( $this->theme_root ) . '/' . $this->stylesheet;
     205                        $this->stylesheet = wp_basename( $this->theme_root ) . '/' . $this->stylesheet;
    206206                        $this->theme_root = dirname( $theme_root );
    207207                }
    208208
     
    263263                        // Default themes always trump their pretenders.
    264264                        // Properly identify default themes that are inside a directory within wp-content/themes.
    265265                        if ( $default_theme_slug = array_search( $this->headers['Name'], self::$default_themes ) ) {
    266                                 if ( basename( $this->stylesheet ) != $default_theme_slug ) {
     266                                if ( wp_basename( $this->stylesheet ) != $default_theme_slug ) {
    267267                                        $this->headers['Name'] .= '/' . $this->stylesheet;
    268268                                }
    269269                        }
     
    12351235         *                                         or null for all extensions. Default null.
    12361236         * @param int               $depth         Optional. How many levels deep to search for files. Accepts 0, 1+, or
    12371237         *                                         -1 (infinite depth). Default 0.
    1238          * @param string            $relative_path Optional. The basename of the absolute path. Used to control the
     1238         * @param string            $relative_path Optional. The wp_basename of the absolute path. Used to control the
    12391239         *                                         returned path for the found files, particularly when this function
    12401240         *                                         recurses to lower depths. Default empty.
    12411241         * @return array|false Array of files, keyed by the path to the file relative to the `$path` directory prepended
  • src/wp-includes/customize/class-wp-customize-media-control.php

     
    9292                                        'url'   => $this->setting->default,
    9393                                        'type'  => $type,
    9494                                        'icon'  => wp_mime_type_icon( $type ),
    95                                         'title' => basename( $this->setting->default ),
     95                                        'title' => wp_basename( $this->setting->default ),
    9696                                );
    9797
    9898                                if ( 'image' === $type ) {
  • src/wp-includes/customize/class-wp-customize-new-menu-control.php

     
    3636         * @param array                $args    Args.
    3737         */
    3838        public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
    39                 _deprecated_file( basename( __FILE__ ), '4.9.0' ); // @todo Move this outside of class, and remove its require_once() from class-wp-customize-control.php. See #42364.
     39                _deprecated_file( wp_basename( __FILE__ ), '4.9.0' ); // @todo Move this outside of class, and remove its require_once() from class-wp-customize-control.php. See #42364.
    4040                parent::__construct( $manager, $id, $args );
    4141        }
    4242
  • src/wp-includes/customize/class-wp-customize-new-menu-section.php

     
    3838         * @param array                $args    Section arguments.
    3939         */
    4040        public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
    41                 _deprecated_file( basename( __FILE__ ), '4.9.0' ); // @todo Move this outside of class, and remove its require_once() from class-wp-customize-section.php. See #42364.
     41                _deprecated_file( wp_basename( __FILE__ ), '4.9.0' ); // @todo Move this outside of class, and remove its require_once() from class-wp-customize-section.php. See #42364.
    4242                parent::__construct( $manager, $id, $args );
    4343        }
    4444
  • src/wp-includes/deprecated.php

     
    18781878        if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) {
    18791879                // We have a thumbnail desired, specified and existing
    18801880
    1881                 $src_file = basename($src);
     1881                $src_file = wp_basename($src);
    18821882        } elseif ( wp_attachment_is_image( $post->ID ) ) {
    18831883                // We have an image without a thumbnail
    18841884
     
    18881888                // No thumb, no image. We'll look for a mime-related icon instead.
    18891889
    18901890                $icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' );
    1891                 $src_file = $icon_dir . '/' . basename($src);
     1891                $src_file = $icon_dir . '/' . wp_basename($src);
    18921892        }
    18931893
    18941894        if ( !isset($src) || !$src )
     
    30583058 */
    30593059function get_theme_data( $theme_file ) {
    30603060        _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
    3061         $theme = new WP_Theme( basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) );
     3061        $theme = new WP_Theme( wp_basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) );
    30623062
    30633063        $theme_data = array(
    30643064                'Name' => $theme->get('Name'),
  • src/wp-includes/embed-template.php

     
    88 * @deprecated 4.5.0 Moved to wp-includes/theme-compat/embed.php
    99 */
    1010
    11 _deprecated_file( basename( __FILE__ ), '4.5.0', 'wp-includes/theme-compat/embed.php' );
     11_deprecated_file( wp_basename( __FILE__ ), '4.5.0', 'wp-includes/theme-compat/embed.php' );
    1212
    1313include( ABSPATH . WPINC . '/theme-compat/embed.php' );
  • src/wp-includes/functions.php

     
    20962096                                if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) {
    20972097                                        $error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir'];
    20982098                                } else {
    2099                                         $error_path = basename( $uploads['basedir'] ) . $uploads['subdir'];
     2099                                        $error_path = wp_basename( $uploads['basedir'] ) . $uploads['subdir'];
    21002100                                }
    21012101
    21022102                                $uploads['error'] = sprintf(
     
    23812381                if ( 0 === strpos( $upload['basedir'], ABSPATH ) ) {
    23822382                        $error_path = str_replace( ABSPATH, '', $upload['basedir'] ) . $upload['subdir'];
    23832383                } else {
    2384                         $error_path = basename( $upload['basedir'] ) . $upload['subdir'];
     2384                        $error_path = wp_basename( $upload['basedir'] ) . $upload['subdir'];
    23852385                }
    23862386
    23872387                $message = sprintf(
  • src/wp-includes/general-template.php

     
    33873387                if ( 'application/x-patch' === $type || 'text/x-patch' === $type ) {
    33883388                        $type = 'text/x-diff';
    33893389                }
    3390         } elseif ( isset( $args['file'] ) && false !== strpos( basename( $args['file'] ), '.' ) ) {
     3390        } elseif ( isset( $args['file'] ) && false !== strpos( wp_basename( $args['file'] ), '.' ) ) {
    33913391                $extension = strtolower( pathinfo( $args['file'], PATHINFO_EXTENSION ) );
    33923392                foreach ( wp_get_mime_types() as $exts => $mime ) {
    33933393                        if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) {
  • src/wp-includes/l10n.php

     
    12581258        $lang_files = glob( ( is_null( $dir ) ? WP_LANG_DIR : $dir ) . '/*.mo' );
    12591259        if ( $lang_files ) {
    12601260                foreach ( $lang_files as $lang_file ) {
    1261                         $lang_file = basename( $lang_file, '.mo' );
     1261                        $lang_file = wp_basename( $lang_file, '.mo' );
    12621262                        if ( 0 !== strpos( $lang_file, 'continents-cities' ) && 0 !== strpos( $lang_file, 'ms-' ) &&
    12631263                                0 !== strpos( $lang_file, 'admin-' ) ) {
    12641264                                $languages[] = $lang_file;
  • src/wp-includes/locale.php

     
    77 * @since 1.2.0
    88 */
    99
    10 _deprecated_file( basename( __FILE__ ), '4.7.0' );
     10_deprecated_file( wp_basename( __FILE__ ), '4.7.0' );
  • src/wp-includes/media.php

     
    28712871        }
    28722872
    28732873        $file     = get_attached_file( $attachment->ID );
    2874         $filename = basename( $file );
     2874        $filename = wp_basename( $file );
    28752875
    28762876        $objects = array( 'attachment' );
    28772877
  • src/wp-includes/plugin.php

     
    652652//
    653653
    654654/**
    655  * Gets the basename of a plugin.
     655 * Gets the wp_basename of a plugin.
    656656 *
    657657 * This method extracts the name of a plugin from its filename.
    658658 *
  • src/wp-includes/post-template.php

     
    635635                        $template_parts = explode( '/', $template_slug );
    636636
    637637                        foreach ( $template_parts as $part ) {
    638                                 $classes[] = "{$post_type}-template-" . sanitize_html_class( str_replace( array( '.', '/' ), '-', basename( $part, '.php' ) ) );
     638                                $classes[] = "{$post_type}-template-" . sanitize_html_class( str_replace( array( '.', '/' ), '-', wp_basename( $part, '.php' ) ) );
    639639                        }
    640640                        $classes[] = "{$post_type}-template-" . sanitize_html_class( str_replace( '.', '-', $template_slug ) );
    641641                } else {
  • src/wp-includes/post.php

     
    54745474        if ( ! empty( $meta['thumb'] ) ) {
    54755475                // Don't delete the thumb if another attachment uses it.
    54765476                if ( ! $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%' . $wpdb->esc_like( $meta['thumb'] ) . '%', $post_id ) ) ) {
    5477                         $thumbfile = str_replace( basename( $file ), $meta['thumb'], $file );
     5477                        $thumbfile = str_replace( wp_basename( $file ), $meta['thumb'], $file );
    54785478                        if ( ! empty( $thumbfile ) ) {
    54795479                                $thumbfile = path_join( $uploadpath['basedir'], $thumbfile );
    54805480                                $thumbdir  = path_join( $uploadpath['basedir'], dirname( $file ) );
     
    54905490        if ( isset( $meta['sizes'] ) && is_array( $meta['sizes'] ) ) {
    54915491                $intermediate_dir = path_join( $uploadpath['basedir'], dirname( $file ) );
    54925492                foreach ( $meta['sizes'] as $size => $sizeinfo ) {
    5493                         $intermediate_file = str_replace( basename( $file ), $sizeinfo['file'], $file );
     5493                        $intermediate_file = str_replace( wp_basename( $file ), $sizeinfo['file'], $file );
    54945494                        if ( ! empty( $intermediate_file ) ) {
    54955495                                $intermediate_file = path_join( $uploadpath['basedir'], $intermediate_file );
    54965496
     
    56165616                                $url = str_replace( $uploads['basedir'], $uploads['baseurl'], $file );
    56175617                        } elseif ( false !== strpos( $file, 'wp-content/uploads' ) ) {
    56185618                                // Get the directory name relative to the basedir (back compat for pre-2.7 uploads)
    5619                                 $url = trailingslashit( $uploads['baseurl'] . '/' . _wp_get_attachment_relative_path( $file ) ) . basename( $file );
     5619                                $url = trailingslashit( $uploads['baseurl'] . '/' . _wp_get_attachment_relative_path( $file ) ) . wp_basename( $file );
    56205620                        } else {
    56215621                                // It's a newly-uploaded file, therefore $file is relative to the basedir.
    56225622                                $url = $uploads['baseurl'] . "/$file";
     
    57045704
    57055705        $file = get_attached_file( $post->ID );
    57065706
    5707         if ( ! empty( $imagedata['thumb'] ) && ( $thumbfile = str_replace( basename( $file ), $imagedata['thumb'], $file ) ) && file_exists( $thumbfile ) ) {
     5707        if ( ! empty( $imagedata['thumb'] ) && ( $thumbfile = str_replace( wp_basename( $file ), $imagedata['thumb'], $file ) ) && file_exists( $thumbfile ) ) {
    57085708                /**
    57095709                 * Filters the attachment thumbnail file path.
    57105710                 *
     
    57445744                return false;
    57455745        }
    57465746
    5747         $url = str_replace( basename( $url ), basename( $thumb ), $url );
     5747        $url = str_replace( wp_basename( $url ), wp_basename( $thumb ), $url );
    57485748
    57495749        /**
    57505750         * Filters the attachment thumbnail URL.
     
    58965896                                $uri  = array_shift( $dirs );
    58975897                                if ( $dh = opendir( $dir ) ) {
    58985898                                        while ( false !== $file = readdir( $dh ) ) {
    5899                                                 $file = basename( $file );
     5899                                                $file = wp_basename( $file );
    59005900                                                if ( substr( $file, 0, 1 ) == '.' ) {
    59015901                                                        continue;
    59025902                                                }
     
    59155915                }
    59165916
    59175917                $types = array();
    5918                 // Icon basename - extension = MIME wildcard.
     5918                // Icon wp_basename - extension = MIME wildcard.
    59195919                foreach ( $icon_files as $file => $uri ) {
    5920                         $types[ preg_replace( '/^([^.]*).*$/', '$1', basename( $file ) ) ] =& $icon_files[ $file ];
     5920                        $types[ preg_replace( '/^([^.]*).*$/', '$1', wp_basename( $file ) ) ] =& $icon_files[ $file ];
    59215921                }
    59225922
    59235923                if ( ! empty( $mime ) ) {
  • src/wp-includes/registration-functions.php

     
    44 *
    55 * @package WordPress
    66 */
    7 _deprecated_file( basename( __FILE__ ), '2.1.0', null, __( 'This file no longer needs to be included.' ) );
     7_deprecated_file( wp_basename( __FILE__ ), '2.1.0', null, __( 'This file no longer needs to be included.' ) );
  • src/wp-includes/registration.php

     
    44 *
    55 * @package WordPress
    66 */
    7 _deprecated_file( basename( __FILE__ ), '3.1.0', null, __( 'This file no longer needs to be included.' ) );
     7_deprecated_file( wp_basename( __FILE__ ), '3.1.0', null, __( 'This file no longer needs to be included.' ) );
  • src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php

     
    114114                        return $file;
    115115                }
    116116
    117                 $name       = basename( $file['file'] );
     117                $name       = wp_basename( $file['file'] );
    118118                $name_parts = pathinfo( $name );
    119119                $name       = trim( substr( $name, 0, -( 1 + strlen( $name_parts['extension'] ) ) ) );
    120120
     
    143143                $attachment->guid           = $url;
    144144
    145145                if ( empty( $attachment->post_title ) ) {
    146                         $attachment->post_title = preg_replace( '/\.[^.]+$/', '', basename( $file ) );
     146                        $attachment->post_title = preg_replace( '/\.[^.]+$/', '', wp_basename( $file ) );
    147147                }
    148148
    149149                // $post_parent is inherited from $attachment['post_parent'].
  • src/wp-includes/rss-functions.php

     
    55 * @package WordPress
    66 */
    77
    8 _deprecated_file( basename( __FILE__ ), '2.1.0', WPINC . '/rss.php' );
     8_deprecated_file( wp_basename( __FILE__ ), '2.1.0', WPINC . '/rss.php' );
    99require_once( ABSPATH . WPINC . '/rss.php' );
  • src/wp-includes/rss.php

     
    1616/**
    1717 * Deprecated. Use SimplePie (class-simplepie.php) instead.
    1818 */
    19 _deprecated_file( basename( __FILE__ ), '3.0.0', WPINC . '/class-simplepie.php' );
     19_deprecated_file( wp_basename( __FILE__ ), '3.0.0', WPINC . '/class-simplepie.php' );
    2020
    2121/**
    2222 * Fires before MagpieRSS is loaded, to optionally replace it.
  • src/wp-includes/session.php

     
    55 * @since 4.0.0
    66 */
    77
    8 _deprecated_file( basename( __FILE__ ), '4.7.0' );
     8_deprecated_file( wp_basename( __FILE__ ), '4.7.0' );
    99
    1010require_once( ABSPATH . WPINC . '/class-wp-session-tokens.php' );
    1111require_once( ABSPATH . WPINC . '/class-wp-user-meta-session-tokens.php' );
  • src/wp-includes/theme-compat/comments.php

     
    88 */
    99_deprecated_file(
    1010        /* translators: %s: template name */
    11         sprintf( __( 'Theme without %s' ), basename( __FILE__ ) ),
     11        sprintf( __( 'Theme without %s' ), wp_basename( __FILE__ ) ),
    1212        '3.0.0',
    1313        null,
    1414        /* translators: %s: template name */
    15         sprintf( __( 'Please include a %s template in your theme.' ), basename( __FILE__ ) )
     15        sprintf( __( 'Please include a %s template in your theme.' ), wp_basename( __FILE__ ) )
    1616);
    1717
    1818// Do not delete these lines
    19 if ( ! empty( $_SERVER['SCRIPT_FILENAME'] ) && 'comments.php' == basename( $_SERVER['SCRIPT_FILENAME'] ) ) {
     19if ( ! empty( $_SERVER['SCRIPT_FILENAME'] ) && 'comments.php' == wp_basename( $_SERVER['SCRIPT_FILENAME'] ) ) {
    2020        die( 'Please do not load this page directly. Thanks!' );
    2121}
    2222
  • src/wp-includes/theme-compat/footer.php

     
    88 */
    99_deprecated_file(
    1010        /* translators: %s: template name */
    11         sprintf( __( 'Theme without %s' ), basename( __FILE__ ) ),
     11        sprintf( __( 'Theme without %s' ), wp_basename( __FILE__ ) ),
    1212        '3.0.0',
    1313        null,
    1414        /* translators: %s: template name */
    15         sprintf( __( 'Please include a %s template in your theme.' ), basename( __FILE__ ) )
     15        sprintf( __( 'Please include a %s template in your theme.' ), wp_basename( __FILE__ ) )
    1616);
    1717?>
    1818
  • src/wp-includes/theme-compat/header.php

     
    88 */
    99_deprecated_file(
    1010        /* translators: %s: template name */
    11         sprintf( __( 'Theme without %s' ), basename( __FILE__ ) ),
     11        sprintf( __( 'Theme without %s' ), wp_basename( __FILE__ ) ),
    1212        '3.0.0',
    1313        null,
    1414        /* translators: %s: template name */
    15         sprintf( __( 'Please include a %s template in your theme.' ), basename( __FILE__ ) )
     15        sprintf( __( 'Please include a %s template in your theme.' ), wp_basename( __FILE__ ) )
    1616);
    1717?>
    1818<!DOCTYPE html>
  • src/wp-includes/theme-compat/sidebar.php

     
    88 */
    99_deprecated_file(
    1010        /* translators: %s: template name */
    11         sprintf( __( 'Theme without %s' ), basename( __FILE__ ) ),
     11        sprintf( __( 'Theme without %s' ), wp_basename( __FILE__ ) ),
    1212        '3.0.0',
    1313        null,
    1414        /* translators: %s: template name */
    15         sprintf( __( 'Please include a %s template in your theme.' ), basename( __FILE__ ) )
     15        sprintf( __( 'Please include a %s template in your theme.' ), wp_basename( __FILE__ ) )
    1616);
    1717?>
    1818        <div id="sidebar" role="complementary">
  • src/wp-includes/theme.php

     
    620620                        } elseif ( 0 === strpos( $theme_root, ABSPATH ) ) {
    621621                                $theme_root_uri = site_url( str_replace( ABSPATH, '', $theme_root ) );
    622622                        } elseif ( 0 === strpos( $theme_root, WP_PLUGIN_DIR ) || 0 === strpos( $theme_root, WPMU_PLUGIN_DIR ) ) {
    623                                 $theme_root_uri = plugins_url( basename( $theme_root ), $theme_root );
     623                                $theme_root_uri = plugins_url( wp_basename( $theme_root ), $theme_root );
    624624                        } else {
    625625                                $theme_root_uri = $theme_root;
    626626                        }
     
    29222922 */
    29232923function _wp_customize_include() {
    29242924
    2925         $is_customize_admin_page = ( is_admin() && 'customize.php' == basename( $_SERVER['PHP_SELF'] ) );
     2925        $is_customize_admin_page = ( is_admin() && 'customize.php' == wp_basename( $_SERVER['PHP_SELF'] ) );
    29262926        $should_include          = (
    29272927                $is_customize_admin_page
    29282928                ||
  • tests/phpunit/includes/abstract-testcase.php

     
    10621062                }
    10631063
    10641064                $attachment = array(
    1065                         'post_title'     => basename( $upload['file'] ),
     1065                        'post_title'     => wp_basename( $upload['file'] ),
    10661066                        'post_content'   => '',
    10671067                        'post_type'      => 'attachment',
    10681068                        'post_parent'    => $parent_post_id,
  • tests/phpunit/includes/factory/class-wp-unittest-factory-for-attachment.php

     
    4646         */
    4747        function create_upload_object( $file, $parent = 0 ) {
    4848                $contents = file_get_contents( $file );
    49                 $upload   = wp_upload_bits( basename( $file ), null, $contents );
     49                $upload   = wp_upload_bits( wp_basename( $file ), null, $contents );
    5050
    5151                $type = '';
    5252                if ( ! empty( $upload['type'] ) ) {
     
    5959                }
    6060
    6161                $attachment = array(
    62                         'post_title'     => basename( $upload['file'] ),
     62                        'post_title'     => wp_basename( $upload['file'] ),
    6363                        'post_content'   => '',
    6464                        'post_type'      => 'attachment',
    6565                        'post_parent'    => $parent,
  • tests/phpunit/includes/mock-fs.php

     
    215215
    216216        function __construct( $path ) {
    217217                $this->path = $path;
    218                 $this->name = basename( $path );
     218                $this->name = wp_basename( $path );
    219219        }
    220220
    221221        function is_file() {
  • tests/phpunit/tests/ajax/Attachments.php

     
    2929                $filename = DIR_TESTDATA . '/images/canola.jpg';
    3030                $contents = file_get_contents( $filename );
    3131
    32                 $upload     = wp_upload_bits( basename( $filename ), null, $contents );
     32                $upload     = wp_upload_bits( wp_basename( $filename ), null, $contents );
    3333                $attachment = $this->_make_attachment( $upload );
    3434
    3535                // Set up a default request
     
    8080                $filename = DIR_TESTDATA . '/formatting/entities.txt';
    8181                $contents = file_get_contents( $filename );
    8282
    83                 $upload     = wp_upload_bits( basename( $filename ), null, $contents );
     83                $upload     = wp_upload_bits( wp_basename( $filename ), null, $contents );
    8484                $attachment = $this->_make_attachment( $upload );
    8585
    8686                // Set up a default request
  • tests/phpunit/tests/ajax/MediaEdit.php

     
    3232                $filename = DIR_TESTDATA . '/images/canola.jpg';
    3333                $contents = file_get_contents( $filename );
    3434
    35                 $upload = wp_upload_bits( basename( $filename ), null, $contents );
     35                $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    3636                $id     = $this->_make_attachment( $upload );
    3737
    3838                $_REQUEST['action']  = 'image-editor';
     
    6363                $filename = DIR_TESTDATA . '/images/canola.jpg';
    6464                $contents = file_get_contents( $filename );
    6565
    66                 $upload = wp_upload_bits( basename( $filename ), null, $contents );
     66                $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    6767                $id     = $this->_make_attachment( $upload );
    6868
    6969                $_REQUEST['action']  = 'image-editor';
  • tests/phpunit/tests/blocks/block-parser.php

     
    8585         * @return string The cleaned fixture name.
    8686         */
    8787        protected function clean_fixture_filename( $filename ) {
    88                 $filename = basename( $filename );
     88                $filename = wp_basename( $filename );
    8989                $filename = preg_replace( '/\..+$/', '', $filename );
    9090                return $filename;
    9191        }
  • tests/phpunit/tests/blocks/render.php

     
    358358         * @return string The cleaned fixture name.
    359359         */
    360360        protected function clean_fixture_filename( $filename ) {
    361                 $filename = basename( $filename );
     361                $filename = wp_basename( $filename );
    362362                $filename = preg_replace( '/\..+$/', '', $filename );
    363363                return $filename;
    364364        }
  • tests/phpunit/tests/file.php

     
    170170                $file = wp_tempnam( $case );
    171171                unlink( $file );
    172172
    173                 $this->assertNotEmpty( basename( basename( $file, '.tmp' ), '.zip' ) );
     173                $this->assertNotEmpty( wp_basename( wp_basename( $file, '.tmp' ), '.zip' ) );
    174174        }
    175175        function data_wp_tempnam_filenames() {
    176176                return array(
  • tests/phpunit/tests/general/template.php

     
    231231                $filename = DIR_TESTDATA . '/images/test-image.jpg';
    232232                $contents = file_get_contents( $filename );
    233233
    234                 $upload              = wp_upload_bits( basename( $filename ), null, $contents );
     234                $upload              = wp_upload_bits( wp_basename( $filename ), null, $contents );
    235235                $this->site_icon_url = $upload['url'];
    236236
    237237                // Save the data
     
    409409        function _insert_custom_logo() {
    410410                $filename = DIR_TESTDATA . '/images/test-image.jpg';
    411411                $contents = file_get_contents( $filename );
    412                 $upload   = wp_upload_bits( basename( $filename ), null, $contents );
     412                $upload   = wp_upload_bits( wp_basename( $filename ), null, $contents );
    413413
    414414                // Save the data.
    415415                $this->custom_logo_url = $upload['url'];
  • tests/phpunit/tests/image/editor.php

     
    130130                );
    131131
    132132                // Test with no parameters
    133                 $this->assertEquals( 'canola-100x50.jpg', basename( $editor->generate_filename() ) );
     133                $this->assertEquals( 'canola-100x50.jpg', wp_basename( $editor->generate_filename() ) );
    134134
    135135                // Test with a suffix only
    136                 $this->assertEquals( 'canola-new.jpg', basename( $editor->generate_filename( 'new' ) ) );
     136                $this->assertEquals( 'canola-new.jpg', wp_basename( $editor->generate_filename( 'new' ) ) );
    137137
    138138                // Test with a destination dir only
    139139                $this->assertEquals( trailingslashit( realpath( get_temp_dir() ) ), trailingslashit( realpath( dirname( $editor->generate_filename( null, get_temp_dir() ) ) ) ) );
    140140
    141141                // Test with a suffix only
    142                 $this->assertEquals( 'canola-100x50.png', basename( $editor->generate_filename( null, null, 'png' ) ) );
     142                $this->assertEquals( 'canola-100x50.png', wp_basename( $editor->generate_filename( null, null, 'png' ) ) );
    143143
    144144                // Combo!
    145145                $this->assertEquals( trailingslashit( realpath( get_temp_dir() ) ) . 'canola-new.png', $editor->generate_filename( 'new', realpath( get_temp_dir() ), 'png' ) );
  • tests/phpunit/tests/image/intermediateSize.php

     
    1717
    1818        public function _make_attachment( $file, $parent_post_id = 0 ) {
    1919                $contents = file_get_contents( $file );
    20                 $upload   = wp_upload_bits( basename( $file ), null, $contents );
     20                $upload   = wp_upload_bits( wp_basename( $file ), null, $contents );
    2121
    2222                return parent::_make_attachment( $upload, $parent_post_id );
    2323        }
  • tests/phpunit/tests/image/resize.php

     
    2929        function test_resize_jpg() {
    3030                $image = $this->resize_helper( DIR_TESTDATA . '/images/test-image.jpg', 25, 25 );
    3131
    32                 $this->assertEquals( 'test-image-25x25.jpg', basename( $image ) );
     32                $this->assertEquals( 'test-image-25x25.jpg', wp_basename( $image ) );
    3333                list($w, $h, $type) = getimagesize( $image );
    3434                $this->assertEquals( 25, $w );
    3535                $this->assertEquals( 25, $h );
     
    4545                        $this->fail( sprintf( 'No PNG support in the editor engine %s on this system', $this->editor_engine ) );
    4646                }
    4747
    48                 $this->assertEquals( 'test-image-25x25.png', basename( $image ) );
     48                $this->assertEquals( 'test-image-25x25.png', wp_basename( $image ) );
    4949                list($w, $h, $type) = getimagesize( $image );
    5050                $this->assertEquals( 25, $w );
    5151                $this->assertEquals( 25, $h );
     
    6161                        $this->fail( sprintf( 'No GIF support in the editor engine %s on this system', $this->editor_engine ) );
    6262                }
    6363
    64                 $this->assertEquals( 'test-image-25x25.gif', basename( $image ) );
     64                $this->assertEquals( 'test-image-25x25.gif', wp_basename( $image ) );
    6565                list($w, $h, $type) = getimagesize( $image );
    6666                $this->assertEquals( 25, $w );
    6767                $this->assertEquals( 25, $h );
     
    8181        function test_resize_thumb_128x96() {
    8282                $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 128, 96 );
    8383
    84                 $this->assertEquals( '2007-06-17DSC_4173-64x96.jpg', basename( $image ) );
     84                $this->assertEquals( '2007-06-17DSC_4173-64x96.jpg', wp_basename( $image ) );
    8585                list($w, $h, $type) = getimagesize( $image );
    8686                $this->assertEquals( 64, $w );
    8787                $this->assertEquals( 96, $h );
     
    9393        function test_resize_thumb_128x0() {
    9494                $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 128, 0 );
    9595
    96                 $this->assertEquals( '2007-06-17DSC_4173-128x193.jpg', basename( $image ) );
     96                $this->assertEquals( '2007-06-17DSC_4173-128x193.jpg', wp_basename( $image ) );
    9797                list($w, $h, $type) = getimagesize( $image );
    9898                $this->assertEquals( 128, $w );
    9999                $this->assertEquals( 193, $h );
     
    105105        function test_resize_thumb_0x96() {
    106106                $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 0, 96 );
    107107
    108                 $this->assertEquals( '2007-06-17DSC_4173-64x96.jpg', basename( $image ) );
     108                $this->assertEquals( '2007-06-17DSC_4173-64x96.jpg', wp_basename( $image ) );
    109109                list($w, $h, $type) = getimagesize( $image );
    110110                $this->assertEquals( 64, $w );
    111111                $this->assertEquals( 96, $h );
     
    117117        function test_resize_thumb_150x150_crop() {
    118118                $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 150, 150, true );
    119119
    120                 $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', basename( $image ) );
     120                $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', wp_basename( $image ) );
    121121                list($w, $h, $type) = getimagesize( $image );
    122122                $this->assertEquals( 150, $w );
    123123                $this->assertEquals( 150, $h );
     
    129129        function test_resize_thumb_150x100_crop() {
    130130                $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 150, 100, true );
    131131
    132                 $this->assertEquals( '2007-06-17DSC_4173-150x100.jpg', basename( $image ) );
     132                $this->assertEquals( '2007-06-17DSC_4173-150x100.jpg', wp_basename( $image ) );
    133133                list($w, $h, $type) = getimagesize( $image );
    134134                $this->assertEquals( 150, $w );
    135135                $this->assertEquals( 100, $h );
     
    141141        function test_resize_thumb_50x150_crop() {
    142142                $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 50, 150, true );
    143143
    144                 $this->assertEquals( '2007-06-17DSC_4173-50x150.jpg', basename( $image ) );
     144                $this->assertEquals( '2007-06-17DSC_4173-50x150.jpg', wp_basename( $image ) );
    145145                list($w, $h, $type) = getimagesize( $image );
    146146                $this->assertEquals( 50, $w );
    147147                $this->assertEquals( 150, $h );
  • tests/phpunit/tests/image/siteIcon.php

     
    101101        function test_create_attachment_object() {
    102102                $attachment_id = $this->_insert_attachment();
    103103                $parent_url    = get_post( $attachment_id )->guid;
    104                 $cropped       = str_replace( basename( $parent_url ), 'cropped-test-image.jpg', $parent_url );
     104                $cropped       = str_replace( wp_basename( $parent_url ), 'cropped-test-image.jpg', $parent_url );
    105105
    106106                $object = $this->wp_site_icon->create_attachment_object( $cropped, $attachment_id );
    107107
     
    115115        function test_insert_cropped_attachment() {
    116116                $attachment_id = $this->_insert_attachment();
    117117                $parent_url    = get_post( $attachment_id )->guid;
    118                 $cropped       = str_replace( basename( $parent_url ), 'cropped-test-image.jpg', $parent_url );
     118                $cropped       = str_replace( wp_basename( $parent_url ), 'cropped-test-image.jpg', $parent_url );
    119119
    120120                $object     = $this->wp_site_icon->create_attachment_object( $cropped, $attachment_id );
    121121                $cropped_id = $this->wp_site_icon->insert_attachment( $object, $cropped );
     
    163163                $filename = DIR_TESTDATA . '/images/test-image.jpg';
    164164                $contents = file_get_contents( $filename );
    165165
    166                 $upload = wp_upload_bits( basename( $filename ), null, $contents );
     166                $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    167167
    168168                $this->attachment_id = $this->_make_attachment( $upload );
    169169                return $this->attachment_id;
  • tests/phpunit/tests/media.php

     
    15241524                // Copy hash generation method used in wp_save_image().
    15251525                $hash = 'e' . time() . rand( 100, 999 );
    15261526
    1527                 $filename_base = basename( $image_meta['file'], '.png' );
     1527                $filename_base = wp_basename( $image_meta['file'], '.png' );
    15281528
    15291529                // Add the hash to the image URL
    15301530                $image_url = str_replace( $filename_base, $filename_base . '-' . $hash, $image_url );
  • tests/phpunit/tests/post/attachments.php

     
    2727                $filename = ( DIR_TESTDATA . '/images/test-image.jpg' );
    2828                $contents = file_get_contents( $filename );
    2929
    30                 $upload = wp_upload_bits( basename( $filename ), null, $contents );
     30                $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    3131                $this->assertTrue( empty( $upload['error'] ) );
    3232
    3333                $id = $this->_make_attachment( $upload );
     
    3939
    4040                // medium, medium_large, and full size will both point to the original
    4141                $downsize = image_downsize( $id, 'medium' );
    42                 $this->assertEquals( basename( $upload['file'] ), basename( $downsize[0] ) );
     42                $this->assertEquals( wp_basename( $upload['file'] ), wp_basename( $downsize[0] ) );
    4343                $this->assertEquals( 50, $downsize[1] );
    4444                $this->assertEquals( 50, $downsize[2] );
    4545
    4646                $downsize = image_downsize( $id, 'medium_large' );
    47                 $this->assertEquals( basename( $upload['file'] ), basename( $downsize[0] ) );
     47                $this->assertEquals( wp_basename( $upload['file'] ), wp_basename( $downsize[0] ) );
    4848                $this->assertEquals( 50, $downsize[1] );
    4949                $this->assertEquals( 50, $downsize[2] );
    5050
    5151                $downsize = image_downsize( $id, 'full' );
    52                 $this->assertEquals( basename( $upload['file'] ), basename( $downsize[0] ) );
     52                $this->assertEquals( wp_basename( $upload['file'] ), wp_basename( $downsize[0] ) );
    5353                $this->assertEquals( 50, $downsize[1] );
    5454                $this->assertEquals( 50, $downsize[2] );
    5555
     
    6666                $filename = ( DIR_TESTDATA . '/images/a2-small.jpg' );
    6767                $contents = file_get_contents( $filename );
    6868
    69                 $upload = wp_upload_bits( basename( $filename ), null, $contents );
     69                $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    7070                $this->assertTrue( empty( $upload['error'] ) );
    7171
    7272                $id = $this->_make_attachment( $upload );
     
    8686
    8787                // image_downsize() should return the correct images and sizes
    8888                $downsize = image_downsize( $id, 'thumbnail' );
    89                 $this->assertEquals( 'a2-small-150x150.jpg', basename( $downsize[0] ) );
     89                $this->assertEquals( 'a2-small-150x150.jpg', wp_basename( $downsize[0] ) );
    9090                $this->assertEquals( 150, $downsize[1] );
    9191                $this->assertEquals( 150, $downsize[2] );
    9292
    9393                // medium, medium_large, and full will both point to the original
    9494                $downsize = image_downsize( $id, 'medium' );
    95                 $this->assertEquals( 'a2-small.jpg', basename( $downsize[0] ) );
     95                $this->assertEquals( 'a2-small.jpg', wp_basename( $downsize[0] ) );
    9696                $this->assertEquals( 400, $downsize[1] );
    9797                $this->assertEquals( 300, $downsize[2] );
    9898
    9999                $downsize = image_downsize( $id, 'medium_large' );
    100                 $this->assertEquals( 'a2-small.jpg', basename( $downsize[0] ) );
     100                $this->assertEquals( 'a2-small.jpg', wp_basename( $downsize[0] ) );
    101101                $this->assertEquals( 400, $downsize[1] );
    102102                $this->assertEquals( 300, $downsize[2] );
    103103
    104104                $downsize = image_downsize( $id, 'full' );
    105                 $this->assertEquals( 'a2-small.jpg', basename( $downsize[0] ) );
     105                $this->assertEquals( 'a2-small.jpg', wp_basename( $downsize[0] ) );
    106106                $this->assertEquals( 400, $downsize[1] );
    107107                $this->assertEquals( 300, $downsize[2] );
    108108
     
    122122                $filename = ( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG' );
    123123                $contents = file_get_contents( $filename );
    124124
    125                 $upload = wp_upload_bits( basename( $filename ), null, $contents );
     125                $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    126126                $this->assertTrue( empty( $upload['error'] ) );
    127127
    128128                $id      = $this->_make_attachment( $upload );
     
    146146
    147147                // image_downsize() should return the correct images and sizes
    148148                $downsize = image_downsize( $id, 'thumbnail' );
    149                 $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', basename( $downsize[0] ) );
     149                $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', wp_basename( $downsize[0] ) );
    150150                $this->assertEquals( 150, $downsize[1] );
    151151                $this->assertEquals( 150, $downsize[2] );
    152152
    153153                $downsize = image_downsize( $id, 'medium' );
    154                 $this->assertEquals( '2007-06-17DSC_4173-400x602.jpg', basename( $downsize[0] ) );
     154                $this->assertEquals( '2007-06-17DSC_4173-400x602.jpg', wp_basename( $downsize[0] ) );
    155155                $this->assertEquals( 400, $downsize[1] );
    156156                $this->assertEquals( 602, $downsize[2] );
    157157
    158158                $downsize = image_downsize( $id, 'medium_large' );
    159                 $this->assertEquals( '2007-06-17DSC_4173-600x904.jpg', basename( $downsize[0] ) );
     159                $this->assertEquals( '2007-06-17DSC_4173-600x904.jpg', wp_basename( $downsize[0] ) );
    160160                $this->assertEquals( 600, $downsize[1] );
    161161                $this->assertEquals( 904, $downsize[2] );
    162162
    163163                $downsize = image_downsize( $id, 'full' );
    164                 $this->assertEquals( '2007-06-17DSC_4173.jpg', basename( $downsize[0] ) );
     164                $this->assertEquals( '2007-06-17DSC_4173.jpg', wp_basename( $downsize[0] ) );
    165165                $this->assertEquals( 680, $downsize[1] );
    166166                $this->assertEquals( 1024, $downsize[2] );
    167167        }
     
    181181                $filename = ( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG' );
    182182                $contents = file_get_contents( $filename );
    183183
    184                 $upload = wp_upload_bits( basename( $filename ), null, $contents );
     184                $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    185185                $this->assertTrue( empty( $upload['error'] ) );
    186186
    187187                $id      = $this->_make_attachment( $upload );
     
    224224                $filename = ( DIR_TESTDATA . '/images/test-image.jpg' );
    225225                $contents = file_get_contents( $filename );
    226226
    227                 $upload = wp_upload_bits( basename( $filename ), null, $contents );
     227                $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    228228                $this->assertTrue( empty( $upload['error'] ) );
    229229
    230230                $upload['url'] = '';
     
    241241                $filename = ( DIR_TESTDATA . '/images/test-image.jpg' );
    242242                $contents = file_get_contents( $filename );
    243243
    244                 $upload = wp_upload_bits( basename( $filename ), null, $contents );
     244                $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    245245                $this->assertTrue( empty( $upload['error'] ) );
    246246
    247247                $id = $this->_make_attachment( $upload );
     
    267267                $filename = ( DIR_TESTDATA . '/images/test-image.jpg' );
    268268                $contents = file_get_contents( $filename );
    269269
    270                 $upload = wp_upload_bits( basename( $filename ), null, $contents );
     270                $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    271271                $this->assertTrue( empty( $upload['error'] ) );
    272272
    273273                $attachment_id = $this->_make_attachment( $upload );
     
    299299                $filename = DIR_TESTDATA . '/images/test-image.jpg';
    300300                $contents = file_get_contents( $filename );
    301301
    302                 $upload = wp_upload_bits( basename( $filename ), null, $contents );
     302                $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    303303                $this->assertTrue( empty( $upload['error'] ) );
    304304
    305305                // Set attachment ID.
     
    324324                $filename = DIR_TESTDATA . '/images/test-image.jpg';
    325325                $contents = file_get_contents( $filename );
    326326
    327                 $upload = wp_upload_bits( basename( $filename ), null, $contents );
     327                $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    328328                $this->assertTrue( empty( $upload['error'] ) );
    329329
    330330                // Set attachment ID.
     
    349349                $filename = ( DIR_TESTDATA . '/images/test-image.jpg' );
    350350                $contents = file_get_contents( $filename );
    351351
    352                 $upload = wp_upload_bits( basename( $filename ), null, $contents );
     352                $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    353353                $this->assertTrue( empty( $upload['error'] ) );
    354354
    355355                // Set attachment ID
     
    377377                $filename = ( DIR_TESTDATA . '/images/test-image.jpg' );
    378378                $contents = file_get_contents( $filename );
    379379
    380                 $upload = wp_upload_bits( basename( $filename ), null, $contents );
     380                $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    381381                $this->assertTrue( empty( $upload['error'] ) );
    382382
    383383                // Set attachment ID.
     
    405405                $filename = ( DIR_TESTDATA . '/images/test-image.jpg' );
    406406                $contents = file_get_contents( $filename );
    407407
    408                 $upload = wp_upload_bits( basename( $filename ), null, $contents );
     408                $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    409409                $this->assertTrue( empty( $upload['error'] ) );
    410410
    411411                // Set attachment ID
     
    432432                $filename = ( DIR_TESTDATA . '/images/test-image.jpg' );
    433433                $contents = file_get_contents( $filename );
    434434
    435                 $upload = wp_upload_bits( basename( $filename ), null, $contents );
     435                $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    436436                $this->assertTrue( empty( $upload['error'] ) );
    437437
    438438                // Set attachment ID
     
    454454                $filename = DIR_TESTDATA . '/images/test-image.jpg';
    455455                $contents = file_get_contents( $filename );
    456456
    457                 $upload        = wp_upload_bits( basename( $filename ), null, $contents );
     457                $upload        = wp_upload_bits( wp_basename( $filename ), null, $contents );
    458458                $attachment_id = $this->_make_attachment( $upload );
    459459
    460460                $this->assertTrue( wp_attachment_is_image( $attachment_id ) );
     
    472472                $filename = DIR_TESTDATA . '/images/test-image.psd';
    473473                $contents = file_get_contents( $filename );
    474474
    475                 $upload        = wp_upload_bits( basename( $filename ), null, $contents );
     475                $upload        = wp_upload_bits( wp_basename( $filename ), null, $contents );
    476476                $attachment_id = $this->_make_attachment( $upload );
    477477
    478478                $this->assertFalse( wp_attachment_is_image( $attachment_id ) );
     
    489489                $filename = DIR_TESTDATA . '/images/test-image.jpg';
    490490                $contents = file_get_contents( $filename );
    491491
    492                 $upload = wp_upload_bits( basename( $filename ), null, $contents );
     492                $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    493493
    494494                $this->assertFalse( $upload['error'] );
    495495
    496496                add_filter( 'upload_mimes', array( $this, 'blacklist_jpg_mime_type' ) );
    497497
    498                 $upload = wp_upload_bits( basename( $filename ), null, $contents );
     498                $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    499499
    500500                remove_filter( 'upload_mimes', array( $this, 'blacklist_jpg_mime_type' ) );
    501501
  • tests/phpunit/tests/rest-api/rest-attachments-controller.php

     
    14351435                        )
    14361436                );
    14371437
    1438                 $filename = basename( $this->test_file2 );
     1438                $filename = wp_basename( $this->test_file2 );
    14391439
    14401440                $request = new WP_REST_Request( 'GET', '/wp/v2/media' );
    14411441                $request->set_param( 'search', $filename );
  • tests/phpunit/tests/theme/WPTheme.php

     
    103103
    104104                // Check that in a URI path, we have raw url encoding (spaces become %20)
    105105                // Don't try to verify the complete URI path. get_theme_root_uri() breaks down quickly.
    106                 $this->assertEquals( 'theme%20with%20spaces', basename( $theme->get_stylesheet_directory_uri() ) );
    107                 $this->assertEquals( 'theme%20with%20spaces', basename( $theme->get_template_directory_uri() ) );
     106                $this->assertEquals( 'theme%20with%20spaces', wp_basename( $theme->get_stylesheet_directory_uri() ) );
     107                $this->assertEquals( 'theme%20with%20spaces', wp_basename( $theme->get_template_directory_uri() ) );
    108108
    109109                // Check that wp_customize_url() uses url encoding, as it is a query arg (spaces become +)
    110110                $this->assertEquals( admin_url( 'customize.php?theme=theme+with+spaces' ), wp_customize_url( 'theme with spaces' ) );
  • tests/phpunit/tests/theme.php

     
    276276
    277277                                // template files that do exist
    278278                                //foreach ($theme['Template Files'] as $path) {
    279                                 //$file = basename($path, '.php');
     279                                //$file = wp_basename($path, '.php');
    280280                                // FIXME: untestable because get_query_template uses TEMPLATEPATH
    281281                                //$this->assertEquals('', get_query_template($file));
    282282                                //}
  • tests/phpunit/tests/xmlrpc/wp/getMediaItem.php

     
    2020
    2121                $filename = ( DIR_TESTDATA . '/images/waffles.jpg' );
    2222                $contents = file_get_contents( $filename );
    23                 $upload   = wp_upload_bits( basename( $filename ), null, $contents );
     23                $upload   = wp_upload_bits( wp_basename( $filename ), null, $contents );
    2424
    2525                $this->attachment_id   = $this->_make_attachment( $upload, self::$post_id );
    2626                $this->attachment_data = get_post( $this->attachment_id, ARRAY_A );