Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r15235 r14924  
    629629                        }
    630630                    }
    631                     @closedir($theme_subdirs);
     631                    @closedir($theme_subdir);
    632632                    if ( !$found_subdir_themes )
    633633                        $wp_broken_themes[$theme_dir] = array('Name' => $theme_dir, 'Title' => $theme_dir, 'Description' => __('Stylesheet is missing.'));
     
    635635            }
    636636        }
    637         @closedir( $themes_dir );
     637        if ( is_dir( $theme_dir ) )
     638            @closedir( $theme_dir );
    638639    }
    639640    return $theme_files;
     
    15361537    $background = get_background_image();
    15371538    $color = get_background_color();
    1538     if ( ! $background && ! $color )
     1539    if ( !$background && !$color )
    15391540        return;
    15401541
    1541     $style = $color ? "background-color: #$color;" : '';
    1542 
    1543     if ( $background ) {
    1544         $image = " background-image: url('$background');";
    1545 
    1546         $repeat = get_theme_mod( 'background_repeat', 'repeat' );
    1547         if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) )
    1548             $repeat = 'repeat';
    1549         $repeat = " background-repeat: $repeat;";
    1550 
    1551         $position = get_theme_mod( 'background_position_x', 'left' );
    1552         if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) )
    1553             $position = 'left';
    1554         $position = " background-position: top $position;";
    1555 
    1556         $attachment = get_theme_mod( 'background_attachment', 'scroll' );
    1557         if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) )
    1558             $attachment = 'scroll';
    1559         $attachment = " background-attachment: $attachment;";
    1560 
    1561         $style .= $image . $repeat . $position . $attachment;
     1542    switch ( get_theme_mod('background_repeat', 'repeat') ) {
     1543        case 'no-repeat':
     1544            $repeat = 'background-repeat: no-repeat;';
     1545            break;
     1546        case 'repeat-x':
     1547            $repeat = 'background-repeat: repeat-x;';
     1548            break;
     1549        case 'repeat-y':
     1550            $repeat = 'background-repeat: repeat-y;';
     1551            break;
     1552        default:
     1553            $repeat = 'background-repeat: repeat;';
    15621554    }
     1555
     1556    switch ( get_theme_mod('background_position_x', 'left') ) {
     1557        case 'center':
     1558            $position = 'background-position: top center;';
     1559            break;
     1560        case 'right':
     1561            $position = 'background-position: top right;';
     1562            break;
     1563        default:
     1564            $position = 'background-position: top left;';
     1565    }
     1566
     1567    if ( 'scroll' == get_theme_mod('background_attachment', 'fixed') )
     1568        $attachment = 'background-attachment: scroll;';
     1569    else
     1570        $attachment = 'background-attachment: fixed;';
     1571
     1572    if ( !empty($background ) )
     1573        $image = "background-image: url('$background');";
     1574    else
     1575        $image = '';
     1576
     1577    if ( !empty($color) )
     1578        $color = "background-color: #$color;";
     1579    else
     1580        $color = '';
    15631581?>
    15641582<style type="text/css">
    1565 body { <?php echo trim( $style ); ?> }
     1583body {
     1584    <?php echo $image; ?>
     1585    <?php echo $color; ?>
     1586    <?php echo $repeat; ?>
     1587    <?php echo $position; ?>
     1588    <?php echo $attachment; ?>
     1589}
    15661590</style>
    15671591<?php
Note: See TracChangeset for help on using the changeset viewer.