Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r14924 r15235  
    629629                        }
    630630                    }
    631                     @closedir($theme_subdir);
     631                    @closedir($theme_subdirs);
    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         if ( is_dir( $theme_dir ) )
    638             @closedir( $theme_dir );
     637        @closedir( $themes_dir );
    639638    }
    640639    return $theme_files;
     
    15371536    $background = get_background_image();
    15381537    $color = get_background_color();
    1539     if ( !$background && !$color )
     1538    if ( ! $background && ! $color )
    15401539        return;
    15411540
    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;';
     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;
    15541562    }
    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 = '';
    15811563?>
    15821564<style type="text/css">
    1583 body {
    1584     <?php echo $image; ?>
    1585     <?php echo $color; ?>
    1586     <?php echo $repeat; ?>
    1587     <?php echo $position; ?>
    1588     <?php echo $attachment; ?>
    1589 }
     1565body { <?php echo trim( $style ); ?> }
    15901566</style>
    15911567<?php
Note: See TracChangeset for help on using the changeset viewer.