Make WordPress Core


Ignore:
Timestamp:
10/27/2009 05:17:23 PM (17 years ago)
Author:
ryan
Message:

More theme subdir fixes. see #10467

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/theme.php

    r12117 r12118  
    297297
    298298                if ( empty($template) ) {
    299                         if ( file_exists(dirname("$theme_root/$theme_file/index.php")) )
    300                                 $template = dirname($theme_file);
     299                        if ( file_exists("$theme_root/$stylesheet/index.php") )
     300                                $template = $stylesheet;
    301301                        else
    302302                                continue;
     
    308308                        $parent_dir = dirname(dirname($theme_file));
    309309                        if ( file_exists("$theme_root/$parent_dir/$template/index.php") ) {
    310                                 $template = "$theme_root/$parent_dir/$template";
     310                                $template = "$parent_dir/$template";
     311                                $template_directory = "$theme_root/$parent_dir/$template";
    311312                        } else {
    312313                                /**
     
    324325                        }
    325326                } else {
    326                         $template = trim( $theme_root . '/' . $template );
     327                        $template_directory = trim( $theme_root . '/' . $template );
    327328                }
    328329
     
    343344                }
    344345
    345                 $template_dir = @ dir("$template");
     346                $template_dir = @ dir("$template_directory");
    346347                if ( $template_dir ) {
    347348                        while ( ($file = $template_dir->read()) !== false ) {
     
    349350                                        continue;
    350351                                if ( preg_match('|\.php$|', $file) ) {
    351                                         $template_files[] = "$template/$file";
    352                                 } elseif ( is_dir("$template/$file") ) {
    353                                         $template_subdir = @ dir("$template/$file");
     352                                        $template_files[] = "$template_directory/$file";
     353                                } elseif ( is_dir("$template_directory/$file") ) {
     354                                        $template_subdir = @ dir("$template_directory/$file");
    354355                                        while ( ($subfile = $template_subdir->read()) !== false ) {
    355356                                                if ( preg_match('|^\.+$|', $subfile) )
    356357                                                        continue;
    357358                                                if ( preg_match('|\.php$|', $subfile) )
    358                                                         $template_files[] = "$template/$file/$subfile";
     359                                                        $template_files[] = "$template_directory/$file/$subfile";
    359360                                        }
    360361                                        @ $template_subdir->close();
     
    391392
    392393                $theme_roots[$stylesheet] = str_replace( WP_CONTENT_DIR, '', $theme_root );
    393                 $themes[$name] = array( 'Name' => $name, 'Title' => $title, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => basename( $template ), 'Stylesheet' => $stylesheet, 'Template Files' => $template_files, 'Stylesheet Files' => $stylesheet_files, 'Template Dir' => $template_dir, 'Stylesheet Dir' => $stylesheet_dir, 'Status' => $theme_data['Status'], 'Screenshot' => $screenshot, 'Tags' => $theme_data['Tags'], 'Theme Root' => $theme_root, 'Theme Root URI' => str_replace( WP_CONTENT_DIR, content_url(), $theme_root ) );
     394                $themes[$name] = array( 'Name' => $name, 'Title' => $title, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template, 'Stylesheet' => $stylesheet, 'Template Files' => $template_files, 'Stylesheet Files' => $stylesheet_files, 'Template Dir' => $template_dir, 'Stylesheet Dir' => $stylesheet_dir, 'Status' => $theme_data['Status'], 'Screenshot' => $screenshot, 'Tags' => $theme_data['Tags'], 'Theme Root' => $theme_root, 'Theme Root URI' => str_replace( WP_CONTENT_DIR, content_url(), $theme_root ) );
    394395        }
    395396
Note: See TracChangeset for help on using the changeset viewer.