Ticket #43170: 43170.diff
File 43170.diff, 86.0 KB (added by , 6 years ago) |
---|
-
src/wp-admin/admin-functions.php
9 9 * @subpackage Administration 10 10 */ 11 11 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' ); 13 13 14 14 /** WordPress Administration API: Includes all Administration functions. */ 15 15 require_once( ABSPATH . 'wp-admin/includes/admin.php' ); -
src/wp-admin/custom-background.php
494 494 $url = $file['url']; 495 495 $type = $file['type']; 496 496 $file = $file['file']; 497 $filename = basename( $file );497 $filename = wp_basename( $file ); 498 498 499 499 // Construct the object array 500 500 $object = array( -
src/wp-admin/custom-header.php
820 820 return $this->finished(); 821 821 } elseif ( $width > $max_width ) { 822 822 $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 ) ); 824 824 if ( ! $image || is_wp_error( $image ) ) { 825 825 wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); 826 826 } … … 828 828 /** This filter is documented in wp-admin/custom-header.php */ 829 829 $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication 830 830 831 $url = str_replace( basename( $url ),basename( $image ), $url );831 $url = str_replace( wp_basename( $url ), wp_basename( $image ), $url ); 832 832 $width = $width / $oitar; 833 833 $height = $height / $oitar; 834 834 } else { … … 895 895 $url = $file['url']; 896 896 $type = $file['type']; 897 897 $file = $file['file']; 898 $filename = basename( $file );898 $filename = wp_basename( $file ); 899 899 900 900 // Construct the object array 901 901 $object = array( … … 984 984 $this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) ); 985 985 986 986 // Cleanup. 987 $medium = str_replace( basename( $original ), 'midsize-' .basename( $original ), $original );987 $medium = str_replace( wp_basename( $original ), 'midsize-' . wp_basename( $original ), $original ); 988 988 if ( file_exists( $medium ) ) { 989 989 wp_delete_file( $medium ); 990 990 } … … 1208 1208 final public function create_attachment_object( $cropped, $parent_attachment_id ) { 1209 1209 $parent = get_post( $parent_attachment_id ); 1210 1210 $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 ); 1212 1212 1213 1213 $size = @getimagesize( $cropped ); 1214 1214 $image_type = ( $size ) ? $size['mime'] : 'image/jpeg'; … … 1215 1215 1216 1216 $object = array( 1217 1217 'ID' => $parent_attachment_id, 1218 'post_title' => basename( $cropped ),1218 'post_title' => wp_basename( $cropped ), 1219 1219 'post_mime_type' => $image_type, 1220 1220 'guid' => $url, 1221 1221 'context' => 'custom-header', -
src/wp-admin/includes/ajax-actions.php
3651 3651 $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication. 3652 3652 3653 3653 $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 ); 3655 3655 3656 3656 $size = @getimagesize( $cropped ); 3657 3657 $image_type = ( $size ) ? $size['mime'] : 'image/jpeg'; 3658 3658 3659 3659 $object = array( 3660 'post_title' => basename( $cropped ),3660 'post_title' => wp_basename( $cropped ), 3661 3661 'post_content' => $url, 3662 3662 'post_mime_type' => $image_type, 3663 3663 'guid' => $url, -
src/wp-admin/includes/class-pclzip.php
2962 2962 2963 2963 // ----- Look for all path to remove 2964 2964 if ($p_remove_all_dir) { 2965 $v_stored_filename = basename($p_filename);2965 $v_stored_filename = wp_basename($p_filename); 2966 2966 } 2967 2967 // ----- Look for partial path remove 2968 2968 else if ($p_remove_dir != "") { … … 3642 3642 return $v_result; 3643 3643 } 3644 3644 3645 // ----- Get the basename of the path3646 $p_entry['filename'] = basename($p_entry['filename']);3645 // ----- Get the wp_basename of the path 3646 $p_entry['filename'] = wp_basename($p_entry['filename']); 3647 3647 } 3648 3648 3649 3649 // ----- Look for path to remove -
src/wp-admin/includes/class-wp-filesystem-direct.php
439 439 */ 440 440 public function dirlist( $path, $include_hidden = true, $recursive = false ) { 441 441 if ( $this->is_file( $path ) ) { 442 $limit_file = basename( $path );442 $limit_file = wp_basename( $path ); 443 443 $path = dirname( $path ); 444 444 } else { 445 445 $limit_file = false; -
src/wp-admin/includes/class-wp-filesystem-ftpext.php
530 530 */ 531 531 public function dirlist( $path = '.', $include_hidden = true, $recursive = false ) { 532 532 if ( $this->is_file( $path ) ) { 533 $limit_file = basename( $path );533 $limit_file = wp_basename( $path ); 534 534 $path = dirname( $path ) . '/'; 535 535 } else { 536 536 $limit_file = false; -
src/wp-admin/includes/class-wp-filesystem-ftpsockets.php
461 461 */ 462 462 public function dirlist( $path = '.', $include_hidden = true, $recursive = false ) { 463 463 if ( $this->is_file( $path ) ) { 464 $limit_file = basename( $path );464 $limit_file = wp_basename( $path ); 465 465 $path = dirname( $path ) . '/'; 466 466 } else { 467 467 $limit_file = false; -
src/wp-admin/includes/class-wp-filesystem-ssh2.php
551 551 */ 552 552 public function dirlist( $path, $include_hidden = true, $recursive = false ) { 553 553 if ( $this->is_file( $path ) ) { 554 $limit_file = basename( $path );554 $limit_file = wp_basename( $path ); 555 555 $path = dirname( $path ); 556 556 } else { 557 557 $limit_file = false; -
src/wp-admin/includes/class-wp-site-icon.php
85 85 public function create_attachment_object( $cropped, $parent_attachment_id ) { 86 86 $parent = get_post( $parent_attachment_id ); 87 87 $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 ); 89 89 90 90 $size = @getimagesize( $cropped ); 91 91 $image_type = ( $size ) ? $size['mime'] : 'image/jpeg'; … … 92 92 93 93 $object = array( 94 94 'ID' => $parent_attachment_id, 95 'post_title' => basename( $cropped ),95 'post_title' => wp_basename( $cropped ), 96 96 'post_content' => $url, 97 97 'post_mime_type' => $image_type, 98 98 'guid' => $url, -
src/wp-admin/includes/class-wp-upgrader-skins.php
7 7 * @since 2.8.0 8 8 */ 9 9 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' ); 11 11 12 12 /** WP_Upgrader_Skin class */ 13 13 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader-skin.php'; -
src/wp-admin/includes/class-wp-upgrader.php
231 231 break; 232 232 default: 233 233 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 ) ) ) ); 235 235 } 236 236 break; 237 237 } … … 312 312 } 313 313 314 314 // 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' ); 316 316 317 317 // Clean up working directory 318 318 if ( $wp_filesystem->is_dir( $working_dir ) ) { … … 540 540 } 541 541 542 542 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 ) ); 545 545 } 546 546 547 547 if ( $clear_destination ) { … … 595 595 $wp_filesystem->delete( $remote_source, true ); 596 596 } 597 597 598 $destination_name = basename( str_replace( $local_destination, '', $destination ) );598 $destination_name = wp_basename( str_replace( $local_destination, '', $destination ) ); 599 599 if ( '.' == $destination_name ) { 600 600 $destination_name = ''; 601 601 } … … 795 795 * @type string $action Type of action. Default 'update'. 796 796 * @type string $type Type of update process. Accepts 'plugin', 'theme', 'translation', or 'core'. 797 797 * @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. 799 799 * @type array $themes The theme slugs. 800 800 * @type array $translations { 801 801 * Array of translations update data. -
src/wp-admin/includes/file.php
72 72 * @global array $wp_file_descriptions Theme file descriptions. 73 73 * @global array $allowed_files List of allowed files. 74 74 * @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 template75 * @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 77 77 */ 78 78 function get_file_description( $file ) { 79 79 global $wp_file_descriptions, $allowed_files; … … 81 81 $dirname = pathinfo( $file, PATHINFO_DIRNAME ); 82 82 83 83 $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 ) ]; 86 86 } elseif ( file_exists( $file_path ) && is_file( $file_path ) ) { 87 87 $template_data = implode( '', file( $file_path ) ); 88 88 if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) ) { … … 90 90 } 91 91 } 92 92 93 return trim( basename( $file ) );93 return trim( wp_basename( $file ) ); 94 94 } 95 95 96 96 /** … … 630 630 $filename = uniqid(); 631 631 } 632 632 633 // Use the basename of the given file without the extension as the name for the temporary directory634 $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 ); 635 635 $temp_filename = preg_replace( '|\.[^.]*$|', '', $temp_filename ); 636 636 637 637 // If the folder is falsey, use its parent directory name instead. … … 857 857 if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) { 858 858 $error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir']; 859 859 } else { 860 $error_path = basename( $uploads['basedir'] ) . $uploads['subdir'];860 $error_path = wp_basename( $uploads['basedir'] ) . $uploads['subdir']; 861 861 } 862 862 return $upload_error_handler( $file, sprintf( __( 'The uploaded file could not be moved to %s.' ), $error_path ) ); 863 863 } … … 976 976 return new WP_Error( 'http_no_url', __( 'Invalid URL Provided.' ) ); 977 977 } 978 978 979 $url_filename = basename( parse_url( $url, PHP_URL_PATH ) );979 $url_filename = wp_basename( parse_url( $url, PHP_URL_PATH ) ); 980 980 981 981 $tmpfname = wp_tempnam( $url_filename ); 982 982 if ( ! $tmpfname ) { -
src/wp-admin/includes/image-edit.php
33 33 $backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true ); 34 34 $can_restore = false; 35 35 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'] ); 37 37 } 38 38 39 39 if ( $msg ) { -
src/wp-admin/includes/image.php
47 47 } 48 48 49 49 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 ); 51 51 } 52 52 53 53 /* … … 56 56 */ 57 57 wp_mkdir_p( dirname( $dst_file ) ); 58 58 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 ) ); 60 60 61 61 $result = $editor->save( $dst_file ); 62 62 if ( is_wp_error( $result ) ) { … … 189 189 $ext = '.png'; 190 190 break; 191 191 } 192 $basename = str_replace( '.', '-', basename( $file ) ) . '-image' . $ext;192 $basename = str_replace( '.', '-', wp_basename( $file ) ) . '-image' . $ext; 193 193 $uploaded = wp_upload_bits( $basename, '', $metadata['image']['data'] ); 194 194 if ( false === $uploaded['error'] ) { 195 195 $image_attachment = array( … … 711 711 } 712 712 713 713 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 ) ); 716 716 717 717 /* 718 718 * The directory containing the original file may no longer -
src/wp-admin/includes/import.php
99 99 100 100 // Construct the object array 101 101 $object = array( 102 'post_title' => basename( $upload['file'] ),102 'post_title' => wp_basename( $upload['file'] ), 103 103 'post_content' => $upload['url'], 104 104 'post_mime_type' => $upload['type'], 105 105 'guid' => $upload['url'], -
src/wp-admin/includes/media.php
434 434 $url = $file['url']; 435 435 $type = $file['type']; 436 436 $file = $file['file']; 437 $title = preg_replace( '/\.[^.]+$/', '', basename( $file ) );437 $title = preg_replace( '/\.[^.]+$/', '', wp_basename( $file ) ); 438 438 $content = ''; 439 439 440 440 // Use image exif/iptc data for title and caption defaults if possible. … … 826 826 if ( isset( $_POST['media_type'] ) && 'image' != $_POST['media_type'] ) { 827 827 $title = esc_html( wp_unslash( $_POST['title'] ) ); 828 828 if ( empty( $title ) ) { 829 $title = esc_html( basename( $src ) );829 $title = esc_html( wp_basename( $src ) ); 830 830 } 831 831 832 832 if ( $title && $src ) { … … 930 930 } 931 931 932 932 $file_array = array(); 933 $file_array['name'] = basename( $matches[0] );933 $file_array['name'] = wp_basename( $matches[0] ); 934 934 935 935 // Download file to temp location. 936 936 $file_array['tmp_name'] = download_url( $file ); -
src/wp-admin/includes/menu.php
52 52 if ( isset( $hook_args['post_type'] ) ) { 53 53 $hook_name = $hook_args['post_type']; 54 54 } else { 55 $hook_name = basename( $hook_name, '.php' );55 $hook_name = wp_basename( $hook_name, '.php' ); 56 56 } 57 57 unset( $hook_args ); 58 58 } else { 59 $hook_name = basename( $menu_page[2], '.php' );59 $hook_name = wp_basename( $menu_page[2], '.php' ); 60 60 } 61 61 $hook_name = sanitize_title( $hook_name ); 62 62 -
src/wp-admin/includes/misc.php
362 362 aria-posinset="<?php echo esc_attr( $index ); ?>"> 363 363 <?php 364 364 $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 ) { 366 366 $file_description .= '<br /><span class="nonessential">(' . esc_html( $filename ) . ')</span>'; 367 367 } 368 368 -
src/wp-admin/includes/ms.php
687 687 $output = array(); 688 688 689 689 foreach ( (array) $lang_files as $val ) { 690 $code_lang = basename( $val, '.mo' );690 $code_lang = wp_basename( $val, '.mo' ); 691 691 692 692 if ( $code_lang == 'en_US' ) { // American English 693 693 $flag = true; -
src/wp-admin/includes/plugin.php
153 153 load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) ); 154 154 } 155 155 } 156 } elseif ( 'hello.php' == basename( $plugin_file ) ) {156 } elseif ( 'hello.php' == wp_basename( $plugin_file ) ) { 157 157 $textdomain = 'default'; 158 158 } 159 159 if ( $textdomain ) { … … 648 648 * Fires as a specific plugin is being activated. 649 649 * 650 650 * 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. 652 652 * 653 653 * If a plugin is silently activated (such as during an update), this hook does not fire. 654 654 * … … 763 763 * Fires as a specific plugin is being deactivated. 764 764 * 765 765 * 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. 767 767 * 768 768 * If a plugin is silently deactivated (such as during an update), this hook does not fire. 769 769 * … … 1130 1130 /** 1131 1131 * Fires in uninstall_plugin() once the plugin has been uninstalled. 1132 1132 * 1133 * The action concatenates the 'uninstall_' prefix with the basename of the1133 * The action concatenates the 'uninstall_' prefix with the wp_basename of the 1134 1134 * plugin passed to uninstall_plugin() to create a dynamically-named action. 1135 1135 * 1136 1136 * @since 2.7.0 -
src/wp-admin/includes/update-core.php
965 965 // Check to see which files don't really need updating - only available for 3.7 and higher 966 966 if ( function_exists( 'get_core_checksums' ) ) { 967 967 // 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; 969 969 970 970 $checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' ); 971 971 if ( is_array( $checksums ) && isset( $checksums[ $wp_version ] ) ) { … … 1385 1385 } 1386 1386 1387 1387 // 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 ); 1389 1389 1390 1390 if ( ! $wp_filesystem->exists( $remote_file ) ) { 1391 1391 continue; -
src/wp-admin/includes/update.php
363 363 /** 364 364 * Displays update information for a plugin. 365 365 * 366 * @param string $file Plugin basename.366 * @param string $file Plugin wp_basename. 367 367 * @param array $plugin_data Plugin information. 368 368 * @return false|void 369 369 */ -
src/wp-admin/includes/upgrade.php
3190 3190 $plugins = __get_option( 'active_plugins' ); 3191 3191 3192 3192 foreach ( (array) $plugins as $plugin ) { 3193 if ( basename( $plugin ) == 'widgets.php' ) {3193 if ( wp_basename( $plugin ) == 'widgets.php' ) { 3194 3194 array_splice( $plugins, array_search( $plugin, $plugins ), 1 ); 3195 3195 update_option( 'active_plugins', $plugins ); 3196 3196 break; -
src/wp-admin/plugin-editor.php
293 293 $referer = wp_get_referer(); 294 294 $excluded_referer_basenames = array( 'plugin-editor.php', 'wp-login.php' ); 295 295 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 ) ) { 297 297 $return_url = $referer; 298 298 } else { 299 299 $return_url = admin_url( '/' ); -
src/wp-admin/theme-editor.php
326 326 $referer = wp_get_referer(); 327 327 $excluded_referer_basenames = array( 'theme-editor.php', 'wp-login.php' ); 328 328 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 ) ) { 330 330 $return_url = $referer; 331 331 } else { 332 332 $return_url = admin_url( '/' ); -
src/wp-admin/update.php
153 153 $submenu_file = 'plugin-install.php'; 154 154 require_once( ABSPATH . 'wp-admin/admin-header.php' ); 155 155 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 ) ) ); 157 157 $nonce = 'plugin-upload'; 158 158 $url = add_query_arg( array( 'package' => $file_upload->id ), 'update.php?action=upload-plugin' ); 159 159 $type = 'upload'; //Install plugin type, From Web or an Upload. … … 271 271 272 272 require_once( ABSPATH . 'wp-admin/admin-header.php' ); 273 273 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 ) ) ); 275 275 $nonce = 'theme-upload'; 276 276 $url = add_query_arg( array( 'package' => $file_upload->id ), 'update.php?action=upload-theme' ); 277 277 $type = 'upload'; //Install plugin type, From Web or an Upload. -
src/wp-admin/upgrade-functions.php
8 8 * @subpackage Administration 9 9 */ 10 10 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' ); 12 12 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); -
src/wp-content/themes/twentyten/loop-attachment.php
138 138 <div class="nav-next"><?php next_image_link( false ); ?></div> 139 139 </div><!-- #nav-below --> 140 140 <?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> 142 142 <?php endif; ?> 143 143 </div><!-- .entry-attachment --> 144 144 <div class="entry-caption"> -
src/wp-includes/ID3/getid3.lib.php
1380 1380 if (include_once($filename)) { 1381 1381 return true; 1382 1382 } else { 1383 $diemessage = basename($sourcefile).' depends on '.$filename.', which has errors';1383 $diemessage = wp_basename($sourcefile).' depends on '.$filename.', which has errors'; 1384 1384 } 1385 1385 } else { 1386 $diemessage = basename($sourcefile).' depends on '.$filename.', which is missing';1386 $diemessage = wp_basename($sourcefile).' depends on '.$filename.', which is missing'; 1387 1387 } 1388 1388 if ($DieOnFailure) { 1389 1389 throw new Exception($diemessage); -
src/wp-includes/Requests/Exception/HTTP.php
68 68 69 69 return 'Requests_Exception_HTTP_Unknown'; 70 70 } 71 } 72 No newline at end of file 71 } -
src/wp-includes/Requests/Proxy/HTTP.php
148 148 public function get_auth_string() { 149 149 return $this->user . ':' . $this->pass; 150 150 } 151 } 152 No newline at end of file 151 } -
src/wp-includes/SimplePie/Core.php
54 54 class SimplePie_Core extends SimplePie 55 55 { 56 56 57 } 58 No newline at end of file 57 } -
src/wp-includes/Text/Diff.php
44 44 if ($engine == 'auto') { 45 45 $engine = extension_loaded('xdiff') ? 'xdiff' : 'native'; 46 46 } else { 47 $engine = basename($engine);47 $engine = wp_basename($engine); 48 48 } 49 49 50 50 // WP #7391 -
src/wp-includes/canonical.php
322 322 'wp-rss.php' => 'rss2', 323 323 'wp-rss2.php' => 'rss2', 324 324 ); 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'] ) ] ); 327 327 wp_redirect( $redirect_url, 301 ); 328 328 die(); 329 329 } … … 361 361 $redirect_url = $redirect['scheme'] . '://' . $redirect['host'] . $redirect['path']; 362 362 } 363 363 364 if ( 'wp-register.php' == basename( $redirect['path'] ) ) {364 if ( 'wp-register.php' == wp_basename( $redirect['path'] ) ) { 365 365 if ( is_multisite() ) { 366 366 /** This filter is documented in wp-login.php */ 367 367 $redirect_url = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ); -
src/wp-includes/category.php
128 128 $category_path = str_replace( '%2F', '/', $category_path ); 129 129 $category_path = str_replace( '%20', ' ', $category_path ); 130 130 $category_paths = '/' . trim( $category_path, '/' ); 131 $leaf_path = sanitize_title( basename( $category_paths ) );131 $leaf_path = sanitize_title( wp_basename( $category_paths ) ); 132 132 $category_paths = explode( '/', $category_paths ); 133 133 $full_path = ''; 134 134 foreach ( (array) $category_paths as $pathdir ) { -
src/wp-includes/class-IXR.php
57 57 58 58 require_once( ABSPATH . WPINC . '/IXR/class-IXR-request.php' ); 59 59 60 require_once( ABSPATH . WPINC . '/IXR/class-IXR-value.php' ); 61 No newline at end of file 60 require_once( ABSPATH . WPINC . '/IXR/class-IXR-value.php' ); -
src/wp-includes/class-feed.php
6 6 * @subpackage Feed 7 7 */ 8 8 9 _deprecated_file( basename( __FILE__ ), '4.7.0', 'fetch_feed()' );9 _deprecated_file( wp_basename( __FILE__ ), '4.7.0', 'fetch_feed()' ); 10 10 11 11 if ( ! class_exists( 'SimplePie', false ) ) { 12 12 require_once( ABSPATH . WPINC . '/class-simplepie.php' ); -
src/wp-includes/class-http.php
137 137 * Default ABSPATH . WPINC . '/certificates/ca-bundle.crt'. 138 138 * @type bool $stream Whether to stream to a file. If set to true and no filename was 139 139 * 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. 141 141 * @type string $filename Filename of the file to write to when streaming. $stream must be 142 142 * set to true. Default null. 143 143 * @type int $limit_response_size Size in bytes to limit the response to. Default null. … … 280 280 } 281 281 282 282 // 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 $url283 // and pick its name using the wp_basename of the $url 284 284 if ( $r['stream'] ) { 285 285 if ( empty( $r['filename'] ) ) { 286 $r['filename'] = get_temp_dir() . basename( $url );286 $r['filename'] = get_temp_dir() . wp_basename( $url ); 287 287 } 288 288 289 289 // 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
2515 2515 $type = self::filenameToType($path); 2516 2516 } 2517 2517 2518 $filename = basename($path);2518 $filename = wp_basename($path); 2519 2519 if ($name == '') { 2520 2520 $name = $filename; 2521 2521 } … … 3003 3003 $this->attachment[] = array( 3004 3004 0 => $string, 3005 3005 1 => $filename, 3006 2 => basename($filename),3006 2 => wp_basename($filename), 3007 3007 3 => $encoding, 3008 3008 4 => $type, 3009 3009 5 => true, // isStringAttachment … … 3041 3041 $type = self::filenameToType($path); 3042 3042 } 3043 3043 3044 $filename = basename($path);3044 $filename = wp_basename($path); 3045 3045 if ($name == '') { 3046 3046 $name = $filename; 3047 3047 } … … 3432 3432 // Do not change absolute URLs, including anonymous protocol 3433 3433 && !preg_match('#^[a-z][a-z0-9+.-]*:?//#i', $url) 3434 3434 ) { 3435 $filename = basename($url);3435 $filename = wp_basename($url); 3436 3436 $directory = dirname($url); 3437 3437 if ($directory == '.') { 3438 3438 $directory = ''; -
src/wp-includes/class-snoopy.php
3 3 /** 4 4 * Deprecated. Use WP_HTTP (http.php) instead. 5 5 */ 6 _deprecated_file( basename( __FILE__ ), '3.0.0', WPINC . '/http.php' );6 _deprecated_file( wp_basename( __FILE__ ), '3.0.0', WPINC . '/http.php' ); 7 7 8 8 if ( ! class_exists( 'Snoopy', false ) ) : 9 9 /************************************************* … … 1241 1241 $fp = fopen($file_name, "r"); 1242 1242 $file_content = fread($fp, filesize($file_name)); 1243 1243 fclose($fp); 1244 $base_name = basename($file_name);1244 $base_name = wp_basename($file_name); 1245 1245 1246 1246 $postdata .= "--".$this->_mime_boundary."\r\n"; 1247 1247 $postdata .= "Content-Disposition: form-data; name=\"$field_name\"; filename=\"$base_name\"\r\n\r\n"; -
src/wp-includes/class-wp-customize-manager.php
1360 1360 if ( ! $attachment_id ) { 1361 1361 1362 1362 // 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 ) ); 1364 1364 if ( $temp_file_name && copy( $file_path, $temp_file_name ) ) { 1365 1365 $file_array['tmp_name'] = $temp_file_name; 1366 1366 } … … 1621 1621 } else { 1622 1622 continue; 1623 1623 } 1624 $file_name = basename( $attachment['file'] );1624 $file_name = wp_basename( $attachment['file'] ); 1625 1625 1626 1626 // Skip file types that are not recognized. 1627 1627 $checked_filetype = wp_check_filetype( $file_name ); … … 4594 4594 4595 4595 if ( $this->return_url ) { 4596 4596 $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 ) ) { 4598 4598 $return_url = $referer; 4599 4599 } elseif ( $this->preview_url ) { 4600 4600 $return_url = $this->preview_url; -
src/wp-includes/class-wp-editor.php
659 659 $page_template = get_page_template_slug( $post ); 660 660 661 661 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' ) ); 663 663 $body_class .= ' page-template-' . sanitize_html_class( $page_template ); 664 664 } 665 665 } -
src/wp-includes/class-wp-theme.php
202 202 203 203 // Correct a situation where the theme is 'some-directory/some-theme' but 'some-directory' was passed in as part of the theme root instead. 204 204 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; 206 206 $this->theme_root = dirname( $theme_root ); 207 207 } 208 208 … … 263 263 // Default themes always trump their pretenders. 264 264 // Properly identify default themes that are inside a directory within wp-content/themes. 265 265 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 ) { 267 267 $this->headers['Name'] .= '/' . $this->stylesheet; 268 268 } 269 269 } … … 1235 1235 * or null for all extensions. Default null. 1236 1236 * @param int $depth Optional. How many levels deep to search for files. Accepts 0, 1+, or 1237 1237 * -1 (infinite depth). Default 0. 1238 * @param string $relative_path Optional. The basename of the absolute path. Used to control the1238 * @param string $relative_path Optional. The wp_basename of the absolute path. Used to control the 1239 1239 * returned path for the found files, particularly when this function 1240 1240 * recurses to lower depths. Default empty. 1241 1241 * @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
92 92 'url' => $this->setting->default, 93 93 'type' => $type, 94 94 'icon' => wp_mime_type_icon( $type ), 95 'title' => basename( $this->setting->default ),95 'title' => wp_basename( $this->setting->default ), 96 96 ); 97 97 98 98 if ( 'image' === $type ) { -
src/wp-includes/customize/class-wp-customize-new-menu-control.php
36 36 * @param array $args Args. 37 37 */ 38 38 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. 40 40 parent::__construct( $manager, $id, $args ); 41 41 } 42 42 -
src/wp-includes/customize/class-wp-customize-new-menu-section.php
38 38 * @param array $args Section arguments. 39 39 */ 40 40 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. 42 42 parent::__construct( $manager, $id, $args ); 43 43 } 44 44 -
src/wp-includes/deprecated.php
1878 1878 if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) { 1879 1879 // We have a thumbnail desired, specified and existing 1880 1880 1881 $src_file = basename($src);1881 $src_file = wp_basename($src); 1882 1882 } elseif ( wp_attachment_is_image( $post->ID ) ) { 1883 1883 // We have an image without a thumbnail 1884 1884 … … 1888 1888 // No thumb, no image. We'll look for a mime-related icon instead. 1889 1889 1890 1890 $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); 1892 1892 } 1893 1893 1894 1894 if ( !isset($src) || !$src ) … … 3058 3058 */ 3059 3059 function get_theme_data( $theme_file ) { 3060 3060 _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 ) ) ); 3062 3062 3063 3063 $theme_data = array( 3064 3064 'Name' => $theme->get('Name'), -
src/wp-includes/embed-template.php
8 8 * @deprecated 4.5.0 Moved to wp-includes/theme-compat/embed.php 9 9 */ 10 10 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' ); 12 12 13 13 include( ABSPATH . WPINC . '/theme-compat/embed.php' ); -
src/wp-includes/functions.php
2096 2096 if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) { 2097 2097 $error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir']; 2098 2098 } else { 2099 $error_path = basename( $uploads['basedir'] ) . $uploads['subdir'];2099 $error_path = wp_basename( $uploads['basedir'] ) . $uploads['subdir']; 2100 2100 } 2101 2101 2102 2102 $uploads['error'] = sprintf( … … 2381 2381 if ( 0 === strpos( $upload['basedir'], ABSPATH ) ) { 2382 2382 $error_path = str_replace( ABSPATH, '', $upload['basedir'] ) . $upload['subdir']; 2383 2383 } else { 2384 $error_path = basename( $upload['basedir'] ) . $upload['subdir'];2384 $error_path = wp_basename( $upload['basedir'] ) . $upload['subdir']; 2385 2385 } 2386 2386 2387 2387 $message = sprintf( -
src/wp-includes/general-template.php
3387 3387 if ( 'application/x-patch' === $type || 'text/x-patch' === $type ) { 3388 3388 $type = 'text/x-diff'; 3389 3389 } 3390 } elseif ( isset( $args['file'] ) && false !== strpos( basename( $args['file'] ), '.' ) ) {3390 } elseif ( isset( $args['file'] ) && false !== strpos( wp_basename( $args['file'] ), '.' ) ) { 3391 3391 $extension = strtolower( pathinfo( $args['file'], PATHINFO_EXTENSION ) ); 3392 3392 foreach ( wp_get_mime_types() as $exts => $mime ) { 3393 3393 if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) { -
src/wp-includes/l10n.php
1258 1258 $lang_files = glob( ( is_null( $dir ) ? WP_LANG_DIR : $dir ) . '/*.mo' ); 1259 1259 if ( $lang_files ) { 1260 1260 foreach ( $lang_files as $lang_file ) { 1261 $lang_file = basename( $lang_file, '.mo' );1261 $lang_file = wp_basename( $lang_file, '.mo' ); 1262 1262 if ( 0 !== strpos( $lang_file, 'continents-cities' ) && 0 !== strpos( $lang_file, 'ms-' ) && 1263 1263 0 !== strpos( $lang_file, 'admin-' ) ) { 1264 1264 $languages[] = $lang_file; -
src/wp-includes/locale.php
7 7 * @since 1.2.0 8 8 */ 9 9 10 _deprecated_file( basename( __FILE__ ), '4.7.0' );10 _deprecated_file( wp_basename( __FILE__ ), '4.7.0' ); -
src/wp-includes/media.php
2871 2871 } 2872 2872 2873 2873 $file = get_attached_file( $attachment->ID ); 2874 $filename = basename( $file );2874 $filename = wp_basename( $file ); 2875 2875 2876 2876 $objects = array( 'attachment' ); 2877 2877 -
src/wp-includes/plugin.php
652 652 // 653 653 654 654 /** 655 * Gets the basename of a plugin.655 * Gets the wp_basename of a plugin. 656 656 * 657 657 * This method extracts the name of a plugin from its filename. 658 658 * -
src/wp-includes/post-template.php
635 635 $template_parts = explode( '/', $template_slug ); 636 636 637 637 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' ) ) ); 639 639 } 640 640 $classes[] = "{$post_type}-template-" . sanitize_html_class( str_replace( '.', '-', $template_slug ) ); 641 641 } else { -
src/wp-includes/post.php
5474 5474 if ( ! empty( $meta['thumb'] ) ) { 5475 5475 // Don't delete the thumb if another attachment uses it. 5476 5476 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 ); 5478 5478 if ( ! empty( $thumbfile ) ) { 5479 5479 $thumbfile = path_join( $uploadpath['basedir'], $thumbfile ); 5480 5480 $thumbdir = path_join( $uploadpath['basedir'], dirname( $file ) ); … … 5490 5490 if ( isset( $meta['sizes'] ) && is_array( $meta['sizes'] ) ) { 5491 5491 $intermediate_dir = path_join( $uploadpath['basedir'], dirname( $file ) ); 5492 5492 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 ); 5494 5494 if ( ! empty( $intermediate_file ) ) { 5495 5495 $intermediate_file = path_join( $uploadpath['basedir'], $intermediate_file ); 5496 5496 … … 5616 5616 $url = str_replace( $uploads['basedir'], $uploads['baseurl'], $file ); 5617 5617 } elseif ( false !== strpos( $file, 'wp-content/uploads' ) ) { 5618 5618 // 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 ); 5620 5620 } else { 5621 5621 // It's a newly-uploaded file, therefore $file is relative to the basedir. 5622 5622 $url = $uploads['baseurl'] . "/$file"; … … 5704 5704 5705 5705 $file = get_attached_file( $post->ID ); 5706 5706 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 ) ) { 5708 5708 /** 5709 5709 * Filters the attachment thumbnail file path. 5710 5710 * … … 5744 5744 return false; 5745 5745 } 5746 5746 5747 $url = str_replace( basename( $url ),basename( $thumb ), $url );5747 $url = str_replace( wp_basename( $url ), wp_basename( $thumb ), $url ); 5748 5748 5749 5749 /** 5750 5750 * Filters the attachment thumbnail URL. … … 5896 5896 $uri = array_shift( $dirs ); 5897 5897 if ( $dh = opendir( $dir ) ) { 5898 5898 while ( false !== $file = readdir( $dh ) ) { 5899 $file = basename( $file );5899 $file = wp_basename( $file ); 5900 5900 if ( substr( $file, 0, 1 ) == '.' ) { 5901 5901 continue; 5902 5902 } … … 5915 5915 } 5916 5916 5917 5917 $types = array(); 5918 // Icon basename - extension = MIME wildcard.5918 // Icon wp_basename - extension = MIME wildcard. 5919 5919 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 ]; 5921 5921 } 5922 5922 5923 5923 if ( ! empty( $mime ) ) { -
src/wp-includes/registration-functions.php
4 4 * 5 5 * @package WordPress 6 6 */ 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
4 4 * 5 5 * @package WordPress 6 6 */ 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
114 114 return $file; 115 115 } 116 116 117 $name = basename( $file['file'] );117 $name = wp_basename( $file['file'] ); 118 118 $name_parts = pathinfo( $name ); 119 119 $name = trim( substr( $name, 0, -( 1 + strlen( $name_parts['extension'] ) ) ) ); 120 120 … … 143 143 $attachment->guid = $url; 144 144 145 145 if ( empty( $attachment->post_title ) ) { 146 $attachment->post_title = preg_replace( '/\.[^.]+$/', '', basename( $file ) );146 $attachment->post_title = preg_replace( '/\.[^.]+$/', '', wp_basename( $file ) ); 147 147 } 148 148 149 149 // $post_parent is inherited from $attachment['post_parent']. -
src/wp-includes/rss-functions.php
5 5 * @package WordPress 6 6 */ 7 7 8 _deprecated_file( basename( __FILE__ ), '2.1.0', WPINC . '/rss.php' );8 _deprecated_file( wp_basename( __FILE__ ), '2.1.0', WPINC . '/rss.php' ); 9 9 require_once( ABSPATH . WPINC . '/rss.php' ); -
src/wp-includes/rss.php
16 16 /** 17 17 * Deprecated. Use SimplePie (class-simplepie.php) instead. 18 18 */ 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' ); 20 20 21 21 /** 22 22 * Fires before MagpieRSS is loaded, to optionally replace it. -
src/wp-includes/session.php
5 5 * @since 4.0.0 6 6 */ 7 7 8 _deprecated_file( basename( __FILE__ ), '4.7.0' );8 _deprecated_file( wp_basename( __FILE__ ), '4.7.0' ); 9 9 10 10 require_once( ABSPATH . WPINC . '/class-wp-session-tokens.php' ); 11 11 require_once( ABSPATH . WPINC . '/class-wp-user-meta-session-tokens.php' ); -
src/wp-includes/theme-compat/comments.php
8 8 */ 9 9 _deprecated_file( 10 10 /* translators: %s: template name */ 11 sprintf( __( 'Theme without %s' ), basename( __FILE__ ) ),11 sprintf( __( 'Theme without %s' ), wp_basename( __FILE__ ) ), 12 12 '3.0.0', 13 13 null, 14 14 /* 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__ ) ) 16 16 ); 17 17 18 18 // Do not delete these lines 19 if ( ! empty( $_SERVER['SCRIPT_FILENAME'] ) && 'comments.php' == basename( $_SERVER['SCRIPT_FILENAME'] ) ) {19 if ( ! empty( $_SERVER['SCRIPT_FILENAME'] ) && 'comments.php' == wp_basename( $_SERVER['SCRIPT_FILENAME'] ) ) { 20 20 die( 'Please do not load this page directly. Thanks!' ); 21 21 } 22 22 -
src/wp-includes/theme-compat/footer.php
8 8 */ 9 9 _deprecated_file( 10 10 /* translators: %s: template name */ 11 sprintf( __( 'Theme without %s' ), basename( __FILE__ ) ),11 sprintf( __( 'Theme without %s' ), wp_basename( __FILE__ ) ), 12 12 '3.0.0', 13 13 null, 14 14 /* 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__ ) ) 16 16 ); 17 17 ?> 18 18 -
src/wp-includes/theme-compat/header.php
8 8 */ 9 9 _deprecated_file( 10 10 /* translators: %s: template name */ 11 sprintf( __( 'Theme without %s' ), basename( __FILE__ ) ),11 sprintf( __( 'Theme without %s' ), wp_basename( __FILE__ ) ), 12 12 '3.0.0', 13 13 null, 14 14 /* 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__ ) ) 16 16 ); 17 17 ?> 18 18 <!DOCTYPE html> -
src/wp-includes/theme-compat/sidebar.php
8 8 */ 9 9 _deprecated_file( 10 10 /* translators: %s: template name */ 11 sprintf( __( 'Theme without %s' ), basename( __FILE__ ) ),11 sprintf( __( 'Theme without %s' ), wp_basename( __FILE__ ) ), 12 12 '3.0.0', 13 13 null, 14 14 /* 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__ ) ) 16 16 ); 17 17 ?> 18 18 <div id="sidebar" role="complementary"> -
src/wp-includes/theme.php
620 620 } elseif ( 0 === strpos( $theme_root, ABSPATH ) ) { 621 621 $theme_root_uri = site_url( str_replace( ABSPATH, '', $theme_root ) ); 622 622 } 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 ); 624 624 } else { 625 625 $theme_root_uri = $theme_root; 626 626 } … … 2922 2922 */ 2923 2923 function _wp_customize_include() { 2924 2924 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'] ) ); 2926 2926 $should_include = ( 2927 2927 $is_customize_admin_page 2928 2928 || -
tests/phpunit/includes/abstract-testcase.php
1062 1062 } 1063 1063 1064 1064 $attachment = array( 1065 'post_title' => basename( $upload['file'] ),1065 'post_title' => wp_basename( $upload['file'] ), 1066 1066 'post_content' => '', 1067 1067 'post_type' => 'attachment', 1068 1068 'post_parent' => $parent_post_id, -
tests/phpunit/includes/factory/class-wp-unittest-factory-for-attachment.php
46 46 */ 47 47 function create_upload_object( $file, $parent = 0 ) { 48 48 $contents = file_get_contents( $file ); 49 $upload = wp_upload_bits( basename( $file ), null, $contents );49 $upload = wp_upload_bits( wp_basename( $file ), null, $contents ); 50 50 51 51 $type = ''; 52 52 if ( ! empty( $upload['type'] ) ) { … … 59 59 } 60 60 61 61 $attachment = array( 62 'post_title' => basename( $upload['file'] ),62 'post_title' => wp_basename( $upload['file'] ), 63 63 'post_content' => '', 64 64 'post_type' => 'attachment', 65 65 'post_parent' => $parent, -
tests/phpunit/includes/mock-fs.php
215 215 216 216 function __construct( $path ) { 217 217 $this->path = $path; 218 $this->name = basename( $path );218 $this->name = wp_basename( $path ); 219 219 } 220 220 221 221 function is_file() { -
tests/phpunit/tests/ajax/Attachments.php
29 29 $filename = DIR_TESTDATA . '/images/canola.jpg'; 30 30 $contents = file_get_contents( $filename ); 31 31 32 $upload = wp_upload_bits( basename( $filename ), null, $contents );32 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 33 33 $attachment = $this->_make_attachment( $upload ); 34 34 35 35 // Set up a default request … … 80 80 $filename = DIR_TESTDATA . '/formatting/entities.txt'; 81 81 $contents = file_get_contents( $filename ); 82 82 83 $upload = wp_upload_bits( basename( $filename ), null, $contents );83 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 84 84 $attachment = $this->_make_attachment( $upload ); 85 85 86 86 // Set up a default request -
tests/phpunit/tests/ajax/MediaEdit.php
32 32 $filename = DIR_TESTDATA . '/images/canola.jpg'; 33 33 $contents = file_get_contents( $filename ); 34 34 35 $upload = wp_upload_bits( basename( $filename ), null, $contents );35 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 36 36 $id = $this->_make_attachment( $upload ); 37 37 38 38 $_REQUEST['action'] = 'image-editor'; … … 63 63 $filename = DIR_TESTDATA . '/images/canola.jpg'; 64 64 $contents = file_get_contents( $filename ); 65 65 66 $upload = wp_upload_bits( basename( $filename ), null, $contents );66 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 67 67 $id = $this->_make_attachment( $upload ); 68 68 69 69 $_REQUEST['action'] = 'image-editor'; -
tests/phpunit/tests/blocks/block-parser.php
85 85 * @return string The cleaned fixture name. 86 86 */ 87 87 protected function clean_fixture_filename( $filename ) { 88 $filename = basename( $filename );88 $filename = wp_basename( $filename ); 89 89 $filename = preg_replace( '/\..+$/', '', $filename ); 90 90 return $filename; 91 91 } -
tests/phpunit/tests/blocks/render.php
358 358 * @return string The cleaned fixture name. 359 359 */ 360 360 protected function clean_fixture_filename( $filename ) { 361 $filename = basename( $filename );361 $filename = wp_basename( $filename ); 362 362 $filename = preg_replace( '/\..+$/', '', $filename ); 363 363 return $filename; 364 364 } -
tests/phpunit/tests/file.php
170 170 $file = wp_tempnam( $case ); 171 171 unlink( $file ); 172 172 173 $this->assertNotEmpty( basename(basename( $file, '.tmp' ), '.zip' ) );173 $this->assertNotEmpty( wp_basename( wp_basename( $file, '.tmp' ), '.zip' ) ); 174 174 } 175 175 function data_wp_tempnam_filenames() { 176 176 return array( -
tests/phpunit/tests/general/template.php
231 231 $filename = DIR_TESTDATA . '/images/test-image.jpg'; 232 232 $contents = file_get_contents( $filename ); 233 233 234 $upload = wp_upload_bits( basename( $filename ), null, $contents );234 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 235 235 $this->site_icon_url = $upload['url']; 236 236 237 237 // Save the data … … 409 409 function _insert_custom_logo() { 410 410 $filename = DIR_TESTDATA . '/images/test-image.jpg'; 411 411 $contents = file_get_contents( $filename ); 412 $upload = wp_upload_bits( basename( $filename ), null, $contents );412 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 413 413 414 414 // Save the data. 415 415 $this->custom_logo_url = $upload['url']; -
tests/phpunit/tests/image/editor.php
130 130 ); 131 131 132 132 // 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() ) ); 134 134 135 135 // 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' ) ) ); 137 137 138 138 // Test with a destination dir only 139 139 $this->assertEquals( trailingslashit( realpath( get_temp_dir() ) ), trailingslashit( realpath( dirname( $editor->generate_filename( null, get_temp_dir() ) ) ) ) ); 140 140 141 141 // 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' ) ) ); 143 143 144 144 // Combo! 145 145 $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
17 17 18 18 public function _make_attachment( $file, $parent_post_id = 0 ) { 19 19 $contents = file_get_contents( $file ); 20 $upload = wp_upload_bits( basename( $file ), null, $contents );20 $upload = wp_upload_bits( wp_basename( $file ), null, $contents ); 21 21 22 22 return parent::_make_attachment( $upload, $parent_post_id ); 23 23 } -
tests/phpunit/tests/image/resize.php
29 29 function test_resize_jpg() { 30 30 $image = $this->resize_helper( DIR_TESTDATA . '/images/test-image.jpg', 25, 25 ); 31 31 32 $this->assertEquals( 'test-image-25x25.jpg', basename( $image ) );32 $this->assertEquals( 'test-image-25x25.jpg', wp_basename( $image ) ); 33 33 list($w, $h, $type) = getimagesize( $image ); 34 34 $this->assertEquals( 25, $w ); 35 35 $this->assertEquals( 25, $h ); … … 45 45 $this->fail( sprintf( 'No PNG support in the editor engine %s on this system', $this->editor_engine ) ); 46 46 } 47 47 48 $this->assertEquals( 'test-image-25x25.png', basename( $image ) );48 $this->assertEquals( 'test-image-25x25.png', wp_basename( $image ) ); 49 49 list($w, $h, $type) = getimagesize( $image ); 50 50 $this->assertEquals( 25, $w ); 51 51 $this->assertEquals( 25, $h ); … … 61 61 $this->fail( sprintf( 'No GIF support in the editor engine %s on this system', $this->editor_engine ) ); 62 62 } 63 63 64 $this->assertEquals( 'test-image-25x25.gif', basename( $image ) );64 $this->assertEquals( 'test-image-25x25.gif', wp_basename( $image ) ); 65 65 list($w, $h, $type) = getimagesize( $image ); 66 66 $this->assertEquals( 25, $w ); 67 67 $this->assertEquals( 25, $h ); … … 81 81 function test_resize_thumb_128x96() { 82 82 $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 128, 96 ); 83 83 84 $this->assertEquals( '2007-06-17DSC_4173-64x96.jpg', basename( $image ) );84 $this->assertEquals( '2007-06-17DSC_4173-64x96.jpg', wp_basename( $image ) ); 85 85 list($w, $h, $type) = getimagesize( $image ); 86 86 $this->assertEquals( 64, $w ); 87 87 $this->assertEquals( 96, $h ); … … 93 93 function test_resize_thumb_128x0() { 94 94 $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 128, 0 ); 95 95 96 $this->assertEquals( '2007-06-17DSC_4173-128x193.jpg', basename( $image ) );96 $this->assertEquals( '2007-06-17DSC_4173-128x193.jpg', wp_basename( $image ) ); 97 97 list($w, $h, $type) = getimagesize( $image ); 98 98 $this->assertEquals( 128, $w ); 99 99 $this->assertEquals( 193, $h ); … … 105 105 function test_resize_thumb_0x96() { 106 106 $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 0, 96 ); 107 107 108 $this->assertEquals( '2007-06-17DSC_4173-64x96.jpg', basename( $image ) );108 $this->assertEquals( '2007-06-17DSC_4173-64x96.jpg', wp_basename( $image ) ); 109 109 list($w, $h, $type) = getimagesize( $image ); 110 110 $this->assertEquals( 64, $w ); 111 111 $this->assertEquals( 96, $h ); … … 117 117 function test_resize_thumb_150x150_crop() { 118 118 $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 150, 150, true ); 119 119 120 $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', basename( $image ) );120 $this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', wp_basename( $image ) ); 121 121 list($w, $h, $type) = getimagesize( $image ); 122 122 $this->assertEquals( 150, $w ); 123 123 $this->assertEquals( 150, $h ); … … 129 129 function test_resize_thumb_150x100_crop() { 130 130 $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 150, 100, true ); 131 131 132 $this->assertEquals( '2007-06-17DSC_4173-150x100.jpg', basename( $image ) );132 $this->assertEquals( '2007-06-17DSC_4173-150x100.jpg', wp_basename( $image ) ); 133 133 list($w, $h, $type) = getimagesize( $image ); 134 134 $this->assertEquals( 150, $w ); 135 135 $this->assertEquals( 100, $h ); … … 141 141 function test_resize_thumb_50x150_crop() { 142 142 $image = $this->resize_helper( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG', 50, 150, true ); 143 143 144 $this->assertEquals( '2007-06-17DSC_4173-50x150.jpg', basename( $image ) );144 $this->assertEquals( '2007-06-17DSC_4173-50x150.jpg', wp_basename( $image ) ); 145 145 list($w, $h, $type) = getimagesize( $image ); 146 146 $this->assertEquals( 50, $w ); 147 147 $this->assertEquals( 150, $h ); -
tests/phpunit/tests/image/siteIcon.php
101 101 function test_create_attachment_object() { 102 102 $attachment_id = $this->_insert_attachment(); 103 103 $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 ); 105 105 106 106 $object = $this->wp_site_icon->create_attachment_object( $cropped, $attachment_id ); 107 107 … … 115 115 function test_insert_cropped_attachment() { 116 116 $attachment_id = $this->_insert_attachment(); 117 117 $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 ); 119 119 120 120 $object = $this->wp_site_icon->create_attachment_object( $cropped, $attachment_id ); 121 121 $cropped_id = $this->wp_site_icon->insert_attachment( $object, $cropped ); … … 163 163 $filename = DIR_TESTDATA . '/images/test-image.jpg'; 164 164 $contents = file_get_contents( $filename ); 165 165 166 $upload = wp_upload_bits( basename( $filename ), null, $contents );166 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 167 167 168 168 $this->attachment_id = $this->_make_attachment( $upload ); 169 169 return $this->attachment_id; -
tests/phpunit/tests/media.php
1524 1524 // Copy hash generation method used in wp_save_image(). 1525 1525 $hash = 'e' . time() . rand( 100, 999 ); 1526 1526 1527 $filename_base = basename( $image_meta['file'], '.png' );1527 $filename_base = wp_basename( $image_meta['file'], '.png' ); 1528 1528 1529 1529 // Add the hash to the image URL 1530 1530 $image_url = str_replace( $filename_base, $filename_base . '-' . $hash, $image_url ); -
tests/phpunit/tests/post/attachments.php
27 27 $filename = ( DIR_TESTDATA . '/images/test-image.jpg' ); 28 28 $contents = file_get_contents( $filename ); 29 29 30 $upload = wp_upload_bits( basename( $filename ), null, $contents );30 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 31 31 $this->assertTrue( empty( $upload['error'] ) ); 32 32 33 33 $id = $this->_make_attachment( $upload ); … … 39 39 40 40 // medium, medium_large, and full size will both point to the original 41 41 $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] ) ); 43 43 $this->assertEquals( 50, $downsize[1] ); 44 44 $this->assertEquals( 50, $downsize[2] ); 45 45 46 46 $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] ) ); 48 48 $this->assertEquals( 50, $downsize[1] ); 49 49 $this->assertEquals( 50, $downsize[2] ); 50 50 51 51 $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] ) ); 53 53 $this->assertEquals( 50, $downsize[1] ); 54 54 $this->assertEquals( 50, $downsize[2] ); 55 55 … … 66 66 $filename = ( DIR_TESTDATA . '/images/a2-small.jpg' ); 67 67 $contents = file_get_contents( $filename ); 68 68 69 $upload = wp_upload_bits( basename( $filename ), null, $contents );69 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 70 70 $this->assertTrue( empty( $upload['error'] ) ); 71 71 72 72 $id = $this->_make_attachment( $upload ); … … 86 86 87 87 // image_downsize() should return the correct images and sizes 88 88 $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] ) ); 90 90 $this->assertEquals( 150, $downsize[1] ); 91 91 $this->assertEquals( 150, $downsize[2] ); 92 92 93 93 // medium, medium_large, and full will both point to the original 94 94 $downsize = image_downsize( $id, 'medium' ); 95 $this->assertEquals( 'a2-small.jpg', basename( $downsize[0] ) );95 $this->assertEquals( 'a2-small.jpg', wp_basename( $downsize[0] ) ); 96 96 $this->assertEquals( 400, $downsize[1] ); 97 97 $this->assertEquals( 300, $downsize[2] ); 98 98 99 99 $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] ) ); 101 101 $this->assertEquals( 400, $downsize[1] ); 102 102 $this->assertEquals( 300, $downsize[2] ); 103 103 104 104 $downsize = image_downsize( $id, 'full' ); 105 $this->assertEquals( 'a2-small.jpg', basename( $downsize[0] ) );105 $this->assertEquals( 'a2-small.jpg', wp_basename( $downsize[0] ) ); 106 106 $this->assertEquals( 400, $downsize[1] ); 107 107 $this->assertEquals( 300, $downsize[2] ); 108 108 … … 122 122 $filename = ( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG' ); 123 123 $contents = file_get_contents( $filename ); 124 124 125 $upload = wp_upload_bits( basename( $filename ), null, $contents );125 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 126 126 $this->assertTrue( empty( $upload['error'] ) ); 127 127 128 128 $id = $this->_make_attachment( $upload ); … … 146 146 147 147 // image_downsize() should return the correct images and sizes 148 148 $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] ) ); 150 150 $this->assertEquals( 150, $downsize[1] ); 151 151 $this->assertEquals( 150, $downsize[2] ); 152 152 153 153 $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] ) ); 155 155 $this->assertEquals( 400, $downsize[1] ); 156 156 $this->assertEquals( 602, $downsize[2] ); 157 157 158 158 $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] ) ); 160 160 $this->assertEquals( 600, $downsize[1] ); 161 161 $this->assertEquals( 904, $downsize[2] ); 162 162 163 163 $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] ) ); 165 165 $this->assertEquals( 680, $downsize[1] ); 166 166 $this->assertEquals( 1024, $downsize[2] ); 167 167 } … … 181 181 $filename = ( DIR_TESTDATA . '/images/2007-06-17DSC_4173.JPG' ); 182 182 $contents = file_get_contents( $filename ); 183 183 184 $upload = wp_upload_bits( basename( $filename ), null, $contents );184 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 185 185 $this->assertTrue( empty( $upload['error'] ) ); 186 186 187 187 $id = $this->_make_attachment( $upload ); … … 224 224 $filename = ( DIR_TESTDATA . '/images/test-image.jpg' ); 225 225 $contents = file_get_contents( $filename ); 226 226 227 $upload = wp_upload_bits( basename( $filename ), null, $contents );227 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 228 228 $this->assertTrue( empty( $upload['error'] ) ); 229 229 230 230 $upload['url'] = ''; … … 241 241 $filename = ( DIR_TESTDATA . '/images/test-image.jpg' ); 242 242 $contents = file_get_contents( $filename ); 243 243 244 $upload = wp_upload_bits( basename( $filename ), null, $contents );244 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 245 245 $this->assertTrue( empty( $upload['error'] ) ); 246 246 247 247 $id = $this->_make_attachment( $upload ); … … 267 267 $filename = ( DIR_TESTDATA . '/images/test-image.jpg' ); 268 268 $contents = file_get_contents( $filename ); 269 269 270 $upload = wp_upload_bits( basename( $filename ), null, $contents );270 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 271 271 $this->assertTrue( empty( $upload['error'] ) ); 272 272 273 273 $attachment_id = $this->_make_attachment( $upload ); … … 299 299 $filename = DIR_TESTDATA . '/images/test-image.jpg'; 300 300 $contents = file_get_contents( $filename ); 301 301 302 $upload = wp_upload_bits( basename( $filename ), null, $contents );302 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 303 303 $this->assertTrue( empty( $upload['error'] ) ); 304 304 305 305 // Set attachment ID. … … 324 324 $filename = DIR_TESTDATA . '/images/test-image.jpg'; 325 325 $contents = file_get_contents( $filename ); 326 326 327 $upload = wp_upload_bits( basename( $filename ), null, $contents );327 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 328 328 $this->assertTrue( empty( $upload['error'] ) ); 329 329 330 330 // Set attachment ID. … … 349 349 $filename = ( DIR_TESTDATA . '/images/test-image.jpg' ); 350 350 $contents = file_get_contents( $filename ); 351 351 352 $upload = wp_upload_bits( basename( $filename ), null, $contents );352 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 353 353 $this->assertTrue( empty( $upload['error'] ) ); 354 354 355 355 // Set attachment ID … … 377 377 $filename = ( DIR_TESTDATA . '/images/test-image.jpg' ); 378 378 $contents = file_get_contents( $filename ); 379 379 380 $upload = wp_upload_bits( basename( $filename ), null, $contents );380 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 381 381 $this->assertTrue( empty( $upload['error'] ) ); 382 382 383 383 // Set attachment ID. … … 405 405 $filename = ( DIR_TESTDATA . '/images/test-image.jpg' ); 406 406 $contents = file_get_contents( $filename ); 407 407 408 $upload = wp_upload_bits( basename( $filename ), null, $contents );408 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 409 409 $this->assertTrue( empty( $upload['error'] ) ); 410 410 411 411 // Set attachment ID … … 432 432 $filename = ( DIR_TESTDATA . '/images/test-image.jpg' ); 433 433 $contents = file_get_contents( $filename ); 434 434 435 $upload = wp_upload_bits( basename( $filename ), null, $contents );435 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 436 436 $this->assertTrue( empty( $upload['error'] ) ); 437 437 438 438 // Set attachment ID … … 454 454 $filename = DIR_TESTDATA . '/images/test-image.jpg'; 455 455 $contents = file_get_contents( $filename ); 456 456 457 $upload = wp_upload_bits( basename( $filename ), null, $contents );457 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 458 458 $attachment_id = $this->_make_attachment( $upload ); 459 459 460 460 $this->assertTrue( wp_attachment_is_image( $attachment_id ) ); … … 472 472 $filename = DIR_TESTDATA . '/images/test-image.psd'; 473 473 $contents = file_get_contents( $filename ); 474 474 475 $upload = wp_upload_bits( basename( $filename ), null, $contents );475 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 476 476 $attachment_id = $this->_make_attachment( $upload ); 477 477 478 478 $this->assertFalse( wp_attachment_is_image( $attachment_id ) ); … … 489 489 $filename = DIR_TESTDATA . '/images/test-image.jpg'; 490 490 $contents = file_get_contents( $filename ); 491 491 492 $upload = wp_upload_bits( basename( $filename ), null, $contents );492 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 493 493 494 494 $this->assertFalse( $upload['error'] ); 495 495 496 496 add_filter( 'upload_mimes', array( $this, 'blacklist_jpg_mime_type' ) ); 497 497 498 $upload = wp_upload_bits( basename( $filename ), null, $contents );498 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 499 499 500 500 remove_filter( 'upload_mimes', array( $this, 'blacklist_jpg_mime_type' ) ); 501 501 -
tests/phpunit/tests/rest-api/rest-attachments-controller.php
1435 1435 ) 1436 1436 ); 1437 1437 1438 $filename = basename( $this->test_file2 );1438 $filename = wp_basename( $this->test_file2 ); 1439 1439 1440 1440 $request = new WP_REST_Request( 'GET', '/wp/v2/media' ); 1441 1441 $request->set_param( 'search', $filename ); -
tests/phpunit/tests/theme/WPTheme.php
103 103 104 104 // Check that in a URI path, we have raw url encoding (spaces become %20) 105 105 // 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() ) ); 108 108 109 109 // Check that wp_customize_url() uses url encoding, as it is a query arg (spaces become +) 110 110 $this->assertEquals( admin_url( 'customize.php?theme=theme+with+spaces' ), wp_customize_url( 'theme with spaces' ) ); -
tests/phpunit/tests/theme.php
276 276 277 277 // template files that do exist 278 278 //foreach ($theme['Template Files'] as $path) { 279 //$file = basename($path, '.php');279 //$file = wp_basename($path, '.php'); 280 280 // FIXME: untestable because get_query_template uses TEMPLATEPATH 281 281 //$this->assertEquals('', get_query_template($file)); 282 282 //} -
tests/phpunit/tests/xmlrpc/wp/getMediaItem.php
20 20 21 21 $filename = ( DIR_TESTDATA . '/images/waffles.jpg' ); 22 22 $contents = file_get_contents( $filename ); 23 $upload = wp_upload_bits( basename( $filename ), null, $contents );23 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); 24 24 25 25 $this->attachment_id = $this->_make_attachment( $upload, self::$post_id ); 26 26 $this->attachment_data = get_post( $this->attachment_id, ARRAY_A );