Make WordPress Core

Changeset 5867


Ignore:
Timestamp:
08/14/2007 02:58:33 AM (19 years ago)
Author:
ryan
Message:

Use opendir instead of dir. Props nbachiyski. fixes #4450

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/import.php

    r5204 r5867  
    1515$import_loc = 'wp-admin/import';
    1616$import_root = ABSPATH.$import_loc;
    17 $imports_dir = @ dir($import_root);
     17$imports_dir = @ opendir($import_root);
    1818if ($imports_dir) {
    19         while (($file = $imports_dir->read()) !== false) {
     19        while (($file = readdir($imports_dir) !== false) {
    2020                if ($file{0} == '.') {
    2121                        continue;
    … …  
    2525        }
    2626}
     27@closedir($imports_dir);
    2728
    2829$importers = get_importers();
  • trunk/wp-admin/includes/plugin.php

    r5803 r5867  
    4343
    4444        // Files in wp-content/plugins directory
    45         $plugins_dir = @ dir( $plugin_root);
     45        $plugins_dir = @ opendir( $plugin_root);
    4646        if ( $plugins_dir ) {
    47                 while (($file = $plugins_dir->read() ) !== false ) {
     47                while (($file = readdir( $plugins_dir ) ) !== false ) {
    4848                        if ( substr($file, 0, 1) == '.' )
    4949                                continue;
    5050                        if ( is_dir( $plugin_root.'/'.$file ) ) {
    51                                 $plugins_subdir = @ dir( $plugin_root.'/'.$file );
     51                                $plugins_subdir = @ opendir( $plugin_root.'/'.$file );
    5252                                if ( $plugins_subdir ) {
    53                                         while (($subfile = $plugins_subdir->read() ) !== false ) {
     53                                        while (($subfile = readdir( $plugins_subdir ) ) !== false ) {
    5454                                                if ( substr($subfile, 0, 1) == '.' )
    5555                                                        continue;
    … …  
    6464                }
    6565        }
     66        @closedir( $plugins_dir );
     67        @closedir( $plugins_subdir );
    6668
    6769        if ( !$plugins_dir || !$plugin_files )
  • trunk/wp-admin/includes/upgrade.php

    r5825 r5867  
    11041104        //$files = array('index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css');
    11051105
    1106         $theme_dir = @ dir("$default_dir");
     1106        $theme_dir = @ opendir("$default_dir");
    11071107        if ($theme_dir) {
    1108                 while(($theme_file = $theme_dir->read()) !== false) {
     1108                while(($theme_file = readdir( $theme_dir )) !== false) {
    11091109                        if (is_dir("$default_dir/$theme_file"))
    11101110                                continue;
    … …  
    11141114                }
    11151115        }
     1116        @closedir($theme_dir);
    11161117
    11171118        // Rewrite the theme header.
    … …  
    11371138        }
    11381139
    1139         $images_dir = @ dir("$default_dir/images");
     1140        $images_dir = @ opendir("$default_dir/images");
    11401141        if ($images_dir) {
    1141                 while(($image = $images_dir->read()) !== false) {
     1142                while(($image = readdir($images_dir)) !== false) {
    11421143                        if (is_dir("$default_dir/images/$image"))
    11431144                                continue;
    … …  
    11471148                }
    11481149        }
     1150        @closedir($images_dir);
    11491151}
    11501152
  • trunk/wp-includes/theme.php

    r5700 r5867  
    119119
    120120        // Files in wp-content/themes directory and one subdir down
    121         $themes_dir = @ dir($theme_root);
     121        $themes_dir = @ opendir($theme_root);
    122122        if ( !$themes_dir )
    123123                return false;
    124124
    125         while ( ($theme_dir = $themes_dir->read()) !== false ) {
     125        while ( ($theme_dir = readdir($themes_dir)) !== false ) {
    126126                if ( is_dir($theme_root . '/' . $theme_dir) && is_readable($theme_root . '/' . $theme_dir) ) {
    127127                        if ( $theme_dir{0} == '.' || $theme_dir == '..' || $theme_dir == 'CVS' )
    128128                                continue;
    129                         $stylish_dir = @ dir($theme_root . '/' . $theme_dir);
     129                        $stylish_dir = @ opendir($theme_root . '/' . $theme_dir);
    130130                        $found_stylesheet = false;
    131                         while ( ($theme_file = $stylish_dir->read()) !== false ) {
     131                        while ( ($theme_file = readdir($stylish_dir)) !== false ) {
    132132                                if ( $theme_file == 'style.css' ) {
    133133                                        $theme_files[] = $theme_dir . '/' . $theme_file;
    … …  
    136136                                }
    137137                        }
     138                        @closedir($stylish_dir);
    138139                        if ( !$found_stylesheet ) { // look for themes in that dir
    139140                                $subdir = "$theme_root/$theme_dir";
    140141                                $subdir_name = $theme_dir;
    141                                 $theme_subdir = @dir( $subdir );
    142                                 while ( ($theme_dir = $theme_subdir->read()) !== false ) {
     142                                $theme_subdir = @ opendir( $subdir );
     143                                while ( ($theme_dir = readdir($theme_subdir)) !== false ) {
    143144                                        if ( is_dir( $subdir . '/' . $theme_dir) && is_readable($subdir . '/' . $theme_dir) ) {
    144145                                                if ( $theme_dir{0} == '.' || $theme_dir == '..' || $theme_dir == 'CVS' )
    145146                                                        continue;
    146                                                 $stylish_dir = @ dir($subdir . '/' . $theme_dir);
     147                                                $stylish_dir = @ opendir($subdir . '/' . $theme_dir);
    147148                                                $found_stylesheet = false;
    148                                                 while ( ($theme_file = $stylish_dir->read()) !== false ) {
     149                                                while ( ($theme_file = readdir($stylish_dir)) !== false ) {
    149150                                                        if ( $theme_file == 'style.css' ) {
    150151                                                                $theme_files[] = $subdir_name . '/' . $theme_dir . '/' . $theme_file;
    … …  
    153154                                                        }
    154155                                                }
     156                                                @closedir($stylish_dir);
    155157                                        }
    156158                                }
     159                                @closedir($theme_subdir);
    157160                                $wp_broken_themes[$theme_dir] = array('Name' => $theme_dir, 'Title' => $theme_dir, 'Description' => __('Stylesheet is missing.'));
    158161                        }
    159162                }
    160163        }
     164        @closedir($theme_dir);
    161165
    162166        if ( !$themes_dir || !$theme_files )
Note: See TracChangeset for help on using the changeset viewer.