Make WordPress Core


Ignore:
Timestamp:
10/15/2009 08:26:21 PM (15 years ago)
Author:
ryan
Message:

Associate subdirector of whitespace trims trailing whites with pinking shears.

File:
1 edited

Legend:

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

    r12025 r12042  
    130130    $theme_root = get_theme_root( $template );
    131131    $template_dir = "$theme_root/$template";
    132        
     132
    133133    return apply_filters( 'template_directory', $template_dir, $template, $theme_root );
    134134}
     
    146146    $theme_root_uri = get_theme_root_uri( $template );
    147147    $template_dir_uri = "$theme_root_uri/$template";
    148    
     148
    149149    return apply_filters( 'template_directory_uri', $template_dir_uri, $template, $theme_root_uri );
    150150}
     
    267267    if ( !$theme_files = search_theme_directories() )
    268268        return false;
    269    
     269
    270270    asort( $theme_files );
    271    
     271
    272272    foreach ( (array) $theme_files as $theme_file ) {
    273273        $theme_root = $theme_file['theme_root'];
     
    308308                continue;
    309309        }
    310        
     310
    311311        $template = trim( $template );
    312312
     
    316316                $template = "$theme_root/$parent_dir/$template";
    317317            } else {
    318                 /** 
    319                  * The parent theme doesn't exist in the current theme's folder or sub folder 
    320                  * so lets use the theme root for the parent template. 
     318                /**
     319                 * The parent theme doesn't exist in the current theme's folder or sub folder
     320                 * so lets use the theme root for the parent template.
    321321                 */
    322322                $parent_theme_root = $theme_files[$template]['theme_root'];
     
    327327                    continue;
    328328                }
    329                
     329
    330330            }
    331331        } else {
    332332            $template = trim( $theme_root . '/' . $template );
    333333        }
    334        
     334
    335335        $stylesheet_files = array();
    336336        $template_files = array();
     
    420420
    421421    $wp_themes = $themes;
    422    
     422
    423423    return $themes;
    424424}
     
    502502function register_theme_directory( $directory ) {
    503503    global $wp_theme_directories;
    504    
     504
    505505    /* The theme directory should be relative to the content directory */
    506506    $registered_directory = WP_CONTENT_DIR . '/' . $directory;
    507    
     507
    508508    /* If this folder does not exist, return and do not register */
    509509    if ( !file_exists( $registered_directory ) )
    510510        return false;
    511    
     511
    512512    $wp_theme_directories[] = $registered_directory;
    513    
     513
    514514    return true;
    515515}
     
    524524function search_theme_directories() {
    525525    global $wp_theme_directories, $wp_broken_themes;
    526    
     526
    527527    if ( empty( $wp_theme_directories ) )
    528528        return false;
     
    534534    foreach ( (array) $wp_theme_directories as $theme_root ) {
    535535        $theme_loc = $theme_root;
    536        
     536
    537537        /* We don't want to replace all forward slashes, see Trac #4541 */
    538         if ( '/' != WP_CONTENT_DIR ) 
     538        if ( '/' != WP_CONTENT_DIR )
    539539            $theme_loc = str_replace(WP_CONTENT_DIR, '', $theme_root);
    540540
     
    552552                $stylish_dir = @ opendir($theme_root . '/' . $theme_dir);
    553553                $found_stylesheet = false;
    554                
     554
    555555                while ( ($theme_file = readdir($stylish_dir)) !== false ) {
    556556                    if ( $theme_file == 'style.css' ) {
     
    561561                }
    562562                @closedir($stylish_dir);
    563                
     563
    564564                if ( !$found_stylesheet ) { // look for themes in that dir
    565565                    $subdir = "$theme_root/$theme_dir";
    566566                    $subdir_name = $theme_dir;
    567567                    $theme_subdir = @ opendir( $subdir );
    568                    
     568
    569569                    while ( ($theme_dir = readdir($theme_subdir)) !== false ) {
    570570                        if ( is_dir( $subdir . '/' . $theme_dir) && is_readable($subdir . '/' . $theme_dir) ) {
    571571                            if ( $theme_dir{0} == '.' || $theme_dir == '..' || $theme_dir == 'CVS' )
    572572                                continue;
    573                                
     573
    574574                            $stylish_dir = @ opendir($subdir . '/' . $theme_dir);
    575575                            $found_stylesheet = false;
    576                            
     576
    577577                            while ( ($theme_file = readdir($stylish_dir)) !== false ) {
    578578                                if ( $theme_file == 'style.css' ) {
     
    586586                    }
    587587                    @closedir($theme_subdir);
    588                    
     588
    589589                    $wp_broken_themes[$theme_dir] = array('Name' => $theme_dir, 'Title' => $theme_dir, 'Description' => __('Stylesheet is missing.'));
    590590                }
     
    594594            @closedir( $theme_dir );
    595595    }
    596    
     596
    597597    return $theme_files;
    598598}
     
    611611function get_theme_root( $stylesheet_or_template = false ) {
    612612    $theme_roots = get_theme_roots();
    613    
     613
    614614    if ( $theme_roots[$stylesheet_or_template] )
    615615        $theme_root = WP_CONTENT_DIR . '/' . $theme_roots[$stylesheet_or_template];
     
    632632function get_theme_root_uri( $stylesheet_or_template = false ) {
    633633    $theme_roots = get_theme_roots();
    634    
     634
    635635    if ( $theme_roots[$stylesheet_or_template] )
    636636        $theme_root_uri = content_url( $theme_roots[$stylesheet_or_template] );
     
    737737 * trying tag ID, for example 'tag-1.php' and will finally fallback to tag.php
    738738 * template, if those files don't exist.
    739  * 
     739 *
    740740 * @since 2.3.0
    741741 * @uses apply_filters() Calls 'tag_template' on file path of tag template.
     
    754754        $templates[] = "tag-$tag_id.php";
    755755    $templates[] = "tag.php";
    756    
     756
    757757    $template = locate_template($templates);
    758758    return apply_filters('tag_template', $template);
Note: See TracChangeset for help on using the changeset viewer.