Make WordPress Core


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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.